| 1 | #!/usr/bin/env bash |
| 2 | #===----------------------------------------------------------------------===## |
| 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-exception |
| 7 | # |
| 8 | #===----------------------------------------------------------------------===## |
| 9 | |
| 10 | # |
| 11 | # This script performs a monolithic build of the monorepo and runs the tests of |
| 12 | # most projects on Windows. This should be replaced by per-project scripts that |
| 13 | # run only the relevant tests. |
| 14 | # |
| 15 | |
| 16 | source .ci/utils.sh |
| 17 | |
| 18 | projects="${1}" |
| 19 | targets="${2}" |
| 20 | runtimes="${3}" |
| 21 | runtimes_targets="${4}" |
| 22 | |
| 23 | start-group "CMake" |
| 24 | pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt |
| 25 | |
| 26 | export CC=C:/clang/clang-msvc/bin/clang-cl.exe |
| 27 | export CXX=C:/clang/clang-msvc/bin/clang-cl.exe |
| 28 | export LD=link |
| 29 | |
| 30 | # The CMAKE_*_LINKER_FLAGS to disable the manifest come from research |
| 31 | # on fixing a build reliability issue on the build server, please |
| 32 | # see https://github.com/llvm/llvm-project/pull/82393 and |
| 33 | # https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40 |
| 34 | # for further information. |
| 35 | cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ |
| 36 | -D LLVM_ENABLE_PROJECTS="${projects}" \ |
| 37 | -G Ninja \ |
| 38 | -D CMAKE_BUILD_TYPE=Release \ |
| 39 | -D LLVM_ENABLE_ASSERTIONS=ON \ |
| 40 | -D LLVM_BUILD_EXAMPLES=ON \ |
| 41 | -D COMPILER_RT_BUILD_LIBFUZZER=OFF \ |
| 42 | -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct" \ |
| 43 | -D COMPILER_RT_BUILD_ORC=OFF \ |
| 44 | -D CMAKE_C_COMPILER_LAUNCHER=sccache \ |
| 45 | -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \ |
| 46 | -D MLIR_ENABLE_BINDINGS_PYTHON=ON \ |
| 47 | -D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \ |
| 48 | -D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \ |
| 49 | -D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \ |
| 50 | -D LLVM_ENABLE_RUNTIMES="${runtimes}" |
| 51 | |
| 52 | start-group "ninja" |
| 53 | |
| 54 | if [[ -n "${targets}" ]]; then |
| 55 | # Targets are not escaped as they are passed as separate arguments. |
| 56 | ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log |
| 57 | cp ${BUILD_DIR}/.ninja_log ninja.ninja_log |
| 58 | fi |
| 59 | |
| 60 | if [[ -n "${runtimes_targets}" ]]; then |
| 61 | start-group "ninja runtimes" |
| 62 | |
| 63 | ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log |
| 64 | cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log |
| 65 | fi |