Allow to find protobuf via MODULE (#18395)
This commit is contained in:
parent
d864d89806
commit
14292b8da5
@ -390,9 +390,11 @@ endmacro()
|
|||||||
|
|
||||||
macro(_ov_find_protobuf_frontend_dependency)
|
macro(_ov_find_protobuf_frontend_dependency)
|
||||||
set(_OV_ENABLE_SYSTEM_PROTOBUF "@ENABLE_SYSTEM_PROTOBUF@")
|
set(_OV_ENABLE_SYSTEM_PROTOBUF "@ENABLE_SYSTEM_PROTOBUF@")
|
||||||
|
set(_OV_PROTOBUF_PACKAGE_CONFIG "@protobuf_config@")
|
||||||
if(_OV_ENABLE_SYSTEM_PROTOBUF)
|
if(_OV_ENABLE_SYSTEM_PROTOBUF)
|
||||||
_ov_find_dependency(Protobuf @Protobuf_VERSION@ EXACT NAMES Protobuf protobuf)
|
_ov_find_dependency(Protobuf @Protobuf_VERSION@ EXACT ${_OV_PROTOBUF_PACKAGE_CONFIG})
|
||||||
endif()
|
endif()
|
||||||
|
unset(_OV_PROTOBUF_PACKAGE_CONFIG)
|
||||||
unset(_OV_ENABLE_SYSTEM_PROTOBUF)
|
unset(_OV_ENABLE_SYSTEM_PROTOBUF)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
18
thirdparty/dependencies.cmake
vendored
18
thirdparty/dependencies.cmake
vendored
@ -2,6 +2,12 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" OR DEFINED VCPKG_VERBOSE)
|
||||||
|
set(OV_VCPKG_BUILD ON)
|
||||||
|
elseif(CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain" OR DEFINED CONAN_EXPORTED)
|
||||||
|
set(OV_CONAN_BUILD)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(_old_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
set(_old_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
set(_old_CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE})
|
set(_old_CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE})
|
||||||
|
|
||||||
@ -363,8 +369,7 @@ endif()
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
||||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg " OR DEFINED VCPKG_VERBOSE OR
|
if(OV_VCPKG_BUILD OR OV_CONAN_BUILD)
|
||||||
CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain" OR DEFINED CONAN_EXPORTED)
|
|
||||||
# vcpkg contains only libs compiled with threads
|
# vcpkg contains only libs compiled with threads
|
||||||
# conan case
|
# conan case
|
||||||
find_package(gflags QUIET)
|
find_package(gflags QUIET)
|
||||||
@ -446,15 +451,16 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND
|
|||||||
if(CMAKE_VERBOSE_MAKEFILE)
|
if(CMAKE_VERBOSE_MAKEFILE)
|
||||||
set(Protobuf_DEBUG ON)
|
set(Protobuf_DEBUG ON)
|
||||||
endif()
|
endif()
|
||||||
# Note: we also specify 'protobuf' in NAMES because of vcpkg
|
if(OV_VCPKG_BUILD)
|
||||||
set(find_package_protobuf_names Protobuf protobuf)
|
set(protobuf_config CONFIG)
|
||||||
|
endif()
|
||||||
# try to find newer version first (major is changed)
|
# try to find newer version first (major is changed)
|
||||||
# see https://protobuf.dev/support/version-support/ and
|
# see https://protobuf.dev/support/version-support/ and
|
||||||
# https://github.com/protocolbuffers/protobuf/commit/d61f75ff6db36b4f9c0765f131f8edc2f86310fa
|
# https://github.com/protocolbuffers/protobuf/commit/d61f75ff6db36b4f9c0765f131f8edc2f86310fa
|
||||||
find_package(Protobuf 4.22.0 QUIET NAMES ${find_package_protobuf_names})
|
find_package(Protobuf 4.22.0 QUIET ${protobuf_config})
|
||||||
if(NOT Protobuf_FOUND)
|
if(NOT Protobuf_FOUND)
|
||||||
# otherwise, fallback to existing default
|
# otherwise, fallback to existing default
|
||||||
find_package(Protobuf 3.20.3 REQUIRED NAMES ${find_package_protobuf_names})
|
find_package(Protobuf 3.20.3 REQUIRED ${protobuf_config})
|
||||||
endif()
|
endif()
|
||||||
set(PROTOC_EXECUTABLE protobuf::protoc)
|
set(PROTOC_EXECUTABLE protobuf::protoc)
|
||||||
else()
|
else()
|
||||||
|
Loading…
Reference in New Issue
Block a user