diff options
author | CoprDistGit <infra@openeuler.org> | 2024-04-15 01:44:51 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-04-15 01:44:51 +0000 |
commit | 7993554df0b339b282e99a6b02596e63637c44df (patch) | |
tree | 614553ac99434b1ab3f161c57eb71aefeda9b4fa | |
parent | 69fb29f4d56164797f0f1ce9368f9466d9124c02 (diff) |
automatic import of onnxruntime
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | 0001-downgrade-cmake.patch | 22 | ||||
-rw-r--r-- | 0002-use-system-python.patch | 20 | ||||
-rw-r--r-- | python-onnxruntime.spec | 117 | ||||
-rw-r--r-- | sources | 2 |
5 files changed, 163 insertions, 0 deletions
@@ -0,0 +1,2 @@ +/3rd_party.tar.gz +/onnxruntime-1.16.3.tar.gz diff --git a/0001-downgrade-cmake.patch b/0001-downgrade-cmake.patch new file mode 100644 index 0000000..bd2ad7d --- /dev/null +++ b/0001-downgrade-cmake.patch @@ -0,0 +1,22 @@ +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/0002-use-system-python.patch b/0002-use-system-python.patch new file mode 100644 index 0000000..b810f0d --- /dev/null +++ b/0002-use-system-python.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 82a454791d..ddb7a904f2 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -531,12 +531,12 @@ endif() + if (onnxruntime_BUILD_SHARED_LIB OR onnxruntime_ENABLE_PYTHON) + if (onnxruntime_ENABLE_PYTHON) + if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS OR onnxruntime_REQUIRE_PYTHON_EMBED_LIB) +- find_package(Python 3.8 COMPONENTS Interpreter Development NumPy) ++ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development NumPy) + else() +- find_package(Python 3.8 COMPONENTS Interpreter Development.Module NumPy) ++ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development.Module NumPy) + endif() + else() +- find_package(Python 3.8 COMPONENTS Interpreter) ++ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter) + endif() + endif() + diff --git a/python-onnxruntime.spec b/python-onnxruntime.spec new file mode 100644 index 0000000..0632714 --- /dev/null +++ b/python-onnxruntime.spec @@ -0,0 +1,117 @@ +%global pypi_name onnxruntime +%global pypi_version 1.16.3 +%global pkg_summary ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator +%global pkg_description %{expand: +%{pkg_summary}} + +Name: %{pypi_name} +Version: %{pypi_version} +Release: 1 +Summary: %{pkg_summary} + +License: MIT +URL: https://github.com/microsoft/onnxruntime +Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/onnxruntime-%{version}.tar.gz + +Source1: 3rd_party.tar.gz + +Patch0: 0001-downgrade-cmake.patch +Patch1: 0002-use-system-python.patch + +BuildRequires: cmake +BuildRequires: ninja-build +BuildRequires: g++ +BuildRequires: flatbuffers +BuildRequires: ccache +BuildRequires: libedit-devel +BuildRequires: abseil-cpp-devel +BuildRequires: boost-devel +BuildRequires: bzip2 +BuildRequires: flatbuffers-compiler +BuildRequires: flatbuffers-devel +BuildRequires: gmock-devel +BuildRequires: gsl-devel +BuildRequires: gtest-devel +BuildRequires: protobuf-devel +BuildRequires: re2-devel +BuildRequires: zlib-devel +BuildRequires: eigen3-devel +BuildRequires: pybind11-devel + +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-setuptools_scm +BuildRequires: python3-pbr +BuildRequires: python3-pip +BuildRequires: python3-wheel +BuildRequires: python3-hatchling +BuildRequires: python3-flatbuffers + +%description +%{pkg_description} + +%package devel +Summary: The development part of the %{name} package +Requires: %{name}%{_isa} = %{version}-%{release} + +%description devel +The development part of the %{name} package + +%package -n python3-onnxruntime +Summary: %{summary} +Requires: %{name}%{_isa} = %{version}-%{release} + +%description -n python3-onnxruntime +Python bindings for the %{name} package + +%package doc +Summary: Documentation files for the %{name} package + +%description doc +Documentation files for the %{name} package + +%prep +%autosetup -p1 -n %{pypi_name}-%{pypi_version} +rm -r cmake/external +tar -xzf %{SOURCE1} --directory=. + +%build +# Re-generate flatbuffer headers +%{__python3} onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc %{_bindir}/flatc + +bash build.sh --build_dir build --config RelWithDebInfo --skip_tests --enable_pybind --build_wheel --build_shared_lib --skip_submodule_sync + +%pyproject_build + +%install + +# doc +mkdir -p "%{buildroot}/%{_docdir}/" +cp --preserve=timestamps -r "./docs/" "%{buildroot}/%{_docdir}/%{name}" +# python +%pyproject_install + +%files +%license LICENSE +%doc ThirdPartyNotices.txt +%{_libdir}/libonnxruntime.so.%{version} +%{_libdir}/libonnxruntime_providers_shared.so.%{version} + +%files devel +%dir %{_includedir}/onnxruntime/ +%{_includedir}/onnxruntime/* +%{_libdir}/libonnxruntime.so +%{_libdir}/libonnxruntime_providers_shared.so +%{_libdir}/pkgconfig/libonnxruntime.pc +%{_libdir}/cmake/onnxruntime/* + +%files -n python3-onnxruntime +%{python3_sitearch}/onnxruntime* +%{_bindir}/onnxruntime_test + +%files doc +%{_docdir}/%{name} + +%changelog +* Sun Mar 31 2024 YunShu +- add onnxruntime 1.16.3 @@ -0,0 +1,2 @@ +07e6061a2147a00d978db17a012ff19c 3rd_party.tar.gz +fe5a67af96cf281275d4c11b24526e65 onnxruntime-1.16.3.tar.gz |