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
10set -ex
11set -o pipefail
12unset LANG
13unset LC_ALL
14unset LC_COLLATE
15
16PROGNAME="$(basename "${0}")"
17
18function usage() {
19cat <<EOF
20Usage:
21${PROGNAME} [options] <BUILDER>
22
23[-h|--help]         Display this help and exit.
24
25--llvm-root <DIR>   Path to the root of the LLVM monorepo. By default, we try
26                    to figure it out based on the current working directory.
27
28--build-dir <DIR>   The directory to use for building the library. By default,
29                    this is '<llvm-root>/build/<builder>'.
30
31--osx-roots <DIR>   Path to pre-downloaded macOS dylibs. By default, we download
32                    them from Green Dragon. This is only relevant at all when
33                    running back-deployment testing if one wants to override
34                    the old dylibs we use to run the tests with different ones.
35EOF
36}
37
38while [[ $# -gt 0 ]]; do
39    case ${1} in
40        -h|--help)
41            usage
42            exit 0
43            ;;
44        --llvm-root)
45            MONOREPO_ROOT="${2}"
46            shift; shift
47            ;;
48        --build-dir)
49            BUILD_DIR="${2}"
50            shift; shift
51            ;;
52        --osx-roots)
53            OSX_ROOTS="${2}"
54            shift; shift
55            ;;
56        *)
57            BUILDER="${1}"
58            shift
59            ;;
60    esac
61done
62
63MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
64BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
65INSTALL_DIR="${BUILD_DIR}/install"
66
67# If we can find Ninja/CMake provided by Xcode, use those since we know their
68# version will generally work with the Clang shipped in Xcode (e.g. if Clang
69# knows about -std=c++20, the CMake bundled in Xcode will probably know about
70# that flag too).
71if xcrun --find ninja &>/dev/null; then NINJA="$(xcrun --find ninja)"; else NINJA="ninja"; fi
72if xcrun --find cmake &>/dev/null; then CMAKE="$(xcrun --find cmake)"; else CMAKE="cmake"; fi
73
74function clean() {
75    rm -rf "${BUILD_DIR}"
76}
77
78function generate-cmake-base() {
79    echo "--- Generating CMake"
80    ${CMAKE} \
81          -S "${MONOREPO_ROOT}/runtimes" \
82          -B "${BUILD_DIR}" \
83          -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
84          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
85          -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
86          -DLIBCXX_ENABLE_WERROR=YES \
87          -DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \
88          "${@}"
89}
90
91function generate-cmake() {
92    generate-cmake-base \
93          -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
94          -DLIBCXX_CXX_ABI=libcxxabi \
95          "${@}"
96}
97
98function generate-cmake-libcxx-win() {
99    # TODO: Clang-cl in MSVC configurations don't have access to compiler_rt
100    # builtins helpers for int128 division. See
101    # https://reviews.llvm.org/D91139#2429595 for a comment about longterm
102    # intent for handling the issue. In the meantime, define
103    # -D_LIBCPP_HAS_NO_INT128 (both when building the library itself and
104    # when building tests) to allow enabling filesystem for running tests,
105    # even if it uses a non-permanent ABI.
106
107    generate-cmake-base \
108          -DLLVM_ENABLE_RUNTIMES="libcxx" \
109          -DCMAKE_C_COMPILER=clang-cl \
110          -DCMAKE_CXX_COMPILER=clang-cl \
111          -DLIBCXX_ENABLE_FILESYSTEM=YES \
112          -DLIBCXX_EXTRA_SITE_DEFINES="_LIBCPP_HAS_NO_INT128" \
113          "${@}"
114}
115
116function check-runtimes() {
117    echo "--- Installing libc++, libc++abi and libunwind to a fake location"
118    ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
119
120    echo "+++ Running the libc++ tests"
121    ${NINJA} -vC "${BUILD_DIR}" check-cxx
122
123    echo "+++ Running the libc++abi tests"
124    ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
125
126    echo "+++ Running the libunwind tests"
127    ${NINJA} -vC "${BUILD_DIR}" check-unwind
128}
129
130# TODO: The goal is to test this against all configurations. We should also move
131#       this to the Lit test suite instead of being a separate CMake target.
132function check-abi-list() {
133    echo "+++ Running the libc++ ABI list test"
134    ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || (
135        echo "+++ Generating the libc++ ABI list after failed check"
136        ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
137        false
138    )
139}
140
141function check-cxx-benchmarks() {
142    echo "--- Running the benchmarks"
143    ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
144}
145
146# Print the version of a few tools to aid diagnostics in some cases
147${CMAKE} --version
148${NINJA} --version
149
150case "${BUILDER}" in
151check-format)
152    clean
153    echo "+++ Checking formatting"
154    # We need to set --extensions so that clang-format checks extensionless files.
155    mkdir -p ${BUILD_DIR}
156    git-clang-format \
157        --binary /usr/bin/clang-format --diff \
158        --extensions ',h,hh,hpp,hxx,c,cc,cxx,cpp' HEAD~1 \
159        -- \
160            libcxx/{benchmarks,include,src,test} \
161            libcxxabi/{fuzz,include,src,test} \
162        | tee ${BUILD_DIR}/clang-format.patch
163    # Check if the diff is empty, fail otherwise.
164    ! grep -q '^--- a' ${BUILD_DIR}/clang-format.patch
165;;
166check-generated-output)
167    # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
168    # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
169    clean
170    generate-cmake
171
172    # Reject patches that forgot to re-run the generator scripts.
173    echo "+++ Making sure the generator scripts were run"
174    ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
175    git diff | tee ${BUILD_DIR}/generated_output.patch
176    git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
177    ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
178    if [ -s ${BUILD_DIR}/generated_output.status ]; then
179        echo "It looks like not all the generator scripts were run,"
180        echo "did you forget to build the libcxx-generate-files target?"
181        echo "Did you add all new files it generated?"
182        false
183    fi
184
185    # Reject patches that introduce non-ASCII characters or hard tabs.
186    # Depends on LC_COLLATE set at the top of this script.
187    ! grep -rn '[^ -~]' libcxx/include/ || false
188
189    # Reject patches that introduce dependency cycles in the headers.
190    python3 libcxx/utils/graph_header_deps.py >/dev/null
191;;
192generic-cxx03)
193    clean
194    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" \
195                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
196    check-runtimes
197    check-abi-list
198;;
199generic-cxx11)
200    clean
201    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
202                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
203    check-runtimes
204    check-abi-list
205;;
206generic-cxx14)
207    clean
208    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake" \
209                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
210    check-runtimes
211    check-abi-list
212;;
213generic-cxx17)
214    clean
215    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake" \
216                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
217    check-runtimes
218    check-abi-list
219;;
220generic-cxx20)
221    clean
222    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake" \
223                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
224    check-runtimes
225    check-abi-list
226;;
227generic-cxx2b)
228    clean
229    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2b.cmake" \
230                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
231    check-runtimes
232    check-abi-list
233;;
234generic-assertions)
235    clean
236    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-assertions.cmake" \
237                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
238    check-runtimes
239    check-abi-list
240;;
241generic-debug-iterators)
242    clean
243    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-iterators.cmake" \
244                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
245    check-runtimes
246    check-abi-list
247;;
248generic-noexceptions)
249    clean
250    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake" \
251                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
252    check-runtimes
253    check-abi-list
254;;
255generic-modules)
256    clean
257    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" \
258                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
259    check-runtimes
260    check-abi-list
261;;
262generic-static)
263    clean
264    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake" \
265                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-static.cfg.in"
266    check-runtimes
267;;
268generic-clang-13)
269    export CC=clang-13
270    export CXX=clang++-13
271    clean
272    generate-cmake -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
273    check-runtimes
274    check-abi-list
275;;
276generic-clang-14)
277    export CC=clang-14
278    export CXX=clang++-14
279    clean
280    generate-cmake -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
281    check-runtimes
282    check-abi-list
283;;
284generic-gcc)
285    export CC=gcc-11
286    export CXX=g++-11
287    clean
288    generate-cmake -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in" \
289                   -DLIBCXX_ENABLE_WERROR=NO
290    check-runtimes
291;;
292generic-gcc-cxx11)
293    export CC=gcc-11
294    export CXX=g++-11
295    clean
296    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
297                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in" \
298                   -DLIBCXX_ENABLE_WERROR=NO
299    check-runtimes
300;;
301generic-asan)
302    clean
303    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake" \
304                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
305    check-runtimes
306;;
307generic-msan)
308    clean
309    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake" \
310                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
311    check-runtimes
312;;
313generic-tsan)
314    clean
315    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake" \
316                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
317    check-runtimes
318;;
319generic-ubsan)
320    clean
321    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake" \
322                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
323    check-runtimes
324;;
325generic-with_llvm_unwinder)
326    clean
327    generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
328                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
329    check-runtimes
330;;
331generic-singlethreaded)
332    clean
333    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-singlethreaded.cmake" \
334                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
335    check-runtimes
336;;
337generic-no-debug)
338    clean
339    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-debug.cmake" \
340                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
341    check-runtimes
342    check-abi-list
343;;
344generic-no-filesystem)
345    clean
346    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake" \
347                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
348    check-runtimes
349;;
350generic-no-random_device)
351    clean
352    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake" \
353                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
354    check-runtimes
355;;
356generic-no-localization)
357    clean
358    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake" \
359                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
360    check-runtimes
361;;
362generic-no-unicode)
363    clean
364    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake" \
365                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
366    check-runtimes
367;;
368generic-no-wide-characters)
369    clean
370    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake" \
371                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
372    check-runtimes
373;;
374generic-no-experimental)
375    clean
376    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake" \
377                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
378    check-runtimes
379    check-abi-list
380;;
381generic-abi-unstable)
382    clean
383    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake" \
384                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
385    check-runtimes
386;;
387apple-system)
388    clean
389
390    arch="$(uname -m)"
391    xcrun --sdk macosx                                              \
392        ${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh    \
393            --llvm-root ${MONOREPO_ROOT}                            \
394            --build-dir ${BUILD_DIR}                                \
395            --install-dir ${INSTALL_DIR}                            \
396            --symbols-dir "${BUILD_DIR}/symbols"                    \
397            --architectures "${arch}"                               \
398            --version "999.99"
399
400    # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
401    xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
402;;
403apple-system-backdeployment-*)
404    clean
405
406    if [[ "${OSX_ROOTS}" == "" ]]; then
407        echo "--- Downloading previous macOS dylibs"
408        PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
409        OSX_ROOTS="${BUILD_DIR}/macos-roots"
410        mkdir -p "${OSX_ROOTS}"
411        curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
412    fi
413
414    DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-}"
415
416    # TODO: On Apple platforms, we never produce libc++abi.1.dylib, always libc++abi.dylib.
417    #       Fix that in the build so that the tests stop searching for @rpath/libc++abi.1.dylib.
418    cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
419       "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
420
421    arch="$(uname -m)"
422    PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
423    PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
424    PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
425    PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
426    PARAMS+=";use_system_cxx_lib=True"
427
428    # TODO: We should run the libunwind tests using the back-deployment dylibs too.
429    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
430                   -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
431                   -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
432                   -DLIBCXX_TEST_PARAMS="${PARAMS}" \
433                   -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
434
435    check-runtimes
436;;
437benchmarks)
438    clean
439    generate-cmake -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
440    check-cxx-benchmarks
441;;
442documentation)
443    clean
444    generate-cmake -DLLVM_ENABLE_SPHINX=ON
445
446    echo "+++ Generating documentation"
447    ${NINJA} -vC "${BUILD_DIR}" docs-libcxx-html
448;;
449bootstrapping-build)
450    clean
451
452    echo "--- Generating CMake"
453    ${CMAKE} \
454          -S "${MONOREPO_ROOT}/llvm" \
455          -B "${BUILD_DIR}" \
456          -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
457          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
458          -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
459          -DLLVM_ENABLE_PROJECTS="clang" \
460          -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
461          -DLLVM_RUNTIME_TARGETS="$(c++ --print-target-triple)" \
462          -DLLVM_TARGETS_TO_BUILD="host" \
463          -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
464          -DLLVM_ENABLE_ASSERTIONS=ON \
465          -DRUNTIMES_LIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
466
467    echo "+++ Running the libc++ and libc++abi tests"
468    ${NINJA} -C "${BUILD_DIR}" check-runtimes
469
470    echo "--- Installing libc++ and libc++abi to a fake location"
471    ${NINJA} -C "${BUILD_DIR}" install-runtimes
472;;
473legacy-test-config)
474    clean
475    generate-cmake -DLIBCXX_TEST_CONFIG="legacy.cfg.in"
476    check-runtimes
477;;
478legacy-project-build)
479    clean
480
481    echo "--- Generating CMake"
482    ${CMAKE} \
483          -S "${MONOREPO_ROOT}/llvm" \
484          -B "${BUILD_DIR}" \
485          -DLLVM_ENABLE_PROJECTS="libcxx;libunwind;libcxxabi" \
486          -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
487          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
488          -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
489          -DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \
490          -DLIBCXX_CXX_ABI=libcxxabi
491    check-runtimes
492;;
493aarch64)
494    clean
495    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
496                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
497    check-runtimes
498;;
499aarch64-noexceptions)
500    clean
501    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
502                   -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
503                   -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
504                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
505    check-runtimes
506;;
507# Aka Armv8 32 bit
508armv8)
509    clean
510    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake" \
511                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
512    check-runtimes
513;;
514armv8-noexceptions)
515    clean
516    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake" \
517                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
518    check-runtimes
519;;
520# Armv7 32 bit. One building Arm only one Thumb only code.
521armv7)
522    clean
523    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake" \
524                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
525    check-runtimes
526;;
527armv7-noexceptions)
528    clean
529    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake" \
530                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
531    check-runtimes
532;;
533clang-cl-dll)
534    clean
535    # TODO: Currently, building with the experimental library breaks running
536    # tests (the test linking look for the c++experimental library with the
537    # wrong name, and the statically linked c++experimental can't be linked
538    # correctly when libc++ visibility attributes indicate dllimport linkage
539    # anyway), thus just disable the experimental library. Remove this
540    # setting when cmake and the test driver does the right thing automatically.
541    generate-cmake-libcxx-win -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
542    echo "+++ Running the libc++ tests"
543    ${NINJA} -vC "${BUILD_DIR}" check-cxx
544;;
545clang-cl-static)
546    clean
547    generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
548    echo "+++ Running the libc++ tests"
549    ${NINJA} -vC "${BUILD_DIR}" check-cxx
550;;
551mingw-dll)
552    clean
553    # Explicitly specify the compiler with a triple prefix. The CI
554    # environment has got two installations of Clang; the default one
555    # defaults to MSVC mode, while there's an installation of llvm-mingw
556    # further back in PATH. By calling the compiler with an explicit
557    # triple prefix, we use the one that is bundled with a mingw sysroot.
558    generate-cmake \
559          -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
560          -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
561          -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
562    echo "+++ Running the libc++ tests"
563    ${NINJA} -vC "${BUILD_DIR}" check-cxx
564;;
565mingw-static)
566    clean
567    generate-cmake \
568          -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
569          -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
570          -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
571          -DLIBCXX_ENABLE_SHARED=OFF \
572          -DLIBUNWIND_ENABLE_SHARED=OFF
573    echo "+++ Running the libc++ tests"
574    ${NINJA} -vC "${BUILD_DIR}" check-cxx
575;;
576aix)
577    export CC=ibm-clang
578    export CXX=ibm-clang++_r
579    clean
580    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
581                   -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
582                   -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
583                   -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
584    # TODO: use check-runtimes once libunwind builds cleanly on AIX.
585    ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
586    ${NINJA} -vC "${BUILD_DIR}" check-cxx check-cxxabi
587;;
588#################################################################
589# Insert vendor-specific internal configurations below.
590#
591# This allows vendors to extend this file with their own internal
592# configurations without running into merge conflicts with upstream.
593#################################################################
594
595#################################################################
596*)
597    echo "${BUILDER} is not a known configuration"
598    exit 1
599;;
600esac
601