-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·62 lines (56 loc) · 1.78 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
PACKAGE_STRUCTURE=com/makepad/hello_quest
ANDROID_HOME=~/Library/Android/sdk
NDK_HOME=~/Library/Android/sdk/ndk/21.4.7075529
JAVA_HOME=~/Library/Application\ Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9514443/Android\ Studio.app/Contents/jbr/Contents/Home/
OVR_HOME=~/dev/ovr_openxr_mobile_sdk_47.0
OPENXR_HOME=~/dev/OpenXR-SDK
PATH=$PATH:$ANDROID_HOME/build-tools/33.0.1
PATH=$PATH:$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
PATH=$JAVA_HOME/bin:$PATH
rm -rf build
mkdir -p build
pushd build > /dev/null
echo Using javac $(javac -version)
javac\
-classpath $ANDROID_HOME/platforms/android-26/android.jar\
-d .\
../src/*.java
export DEX_PREOPT_DEFAULT=nostripping
d8 --lib $ANDROID_HOME/platforms/android-26/android.jar ${PACKAGE_STRUCTURE}/MainActivity.class
mkdir -p lib/arm64-v8a
pushd lib/arm64-v8a > /dev/null
cp $OVR_HOME/OpenXR/Libs/Android/arm64-v8a/Debug/libopenxr_loader.so .
$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang\
-march=armv8-a\
-shared\
-I ../../../src\
-I $NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/\
-I $OVR_HOME/OpenXR/Include\
-I $OPENXR_HOME/include\
-L $NDK_HOME/platforms/android-26/arch-arm64/usr/lib\
-L.\
-landroid\
-llog\
-lEGL\
-lGLESv2\
-lopenxr_loader\
-o libmain.so\
../../../src/*.c
popd > /dev/null
aapt\
package\
-F hello_quest.apk\
-I $ANDROID_HOME/platforms/android-26/android.jar\
-M ../src/AndroidManifest.xml\
-f
aapt add hello_quest.apk classes.dex
aapt add hello_quest.apk lib/arm64-v8a/libmain.so
aapt add hello_quest.apk lib/arm64-v8a/libopenxr_loader.so
apksigner\
sign\
-ks ~/.android/debug.keystore\
--ks-key-alias androiddebugkey\
--ks-pass pass:android\
hello_quest.apk
popd > /dev/null