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# MacOS Build Script. 17 18# Fail on any error. 19set -e 20# Display commands being run. 21set -x 22 23BUILD_ROOT=$PWD 24SRC=$PWD/github/SPIRV-Tools 25BUILD_TYPE=$1 26 27# Get NINJA. 28wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip 29unzip -q ninja-mac.zip 30chmod +x ninja 31export PATH="$PWD:$PATH" 32 33cd $SRC 34git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers 35git clone --depth=1 https://github.com/google/googletest external/googletest 36git clone --depth=1 https://github.com/google/effcee external/effcee 37git clone --depth=1 https://github.com/google/re2 external/re2 38 39mkdir build && cd $SRC/build 40 41# Invoke the build. 42BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} 43echo $(date): Starting build... 44cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. 45 46echo $(date): Build everything... 47ninja 48echo $(date): Build completed. 49 50echo $(date): Starting ctest... 51ctest -j4 --output-on-failure --timeout 300 52echo $(date): ctest completed. 53 54