mirror of
https://github.com/monero-project/monero.git
synced 2025-05-17 10:04:42 +00:00
trezor: fix protobuf 30 compatibility
This commit is contained in:
parent
f90a267fa3
commit
a5fabe5134
3 changed files with 18 additions and 0 deletions
|
@ -63,6 +63,10 @@ if (USE_DEVICE_TREZOR)
|
||||||
trezor_fatal_msg("Trezor: protobuf library not found")
|
trezor_fatal_msg("Trezor: protobuf library not found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (Protobuf_VERSION VERSION_GREATER_EQUAL 22.0)
|
||||||
|
add_definitions(-DPROTOBUF_HAS_ABSEIL)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(TREZOR_DEBUG)
|
if(TREZOR_DEBUG)
|
||||||
set(USE_DEVICE_TREZOR_DEBUG 1)
|
set(USE_DEVICE_TREZOR_DEBUG 1)
|
||||||
message(STATUS "Trezor: debug build enabled")
|
message(STATUS "Trezor: debug build enabled")
|
||||||
|
|
|
@ -132,5 +132,11 @@ namespace trezor
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PROTOBUF_HAS_ABSEIL
|
||||||
|
messages::MessageType MessageMapper::get_message_wire_number(const absl::string_view& msg_name) {
|
||||||
|
return MessageMapper::get_message_wire_number(std::string{msg_name});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
#include <google/protobuf/generated_enum_reflection.h>
|
#include <google/protobuf/generated_enum_reflection.h>
|
||||||
#include "google/protobuf/descriptor.pb.h"
|
#include "google/protobuf/descriptor.pb.h"
|
||||||
|
|
||||||
|
#ifdef PROTOBUF_HAS_ABSEIL
|
||||||
|
#include <absl/strings/string_view.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "messages/messages.pb.h"
|
#include "messages/messages.pb.h"
|
||||||
|
|
||||||
namespace hw {
|
namespace hw {
|
||||||
|
@ -62,6 +66,10 @@ namespace trezor {
|
||||||
static messages::MessageType get_message_wire_number(const google::protobuf::Message & msg);
|
static messages::MessageType get_message_wire_number(const google::protobuf::Message & msg);
|
||||||
static messages::MessageType get_message_wire_number(const std::string & msg_name);
|
static messages::MessageType get_message_wire_number(const std::string & msg_name);
|
||||||
|
|
||||||
|
#ifdef PROTOBUF_HAS_ABSEIL
|
||||||
|
static messages::MessageType get_message_wire_number(const absl::string_view & msg_name); // Protobuf 30 and up
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class t_message=google::protobuf::Message>
|
template<class t_message=google::protobuf::Message>
|
||||||
static messages::MessageType get_message_wire_number() {
|
static messages::MessageType get_message_wire_number() {
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
|
|
Loading…
Reference in a new issue