File tree Expand file tree Collapse file tree 4 files changed +52
-1
lines changed Expand file tree Collapse file tree 4 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,27 @@ Qualcomm lib Genie binding for React Native
8
8
npm install react-native-qnn-llm
9
9
```
10
10
11
- ### Add proguard
11
+ ### Android Setup
12
+
13
+ #### Download and setup env
14
+
15
+ 1 . Download SDK from [ here] ( https://www.qualcomm.com/developer/software/qualcomm-ai-engine-direct-sdk )
16
+ 2 . Setup env ` source path/to/QNN/SDK/bin/envsetup.sh `
17
+
18
+ #### QNN libs
19
+
20
+ Add QNN libs dependency into ` android/app/build.gradle `
21
+
22
+ ``` diff
23
+ dependencies {
24
+ + implementation "com.qualcomm.qti:qnn-runtime:latest.integration@aar"
25
+ ```
26
+
27
+ Or set ` useQnnSdkLib=true ` in ` android/gradle.properties `
28
+
29
+ Notes: If you use dependency, the version should match QNN SDK version
30
+
31
+ #### Proguard
12
32
13
33
``` diff
14
34
+ -keep class com.qnnllm.** { *; }
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ if (DEFINED ENV{QNN_SDK_ROOT} AND NOT QNN_SDK_ROOT)
8
8
set (QNN_SDK_ROOT $ENV{QNN_SDK_ROOT} )
9
9
endif ()
10
10
11
+ option (USE_QNN_SDK_LIB "Use QNN SDK Lib" OFF )
12
+
11
13
include_directories (
12
14
${QNN_SDK_ROOT} /include /Genie
13
15
${QNN_SDK_ROOT} /include /QNN
@@ -61,6 +63,26 @@ if (CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a" AND QNN_SDK_ROOT)
61
63
${QNN_PLAT_LIB_DIR} /libQnnHtpNetRunExtensions.so
62
64
)
63
65
66
+ if (USE_QNN_SDK_LIB)
67
+ file (GLOB QNN_HTP_LIBS
68
+ ${QNN_PLAT_LIB_DIR} /libQnnSystem.so
69
+ ${QNN_PLAT_LIB_DIR} /libQnnGpu.so
70
+ ${QNN_PLAT_LIB_DIR} /libQnnHtp.so
71
+ ${QNN_PLAT_LIB_DIR} /libQnnHtpPrepare.so
72
+ ${QNN_PLAT_LIB_DIR} /libQnnHtpV68Stub.so
73
+ ${QNN_PLAT_LIB_DIR} /libQnnHtpV69Stub.so
74
+ ${QNN_PLAT_LIB_DIR} /libQnnHtpV73Stub.so
75
+ ${QNN_PLAT_LIB_DIR} /libQnnHtpV75Stub.so
76
+ ${QNN_PLAT_LIB_DIR} /libQnnHtpV79Stub.so
77
+ ${QNN_LIB_DIR} /hexagon-v68/unsigned/libQnnHtpV68Skel.so
78
+ ${QNN_LIB_DIR} /hexagon-v69/unsigned/libQnnHtpV69Skel.so
79
+ ${QNN_LIB_DIR} /hexagon-v73/unsigned/libQnnHtpV73Skel.so
80
+ ${QNN_LIB_DIR} /hexagon-v75/unsigned/libQnnHtpV75Skel.so
81
+ ${QNN_LIB_DIR} /hexagon-v79/unsigned/libQnnHtpV79Skel.so
82
+ )
83
+ list (APPEND QNN_LIBS ${QNN_HTP_LIBS} )
84
+ endif ()
85
+
64
86
# concatenate two lists
65
87
list (APPEND QNN_LIBS ${QNN_PLAT_LIBS} )
66
88
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ def isNewArchitectureEnabled() {
23
23
return rootProject. hasProperty(" newArchEnabled" ) && rootProject. getProperty(" newArchEnabled" ) == " true"
24
24
}
25
25
26
+ def isQnnSdkLibEnabled () {
27
+ return rootProject. hasProperty(" useQnnSdkLib" ) && rootProject. getProperty(" useQnnSdkLib" ) == " true"
28
+ }
29
+
26
30
apply plugin : " com.android.library"
27
31
apply plugin : " kotlin-android"
28
32
@@ -68,6 +72,9 @@ android {
68
72
externalNativeBuild {
69
73
cmake {
70
74
cppFlags " -O2 -frtti -fexceptions -Wall -fstack-protector-all"
75
+ if (isQnnSdkLibEnabled()) {
76
+ arguments " -DUSE_QNN_SDK_LIB=ON"
77
+ }
71
78
abiFilters (* reactNativeArchitectures())
72
79
}
73
80
}
Original file line number Diff line number Diff line change @@ -37,3 +37,5 @@ newArchEnabled=true
37
37
# Use this property to enable or disable the Hermes JS engine.
38
38
# If set to false, you will be using JSC instead.
39
39
hermesEnabled =true
40
+
41
+ useQnnSdkLib =true
You can’t perform that action at this time.
0 commit comments