Skip to content

Commit 6dd97ca

Browse files
committed
fix linux CI
1 parent 05163d1 commit 6dd97ca

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,15 +2408,48 @@ if (MSVC)
24082408
# target_compile_options(SerialPrograms PRIVATE /arch:AVX512 /DPA_Arch_x64_AVX512)
24092409
# target_compile_options(SerialPrograms PRIVATE /arch:AVX512 /DPA_Arch_x64_AVX512GF)
24102410
else()
2411-
# Get root path where Homebrew installs libraries. Example root path: "/opt/homebrew/",
2412-
# where you can find libraries in "/opt/homebrew/lib/" and headers in "/opt/homebrew/include/".
2413-
# CMake does not support ONNX Runtime, so we have to add ONNX Runtime paths on our own.
2414-
# Save the root path as CMake variable HOMEBREW_PREFIX.
2415-
execute_process(COMMAND brew --prefix OUTPUT_VARIABLE HOMEBREW_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
2411+
if (APPLE)
2412+
# Get root path where Homebrew installs libraries. Example root path: "/opt/homebrew/",
2413+
# where you can find libraries in "/opt/homebrew/lib/" and headers in "/opt/homebrew/include/".
2414+
# CMake does not support ONNX Runtime, so we have to add ONNX Runtime paths on our own.
2415+
# Save the root path as CMake variable HOMEBREW_PREFIX.
2416+
execute_process(COMMAND brew --prefix OUTPUT_VARIABLE HOMEBREW_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
2417+
2418+
# Get ONNX Runtime paths
2419+
target_include_directories(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/include/onnxruntime)
2420+
target_link_libraries(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/lib/libonnxruntime.dylib)
2421+
else()
2422+
# Instructions took from https://github.com/microsoft/onnxruntime/discussions/6489
2423+
# Step 1: Download the file
2424+
file(DOWNLOAD
2425+
https://github.com/microsoft/onnxruntime/releases/download/v1.22.0/onnxruntime-linux-x64-1.22.0.tgz
2426+
${CMAKE_BINARY_DIR}/onnxruntime-linux-x64-1.22.0.tgz
2427+
SHOW_PROGRESS
2428+
)
2429+
2430+
# Step 2: Extract the archive
2431+
execute_process(
2432+
COMMAND tar -xzf onnxruntime-linux-x64-1.22.0.tgz
2433+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
2434+
)
24162435

2417-
# Get ONNX Runtime paths
2418-
target_include_directories(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/include/onnxruntime)
2419-
target_link_libraries(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/lib/libonnxruntime.dylib)
2436+
# Step 3: Copy files to /usr/local
2437+
execute_process(
2438+
COMMAND sudo cp -r ${CMAKE_BINARY_DIR}/onnxruntime-linux-x64-1.22.0/include /usr/local/
2439+
)
2440+
execute_process(
2441+
COMMAND sudo cp -r ${CMAKE_BINARY_DIR}/onnxruntime-linux-x64-1.22.0/lib /usr/local/
2442+
)
2443+
2444+
# Step 4: Run ldconfig
2445+
execute_process(
2446+
COMMAND sudo ldconfig
2447+
WORKING_DIRECTORY /usr/local/lib
2448+
)
2449+
2450+
# Link against ONNX Runtime
2451+
target_link_libraries(SerialPrograms PRIVATE onnxruntime)
2452+
endif()
24202453

24212454
# Find OpenCV
24222455
# set(OPENCV_DIR, "/usr/local/opt/opencv/lib/cmake/opencv4")

0 commit comments

Comments
 (0)