@@ -11,27 +11,13 @@ if(NOT TARGET srt::driver)
1111endif ()
1212
1313# Require onnxruntime headers.
14- # Locate ONNX Runtime: check SYNTHRT_ORT_DIR (CI), then third-party/ (local), then build dir
15- if (DEFINED SYNTHRT_ORT_DIR AND IS_DIRECTORY "${SYNTHRT_ORT_DIR} /default" )
16- set (_onnxruntime_dir ${SYNTHRT_ORT_DIR} )
17- elseif (IS_DIRECTORY ${SYNTHRT_SOURCE_DIR } /third-party/onnxruntime/default)
18- set (_onnxruntime_dir ${SYNTHRT_SOURCE_DIR } /third-party/onnxruntime)
19- elseif (IS_DIRECTORY ${CMAKE_BINARY_DIR } /onnxruntime/default)
20- set (_onnxruntime_dir ${CMAKE_BINARY_DIR } /onnxruntime)
21- else ()
22- set (_onnxruntime_dir ${SYNTHRT_SOURCE_DIR } /third-party/onnxruntime)
23- endif ()
24-
25- # Normalize to forward slashes for portability. On Windows CI the workspace
26- # path may contain backslashes (e.g. "D:\a\synthrt") which break CMake string
27- # parsing when the path is embedded in a list argument ("\a" is an invalid
28- # escape). file(TO_CMAKE_PATH) converts native separators to "/".
29- file (TO_CMAKE_PATH "${_onnxruntime_dir} " _onnxruntime_dir )
30-
31- set (_onnxruntime_default_dir ${_onnxruntime_dir} /default)
32-
33- if (NOT IS_DIRECTORY ${_onnxruntime_default_dir} )
34- message (WARNING "OnnxDriver plugin will not be built: ONNX runtime not found at ${_onnxruntime_default_dir} ." )
14+ # ONNX Runtime is provided by the onnxruntime-builds CMake package (vcpkg
15+ # overlay port derived from its own scripts/setup-onnxruntime.cmake); find it
16+ # here so consumers never pass paths from the port. Without the package the
17+ # plugin degrades to not being built (same behavior as before the split).
18+ find_package (onnxruntime-builds CONFIG QUIET )
19+ if (NOT TARGET onnxruntime-builds::default)
20+ message (WARNING "OnnxDriver plugin will not be built: ONNX Runtime package (onnxruntime-builds) not found." )
3521 return ()
3622endif ()
3723
@@ -42,8 +28,6 @@ project(srt-onnxdriver
4228
4329file (GLOB_RECURSE _src CONFIGURE_DEPENDS *.h *.cpp )
4430
45- set (_onnxruntime_cuda_dir ${_onnxruntime_dir} /cuda)
46-
4731if (WIN32 AND SRT_DRIVER_ENABLE_DIRECTML)
4832 set (_onnxdriver_ep_macro_dml "ONNXDRIVER_ENABLE_DML" )
4933endif ()
@@ -65,7 +49,7 @@ synthrt_add_plugin(${PROJECT_NAME} inferencedrivers ${PROJECT_NAME} NO_EXPORT
6549 FEATURES cxx_std_20
6650 LINKS srt::driver srt::core
6751 LINKS_PRIVATE stduuid BLAKE3::blake3
68- INCLUDE_PRIVATE * ${_onnxruntime_default_dir} /include
52+ INCLUDE_PRIVATE * ${ONNXRUNTIME_BUILDS_INCLUDE_DIR}
6953 DEFINES ORT_API_MANUAL_INIT ${_onnxdriver_ep_macros}
7054)
7155
@@ -74,12 +58,12 @@ synthrt_add_plugin(${PROJECT_NAME} inferencedrivers ${PROJECT_NAME} NO_EXPORT
7458# install(FILES ...) receives actual file paths — install(FILES ...) does
7559# not expand glob patterns itself.
7660if (WIN32 )
77- file (GLOB _ort_default_lib_files ${_onnxruntime_default_dir} /lib /*.dll )
61+ file (GLOB _ort_default_lib_files ${ONNXRUNTIME_BUILDS_RUNTIME_DIR} /*.dll )
7862elseif (APPLE )
79- file (GLOB _ort_default_lib_files ${_onnxruntime_default_dir} /lib /*.dylib )
63+ file (GLOB _ort_default_lib_files ${ONNXRUNTIME_BUILDS_RUNTIME_DIR} /*.dylib )
8064else ()
81- file (GLOB _ort_default_lib_files ${_onnxruntime_default_dir} /lib /*.so
82- ${_onnxruntime_default_dir} /lib /*.so.* )
65+ file (GLOB _ort_default_lib_files ${ONNXRUNTIME_BUILDS_RUNTIME_DIR} /*.so
66+ ${ONNXRUNTIME_BUILDS_RUNTIME_DIR} /*.so.* )
8367endif ()
8468
8569# Build-phase copy: place runtimes next to the plugin output directory.
@@ -103,12 +87,12 @@ if(_ort_default_lib_files)
10387 )
10488endif ()
10589
106- if (EXISTS ${_onnxruntime_cuda_dir} AND IS_DIRECTORY ${_onnxruntime_cuda_dir} )
90+ if (ONNXRUNTIME_BUILDS_CUDA_RUNTIME_DIR )
10791 if (WIN32 )
108- file (GLOB _ort_cuda_lib_files ${_onnxruntime_cuda_dir} /lib /*.dll )
92+ file (GLOB _ort_cuda_lib_files ${ONNXRUNTIME_BUILDS_CUDA_RUNTIME_DIR} /*.dll )
10993 else ()
110- file (GLOB _ort_cuda_lib_files ${_onnxruntime_cuda_dir} /lib /*.so
111- ${_onnxruntime_cuda_dir} /lib /*.so.* )
94+ file (GLOB _ort_cuda_lib_files ${ONNXRUNTIME_BUILDS_CUDA_RUNTIME_DIR} /*.so
95+ ${ONNXRUNTIME_BUILDS_CUDA_RUNTIME_DIR} /*.so.* )
11296 endif ()
11397
11498 if (NOT APPLE AND _ort_cuda_lib_files)
0 commit comments