[libcxx-commits] [libcxx] c42007e - [libc++] Use Xcode's CMake if it's present
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Sat May 8 04:40:44 PDT 2021
Author: Louis Dionne
Date: 2021-05-08T07:40:35-04:00
New Revision: c42007e266a38374f705564225dc35c5aacba7f4
URL: https://github.com/llvm/llvm-project/commit/c42007e266a38374f705564225dc35c5aacba7f4
DIFF: https://github.com/llvm/llvm-project/commit/c42007e266a38374f705564225dc35c5aacba7f4.diff
LOG: [libc++] Use Xcode's CMake if it's present
This resolves issues when the CMake in use on the host is too old to
configure libc++ properly, but Xcode has a sufficiently recent version.
It is technically possible for the reverse issue to happen, where the
Xcode version would be too old and the user-installed version would be
better, however in the context of our build bots, we use AppleClang on
Apple platforms, and the CMake shipped with Xcode should work with the
AppleClang shipped alongside that Xcode.
Differential Revision: https://reviews.llvm.org/D102083
Added:
Modified:
libcxx/utils/ci/run-buildbot
Removed:
################################################################################
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index baf4707c3169d..c781310d88f33 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -64,12 +64,12 @@ MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
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 clean() {
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 @@ function check-cxx-benchmarks() {
}
# 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 @@ unified-standalone)
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 @@ runtimes-build)
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 @@ legacy-standalone)
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 @@ legacy-standalone)
-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 \
More information about the libcxx-commits
mailing list