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