mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[build] Fix CMake protobuf dependency handling (#6772)
Reverts #6609 since that fix didn't Just Work(tm) on Windows. (edit: or Ubuntu. Seems to have broken everything except macOS.) This PR configures CMake to try and find protobuf-config.cmake first, which allows protobuf to pull in abseil for us. If protobuf-config.cmake is not available (coprocessors which don't have a new enough protobuf installed are a common case), it will fallback to CMake's built-in FindProtobuf module, which is what we were using before. Add wpi::CreateMessage, a wrapper with an ifdef to switch between Arena::CreateMessage and Arena::Create, since the former is deprecated in newer versions of protobuf. This allows forward compatibility with newer versions of protobuf.
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
|
||||
#include "frc/kinematics/proto/ChassisSpeedsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::ChassisSpeeds>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufChassisSpeeds>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufChassisSpeeds>(arena);
|
||||
}
|
||||
|
||||
frc::ChassisSpeeds wpi::Protobuf<frc::ChassisSpeeds>::Unpack(
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
|
||||
#include "frc/kinematics/proto/DifferentialDriveKinematicsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::DifferentialDriveKinematics>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufDifferentialDriveKinematics>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufDifferentialDriveKinematics>(
|
||||
arena);
|
||||
}
|
||||
|
||||
frc::DifferentialDriveKinematics
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
|
||||
#include "frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<
|
||||
frc::DifferentialDriveWheelPositions>::New(google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
return wpi::CreateMessage<
|
||||
wpi::proto::ProtobufDifferentialDriveWheelPositions>(arena);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
|
||||
#include "frc/kinematics/proto/DifferentialDriveWheelSpeedsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<
|
||||
frc::DifferentialDriveWheelSpeeds>::New(google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufDifferentialDriveWheelSpeeds>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufDifferentialDriveWheelSpeeds>(
|
||||
arena);
|
||||
}
|
||||
|
||||
frc::DifferentialDriveWheelSpeeds
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
#include "frc/kinematics/proto/MecanumDriveKinematicsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::MecanumDriveKinematics>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufMecanumDriveKinematics>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufMecanumDriveKinematics>(arena);
|
||||
}
|
||||
|
||||
frc::MecanumDriveKinematics wpi::Protobuf<frc::MecanumDriveKinematics>::Unpack(
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
|
||||
#include "frc/kinematics/proto/MecanumDriveWheelPositionsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::MecanumDriveWheelPositions>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufMecanumDriveWheelPositions>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufMecanumDriveWheelPositions>(
|
||||
arena);
|
||||
}
|
||||
|
||||
frc::MecanumDriveWheelPositions
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
#include "frc/kinematics/proto/MecanumDriveWheelSpeedsProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufMecanumDriveWheelSpeeds>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufMecanumDriveWheelSpeeds>(arena);
|
||||
}
|
||||
|
||||
frc::MecanumDriveWheelSpeeds
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
#include "frc/kinematics/proto/SwerveModulePositionProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::SwerveModulePosition>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufSwerveModulePosition>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufSwerveModulePosition>(arena);
|
||||
}
|
||||
|
||||
frc::SwerveModulePosition wpi::Protobuf<frc::SwerveModulePosition>::Unpack(
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
#include "frc/kinematics/proto/SwerveModuleStateProto.h"
|
||||
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
google::protobuf::Message* wpi::Protobuf<frc::SwerveModuleState>::New(
|
||||
google::protobuf::Arena* arena) {
|
||||
return google::protobuf::Arena::CreateMessage<
|
||||
wpi::proto::ProtobufSwerveModuleState>(arena);
|
||||
return wpi::CreateMessage<wpi::proto::ProtobufSwerveModuleState>(arena);
|
||||
}
|
||||
|
||||
frc::SwerveModuleState wpi::Protobuf<frc::SwerveModuleState>::Unpack(
|
||||
|
||||
Reference in New Issue
Block a user