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>'.
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.
36 CC The C compiler to use, this value is used by CMake. This
39 CXX The C++ compiler to use, this value is used by CMake. This
42 CMAKE The CMake binary to use. This variable is optional.
44 CLANG_FORMAT The clang-format binary to use when generating the format
47 ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
50 ENABLE_STD_MODULES Whether to enable or disable building the C++23 std
51 modules. This variable is optional.
52 TODO MODULES remove when all supported compilers support
58 if [[ $# == 0 ]]; then
63 while [[ $# -gt 0 ]]; do
88 MONOREPO_ROOT
="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
89 BUILD_DIR
="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
90 INSTALL_DIR
="${BUILD_DIR}/install"
92 # If we can find Ninja/CMake provided by Xcode, use those since we know their
93 # version will generally work with the Clang shipped in Xcode (e.g. if Clang
94 # knows about -std=c++20, the CMake bundled in Xcode will probably know about
96 if xcrun
--find ninja
&>/dev
/null
; then
97 NINJA
="$(xcrun --find ninja)"
98 elif which ninja
&>/dev
/null
; then
99 # The current implementation of modules needs the absolute path to the ninja
101 # TODO MODULES Is this still needed when CMake has libc++ module support?
102 NINJA
="$(which ninja)"
107 if [ -z "${CMAKE}" ]; then
108 if xcrun
--find cmake
&>/dev
/null
; then
109 CMAKE
="$(xcrun --find cmake)"
116 rm -rf "${BUILD_DIR}"
119 if [ -z "${ENABLE_CLANG_TIDY}" ]; then
120 ENABLE_CLANG_TIDY
=Off
123 if [ -n "${ENABLE_STD_MODULES}" ]; then
124 ENABLE_STD_MODULES
="-DLIBCXX_ENABLE_STD_MODULES=${ENABLE_STD_MODULES}"
127 function generate-cmake-base
() {
128 echo "--- Generating CMake"
130 -S "${MONOREPO_ROOT}/runtimes" \
132 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
133 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
134 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
135 -DLIBCXX_ENABLE_WERROR=YES \
136 -DLIBCXXABI_ENABLE_WERROR=YES \
137 -DLIBUNWIND_ENABLE_WERROR=YES \
138 -DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
139 ${ENABLE_STD_MODULES} \
140 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
144 function generate-cmake
() {
145 generate-cmake-base \
146 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
147 -DLIBCXX_CXX_ABI=libcxxabi \
151 function generate-cmake-libcxx-win
() {
152 generate-cmake-base \
153 -DLLVM_ENABLE_RUNTIMES="libcxx" \
154 -DCMAKE_C_COMPILER=clang-cl \
155 -DCMAKE_CXX_COMPILER=clang-cl \
159 function generate-cmake-android
() {
160 generate-cmake-base \
161 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
162 -DLIBCXX_CXX_ABI=libcxxabi \
166 function check-runtimes
() {
167 echo "+++ Running the libc++ tests"
168 ${NINJA} -vC "${BUILD_DIR}" check-cxx
170 echo "+++ Running the libc++abi tests"
171 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
173 echo "+++ Running the libunwind tests"
174 ${NINJA} -vC "${BUILD_DIR}" check-unwind
176 # TODO: On macOS 13.5, the linker seems to have an issue where it will pick up
177 # a library if it exists inside a -L search path, even if we don't link
178 # against that library. This happens with libunwind.dylib if it is built
179 # at the point when we run the libc++ tests, which causes issues cause we
180 # are also linking against the system unwinder.
182 # I believe this is a linker regression and I reported it as rdar://115842730.
183 # It should be possible to move this installation step back to the top once
184 # that issue has been resolved, but in the meantime it doesn't really hurt to
186 echo "--- Installing libc++, libc++abi and libunwind to a fake location"
187 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
190 # TODO: The goal is to test this against all configurations. We should also move
191 # this to the Lit test suite instead of being a separate CMake target.
192 function check-abi-list
() {
193 echo "+++ Running the libc++ ABI list test"
194 ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist ||
(
195 echo "+++ Generating the libc++ ABI list after failed check"
196 ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
201 function check-cxx-benchmarks
() {
202 echo "--- Running the benchmarks"
203 ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
206 # Print the version of a few tools to aid diagnostics in some cases
210 if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
213 check-generated-output
)
214 # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
215 # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
219 set +x
# Printing all the commands below just creates extremely confusing output
221 # Reject patches that forgot to re-run the generator scripts.
222 echo "+++ Making sure the generator scripts were run"
223 ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
224 git
diff |
tee ${BUILD_DIR}/generated_output.
patch
225 git ls-files
-o --exclude-standard |
tee ${BUILD_DIR}/generated_output.status
226 ! grep -q '^--- a' ${BUILD_DIR}/generated_output.
patch || false
227 if [ -s ${BUILD_DIR}/generated_output.status
]; then
228 echo "It looks like not all the generator scripts were run,"
229 echo "did you forget to build the libcxx-generate-files target?"
230 echo "Did you add all new files it generated?"
234 echo "+++ Making sure libcxx/utils/data/ignore_format.txt was updated appropriately"
235 cp ${MONOREPO_ROOT}/libcxx
/utils
/data
/ignore_format.txt
${BUILD_DIR}/before.txt
236 ${MONOREPO_ROOT}/libcxx
/utils
/generate_ignore_format.sh
237 diff ${BUILD_DIR}/before.txt ${MONOREPO_ROOT}/libcxx/utils/data/ignore_format.txt | tee ${BUILD_DIR}/ignore_format.
diff || true
238 if [ -s ${BUILD_DIR}/ignore_format.
diff ]; then
239 echo "It looks like the list of not formatted files has changed."
240 echo "If a file is now properly formatted with clang-format, remove the file name from "
241 echo "libcxx/utils/data/ignore_format.txt. Otherwise you have to fix the"
242 echo "formatting of some of the changed files. The diff above represents the "
243 echo "changes that would be needed to ignore_format.txt to keep it representative "
244 echo "of which files are mis-formatted in the project."
248 # Reject patches that introduce non-ASCII characters or hard tabs.
249 # Depends on LC_COLLATE set at the top of this script.
251 ! grep -rn '[^ -~]' libcxx
/include libcxx
/src libcxx
/test libcxx
/benchmarks \
253 --exclude '*unicode*.cpp' \
254 --exclude '*print*.sh.cpp' \
255 --exclude 'escaped_output.*.pass.cpp' \
256 --exclude 'format_tests.h' \
257 --exclude 'format.functions.tests.h' \
258 --exclude 'formatter.*.pass.cpp' \
259 --exclude 'grep.pass.cpp' \
260 --exclude 'locale-specific_form.pass.cpp' \
261 --exclude 'ostream.pass.cpp' \
262 --exclude 'transcoding.pass.cpp' \
263 --exclude 'underflow.pass.cpp' \
266 # Reject code with trailing whitespace
267 ! grep -rn '[[:blank:]]$' libcxx
/include libcxx
/src libcxx
/test libcxx
/benchmarks || false
270 # Various Standard modes
274 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
280 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
286 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
292 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
298 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
304 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake"
310 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
315 # Other compiler support
319 generate-cmake
-DLIBCXX_ENABLE_WERROR=NO \
320 -DLIBCXXABI_ENABLE_WERROR=NO \
321 -DLIBUNWIND_ENABLE_WERROR=NO
326 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
327 -DLIBCXX_ENABLE_WERROR=NO \
328 -DLIBCXXABI_ENABLE_WERROR=NO \
329 -DLIBUNWIND_ENABLE_WERROR=NO
337 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
342 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
347 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
352 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
356 # Various build configurations
361 echo "--- Generating CMake"
363 -S "${MONOREPO_ROOT}/llvm" \
365 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
366 -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
367 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
368 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
369 -DLLVM_ENABLE_PROJECTS="clang" \
370 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
371 -DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \
372 -DLLVM_TARGETS_TO_BUILD="host" \
373 -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
374 -DLLVM_ENABLE_ASSERTIONS=ON \
375 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
377 echo "+++ Running the libc++ and libc++abi tests"
378 ${NINJA} -vC "${BUILD_DIR}" check-runtimes
380 echo "--- Installing libc++ and libc++abi to a fake location"
381 ${NINJA} -vC "${BUILD_DIR}" install-runtimes
387 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
392 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
393 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
394 -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
395 -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
398 generic-hardened-mode
)
400 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake"
406 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-safe-mode.cmake"
412 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
416 generic-with_llvm_unwinder
)
418 generate-cmake
-DLIBCXXABI_USE_LLVM_UNWINDER=ON
426 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
432 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
441 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
444 generic-no-filesystem
)
446 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
449 generic-no-random_device
)
451 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
454 generic-no-localization
)
456 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
461 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
464 generic-no-wide-characters
)
466 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
471 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-tzdb.cmake"
474 generic-no-experimental
)
476 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
480 generic-no-exceptions
)
482 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake"
487 # Other miscellaneous jobs
489 generic-abi-unstable
)
491 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
499 ${MONOREPO_ROOT}/libcxx
/utils
/ci
/apple-install-libcxx.sh \
500 --llvm-root ${MONOREPO_ROOT} \
501 --build-dir ${BUILD_DIR} \
502 --install-dir ${INSTALL_DIR} \
503 --symbols-dir "${BUILD_DIR}/symbols" \
504 --architectures "${arch}" \
507 # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
508 xcrun
--sdk macosx ninja
-vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
510 apple-system-backdeployment-hardened-
*)
513 if [[ "${OSX_ROOTS}" == "" ]]; then
514 echo "--- Downloading previous macOS dylibs"
515 PREVIOUS_DYLIBS_URL
="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
516 OSX_ROOTS
="${BUILD_DIR}/macos-roots"
517 mkdir
-p "${OSX_ROOTS}"
518 curl
"${PREVIOUS_DYLIBS_URL}" |
tar -xz --strip-components=1 -C "${OSX_ROOTS}"
521 DEPLOYMENT_TARGET
="${BUILDER#apple-system-backdeployment-hardened-}"
523 # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
524 # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
525 # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
526 cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
527 "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
528 cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
529 "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
532 PARAMS
="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
533 PARAMS
+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
534 PARAMS
+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
535 PARAMS
+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
536 PARAMS
+=";hardening_mode=hardened"
538 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
539 -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
540 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
541 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
542 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
543 -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
544 -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
548 apple-system-backdeployment-
*)
551 if [[ "${OSX_ROOTS}" == "" ]]; then
552 echo "--- Downloading previous macOS dylibs"
553 PREVIOUS_DYLIBS_URL
="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
554 OSX_ROOTS
="${BUILD_DIR}/macos-roots"
555 mkdir
-p "${OSX_ROOTS}"
556 curl
"${PREVIOUS_DYLIBS_URL}" |
tar -xz --strip-components=1 -C "${OSX_ROOTS}"
559 DEPLOYMENT_TARGET
="${BUILDER#apple-system-backdeployment-}"
561 # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
562 # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
563 # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
564 cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
565 "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
566 cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
567 "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
570 PARAMS
="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
571 PARAMS
+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
572 PARAMS
+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
573 PARAMS
+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
575 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
576 -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
577 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
578 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
579 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
580 -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
581 -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
592 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
595 aarch64-no-exceptions
)
597 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
598 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
599 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
605 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
610 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake"
613 # Armv7 32 bit. One building Arm only one Thumb only code.
616 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
621 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake"
626 # TODO: Currently, building with the experimental library breaks running
627 # tests (the test linking look for the c++experimental library with the
628 # wrong name, and the statically linked c++experimental can't be linked
629 # correctly when libc++ visibility attributes indicate dllimport linkage
630 # anyway), thus just disable the experimental library. Remove this
631 # setting when cmake and the test driver does the right thing automatically.
632 generate-cmake-libcxx-win
-DLIBCXX_TEST_PARAMS="enable_experimental=False"
633 echo "+++ Running the libc++ tests"
634 ${NINJA} -vC "${BUILD_DIR}" check-cxx
638 generate-cmake-libcxx-win
-DLIBCXX_ENABLE_SHARED=OFF
639 echo "+++ Running the libc++ tests"
640 ${NINJA} -vC "${BUILD_DIR}" check-cxx
642 clang-cl-no-vcruntime
)
644 # Building libc++ in the same way as in clang-cl-dll above, but running
645 # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
646 # translation units while using libc++, even if libc++ is built with
647 # exceptions enabled.
648 generate-cmake-libcxx-win
-DLIBCXX_TEST_PARAMS="enable_experimental=False" \
649 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
650 echo "+++ Running the libc++ tests"
651 ${NINJA} -vC "${BUILD_DIR}" check-cxx
655 generate-cmake-libcxx-win
-DLIBCXX_TEST_PARAMS="enable_experimental=False" \
656 -DCMAKE_BUILD_TYPE=Debug
657 echo "+++ Running the libc++ tests"
658 ${NINJA} -vC "${BUILD_DIR}" check-cxx
662 # Test linking a static libc++ with the static CRT ("MultiThreaded" denotes
663 # the static CRT, as opposed to "MultiThreadedDLL" which is the default).
664 generate-cmake-libcxx-win
-DLIBCXX_ENABLE_SHARED=OFF \
665 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
666 echo "+++ Running the libc++ tests"
667 ${NINJA} -vC "${BUILD_DIR}" check-cxx
671 # Explicitly specify the compiler with a triple prefix. The CI
672 # environment has got two installations of Clang; the default one
673 # defaults to MSVC mode, while there's an installation of llvm-mingw
674 # further back in PATH. By calling the compiler with an explicit
675 # triple prefix, we use the one that is bundled with a mingw sysroot.
677 -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
678 -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang
++ \
679 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
685 -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
686 -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang
++ \
687 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
688 -DLIBCXX_ENABLE_SHARED=OFF \
689 -DLIBUNWIND_ENABLE_SHARED=OFF
695 -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
696 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang
++ \
697 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
702 generate-cmake
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
703 -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
704 -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
705 -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
712 ANDROID_EMU_IMG
="${BUILDER#android-ndk-}"
713 .
"${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/emulator-functions.sh"
714 if ! validate_emu_img
"${ANDROID_EMU_IMG}"; then
715 echo "error: android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG})" >&2
718 ARCH
=$
(arch_of_emu_img
${ANDROID_EMU_IMG})
720 # Use the Android compiler by default.
721 export CC
=${CC:-/opt/android/clang/clang-current/bin/clang}
722 export CXX
=${CXX:-/opt/android/clang/clang-current/bin/clang++}
724 # The NDK libc++_shared.so is always built against the oldest supported API
725 # level. When tests are run against a device with a newer API level, test
726 # programs can be built for any supported API level, but building for the
727 # newest API (i.e. the system image's API) is probably the most interesting.
728 PARAMS
="target_triple=$(triple_of_arch ${ARCH})$(api_of_emu_img ${ANDROID_EMU_IMG})"
729 generate-cmake-android
-C "${MONOREPO_ROOT}/runtimes/cmake/android/Arch-${ARCH}.cmake" \
730 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AndroidNDK.cmake" \
731 -DCMAKE_SYSROOT=/opt
/android
/ndk
/sysroot \
732 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
733 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
734 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
736 # Start the emulator and make sure we can connect to the adb server running
738 "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/start-emulator.sh" ${ANDROID_EMU_IMG}
739 trap "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/stop-emulator.sh" EXIT
740 .
"${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/setup-env-for-emulator.sh"
742 # Create adb_run early to avoid concurrent `mkdir -p` of common parent
744 adb shell mkdir
-p /data
/local
/tmp
/adb_run
745 adb push
"${BUILD_DIR}/lib/libc++_shared.so" /data
/local
/tmp
/libc
++/libc
++_shared.so
746 echo "+++ Running the libc++ tests"
747 ${NINJA} -vC "${BUILD_DIR}" check-cxx
748 echo "+++ Running the libc++abi tests"
749 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
751 #################################################################
752 # Insert vendor-specific internal configurations below.
754 # This allows vendors to extend this file with their own internal
755 # configurations without running into merge conflicts with upstream.
756 #################################################################
758 #################################################################
760 echo "${BUILDER} is not a known configuration"