• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-r20"
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# removing the old version
30echo y | sudo apt-get purge --auto-remove cmake
31
32# Installing the 3.10.2 version
33wget http://www.cmake.org/files/v3.10/cmake-3.10.2.tar.gz
34tar -xvzf cmake-3.10.2.tar.gz
35pushd cmake-3.10.2/
36./configure
37make
38sudo make install
39echo "$(date): $(cmake --version)"
40popd
41
42# Get NINJA.
43wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
44unzip -q ninja-linux.zip
45export PATH="$PWD:$PATH"
46
47# Get Android NDK.
48wget -q https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
49unzip -q android-ndk-r20-linux-x86_64.zip
50# ANDROID_NDK is set earlier.
51
52cd "$SRC"
53./tools/git-sync-deps
54
55mkdir build && cd "$SRC/build"
56
57# Invoke the build.
58echo "$(date): Starting build..."
59cmake -GNinja \
60    "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \
61    "-DANDROID_ABI=$ANDROID_ABI" \
62    "-DANDROID_PLATFORM=$ANDROID_PLATFORM" \
63    "-DANDROID_NDK=$ANDROID_NDK" \
64    "-DANDROID_STL=$ANDROID_STL" \
65    "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_PATH" \
66     ..
67
68echo "$(date): Build everything..."
69ninja
70echo "$(date): Build completed."
71