2023-06-12 21:45:48 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#===----------------------------------------------------------------------===##
|
|
|
|
#
|
|
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#
|
|
|
|
#===----------------------------------------------------------------------===##
|
|
|
|
|
|
|
|
#
|
|
|
|
# This script performs a monolithic build of the monorepo and runs the tests of
|
|
|
|
# most projects on Windows. This should be replaced by per-project scripts that
|
|
|
|
# run only the relevant tests.
|
|
|
|
#
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
|
2023-09-11 11:20:34 +00:00
|
|
|
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
|
2023-06-12 21:45:48 +00:00
|
|
|
|
|
|
|
rm -rf ${BUILD_DIR}
|
|
|
|
|
2023-09-11 11:20:34 +00:00
|
|
|
if [[ -n "${CLEAR_CACHE:-}" ]]; then
|
|
|
|
echo "clearing sccache"
|
|
|
|
rm -rf "$SCCACHE_DIR"
|
|
|
|
fi
|
|
|
|
|
2023-06-12 21:45:48 +00:00
|
|
|
sccache --zero-stats
|
|
|
|
function show-stats {
|
2023-09-11 11:20:34 +00:00
|
|
|
mkdir -p artifacts
|
|
|
|
sccache --show-stats >> artifacts/sccache_stats.txt
|
2023-06-12 21:45:48 +00:00
|
|
|
}
|
|
|
|
trap show-stats EXIT
|
|
|
|
|
|
|
|
projects="${1}"
|
|
|
|
targets="${2}"
|
|
|
|
|
|
|
|
echo "--- cmake"
|
|
|
|
pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
|
|
|
|
cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
|
|
|
|
-D LLVM_ENABLE_PROJECTS="${projects}" \
|
|
|
|
-G Ninja \
|
|
|
|
-D CMAKE_BUILD_TYPE=Release \
|
|
|
|
-D LLVM_ENABLE_ASSERTIONS=ON \
|
|
|
|
-D LLVM_BUILD_EXAMPLES=ON \
|
|
|
|
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
|
2024-01-10 18:39:33 +00:00
|
|
|
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \
|
2023-06-12 21:45:48 +00:00
|
|
|
-D COMPILER_RT_BUILD_ORC=OFF \
|
|
|
|
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
|
2023-11-25 09:55:32 +00:00
|
|
|
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
|
|
|
|
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
|
2023-06-12 21:45:48 +00:00
|
|
|
|
|
|
|
echo "--- ninja"
|
2023-09-13 11:02:55 +00:00
|
|
|
# Targets are not escaped as they are passed as separate arguments.
|
|
|
|
ninja -C "${BUILD_DIR}" ${targets}
|