diff --git a/build_release_macos.sh b/build_release_macos.sh
index cdc5dbbe3c..9eca2e7f40 100755
--- a/build_release_macos.sh
+++ b/build_release_macos.sh
@@ -47,7 +47,7 @@ while getopts ":dpa:snt:xbc:i:j:Tuh" opt; do
u )
export BUILD_TARGET="universal"
;;
- h ) echo "Usage: ./build_release_macos.sh [-d]"
+ h ) echo "Usage: ./build_release_macos.sh [-d] [-- CMAKE_ARGS...]"
echo " -d: Build deps only"
echo " -a: Set ARCHITECTURE (arm64 or x86_64 or universal)"
echo " -s: Build slicer only"
@@ -60,13 +60,33 @@ while getopts ":dpa:snt:xbc:i:j:Tuh" opt; do
echo " -i: Add a prefix to ignore during CMake dependency discovery (repeatable), defaults to /opt/local:/usr/local:/opt/homebrew"
echo " -j: Set the number of parallel build jobs (CMAKE_BUILD_PARALLEL_LEVEL)"
echo " -T: Build and run tests (set ORCA_TESTS_BUILD_ONLY=1 to build without running)"
+ echo " -- CMAKE_ARGS...: pass everything after '--' to the cmake configure step of the deps (-d) and slicer (-s) builds,"
+ echo " e.g. -DDESTDIR=
for the deps, -DCMAKE_PREFIX_PATH=/usr/local -DSLIC3R_PCH=OFF for the slicer, --fresh."
+ echo " They come last on the cmake command line. Use absolute paths: cmake runs in the build directory."
exit 0
;;
+ : )
+ echo "Option -${OPTARG} requires an argument, aborting."
+ exit 1
+ ;;
* )
+ echo "Unknown option -${OPTARG}, aborting. CMake arguments must follow '--'."
+ exit 1
;;
esac
done
+# getopts stops at '--'; whatever follows is handed to cmake unchanged.
+if [[ ${OPTIND} -le $# ]] ; then
+ separator_index=$((OPTIND-1))
+ if [[ "${!separator_index}" != "--" ]] ; then
+ echo "Unexpected argument '${!OPTIND}': cmake arguments must follow '--', aborting."
+ exit 1
+ fi
+fi
+shift $((OPTIND-1))
+EXTRA_CMAKE_ARGS=("$@")
+
# Set defaults
if [ -z "$ARCH" ]; then
@@ -211,7 +231,8 @@ function build_deps() {
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
-DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \
"${CMAKE_CCACHE_ARGS[@]}" \
- ${CMAKE_POLICY_COMPAT}
+ ${CMAKE_POLICY_COMPAT} \
+ "${EXTRA_CMAKE_ARGS[@]}"
fi
cmake --build . --config "$BUILD_CONFIG" --target deps
)
@@ -314,7 +335,8 @@ function build_slicer() {
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
-DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \
"${CMAKE_CCACHE_ARGS[@]}" \
- ${CMAKE_POLICY_COMPAT}
+ ${CMAKE_POLICY_COMPAT} \
+ "${EXTRA_CMAKE_ARGS[@]}"
fi
cmake --build . --config "$BUILD_CONFIG" --target "$SLICER_BUILD_TARGET"
)