Skip to content

Commit

Permalink
fix cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
xadupre committed Sep 17, 2024
1 parent 1467915 commit ef1d7e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions _cmake/externals/FindOrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ function(ort_add_dependency name folder_copy)
foreach(file_i ${ORT_LIB_FILES})
message(STATUS "ort: copy ${file_i} to '${destination_dir}'")
add_custom_command(
TARGET ${name} POST_BUILD
TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy ${file_i} ${destination_dir})
if(folder_copy)
message(STATUS "ort: copy '${file_i}' to '${ROOT_PROJECT_PATH}/${folder_copy}'")
add_custom_command(
TARGET ${name} POST_BUILD
TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${file_i}" "${ROOT_PROJECT_PATH}/${folder_copy}")
message(STATUS "ort: copy '${file_i}' to '${SETUP_BUILD_LIB}/${folder_copy}'")
add_custom_command(
TARGET ${name} POST_BUILD
TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory "${SETUP_BUILD_LIB}/${folder_copy}")
add_custom_command(
TARGET ${name} POST_BUILD
TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${file_i}" "${SETUP_BUILD_LIB}/${folder_copy}")
endif()
endforeach()
Expand Down
20 changes: 13 additions & 7 deletions _cmake/targets/ortinf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@ target_include_directories(
${ROOT_INCLUDE_PATH})
target_link_libraries(lib_ortapi PRIVATE common)

set(ORTAPI_INCLUDE_DIR "${ROOT_PROJECT_PATH}/onnx_extended/ortcy/wrap")

cython_add_module(
ortinf
../onnx_extended/ortcy/wrap/ortinf.pyx
OpenMP::OpenMP_CXX)
target_link_directories(ortinf PRIVATE ${ONNXRUNTIME_LIB_DIR})
message(STATUS " LINK ortinf <- lib_ortapi onnxruntime")

message(STATUS " LINK ortinf <- lib_ortapi onnxruntime ${ORTAPI_INCLUDE_DIR}")

ort_add_dependency(
ortinf
onnx_extended/ortcy/wrap)

# If ONNXRUNTIME_LIB_DIR is used, then it seems a local installation does
# does not the binaries anymore if they are removed.
target_link_directories(ortinf PRIVATE ${ORTAPI_INCLUDE_DIR})

target_link_libraries(
ortinf
PRIVATE
lib_ortapi
onnxruntime
common_kernels)
target_include_directories(ortinf PRIVATE ${ROOT_INCLUDE_PATH})
ort_add_dependency(
ortinf
onnx_extended/ortcy/wrap)

set(ORTAPI_INCLUDE_DIR "${ROOT_INCLUDE_PATH}/onnx_extended/ortcy/wrap")

add_executable(test_ortcy_inference_cpp ../_unittests/ut_ortcy/test_inference.cpp)
target_compile_definitions(test_ortcy_inference_cpp PRIVATE PYTHON_MANYLINUX=${PYTHON_MANYLINUX})
Expand Down

0 comments on commit ef1d7e2

Please sign in to comment.