mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
### Description Use target name for flatbuffers. Add version range for flatbuffers. It is similar to #13870 ### Motivation and Context To fix a build error: ``` CMake Error at onnxruntime_graph.cmake:88 (add_dependencies): The dependency target "flatbuffers" of target "onnxruntime_graph" does not exist. Call Stack (most recent call first): CMakeLists.txt:1490 (include) ``` It happens when flatbuffers library is already installed. For example, on Ubuntu people may get it from apt-get. But, the one provided by Ubuntu 20.04 is not compatible with our code. The one in Ubuntu 22.04 works fine.
34 lines
1.8 KiB
CMake
34 lines
1.8 KiB
CMake
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
set(PROVIDERS_SNPE onnxruntime_providers_snpe)
|
|
add_compile_definitions(USE_SNPE=1)
|
|
|
|
file(GLOB_RECURSE
|
|
onnxruntime_providers_snpe_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/snpe/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/snpe/*.cc"
|
|
)
|
|
|
|
file(GLOB SNPE_SO_FILES LIST_DIRECTORIES false "${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI}/*.so" "${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI}/*.dll")
|
|
# add dsp skel files to distribution
|
|
file(GLOB SNPE_DSP_FILES LIST_DIRECTORIES false "${SNPE_CMAKE_DIR}/lib/dsp/*.so")
|
|
list(APPEND SNPE_SO_FILES ${QCDK_FILES} ${SNPE_DSP_FILES})
|
|
|
|
if(NOT SNPE OR NOT SNPE_SO_FILES)
|
|
message(ERROR "Snpe not found in ${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI} for platform ${CMAKE_GENERATOR_PLATFORM}")
|
|
endif()
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_snpe_cc_srcs})
|
|
onnxruntime_add_static_library(onnxruntime_providers_snpe ${onnxruntime_providers_snpe_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_snpe onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers::flatbuffers)
|
|
link_directories(${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI} ${SNPE_CMAKE_DIR}/lib/dsp)
|
|
add_dependencies(onnxruntime_providers_snpe onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_providers_snpe PROPERTIES CXX_STANDARD_REQUIRED ON)
|
|
set_target_properties(onnxruntime_providers_snpe PROPERTIES FOLDER "ONNXRuntime")
|
|
target_include_directories(onnxruntime_providers_snpe PRIVATE ${ONNXRUNTIME_ROOT} ${SNPE_ROOT}/include/zdl)
|
|
set_target_properties(onnxruntime_providers_snpe PROPERTIES LINKER_LANGUAGE CXX)
|
|
|
|
if(MSVC)
|
|
target_compile_options(onnxruntime_providers_snpe PUBLIC /wd4244 /wd4505)
|
|
endif()
|