forked from couchbaselabs/couchbase-lite-libsqlcipher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-android.sh
More file actions
executable file
·38 lines (30 loc) · 829 Bytes
/
build-android.sh
File metadata and controls
executable file
·38 lines (30 loc) · 829 Bytes
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
#!/bin/bash
set -e
# Output directory
OUTPUT_DIR="$(pwd)/libs/android"
rm -rf "$OUTPUT_DIR"
core_count=$(getconf _NPROCESSORS_ONLN)
# Make sure ANDROID_NDK_HOME is set
if [ -z "$ANDROID_NDK_HOME" ]; then
echo "Please export ANDROID_NDK_HOME=/path/to/ndk/29.0.0"
exit 1
fi
echo $ANDROID_NDK_HOME
TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake"
for arch in x86 x86_64 armeabi-v7a arm64-v8a; do
mkdir -p "$OUTPUT_DIR/$arch"
pushd "$OUTPUT_DIR/$arch" >/dev/null
# API level: arm64 needs >=21, others >=19
api=19
if [ "$arch" = "arm64-v8a" ]; then
api=21
fi
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
-DANDROID_ABI="$arch" \
-DANDROID_PLATFORM=android-$api \
../../..
make -j $((core_count + 1))
popd >/dev/null
done