mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-07 17:15:29 +00:00
[QNN EP] refactor QNN deps/copy logic. start copying deps to target python loc… (#20317)
copy QNN deps when building python bindings as well. tweak the wildcard to only copy QNN related files. latest sdk from Qualcomm (>= 2.21) also include SNPE dll's which we don't want to include.
This commit is contained in:
parent
caf692e626
commit
08d208b969
3 changed files with 45 additions and 34 deletions
|
|
@ -791,6 +791,38 @@ if (onnxruntime_USE_QNN)
|
|||
list(APPEND ORT_PROVIDER_FLAGS -DUSE_QNN=1)
|
||||
list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_QNN=1)
|
||||
list(APPEND ONNXRUNTIME_PROVIDER_NAMES qnn)
|
||||
if (NOT QNN_ARCH_ABI)
|
||||
string(TOLOWER ${onnxruntime_target_platform} GEN_PLATFORM)
|
||||
if(MSVC)
|
||||
message(STATUS "Building MSVC for architecture ${CMAKE_SYSTEM_PROCESSOR} with CMAKE_GENERATOR_PLATFORM as ${GEN_PLATFORM}")
|
||||
if (${GEN_PLATFORM} STREQUAL "arm64")
|
||||
set(QNN_ARCH_ABI aarch64-windows-msvc)
|
||||
else()
|
||||
set(QNN_ARCH_ABI x86_64-windows-msvc)
|
||||
endif()
|
||||
else()
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
set(QNN_ARCH_ABI aarch64-android-clang6.0)
|
||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
if (${GEN_PLATFORM} STREQUAL "x86_64")
|
||||
set(QNN_ARCH_ABI x86_64-linux-clang)
|
||||
else()
|
||||
set(QNN_ARCH_ABI aarch64-android)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
file(GLOB QNN_LIB_FILES LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/libQnn*.so" "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/Qnn*.dll")
|
||||
if (${QNN_ARCH_ABI} STREQUAL "aarch64-windows-msvc")
|
||||
file(GLOB EXTRA_HTP_LIB LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/hexagon-v68/unsigned/libQnnHtpV68Skel.so"
|
||||
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so"
|
||||
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libqnnhtpv73.cat")
|
||||
list(APPEND QNN_LIB_FILES ${EXTRA_HTP_LIB})
|
||||
endif()
|
||||
message(STATUS "QNN lib files: " ${QNN_LIB_FILES})
|
||||
endif()
|
||||
endif()
|
||||
if (onnxruntime_USE_SNPE)
|
||||
list(APPEND ORT_PROVIDER_FLAGS -DUSE_SNPE=1)
|
||||
|
|
|
|||
|
|
@ -1001,6 +1001,15 @@ if (onnxruntime_USE_COREML)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_USE_QNN)
|
||||
add_custom_command(
|
||||
TARGET onnxruntime_pybind11_state POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${QNN_LIB_FILES}
|
||||
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS)
|
||||
include(onnxruntime_language_interop_ops.cmake)
|
||||
|
|
|
|||
|
|
@ -982,41 +982,11 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
endif()
|
||||
|
||||
if (onnxruntime_USE_QNN)
|
||||
if (NOT QNN_ARCH_ABI)
|
||||
string(TOLOWER ${onnxruntime_target_platform} GEN_PLATFORM)
|
||||
if(MSVC)
|
||||
message(STATUS "Building MSVC for architecture ${CMAKE_SYSTEM_PROCESSOR} with CMAKE_GENERATOR_PLATFORM as ${GEN_PLATFORM}")
|
||||
if (${GEN_PLATFORM} STREQUAL "arm64")
|
||||
set(QNN_ARCH_ABI aarch64-windows-msvc)
|
||||
else()
|
||||
set(QNN_ARCH_ABI x86_64-windows-msvc)
|
||||
endif()
|
||||
else()
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
set(QNN_ARCH_ABI aarch64-android-clang6.0)
|
||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
if (${GEN_PLATFORM} STREQUAL "x86_64")
|
||||
set(QNN_ARCH_ABI x86_64-linux-clang)
|
||||
else()
|
||||
set(QNN_ARCH_ABI aarch64-android)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
file(GLOB QNN_LIB_FILES LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/*.so" "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/*.dll")
|
||||
if (${QNN_ARCH_ABI} STREQUAL "aarch64-windows-msvc")
|
||||
file(GLOB EXTRA_HTP_LIB LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/hexagon-v68/unsigned/libQnnHtpV68Skel.so"
|
||||
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so"
|
||||
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libqnnhtpv73.cat")
|
||||
list(APPEND QNN_LIB_FILES ${EXTRA_HTP_LIB})
|
||||
endif()
|
||||
message(STATUS "QNN lib files: " ${QNN_LIB_FILES})
|
||||
add_custom_command(
|
||||
TARGET ${test_data_target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${QNN_LIB_FILES} $<TARGET_FILE_DIR:${test_data_target}>
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${test_data_target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${QNN_LIB_FILES} $<TARGET_FILE_DIR:${test_data_target}>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue