@@ -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
@@ -49,8 +50,79 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4950 -D LLVM_ENABLE_LLD=ON \
5051 -D CMAKE_CXX_FLAGS=-gmlt \
5152 -D LLVM_CCACHE_BUILD=ON \
52- -D MLIR_ENABLE_BINDINGS_PYTHON=ON
53+ -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
54+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} "
5355
5456echo " --- ninja"
5557# Targets are not escaped as they are passed as separate arguments.
5658ninja -C " ${BUILD_DIR} " -k 0 ${targets}
59+
60+ runtimes=" ${3} "
61+ runtime_targets=" ${4} "
62+
63+ # Compiling runtimes with just-built Clang and running their tests
64+ # as an additional testing for Clang.
65+ if [[ " ${runtimes} " != " " ]]; then
66+ if [[ " ${runtime_targets} " == " " ]]; then
67+ echo " Runtimes to build are specified, but targets are not."
68+ exit 1
69+ fi
70+
71+ echo " --- ninja install-clang"
72+
73+ ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
74+
75+ RUNTIMES_BUILD_DIR=" ${MONOREPO_ROOT} /build-runtimes"
76+ INSTALL_DIR=" ${BUILD_DIR} /install"
77+ mkdir -p ${RUNTIMES_BUILD_DIR}
78+
79+ echo " --- cmake runtimes C++03"
80+
81+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
82+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
83+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
84+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
85+ -D LIBCXX_CXX_ABI=libcxxabi \
86+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
87+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
88+ -D LIBCXX_TEST_PARAMS=" std=c++03" \
89+ -D LIBCXXABI_TEST_PARAMS=" std=c++03"
90+
91+ echo " --- ninja runtimes C++03"
92+
93+ ninja -vC " ${RUNTIMES_BUILD_DIR} " ${runtime_targets}
94+
95+ echo " --- cmake runtimes C++26"
96+
97+ rm -rf " ${RUNTIMES_BUILD_DIR} "
98+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
99+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
100+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
101+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
102+ -D LIBCXX_CXX_ABI=libcxxabi \
103+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
104+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
105+ -D LIBCXX_TEST_PARAMS=" std=c++26" \
106+ -D LIBCXXABI_TEST_PARAMS=" std=c++26"
107+
108+ echo " --- ninja runtimes C++26"
109+
110+ ninja -vC " ${RUNTIMES_BUILD_DIR} " ${runtime_targets}
111+
112+ echo " --- cmake runtimes clang modules"
113+
114+ rm -rf " ${RUNTIMES_BUILD_DIR} "
115+ cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
116+ -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
117+ -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
118+ -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
119+ -D LIBCXX_CXX_ABI=libcxxabi \
120+ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
121+ -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
122+ -D LIBCXX_TEST_PARAMS=" enable_modules=clang" \
123+ -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang"
124+
125+ echo " --- ninja runtimes clang modules"
126+
127+ ninja -vC " ${RUNTIMES_BUILD_DIR} " ${runtime_targets}
128+ fi
0 commit comments