Rename GetLanguageInfo to GetLanguageSpecificData (#117012)
[llvm-project.git] / .ci / monolithic-linux.sh
bloba4aeea7a16addc4206bf046a8f828f567af68bda
1 #!/usr/bin/env bash
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.
16 set -ex
17 set -o pipefail
19 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
20 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
21 INSTALL_DIR="${BUILD_DIR}/install"
22 rm -rf "${BUILD_DIR}"
24 ccache --zero-stats
26 if [[ -n "${CLEAR_CACHE:-}" ]]; then
27 echo "clearing cache"
28 ccache --clear
31 function at-exit {
32 mkdir -p artifacts
33 ccache --print-stats > artifacts/ccache_stats.txt
35 # If building fails there will be no results files.
36 shopt -s nullglob
37 python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
38 "linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
40 trap at-exit EXIT
42 projects="${1}"
43 targets="${2}"
45 lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
47 echo "--- cmake"
48 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
49 pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
50 pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
51 cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
52 -D LLVM_ENABLE_PROJECTS="${projects}" \
53 -G Ninja \
54 -D CMAKE_BUILD_TYPE=Release \
55 -D LLVM_ENABLE_ASSERTIONS=ON \
56 -D LLVM_BUILD_EXAMPLES=ON \
57 -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
58 -D LLVM_LIT_ARGS="${lit_args}" \
59 -D LLVM_ENABLE_LLD=ON \
60 -D CMAKE_CXX_FLAGS=-gmlt \
61 -D LLVM_CCACHE_BUILD=ON \
62 -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
63 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
65 echo "--- ninja"
66 # Targets are not escaped as they are passed as separate arguments.
67 ninja -C "${BUILD_DIR}" -k 0 ${targets}
69 runtimes="${3}"
70 runtime_targets="${4}"
72 # Compiling runtimes with just-built Clang and running their tests
73 # as an additional testing for Clang.
74 if [[ "${runtimes}" != "" ]]; then
75 if [[ "${runtime_targets}" == "" ]]; then
76 echo "Runtimes to build are specified, but targets are not."
77 exit 1
80 echo "--- ninja install-clang"
82 ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
84 RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
85 INSTALL_DIR="${BUILD_DIR}/install"
86 mkdir -p ${RUNTIMES_BUILD_DIR}
88 echo "--- cmake runtimes C++03"
90 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
91 -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
92 -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
93 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
94 -D LIBCXX_CXX_ABI=libcxxabi \
95 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
96 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
97 -D LIBCXX_TEST_PARAMS="std=c++03" \
98 -D LIBCXXABI_TEST_PARAMS="std=c++03" \
99 -D LLVM_LIT_ARGS="${lit_args}"
101 echo "--- ninja runtimes C++03"
103 ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
105 echo "--- cmake runtimes C++26"
107 rm -rf "${RUNTIMES_BUILD_DIR}"
108 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
109 -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
110 -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
111 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
112 -D LIBCXX_CXX_ABI=libcxxabi \
113 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
114 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
115 -D LIBCXX_TEST_PARAMS="std=c++26" \
116 -D LIBCXXABI_TEST_PARAMS="std=c++26" \
117 -D LLVM_LIT_ARGS="${lit_args}"
119 echo "--- ninja runtimes C++26"
121 ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
123 echo "--- cmake runtimes clang modules"
125 rm -rf "${RUNTIMES_BUILD_DIR}"
126 cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
127 -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
128 -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
129 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
130 -D LIBCXX_CXX_ABI=libcxxabi \
131 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
132 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
133 -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
134 -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
135 -D LLVM_LIT_ARGS="${lit_args}"
137 echo "--- ninja runtimes clang modules"
139 ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}