| 1 |
#!/bin/bash |
| 2 |
# Copyright (c) 2018 Google LLC. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
# you may not use this file except in compliance with the License. |
| 6 |
# You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
# Fail on any error. |
| 17 |
set -e |
| 18 |
# Display commands being run. |
| 19 |
set -x |
| 20 |
|
| 21 |
BUILD_ROOT=$PWD |
| 22 |
GITHUB_DIR=$BUILD_ROOT/github |
| 23 |
|
| 24 |
SKIP_TESTS="False" |
| 25 |
BUILD_TYPE="Release" |
| 26 |
|
| 27 |
# Get NINJA. |
| 28 |
wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip |
| 29 |
unzip -q ninja-linux.zip |
| 30 |
export PATH="$PWD:$PATH" |
| 31 |
|
| 32 |
# Get shaderc. |
| 33 |
cd $GITHUB_DIR |
| 34 |
git clone https://github.com/google/shaderc.git |
| 35 |
SHADERC_DIR=$GITHUB_DIR/shaderc |
| 36 |
cd $SHADERC_DIR/third_party |
| 37 |
|
| 38 |
# Get shaderc dependencies. Link the appropriate SPIRV-Tools. |
| 39 |
git clone https://github.com/google/googletest.git |
| 40 |
git clone https://github.com/KhronosGroup/glslang.git |
| 41 |
ln -s $GITHUB_DIR/SPIRV-Tools spirv-tools |
| 42 |
git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-headers |
| 43 |
git clone https://github.com/google/re2 |
| 44 |
git clone https://github.com/google/effcee |
| 45 |
|
| 46 |
cd $SHADERC_DIR |
| 47 |
mkdir build |
| 48 |
cd $SHADERC_DIR/build |
| 49 |
|
| 50 |
# Invoke the build. |
| 51 |
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} |
| 52 |
echo $(date): Starting build... |
| 53 |
cmake -GNinja -DRE2_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. |
| 54 |
|
| 55 |
echo $(date): Build glslang... |
| 56 |
ninja glslangValidator |
| 57 |
|
| 58 |
echo $(date): Build everything... |
| 59 |
ninja |
| 60 |
echo $(date): Build completed. |
| 61 |
|
| 62 |
echo $(date): Check Shaderc for copyright notices... |
| 63 |
ninja check-copyright |
| 64 |
|
| 65 |
echo $(date): Starting ctest... |
| 66 |
if [ $SKIP_TESTS = "False" ] |
| 67 |
then |
| 68 |
ctest --output-on-failure -j4 |
| 69 |
fi |
| 70 |
echo $(date): ctest completed. |
| 71 |
|