mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-04-07 03:10:15 -04:00
sci-libs/onnxruntime: new package, add 1.22.2
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
This commit is contained in:
2
sci-libs/onnxruntime/Manifest
Normal file
2
sci-libs/onnxruntime/Manifest
Normal file
@@ -0,0 +1,2 @@
|
||||
DIST eigen-3.4.0_p20250216.tar.bz2 2272941 BLAKE2B c86764a5c31b978d09f9f8f458a982fb16c2cdfd053e0c7a371fbe5b9c64bead42c25fb7d4cb795eb5ee7ff1800bb51fac6783ad0881dd69dee5d463ccd213e3 SHA512 3c9fab41bde1ee4b8f5ba21c991a75cc73e104cdb48f3377b5fc51afae8cbb5e891c39e4fd998c5263178a8962b09d9d907b9d125dfddc50bc2ec5171917d6b8
|
||||
DIST onnxruntime-1.22.2.tar.gz 241423673 BLAKE2B 831728ace1daed40793076703ac35260b0143d5ff3041eef57c08feb32d520ff363e4fc351551dbf713c62f30990f7dec24fee380d3aa36ec6d7303318f2f198 SHA512 af123f6374f522715caab28c8147882a7f1787e6616cb7226efd2fb02fd5935a7263c523d694e5dd1ea7971cdb2e71f939218231c2d18a8baba3e97171c3ef0b
|
||||
@@ -0,0 +1,15 @@
|
||||
From: Pavel Sobolev <contact@paveloom.dev>
|
||||
Subject: [PATCH] Add a missing include of `cstdint`.
|
||||
|
||||
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
|
||||
|
||||
--- a/onnxruntime/core/optimizer/transpose_optimization/optimizer_api.h
|
||||
+++ b/onnxruntime/core/optimizer/transpose_optimization/optimizer_api.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
+#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace onnx_transpose_optimization {
|
||||
@@ -0,0 +1,100 @@
|
||||
From: Pavel Sobolev <contact@paveloom.dev>
|
||||
Subject: [PATCH] Relax the dependency on `flatbuffers`.
|
||||
|
||||
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
|
||||
|
||||
--- a/onnxruntime/core/flatbuffers/schema/ort.fbs.h
|
||||
+++ b/onnxruntime/core/flatbuffers/schema/ort.fbs.h
|
||||
@@ -6,13 +6,6 @@
|
||||
|
||||
#include "core/common/flatbuffers.h"
|
||||
|
||||
-// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
-// generated, otherwise it may not be compatible.
|
||||
-static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
|
||||
- FLATBUFFERS_VERSION_MINOR == 5 &&
|
||||
- FLATBUFFERS_VERSION_REVISION == 26,
|
||||
- "Non-compatible flatbuffers version included");
|
||||
-
|
||||
namespace onnxruntime {
|
||||
namespace fbs {
|
||||
|
||||
--- a/onnxruntime/core/flatbuffers/schema/ort_training_checkpoint.fbs.h
|
||||
+++ b/onnxruntime/core/flatbuffers/schema/ort_training_checkpoint.fbs.h
|
||||
@@ -6,13 +6,6 @@
|
||||
|
||||
#include "core/common/flatbuffers.h"
|
||||
|
||||
-// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
-// generated, otherwise it may not be compatible.
|
||||
-static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
|
||||
- FLATBUFFERS_VERSION_MINOR == 5 &&
|
||||
- FLATBUFFERS_VERSION_REVISION == 26,
|
||||
- "Non-compatible flatbuffers version included");
|
||||
-
|
||||
#include "ort.fbs.h"
|
||||
|
||||
namespace onnxruntime {
|
||||
--- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/DmlGraphDesc_generated.h
|
||||
+++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/DmlGraphDesc_generated.h
|
||||
@@ -6,13 +6,6 @@
|
||||
|
||||
#include "core/common/flatbuffers.h"
|
||||
|
||||
-// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
-// generated, otherwise it may not be compatible.
|
||||
-static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
|
||||
- FLATBUFFERS_VERSION_MINOR == 5 &&
|
||||
- FLATBUFFERS_VERSION_REVISION == 26,
|
||||
- "Non-compatible flatbuffers version included");
|
||||
-
|
||||
#include "OperatorFieldTypes_generated.h"
|
||||
|
||||
namespace dml {
|
||||
--- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/OperatorFieldTypes_generated.h
|
||||
+++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/OperatorFieldTypes_generated.h
|
||||
@@ -6,13 +6,6 @@
|
||||
|
||||
#include "core/common/flatbuffers.h"
|
||||
|
||||
-// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
-// generated, otherwise it may not be compatible.
|
||||
-static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
|
||||
- FLATBUFFERS_VERSION_MINOR == 5 &&
|
||||
- FLATBUFFERS_VERSION_REVISION == 26,
|
||||
- "Non-compatible flatbuffers version included");
|
||||
-
|
||||
namespace dml {
|
||||
namespace ir {
|
||||
namespace operatorFieldTypes {
|
||||
--- a/onnxruntime/lora/adapter_format/adapter_schema.fbs.h
|
||||
+++ b/onnxruntime/lora/adapter_format/adapter_schema.fbs.h
|
||||
@@ -5,13 +5,6 @@
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
-// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
-// generated, otherwise it may not be compatible.
|
||||
-static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
|
||||
- FLATBUFFERS_VERSION_MINOR == 5 &&
|
||||
- FLATBUFFERS_VERSION_REVISION == 26,
|
||||
- "Non-compatible flatbuffers version included");
|
||||
-
|
||||
namespace onnxruntime {
|
||||
namespace adapters {
|
||||
|
||||
--- a/onnxruntime/test/flatbuffers/flatbuffers_utils_test.fbs.h
|
||||
+++ b/onnxruntime/test/flatbuffers/flatbuffers_utils_test.fbs.h
|
||||
@@ -7,13 +7,6 @@
|
||||
// manual edit to use wrapper in core/common
|
||||
#include "core/common/flatbuffers.h"
|
||||
|
||||
-// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
-// generated, otherwise it may not be compatible.
|
||||
-static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
|
||||
- FLATBUFFERS_VERSION_MINOR == 5 &&
|
||||
- FLATBUFFERS_VERSION_REVISION == 26,
|
||||
- "Non-compatible flatbuffers version included");
|
||||
-
|
||||
// manual edit to set include path for this
|
||||
#include "core/flatbuffers/schema/ort.fbs.h"
|
||||
@@ -0,0 +1,226 @@
|
||||
From: Pavel Sobolev <contact@paveloom.dev>
|
||||
Subject: [PATCH] Use system libraries.
|
||||
|
||||
Everything, except for Eigen3.
|
||||
|
||||
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
|
||||
|
||||
--- a/cmake/external/abseil-cpp.cmake
|
||||
+++ b/cmake/external/abseil-cpp.cmake
|
||||
@@ -28,7 +28,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL_HASH SHA1=${DEP_SHA1_abseil_cpp}
|
||||
EXCLUDE_FROM_ALL
|
||||
PATCH_COMMAND ${ABSL_PATCH_COMMAND}
|
||||
- FIND_PACKAGE_ARGS 20240722 NAMES absl
|
||||
+ FIND_PACKAGE_ARGS NAMES absl REQUIRED
|
||||
)
|
||||
|
||||
onnxruntime_fetchcontent_makeavailable(abseil_cpp)
|
||||
--- a/cmake/external/onnxruntime_external_deps.cmake
|
||||
+++ b/cmake/external/onnxruntime_external_deps.cmake
|
||||
@@ -40,7 +40,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL ${DEP_URL_re2}
|
||||
URL_HASH SHA1=${DEP_SHA1_re2}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES re2
|
||||
+ FIND_PACKAGE_ARGS NAMES re2 REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(re2)
|
||||
|
||||
@@ -68,7 +68,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
||||
URL ${DEP_URL_googletest}
|
||||
URL_HASH SHA1=${DEP_SHA1_googletest}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 1.14.0...<2.0.0 NAMES GTest
|
||||
+ FIND_PACKAGE_ARGS 1.14.0...<2.0.0 NAMES GTest REQUIRED
|
||||
)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
endif()
|
||||
@@ -84,7 +84,7 @@ if (onnxruntime_BUILD_BENCHMARKS)
|
||||
URL ${DEP_URL_google_benchmark}
|
||||
URL_HASH SHA1=${DEP_SHA1_google_benchmark}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES benchmark
|
||||
+ FIND_PACKAGE_ARGS NAMES benchmark REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(google_benchmark)
|
||||
endif()
|
||||
@@ -102,7 +102,7 @@ if(onnxruntime_USE_MIMALLOC)
|
||||
URL ${DEP_URL_mimalloc}
|
||||
URL_HASH SHA1=${DEP_SHA1_mimalloc}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES mimalloc
|
||||
+ FIND_PACKAGE_ARGS NAMES mimalloc REQUIRED
|
||||
)
|
||||
FetchContent_MakeAvailable(mimalloc)
|
||||
endif()
|
||||
@@ -191,7 +191,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL_HASH SHA1=${DEP_SHA1_protobuf}
|
||||
PATCH_COMMAND ${ONNXRUNTIME_PROTOBUF_PATCH_COMMAND}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES Protobuf protobuf
|
||||
+ FIND_PACKAGE_ARGS NAMES Protobuf protobuf REQUIRED
|
||||
)
|
||||
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
|
||||
@@ -271,7 +271,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL ${DEP_URL_date}
|
||||
URL_HASH SHA1=${DEP_SHA1_date}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 3...<4 NAMES date
|
||||
+ FIND_PACKAGE_ARGS 3...<4 NAMES date REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(date)
|
||||
|
||||
@@ -285,7 +285,7 @@ if(NOT TARGET Boost::mp11)
|
||||
mp11
|
||||
URL ${DEP_URL_mp11}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES Boost
|
||||
+ FIND_PACKAGE_ARGS NAMES Boost REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(mp11)
|
||||
if(NOT TARGET Boost::mp11)
|
||||
@@ -302,7 +302,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL ${DEP_URL_json}
|
||||
URL_HASH SHA1=${DEP_SHA1_json}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 3.10 NAMES nlohmann_json
|
||||
+ FIND_PACKAGE_ARGS 3.10 NAMES nlohmann_json REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(nlohmann_json)
|
||||
|
||||
@@ -366,7 +366,7 @@ if (CPUINFO_SUPPORTED)
|
||||
URL_HASH SHA1=${DEP_SHA1_pytorch_cpuinfo}
|
||||
EXCLUDE_FROM_ALL
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} -p1 < ${PROJECT_SOURCE_DIR}/patches/cpuinfo/9bb12d342fd9479679d505d93a478a6f9cd50a47.patch
|
||||
- FIND_PACKAGE_ARGS NAMES cpuinfo
|
||||
+ FIND_PACKAGE_ARGS NAMES cpuinfo REQUIRED
|
||||
)
|
||||
else()
|
||||
onnxruntime_fetchcontent_declare(
|
||||
@@ -374,7 +374,7 @@ if (CPUINFO_SUPPORTED)
|
||||
URL ${DEP_URL_pytorch_cpuinfo}
|
||||
URL_HASH SHA1=${DEP_SHA1_pytorch_cpuinfo}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES cpuinfo
|
||||
+ FIND_PACKAGE_ARGS NAMES cpuinfo REQUIRED
|
||||
)
|
||||
endif()
|
||||
set(ONNXRUNTIME_CPUINFO_PROJ pytorch_cpuinfo)
|
||||
@@ -392,7 +392,7 @@ if(onnxruntime_USE_CUDA)
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
|
||||
+ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL REQUIRED
|
||||
)
|
||||
else()
|
||||
onnxruntime_fetchcontent_declare(
|
||||
@@ -400,14 +400,14 @@ else()
|
||||
URL ${DEP_URL_microsoft_gsl}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
|
||||
+ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL REQUIRED
|
||||
)
|
||||
endif()
|
||||
set(GSL_TARGET "Microsoft.GSL::GSL")
|
||||
set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
|
||||
onnxruntime_fetchcontent_makeavailable(GSL)
|
||||
|
||||
-find_path(safeint_SOURCE_DIR NAMES "SafeInt.hpp")
|
||||
+find_path(safeint_SOURCE_DIR NAMES "SafeInt.hpp" REQUIRED)
|
||||
if(NOT safeint_SOURCE_DIR)
|
||||
unset(safeint_SOURCE_DIR)
|
||||
onnxruntime_fetchcontent_declare(
|
||||
@@ -449,10 +449,14 @@ onnxruntime_fetchcontent_declare(
|
||||
URL_HASH SHA1=${DEP_SHA1_flatbuffers}
|
||||
PATCH_COMMAND ${ONNXRUNTIME_FLATBUFFERS_PATCH_COMMAND}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers flatbuffers
|
||||
+ FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers flatbuffers REQUIRED
|
||||
)
|
||||
|
||||
onnxruntime_fetchcontent_makeavailable(flatbuffers)
|
||||
+if(TARGET flatbuffers::flatbuffers_shared AND NOT TARGET flatbuffers::flatbuffers)
|
||||
+ message(STATUS "Aliasing flatbuffers::flatbuffers to flatbuffers::flatbuffers_shared")
|
||||
+ add_library(flatbuffers::flatbuffers ALIAS flatbuffers::flatbuffers_shared)
|
||||
+endif()
|
||||
if(NOT flatbuffers_FOUND)
|
||||
if(NOT TARGET flatbuffers::flatbuffers)
|
||||
add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
|
||||
@@ -514,7 +514,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL_HASH SHA1=${DEP_SHA1_onnx}
|
||||
PATCH_COMMAND ${ONNXRUNTIME_ONNX_PATCH_COMMAND}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES ONNX onnx
|
||||
+ FIND_PACKAGE_ARGS NAMES ONNX onnx REQUIRED
|
||||
)
|
||||
if (NOT onnxruntime_MINIMAL_BUILD)
|
||||
onnxruntime_fetchcontent_makeavailable(onnx)
|
||||
@@ -597,7 +597,7 @@ if(onnxruntime_ENABLE_DLPACK)
|
||||
URL ${DEP_URL_dlpack}
|
||||
URL_HASH SHA1=${DEP_SHA1_dlpack}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES dlpack
|
||||
+ FIND_PACKAGE_ARGS NAMES dlpack REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(dlpack)
|
||||
endif()
|
||||
@@ -610,7 +610,7 @@ if(onnxruntime_ENABLE_TRAINING OR (onnxruntime_ENABLE_TRAINING_APIS AND onnxrunt
|
||||
URL ${DEP_URL_cxxopts}
|
||||
URL_HASH SHA1=${DEP_SHA1_cxxopts}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES cxxopts
|
||||
+ FIND_PACKAGE_ARGS NAMES cxxopts REQUIRED
|
||||
)
|
||||
set(CXXOPTS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
--- a/cmake/external/pybind11.cmake
|
||||
+++ b/cmake/external/pybind11.cmake
|
||||
@@ -6,7 +6,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL ${DEP_URL_pybind11}
|
||||
URL_HASH SHA1=${DEP_SHA1_pybind11}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS 2.13 NAMES pybind11
|
||||
+ FIND_PACKAGE_ARGS 2.13 NAMES pybind11 REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(pybind11_project)
|
||||
|
||||
--- a/cmake/external/wil.cmake
|
||||
+++ b/cmake/external/wil.cmake
|
||||
@@ -8,7 +8,7 @@ onnxruntime_fetchcontent_declare(
|
||||
URL ${DEP_URL_microsoft_wil}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_wil}
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES wil
|
||||
+ FIND_PACKAGE_ARGS NAMES wil REQUIRED
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
--- a/cmake/external/xnnpack.cmake
|
||||
+++ b/cmake/external/xnnpack.cmake
|
||||
@@ -17,11 +17,11 @@ if(CMAKE_ANDROID_ARCH_ABI STREQUAL armeabi-v7a)
|
||||
endif()
|
||||
|
||||
# pthreadpool depends on fxdiv
|
||||
-onnxruntime_fetchcontent_declare(fxdiv URL ${DEP_URL_fxdiv} URL_HASH SHA1=${DEP_SHA1_fxdiv} EXCLUDE_FROM_ALL FIND_PACKAGE_ARGS NAMES fxdiv)
|
||||
+onnxruntime_fetchcontent_declare(fxdiv URL ${DEP_URL_fxdiv} URL_HASH SHA1=${DEP_SHA1_fxdiv} EXCLUDE_FROM_ALL FIND_PACKAGE_ARGS NAMES fxdiv REQUIRED)
|
||||
onnxruntime_fetchcontent_makeavailable(fxdiv)
|
||||
set(FXDIV_SOURCE_DIR ${fxdiv_SOURCE_DIR})
|
||||
|
||||
-onnxruntime_fetchcontent_declare(pthreadpool URL ${DEP_URL_pthreadpool} URL_HASH SHA1=${DEP_SHA1_pthreadpool} EXCLUDE_FROM_ALL FIND_PACKAGE_ARGS NAMES unofficial-pthreadpool)
|
||||
+onnxruntime_fetchcontent_declare(pthreadpool URL ${DEP_URL_pthreadpool} URL_HASH SHA1=${DEP_SHA1_pthreadpool} EXCLUDE_FROM_ALL FIND_PACKAGE_ARGS NAMES unofficial-pthreadpool REQUIRED)
|
||||
onnxruntime_fetchcontent_makeavailable(pthreadpool)
|
||||
|
||||
# --- Determine target processor
|
||||
@@ -84,7 +84,7 @@ endif()
|
||||
onnxruntime_fetchcontent_declare(googlexnnpack URL ${DEP_URL_googlexnnpack} URL_HASH SHA1=${DEP_SHA1_googlexnnpack}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/xnnpack/AddEmscriptenAndIosSupport.patch
|
||||
EXCLUDE_FROM_ALL
|
||||
- FIND_PACKAGE_ARGS NAMES xnnpack
|
||||
+ FIND_PACKAGE_ARGS NAMES xnnpack REQUIRED
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(googlexnnpack)
|
||||
set(XNNPACK_DIR ${googlexnnpack_SOURCE_DIR})
|
||||
12
sci-libs/onnxruntime/metadata.xml
Normal file
12
sci-libs/onnxruntime/metadata.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>contact@paveloom.dev</email>
|
||||
<name>Pavel Sobolev</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<bugs-to>https://github.com/microsoft/onnxruntime/issues</bugs-to>
|
||||
<remote-id type="github">microsoft/onnxruntime</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
146
sci-libs/onnxruntime/onnxruntime-1.22.2.ebuild
Normal file
146
sci-libs/onnxruntime/onnxruntime-1.22.2.ebuild
Normal file
@@ -0,0 +1,146 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{11..13} )
|
||||
|
||||
inherit cmake edo flag-o-matic python-r1
|
||||
|
||||
EIGEN_COMMIT="1d8b82b0740839c0de7f1242a3585e3390ff5f33"
|
||||
|
||||
DESCRIPTION="Cross-platform, high performance ML inferencing and training accelerator"
|
||||
HOMEPAGE="
|
||||
https://onnxruntime.ai
|
||||
https://github.com/microsoft/onnxruntime
|
||||
"
|
||||
SRC_URI="
|
||||
https://github.com/microsoft/onnxruntime/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
|
||||
https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_COMMIT}/eigen-${EIGEN_COMMIT}.tar.bz2 ->
|
||||
eigen-3.4.0_p20250216.tar.bz2
|
||||
"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
IUSE="python test"
|
||||
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
dev-cpp/abseil-cpp:=
|
||||
dev-libs/cpuinfo
|
||||
dev-libs/protobuf:=
|
||||
dev-libs/re2:=
|
||||
sci-ml/onnx[disableStaticReg]
|
||||
|
||||
python? (
|
||||
${PYTHON_DEPS}
|
||||
dev-python/coloredlogs[${PYTHON_USEDEP}]
|
||||
dev-python/flatbuffers[${PYTHON_USEDEP}]
|
||||
>=dev-python/numpy-2[${PYTHON_USEDEP}]
|
||||
dev-python/packaging[${PYTHON_USEDEP}]
|
||||
dev-python/protobuf[${PYTHON_USEDEP}]
|
||||
dev-python/sympy[${PYTHON_USEDEP}]
|
||||
)
|
||||
"
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
dev-cpp/ms-gsl
|
||||
dev-cpp/nlohmann_json
|
||||
dev-cpp/safeint
|
||||
dev-libs/boost
|
||||
dev-libs/date
|
||||
dev-libs/flatbuffers
|
||||
|
||||
python? (
|
||||
dev-python/pybind11[${PYTHON_USEDEP}]
|
||||
sci-libs/dlpack
|
||||
)
|
||||
"
|
||||
BDEPEND="
|
||||
${PYTHON_DEPS}
|
||||
|
||||
test? (
|
||||
dev-cpp/gtest
|
||||
|
||||
python? ( dev-python/pytest[${PYTHON_USEDEP}] )
|
||||
)
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-1.22.2-add-a-missing-include-of-cstdint.patch"
|
||||
"${FILESDIR}/${PN}-1.22.2-relax-the-dependency-on-flatbuffers.patch"
|
||||
"${FILESDIR}/${PN}-1.22.2-use-system-libraries.patch"
|
||||
)
|
||||
|
||||
CMAKE_USE_DIR="${S}/cmake"
|
||||
|
||||
src_configure() {
|
||||
# Python is used at build time unconditionally
|
||||
python_setup
|
||||
|
||||
local mycmakeargs=(
|
||||
-Donnxruntime_BUILD_SHARED_LIB=on
|
||||
|
||||
-Donnxruntime_BUILD_UNIT_TESTS=$(usex test)
|
||||
-Donnxruntime_ENABLE_PYTHON=$(usex python)
|
||||
|
||||
# This is required until a newer version of Eigen3 comes out
|
||||
-DFETCHCONTENT_SOURCE_DIR_EIGEN3="${WORKDIR}/eigen-${EIGEN_COMMIT}"
|
||||
|
||||
# This makes it possible for `find_path` to find the `onnx-ml.proto` file
|
||||
-DCMAKE_INCLUDE_PATH="$(python_get_sitedir)"
|
||||
|
||||
-Wno-dev
|
||||
)
|
||||
|
||||
append-ldflags -Wl,-z,noexecstack
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
# Adapted from `run_onnxruntime_tests` in `tools/ci_build/build.py`
|
||||
python_test() {
|
||||
cd "${S}/cmake_build" || die
|
||||
epytest --pyargs \
|
||||
onnxruntime_test_python.py \
|
||||
onnxruntime_test_python_backend.py \
|
||||
onnxruntime_test_python_mlops.py \
|
||||
onnxruntime_test_python_sparse_matmul.py
|
||||
}
|
||||
|
||||
src_test() {
|
||||
export GTEST_FILTER="*:-ActivationOpNoInfTest.Softsign"
|
||||
cmake_src_test
|
||||
|
||||
if use python ; then
|
||||
python_test
|
||||
fi
|
||||
}
|
||||
|
||||
# There is some custom logic in `setup.py`
|
||||
python_install() {
|
||||
cd "${S}/cmake_build" || die
|
||||
edo ${EPYTHON} ../setup.py install \
|
||||
--prefix="${EPREFIX}/usr" \
|
||||
--root="${D}"
|
||||
|
||||
libs=(
|
||||
"libonnxruntime.so.${PV}"
|
||||
"libonnxruntime_providers_shared.so"
|
||||
)
|
||||
for lib in "${libs[@]}"; do
|
||||
ln -fsr "${ED}/usr/$(get_libdir)/${lib}" "${D}/$(python_get_sitedir)/onnxruntime/capi/${lib}"
|
||||
done
|
||||
|
||||
rm -rf "${D}/$(python_get_sitedir)"/*.egg-info
|
||||
python_optimize
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
|
||||
if use python ; then
|
||||
python_foreach_impl python_install
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user