-
Notifications
You must be signed in to change notification settings - Fork 3
/
sdk.sh
executable file
·68 lines (58 loc) · 1.71 KB
/
sdk.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash -e
export ARCH="$(grep '^arch' local.properties | sed 's/^.*=[[:space:]]*//')"
if [ -z "$ARCH" ];
then
echo "Please specify ARCH using Start.sh"
exit 1
fi
export ANDROID_NDK="$(grep '^ndk\.dir' local.properties | sed 's/^.*=[[:space:]]*//')"
if [ ! -d "$ANDROID_NDK" ];
then
echo "Please specify NDK path using Start.sh"
exit 1
fi
case "$ARCH" in
"armv7")
### toolchain config for ARMv7
export TARGET_ABI=armeabi-v7a
export ANDROID_ABI="$TARGET_ABI with NEON"
export TARGET=armv7a-linux-androideabi ;;
"arm64")
### toolchain config for ARM64
export TARGET_ABI=arm64-v8a
export ANDROID_ABI=$TARGET_ABI
export TARGET=aarch64-linux-android ;;
"x86_64")
### toolchain config for x86_64
export TARGET_ABI=x86_64
export ANDROID_ABI=$TARGET_ABI
export TARGET=x86_64-linux-android ;;
*)
echo "Don't ask to use $ARCH"
exit 1 ;;
esac
export API=21
export CFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -fexceptions -D__ANDROID_MIN_SDK_VERSION__=$API"
export CXXFLAGS="$CFLAGS -frtti"
export NATIVE_API_LEVEL="android-$API"
echo "Configured for $TARGET_ABI"
case "$OSTYPE" in
linux*)
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
echo "Configured for Linux" ;;
darwin*)
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/darwin-x86_64
export MACOSX_DEPLOYMENT_TARGET=10.15
echo "Configured for Mac OS" ;;
*)
echo "Just use right OS instead $OSTYPE"
exit 1 ;;
esac
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export AR=$TOOLCHAIN/bin/llvm-ar
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
export ANDR_ROOT=$(pwd)
export OUTPUT_PATH="$ANDR_ROOT/output"