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 #===----------------------------------------------------------------------===##
11 # This script performs a monolithic build of the monorepo and runs the tests of
12 # most projects on Linux. This should be replaced by per-project scripts that
13 # run only the relevant tests.
19 MONOREPO_ROOT
="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
20 BUILD_DIR
="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
21 INSTALL_DIR
="${BUILD_DIR}/install"
26 if [[ -n "${CLEAR_CACHE:-}" ]]; then
35 ccache
--print-stats > artifacts
/ccache_stats.txt
37 # If building fails there will be no results files.
39 if command -v buildkite-agent
2>&1 >/dev
/null
41 python3
"${MONOREPO_ROOT}"/.ci
/generate_test_report.py
":linux: Linux x64 Test Results" \
42 "linux-x64-test-results" $retcode "${BUILD_DIR}"/test-results.
*.xml
50 lit_args
="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
53 pip
install -q -r "${MONOREPO_ROOT}"/mlir
/python
/requirements.txt
54 pip
install -q -r "${MONOREPO_ROOT}"/lldb
/test
/requirements.txt
55 pip
install -q -r "${MONOREPO_ROOT}"/.ci
/requirements.txt
56 cmake
-S "${MONOREPO_ROOT}"/llvm
-B "${BUILD_DIR}" \
57 -D LLVM_ENABLE_PROJECTS
="${projects}" \
59 -D CMAKE_BUILD_TYPE
=Release \
60 -D LLVM_ENABLE_ASSERTIONS
=ON \
61 -D LLVM_BUILD_EXAMPLES
=ON \
62 -D COMPILER_RT_BUILD_LIBFUZZER
=OFF \
63 -D LLVM_LIT_ARGS
="${lit_args}" \
64 -D LLVM_ENABLE_LLD
=ON \
65 -D CMAKE_CXX_FLAGS
=-gmlt \
66 -D LLVM_CCACHE_BUILD
=ON \
67 -D MLIR_ENABLE_BINDINGS_PYTHON
=ON \
68 -D CMAKE_INSTALL_PREFIX
="${INSTALL_DIR}"
71 # Targets are not escaped as they are passed as separate arguments.
72 ninja
-C "${BUILD_DIR}" -k 0 ${targets}
75 runtime_targets
="${4}"
77 # Compiling runtimes with just-built Clang and running their tests
78 # as an additional testing for Clang.
79 if [[ "${runtimes}" != "" ]]; then
80 if [[ "${runtime_targets}" == "" ]]; then
81 echo "Runtimes to build are specified, but targets are not."
85 echo "--- ninja install-clang"
87 ninja
-C ${BUILD_DIR} install-clang install-clang-resource-headers
89 RUNTIMES_BUILD_DIR
="${MONOREPO_ROOT}/build-runtimes"
90 INSTALL_DIR
="${BUILD_DIR}/install"
91 mkdir
-p ${RUNTIMES_BUILD_DIR}
93 echo "--- cmake runtimes C++03"
95 cmake
-S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
96 -D CMAKE_C_COMPILER
="${INSTALL_DIR}/bin/clang" \
97 -D CMAKE_CXX_COMPILER
="${INSTALL_DIR}/bin/clang++" \
98 -D LLVM_ENABLE_RUNTIMES
="${runtimes}" \
99 -D LIBCXX_CXX_ABI
=libcxxabi \
100 -D CMAKE_BUILD_TYPE
=RelWithDebInfo \
101 -D CMAKE_INSTALL_PREFIX
="${INSTALL_DIR}" \
102 -D LIBCXX_TEST_PARAMS
="std=c++03" \
103 -D LIBCXXABI_TEST_PARAMS
="std=c++03" \
104 -D LLVM_LIT_ARGS
="${lit_args}"
106 echo "--- ninja runtimes C++03"
108 ninja
-vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
110 echo "--- cmake runtimes C++26"
112 rm -rf "${RUNTIMES_BUILD_DIR}"
113 cmake
-S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
114 -D CMAKE_C_COMPILER
="${INSTALL_DIR}/bin/clang" \
115 -D CMAKE_CXX_COMPILER
="${INSTALL_DIR}/bin/clang++" \
116 -D LLVM_ENABLE_RUNTIMES
="${runtimes}" \
117 -D LIBCXX_CXX_ABI
=libcxxabi \
118 -D CMAKE_BUILD_TYPE
=RelWithDebInfo \
119 -D CMAKE_INSTALL_PREFIX
="${INSTALL_DIR}" \
120 -D LIBCXX_TEST_PARAMS
="std=c++26" \
121 -D LIBCXXABI_TEST_PARAMS
="std=c++26" \
122 -D LLVM_LIT_ARGS
="${lit_args}"
124 echo "--- ninja runtimes C++26"
126 ninja
-vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
128 echo "--- cmake runtimes clang modules"
130 rm -rf "${RUNTIMES_BUILD_DIR}"
131 cmake
-S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
132 -D CMAKE_C_COMPILER
="${INSTALL_DIR}/bin/clang" \
133 -D CMAKE_CXX_COMPILER
="${INSTALL_DIR}/bin/clang++" \
134 -D LLVM_ENABLE_RUNTIMES
="${runtimes}" \
135 -D LIBCXX_CXX_ABI
=libcxxabi \
136 -D CMAKE_BUILD_TYPE
=RelWithDebInfo \
137 -D CMAKE_INSTALL_PREFIX
="${INSTALL_DIR}" \
138 -D LIBCXX_TEST_PARAMS
="enable_modules=clang" \
139 -D LIBCXXABI_TEST_PARAMS
="enable_modules=clang" \
140 -D LLVM_LIT_ARGS
="${lit_args}"
142 echo "--- ninja runtimes clang modules"
144 ninja
-vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}