@@ -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
@@ -53,12 +54,10 @@ trap at-exit EXIT
53
54
54
55
projects=" ${1} "
55
56
targets=" ${2} "
56
- runtimes=" ${3} "
57
57
58
58
lit_args=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
59
59
60
60
echo " --- cmake"
61
-
62
61
export PIP_BREAK_SYSTEM_PACKAGES=1
63
62
pip install -q -r " ${MONOREPO_ROOT} " /mlir/python/requirements.txt
64
63
pip install -q -r " ${MONOREPO_ROOT} " /lldb/test/requirements.txt
@@ -69,7 +68,7 @@ export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`
69
68
[[ ! -f " ${LLVM_SYMBOLIZER_PATH} " ]] && echo " llvm-symbolizer not found!"
70
69
71
70
# Set up all runtimes either way. libcxx is a dependency of LLDB.
72
- # If it ends up being unused, not much harm .
71
+ # It will not be built unless it is used .
73
72
cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
74
73
-D LLVM_ENABLE_PROJECTS=" ${projects} " \
75
74
-D LLVM_ENABLE_RUNTIMES=" libcxx;libcxxabi;libunwind" \
@@ -86,44 +85,69 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
86
85
-D LIBCXX_CXX_ABI=libcxxabi \
87
86
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
88
87
-D LLDB_ENABLE_PYTHON=ON \
89
- -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON
88
+ -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
89
+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} "
90
90
91
91
echo " --- ninja"
92
-
93
92
# Targets are not escaped as they are passed as separate arguments.
94
93
ninja -C " ${BUILD_DIR} " -k 0 ${targets}
95
94
95
+ runtimes=" ${3} "
96
96
runtime_targets=" ${4} "
97
97
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.
98
+ # Compiling runtimes with just-built Clang and running their tests
99
+ # as an additional testing for Clang.
104
100
if [[ " ${runtimes} " != " " ]]; then
105
101
if [[ " ${runtime_targets} " == " " ]]; then
106
102
echo " Runtimes to build are specified, but targets are not."
107
103
exit 1
108
104
fi
109
105
106
+ echo " --- ninja install-clang"
107
+
108
+ ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
109
+
110
+ RUNTIMES_BUILD_DIR=" ${MONOREPO_ROOT} /build-runtimes"
111
+ INSTALL_DIR=" ${BUILD_DIR} /install"
112
+ mkdir -p ${RUNTIMES_BUILD_DIR}
113
+
110
114
echo " --- cmake runtimes C++26"
111
115
112
- cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
116
+ rm -rf " ${RUNTIMES_BUILD_DIR} "
117
+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
118
+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
119
+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
120
+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
121
+ -D LIBCXX_CXX_ABI=libcxxabi \
122
+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
123
+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
113
124
-D LIBCXX_TEST_PARAMS=" std=c++26" \
114
- -D LIBCXXABI_TEST_PARAMS=" std=c++26"
125
+ -D LIBCXXABI_TEST_PARAMS=" std=c++26" \
126
+ -D LLVM_LIT_ARGS=" ${lit_args} "
115
127
116
128
echo " --- ninja runtimes C++26"
117
129
118
- ninja -vC " ${BUILD_DIR } " ${runtime_targets}
130
+ ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
119
131
120
132
echo " --- cmake runtimes clang modules"
121
133
122
- cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
134
+ # We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
135
+ # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
136
+ # propagates without a clean build. Other that those two variables, builds
137
+ # are supposed to be the same.
138
+
139
+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
140
+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
141
+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
142
+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
143
+ -D LIBCXX_CXX_ABI=libcxxabi \
144
+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
145
+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
123
146
-D LIBCXX_TEST_PARAMS=" enable_modules=clang" \
124
- -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang"
147
+ -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang" \
148
+ -D LLVM_LIT_ARGS=" ${lit_args} "
125
149
126
150
echo " --- ninja runtimes clang modules"
127
151
128
- ninja -vC " ${BUILD_DIR } " ${runtime_targets}
152
+ ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
129
153
fi
0 commit comments