-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathONNXRuntime.cmake
30 lines (24 loc) · 1011 Bytes
/
ONNXRuntime.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ONNX Runtime Configuration
# Set ONNX Runtime
set(ORT_VERSION "1.19.2" CACHE STRING "Onnx runtime version") # modify accordingly
set(ONNX_RUNTIME_DIR $ENV{HOME}/onnxruntime-linux-x64-gpu-${ORT_VERSION} CACHE PATH "Path to onnxruntime")
message(STATUS "Onnx runtime version: ${ORT_VERSION}")
# Set ONNX Runtime directory (modify accordingly)
message(STATUS "Onnx runtime directory: ${ONNX_RUNTIME_DIR}")
# Find CUDA (if available)
find_package(CUDA)
if (CUDA_FOUND)
message(STATUS "Found CUDA")
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda)
else ()
message(WARNING "CUDA not found. GPU support will be disabled.")
endif()
# Define ONNX Runtime-specific source files
set(ONNX_RUNTIME_SOURCES
${INFER_ROOT}/onnx-runtime/src/ORTInfer.cpp
# Add more ONNX Runtime source files here if needed
)
# Append ONNX Runtime sources to the main sources
list(APPEND SOURCES ${ONNX_RUNTIME_SOURCES})
# Add compile definition to indicate ONNX Runtime usage
add_compile_definitions(USE_ONNX_RUNTIME)