Debian Codegraph @

third_party/spirv-tools/kokoro/scripts/macos/build.sh

raw
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.
19 set -e
20 # Display commands being run.
21 set -x
22
23 BUILD_ROOT=$PWD
24 SRC=$PWD/github/SPIRV-Tools
25 BUILD_TYPE=$1
26
27 # Get NINJA.
28 wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
29 unzip -q ninja-mac.zip
30 chmod +x ninja
31 export PATH="$PWD:$PATH"
32
33 cd $SRC
34 git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers
35 git clone https://github.com/google/googletest external/googletest
36 cd external && cd googletest && git reset --hard 1fb1bb23bb8418dc73a5a9a82bbed31dc610fec7 && cd .. && cd ..
37 git clone --depth=1 https://github.com/google/effcee external/effcee
38 git clone --depth=1 https://github.com/google/re2 external/re2
39 git clone --depth=1 --branch v3.13.0 https://github.com/protocolbuffers/protobuf external/protobuf
40
41 mkdir build && cd $SRC/build
42
43 # Invoke the build.
44 BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
45 echo $(date): Starting build...
46 # We need Python 3. At the moment python3.7 is the newest Python on Kokoro.
47 cmake \
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
57 echo $(date): Build everything...
58 ninja
59 echo $(date): Build completed.
60
61 echo $(date): Starting ctest...
62 ctest -j4 --output-on-failure --timeout 300
63 echo $(date): ctest completed.
64
65 # Package the build.
66 ninja install
67 cd $KOKORO_ARTIFACTS_DIR
68 tar czf install.tgz install
69