From c34ae1f34a1bf8cecf80e36105fe1133607f1bd6 Mon Sep 17 00:00:00 2001 From: Adam Robinson Date: Fri, 23 Oct 2026 18:47:59 -0400 Subject: [PATCH] build: check for ninja in macOS script (#14494) With -x, build_release_macos.sh now stops before the CMake configure step if ninja is not on PATH, and tells the user to run `brew install ninja`. The -x help text now says Ninja is required. --- build_release_macos.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build_release_macos.sh b/build_release_macos.sh index 9eca2e7f40..c5fd2b9a7c 100755 --- a/build_release_macos.sh +++ b/build_release_macos.sh @@ -54,7 +54,7 @@ while getopts ":dpa:snt:xbc:i:j:Tuh" opt; do echo " -u: Build universal app only (requires existing arm64 and x86_64 app bundles)" echo " -n: Nightly build" echo " -t: Specify minimum version of the target platform, default is 12.0" - echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode" + echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode (requires ninja; install with 'brew install ninja')" echo " -b: Build without reconfiguring CMake" echo " -c: Set CMake build configuration, default is Release" echo " -i: Add a prefix to ignore during CMake dependency discovery (repeatable), defaults to /opt/local:/usr/local:/opt/homebrew" @@ -122,6 +122,12 @@ if [ -z "$CMAKE_IGNORE_PREFIX_PATH" ]; then export CMAKE_IGNORE_PREFIX_PATH="/opt/local:/usr/local:/opt/homebrew" fi +if [[ "$SLICER_CMAKE_GENERATOR" == Ninja* || "$DEPS_CMAKE_GENERATOR" == Ninja* ]] && ! command -v ninja >/dev/null 2>&1; then + echo "Error: Ninja is required when using the -x generator option." + echo "Install it with Homebrew: brew install ninja" + exit 1 +fi + CMAKE_VERSION=$(cmake --version | head -1 | sed 's/[^0-9]*\([0-9]*\).*/\1/') if [ "$CMAKE_VERSION" -ge 4 ] 2>/dev/null; then export CMAKE_POLICY_VERSION_MINIMUM=3.10