You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use the onnxruntime with a static library or access the sources in my CMakeLists.txt file via fetch_content. The fetch content seems to work, but it seems that there is a problem when resolving nsync::nsync_cpp
Here is my CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
# Project setup
project(MiniONNXRuntime CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Fetch ONNX Runtime source code using Git
include(FetchContent)
FetchContent_Declare(
onnxruntime
GIT_REPOSITORY https://github.com/microsoft/onnxruntime.git
GIT_TAG v1.20.1 # Specify the desired version
)
# Fetch the content
FetchContent_MakeAvailable(onnxruntime)
# Add ONNX Runtime build
set(ONNX_RUNTIME_BUILD_SHARED_LIB OFF) # Use static linking for simplicity
set(ONNX_RUNTIME_BUILD_CSHARP OFF)
set(ONNX_RUNTIME_BUILD_PYTHON OFF)
set(ONNX_RUNTIME_BUILD_NODEJS OFF)
set(ONNX_RUNTIME_ENABLE_EXTENDED OFF)
set(ONNX_RUNTIME_USE_CUDA OFF)
set(ONNX_RUNTIME_USE_OPENVINO OFF)
set(ONNX_RUNTIME_BUILD_UNIT_TESTS OFF)
add_subdirectory(${onnxruntime_SOURCE_DIR}/cmake ${onnxruntime_BINARY_DIR})
# Add the executable for the minimal example
add_executable(mini_main src/main.cpp)
# Link ONNX Runtime to the executable
target_link_libraries(mini_main PRIVATE onnxruntime)
# Include ONNX Runtime headers
target_include_directories(mini_main PRIVATE ${onnxruntime_SOURCE_DIR}/include)
and here is the error.
...
CMake Error at build/_deps/onnxruntime-src/cmake/onnxruntime_mlas.cmake:746 (target_link_libraries):
Target "onnxruntime_mlas_q4dq" links to:
nsync::nsync_cpp
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
build/_deps/onnxruntime-src/cmake/CMakeLists.txt:1789 (include)
CMake Error at build/_deps/onnxruntime-src/cmake/onnxruntime_unittests.cmake:72 (target_link_libraries):
Target "onnxruntime_test_all" links to:
nsync::nsync_cpp
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to use the onnxruntime with a static library or access the sources in my CMakeLists.txt file via fetch_content. The fetch content seems to work, but it seems that there is a problem when resolving nsync::nsync_cpp
Here is my CMakeLists.txt
and here is the error.
Maybe some could help me.
Beta Was this translation helpful? Give feedback.
All reactions