Skip to content

Commit

Permalink
updated BuildMacOS.sh to support XCode builds
Browse files Browse the repository at this point in the history
updated Qhull.cmake to add patch to the imported Qhull CMakeLists.txt so that it creates correctly named debug libraries.
#3173
  • Loading branch information
nanoplane authored and supermerill committed Apr 25, 2023
1 parent 18877dc commit 2e6c5e3
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
18 changes: 14 additions & 4 deletions BuildMacOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -157,18 +161,24 @@ 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"

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
Expand Down
9 changes: 9 additions & 0 deletions deps/Qhull/Qhull.cmake
Original file line number Diff line number Diff line change
@@ -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 ()
33 changes: 33 additions & 0 deletions deps/Qhull/Qhull.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2e6c5e3

Please sign in to comment.