summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorDavid Elsing <david.elsing@posteo.net>2024-08-04 22:15:55 +0000
committerLudovic Courtès <ludo@gnu.org>2024-09-06 11:46:25 +0200
commit73302e3cae6284730878c887e355121aaaade799 (patch)
tree781ad47cf041bdc6e70e18c7d0d1e407b9f61c5d /gnu/packages/patches
parent595cc594b65ffe4a55c8b8d53a91a841cf056103 (diff)
gnu: onnx-optimizer: Update to 0.3.19.
* gnu/packages/machine-learning.scm (onnx-optimizer): Update to 0.3.19. * gnu/packages/patches/onnx-optimizer-system-library.patch: Adjust patch. Co-authored-by: Andy Tai <atai@atai.org>
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/onnx-optimizer-system-library.patch60
1 files changed, 30 insertions, 30 deletions
diff --git a/gnu/packages/patches/onnx-optimizer-system-library.patch b/gnu/packages/patches/onnx-optimizer-system-library.patch
index 5c592597e0..513623fe05 100644
--- a/gnu/packages/patches/onnx-optimizer-system-library.patch
+++ b/gnu/packages/patches/onnx-optimizer-system-library.patch
@@ -1,53 +1,53 @@
-Arrange so that onnx-optimizer (1) uses our own ONNX build,
-(2) builds as a shared library, and (3) links against the shared
-libraries of ONNX.
+Arrange so that onnx-optimizer uses our own ONNX build, and links against the
+shared libraries of ONNX.
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c2e48b35..8af51076 100644
+index 00633856..76a73853 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -9,8 +9,6 @@ endif(NOT MSVC)
+@@ -27,8 +27,6 @@ if(NOT ONNX_OPT_USE_SYSTEM_PROTOBUF)
+ endif()
- set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(ONNX_ROOT ${PROJECT_SOURCE_DIR}/third_party/onnx)
--add_subdirectory(${ONNX_ROOT})
+-add_subdirectory_if_no_target(${ONNX_ROOT} ${ONNX_TARGET_NAME})
file(READ "${PROJECT_SOURCE_DIR}/VERSION_NUMBER" ONNX_OPTIMIZER_VERSION)
string(STRIP "${ONNX_OPTIMIZER_VERSION}" ONNX_OPTIMIZER_VERSION)
-@@ -21,14 +19,18 @@ file(GLOB_RECURSE onnx_opt_srcs "onnxoptimizer/*.cc"
+@@ -41,14 +39,14 @@ file(GLOB onnx_opt_srcs "onnxoptimizer/*.cc"
list(REMOVE_ITEM onnx_opt_srcs "${PROJECT_SOURCE_DIR}/onnxoptimizer/cpp2py_export.cc")
- add_library(onnx_optimizer ${onnx_opt_srcs})
--target_link_libraries(onnx_optimizer PUBLIC onnx)
-+target_link_libraries(onnx_optimizer PUBLIC onnx onnx_proto)
+ onnxopt_add_library(onnx_optimizer ${onnx_opt_srcs})
+-target_link_libraries(onnx_optimizer PUBLIC ${ONNX_TARGET_NAME})
++target_link_libraries(onnx_optimizer PUBLIC ${ONNX_TARGET_NAME} onnx_proto)
target_include_directories(onnx_optimizer PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
-+# These cpp macros must be defined so the ONNX headers behave
-+# correctly.
-+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DONNX_ML=1 -DONNX_NAMESPACE=onnx")
-+
- add_executable(onnx_optimizer_exec examples/onnx_optimizer_exec.cpp)
+ onnxopt_add_executable(onnx_optimizer_exec examples/onnx_optimizer_exec.cpp)
-target_link_libraries(onnx_optimizer_exec onnx_optimizer)
-+target_link_libraries(onnx_optimizer_exec onnx_optimizer protobuf)
-
- if(BUILD_ONNX_PYTHON)
- if("${PY_EXT_SUFFIX}" STREQUAL "")
-@@ -79,11 +81,10 @@ if(BUILD_ONNX_PYTHON)
- PRIVATE $<TARGET_OBJECTS:onnx_optimizer>)
- else()
- # Assume everything else is like gcc
-- target_link_libraries(onnx_opt_cpp2py_export
-- PRIVATE "-Wl,--whole-archive" $<TARGET_FILE:onnx_optimizer>
-- "-Wl,--no-whole-archive")
-+ target_link_libraries(onnx_opt_cpp2py_export PRIVATE onnx_optimizer)
++target_link_libraries(onnx_optimizer_exec onnx_optimizer onnx_proto)
+
+
+ file(GLOB onnx_opt_c_api_srcs "onnxoptimizer/c_api/*.cc"
+@@ -116,7 +114,8 @@ if(BUILD_ONNX_PYTHON)
+ PRIVATE "-Wl,--whole-archive" $<TARGET_FILE:onnx_optimizer>
+ "-Wl,--no-whole-archive")
set_target_properties(onnx_opt_cpp2py_export
- PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
-+ PROPERTIES LINK_FLAGS
-+ "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib")
++ PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL,-rpath=${CMAKE_INSTALL_PREFIX}/lib")
++
endif()
target_link_libraries(onnx_opt_cpp2py_export PRIVATE onnx_optimizer)
+diff --git a/cmake/utils.cmake b/cmake/utils.cmake
+index 6cca9f36..8e39d5c4 100644
+--- a/cmake/utils.cmake
++++ b/cmake/utils.cmake
+@@ -1,4 +1,4 @@
+-include(${PROJECT_SOURCE_DIR}/third_party/onnx/cmake/Utils.cmake)
++include(${ONNX_ROOT}/cmake/Utils.cmake)
+
+ # Poor man's FetchContent
+ function(add_subdirectory_if_no_target dir target)