all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 7890bee045d1f7f04c6330945898c4e27552b4a1 2582 bytes (raw)
name: gnu/packages/patches/onnx-optimizer-system-library.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
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.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00633856..c6f3188d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,6 @@ if(NOT ONNX_OPT_USE_SYSTEM_PROTOBUF)
 endif()


-set(ONNX_ROOT ${PROJECT_SOURCE_DIR}/third_party/onnx)
-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)
@@ -41,14 +39,18 @@ file(GLOB onnx_opt_srcs "onnxoptimizer/*.cc"
 list(REMOVE_ITEM onnx_opt_srcs "${PROJECT_SOURCE_DIR}/onnxoptimizer/cpp2py_export.cc")
 
 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")
+
 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)


 file(GLOB onnx_opt_c_api_srcs "onnxoptimizer/c_api/*.cc"
@@ -112,11 +114,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)
     set_target_properties(onnx_opt_cpp2py_export
-                          PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
+                          PROPERTIES LINK_FLAGS
+			  "-Wl,-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)

debug log:

solving 7890bee045 ...
found 7890bee045 in https://yhetil.org/guix/298ff69fb8f8e7501dd2f2d0eebc9d40405e2ac6.1694375976.git.atai@atai.org/
found 5c592597e0 in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 5c592597e08cbd0e70200c93cd61ff5b7874519e	gnu/packages/patches/onnx-optimizer-system-library.patch

applying [1/1] https://yhetil.org/guix/298ff69fb8f8e7501dd2f2d0eebc9d40405e2ac6.1694375976.git.atai@atai.org/
diff --git a/gnu/packages/patches/onnx-optimizer-system-library.patch b/gnu/packages/patches/onnx-optimizer-system-library.patch
index 5c592597e0..7890bee045 100644

1:80: trailing whitespace.
 
Checking patch gnu/packages/patches/onnx-optimizer-system-library.patch...
Applied patch gnu/packages/patches/onnx-optimizer-system-library.patch cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 7890bee045d1f7f04c6330945898c4e27552b4a1	gnu/packages/patches/onnx-optimizer-system-library.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.