File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ build_android_native_library() {
22
22
pushd examples/demo-apps/android/LlamaDemo
23
23
CMAKE_OUT=" cmake-out-android-$1 " ANDROID_NDK=/opt/ndk ANDROID_ABI=" $1 " ./gradlew setup
24
24
popd
25
+ cp " cmake-out-android-$1 " /extension/android/* .so build_aar/jni/$1 /
25
26
}
26
27
27
28
build_android_demo_app () {
@@ -37,8 +38,27 @@ build_android_llama_demo_app() {
37
38
popd
38
39
}
39
40
41
+ build_aar () {
42
+ cp extension/android/build/libs/executorch.jar build_aar/libs
43
+ echo \< manifest xmlns:android=\" http://schemas.android.com/apk/res/android\" \
44
+ package=\" org.pytorch.executorch\"\> \
45
+ \< uses-sdk android:minSdkVersion=\" 19\" /\> \
46
+ \< /manifest\> > build_aar/AndroidManifest.xml
47
+ pushd build_aar
48
+ mv jni/arm64-v8a/libexecutorch_jni.so jni/arm64-v8a/libexecutorch.so
49
+ mv jni/x86_64/libexecutorch_jni.so jni/x86_64/libexecutorch.so
50
+ zip -r executorch.aar libs jni AndroidManifest.xml
51
+
52
+ rm jni/arm64-v8a/libexecutorch.so jni/x86_64/libexecutorch.so
53
+ zip -r executorch-llama.aar libs jni AndroidManifest.xml
54
+ popd
55
+ }
56
+
57
+ mkdir -p build_aar/jni/arm64-v8a build_aar/jni/x86_64 build_aar/libs
58
+
40
59
build_android_native_library arm64-v8a
41
60
build_android_native_library x86_64
42
61
export_model
43
62
build_android_demo_app
44
63
build_android_llama_demo_app
64
+ build_aar
You can’t perform that action at this time.
0 commit comments