• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 https://github.com/google/googletest          external/googletest
36cd external && cd googletest && git reset --hard 1fb1bb23bb8418dc73a5a9a82bbed31dc610fec7 && cd .. && cd ..
37git clone --depth=1 https://github.com/google/effcee              external/effcee
38git clone --depth=1 https://github.com/google/re2                 external/re2
39git clone --depth=1 --branch v3.13.0 https://github.com/protocolbuffers/protobuf external/protobuf
40
41mkdir build && cd $SRC/build
42
43# Invoke the build.
44BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
45echo $(date): Starting build...
46# We need Python 3.  At the moment python3.7 is the newest Python on Kokoro.
47cmake \
48  -GNinja \
49  -DCMAKE_INSTALL_PREFIX=$KOKORO_ARTIFACTS_DIR/install \
50  -DPYTHON_EXECUTABLE:FILEPATH=/usr/local/bin/python3.7 \
51  -DCMAKE_C_COMPILER=clang \
52  -DCMAKE_CXX_COMPILER=clang++ \
53  -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
54  -DSPIRV_BUILD_FUZZER=ON \
55  ..
56
57echo $(date): Build everything...
58ninja
59echo $(date): Build completed.
60
61echo $(date): Starting ctest...
62ctest -j4 --output-on-failure --timeout 300
63echo $(date): ctest completed.
64
65# Package the build.
66ninja install
67cd $KOKORO_ARTIFACTS_DIR
68tar czf install.tgz install
69
70