diff --git a/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake b/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake index 083ed6d63fc82..0933db8cb9808 100644 --- a/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake +++ b/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake @@ -98,7 +98,7 @@ endif() set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} ${WIL_TARGET} nlohmann_json::nlohmann_json - onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface + onnx ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date::date ${ONNXRUNTIME_CPUINFO_TARGETS} Eigen3::Eigen) diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/conanfile.py index 1ca86b1576807..595ed7753ca8c 100644 --- a/recipes/onnxruntime/all/conanfile.py +++ b/recipes/onnxruntime/all/conanfile.py @@ -1,5 +1,4 @@ import os -import sys from conan import ConanFile from conan.errors import ConanInvalidConfiguration @@ -81,10 +80,6 @@ def validate(self): raise ConanInvalidConfiguration( f"{self.ref} requires onnx compiled with `-o onnx:disable_static_registration=True`." ) - if onnx.options.get_safe("shared"): - # Commented here: https://github.com/onnx/onnx/pull/7505#issuecomment-3601468150 - raise ConanInvalidConfiguration("There are link errors using 'onnx/*:shared=True'," - " use '-o onnx/*:shared=False' instead.") def validate_build(self): if self.settings.os == "Windows" and self.dependencies["abseil"].options.shared: @@ -102,7 +97,9 @@ def generate(self): tc = CMakeToolchain(self) # disable downloading dependencies to ensure conan ones are used tc.variables["FETCHCONTENT_FULLY_DISCONNECTED"] = True - + if self.options.shared: + import sys + tc.variables["Python_EXECUTABLE"] = sys.executable.replace("\\", "/") tc.variables["onnxruntime_BUILD_SHARED_LIB"] = self.options.shared tc.variables["onnxruntime_USE_FULL_PROTOBUF"] = not self.dependencies["protobuf"].options.lite tc.variables["onnxruntime_USE_XNNPACK"] = self.options.with_xnnpack