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 64 65 66 67 68 69
|
Description: Use system protobuf lib (libprotobuf-dev)
Forwarded: not-needed
Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-protobuf.patch
Author: Alejandro Álvarez Ayllón <a.alvarezayllon@gmail.com>
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
@@ -107,23 +107,6 @@
FetchContent_MakeAvailable(mimalloc)
endif()
-#Protobuf depends on utf8_range
-onnxruntime_fetchcontent_declare(
- utf8_range
- URL ${DEP_URL_utf8_range}
- URL_HASH SHA1=${DEP_SHA1_utf8_range}
- EXCLUDE_FROM_ALL
- FIND_PACKAGE_ARGS NAMES utf8_range
-)
-
-set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Build test suite" FORCE)
-set(utf8_range_ENABLE_INSTALL OFF CACHE BOOL "Configure installation" FORCE)
-
-# The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
-onnxruntime_fetchcontent_makeavailable(utf8_range)
-# protobuf's cmake/utf8_range.cmake has the following line
-include_directories(${utf8_range_SOURCE_DIR})
-
# Download a protoc binary from Internet if needed
if(NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT onnxruntime_USE_VCPKG)
# This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
@@ -201,36 +184,10 @@
set(ONNXRUNTIME_PROTOBUF_PATCH_COMMAND "")
endif()
-#Protobuf depends on absl and utf8_range
-onnxruntime_fetchcontent_declare(
- Protobuf
- URL ${DEP_URL_protobuf}
- URL_HASH SHA1=${DEP_SHA1_protobuf}
- PATCH_COMMAND ${ONNXRUNTIME_PROTOBUF_PATCH_COMMAND}
- EXCLUDE_FROM_ALL
- FIND_PACKAGE_ARGS NAMES Protobuf protobuf
-)
-
-set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
-#TODO: we'd better to turn the following option off. However, it will cause
-# ".\build.bat --config Debug --parallel --skip_submodule_sync --update" fail with an error message:
-# install(EXPORT "ONNXTargets" ...) includes target "onnx_proto" which requires target "libprotobuf-lite" that is
-# not in any export set.
-#set(protobuf_INSTALL OFF CACHE BOOL "Install protobuf binaries and files" FORCE)
-set(protobuf_USE_EXTERNAL_GTEST ON CACHE BOOL "" FORCE)
-
-if (ANDROID)
- set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib support" FORCE)
-endif()
-
-if (onnxruntime_DISABLE_RTTI)
- set(protobuf_DISABLE_RTTI ON CACHE BOOL "Remove runtime type information in the binaries" FORCE)
-endif()
-
+find_package(Protobuf REQUIRED)
include(protobuf_function)
#protobuf end
-onnxruntime_fetchcontent_makeavailable(Protobuf)
if(Protobuf_FOUND)
message(STATUS "Using protobuf from find_package(or vcpkg). Protobuf version: ${Protobuf_VERSION}")
else()
|