Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Dec 20, 2021
2 parents 3e9d41f + 7b6b4b0 commit ab4d1ca
Show file tree
Hide file tree
Showing 42 changed files with 590 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
build:

runs-on: macos-latest
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/ccpp_mac_arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: C/C++ debug arm macos

on:
push:
branches:
- Nigthly

jobs:
build:

runs-on: macos-11

steps:
- uses: actions/checkout@v2
with:
ref: 'debug_macos'
- name: build deps & slicer
run: ./BuildMacOS.sh -ia
- name: Upload artifact
uses: actions/[email protected]
with:
name: nightly_macos_arm_debug.dmg
path: build/${{ github.event.repository.name }}.dmg
- name: Upload artifact
uses: actions/[email protected]
with:
name: nightly_arm_macos.tar
path: build/${{ github.event.repository.name }}.tar
31 changes: 31 additions & 0 deletions .github/workflows/ccpp_mac_arm_debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: C/C++ debug arm macos

on:
push:
branches:
- debug_macos

jobs:
build:

runs-on: macos-11

steps:
- uses: actions/checkout@v2
with:
ref: 'debug_macos'
- name: build deps & slicer
run: ./BuildMacOS.sh -bia
- name: ls build
working-directory: ./build
run: ls
- name: Upload artifact
uses: actions/[email protected]
with:
name: nightly_macos_arm_debug.dmg
path: build/${{ github.event.repository.name }}.dmg
- name: Upload artifact
uses: actions/[email protected]
with:
name: nightly_arm_macos.tar
path: build/${{ github.event.repository.name }}.tar
98 changes: 8 additions & 90 deletions .github/workflows/ccpp_mac_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,104 +10,22 @@ jobs:

runs-on: macos-latest

env:
EXEC_NAME: "${{ github.event.repository.name }}"
DBL_NAME: "${{ github.event.repository.name }}/${{ github.event.repository.name }}"
steps:
- uses: actions/checkout@v2
with:
ref: 'debug_macos'
- name: update submodule profiles
working-directory: ./resources/profiles
run: git submodule update --init
- id: lowercase_repo
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.event.repository.name }}
- name: set exec name
if: ${{ github.event.repository.name != 'Slic3r' }}
uses: allenevans/[email protected]
with:
EXEC_NAME: "${{ steps.lowercase_repo.outputs.lowercase }}"
- name: change date in version
run: |
sed "s/+UNKNOWN/_$(date '+%F')/" version.inc > version.date.inc
mv version.date.inc version.inc
- name: mkdir in deps
run: mkdir deps/build
- name: cmake deps
working-directory: ./deps/build
run: cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13"
- name: make deps
working-directory: ./deps/build
run: make
- name: ls libs
working-directory: ./deps/build
run: ls ./destdir/usr/local/lib
- name: rename wxscintilla
working-directory: ./deps/build/destdir/usr/local/lib
run: cp libwxscintilla-3.1.a libwx_osx_cocoau_scintilla-3.1.a
- name: ls libs
working-directory: ./deps/build
run: ls ./destdir/usr/local/lib
- name: clean deps
working-directory: ./deps/build
run: rm -rf dep_*
- name: mkdir build
run: mkdir build
- name: cmake
working-directory: ./build
run: cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DSLIC3R_STATIC=1
- name: make ${{ github.event.repository.name }}
working-directory: ./build
run: make Slic3r
- name: make .mo
working-directory: ./build
run: make gettext_po_to_mo
- name: update Info.plist
working-directory: ./build/src
run: sed "s/+UNKNOWN/_$(date '+%F')/" Info.plist >Info.date.plist
- name: create directory and copy into it
working-directory: ./build
run: |
mkdir pack
mkdir pack/${{ github.event.repository.name }}
mkdir pack/${{ env.DBL_NAME }}.app
mkdir pack/${{ env.DBL_NAME }}.app/Contents
mkdir pack/${{ env.DBL_NAME }}.app/Contents/_CodeSignature
mkdir pack/${{ env.DBL_NAME }}.app/Contents/Frameworks
mkdir pack/${{ env.DBL_NAME }}.app/Contents/MacOS
- name: copy Resources
working-directory: ./build
run: |
cp -Rf ../resources pack/${{ env.DBL_NAME }}.app/Contents/Resources
cp pack/${{ env.DBL_NAME }}.app/Contents/Resources/icons/${{ github.event.repository.name }}.icns pack/${{ github.event.repository.name }}/${{ github.event.repository.name }}.app/Contents/resources/${{ github.event.repository.name }}.icns
cp src/Info.date.plist pack/${{ github.event.repository.name }}/${{ github.event.repository.name }}.app/Contents/Info.plist
echo -n -e 'APPL????\x0a' > PkgInfo
cp PkgInfo pack/${{ env.DBL_NAME }}.app/Contents/PkgInfo
# echo -n -e '\xff\xfeAPPL\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x0a\x00' > PkgInfo
- name: copy bin and do not let it lower case
working-directory: ./build
run: |
cp -f src/${{ env.EXEC_NAME }} pack/${{ env.DBL_NAME }}.app/Contents/MacOS/${{ github.event.repository.name }}
chmod u+x pack/${{ env.DBL_NAME }}.app/Contents/MacOS/${{ github.event.repository.name }}
tar -cvf ${{ github.event.repository.name }}.tar pack/${{ github.event.repository.name }}
- name: create dmg
- name: build deps & slicer
run: ./BuildMacOS.sh -bi
- name: tar the pack
working-directory: ./build
run: |
hdiutil create -ov -fs HFS+ -volname "${{ github.event.repository.name }}" -srcfolder "pack/${{ github.event.repository.name }}" temp.dmg
hdiutil convert temp.dmg -format UDZO -o ${{ github.event.repository.name }}.dmg
# - name: signing Resources (creating CodeResources inside _CodeSignature)
# working-directory: .
# run: codesign -s <identity> Resources
# maybe i should just try to do that on a separate pc and copy the file here, more secure as a signing process.
run: ls
- name: Upload artifact
uses: actions/[email protected]
with:
name: nightly_macos.tar
path: build/${{ github.event.repository.name }}.tar
name: nightly_macos_debug.dmg
path: build/${{ github.event.repository.name }}.dmg
- name: Upload artifact
uses: actions/[email protected]
with:
name: nightly_macos_debug.dmg
path: build/${{ github.event.repository.name }}.dmg
name: nightly_macos.tar
path: build/${{ github.event.repository.name }}.tar
72 changes: 60 additions & 12 deletions BuildMacOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export ROOT=`pwd`
export NCORES=`sysctl -n hw.ncpu`
export CMAKE_INSTALLED=`which cmake`
#export ARCH=$(uname -m)

# Check if CMake is installed
if [[ -z "$CMAKE_INSTALLED" ]]
Expand All @@ -11,18 +12,32 @@ then
exit -1
fi

while getopts ":ih" opt; do
while getopts ":iaxbh" opt; do
case ${opt} in
i )
export BUILD_IMAGE="1"
;;
a )
export BUILD_ARCH="arm64"
;;
x )
export BUILD_ARCH="x86_64"
;;
b )
export BUILD_DEBUG="1"
;;
h ) echo "Usage: ./BuildMacOS.sh [-i]"
echo " -i: Generate DMG image (optional)"
echo " -a: Build for arm64 (Apple Silicon)"
echo " -x: Build for x86_64 (Intel)"
echo " -b: Build with debug symbols"
exit 0
;;
esac
done

echo "Build architecture: ${BUILD_ARCH}"

# mkdir build
if [ ! -d "build" ]
then
Expand All @@ -35,15 +50,15 @@ echo -n "[1/9] Updating submodules..."
pushd resources/profiles
git submodule update --init
popd
} > $ROOT/build/Build.log # Capture all command output
} #> $ROOT/build/Build.log # Capture all command output
echo "done"

echo -n "[2/9] Changing date in version..."
{
# change date in version
sed "s/+UNKNOWN/_$(date '+%F')/" version.inc > version.date.inc
mv version.date.inc version.inc
} &> $ROOT/build/Build.log # Capture all command output
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

# mkdir in deps
Expand All @@ -54,42 +69,68 @@ fi

echo -n "[3/9] Configuring dependencies..."
{
BUILD_ARGS=""
if [[ -n "$BUILD_ARCH" ]]
then
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_OSX_ARCHITECTURES:STRING=${BUILD_ARCH}"
fi
if [[ -n "$BUILD_DEBUG" ]]
then
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
fi
# cmake deps
echo "Cmake command: cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.13\" ${BUILD_ARCH} "
pushd deps/build
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13"
} &> $ROOT/build/Build.log # Capture all command output
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" $BUILD_ARGS
echo "ls deps/build:"
ls -al
echo "ls deps/build/dep_GLEW-prefix"
ls -al dep_GLEW-prefix
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

echo -n "[4/9] Building dependencies..."
{
# make deps
make -j$NCORES
} &> $ROOT/build/Build.log # Capture all command output
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

echo -n "[5/9] Renaming wxscintilla library..."
{
# rename wxscintilla
pushd destdir/usr/local/lib
cp libwxscintilla-3.1.a libwx_osx_cocoau_scintilla-3.1.a
echo "ls deps/build/destdir/usr/local/lib"
ls -al
popd
} &> $ROOT/build/Build.log # Capture all command output
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

echo -n "[6/9] Cleaning dependencies..."
{
# clean deps
rm -rf dep_*
popd
} &> $ROOT/build/Build.log # Capture all command output
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

echo -n "[7/9] Configuring Slic3r..."
{
BUILD_ARGS=""
if [[ -n "$BUILD_ARCH" ]]
then
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_OSX_ARCHITECTURES=${BUILD_ARCH}"
fi
if [[ -n "$BUILD_DEBUG" ]]
then
BUILD_ARGS="-DCMAKE_BUILD_TYPE=Debug ${BUILD_ARGS}"
fi
# cmake
pushd build
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DSLIC3R_STATIC=1
} &> $ROOT/build/Build.log # Capture all command output
echo "Cmake command: cmake .. -DCMAKE_PREFIX_PATH=\"$PWD/../deps/build/destdir/usr/local\" -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.13\" -DSLIC3R_STATIC=1 ${BUILD_ARGS}"
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DSLIC3R_STATIC=1 ${BUILD_ARGS}
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

echo -n "[8/9] Building Slic3r..."
Expand All @@ -99,9 +140,14 @@ echo -n "[8/9] Building Slic3r..."

# make .mo
make gettext_po_to_mo
} &> $ROOT/build/Build.log # Capture all command output
} #&> $ROOT/build/Build.log # Capture all command output
echo "done"

echo "ls ROOT"
ls $ROOT
echo "ls ROOT/build"
ls $ROOT/build
echo "ls -al ROOT/build/src"
ls -al $ROOT/build/src
# Give proper permissions to script
chmod 755 $ROOT/build/src/BuildMacOSImage.sh

Expand All @@ -111,3 +157,5 @@ then
else
$ROOT/build/src/BuildMacOSImage.sh
fi
echo "ls -al ROOT/build"
ls -al $ROOT/build
19 changes: 18 additions & 1 deletion deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(DEP_WX_GTK3 "Build wxWidgets against GTK3" OFF)
endif()

set(IS_CROSS_COMPILE FALSE)

if (APPLE)
set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST)
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
if (CMAKE_OSX_ARCHITECTURES AND _arch_idx LESS 0)
set(IS_CROSS_COMPILE TRUE)
string(REPLACE ";" "$<SEMICOLON>" CMAKE_OSX_ARCHS "${CMAKE_OSX_ARCHITECTURES}")
set(_cmake_osx_arch -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHS})
set(_cmake_args_osx_arch CMAKE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHS})
message("Detect Cross-compilation. Will build for target ${CMAKE_OSX_ARCHS}" )
endif ()
endif ()

# On developer machines, it can be enabled to speed up compilation and suppress warnings coming from IGL.
# FIXME:
# Enabling this option is not safe. IGL will compile itself with its own version of Eigen while
Expand All @@ -61,7 +76,7 @@ function(prusaslicer_add_cmake_project projectname)

set(_gen "")
set(_build_j "-j${NPROC}")
if (MSVC)
if (MSVC)
set(_gen CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}")
set(_build_j "/m")
endif ()
Expand All @@ -79,6 +94,7 @@ if (MSVC)
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DBUILD_SHARED_LIBS:BOOL=OFF
${_cmake_osx_arch}
"${_configs_line}"
${DEP_CMAKE_OPTS}
${P_ARGS_CMAKE_ARGS}
Expand Down Expand Up @@ -181,6 +197,7 @@ if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
DEPENDS dep_boost
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
${_cmake_args_osx_arch}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_BINARY_DIR}/dep_boost_polygon-prefix/src/dep_boost_polygon/include/boost/polygon"
"${DESTDIR}/usr/local/include/boost/polygon"
Expand Down
Loading

0 comments on commit ab4d1ca

Please sign in to comment.