2 # ===----------------------------------------------------------------------===##
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
8 # ===----------------------------------------------------------------------===##
16 PROGNAME
="$(basename "${0}")"
21 ${PROGNAME} [options] <BUILDER>
23 [-h|--help] Display this help and exit.
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.
28 --build-dir <DIR> The directory to use for building the library. By default,
29 this is '<llvm-root>/build/<builder>'.
32 CC The C compiler to use, this value is used by CMake. This
35 CXX The C++ compiler to use, this value is used by CMake. This
38 CMAKE The CMake binary to use. This variable is optional.
40 CLANG_FORMAT The clang-format binary to use when generating the format
46 if [[ $# == 0 ]]; then
51 while [[ $# -gt 0 ]]; do
72 MONOREPO_ROOT
="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
73 BUILD_DIR
="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
74 INSTALL_DIR
="${BUILD_DIR}/install"
76 # If we can find Ninja/CMake provided by Xcode, use those since we know their
77 # version will generally work with the Clang shipped in Xcode (e.g. if Clang
78 # knows about -std=c++20, the CMake bundled in Xcode will probably know about
80 if xcrun
--find ninja
&>/dev
/null
; then
81 NINJA
="$(xcrun --find ninja)"
82 elif which ninja
&>/dev
/null
; then
83 # The current implementation of modules needs the absolute path to the ninja
85 # TODO MODULES Is this still needed when CMake has libc++ module support?
86 NINJA
="$(which ninja)"
91 if [ -z "${CMAKE}" ]; then
92 if xcrun
--find cmake
&>/dev
/null
; then
93 CMAKE
="$(xcrun --find cmake)"
102 if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
113 if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
125 rm -rf "${BUILD_DIR}"
128 function generate-cmake-base
() {
129 step
"Generating CMake"
131 -S "${MONOREPO_ROOT}/runtimes" \
133 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
134 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
135 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
136 -DLIBCXX_ENABLE_WERROR=YES \
137 -DLIBCXXABI_ENABLE_WERROR=YES \
138 -DLIBUNWIND_ENABLE_WERROR=YES \
139 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
143 function generate-cmake
() {
144 generate-cmake-base \
145 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
146 -DLIBCXX_CXX_ABI=libcxxabi \
150 function generate-cmake-libcxx-win
() {
151 generate-cmake-base \
152 -DLLVM_ENABLE_RUNTIMES="libcxx" \
153 -DCMAKE_C_COMPILER=clang-cl \
154 -DCMAKE_CXX_COMPILER=clang-cl \
158 function generate-cmake-android
() {
159 generate-cmake-base \
160 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
161 -DLIBCXX_CXX_ABI=libcxxabi \
165 function check-runtimes
() {
166 step
"Building libc++ test dependencies"
167 ${NINJA} -vC "${BUILD_DIR}" cxx-test-depends
169 step
"Running the libc++ tests"
170 ${NINJA} -vC "${BUILD_DIR}" check-cxx
172 step
"Running the libc++abi tests"
173 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
175 step
"Running the libunwind tests"
176 ${NINJA} -vC "${BUILD_DIR}" check-unwind
179 # TODO: The goal is to test this against all configurations. We should also move
180 # this to the Lit test suite instead of being a separate CMake target.
181 function check-abi-list
() {
182 step
"Running the libc++ ABI list test"
183 ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist ||
(
184 error
"Generating the libc++ ABI list after failed check"
185 ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
190 function test-armv7m-picolibc
() {
193 # To make it easier to get this builder up and running, build picolibc
194 # from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
195 # This could be optimised by building picolibc into the Docker container.
196 step
"Building picolibc from source"
197 ${MONOREPO_ROOT}/libcxx
/utils
/ci
/build-picolibc.sh \
198 --build-dir "${BUILD_DIR}" \
199 --install-dir "${INSTALL_DIR}" \
200 --target armv7m-none-eabi
202 step
"Generating CMake for compiler-rt"
203 flags
="--sysroot=${INSTALL_DIR}"
205 -S "${MONOREPO_ROOT}/compiler-rt" \
206 -B "${BUILD_DIR}/compiler-rt" \
207 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
208 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
209 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
210 -DCMAKE_C_FLAGS="${flags}" \
211 -DCMAKE_CXX_FLAGS="${flags}" \
212 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
215 step
"Generating CMake for libc++"
217 -DLIBCXX_TEST_CONFIG="armv7m-picolibc-libc++.cfg.in" \
218 -DLIBCXXABI_TEST_CONFIG="armv7m-picolibc-libc++abi.cfg.in" \
219 -DLIBUNWIND_TEST_CONFIG="armv7m-picolibc-libunwind.cfg.in" \
220 -DCMAKE_C_FLAGS="${flags}" \
221 -DCMAKE_CXX_FLAGS="${flags}" \
224 step
"Installing compiler-rt"
225 ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
227 # Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
228 # clang 19 changed this to armv7m-unknown-none-eabi. So for as long as 18.x
229 # is supported, we have to ask clang what the triple will be.
230 NORMALISED_TARGET_TRIPLE
=$
(${CC-cc} --target=armv7m-none-eabi
-print-target-triple)
231 # Without this step linking fails later in the build.
232 mv "${BUILD_DIR}/install/lib/${NORMALISED_TARGET_TRIPLE}"/* "${BUILD_DIR}/install/lib"
237 # Print the version of a few tools to aid diagnostics in some cases
238 step
"Diagnose tools in use"
241 if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
244 check-generated-output
)
245 # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
246 # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
250 # Reject patches that forgot to re-run the generator scripts.
251 step
"Making sure the generator scripts were run"
252 set +x
# Printing all the commands below just creates extremely confusing output
253 ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
254 git
diff |
tee ${BUILD_DIR}/generated_output.
patch
255 git ls-files
-o --exclude-standard |
tee ${BUILD_DIR}/generated_output.status
256 ! grep -q '^--- a' ${BUILD_DIR}/generated_output.
patch || false
257 if [ -s ${BUILD_DIR}/generated_output.status
]; then
258 echo "It looks like not all the generator scripts were run,"
259 echo "did you forget to build the libcxx-generate-files target?"
260 echo "Did you add all new files it generated?"
264 # This depends on LC_COLLATE set at the top of this script.
265 step
"Reject patches that introduce non-ASCII characters or hard tabs."
266 ! grep -rn '[^ -~]' libcxx
/include libcxx
/src libcxx
/test \
268 --exclude '*unicode*.cpp' \
269 --exclude '*print*.sh.cpp' \
270 --exclude 'escaped_output.*.pass.cpp' \
271 --exclude 'format_tests.h' \
272 --exclude 'format.functions.tests.h' \
273 --exclude 'formatter.*.pass.cpp' \
274 --exclude 'grep.pass.cpp' \
275 --exclude 'locale-specific_form.pass.cpp' \
276 --exclude 'ostream.pass.cpp' \
277 --exclude 'transcoding.pass.cpp' \
278 --exclude 'underflow.pass.cpp' \
282 # Various Standard modes
284 frozen-cxx03-headers
)
286 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03-frozen.cmake"
292 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
298 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
304 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
310 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
316 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
322 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake"
328 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
333 # Other compiler support
337 generate-cmake
-DLIBCXX_ENABLE_WERROR=NO \
338 -DLIBCXXABI_ENABLE_WERROR=NO \
339 -DLIBUNWIND_ENABLE_WERROR=NO
344 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
345 -DLIBCXX_ENABLE_WERROR=NO \
346 -DLIBCXXABI_ENABLE_WERROR=NO \
347 -DLIBUNWIND_ENABLE_WERROR=NO
355 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
360 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
365 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
370 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
374 # Various build configurations
379 step
"Generating CMake"
381 -S "${MONOREPO_ROOT}/llvm" \
383 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
384 -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
385 -DCMAKE_BUILD_TYPE=Release \
386 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
387 -DLLVM_ENABLE_PROJECTS="clang;lldb" \
388 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
389 -DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \
390 -DLLVM_HOST_TRIPLE="$(${CXX} --print-target-triple)" \
391 -DLLVM_TARGETS_TO_BUILD="host" \
392 -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
393 -DLLVM_ENABLE_ASSERTIONS=ON \
394 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
396 step
"Running the libc++ and libc++abi tests"
397 ${NINJA} -vC "${BUILD_DIR}" check-runtimes
399 step
"Installing libc++ and libc++abi to a fake location"
400 ${NINJA} -vC "${BUILD_DIR}" install-runtimes
402 step
"Running the LLDB libc++ data formatter tests"
403 ${NINJA} -vC "${BUILD_DIR}" lldb-api-test-deps
404 ${BUILD_DIR}/bin
/llvm-lit
-sv --param dotest-args
='--category libc++' "${MONOREPO_ROOT}/lldb/test/API"
410 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
415 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
416 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
417 -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
418 -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
421 generic-hardening-mode-fast
)
423 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake"
427 generic-hardening-mode-fast-with-abi-breaks
)
429 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake"
431 # Not checking ABI list since we purposefully enable ABI breaking changes
433 generic-hardening-mode-extensive
)
435 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake"
439 generic-hardening-mode-debug
)
441 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake"
450 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
456 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
465 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
468 generic-no-filesystem
)
470 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
473 generic-no-random_device
)
475 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
478 generic-no-localization
)
480 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
485 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-terminal.cmake"
490 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
493 generic-no-wide-characters
)
495 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
500 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-tzdb.cmake"
503 generic-no-experimental
)
505 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
509 generic-no-exceptions
)
511 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake"
517 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
521 # Other miscellaneous jobs
523 generic-abi-unstable
)
525 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
528 generic-optimized-speed
)
530 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-optimized-speed.cmake"
536 step
"Installing libc++ with the Apple system configuration"
539 ${MONOREPO_ROOT}/libcxx
/utils
/ci
/apple-install-libcxx.sh \
540 --llvm-root ${MONOREPO_ROOT} \
541 --build-dir ${BUILD_DIR} \
542 --install-dir ${INSTALL_DIR} \
543 --symbols-dir "${BUILD_DIR}/symbols" \
544 --architectures "${arch}" \
547 step
"Running tests against Apple-configured libc++"
548 # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
549 xcrun
--sdk macosx ninja
-vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
551 apple-system-hardened
)
555 version
="$(sw_vers --productVersion)"
556 params
="target_triple=${arch}-apple-macosx${version}"
557 params
+=";hardening_mode=fast"
559 # In the Apple system configuration, we build libc++ and libunwind separately.
560 step
"Installing libc++ and libc++abi in Apple-system configuration"
562 -S "${MONOREPO_ROOT}/runtimes" \
563 -B "${BUILD_DIR}/cxx" \
564 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
565 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
566 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/cxx" \
567 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
568 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
569 -DLIBCXX_CXX_ABI=libcxxabi \
570 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
571 -DLIBCXX_TEST_CONFIG="apple-libc++-system.cfg.in" \
572 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-system.cfg.in" \
573 -DLIBCXX_TEST_PARAMS="${params}" \
574 -DLIBCXXABI_TEST_PARAMS="${params}"
576 step
"Installing libunwind in Apple-system configuration"
578 -S "${MONOREPO_ROOT}/runtimes" \
579 -B "${BUILD_DIR}/unwind" \
580 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
581 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
582 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/unwind" \
583 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
584 -DLLVM_ENABLE_RUNTIMES="libunwind" \
585 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-system.cfg.in" \
586 -DLIBUNWIND_TEST_PARAMS="${params}" \
587 -DCMAKE_INSTALL_NAME_DIR="/usr/lib/system"
589 step
"Running the libc++ tests"
590 ${NINJA} -vC "${BUILD_DIR}/cxx" check-cxx
592 step
"Running the libc++abi tests"
593 ${NINJA} -vC "${BUILD_DIR}/cxx" check-cxxabi
595 step
"Running the libunwind tests"
596 ${NINJA} -vC "${BUILD_DIR}/unwind" check-unwind
602 version
="$(sw_vers --productVersion)"
603 params
="target_triple=${arch}-apple-macosx${version}"
605 # In the Apple system configuration, we build libc++ and libunwind separately.
606 step
"Installing libc++ and libc++abi in Apple-system configuration"
608 -S "${MONOREPO_ROOT}/runtimes" \
609 -B "${BUILD_DIR}/cxx" \
610 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
611 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
612 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/cxx" \
613 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
614 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
615 -DLIBCXX_CXX_ABI=libcxxabi \
616 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
617 -DLIBCXX_TEST_CONFIG="apple-libc++-system.cfg.in" \
618 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-system.cfg.in" \
619 -DLIBCXX_TEST_PARAMS="${params}" \
620 -DLIBCXXABI_TEST_PARAMS="${params}"
622 step
"Installing libunwind in Apple-system configuration"
624 -S "${MONOREPO_ROOT}/runtimes" \
625 -B "${BUILD_DIR}/unwind" \
626 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
627 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
628 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/unwind" \
629 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
630 -DLLVM_ENABLE_RUNTIMES="libunwind" \
631 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-system.cfg.in" \
632 -DLIBUNWIND_TEST_PARAMS="${params}" \
633 -DCMAKE_INSTALL_NAME_DIR="/usr/lib/system"
635 step
"Running the libc++ tests"
636 ${NINJA} -vC "${BUILD_DIR}/cxx" check-cxx
638 step
"Running the libc++abi tests"
639 ${NINJA} -vC "${BUILD_DIR}/cxx" check-cxxabi
641 step
"Running the libunwind tests"
642 ${NINJA} -vC "${BUILD_DIR}/unwind" check-unwind
646 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
649 aarch64-no-exceptions
)
651 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
652 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
653 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
659 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
664 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake"
667 # Armv7 32 bit. One building Arm only one Thumb only code.
670 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
675 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake"
679 test-armv7m-picolibc \
680 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake"
682 armv7m-picolibc-no-exceptions
)
683 test-armv7m-picolibc \
684 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake" \
685 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
686 -DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF \
687 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
688 -DLIBCXX_ENABLE_RTTI=OFF
692 # TODO: Currently, building with the experimental library breaks running
693 # tests (the test linking look for the c++experimental library with the
694 # wrong name, and the statically linked c++experimental can't be linked
695 # correctly when libc++ visibility attributes indicate dllimport linkage
696 # anyway), thus just disable the experimental library. Remove this
697 # setting when cmake and the test driver does the right thing automatically.
698 generate-cmake-libcxx-win
-DLIBCXX_TEST_PARAMS="enable_experimental=False"
699 step
"Running the libc++ tests"
700 ${NINJA} -vC "${BUILD_DIR}" check-cxx
704 generate-cmake-libcxx-win
-DLIBCXX_ENABLE_SHARED=OFF
705 step
"Running the libc++ tests"
706 ${NINJA} -vC "${BUILD_DIR}" check-cxx
708 clang-cl-no-vcruntime
)
710 # Building libc++ in the same way as in clang-cl-dll above, but running
711 # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
712 # translation units while using libc++, even if libc++ is built with
713 # exceptions enabled.
714 generate-cmake-libcxx-win
-DLIBCXX_TEST_PARAMS="enable_experimental=False" \
715 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
716 step
"Running the libc++ tests"
717 ${NINJA} -vC "${BUILD_DIR}" check-cxx
721 generate-cmake-libcxx-win
-DLIBCXX_TEST_PARAMS="enable_experimental=False" \
722 -DCMAKE_BUILD_TYPE=Debug
723 step
"Running the libc++ tests"
724 ${NINJA} -vC "${BUILD_DIR}" check-cxx
728 # Test linking a static libc++ with the static CRT ("MultiThreaded" denotes
729 # the static CRT, as opposed to "MultiThreadedDLL" which is the default).
730 generate-cmake-libcxx-win
-DLIBCXX_ENABLE_SHARED=OFF \
731 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
732 step
"Running the libc++ tests"
733 ${NINJA} -vC "${BUILD_DIR}" check-cxx
738 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
744 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
745 -DLIBCXX_ENABLE_SHARED=OFF \
746 -DLIBUNWIND_ENABLE_SHARED=OFF
752 -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
753 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang
++ \
754 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
757 mingw-incomplete-sysroot
)
758 # When bringing up a new cross compiler from scratch, we build
759 # libunwind/libcxx in a setup where the toolchain is incomplete and
760 # unable to perform the normal linker checks; this requires a few
761 # special cases in the CMake files.
763 # Building in an incomplete setup requires setting CMAKE_*_COMPILER_WORKS,
764 # as CMake fails to probe the compiler. This case also requires
765 # setting CMAKE_CXX_COMPILER_TARGET, as LLVM's heuristics for setting
766 # the triple fails when CMake hasn't been able to probe the environment.
767 # (This is what one has to do when building the initial libunwind/libcxx
768 # for a new toolchain.)
771 -DCMAKE_C_COMPILER_WORKS=TRUE \
772 -DCMAKE_CXX_COMPILER_WORKS=TRUE \
773 -DCMAKE_C_COMPILER_TARGET=x86_64-w64-windows-gnu \
774 -DCMAKE_CXX_COMPILER_TARGET=x86_64-w64-windows-gnu \
775 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
776 # Only test that building succeeds; there's not much extra value in running
777 # the tests here, as it would be equivalent to the mingw-dll config above.
778 step
"Building the runtimes"
779 ${NINJA} -vC "${BUILD_DIR}"
783 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
784 -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
785 -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
786 -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
793 ANDROID_EMU_IMG
="${BUILDER#android-ndk-}"
794 .
"${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/emulator-functions.sh"
795 if ! validate_emu_img
"${ANDROID_EMU_IMG}"; then
796 error
"android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG})" >&2
799 ARCH
=$
(arch_of_emu_img
${ANDROID_EMU_IMG})
801 # Use the Android compiler by default.
802 export CC
=${CC:-/opt/android/clang/clang-current/bin/clang}
803 export CXX
=${CXX:-/opt/android/clang/clang-current/bin/clang++}
805 # The NDK libc++_shared.so is always built against the oldest supported API
806 # level. When tests are run against a device with a newer API level, test
807 # programs can be built for any supported API level, but building for the
808 # newest API (i.e. the system image's API) is probably the most interesting.
809 PARAMS
="executor=${MONOREPO_ROOT}/libcxx/utils/adb_run.py;target_triple=$(triple_of_arch ${ARCH})$(api_of_emu_img ${ANDROID_EMU_IMG})"
810 generate-cmake-android
-C "${MONOREPO_ROOT}/runtimes/cmake/android/Arch-${ARCH}.cmake" \
811 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AndroidNDK.cmake" \
812 -DCMAKE_SYSROOT=/opt
/android
/ndk
/sysroot \
813 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
814 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
816 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
818 # Start the emulator and make sure we can connect to the adb server running
820 "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/start-emulator.sh" ${ANDROID_EMU_IMG}
821 trap "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/stop-emulator.sh" EXIT
822 .
"${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/setup-env-for-emulator.sh"
824 # Create adb_run early to avoid concurrent `mkdir -p` of common parent
826 adb shell mkdir
-p /data
/local
/tmp
/adb_run
827 adb push
"${BUILD_DIR}/lib/libc++_shared.so" /data
/local
/tmp
/libc
++/libc
++_shared.so
828 step
"Running the libc++ tests"
829 ${NINJA} -vC "${BUILD_DIR}" check-cxx
830 step
"Running the libc++abi tests"
831 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
833 #################################################################
834 # Insert vendor-specific internal configurations below.
836 # This allows vendors to extend this file with their own internal
837 # configurations without running into merge conflicts with upstream.
838 #################################################################
840 #################################################################
842 echo "${BUILDER} is not a known configuration"
847 endstep
# Make sure we close any still-open output group