diff options
author | CoprDistGit <infra@openeuler.org> | 2024-04-15 02:11:05 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-04-15 02:11:05 +0000 |
commit | e5e2655e0f84a9ca2c49d899bafbd17845ff2d6b (patch) | |
tree | ab4086b9279d9bf7e8564d76d1a1a759c717cbb3 | |
parent | 7993554df0b339b282e99a6b02596e63637c44df (diff) |
automatic import of onnxruntime
-rw-r--r-- | 0001-dont-install-tests.patch | 41 | ||||
-rw-r--r-- | 0001-downgrade-cmake.patch | 22 | ||||
-rw-r--r-- | 0003-system-flatbuffers.patch | 22 | ||||
-rw-r--r-- | python-onnxruntime.spec | 3 |
4 files changed, 65 insertions, 23 deletions
diff --git a/0001-dont-install-tests.patch b/0001-dont-install-tests.patch new file mode 100644 index 0000000..c6829ad --- /dev/null +++ b/0001-dont-install-tests.patch @@ -0,0 +1,41 @@ +commit 0d79eafe6fd027adb197c543df39cbdda6e0cbec +Author: Alejandro Álvarez Ayllón <a.alvarezayllon@gmail.com> +Date: Mon Jun 5 11:25:53 2023 +0000 + + Don't install tests + +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 2e54063598..f97cc69249 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -78,6 +78,7 @@ option(onnxruntime_USE_RKNPU "Build with RKNPU support" OFF) + option(onnxruntime_USE_DNNL "Build with DNNL support" OFF) + option(onnxruntime_USE_JSEP "Build with JavaScript implemented kernels support" OFF) + option(onnxruntime_BUILD_UNIT_TESTS "Build ONNXRuntime unit tests" ON) ++option(onnxruntime_INSTALL_UNIT_TESTS "Install ONNXRuntime unit tests" ON) + option(onnxruntime_BUILD_CSHARP "Build C# library" OFF) + option(onnxruntime_BUILD_OBJC "Build Objective-C library" OFF) + option(onnxruntime_USE_PREINSTALLED_EIGEN "Use pre-installed EIGEN. Need to provide eigen_SOURCE_PATH if turn this on." OFF) +diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake +index 9347be180d..09723613e4 100644 +--- a/cmake/onnxruntime_unittests.cmake ++++ b/cmake/onnxruntime_unittests.cmake +@@ -1027,11 +1027,13 @@ if (onnxruntime_USE_TVM) + endif() + endif() + +-install(TARGETS onnx_test_runner +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR} +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++if (onnxruntime_INSTALL_UNIT_TESTS) ++ install(TARGETS onnx_test_runner ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++endif() + + if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP) + if(onnxruntime_BUILD_BENCHMARKS) diff --git a/0001-downgrade-cmake.patch b/0001-downgrade-cmake.patch deleted file mode 100644 index bd2ad7d..0000000 --- a/0001-downgrade-cmake.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index 82a454791d..87a048fbd2 100644 ---- a/cmake/CMakeLists.txt -+++ b/cmake/CMakeLists.txt -@@ -2,7 +2,7 @@ - # Licensed under the MIT License. - - # Minimum CMake required --cmake_minimum_required(VERSION 3.26) -+cmake_minimum_required(VERSION 3.24) - - cmake_policy(SET CMP0069 NEW) - set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) -@@ -14,7 +14,7 @@ cmake_policy(SET CMP0117 NEW) - cmake_policy(SET CMP0104 OLD) - - # Enable Hot Reload for MSVC compilers if supported. --cmake_policy(SET CMP0141 NEW) -+# cmake_policy(SET CMP0141 NEW) - - # Project - project(onnxruntime C CXX ASM) diff --git a/0003-system-flatbuffers.patch b/0003-system-flatbuffers.patch new file mode 100644 index 0000000..d965f54 --- /dev/null +++ b/0003-system-flatbuffers.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake +index 8e412c7847..1e971e5b27 100644 +--- a/cmake/external/onnxruntime_external_deps.cmake ++++ b/cmake/external/onnxruntime_external_deps.cmake +@@ -103,7 +103,7 @@ FetchContent_Declare( + URL ${DEP_URL_flatbuffers} + URL_HASH SHA1=${DEP_SHA1_flatbuffers} + PATCH_COMMAND ${ONNXRUNTIME_FLATBUFFERS_PATCH_COMMAND} +- FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES Flatbuffers ++ FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES FlatBuffers + ) + + # Download a protoc binary from Internet if needed +@@ -342,6 +342,8 @@ namespace std { using ::getenv; } + target_compile_options(flatc PRIVATE /FI${CMAKE_BINARY_DIR}/gdk_cstdlib_wrapper.h) + endif() + endif() ++else() ++ add_library(flatbuffers::flatbuffers ALIAS flatbuffers::flatbuffers_shared) + endif() + + if (onnxruntime_BUILD_UNIT_TESTS) diff --git a/python-onnxruntime.spec b/python-onnxruntime.spec index 0632714..7a2af85 100644 --- a/python-onnxruntime.spec +++ b/python-onnxruntime.spec @@ -15,8 +15,9 @@ Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/onnxruntime-%{versi Source1: 3rd_party.tar.gz -Patch0: 0001-downgrade-cmake.patch +Patch0: 0001-dont-install-tests.patch Patch1: 0002-use-system-python.patch +Patch2: 0003-system-flatbuffers.patch BuildRequires: cmake BuildRequires: ninja-build |