1# Copyright The Amber Authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15set -e # Fail on error 16set -x # Display commands as run 17 18BUILD_ROOT="$PWD" 19SRC="$PWD/github/amber" 20BUILD_TYPE="Release" 21 22export ANDROID_NDK="$BUILD_ROOT/android-ndk-r25b" 23ANDROID_STL="c++_static" 24ANDROID_PLATFORM="android-14" 25ANDROID_ABI="armeabi-v7a with NEON" 26 27TOOLCHAIN_PATH="$ANDROID_NDK/build/cmake/android.toolchain.cmake" 28 29# Disable git's "detected dubious ownership" error - kokoro checks out the repo with a different 30# user, and we don't care about this warning. 31git config --global --add safe.directory '*' 32 33# removing the old version 34echo y | sudo apt-get purge --auto-remove cmake 35 36# Installing the 3.14.0 version. 37# Glslang requires 3.14.0 38wget http://www.cmake.org/files/v3.18/cmake-3.18.6.tar.gz 39tar -xvzf cmake-3.18.6.tar.gz 40pushd cmake-3.18.6/ 41./configure 42make 43sudo make install 44echo "$(date): $(cmake --version)" 45popd 46 47# Get NINJA. 48wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip 49unzip -q ninja-linux.zip 50export PATH="$PWD:$PATH" 51 52# Get Android NDK. 53wget -q https://dl.google.com/android/repository/android-ndk-r25b-linux.zip 54unzip -q android-ndk-r25b-linux.zip 55# ANDROID_NDK is set earlier. 56 57cd "$SRC" 58./tools/git-sync-deps 59 60mkdir build && cd "$SRC/build" 61 62# Invoke the build. 63echo "$(date): Starting build..." 64cmake -GNinja \ 65 "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \ 66 "-DANDROID_ABI=$ANDROID_ABI" \ 67 "-DANDROID_PLATFORM=$ANDROID_PLATFORM" \ 68 "-DANDROID_NDK=$ANDROID_NDK" \ 69 "-DANDROID_STL=$ANDROID_STL" \ 70 "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_PATH" \ 71 .. 72 73echo "$(date): Build everything..." 74ninja 75echo "$(date): Build completed." 76