2019-10-17 18:09:59 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2019 Google LLC
|
|
|
|
#
|
|
|
|
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# https://llvm.org/LICENSE.txt
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2019-10-18 18:24:09 +02:00
|
|
|
set -eux
|
2019-10-17 18:09:59 +02:00
|
|
|
|
2019-12-09 12:09:53 +01:00
|
|
|
# Runs Cmake.
|
|
|
|
# Inputs: CCACHE_PATH, WORKSPACE, TARGET_DIR; $WORKSPACE/build must exist.
|
|
|
|
# Outputs: $TARGET_DIR/CMakeCache.txt, $WORKSPACE/compile_commands.json (symlink).
|
|
|
|
|
2019-10-17 18:09:59 +02:00
|
|
|
echo "Running CMake... ======================================"
|
2019-12-11 15:42:38 +01:00
|
|
|
export CC=clang
|
|
|
|
export CXX=clang++
|
2019-10-17 18:09:59 +02:00
|
|
|
export LD=LLD
|
|
|
|
|
2019-12-09 12:09:53 +01:00
|
|
|
cd "$WORKSPACE"/build
|
2019-10-17 18:09:59 +02:00
|
|
|
set +e
|
|
|
|
cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_LLD=ON \
|
2019-11-11 09:05:17 +01:00
|
|
|
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;lld;libunwind" \
|
2019-12-09 12:09:53 +01:00
|
|
|
-D LLVM_CCACHE_BUILD=ON -D LLVM_CCACHE_DIR="${CCACHE_PATH}" -D LLVM_CCACHE_MAXSIZE=20G \
|
2019-10-17 18:09:59 +02:00
|
|
|
-D LLVM_ENABLE_ASSERTIONS=ON -DCMAKE_CXX_FLAGS=-gmlt \
|
2019-12-09 12:09:53 +01:00
|
|
|
-DLLVM_LIT_ARGS="-v --xunit-xml-output ${WORKSPACE}/build/test-results.xml"
|
2019-10-17 18:09:59 +02:00
|
|
|
RETURN_CODE="${PIPESTATUS[0]}"
|
|
|
|
set -e
|
|
|
|
|
2019-12-09 12:09:53 +01:00
|
|
|
ln -s "$WORKSPACE"/build/compile_commands.json "$WORKSPACE"
|
2019-11-18 17:30:11 +01:00
|
|
|
cp CMakeCache.txt ${TARGET_DIR}
|
2019-12-09 12:09:53 +01:00
|
|
|
|
2019-10-17 18:09:59 +02:00
|
|
|
echo "CMake completed ======================================"
|
2019-12-09 12:09:53 +01:00
|
|
|
exit "${RETURN_CODE}"
|