-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathandroid_build.sh
executable file
·50 lines (40 loc) · 1017 Bytes
/
android_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
mode=$1
if [ -z $1 ]; then
mode=Release
fi
njobs=`nproc`
# Android
if [ -z $ANDROID_SDK ]; then
ANDROID_SDK="$HOME/Android/Sdk"
fi
# Android armeabi-v7a
mkdir -p build-android-armeabi-v7a
cd build-android-armeabi-v7a
ANDROID_ABI=armeabi-v7a
"$ANDROID_SDK"/cmake/*/bin/cmake \
.. \
-DANDROID_STL=c++_static \
-DANDROID_TOOLCHAIN=clang \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_SDK/ndk-bundle/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=$ANDROID_ABI \
-DANDROID_CPP_FEATURES=exceptions \
-DANDROID_ARM_MODE=arm \
-DCMAKE_BUILD_TYPE=$mode
make -j$njobs
cd ..
# Android arm64-v8a
mkdir -p build-android-arm64-v8a
cd build-android-arm64-v8a
ANDROID_ABI=arm64-v8a
"$ANDROID_SDK"/cmake/*/bin/cmake \
.. \
-DANDROID_STL=c++_static \
-DANDROID_TOOLCHAIN=clang \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_SDK/ndk-bundle/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=$ANDROID_ABI \
-DANDROID_CPP_FEATURES=exceptions \
-DANDROID_ARM_MODE=arm \
-DCMAKE_BUILD_TYPE=$mode
make -j$njobs
cd ..