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 c2e48b35..8af51076 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,6 @@ endif(NOT MSVC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(ONNX_ROOT ${PROJECT_SOURCE_DIR}/third_party/onnx) -add_subdirectory(${ONNX_ROOT}) 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" 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) target_include_directories(onnx_optimizer PUBLIC $ $ ) +# 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) -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 $) else() # Assume everything else is like gcc - target_link_libraries(onnx_opt_cpp2py_export - PRIVATE "-Wl,--whole-archive" $ - "-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) 563b71c70ff42168771402b2820f01ccd02420'>guix-pack.sh
AgeCommit message (Expand)Author
2020-09-28tests: Simplify shell exit status negation;...* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh, tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh, tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh, tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh, tests/guix-package.sh: Use the shell '!' keyword to negate command exit status in place of 'if ...; then false; else true; fi' Eric Bavier
2020-05-14store: 'mapm/accumulate-builds' preserves '%current-target-system'....Fixes <https://bugs.gnu.org/41182>. * guix/store.scm (mapm/accumulate-builds): Pass #:system and #:target to 'run-with-store'. * tests/store.scm ("mapm/accumulate-builds, %current-target-system"): New test. * tests/guix-pack.sh: Add 'guix pack -d --target' test. Ludovic Courtès
2020-03-31pack: Adjust test to '--dry-run' changes....This is a followup to 131f50cdc9dbb7183023f4dae759876a9e700bef. * tests/guix-pack.sh: Use '--no-grafts' in conjunction with '-n' and '-d'. Ludovic Courtès
2019-11-22pack: Allow multiple '--manifest' options....* guix/scripts/pack.scm (guix-pack): Collect 'manifest' options, and concatenate the resulting manifests. * tests/guix-pack.sh: Test it. * doc/guix.texi (Invoking guix pack): Document it. Ludovic Courtès
2019-11-21pack: Add "--derivation"....* guix/scripts/pack.scm (%options, show-help): Add "--derivation". (guix-pack): Honor it. * tests/guix-pack.sh: Test it. * doc/guix.texi (Invoking guix pack): Document it. Ludovic Courtès
2019-05-22pack: Add '--root'....* guix/scripts/pack.scm (%options, show-help): Add "--root". (guix-pack): Honor it. * tests/guix-pack.sh: Test it. * doc/guix.texi (Invoking guix pack): Document it. Ludovic Courtès
2019-05-09tests: Ensure 'unshare' works before relying on it....Fixes <https://bugs.gnu.org/35642>. Reported by Josh Holland <josh@inv.alid.pw>. * tests/guix-pack-relocatable.sh: Before invoking 'unshare' at the bottom, add "if unshare -r true" condition. * tests/guix-pack.sh: Likewise. Ludovic Courtès