@@ -18,6 +18,7 @@ set -o pipefail
1818
1919MONOREPO_ROOT=" ${MONOREPO_ROOT:= " $( git rev-parse --show-toplevel) " } "
2020BUILD_DIR=" ${BUILD_DIR:= ${MONOREPO_ROOT} / build} "
21+ INSTALL_DIR=" ${BUILD_DIR} /install"
2122rm -rf " ${BUILD_DIR} "
2223
2324ccache --zero-stats
@@ -27,14 +28,10 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
2728 ccache --clear
2829fi
2930
30- mkdir -p artifacts/reproducers
31-
32- # Make sure any clang reproducers will end up as artifacts.
33- export CLANG_CRASH_DIAGNOSTICS_DIR=` realpath artifacts/reproducers`
34-
3531function at-exit {
3632 retcode=$?
3733
34+ mkdir -p artifacts
3835 ccache --print-stats > artifacts/ccache_stats.txt
3936 cp " ${BUILD_DIR} " /.ninja_log artifacts/.ninja_log
4037
@@ -53,28 +50,17 @@ trap at-exit EXIT
5350
5451projects=" ${1} "
5552targets=" ${2} "
56- runtimes=" ${3} "
5753
5854lit_args=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5955
6056echo " --- cmake"
61-
6257export PIP_BREAK_SYSTEM_PACKAGES=1
6358pip install -q -r " ${MONOREPO_ROOT} " /mlir/python/requirements.txt
6459pip install -q -r " ${MONOREPO_ROOT} " /lldb/test/requirements.txt
6560pip install -q -r " ${MONOREPO_ROOT} " /.ci/requirements.txt
66-
67- # Set the system llvm-symbolizer as preferred.
68- export LLVM_SYMBOLIZER_PATH=` which llvm-symbolizer`
69- [[ ! -f " ${LLVM_SYMBOLIZER_PATH} " ]] && echo " llvm-symbolizer not found!"
70-
71- # Set up all runtimes either way. libcxx is a dependency of LLDB.
72- # If it ends up being unused, not much harm.
7361cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
7462 -D LLVM_ENABLE_PROJECTS=" ${projects} " \
75- -D LLVM_ENABLE_RUNTIMES=" libcxx;libcxxabi;libunwind" \
7663 -G Ninja \
77- -D CMAKE_PREFIX_PATH=" ${HOME} /.local" \
7864 -D CMAKE_BUILD_TYPE=Release \
7965 -D LLVM_ENABLE_ASSERTIONS=ON \
8066 -D LLVM_BUILD_EXAMPLES=ON \
@@ -83,47 +69,69 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
8369 -D LLVM_ENABLE_LLD=ON \
8470 -D CMAKE_CXX_FLAGS=-gmlt \
8571 -D LLVM_CCACHE_BUILD=ON \
86- -D LIBCXX_CXX_ABI=libcxxabi \
8772 -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
88- -D LLDB_ENABLE_PYTHON=ON \
89- -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON
73+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} "
9074
9175echo " --- ninja"
92-
9376# Targets are not escaped as they are passed as separate arguments.
9477ninja -C " ${BUILD_DIR} " -k 0 ${targets}
9578
79+ runtimes=" ${3} "
9680runtime_targets=" ${4} "
9781
98- # Run runtimes tests.
99- # We don't need to do a clean separate build of runtimes, because runtimes
100- # will be built against just built clang, and because LIBCXX_TEST_PARAMS
101- # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
102- # propagates without a clean build. Other that those two variables, builds
103- # are supposed to be the same.
82+ # Compiling runtimes with just-built Clang and running their tests
83+ # as an additional testing for Clang.
10484if [[ " ${runtimes} " != " " ]]; then
10585 if [[ " ${runtime_targets} " == " " ]]; then
10686 echo " Runtimes to build are specified, but targets are not."
10787 exit 1
10888 fi
10989
90+ echo " --- ninja install-clang"
91+
92+ ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
93+
94+ RUNTIMES_BUILD_DIR=" ${MONOREPO_ROOT} /build-runtimes"
95+ INSTALL_DIR=" ${BUILD_DIR} /install"
96+ mkdir -p ${RUNTIMES_BUILD_DIR}
97+
11098 echo " --- cmake runtimes C++26"
11199
112- cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
100+ rm -rf " ${RUNTIMES_BUILD_DIR} "
101+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
102+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
103+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
104+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
105+ -D LIBCXX_CXX_ABI=libcxxabi \
106+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
107+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
113108 -D LIBCXX_TEST_PARAMS=" std=c++26" \
114- -D LIBCXXABI_TEST_PARAMS=" std=c++26"
109+ -D LIBCXXABI_TEST_PARAMS=" std=c++26" \
110+ -D LLVM_LIT_ARGS=" ${lit_args} "
115111
116112 echo " --- ninja runtimes C++26"
117113
118- ninja -vC " ${BUILD_DIR } " ${runtime_targets}
114+ ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
119115
120116 echo " --- cmake runtimes clang modules"
121117
122- cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
118+ # We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
119+ # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
120+ # propagates without a clean build. Other that those two variables, builds
121+ # are supposed to be the same.
122+
123+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
124+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
125+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
126+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
127+ -D LIBCXX_CXX_ABI=libcxxabi \
128+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
129+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
123130 -D LIBCXX_TEST_PARAMS=" enable_modules=clang" \
124- -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang"
131+ -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang" \
132+ -D LLVM_LIT_ARGS=" ${lit_args} "
125133
126134 echo " --- ninja runtimes clang modules"
127135
128- ninja -vC " ${BUILD_DIR } " ${runtime_targets}
136+ ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
129137fi
0 commit comments