diff --git a/recipes/onnxruntime/all/conandata.yml b/recipes/onnxruntime/all/conandata.yml index c1f4ac489cb97c..79537744aac4e9 100644 --- a/recipes/onnxruntime/all/conandata.yml +++ b/recipes/onnxruntime/all/conandata.yml @@ -13,6 +13,9 @@ patches: - patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch" patch_description: "allow to build with abseil built without c++17 support" patch_type: "portability" + - patch_file: "patches/1.15.1-0002-cuda-gsl.patch" + patch_description: "CMake: fix GSL and cuda" + patch_type: "conan" "1.14.1": - patch_file: "patches/1.14.1-0001-cmake-dependencies.patch" patch_description: "CMake: ensure conan dependencies are used (upstreamed future versions)" @@ -32,3 +35,6 @@ patches: patch_description: "Ensures the forward compatibility with the newest versions of re2 library." patch_type: "portability" patch_source: "https://github.com/microsoft/onnxruntime/commit/126e7bf15fa4af8621814b82a3f7bd0d786f0239.patch" + - patch_file: "patches/1.14.1-0006-cuda-gsl.patch" + patch_description: "CMake: fix GSL and cuda" + patch_type: "conan" diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/conanfile.py index dc0f2dce95435e..d9cbd30ca3f927 100644 --- a/recipes/onnxruntime/all/conanfile.py +++ b/recipes/onnxruntime/all/conanfile.py @@ -27,11 +27,13 @@ class OnnxRuntimeConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "with_xnnpack": [True, False], + "with_cuda_provider": [True, False], } default_options = { "shared": False, "fPIC": True, "with_xnnpack": False, + "with_cuda_provider": False, } short_paths = True @@ -44,7 +46,7 @@ def _compilers_minimum_version(self): return { "Visual Studio": "16", "msvc": "192", - "gcc": "7", + "gcc": "8", "clang": "5", "apple-clang": "10", } @@ -126,6 +128,7 @@ def generate(self): tc.variables["onnxruntime_USE_FULL_PROTOBUF"] = not self.dependencies["protobuf"].options.lite tc.variables["onnxruntime_USE_XNNPACK"] = self.options.with_xnnpack + tc.variables["onnxruntime_USE_CUDA"] = self.options.with_cuda_provider tc.variables["onnxruntime_BUILD_UNIT_TESTS"] = False tc.variables["onnxruntime_RUN_ONNX_TESTS"] = False tc.variables["onnxruntime_GENERATE_TEST_REPORTS"] = False @@ -150,7 +153,7 @@ def generate(self): tc.variables["onnxruntime_TVM_CUDA_RUNTIME"] = False tc.variables["onnxruntime_TVM_USE_HASH"] = False tc.variables["onnxruntime_CROSS_COMPILING"] = False - tc.variables["onnxruntime_DISABLE_CONTRIB_OPS"] = False + tc.variables["onnxruntime_DISABLE_CONTRIB_OPS"] = self.options.with_cuda_provider tc.variables["onnxruntime_DISABLE_ML_OPS"] = False tc.variables["onnxruntime_DISABLE_RTTI"] = False tc.variables["onnxruntime_DISABLE_EXCEPTIONS"] = False diff --git a/recipes/onnxruntime/all/patches/1.14.1-0006-cuda-gsl.patch b/recipes/onnxruntime/all/patches/1.14.1-0006-cuda-gsl.patch new file mode 100644 index 00000000000000..965b24fe9d6010 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.14.1-0006-cuda-gsl.patch @@ -0,0 +1,12 @@ +diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake +index b051ff0be1..19ce4107de 100644 +--- a/cmake/external/onnxruntime_external_deps.cmake ++++ b/cmake/external/onnxruntime_external_deps.cmake +@@ -251,6 +251,7 @@ if(onnxruntime_USE_CUDA) + URL ${DEP_URL_microsoft_gsl} + URL_HASH SHA1=${DEP_SHA1_microsoft_gsl} + PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch ++ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL + ) + else() + FetchContent_Declare( diff --git a/recipes/onnxruntime/all/patches/1.15.1-0002-cuda-gsl.patch b/recipes/onnxruntime/all/patches/1.15.1-0002-cuda-gsl.patch new file mode 100644 index 00000000000000..dd1d64e3fdb8e4 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.15.1-0002-cuda-gsl.patch @@ -0,0 +1,12 @@ +diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake +index 9effd1a2db..3284c35424 100644 +--- a/cmake/external/onnxruntime_external_deps.cmake ++++ b/cmake/external/onnxruntime_external_deps.cmake +@@ -288,6 +288,7 @@ if(onnxruntime_USE_CUDA) + URL ${DEP_URL_microsoft_gsl} + URL_HASH SHA1=${DEP_SHA1_microsoft_gsl} + PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch ++ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL + ) + else() + FetchContent_Declare(