File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,16 @@ if(NOT CMAKE_BUILD_TYPE)
131
131
endif ()
132
132
133
133
set (TRITON_ONNXRUNTIME_DOCKER_BUILD OFF )
134
+ # Download onnxruntime
135
+ include (cmake/download_onnxruntime.cmake )
134
136
if (TRITON_ONNXRUNTIME_LIB_PATHS STREQUAL "" )
135
137
set (TRITON_ONNXRUNTIME_DOCKER_BUILD ON )
136
138
endif ()
137
139
138
140
message (STATUS "Using Onnxruntime docker: ${TRITON_ONNXRUNTIME_DOCKER_BUILD} " )
139
141
140
142
if (NOT TRITON_ONNXRUNTIME_DOCKER_BUILD )
141
- find_library (ONNXRUNTIME_LIBRARY NAMES onnxruntime PATHS ${TRITON_ONNXRUNTIME_LIB_PATHS} )
143
+ find_library (ONNXRUNTIME_LIBRARY NAMES onnxruntime PATHS ${TRITON_ONNXRUNTIME_LIB_PATHS} REQUIRED )
142
144
if (${TRITON_ENABLE_ONNXRUNTIME_OPENVINO} )
143
145
find_library (OV_LIBRARY
144
146
NAMES openvino
Original file line number Diff line number Diff line change
1
+ if (WIN32 )
2
+
3
+ message (NOTICE "Downloading onnxruntime" )
4
+
5
+ # Define the download and extraction paths)
6
+ set (DOWNLOAD_PATH "${CMAKE_BINARY_DIR} /_deps/downloads/onnxruntime.zip" )
7
+ set (EXTRACT_DIR "${CMAKE_BINARY_DIR} /_deps/downloads/onnxruntime" )
8
+
9
+ # Download the file
10
+ file (DOWNLOAD $ENV{TRITON_ONNXRUNTIME_PACKAGE_URL} ${DOWNLOAD_PATH} SHOW_PROGRESS STATUS DOWNLOAD_STATUS )
11
+
12
+ # Check the download status
13
+ list (GET DOWNLOAD_STATUS 0 DOWNLOAD_RESULT )
14
+ if (NOT DOWNLOAD_RESULT EQUAL 0 )
15
+ message (SEND_ERROR "Failed to download ${ONNXRUNTIME_PACKAGE_URL} " )
16
+ else ()
17
+ message (NOTICE "Download successful: ${DOWNLOAD_PATH} " )
18
+
19
+ # Extract the downloaded file
20
+ file (ARCHIVE_EXTRACT INPUT ${DOWNLOAD_PATH} DESTINATION ${EXTRACT_DIR} VERBOSE )
21
+
22
+ # Make the extracted directory searchable for CMake
23
+ list (APPEND CMAKE_PREFIX_PATH ${EXTRACT_DIR} )
24
+
25
+ # Find a specific library in the extracted folder
26
+ # find_library(ONNXRUNTIME_LIBRARY onnxruntime NAMES onnxruntime.dll onnxruntime.so PATHS ${EXTRACT_DIR} PATH_SUFFIXES lib include NO_DEFAULT_PATH)
27
+
28
+ set (TRITON_ONNXRUNTIME_LIB_PATHS ${EXTRACT_DIR} /lib )
29
+
30
+ endif (NOT DOWNLOAD_RESULT EQUAL 0 )
31
+
32
+ endif (WIN32 )
You can’t perform that action at this time.
0 commit comments