diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2023-12-27 16:13:30 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2024-01-01 14:35:12 +0100 |
commit | 43c92f323e1750d2d3661b419e53c45c673501af (patch) | |
tree | 5fe715fefdcdd5c3f66bf81329e5de07dba436fb /gnu/packages/patches | |
parent | 77204306783ef7aae8b44bcafe699cbe35fb761d (diff) | |
download | guix-43c92f323e1750d2d3661b419e53c45c673501af.tar.gz guix-43c92f323e1750d2d3661b419e53c45c673501af.zip |
gnu: Add onnx-for-torch2.
* gnu/packages/machine-learning.scm (onnx-for-torch2): New variable.
* gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Change-Id: I8a46b9a8096a33bcf949bc4f5d497e22902ab301
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch b/gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch new file mode 100644 index 0000000000..b6a5e5d828 --- /dev/null +++ b/gnu/packages/patches/onnx-1.13.1-use-system-googletest.patch @@ -0,0 +1,55 @@ +ONNX will build googletest from a Git checkout. Patch CMake to use our +googletest package and enable tests by default. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0aa9fda2..a573170c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,7 @@ option(BUILD_ONNX_PYTHON "Build Python binaries" OFF) + option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON) + option(ONNX_WERROR "Build with Werror" OFF) + option(ONNX_COVERAGE "Build with coverage instrumentation" OFF) +-option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF) ++option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" ON) + option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF) + option(ONNXIFI_ENABLE_EXT "Enable onnxifi extensions." OFF) + if(NOT DEFINED ONNX_ML) +@@ -82,8 +82,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") + endif() + + if(ONNX_BUILD_TESTS) +- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external) +- include(googletest) ++ find_package(GTest REQUIRED) ++ if(NOT GTest_FOUND) ++ message(FATAL_ERROR "cannot find googletest") ++ endif() + endif() + + if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf)) +diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake +index e29a93ff..ae146390 100644 +--- a/cmake/unittest.cmake ++++ b/cmake/unittest.cmake +@@ -7,7 +7,7 @@ + + find_package(Threads) + +-set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES}) ++set(${UT_NAME}_libs ${GTEST_LIBRARIES}) + + list(APPEND ${UT_NAME}_libs onnx) + list(APPEND ${UT_NAME}_libs onnx_proto) +@@ -22,9 +22,9 @@ + list(REMOVE_DUPLICATES _UT_SOURCES) + + add_executable(${_UT_TARGET} ${_UT_SOURCES}) +- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest) ++ add_dependencies(${_UT_TARGET} onnx onnx_proto) + + target_include_directories(${_UT_TARGET} +- PUBLIC ${googletest_INCLUDE_DIRS} ++ PUBLIC ${GTEST_INCLUDE_DIRS} + ${ONNX_INCLUDE_DIRS} + ${PROTOBUF_INCLUDE_DIRS} + ${ONNX_ROOT}
\ No newline at end of file |