| #!/usr/bin/env bash |
| #===----------------------------------------------------------------------===## |
| # |
| # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| # |
| #===----------------------------------------------------------------------===## |
| |
| set -ex |
| set -o pipefail |
| unset LANG |
| unset LC_ALL |
| unset LC_COLLATE |
| |
| PROGNAME="$(basename "${0}")" |
| |
| function usage() { |
| cat <<EOF |
| Usage: |
| ${PROGNAME} [options] <BUILDER> |
| |
| [-h|--help] Display this help and exit. |
| |
| --llvm-root <DIR> Path to the root of the LLVM monorepo. By default, we try |
| to figure it out based on the current working directory. |
| |
| --build-dir <DIR> The directory to use for building the library. By default, |
| this is '<llvm-root>/build/<builder>'. |
| |
| --osx-roots <DIR> Path to pre-downloaded macOS dylibs. By default, we download |
| them from Green Dragon. This is only relevant at all when |
| running back-deployment testing if one wants to override |
| the old dylibs we use to run the tests with different ones. |
| Environment variables |
| CC The C compiler to use, this value is used by CMake. This |
| variable is optional. |
| |
| CXX The C++ compiler to use, this value is used by CMake. This |
| variable is optional. |
| |
| CMAKE The CMake binary to use. This variable is optional. |
| |
| CLANG_FORMAT The clang-format binary to use when generating the format |
| ignore list. |
| |
| GIT_CLANG_FORMAT The git-clang-format binary to use in the 'format' builder. |
| When the value is omitted, it defaults to |
| 'git-clang-format'. This variable or its fallback must work |
| when running the 'format' builder. |
| |
| ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable |
| is optional. |
| |
| ENABLE_STD_MODULES Whether to enable or disable building the C++23 std |
| modules. This variable is optional. |
| TODO MODULES remove when all supported compilers support |
| modules. |
| |
| EOF |
| } |
| |
| if [[ $# == 0 ]]; then |
| usage |
| exit 0 |
| fi |
| |
| while [[ $# -gt 0 ]]; do |
| case ${1} in |
| -h|--help) |
| usage |
| exit 0 |
| ;; |
| --llvm-root) |
| MONOREPO_ROOT="${2}" |
| shift; shift |
| ;; |
| --build-dir) |
| BUILD_DIR="${2}" |
| shift; shift |
| ;; |
| --osx-roots) |
| OSX_ROOTS="${2}" |
| shift; shift |
| ;; |
| *) |
| BUILDER="${1}" |
| shift |
| ;; |
| esac |
| done |
| |
| MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}" |
| BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}" |
| INSTALL_DIR="${BUILD_DIR}/install" |
| |
| # 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)" |
| elif which ninja &>/dev/null; then |
| # The current implementation of modules needs the absolute path to the ninja |
| # binary. |
| # TODO MODULES Is this still needed when CMake has libc++ module support? |
| NINJA="$(which ninja)" |
| else |
| NINJA="ninja" |
| fi |
| |
| if [ -z "${CMAKE}" ]; then |
| if xcrun --find cmake &>/dev/null; then |
| CMAKE="$(xcrun --find cmake)" |
| else |
| CMAKE="cmake" |
| fi |
| fi |
| |
| function clean() { |
| rm -rf "${BUILD_DIR}" |
| } |
| |
| if [ -z "${ENABLE_CLANG_TIDY}" ]; then |
| ENABLE_CLANG_TIDY=Off |
| fi |
| |
| if [ -n "${ENABLE_STD_MODULES}" ]; then |
| ENABLE_STD_MODULES="-DLIBCXX_ENABLE_STD_MODULES=${ENABLE_STD_MODULES}" |
| fi |
| |
| function generate-cmake-base() { |
| echo "--- Generating CMake" |
| ${CMAKE} \ |
| -S "${MONOREPO_ROOT}/runtimes" \ |
| -B "${BUILD_DIR}" \ |
| -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| -DLIBCXX_ENABLE_WERROR=YES \ |
| -DLIBCXXABI_ENABLE_WERROR=YES \ |
| -DLIBUNWIND_ENABLE_WERROR=YES \ |
| -DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \ |
| ${ENABLE_STD_MODULES} \ |
| -DLLVM_LIT_ARGS="-v --show-unsupported --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \ |
| "${@}" |
| } |
| |
| function generate-cmake() { |
| generate-cmake-base \ |
| -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ |
| -DLIBCXX_CXX_ABI=libcxxabi \ |
| "${@}" |
| } |
| |
| function generate-cmake-libcxx-win() { |
| generate-cmake-base \ |
| -DLLVM_ENABLE_RUNTIMES="libcxx" \ |
| -DCMAKE_C_COMPILER=clang-cl \ |
| -DCMAKE_CXX_COMPILER=clang-cl \ |
| "${@}" |
| } |
| |
| function check-runtimes() { |
| echo "--- Installing libc++, libc++abi and libunwind to a fake location" |
| ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind |
| |
| echo "+++ Running the libc++ tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| |
| echo "+++ Running the libc++abi tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxxabi |
| |
| echo "+++ Running the libunwind tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-unwind |
| } |
| |
| # TODO: The goal is to test this against all configurations. We should also move |
| # this to the Lit test suite instead of being a separate CMake target. |
| function check-abi-list() { |
| echo "+++ Running the libc++ ABI list test" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || ( |
| echo "+++ Generating the libc++ ABI list after failed check" |
| ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist |
| false |
| ) |
| } |
| |
| function check-cxx-benchmarks() { |
| echo "--- Running the benchmarks" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks |
| } |
| |
| # Print the version of a few tools to aid diagnostics in some cases |
| ${CMAKE} --version |
| ${NINJA} --version |
| |
| if [ ! -z "${CXX}" ]; then ${CXX} --version; fi |
| |
| case "${BUILDER}" in |
| check-format) |
| clean |
| echo "+++ Checking formatting" |
| # We need to set --extensions so that clang-format checks extensionless files. |
| mkdir -p ${BUILD_DIR} |
| if [ -z "${GIT_CLANG_FORMAT}" ]; then |
| GIT_CLANG_FORMAT=git-clang-format |
| fi |
| ${GIT_CLANG_FORMAT} \ |
| --diff \ |
| --extensions ',h,hpp,c,cpp,cppm,inc,ipp' HEAD~1 \ |
| -- $(find libcxx/{benchmarks,include,modules,src} -type f | grep -vf libcxx/utils/data/ignore_format.txt) \ |
| | tee ${BUILD_DIR}/clang-format.patch |
| # Check if the diff is empty, fail otherwise. |
| ! grep -q '^--- a' ${BUILD_DIR}/clang-format.patch |
| ;; |
| check-generated-output) |
| # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead. |
| # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not |
| clean |
| generate-cmake |
| |
| # Reject patches that forgot to re-run the generator scripts. |
| echo "+++ Making sure the generator scripts were run" |
| ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files |
| git diff | tee ${BUILD_DIR}/generated_output.patch |
| git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status |
| ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false |
| if [ -s ${BUILD_DIR}/generated_output.status ]; then |
| echo "It looks like not all the generator scripts were run," |
| echo "did you forget to build the libcxx-generate-files target?" |
| echo "Did you add all new files it generated?" |
| false |
| fi |
| |
| ${MONOREPO_ROOT}/libcxx/utils/generate_ignore_format.sh |
| git diff | tee ${BUILD_DIR}/generated_output.patch |
| git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status |
| ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false |
| if [ -s ${BUILD_DIR}/generated_output.status ]; then |
| echo "It looks like the list of not formatted files has changed." |
| echo "If a file is now properly formatted with clang-format, remove the file name from " |
| echo "libcxx/utils/data/ignore_format.txt. Otherwise you have to fix the" |
| echo "formatting of some of the changed files." |
| false |
| fi |
| |
| # Reject patches that introduce non-ASCII characters or hard tabs. |
| # Depends on LC_COLLATE set at the top of this script. |
| ! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test libcxx/benchmarks \ |
| --exclude '*.dat' \ |
| --exclude '*unicode*.cpp' \ |
| --exclude '*print*.sh.cpp' \ |
| --exclude 'escaped_output.*.pass.cpp' \ |
| --exclude 'format_tests.h' \ |
| --exclude 'format.functions.tests.h' \ |
| --exclude 'formatter.*.pass.cpp' \ |
| --exclude 'grep.pass.cpp' \ |
| --exclude 'locale-specific_form.pass.cpp' \ |
| --exclude 'ostream.pass.cpp' \ |
| --exclude 'transcoding.pass.cpp' \ |
| --exclude 'underflow.pass.cpp' \ |
| || false |
| |
| # Reject code with trailing whitespace |
| ! grep -rn '[[:blank:]]$' libcxx/include libcxx/src libcxx/test libcxx/benchmarks || false |
| ;; |
| # |
| # Various Standard modes |
| # |
| generic-cxx03) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-cxx11) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-cxx14) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-cxx17) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-cxx20) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-cxx23) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-cxx26) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| # |
| # Other compiler support |
| # |
| generic-gcc) |
| clean |
| generate-cmake -DLIBCXX_ENABLE_WERROR=NO \ |
| -DLIBCXXABI_ENABLE_WERROR=NO \ |
| -DLIBUNWIND_ENABLE_WERROR=NO |
| check-runtimes |
| ;; |
| generic-gcc-cxx11) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \ |
| -DLIBCXX_ENABLE_WERROR=NO \ |
| -DLIBCXXABI_ENABLE_WERROR=NO \ |
| -DLIBUNWIND_ENABLE_WERROR=NO |
| check-runtimes |
| ;; |
| # |
| # Sanitizers |
| # |
| generic-asan) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake" |
| check-runtimes |
| ;; |
| generic-msan) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake" |
| check-runtimes |
| ;; |
| generic-tsan) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake" |
| check-runtimes |
| ;; |
| generic-ubsan) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake" |
| check-runtimes |
| ;; |
| # |
| # Various build configurations |
| # |
| bootstrapping-build) |
| clean |
| |
| echo "--- Generating CMake" |
| ${CMAKE} \ |
| -S "${MONOREPO_ROOT}/llvm" \ |
| -B "${BUILD_DIR}" \ |
| -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
| -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| -DLLVM_ENABLE_PROJECTS="clang" \ |
| -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ |
| -DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \ |
| -DLLVM_TARGETS_TO_BUILD="host" \ |
| -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \ |
| -DLLVM_ENABLE_ASSERTIONS=ON \ |
| -DLLVM_LIT_ARGS="-v --show-unsupported --xunit-xml-output test-results.xml --timeout=1500 --time-tests" |
| |
| echo "+++ Running the libc++ and libc++abi tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-runtimes |
| |
| echo "--- Installing libc++ and libc++abi to a fake location" |
| ${NINJA} -vC "${BUILD_DIR}" install-runtimes |
| |
| ccache -s |
| ;; |
| generic-static) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake" |
| check-runtimes |
| ;; |
| generic-merged) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \ |
| -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \ |
| -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \ |
| -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in" |
| check-runtimes |
| ;; |
| generic-hardened-mode) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-debug-mode) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-with_llvm_unwinder) |
| clean |
| generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON |
| check-runtimes |
| ;; |
| # |
| # Module builds |
| # |
| generic-modules) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-modules-lsv) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| # |
| # Parts removed |
| # |
| generic-no-threads) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake" |
| check-runtimes |
| ;; |
| generic-no-filesystem) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake" |
| check-runtimes |
| ;; |
| generic-no-random_device) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake" |
| check-runtimes |
| ;; |
| generic-no-localization) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake" |
| check-runtimes |
| ;; |
| generic-no-unicode) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake" |
| check-runtimes |
| ;; |
| generic-no-wide-characters) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake" |
| check-runtimes |
| ;; |
| generic-no-experimental) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| generic-no-exceptions) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake" |
| check-runtimes |
| check-abi-list |
| ;; |
| # |
| # Other miscellaneous jobs |
| # |
| generic-abi-unstable) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake" |
| check-runtimes |
| ;; |
| apple-system) |
| clean |
| |
| arch="$(uname -m)" |
| xcrun --sdk macosx \ |
| ${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh \ |
| --llvm-root ${MONOREPO_ROOT} \ |
| --build-dir ${BUILD_DIR} \ |
| --install-dir ${INSTALL_DIR} \ |
| --symbols-dir "${BUILD_DIR}/symbols" \ |
| --architectures "${arch}" \ |
| --version "999.99" |
| |
| # TODO: It would be better to run the tests against the fake-installed version of libc++ instead |
| xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist |
| ;; |
| apple-system-backdeployment-hardened-*) |
| clean |
| |
| if [[ "${OSX_ROOTS}" == "" ]]; then |
| echo "--- Downloading previous macOS dylibs" |
| PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz" |
| OSX_ROOTS="${BUILD_DIR}/macos-roots" |
| mkdir -p "${OSX_ROOTS}" |
| curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}" |
| fi |
| |
| DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-hardened-}" |
| |
| # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib, |
| # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the |
| # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib. |
| cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \ |
| "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib" |
| cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \ |
| "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib" |
| |
| arch="$(uname -m)" |
| PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}" |
| PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}" |
| PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}" |
| PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}" |
| PARAMS+=";hardening_mode=hardened" |
| |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ |
| -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \ |
| -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \ |
| -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \ |
| -DLIBCXX_TEST_PARAMS="${PARAMS}" \ |
| -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \ |
| -DLIBUNWIND_TEST_PARAMS="${PARAMS}" |
| |
| check-runtimes |
| ;; |
| apple-system-backdeployment-*) |
| clean |
| |
| if [[ "${OSX_ROOTS}" == "" ]]; then |
| echo "--- Downloading previous macOS dylibs" |
| PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz" |
| OSX_ROOTS="${BUILD_DIR}/macos-roots" |
| mkdir -p "${OSX_ROOTS}" |
| curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}" |
| fi |
| |
| DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-}" |
| |
| # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib, |
| # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the |
| # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib. |
| cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \ |
| "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib" |
| cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \ |
| "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib" |
| |
| arch="$(uname -m)" |
| PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}" |
| PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}" |
| PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}" |
| PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}" |
| |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ |
| -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \ |
| -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \ |
| -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \ |
| -DLIBCXX_TEST_PARAMS="${PARAMS}" \ |
| -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \ |
| -DLIBUNWIND_TEST_PARAMS="${PARAMS}" |
| |
| check-runtimes |
| ;; |
| benchmarks) |
| clean |
| generate-cmake |
| check-cxx-benchmarks |
| ;; |
| documentation) |
| clean |
| generate-cmake -DLLVM_ENABLE_SPHINX=ON |
| |
| echo "+++ Generating documentation" |
| ${NINJA} -vC "${BUILD_DIR}" docs-libcxx-html |
| ;; |
| aarch64) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" |
| check-runtimes |
| ;; |
| aarch64-no-exceptions) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \ |
| -DLIBCXX_ENABLE_EXCEPTIONS=OFF \ |
| -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF |
| check-runtimes |
| ;; |
| # Aka Armv8 32 bit |
| armv8) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake" |
| check-runtimes |
| ;; |
| armv8-no-exceptions) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake" |
| check-runtimes |
| ;; |
| # Armv7 32 bit. One building Arm only one Thumb only code. |
| armv7) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake" |
| check-runtimes |
| ;; |
| armv7-no-exceptions) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake" |
| check-runtimes |
| ;; |
| clang-cl-dll) |
| clean |
| # TODO: Currently, building with the experimental library breaks running |
| # tests (the test linking look for the c++experimental library with the |
| # wrong name, and the statically linked c++experimental can't be linked |
| # correctly when libc++ visibility attributes indicate dllimport linkage |
| # anyway), thus just disable the experimental library. Remove this |
| # setting when cmake and the test driver does the right thing automatically. |
| generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" |
| echo "+++ Running the libc++ tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| ;; |
| clang-cl-static) |
| clean |
| generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF |
| echo "+++ Running the libc++ tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| ;; |
| clang-cl-no-vcruntime) |
| clean |
| # Building libc++ in the same way as in clang-cl-dll above, but running |
| # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain |
| # translation units while using libc++, even if libc++ is built with |
| # exceptions enabled. |
| generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \ |
| -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in" |
| echo "+++ Running the libc++ tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| ;; |
| clang-cl-debug) |
| clean |
| generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \ |
| -DCMAKE_BUILD_TYPE=Debug |
| echo "+++ Running the libc++ tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| ;; |
| clang-cl-static-crt) |
| clean |
| # Test linking a static libc++ with the static CRT ("MultiThreaded" denotes |
| # the static CRT, as opposed to "MultiThreadedDLL" which is the default). |
| generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \ |
| -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded |
| echo "+++ Running the libc++ tests" |
| ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| ;; |
| mingw-dll) |
| clean |
| # Explicitly specify the compiler with a triple prefix. The CI |
| # environment has got two installations of Clang; the default one |
| # defaults to MSVC mode, while there's an installation of llvm-mingw |
| # further back in PATH. By calling the compiler with an explicit |
| # triple prefix, we use the one that is bundled with a mingw sysroot. |
| generate-cmake \ |
| -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \ |
| -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \ |
| -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" |
| check-runtimes |
| ;; |
| mingw-static) |
| clean |
| generate-cmake \ |
| -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \ |
| -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \ |
| -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \ |
| -DLIBCXX_ENABLE_SHARED=OFF \ |
| -DLIBUNWIND_ENABLE_SHARED=OFF |
| check-runtimes |
| ;; |
| mingw-dll-i686) |
| clean |
| generate-cmake \ |
| -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \ |
| -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \ |
| -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" |
| check-runtimes |
| ;; |
| aix) |
| clean |
| generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \ |
| -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \ |
| -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \ |
| -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in" |
| check-abi-list |
| check-runtimes |
| ;; |
| ################################################################# |
| # Insert vendor-specific internal configurations below. |
| # |
| # This allows vendors to extend this file with their own internal |
| # configurations without running into merge conflicts with upstream. |
| ################################################################# |
| |
| ################################################################# |
| *) |
| echo "${BUILDER} is not a known configuration" |
| exit 1 |
| ;; |
| esac |