Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | #===----------------------------------------------------------------------===## |
| 3 | # |
| 4 | # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | # See https://llvm.org/LICENSE.txt for license information. |
| 6 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | # |
| 8 | #===----------------------------------------------------------------------===## |
| 9 | |
| 10 | set -ex |
Marek Kurdej | 0544936 | 2021-02-04 21:13:22 +0100 | [diff] [blame] | 11 | set -o pipefail |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 12 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 13 | PROGNAME="$(basename "${0}")" |
| 14 | |
| 15 | function usage() { |
| 16 | cat <<EOF |
| 17 | Usage: |
| 18 | ${PROGNAME} [options] <BUILDER> |
| 19 | |
| 20 | [-h|--help] Display this help and exit. |
| 21 | |
| 22 | --llvm-root <DIR> Path to the root of the LLVM monorepo. By default, we try |
| 23 | to figure it out based on the current working directory. |
| 24 | |
Louis Dionne | 04bf103 | 2020-11-05 19:09:03 -0500 | [diff] [blame] | 25 | --build-dir <DIR> The directory to use for building the library. By default, |
| 26 | this is '<llvm-root>/build/<builder>'. |
| 27 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 28 | --osx-roots <DIR> Path to pre-downloaded macOS dylibs. By default, we download |
| 29 | them from Green Dragon. This is only relevant at all when |
| 30 | running back-deployment testing if one wants to override |
| 31 | the old dylibs we use to run the tests with different ones. |
| 32 | EOF |
| 33 | } |
| 34 | |
| 35 | while [[ $# -gt 0 ]]; do |
| 36 | case ${1} in |
| 37 | -h|--help) |
| 38 | usage |
| 39 | exit 0 |
| 40 | ;; |
| 41 | --llvm-root) |
| 42 | MONOREPO_ROOT="${2}" |
| 43 | shift; shift |
| 44 | ;; |
Louis Dionne | 04bf103 | 2020-11-05 19:09:03 -0500 | [diff] [blame] | 45 | --build-dir) |
| 46 | BUILD_DIR="${2}" |
| 47 | shift; shift |
| 48 | ;; |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 49 | --osx-roots) |
| 50 | OSX_ROOTS="${2}" |
| 51 | shift; shift |
| 52 | ;; |
| 53 | *) |
| 54 | BUILDER="${1}" |
| 55 | shift |
| 56 | ;; |
| 57 | esac |
| 58 | done |
| 59 | |
| 60 | MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}" |
Louis Dionne | 04bf103 | 2020-11-05 19:09:03 -0500 | [diff] [blame] | 61 | BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}" |
Louis Dionne | 485f4c0 | 2021-01-07 17:37:09 -0500 | [diff] [blame] | 62 | INSTALL_DIR="${BUILD_DIR}/install" |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 63 | |
Louis Dionne | 7a8d536 | 2021-03-04 16:01:36 -0500 | [diff] [blame] | 64 | # On macOS, fall back to using the Ninja provided with Xcode if no other Ninja can be found. |
| 65 | if which ninja &>/dev/null; then |
| 66 | NINJA="$(which ninja)" |
| 67 | else |
| 68 | NINJA="$(xcrun --find ninja)" |
| 69 | fi |
| 70 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 71 | function clean() { |
| 72 | rm -rf "${BUILD_DIR}" |
| 73 | } |
| 74 | |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 75 | function generate-cmake() { |
| 76 | echo "--- Generating CMake" |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 77 | cmake -S "${MONOREPO_ROOT}/llvm" \ |
| 78 | -B "${BUILD_DIR}" \ |
Louis Dionne | 7a8d536 | 2021-03-04 16:01:36 -0500 | [diff] [blame] | 79 | -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 80 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 81 | -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| 82 | -DLLVM_ENABLE_PROJECTS="libcxx;libunwind;libcxxabi" \ |
| 83 | -DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \ |
| 84 | -DLIBCXX_CXX_ABI=libcxxabi \ |
Louis Dionne | 662aaa2 | 2020-11-05 10:47:06 -0500 | [diff] [blame] | 85 | "${@}" |
| 86 | } |
| 87 | |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 88 | function check-cxx-cxxabi() { |
Louis Dionne | eacce54 | 2021-03-24 09:50:59 -0400 | [diff] [blame] | 89 | echo "--- Installing libc++ and libc++abi to a fake location" |
| 90 | ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi |
| 91 | |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 92 | echo "+++ Running the libc++ tests" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 93 | ${NINJA} -vC "${BUILD_DIR}" check-cxx |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 94 | |
| 95 | echo "+++ Running the libc++abi tests" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 96 | ${NINJA} -vC "${BUILD_DIR}" check-cxxabi |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 97 | } |
| 98 | |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 99 | # TODO: The goal is to test this against all configurations. We should also move |
| 100 | # this to the Lit test suite instead of being a separate CMake target. |
| 101 | function check-abi-list() { |
| 102 | echo "+++ Running the libc++ ABI list test" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 103 | ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || ( |
Marek Kurdej | 718b62c | 2020-12-02 08:57:02 +0100 | [diff] [blame] | 104 | echo "+++ Generating the libc++ ABI list after failed check" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 105 | ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist |
Marek Kurdej | 718b62c | 2020-12-02 08:57:02 +0100 | [diff] [blame] | 106 | false |
| 107 | ) |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 108 | } |
| 109 | |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 110 | function check-cxx-benchmarks() { |
| 111 | echo "--- Running the benchmarks" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 112 | ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 113 | } |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 114 | |
Louis Dionne | 6bd3e65 | 2021-04-01 13:40:04 -0400 | [diff] [blame] | 115 | # Print the version of a few tools to aid diagnostics in some cases |
| 116 | cmake --version |
| 117 | ${NINJA} --version |
| 118 | |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 119 | case "${BUILDER}" in |
Marek Kurdej | 0544936 | 2021-02-04 21:13:22 +0100 | [diff] [blame] | 120 | check-format) |
| 121 | clean |
| 122 | echo "+++ Checking formatting" |
| 123 | # We need to set --extensions so that clang-format checks extensionless files. |
| 124 | mkdir -p ${BUILD_DIR} |
| 125 | git-clang-format \ |
| 126 | --binary /usr/bin/clang-format --diff \ |
| 127 | --extensions ',h,hh,hpp,hxx,c,cc,cxx,cpp' HEAD~1 \ |
| 128 | -- \ |
| 129 | libcxx/{benchmarks,include,src,test} \ |
| 130 | libcxxabi/{fuzz,include,src,test} \ |
| 131 | | tee ${BUILD_DIR}/clang-format.patch |
| 132 | # Check if the diff is empty, fail otherwise. |
| 133 | ! grep -q '^--- a' ${BUILD_DIR}/clang-format.patch |
| 134 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 135 | generic-cxx03) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 136 | export CC=clang |
| 137 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 138 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 139 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" |
| 140 | check-cxx-cxxabi |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 141 | check-abi-list |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 142 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 143 | generic-cxx11) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 144 | export CC=clang |
| 145 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 146 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 147 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" |
| 148 | check-cxx-cxxabi |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 149 | check-abi-list |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 150 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 151 | generic-cxx14) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 152 | export CC=clang |
| 153 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 154 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 155 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake" |
| 156 | check-cxx-cxxabi |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 157 | check-abi-list |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 158 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 159 | generic-cxx17) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 160 | export CC=clang |
| 161 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 162 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 163 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake" |
| 164 | check-cxx-cxxabi |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 165 | check-abi-list |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 166 | ;; |
Marek Kurdej | 24b4c51 | 2021-01-07 12:29:04 +0100 | [diff] [blame] | 167 | generic-cxx20) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 168 | export CC=clang |
| 169 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 170 | clean |
Marek Kurdej | 24b4c51 | 2021-01-07 12:29:04 +0100 | [diff] [blame] | 171 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake" |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 172 | check-cxx-cxxabi |
Louis Dionne | dfbd00e | 2020-11-26 15:00:42 -0500 | [diff] [blame] | 173 | check-abi-list |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 174 | ;; |
Marek Kurdej | 758067c | 2021-01-08 18:40:42 +0100 | [diff] [blame] | 175 | generic-cxx2b) |
| 176 | export CC=clang-tot |
| 177 | export CXX=clang++-tot |
| 178 | clean |
| 179 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2b.cmake" |
| 180 | check-cxx-cxxabi |
| 181 | check-abi-list |
| 182 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 183 | generic-noexceptions) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 184 | export CC=clang |
| 185 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 186 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 187 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake" |
| 188 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 189 | ;; |
Louis Dionne | eacce54 | 2021-03-24 09:50:59 -0400 | [diff] [blame] | 190 | generic-static) |
| 191 | export CC=clang |
| 192 | export CXX=clang++ |
| 193 | clean |
| 194 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake" |
| 195 | check-cxx-cxxabi |
| 196 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 197 | generic-32bit) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 198 | export CC=clang |
| 199 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 200 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 201 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-32bits.cmake" |
| 202 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 203 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 204 | generic-gcc) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 205 | export CC=gcc |
| 206 | export CXX=g++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 207 | clean |
Louis Dionne | eacce54 | 2021-03-24 09:50:59 -0400 | [diff] [blame] | 208 | generate-cmake |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 209 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 210 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 211 | generic-asan) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 212 | export CC=clang |
| 213 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 214 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 215 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake" |
| 216 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 217 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 218 | generic-msan) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 219 | export CC=clang |
| 220 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 221 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 222 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake" |
| 223 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 224 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 225 | generic-tsan) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 226 | export CC=clang |
| 227 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 228 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 229 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake" |
| 230 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 231 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 232 | generic-ubsan) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 233 | export CC=clang |
| 234 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 235 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 236 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake" |
| 237 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 238 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 239 | generic-with_llvm_unwinder) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 240 | export CC=clang |
| 241 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 242 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 243 | generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON |
| 244 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 245 | ;; |
Louis Dionne | 6f8038c | 2020-10-01 13:55:39 -0400 | [diff] [blame] | 246 | generic-singlethreaded) |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 247 | export CC=clang |
| 248 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 249 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 250 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-singlethreaded.cmake" |
| 251 | check-cxx-cxxabi |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 252 | ;; |
Louis Dionne | abcfdbc | 2021-03-23 14:09:52 -0400 | [diff] [blame] | 253 | generic-no-debug) |
Louis Dionne | 4396f9b | 2020-10-06 16:46:58 -0400 | [diff] [blame] | 254 | export CC=clang |
| 255 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 256 | clean |
Louis Dionne | abcfdbc | 2021-03-23 14:09:52 -0400 | [diff] [blame] | 257 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-debug.cmake" |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 258 | check-cxx-cxxabi |
Louis Dionne | 4396f9b | 2020-10-06 16:46:58 -0400 | [diff] [blame] | 259 | ;; |
Louis Dionne | db84e12 | 2021-01-18 12:18:18 -0500 | [diff] [blame] | 260 | generic-no-filesystem) |
| 261 | export CC=clang |
| 262 | export CXX=clang++ |
| 263 | clean |
| 264 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake" |
| 265 | check-cxx-cxxabi |
| 266 | ;; |
Louis Dionne | 3777e68 | 2020-10-15 10:32:09 -0400 | [diff] [blame] | 267 | generic-no-random_device) |
| 268 | export CC=clang |
| 269 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 270 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 271 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake" |
| 272 | check-cxx-cxxabi |
Louis Dionne | 3777e68 | 2020-10-15 10:32:09 -0400 | [diff] [blame] | 273 | ;; |
Louis Dionne | 8d053eb | 2020-10-09 15:31:05 -0400 | [diff] [blame] | 274 | generic-no-localization) |
| 275 | export CC=clang |
| 276 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 277 | clean |
Louis Dionne | 8d053eb | 2020-10-09 15:31:05 -0400 | [diff] [blame] | 278 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake" |
| 279 | check-cxx-cxxabi |
| 280 | ;; |
Louis Dionne | 89d0eb2 | 2020-10-01 08:55:40 -0400 | [diff] [blame] | 281 | x86_64-apple-system) |
| 282 | export CC=clang |
| 283 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 284 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 285 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" |
| 286 | check-cxx-cxxabi |
Louis Dionne | 89d0eb2 | 2020-10-01 08:55:40 -0400 | [diff] [blame] | 287 | ;; |
| 288 | x86_64-apple-system-noexceptions) |
| 289 | export CC=clang |
| 290 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 291 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 292 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ |
| 293 | -DLIBCXX_ENABLE_EXCEPTIONS=OFF \ |
| 294 | -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF |
| 295 | check-cxx-cxxabi |
| 296 | ;; |
Louis Dionne | 662aaa2 | 2020-11-05 10:47:06 -0500 | [diff] [blame] | 297 | x86_64-apple-system-backdeployment-*) |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 298 | clean |
Louis Dionne | 662aaa2 | 2020-11-05 10:47:06 -0500 | [diff] [blame] | 299 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 300 | if [[ "${OSX_ROOTS}" == "" ]]; then |
| 301 | echo "--- Downloading previous macOS dylibs" |
Louis Dionne | c767535 | 2021-03-25 14:14:20 -0400 | [diff] [blame] | 302 | PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/liu4fmc53qzlfly/libcxx-roots.tar.gz" |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 303 | OSX_ROOTS="${BUILD_DIR}/macos-roots" |
| 304 | mkdir -p "${OSX_ROOTS}" |
| 305 | curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}" |
| 306 | fi |
Louis Dionne | 662aaa2 | 2020-11-05 10:47:06 -0500 | [diff] [blame] | 307 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 308 | DEPLOYMENT_TARGET="${BUILDER#x86_64-apple-system-backdeployment-}" |
Louis Dionne | 84ad13b | 2020-07-08 16:38:54 -0400 | [diff] [blame] | 309 | |
| 310 | # TODO: On Apple platforms, we never produce libc++abi.1.dylib, always libc++abi.dylib. |
| 311 | # Fix that in the build so that the tests stop searching for @rpath/libc++abi.1.dylib. |
| 312 | cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \ |
| 313 | "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib" |
| 314 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 315 | PARAMS="target_triple=x86_64-apple-macosx${DEPLOYMENT_TARGET}" |
| 316 | PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}" |
Louis Dionne | 84ad13b | 2020-07-08 16:38:54 -0400 | [diff] [blame] | 317 | PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}" |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 318 | PARAMS+=";use_system_cxx_lib=True" |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 319 | |
| 320 | export CC=clang |
| 321 | export CXX=clang++ |
| 322 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ |
| 323 | -DLIBCXX_TEST_PARAMS="${PARAMS}" \ |
| 324 | -DLIBCXXABI_TEST_PARAMS="${PARAMS}" |
| 325 | |
Louis Dionne | 84ad13b | 2020-07-08 16:38:54 -0400 | [diff] [blame] | 326 | check-cxx-cxxabi |
Louis Dionne | 662aaa2 | 2020-11-05 10:47:06 -0500 | [diff] [blame] | 327 | ;; |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 328 | benchmarks) |
| 329 | export CC=clang |
| 330 | export CXX=clang++ |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 331 | clean |
Louis Dionne | f9c11b0 | 2020-10-23 10:02:14 -0400 | [diff] [blame] | 332 | generate-cmake |
| 333 | check-cxx-benchmarks |
Louis Dionne | 89d0eb2 | 2020-10-01 08:55:40 -0400 | [diff] [blame] | 334 | ;; |
Louis Dionne | aa4e44f | 2020-11-05 14:34:29 -0500 | [diff] [blame] | 335 | documentation) |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 336 | export CC=clang |
| 337 | export CXX=clang++ |
| 338 | clean |
| 339 | generate-cmake -DLLVM_ENABLE_SPHINX=ON |
| 340 | |
| 341 | echo "+++ Generating documentation" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 342 | ${NINJA} -vC "${BUILD_DIR}" docs-libcxx-html |
Louis Dionne | aa4e44f | 2020-11-05 14:34:29 -0500 | [diff] [blame] | 343 | ;; |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 344 | unified-standalone) |
| 345 | export CC=clang |
| 346 | export CXX=clang++ |
| 347 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 348 | clean |
| 349 | |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 350 | echo "--- Generating CMake" |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 351 | cmake -S "${MONOREPO_ROOT}/libcxx/utils/ci/runtimes" \ |
| 352 | -B "${BUILD_DIR}" \ |
Louis Dionne | 7a8d536 | 2021-03-04 16:01:36 -0500 | [diff] [blame] | 353 | -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 354 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 355 | -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| 356 | -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi;libunwind" |
| 357 | |
| 358 | check-cxx-cxxabi |
| 359 | ;; |
Louis Dionne | 61b63fd | 2021-03-16 11:57:42 -0700 | [diff] [blame] | 360 | runtimes-build) |
| 361 | export CC=clang |
| 362 | export CXX=clang++ |
| 363 | |
| 364 | clean |
| 365 | |
| 366 | echo "--- Generating CMake" |
| 367 | cmake -S "${MONOREPO_ROOT}/llvm" \ |
| 368 | -B "${BUILD_DIR}" \ |
| 369 | -GNinja \ |
| 370 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 371 | -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| 372 | -DLLVM_ENABLE_PROJECTS="clang" \ |
| 373 | -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \ |
| 374 | -DLLVM_RUNTIME_TARGETS="x86_64-unknown-linux-gnu" |
| 375 | |
| 376 | echo "+++ Running the libc++ and libc++abi tests" |
| 377 | ${NINJA} -C "${BUILD_DIR}" check-runtimes |
| 378 | |
| 379 | echo "--- Installing libc++ and libc++abi to a fake location" |
| 380 | ${NINJA} -C "${BUILD_DIR}" install-cxx install-cxxabi |
| 381 | ;; |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 382 | legacy-standalone) |
| 383 | export CC=clang |
| 384 | export CXX=clang++ |
| 385 | |
Louis Dionne | bb7be75 | 2020-11-05 19:02:32 -0500 | [diff] [blame] | 386 | clean |
| 387 | |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 388 | echo "--- Generating CMake" |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 389 | cmake -S "${MONOREPO_ROOT}/libcxx" \ |
| 390 | -B "${BUILD_DIR}/libcxx" \ |
Louis Dionne | 7a8d536 | 2021-03-04 16:01:36 -0500 | [diff] [blame] | 391 | -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 392 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 393 | -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| 394 | -DLLVM_PATH="${MONOREPO_ROOT}/llvm" \ |
| 395 | -DLIBCXX_CXX_ABI=libcxxabi \ |
| 396 | -DLIBCXX_CXX_ABI_INCLUDE_PATHS="${MONOREPO_ROOT}/libcxxabi/include" \ |
| 397 | -DLIBCXX_CXX_ABI_LIBRARY_PATH="${BUILD_DIR}/libcxxabi/lib" |
| 398 | |
| 399 | cmake -S "${MONOREPO_ROOT}/libcxxabi" \ |
| 400 | -B "${BUILD_DIR}/libcxxabi" \ |
Louis Dionne | 7a8d536 | 2021-03-04 16:01:36 -0500 | [diff] [blame] | 401 | -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 402 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 403 | -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ |
| 404 | -DLLVM_PATH="${MONOREPO_ROOT}/llvm" \ |
| 405 | -DLIBCXXABI_LIBCXX_PATH="${MONOREPO_ROOT}/libcxx" \ |
Louis Dionne | 94870d8 | 2020-06-26 12:08:59 -0400 | [diff] [blame] | 406 | -DLIBCXXABI_LIBCXX_INCLUDES="${BUILD_DIR}/libcxx/include/c++/v1" \ |
Louis Dionne | 5be8b09 | 2020-10-26 14:25:49 -0400 | [diff] [blame] | 407 | -DLIBCXXABI_LIBCXX_LIBRARY_PATH="${BUILD_DIR}/libcxx/lib" |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 408 | |
Louis Dionne | 94870d8 | 2020-06-26 12:08:59 -0400 | [diff] [blame] | 409 | echo "+++ Generating libc++ headers" |
| 410 | ${NINJA} -vC "${BUILD_DIR}/libcxx" generate-cxx-headers |
| 411 | |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 412 | echo "+++ Building libc++abi" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 413 | ${NINJA} -vC "${BUILD_DIR}/libcxxabi" cxxabi |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 414 | |
| 415 | echo "+++ Building libc++" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 416 | ${NINJA} -vC "${BUILD_DIR}/libcxx" cxx |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 417 | |
| 418 | echo "+++ Running the libc++ tests" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 419 | ${NINJA} -vC "${BUILD_DIR}/libcxx" check-cxx |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 420 | |
| 421 | echo "+++ Running the libc++abi tests" |
Louis Dionne | 1fcb041 | 2021-03-19 16:26:15 -0700 | [diff] [blame] | 422 | ${NINJA} -vC "${BUILD_DIR}/libcxxabi" check-cxxabi |
Louis Dionne | 435c36b | 2020-10-23 16:27:41 -0400 | [diff] [blame] | 423 | ;; |
David Spickett | 77471a1 | 2021-02-08 10:43:21 +0000 | [diff] [blame] | 424 | aarch64) |
| 425 | clean |
| 426 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" |
| 427 | check-cxx-cxxabi |
| 428 | ;; |
| 429 | aarch64-noexceptions) |
| 430 | clean |
| 431 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \ |
| 432 | -DLIBCXX_ENABLE_EXCEPTIONS=OFF \ |
| 433 | -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF |
| 434 | check-cxx-cxxabi |
| 435 | ;; |
David Spickett | a16b886 | 2021-03-02 15:07:19 +0000 | [diff] [blame] | 436 | # Aka Armv8 32 bit |
| 437 | armv8) |
| 438 | clean |
David Spickett | 7cc0a7f | 2021-03-17 11:09:41 +0000 | [diff] [blame] | 439 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake" |
David Spickett | a16b886 | 2021-03-02 15:07:19 +0000 | [diff] [blame] | 440 | check-cxx-cxxabi |
| 441 | ;; |
| 442 | armv8-noexceptions) |
| 443 | clean |
David Spickett | 7cc0a7f | 2021-03-17 11:09:41 +0000 | [diff] [blame] | 444 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake" |
David Spickett | a16b886 | 2021-03-02 15:07:19 +0000 | [diff] [blame] | 445 | check-cxx-cxxabi |
| 446 | ;; |
| 447 | # Armv7 32 bit. One building Arm only one Thumb only code. |
| 448 | armv7) |
| 449 | clean |
David Spickett | 7cc0a7f | 2021-03-17 11:09:41 +0000 | [diff] [blame] | 450 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake" |
David Spickett | a16b886 | 2021-03-02 15:07:19 +0000 | [diff] [blame] | 451 | check-cxx-cxxabi |
| 452 | ;; |
| 453 | armv7-noexceptions) |
| 454 | clean |
David Spickett | 7cc0a7f | 2021-03-17 11:09:41 +0000 | [diff] [blame] | 455 | generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake" |
David Spickett | a16b886 | 2021-03-02 15:07:19 +0000 | [diff] [blame] | 456 | check-cxx-cxxabi |
| 457 | ;; |
Martin Storsjö | 2ffae01 | 2021-03-17 12:10:42 +0200 | [diff] [blame^] | 458 | generic-win) |
| 459 | clean |
| 460 | # TODO: The CI runner doesn't have bash in the path currently, and it's |
| 461 | # needed for running tests. Once it's available out of the box, remove this. |
| 462 | export PATH="$PATH:/c/Program Files/Git/usr/bin" |
| 463 | |
| 464 | # TODO: Clang-cl in MSVC configurations don't have access to compiler_rt |
| 465 | # builtins helpers for int128 division. See |
| 466 | # https://reviews.llvm.org/D91139#2429595 for a comment about longterm |
| 467 | # intent for handling the issue. In the meantime, define |
| 468 | # -D_LIBCPP_HAS_NO_INT128 (both when building the library itself and |
| 469 | # when building tests) to allow enabling filesystem for running tests, |
| 470 | # even if it uses a non-permanent ABI. |
| 471 | |
| 472 | # TODO: The CI runner currently uses Clang 11, which doesn't implicitly |
| 473 | # link in oldnames.lib (which is needed for some tests) when compiling |
| 474 | # with the plain "clang" driver, as the tests do (as opposed to using |
| 475 | # the "clang-cl" driver for compiling). When the CI runner runs |
| 476 | # Clang 12, the "-loldnames" option can be dropped. |
| 477 | |
| 478 | # TODO: Currently, building with the experimental library breaks running |
| 479 | # tests (the test linking look for the c++experimental library with the |
| 480 | # wrong name, and the statically linked c++experimental can't be linked |
| 481 | # correctly when libc++ visibility attributes indicate dllimport linkage |
| 482 | # anyway), thus just disable the experimental library. Remove this |
| 483 | # setting when cmake and the test driver does the right thing automatically. |
| 484 | |
| 485 | echo "--- Generating CMake" |
| 486 | cmake -S "${MONOREPO_ROOT}/libcxx" \ |
| 487 | -B "${BUILD_DIR}" \ |
| 488 | -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ |
| 489 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 490 | -DCMAKE_C_COMPILER=clang-cl \ |
| 491 | -DCMAKE_CXX_COMPILER=clang-cl \ |
| 492 | -DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \ |
| 493 | -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO \ |
| 494 | -DLIBCXX_ENABLE_FILESYSTEM=YES \ |
| 495 | -DCMAKE_CXX_FLAGS="-D_LIBCPP_HAS_NO_INT128" \ |
| 496 | -DLIBCXX_TEST_COMPILER_FLAGS="-D_LIBCPP_HAS_NO_INT128" \ |
| 497 | -DLIBCXX_TEST_LINKER_FLAGS="-loldnames" |
| 498 | echo "+++ Running the libc++ tests" |
| 499 | ${NINJA} -vC "${BUILD_DIR}" check-cxx |
| 500 | ;; |
Louis Dionne | ce55605 | 2020-09-23 09:20:03 -0400 | [diff] [blame] | 501 | *) |
| 502 | echo "${BUILDER} is not a known configuration" |
| 503 | exit 1 |
| 504 | ;; |
| 505 | esac |