[libcxx-commits] [PATCH] D102083: [libc++] Use Xcode's CMake if it's present

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 8 04:41:00 PDT 2021


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc42007e266a3: [libc++] Use Xcode's CMake if it's present (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102083/new/

https://reviews.llvm.org/D102083

Files:
  libcxx/utils/ci/run-buildbot


Index: libcxx/utils/ci/run-buildbot
===================================================================
--- libcxx/utils/ci/run-buildbot
+++ libcxx/utils/ci/run-buildbot
@@ -64,12 +64,12 @@
 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
 INSTALL_DIR="${BUILD_DIR}/install"
 
-# 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="$(which ninja)"
-else
-    NINJA="$(xcrun --find ninja)"
-fi
+# If we can find Ninja/CMake provided by Xcode, use those since we know their
+# version will generally work with the Clang shipped in Xcode (e.g. if Clang
+# knows about -std=c++20, the CMake bundled in Xcode will probably know about
+# that flag too).
+if xcrun --find ninja &>/dev/null; then NINJA="$(xcrun --find ninja)"; else NINJA="ninja"; fi
+if xcrun --find cmake &>/dev/null; then CMAKE="$(xcrun --find cmake)"; else CMAKE="cmake"; fi
 
 function clean() {
     rm -rf "${BUILD_DIR}"
@@ -77,7 +77,7 @@
 
 function generate-cmake-base() {
     echo "--- Generating CMake"
-    cmake \
+    ${CMAKE} \
           -B "${BUILD_DIR}" \
           -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -141,7 +141,7 @@
 }
 
 # Print the version of a few tools to aid diagnostics in some cases
-cmake --version
+${CMAKE} --version
 ${NINJA} --version
 
 case "${BUILDER}" in
@@ -403,7 +403,8 @@
     clean
 
     echo "--- Generating CMake"
-    cmake -S "${MONOREPO_ROOT}/libcxx/utils/ci/runtimes" \
+    ${CMAKE} \
+          -S "${MONOREPO_ROOT}/libcxx/utils/ci/runtimes" \
           -B "${BUILD_DIR}" \
           -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -419,9 +420,10 @@
     clean
 
     echo "--- Generating CMake"
-    cmake -S "${MONOREPO_ROOT}/llvm" \
+    ${CMAKE} \
+          -S "${MONOREPO_ROOT}/llvm" \
           -B "${BUILD_DIR}" \
-          -GNinja \
+          -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
           -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
           -DLLVM_ENABLE_PROJECTS="clang" \
@@ -441,7 +443,8 @@
     clean
 
     echo "--- Generating CMake"
-    cmake -S "${MONOREPO_ROOT}/libcxx" \
+    ${CMAKE} \
+          -S "${MONOREPO_ROOT}/libcxx" \
           -B "${BUILD_DIR}/libcxx" \
           -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -451,7 +454,8 @@
           -DLIBCXX_CXX_ABI_INCLUDE_PATHS="${MONOREPO_ROOT}/libcxxabi/include" \
           -DLIBCXX_CXX_ABI_LIBRARY_PATH="${BUILD_DIR}/libcxxabi/lib"
 
-    cmake -S "${MONOREPO_ROOT}/libcxxabi" \
+    ${CMAKE} \
+          -S "${MONOREPO_ROOT}/libcxxabi" \
           -B "${BUILD_DIR}/libcxxabi" \
           -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
           -DCMAKE_BUILD_TYPE=RelWithDebInfo \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102083.343829.patch
Type: text/x-patch
Size: 2875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210508/0763f377/attachment-0001.bin>


More information about the libcxx-commits mailing list