From 2e6c5e3310144561dd79f5a68a50170436ccbd33 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 1 Sep 2022 08:28:19 -0700 Subject: [PATCH] updated BuildMacOS.sh to support XCode builds updated Qhull.cmake to add patch to the imported Qhull CMakeLists.txt so that it creates correctly named debug libraries. supermerill/SuperSlicer#3173 --- BuildMacOS.sh | 18 ++++++++++++++---- deps/Qhull/Qhull.cmake | 9 +++++++++ deps/Qhull/Qhull.patch | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 deps/Qhull/Qhull.patch diff --git a/BuildMacOS.sh b/BuildMacOS.sh index 6aa0ff2c198..d6d1fd086fd 100755 --- a/BuildMacOS.sh +++ b/BuildMacOS.sh @@ -12,7 +12,7 @@ then exit -1 fi -while getopts ":iaxbh" opt; do +while getopts ":iaxbhc" opt; do case ${opt} in i ) export BUILD_IMAGE="1" @@ -26,11 +26,15 @@ while getopts ":iaxbh" opt; do b ) export BUILD_DEBUG="1" ;; + c) + export BUILD_XCODE="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" + echo " -c: Build for XCode" exit 0 ;; esac @@ -157,9 +161,13 @@ echo -n "[7/9] Configuring Slic3r..." then BUILD_ARGS="-DCMAKE_BUILD_TYPE=Debug ${BUILD_ARGS}" fi + if [[ -n "$BUILD_XCODE" ]] + then + BUILD_ARGS="-GXcode ${BUILD_ARGS}" + fi # cmake pushd build - echo "Cmake command: cmake .. -DCMAKE_PREFIX_PATH=\"$PWD/../deps/build/destdir/usr/local\" -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.14\" -DSLIC3R_STATIC=1 ${BUILD_ARGS}" + echo "Slic3r Cmake command: cmake .. -DCMAKE_PREFIX_PATH=\"$PWD/../deps/build/destdir/usr/local\" -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.14\" -DSLIC3R_STATIC=1 ${BUILD_ARGS}" cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" -DSLIC3R_STATIC=1 ${BUILD_ARGS} } #&> $ROOT/build/Build.log # Capture all command output echo "done" @@ -167,8 +175,10 @@ echo "done" echo -n "[8/9] Building Slic3r..." { # make Slic3r - make -j$NCORES Slic3r - + if [[ -z "$BUILD_XCODE" ]] + then + make -j$NCORES Slic3r + fi # make .mo make gettext_po_to_mo } #&> $ROOT/build/Build.log # Capture all command output diff --git a/deps/Qhull/Qhull.cmake b/deps/Qhull/Qhull.cmake index fedec550c1a..b363ef85195 100644 --- a/deps/Qhull/Qhull.cmake +++ b/deps/Qhull/Qhull.cmake @@ -1,11 +1,20 @@ include(GNUInstallDirs) + +set(_patch_step "") +if (APPLE) + set(_patch_step PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/Qhull.patch) +endif () + + prusaslicer_add_cmake_project(Qhull URL "https://github.com/qhull/qhull/archive/v8.0.1.zip" URL_HASH SHA256=5287f5edd6a0372588f5d6640799086a4033d89d19711023ef8229dd9301d69b + "${_patch_step}" CMAKE_ARGS -DINCLUDE_INSTALL_DIR=${CMAKE_INSTALL_INCLUDEDIR} ) + if (MSVC) add_debug_dep(dep_Qhull) endif () \ No newline at end of file diff --git a/deps/Qhull/Qhull.patch b/deps/Qhull/Qhull.patch new file mode 100644 index 00000000000..75ea10d7900 --- /dev/null +++ b/deps/Qhull/Qhull.patch @@ -0,0 +1,33 @@ +--- CMakeLists.txt 2020-08-04 20:37:02.000000000 -0700 ++++ CMakeLists.txt 2022-08-14 12:02:28.000000000 -0700 +@@ -339,21 +339,21 @@ + + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) + +-if(CMAKE_BUILD_TYPE MATCHES "[dD]ebug") +- set(qhull_CPP qhullcpp_d) +- set(qhull_SHARED qhull_d) +- set(qhull_SHAREDP qhull_pd) +- set(qhull_SHAREDR qhull_rd) +- set(qhull_STATIC qhullstatic_d) +- set(qhull_STATICR qhullstatic_rd) +-else() ++#if(CMAKE_BUILD_TYPE MATCHES "[dD]ebug") ++# set(qhull_CPP qhullcpp_d) ++# set(qhull_SHARED qhull_d) ++# set(qhull_SHAREDP qhull_pd) ++# set(qhull_SHAREDR qhull_rd) ++# set(qhull_STATIC qhullstatic_d) ++# set(qhull_STATICR qhullstatic_rd) ++#else() + set(qhull_CPP qhullcpp) + set(qhull_SHARED libqhull) # Temporarily avoid name conflict with qhull executable + set(qhull_SHAREDP qhull_p) + set(qhull_SHAREDR qhull_r) + set(qhull_STATIC qhullstatic) + set(qhull_STATICR qhullstatic_r) +-endif() ++#endif() + + set( + qhull_TARGETS_INSTALL