Skip to content

Commit 2d85b9a

Browse files
committed
Add logic to pull Onnx Runtime
1 parent bc8b479 commit 2d85b9a

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

cmake/download_onnxruntime.cmake

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
if(WIN32)
1+
# Define the download and extraction paths)
2+
set(DOWNLOAD_PATH "${CMAKE_BINARY_DIR}/_deps/downloads/onnxruntime.zip")
3+
set(EXTRACT_DIR "${CMAKE_BINARY_DIR}/_deps/downloads/onnxruntime")
24

3-
message(NOTICE "Downloading onnxruntime: ${TRITON_ONNXRUNTIME_PACKAGE_URL}")
5+
if(DEFINED TRITON_ONNXRUNTIME_PACKAGE_URL)
6+
message(NOTICE "Downloading onnxruntime: ${TRITON_ONNXRUNTIME_PACKAGE_URL}")
7+
# Download the file
8+
file(DOWNLOAD ${TRITON_ONNXRUNTIME_PACKAGE_URL} ${DOWNLOAD_PATH} SHOW_PROGRESS STATUS DOWNLOAD_STATUS)
49

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")
810

9-
# Download the file
10-
file(DOWNLOAD ${TRITON_ONNXRUNTIME_PACKAGE_URL} ${DOWNLOAD_PATH} SHOW_PROGRESS STATUS DOWNLOAD_STATUS)
11+
# Check the download status
12+
list(GET DOWNLOAD_STATUS 0 DOWNLOAD_RESULT)
13+
if(NOT DOWNLOAD_RESULT EQUAL 0)
14+
message(NOTICE "Failed to download: ${TRITON_ONNXRUNTIME_PACKAGE_URL}")
15+
else()
16+
message(NOTICE "Download successful: ${DOWNLOAD_PATH}" )
1117

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: ${TRITON_ONNXRUNTIME_PACKAGE_URL}")
16-
else()
17-
message(NOTICE "Download successful: ${DOWNLOAD_PATH}" )
18+
# Extract the downloaded file
19+
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_PATH} DESTINATION ${EXTRACT_DIR} VERBOSE )
1820

19-
# Extract the downloaded file
20-
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_PATH} DESTINATION ${EXTRACT_DIR} VERBOSE )
21+
set(TRITON_ONNXRUNTIME_INCLUDE_PATHS ${EXTRACT_DIR}/include)
22+
set(TRITON_ONNXRUNTIME_LIB_PATHS ${EXTRACT_DIR}/lib)
2123

22-
set(TRITON_ONNXRUNTIME_INCLUDE_PATHS ${EXTRACT_DIR}/include)
23-
set(TRITON_ONNXRUNTIME_LIB_PATHS ${EXTRACT_DIR}/lib)
24-
25-
endif(NOT DOWNLOAD_RESULT EQUAL 0)
26-
27-
endif(WIN32)
24+
endif(NOT DOWNLOAD_RESULT EQUAL 0)
25+
endif(DEFINED TRITON_ONNXRUNTIME_PACKAGE_URL)

0 commit comments

Comments
 (0)