Skip to content

Commit

Permalink
[feat] android demo support opencl.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhaode committed Sep 18, 2024
1 parent c69a39b commit 15685cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ else()
set_target_properties(llm PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)

target_link_libraries(llm MNN MNN_Express)
if (MNN_OPENCL)
target_link_libraries(llm MNN_CL)
endif()
if (LLM_SUPPORT_VISION)
target_link_libraries(llm MNNOpenCV)
endif()
Expand Down Expand Up @@ -122,10 +125,13 @@ else()
list(APPEND LLM_LIBS $<TARGET_FILE:MNN>)
list(APPEND LLM_LIBS $<TARGET_FILE:MNN_Express>)
if (LLM_SUPPORT_VISION)
list(APPEND LLM_LIBS $<TARGET_FILE:MNNOpenCV>)
#list(APPEND LLM_LIBS $<TARGET_FILE:MNNOpenCV>)
endif()
if (MNN_OPENCL)
list(APPEND LLM_LIBS $<TARGET_FILE:MNN_CL>)
endif()
add_custom_command(TARGET llm POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${LLM_LIBS}
${CMAKE_CURRENT_LIST_DIR}/android/app/src/main/jni/libs)
${CMAKE_CURRENT_LIST_DIR}/android/app/src/main/jni/libs/arm64-v8a)
endif()
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
arguments "-DBUILD_JNI=TRUE", "-DANDROID_STL=c++_shared", "-DLLM_SUPPORT_VISION=TRUE"
arguments "-DBUILD_JNI=TRUE", "-DANDROID_STL=c++_shared", "-DLLM_SUPPORT_VISION=TRUE", "-DMNN_OPENCL=TRUE"
abiFilters 'arm64-v8a'
}
}
Expand Down

0 comments on commit 15685cb

Please sign in to comment.