1#!/bin/bash 2# Copyright 2018 The Amber Authors. 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 16set -e # fail on error 17set -x # display commands 18 19BUILD_ROOT="$PWD" 20SRC="$PWD/github/amber" 21 22# NDK Path 23export ANDROID_NDK="$BUILD_ROOT/android-ndk-r21" 24 25# Get NINJA. 26wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip 27unzip -q ninja-linux.zip 28export PATH="$PWD:$PATH" 29 30# Get Android NDK. 31wget -q https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip 32unzip -q android-ndk-r21-linux-x86_64.zip 33# ANDROID_NDK is set earlier. 34 35cd "$SRC" 36./tools/git-sync-deps 37./tools/update_build_version.py . samples/ third_party/ 38./tools/update_vk_wrappers.py . . 39 40mkdir -p build/libs build/app 41cd "$SRC/build" 42 43# Invoke the build. 44 45echo "$(date): Starting ndk-build for android_test ..." 46"$ANDROID_NDK/ndk-build" \ 47 -C "$SRC/android_test" \ 48 NDK_PROJECT_PATH=. \ 49 "NDK_LIBS_OUT=$(pwd)/libs" \ 50 "NDK_APP_OUT=$(pwd)/app" \ 51 -j8 52 53echo "$(date): ndk-build for android_test completed." 54 55echo "$(date): Starting ndk-build for samples ..." 56"$ANDROID_NDK/ndk-build" \ 57 -C "$SRC/samples" \ 58 NDK_PROJECT_PATH=. \ 59 "NDK_LIBS_OUT=$(pwd)/libs" \ 60 "NDK_APP_OUT=$(pwd)/app" \ 61 -j8 62echo "$(date): ndk-build for samples completed." 63