@@ -18,6 +18,7 @@ set -o pipefail
18
18
19
19
MONOREPO_ROOT=" ${MONOREPO_ROOT:= " $( git rev-parse --show-toplevel) " } "
20
20
BUILD_DIR=" ${BUILD_DIR:= ${MONOREPO_ROOT} / build} "
21
+ INSTALL_DIR=" ${BUILD_DIR} /install"
21
22
rm -rf " ${BUILD_DIR} "
22
23
23
24
ccache --zero-stats
@@ -27,14 +28,10 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
27
28
ccache --clear
28
29
fi
29
30
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
-
35
31
function at-exit {
36
32
retcode=$?
37
33
34
+ mkdir -p artifacts
38
35
ccache --print-stats > artifacts/ccache_stats.txt
39
36
cp " ${BUILD_DIR} " /.ninja_log artifacts/.ninja_log
40
37
@@ -53,28 +50,17 @@ trap at-exit EXIT
53
50
54
51
projects=" ${1} "
55
52
targets=" ${2} "
56
- runtimes=" ${3} "
57
53
58
54
lit_args=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
59
55
60
56
echo " --- cmake"
61
-
62
57
export PIP_BREAK_SYSTEM_PACKAGES=1
63
58
pip install -q -r " ${MONOREPO_ROOT} " /mlir/python/requirements.txt
64
59
pip install -q -r " ${MONOREPO_ROOT} " /lldb/test/requirements.txt
65
60
pip 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.
73
61
cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
74
62
-D LLVM_ENABLE_PROJECTS=" ${projects} " \
75
- -D LLVM_ENABLE_RUNTIMES=" libcxx;libcxxabi;libunwind" \
76
63
-G Ninja \
77
- -D CMAKE_PREFIX_PATH=" ${HOME} /.local" \
78
64
-D CMAKE_BUILD_TYPE=Release \
79
65
-D LLVM_ENABLE_ASSERTIONS=ON \
80
66
-D LLVM_BUILD_EXAMPLES=ON \
@@ -83,47 +69,69 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
83
69
-D LLVM_ENABLE_LLD=ON \
84
70
-D CMAKE_CXX_FLAGS=-gmlt \
85
71
-D LLVM_CCACHE_BUILD=ON \
86
- -D LIBCXX_CXX_ABI=libcxxabi \
87
72
-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} "
90
74
91
75
echo " --- ninja"
92
-
93
76
# Targets are not escaped as they are passed as separate arguments.
94
77
ninja -C " ${BUILD_DIR} " -k 0 ${targets}
95
78
79
+ runtimes=" ${3} "
96
80
runtime_targets=" ${4} "
97
81
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.
104
84
if [[ " ${runtimes} " != " " ]]; then
105
85
if [[ " ${runtime_targets} " == " " ]]; then
106
86
echo " Runtimes to build are specified, but targets are not."
107
87
exit 1
108
88
fi
109
89
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
+
110
98
echo " --- cmake runtimes C++26"
111
99
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} " \
113
108
-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} "
115
111
116
112
echo " --- ninja runtimes C++26"
117
113
118
- ninja -vC " ${BUILD_DIR } " ${runtime_targets}
114
+ ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
119
115
120
116
echo " --- cmake runtimes clang modules"
121
117
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} " \
123
130
-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} "
125
133
126
134
echo " --- ninja runtimes clang modules"
127
135
128
- ninja -vC " ${BUILD_DIR } " ${runtime_targets}
136
+ ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
129
137
fi
0 commit comments