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. 17set -e 18# Display commands being run. 19set -x 20 21BUILD_ROOT=$PWD 22GITHUB_DIR=$BUILD_ROOT/github 23 24SKIP_TESTS="False" 25BUILD_TYPE="Release" 26 27# Get NINJA. 28wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip 29unzip -q ninja-linux.zip 30export PATH="$PWD:$PATH" 31 32# Get shaderc. 33cd $GITHUB_DIR 34git clone https://github.com/google/shaderc.git 35SHADERC_DIR=$GITHUB_DIR/shaderc 36cd $SHADERC_DIR/third_party 37 38# Get shaderc dependencies. Link the appropriate SPIRV-Tools. 39git clone https://github.com/google/googletest.git 40git clone https://github.com/google/glslang.git 41ln -s $GITHUB_DIR/SPIRV-Tools spirv-tools 42git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-headers 43git clone https://github.com/google/re2 44git clone https://github.com/google/effcee 45 46cd $SHADERC_DIR 47mkdir build 48cd $SHADERC_DIR/build 49 50# Invoke the build. 51BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} 52echo $(date): Starting build... 53cmake -GNinja -DRE2_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. 54 55echo $(date): Build glslang... 56ninja glslangValidator 57 58echo $(date): Build everything... 59ninja 60echo $(date): Build completed. 61 62echo $(date): Check Shaderc for copyright notices... 63ninja check-copyright 64 65echo $(date): Starting ctest... 66if [ $SKIP_TESTS = "False" ] 67then 68 ctest --output-on-failure -j4 69fi 70echo $(date): ctest completed. 71 72