Skip to content

Commit

Permalink
Supported newer protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Oct 24, 2024
1 parent 187c7cf commit 7f337b4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
14 changes: 9 additions & 5 deletions src/frontends/onnx/frontend/src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <google/protobuf/port_def.inc>
#include <google/protobuf/runtime_version.h>

#if PROTOBUF_VERSION >= 4022000 // protobuf 4.22
# define OV_PROTOBUF_ABSL_IS_USED
#endif
#include <google/protobuf/port_undef.inc>

#ifndef OV_PROTOBUF_ABSL_IS_USED
# include <google/protobuf/stubs/logging.h>
#ifdef OV_PROTOBUF_ABSL_IS_USED
# include <absl/log/globals.h>
#else
# include <google/protobuf/stubs/logging.h>
#endif

#include <fstream>
Expand Down Expand Up @@ -47,7 +49,9 @@ ONNX_FRONTEND_C_API void* get_front_end_data() {
};
#ifndef OPENVINO_DEBUG_ENABLE
// disable protobuf logging
# ifndef OV_PROTOBUF_ABSL_IS_USED
# ifdef OV_PROTOBUF_ABSL_IS_USED
absl::SetGlobalVLogLevel(0);
# else
google::protobuf::SetLogHandler(nullptr);
# endif
#endif
Expand Down
14 changes: 9 additions & 5 deletions src/frontends/paddle/src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

#include "openvino/frontend/paddle/frontend.hpp"

#include <google/protobuf/port_def.inc>
#include <google/protobuf/runtime_version.h>

#if PROTOBUF_VERSION >= 4022000 // protobuf 4.22
# define OV_PROTOBUF_ABSL_IS_USED
#endif
#include <google/protobuf/port_undef.inc>

#ifndef OV_PROTOBUF_ABSL_IS_USED
# include <google/protobuf/stubs/logging.h>
#ifdef OV_PROTOBUF_ABSL_IS_USED
# include <absl/log/globals.h>
#else
# include <google/protobuf/stubs/logging.h>
#endif

#include <fstream>
Expand Down Expand Up @@ -594,7 +596,9 @@ PADDLE_C_API void* get_front_end_data() {

#ifndef OPENVINO_DEBUG_ENABLE
// disable protobuf logging
# ifndef OV_PROTOBUF_ABSL_IS_USED
# ifdef OV_PROTOBUF_ABSL_IS_USED
absl::SetGlobalVLogLevel(0);
# else
google::protobuf::SetLogHandler(nullptr);
# endif
#endif
Expand Down
5 changes: 4 additions & 1 deletion thirdparty/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND
# try to find newer version first (major is changed)
# see https://protobuf.dev/support/version-support/ and
# https://github.com/protocolbuffers/protobuf/commit/d61f75ff6db36b4f9c0765f131f8edc2f86310fa
find_package(Protobuf 4.22.0 QUIET CONFIG)
find_package(Protobuf 5.26.0 QUIET CONFIG)
if(NOT Protobuf_FOUND)
find_package(Protobuf 4.22.0 QUIET CONFIG)
endif()
if(Protobuf_FOUND)
# protobuf was found via CONFIG mode, let's save it for later usage in OpenVINOConfig.cmake static build
set(protobuf_config CONFIG)
Expand Down

0 comments on commit 7f337b4

Please sign in to comment.