1#!/bin/bash 2 3# Copyright 2020 The Amber Authors. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17set -e # fail on error 18 19. /bin/using.sh # Declare the bash `using` function for configuring toolchains. 20 21set -x # show commands 22 23BUILD_TYPE="Debug" 24 25using cmake-3.17.2 26using ninja-1.10.0 27 28if [ ! -z "$COMPILER" ]; then 29 using "$COMPILER" 30fi 31 32# Possible configurations are: 33# DEBUG, RELEASE 34 35if [ $CONFIG = "RELEASE" ] 36then 37 BUILD_TYPE="RelWithDebInfo" 38fi 39 40# Make a directory for Dawn dependencies 41mkdir -p $ROOT_DIR/build/out/dawn-deps && cd $ROOT_DIR/build/out/dawn-deps 42 43# Get depot tools 44git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 45export PATH="$PWD/depot_tools:$PATH" 46 47# Clone the repo as "dawn" 48git clone https://dawn.googlesource.com/dawn dawn && cd dawn 49DAWN=$PWD 50 51# Bootstrap the gclient configuration 52cp scripts/standalone.gclient .gclient 53 54# Fetch external dependencies and toolchains with gclient 55gclient sync 56 57# Generate build files 58mkdir -p out/Release 59touch out/Release/args.gn 60gn gen out/Release 61 62# build dawn 63ninja -C out/Release 64 65cd $ROOT_DIR 66./tools/git-sync-deps 67 68cd $ROOT_DIR/build 69 70# Invoke the build. 71BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} 72echo $(date): Starting build... 73 74cmake -GNinja ..\ 75 -DCMAKE_BUILD_TYPE=$BUILD_TYPE\ 76 -DDawn_INCLUDE_DIR=$DAWN/src/include\ 77 -DDawn_GEN_INCLUDE_DIR=$DAWN/out/Release/gen/src/include\ 78 -DDawn_LIBRARY_DIR=$DAWN/out/Release 79 80echo $(date): Build everything... 81ninja 82echo $(date): Build completed. 83 84echo $(date): Starting amber_unittests... 85./amber_unittests 86echo $(date): amber_unittests completed. 87