Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/shaderc
Path: blob/main/kokoro/linux/build-docker.sh
1560 views
1
#!/bin/bash
2
3
# Copyright (C) 2017 Google Inc.
4
#
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
8
#
9
# http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
16
17
# Linux Build Script run inside docker container.
18
19
set -e # Fail on any error.
20
21
. /bin/using.sh # Declare the bash `using` function for configuring toolchains.
22
23
set -x # Display commands being run.
24
25
SKIP_TESTS="False"
26
BUILD_TYPE="Debug"
27
28
using cmake-3.17.2
29
using ninja-1.10.0
30
31
if [ ! -z "$COMPILER" ]; then
32
using "$COMPILER"
33
fi
34
35
# Possible configurations are:
36
# ASAN, COVERAGE, RELEASE, DEBUG, DEBUG_EXCEPTION, RELEASE_MINGW
37
38
if [ $CONFIG = "RELEASE" ] || [ $CONFIG = "RELEASE_MINGW" ]
39
then
40
BUILD_TYPE="RelWithDebInfo"
41
fi
42
43
ADDITIONAL_CMAKE_FLAGS=""
44
if [ $CONFIG = "ASAN" ]
45
then
46
ADDITIONAL_CMAKE_FLAGS="-DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address"
47
elif [ $CONFIG = "COVERAGE" ]
48
then
49
ADDITIONAL_CMAKE_FLAGS="-DENABLE_CODE_COVERAGE=ON"
50
SKIP_TESTS="True"
51
elif [ $CONFIG = "DEBUG_EXCEPTION" ]
52
then
53
ADDITIONAL_CMAKE_FLAGS="-DDISABLE_EXCEPTIONS=ON -DDISABLE_RTTI=ON"
54
elif [ $CONFIG = "RELEASE_MINGW" ]
55
then
56
ADDITIONAL_CMAKE_FLAGS="-DCMAKE_TOOLCHAIN_FILE=$ROOT_DIR/cmake/linux-mingw-toolchain.cmake"
57
SKIP_TESTS="True"
58
fi
59
60
cd $ROOT_DIR
61
./utils/git-sync-deps
62
63
mkdir build
64
cd $ROOT_DIR/build
65
66
# Invoke the build.
67
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
68
echo $(date): Starting build...
69
cmake -GNinja -DCMAKE_INSTALL_PREFIX=$KOKORO_ARTIFACTS_DIR/install -DRE2_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ADDITIONAL_CMAKE_FLAGS ..
70
71
echo $(date): Build glslang...
72
ninja glslang-standalone
73
74
echo $(date): Build everything...
75
ninja
76
echo $(date): Build completed.
77
78
echo $(date): Check Shaderc for copyright notices...
79
ninja check-copyright
80
81
if [ $CONFIG = "COVERAGE" ]
82
then
83
echo $(date): Check coverage...
84
ninja report-coverage
85
echo $(date): Check coverage completed.
86
fi
87
88
echo $(date): Starting ctest...
89
if [ $SKIP_TESTS = "False" ]
90
then
91
ctest --output-on-failure -j4
92
fi
93
echo $(date): ctest completed.
94
95
# libshaderc_util/core is generated by the death test in shaderc_util_file_finder_test
96
rm -f libshaderc_util/core
97
98
# Package the build.
99
ninja install
100
cd $KOKORO_ARTIFACTS_DIR
101
tar czf install.tgz install
102
103