Skip to content

Commit 1ec9ee2

Browse files
committed
fix linux CI
1 parent 763c2e0 commit 1ec9ee2

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
@@ -2399,15 +2399,48 @@ if (MSVC)
23992399
# target_compile_options(SerialPrograms PRIVATE /arch:AVX512 /DPA_Arch_x64_AVX512)
24002400
# target_compile_options(SerialPrograms PRIVATE /arch:AVX512 /DPA_Arch_x64_AVX512GF)
24012401
else()
2402-
# Get root path where Homebrew installs libraries. Example root path: "/opt/homebrew/",
2403-
# where you can find libraries in "/opt/homebrew/lib/" and headers in "/opt/homebrew/include/".
2404-
# CMake does not support ONNX Runtime, so we have to add ONNX Runtime paths on our own.
2405-
# Save the root path as CMake variable HOMEBREW_PREFIX.
2406-
execute_process(COMMAND brew --prefix OUTPUT_VARIABLE HOMEBREW_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
2402+
if (APPLE)
2403+
# Get root path where Homebrew installs libraries. Example root path: "/opt/homebrew/",
2404+
# where you can find libraries in "/opt/homebrew/lib/" and headers in "/opt/homebrew/include/".
2405+
# CMake does not support ONNX Runtime, so we have to add ONNX Runtime paths on our own.
2406+
# Save the root path as CMake variable HOMEBREW_PREFIX.
2407+
execute_process(COMMAND brew --prefix OUTPUT_VARIABLE HOMEBREW_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
2408+
2409+
# Get ONNX Runtime paths
2410+
target_include_directories(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/include/onnxruntime)
2411+
target_link_libraries(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/lib/libonnxruntime.dylib)
2412+
else()
2413+
# Instructions took from https://github.com/microsoft/onnxruntime/discussions/6489
2414+
# Step 1: Download the file
2415+
file(DOWNLOAD
2416+
https://github.com/microsoft/onnxruntime/releases/download/v1.22.0/onnxruntime-linux-x64-1.22.0.tgz
2417+
${CMAKE_BINARY_DIR}/onnxruntime-linux-x64-1.22.0.tgz
2418+
SHOW_PROGRESS
2419+
)
2420+
2421+
# Step 2: Extract the archive
2422+
execute_process(
2423+
COMMAND tar -xzf onnxruntime-linux-x64-1.22.0.tgz
2424+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
2425+
)
24072426

2408-
# Get ONNX Runtime paths
2409-
target_include_directories(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/include/onnxruntime)
2410-
target_link_libraries(SerialPrograms PRIVATE ${HOMEBREW_PREFIX}/lib/libonnxruntime.dylib)
2427+
# Step 3: Copy files to /usr/local
2428+
execute_process(
2429+
COMMAND sudo cp -r ${CMAKE_BINARY_DIR}/onnxruntime-linux-x64-1.22.0/include /usr/local/
2430+
)
2431+
execute_process(
2432+
COMMAND sudo cp -r ${CMAKE_BINARY_DIR}/onnxruntime-linux-x64-1.22.0/lib /usr/local/
2433+
)
2434+
2435+
# Step 4: Run ldconfig
2436+
execute_process(
2437+
COMMAND sudo ldconfig
2438+
WORKING_DIRECTORY /usr/local/lib
2439+
)
2440+
2441+
# Link against ONNX Runtime
2442+
target_link_libraries(SerialPrograms PRIVATE onnxruntime)
2443+
endif()
24112444

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

0 commit comments

Comments
 (0)