[libc++] Allow running CI on macOS when Ninja isn't installed outside of Xcode
authorLouis Dionne <ldionne.2@gmail.com>
Fri, 26 Feb 2021 17:13:51 +0000 (12:13 -0500)
committerLouis Dionne <ldionne.2@gmail.com>
Fri, 26 Feb 2021 17:15:12 +0000 (12:15 -0500)
Xcode does bundle Ninja, so we can use that Ninja if there's no system-wide
Ninja installed. This is useful on some CI bots we have that don't come
with Ninja pre-installed.

libcxx/utils/ci/run-buildbot

index 56ece02..09ddd65 100755 (executable)
@@ -67,9 +67,13 @@ function clean() {
 
 function generate-cmake() {
     echo "--- Generating CMake"
+    # On macOS, fall back to using the Ninja provided with Xcode if no other
+    # Ninja can be found.
+    if which ninja &>/dev/null; then ninja_path="$(which ninja)"; else ninja_path="$(xcrun --find ninja)"; fi
     cmake -S "${MONOREPO_ROOT}/llvm" \
           -B "${BUILD_DIR}" \
           -GNinja \
+          -DCMAKE_MAKE_PROGRAM="${ninja_path}" \
           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
           -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
           -DLLVM_ENABLE_PROJECTS="libcxx;libunwind;libcxxabi" \