brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · e6a59a2 Raw
109 lines · bash
1#!/usr/bin/env bash2#===----------------------------------------------------------------------===##3#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-exception7#8#===----------------------------------------------------------------------===##9 10#11# This script performs a monolithic build of the monorepo and runs the tests of12# most projects on Linux. This should be replaced by per-project scripts that13# run only the relevant tests.14#15 16source .ci/utils.sh17 18INSTALL_DIR="${BUILD_DIR}/install"19 20mkdir -p artifacts/reproducers21 22# Make sure any clang reproducers will end up as artifacts23export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`24 25projects="${1}"26targets="${2}"27runtimes="${3}"28runtime_targets="${4}"29runtime_targets_needs_reconfig="${5}"30enable_cir="${6}"31 32lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct"33 34start-group "CMake"35 36# Set the system llvm-symbolizer as preferred.37export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`38[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!"39 40# Set up all runtimes either way. libcxx is a dependency of LLDB.41# It will not be built unless it is used.42cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \43      -D LLVM_ENABLE_PROJECTS="${projects}" \44      -D LLVM_ENABLE_RUNTIMES="${runtimes}" \45      -G Ninja \46      -D CMAKE_PREFIX_PATH="${HOME}/.local" \47      -D CMAKE_BUILD_TYPE=Release \48      -D CLANG_ENABLE_CIR=${enable_cir} \49      -D LLVM_ENABLE_ASSERTIONS=ON \50      -D LLVM_BUILD_EXAMPLES=ON \51      -D COMPILER_RT_BUILD_LIBFUZZER=OFF \52      -D LLVM_LIT_ARGS="${lit_args}" \53      -D LLVM_ENABLE_LLD=ON \54      -D CMAKE_CXX_FLAGS=-gmlt \55      -D CMAKE_C_COMPILER_LAUNCHER=sccache \56      -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \57      -D LIBCXX_CXX_ABI=libcxxabi \58      -D MLIR_ENABLE_BINDINGS_PYTHON=ON \59      -D LLDB_ENABLE_PYTHON=ON \60      -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \61      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \62      -D CMAKE_EXE_LINKER_FLAGS="-no-pie" \63      -D LLVM_ENABLE_WERROR=ON64 65start-group "ninja"66 67if [[ -n "${targets}" ]]; then68  # Targets are not escaped as they are passed as separate arguments.69  ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log70  cp ${BUILD_DIR}/.ninja_log ninja.ninja_log71fi72 73if [[ -n "${runtime_targets}" ]]; then74  start-group "ninja Runtimes"75 76  ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log77  cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log78fi79 80# Compiling runtimes with just-built Clang and running their tests81# as an additional testing for Clang.82if [[ -n "${runtime_targets_needs_reconfig}" ]]; then83  start-group "CMake Runtimes C++26"84 85  cmake \86    -D LIBCXX_TEST_PARAMS="std=c++26" \87    -D LIBCXXABI_TEST_PARAMS="std=c++26" \88    "${BUILD_DIR}"89 90  start-group "ninja Runtimes C++26"91 92  ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \93    |& tee ninja_runtimes_needs_reconfig1.log94  cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log95 96  start-group "CMake Runtimes Clang Modules"97 98  cmake \99    -D LIBCXX_TEST_PARAMS="enable_modules=clang" \100    -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \101    "${BUILD_DIR}"102 103  start-group "ninja Runtimes Clang Modules"104 105  ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \106    |& tee ninja_runtimes_needs_reconfig2.log107  cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log108fi109