-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmake_android.sh
34 lines (29 loc) · 1014 Bytes
/
make_android.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
if [ -n "$1" ]; then
export QJSNS=1
else
export QJSNS=0
fi
if [ -n "$ANDROID_NDK" ]; then
export NDK=${ANDROID_NDK}
elif [ -n "$ANDROID_NDK_HOME" ]; then
export NDK=${ANDROID_NDK_HOME}
else
export NDK=~/android-ndk-r21b
fi
if [ ! -d "$NDK" ]; then
echo "Please set ANDROID_NDK environment to the root of NDK."
exit 1
fi
function build() {
API=$1
ABI=$2
TOOLCHAIN_ANME=$3
BUILD_PATH=build.Android.${ABI}
cmake -H. -B${BUILD_PATH} -DANDROID_ABI=${ABI} -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=${API} -DANDROID_TOOLCHAIN=clang -DANDROID_TOOLCHAIN_NAME=${TOOLCHAIN_ANME} -DQJS_NS=${QJSNS}
cmake --build ${BUILD_PATH} --config Release
mkdir -p ./qjs/quickjs/Lib/Android/${ABI}/
cp ${BUILD_PATH}/libquickjs.a ./qjs/quickjs/Lib/Android/${ABI}/libquickjs.a
}
build android-18 armeabi-v7a arm-linux-androideabi-4.9
build android-18 arm64-v8a arm-linux-androideabi-clang
build android-18 x86_64 x86_64-4.9