mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[build] Make Protobuf optional in CMake build (#7061)
This commit is contained in:
@@ -81,6 +81,7 @@ option(WITH_EXAMPLES "Build examples" OFF)
|
||||
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
|
||||
option(WITH_GUI "Build GUI items" ON)
|
||||
option(WITH_SIMULATION_MODULES "Build simulation modules" ON)
|
||||
option(WITH_PROTOBUF "Build protobuf support" ON)
|
||||
|
||||
# Options for using a package manager (e.g., vcpkg) for certain dependencies.
|
||||
option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF)
|
||||
@@ -131,9 +132,11 @@ endif()
|
||||
find_package(LIBSSH 0.7.1)
|
||||
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "" FORCE)
|
||||
find_package(Protobuf REQUIRED)
|
||||
find_program(PROTOC_COMPILER protoc REQUIRED)
|
||||
if(WITH_PROTOBUF)
|
||||
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "" FORCE)
|
||||
find_package(Protobuf REQUIRED)
|
||||
find_program(PROTOC_COMPILER protoc REQUIRED)
|
||||
endif()
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
|
||||
|
||||
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
@@ -2,6 +2,9 @@ include(CompileWarnings)
|
||||
|
||||
macro(wpilib_add_test name srcdir)
|
||||
file(GLOB_RECURSE test_src ${srcdir}/*.cpp)
|
||||
if(NOT WITH_PROTOBUF)
|
||||
list(FILTER test_src EXCLUDE REGEX "/proto/")
|
||||
endif()
|
||||
add_executable(${name}_test ${test_src})
|
||||
set_property(TARGET ${name}_test PROPERTY FOLDER "tests")
|
||||
wpilib_target_warnings(${name}_test)
|
||||
|
||||
@@ -109,11 +109,13 @@ void DataLogReaderThread::ReadMain() {
|
||||
schema, err);
|
||||
}
|
||||
} else if (auto filename = wpi::remove_prefix(name, "/.schema/proto:")) {
|
||||
#ifndef NO_PROTOBUF
|
||||
// protobuf descriptor handling
|
||||
if (!m_protoDb.Add(*filename, data)) {
|
||||
wpi::print("could not decode protobuf '{}' filename '{}'\n", name,
|
||||
*filename);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
#include <wpi/DenseMap.h>
|
||||
#include <wpi/Signal.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/protobuf/ProtobufMessageDatabase.h>
|
||||
#include <wpi/struct/DynamicStruct.h>
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include <wpi/protobuf/ProtobufMessageDatabase.h>
|
||||
#endif
|
||||
|
||||
namespace glass {
|
||||
|
||||
class DataLogReaderRange {
|
||||
@@ -75,7 +78,9 @@ class DataLogReaderThread {
|
||||
}
|
||||
|
||||
wpi::StructDescriptorDatabase& GetStructDatabase() { return m_structDb; }
|
||||
#ifndef NO_PROTOBUF
|
||||
wpi::ProtobufMessageDatabase& GetProtobufDatabase() { return m_protoDb; }
|
||||
#endif
|
||||
|
||||
const wpi::log::DataLogReader& GetReader() const { return m_reader; }
|
||||
|
||||
@@ -94,7 +99,9 @@ class DataLogReaderThread {
|
||||
std::map<std::string, DataLogReaderEntry, std::less<>> m_entriesByName;
|
||||
wpi::DenseMap<int, DataLogReaderEntry*> m_entriesById;
|
||||
wpi::StructDescriptorDatabase m_structDb;
|
||||
#ifndef NO_PROTOBUF
|
||||
wpi::ProtobufMessageDatabase m_protoDb;
|
||||
#endif
|
||||
std::thread m_thread;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_stdlib.h>
|
||||
#include <networktables/NetworkTableInstance.h>
|
||||
@@ -31,6 +29,11 @@
|
||||
#include <wpi/print.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#endif
|
||||
|
||||
#include "glass/Context.h"
|
||||
#include "glass/DataSource.h"
|
||||
#include "glass/Storage.h"
|
||||
@@ -346,6 +349,7 @@ static void UpdateStructValueSource(NetworkTablesModel& model,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
static void UpdateProtobufValueSource(NetworkTablesModel& model,
|
||||
NetworkTablesModel::ValueSource* out,
|
||||
const google::protobuf::Message& msg,
|
||||
@@ -534,6 +538,7 @@ static void UpdateProtobufValueSource(NetworkTablesModel& model,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void UpdateJsonValueSource(NetworkTablesModel& model,
|
||||
NetworkTablesModel::ValueSource* out,
|
||||
@@ -764,6 +769,7 @@ void NetworkTablesModel::ValueSource::UpdateFromValue(
|
||||
valueChildren.clear();
|
||||
}
|
||||
} else if (auto filename = wpi::remove_prefix(typeStr, "proto:")) {
|
||||
#ifndef NO_PROTOBUF
|
||||
auto msg = model.m_protoDb.Find(*filename);
|
||||
if (msg) {
|
||||
msg->Clear();
|
||||
@@ -777,6 +783,9 @@ void NetworkTablesModel::ValueSource::UpdateFromValue(
|
||||
} else {
|
||||
valueChildren.clear();
|
||||
}
|
||||
#else
|
||||
valueChildren.clear();
|
||||
#endif
|
||||
} else {
|
||||
valueChildren.clear();
|
||||
}
|
||||
@@ -902,6 +911,7 @@ void NetworkTablesModel::Update() {
|
||||
wpi::remove_prefix(entry->info.name, "/.schema/proto:");
|
||||
entry->value.IsRaw() && filename &&
|
||||
entry->info.type_str == "proto:FileDescriptorProto") {
|
||||
#ifndef NO_PROTOBUF
|
||||
// protobuf descriptor handling
|
||||
if (!m_protoDb.Add(*filename, entry->value.GetRaw())) {
|
||||
wpi::print("could not decode protobuf '{}' filename '{}'\n",
|
||||
@@ -918,6 +928,7 @@ void NetworkTablesModel::Update() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,12 @@
|
||||
#include <ntcore_cpp.h>
|
||||
#include <wpi/DenseMap.h>
|
||||
#include <wpi/json.h>
|
||||
#include <wpi/protobuf/ProtobufMessageDatabase.h>
|
||||
#include <wpi/struct/DynamicStruct.h>
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include <wpi/protobuf/ProtobufMessageDatabase.h>
|
||||
#endif
|
||||
|
||||
#include "glass/Model.h"
|
||||
#include "glass/View.h"
|
||||
|
||||
@@ -168,7 +171,9 @@ class NetworkTablesModel : public Model {
|
||||
Entry* AddEntry(NT_Topic topic);
|
||||
|
||||
wpi::StructDescriptorDatabase& GetStructDatabase() { return m_structDb; }
|
||||
#ifndef NO_PROTOBUF
|
||||
wpi::ProtobufMessageDatabase& GetProtobufDatabase() { return m_protoDb; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
void RebuildTree();
|
||||
@@ -191,7 +196,9 @@ class NetworkTablesModel : public Model {
|
||||
Client m_server;
|
||||
|
||||
wpi::StructDescriptorDatabase m_structDb;
|
||||
#ifndef NO_PROTOBUF
|
||||
wpi::ProtobufMessageDatabase m_protoDb;
|
||||
#endif
|
||||
};
|
||||
|
||||
using NetworkTablesFlags = int;
|
||||
|
||||
@@ -38,6 +38,7 @@ includeOtherLibs {
|
||||
^Eigen/
|
||||
^fmt/
|
||||
^gcem/
|
||||
^google/
|
||||
^gtest/
|
||||
^unsupported/
|
||||
^wpi/
|
||||
|
||||
@@ -6,9 +6,11 @@ include(AddTest)
|
||||
include(DownloadAndCheck)
|
||||
include(WpiProtobuf)
|
||||
|
||||
# workaround for makefiles - for some reason parent directories aren't created.
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/protobuf")
|
||||
file(GLOB wpimath_proto_src src/main/proto/*.proto)
|
||||
if(WITH_PROTOBUF)
|
||||
# workaround for makefiles - for some reason parent directories aren't created.
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/protobuf")
|
||||
file(GLOB wpimath_proto_src src/main/proto/*.proto)
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB wpimath_jni_src
|
||||
@@ -120,21 +122,28 @@ file(
|
||||
src/main/native/thirdparty/sleipnir/src/*.cpp
|
||||
)
|
||||
list(REMOVE_ITEM wpimath_native_src ${wpimath_jni_src})
|
||||
if(NOT WITH_PROTOBUF)
|
||||
list(FILTER wpimath_native_src EXCLUDE REGEX "/proto/")
|
||||
endif()
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
|
||||
|
||||
add_library(protobuf OBJECT)
|
||||
target_link_libraries(protobuf wpiutil)
|
||||
if(WITH_PROTOBUF)
|
||||
add_library(protobuf OBJECT)
|
||||
target_link_libraries(protobuf wpiutil)
|
||||
|
||||
add_library(wpimath ${wpimath_native_src} $<TARGET_OBJECTS:protobuf>)
|
||||
add_library(wpimath ${wpimath_native_src} $<TARGET_OBJECTS:protobuf>)
|
||||
|
||||
wpi_protobuf_generate(
|
||||
TARGET
|
||||
protobuf
|
||||
PROTOS ${wpimath_proto_src}
|
||||
PLUGIN ${PROTOC_WPILIB_PLUGIN}
|
||||
PROTOC_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
|
||||
)
|
||||
wpi_protobuf_generate(
|
||||
TARGET
|
||||
protobuf
|
||||
PROTOS ${wpimath_proto_src}
|
||||
PLUGIN ${PROTOC_WPILIB_PLUGIN}
|
||||
PROTOC_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
|
||||
)
|
||||
else()
|
||||
add_library(wpimath ${wpimath_native_src})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
@@ -164,12 +173,18 @@ set_target_properties(wpimath PROPERTIES DEBUG_POSTFIX "d")
|
||||
set_property(TARGET wpimath PROPERTY FOLDER "libraries")
|
||||
target_compile_definitions(wpimath PRIVATE WPILIB_EXPORTS SLEIPNIR_EXPORTS)
|
||||
|
||||
target_compile_features(protobuf PUBLIC cxx_std_20)
|
||||
target_compile_features(wpimath PUBLIC cxx_std_20)
|
||||
if(MSVC)
|
||||
target_compile_options(wpimath PUBLIC /utf-8 /bigobj)
|
||||
target_compile_options(protobuf PUBLIC /utf-8 /bigobj)
|
||||
endif()
|
||||
|
||||
if(WITH_PROTOBUF)
|
||||
target_compile_features(protobuf PUBLIC cxx_std_20)
|
||||
if(MSVC)
|
||||
target_compile_options(protobuf PUBLIC /utf-8 /bigobj)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
wpilib_target_warnings(wpimath)
|
||||
target_link_libraries(wpimath wpiutil)
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include <sleipnir/optimization/OptimizationProblem.hpp>
|
||||
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
units::meter_t Ellipse2d::Distance(const Translation2d& point) const {
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <Eigen/Core>
|
||||
#include <wpi/json.h>
|
||||
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/geometry/Rectangle2d.h"
|
||||
|
||||
#include "geometry2d.pb.h"
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <wpi/json.h>
|
||||
|
||||
#include "geometry2d.pb.h"
|
||||
#include "units/math.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <wpi/json.h>
|
||||
|
||||
#include "frc/fmt/Eigen.h"
|
||||
#include "geometry3d.pb.h"
|
||||
#include "units/math.h"
|
||||
#include "wpimath/MathShared.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "frc/geometry/Transform2d.h"
|
||||
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <wpi/json.h>
|
||||
|
||||
#include "geometry2d.pb.h"
|
||||
#include "units/math.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <wpi/json.h>
|
||||
|
||||
#include "geometry3d.pb.h"
|
||||
#include "units/length.h"
|
||||
#include "units/math.h"
|
||||
|
||||
|
||||
@@ -235,5 +235,7 @@ class WPILIB_DLLEXPORT ArmFeedforward {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/controller/proto/ArmFeedforwardProto.h"
|
||||
#endif
|
||||
#include "frc/controller/struct/ArmFeedforwardStruct.h"
|
||||
|
||||
@@ -87,5 +87,7 @@ class WPILIB_DLLEXPORT DifferentialDriveFeedforward {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/controller/proto/DifferentialDriveFeedforwardProto.h"
|
||||
#endif
|
||||
#include "frc/controller/struct/DifferentialDriveFeedforwardStruct.h"
|
||||
|
||||
@@ -21,5 +21,7 @@ struct DifferentialDriveWheelVoltages {
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/controller/proto/DifferentialDriveWheelVoltagesProto.h"
|
||||
#endif
|
||||
#include "frc/controller/struct/DifferentialDriveWheelVoltagesStruct.h"
|
||||
|
||||
@@ -225,5 +225,7 @@ class ElevatorFeedforward {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/controller/proto/ElevatorFeedforwardProto.h"
|
||||
#endif
|
||||
#include "frc/controller/struct/ElevatorFeedforwardStruct.h"
|
||||
|
||||
@@ -208,5 +208,7 @@ class WPILIB_DLLEXPORT Ellipse2d {
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Ellipse2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Ellipse2dStruct.h"
|
||||
|
||||
@@ -213,6 +213,8 @@ void from_json(const wpi::json& json, Pose2d& pose);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Pose2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Pose2dStruct.h"
|
||||
#include "frc/geometry/Pose2d.inc"
|
||||
|
||||
@@ -215,5 +215,7 @@ void from_json(const wpi::json& json, Pose3d& pose);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Pose3dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Pose3dStruct.h"
|
||||
|
||||
@@ -191,5 +191,7 @@ void from_json(const wpi::json& json, Quaternion& quaternion);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/QuaternionProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/QuaternionStruct.h"
|
||||
|
||||
@@ -206,5 +206,7 @@ class WPILIB_DLLEXPORT Rectangle2d {
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Rectangle2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Rectangle2dStruct.h"
|
||||
|
||||
@@ -169,6 +169,8 @@ void from_json(const wpi::json& json, Rotation2d& rotation);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Rotation2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Rotation2dStruct.h"
|
||||
#include "frc/geometry/Rotation2d.inc"
|
||||
|
||||
@@ -195,5 +195,7 @@ void from_json(const wpi::json& json, Rotation3d& rotation);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Rotation3dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Rotation3dStruct.h"
|
||||
|
||||
@@ -124,6 +124,8 @@ class WPILIB_DLLEXPORT Transform2d {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Transform2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Transform2dStruct.h"
|
||||
#include "frc/geometry/Transform2d.inc"
|
||||
|
||||
@@ -130,5 +130,7 @@ class WPILIB_DLLEXPORT Transform3d {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Transform3dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Transform3dStruct.h"
|
||||
|
||||
@@ -232,6 +232,8 @@ void from_json(const wpi::json& json, Translation2d& state);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Translation2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Translation2dStruct.h"
|
||||
#include "frc/geometry/Translation2d.inc"
|
||||
|
||||
@@ -199,6 +199,8 @@ void from_json(const wpi::json& json, Translation3d& state);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Translation3dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Translation3dStruct.h"
|
||||
#include "frc/geometry/Translation3d.inc"
|
||||
|
||||
@@ -58,5 +58,7 @@ struct WPILIB_DLLEXPORT Twist2d {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Twist2dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Twist2dStruct.h"
|
||||
|
||||
@@ -78,5 +78,7 @@ struct WPILIB_DLLEXPORT Twist3d {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/geometry/proto/Twist3dProto.h"
|
||||
#endif
|
||||
#include "frc/geometry/struct/Twist3dStruct.h"
|
||||
|
||||
@@ -279,5 +279,7 @@ struct WPILIB_DLLEXPORT ChassisSpeeds {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/ChassisSpeedsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/ChassisSpeedsStruct.h"
|
||||
|
||||
@@ -99,5 +99,7 @@ class WPILIB_DLLEXPORT DifferentialDriveKinematics
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/DifferentialDriveKinematicsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/DifferentialDriveKinematicsStruct.h"
|
||||
|
||||
@@ -50,5 +50,7 @@ struct WPILIB_DLLEXPORT DifferentialDriveWheelPositions {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/DifferentialDriveWheelPositionsStruct.h"
|
||||
|
||||
@@ -113,5 +113,7 @@ struct WPILIB_DLLEXPORT DifferentialDriveWheelSpeeds {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/DifferentialDriveWheelSpeedsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/DifferentialDriveWheelSpeedsStruct.h"
|
||||
|
||||
@@ -200,5 +200,7 @@ class WPILIB_DLLEXPORT MecanumDriveKinematics
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/MecanumDriveKinematicsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/MecanumDriveKinematicsStruct.h"
|
||||
|
||||
@@ -61,5 +61,7 @@ struct WPILIB_DLLEXPORT MecanumDriveWheelPositions {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/MecanumDriveWheelPositionsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/MecanumDriveWheelPositionsStruct.h"
|
||||
|
||||
@@ -121,5 +121,7 @@ struct WPILIB_DLLEXPORT MecanumDriveWheelSpeeds {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/MecanumDriveWheelSpeedsProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/MecanumDriveWheelSpeedsStruct.h"
|
||||
|
||||
@@ -43,5 +43,7 @@ struct WPILIB_DLLEXPORT SwerveModulePosition {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/SwerveModulePositionProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/SwerveModulePositionStruct.h"
|
||||
|
||||
@@ -48,5 +48,7 @@ struct WPILIB_DLLEXPORT SwerveModuleState {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/kinematics/proto/SwerveModuleStateProto.h"
|
||||
#endif
|
||||
#include "frc/kinematics/struct/SwerveModuleStateStruct.h"
|
||||
|
||||
@@ -115,5 +115,7 @@ class WPILIB_DLLEXPORT CubicHermiteSpline : public Spline<3> {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/spline/proto/CubicHermiteSplineProto.h"
|
||||
#endif
|
||||
#include "frc/spline/struct/CubicHermiteSplineStruct.h"
|
||||
|
||||
@@ -125,5 +125,7 @@ class WPILIB_DLLEXPORT QuinticHermiteSpline : public Spline<5> {
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/spline/proto/QuinticHermiteSplineProto.h"
|
||||
#endif
|
||||
#include "frc/spline/struct/QuinticHermiteSplineStruct.h"
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "frc/proto/MatrixProto.h"
|
||||
#include "frc/system/LinearSystem.h"
|
||||
|
||||
template <int States, int Inputs, int Outputs>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <fmt/format.h>
|
||||
#include <wpi/ProtoHelper.h>
|
||||
|
||||
#include "frc/proto/MatrixProto.h"
|
||||
#include "frc/system/proto/LinearSystemProto.h"
|
||||
#include "system.pb.h"
|
||||
|
||||
|
||||
@@ -146,5 +146,7 @@ void from_json(const wpi::json& json, Trajectory::State& state);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#ifndef NO_PROTOBUF
|
||||
#include "frc/trajectory/proto/TrajectoryProto.h"
|
||||
#include "frc/trajectory/proto/TrajectoryStateProto.h"
|
||||
#endif
|
||||
|
||||
@@ -4,15 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "controller.pb.h"
|
||||
#include "kinematics.pb.h"
|
||||
#include "spline.pb.h"
|
||||
#include "system.pb.h"
|
||||
#include "wpimath.pb.h"
|
||||
|
||||
template <typename T>
|
||||
class ProtoTest : public testing::Test {};
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "controller.pb.h"
|
||||
#include "frc/controller/ArmFeedforward.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "controller.pb.h"
|
||||
#include "frc/controller/DifferentialDriveWheelVoltages.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "controller.pb.h"
|
||||
#include "frc/controller/ElevatorFeedforward.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Ellipse2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Pose3d.h"
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Quaternion.h"
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Rectangle2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Rotation2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Rotation3d.h"
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Transform2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Transform3d.h"
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Translation2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Translation3d.h"
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Twist2d.h"
|
||||
#include "geometry2d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/geometry/Twist3d.h"
|
||||
#include "geometry3d.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/ChassisSpeeds.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveKinematics.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveWheelSpeeds.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/MecanumDriveKinematics.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/MecanumDriveWheelPositions.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/MecanumDriveWheelSpeeds.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../../ProtoTestBase.h"
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/SwerveModulePosition.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/kinematics/SwerveModuleState.h"
|
||||
#include "kinematics.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/system/plant/DCMotor.h"
|
||||
#include "plant.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/trajectory/Trajectory.h"
|
||||
#include "trajectory.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "frc/trajectory/Trajectory.h"
|
||||
#include "trajectory.pb.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -121,6 +121,9 @@ file(
|
||||
src/main/native/thirdparty/mpack/src/*.cpp
|
||||
)
|
||||
list(REMOVE_ITEM wpiutil_native_src ${wpiutil_jni_src})
|
||||
if(NOT WITH_PROTOBUF)
|
||||
list(FILTER wpiutil_native_src EXCLUDE REGEX "/protobuf/")
|
||||
endif()
|
||||
file(GLOB_RECURSE wpiutil_unix_src src/main/native/unix/*.cpp)
|
||||
file(GLOB_RECURSE wpiutil_linux_src src/main/native/linux/*.cpp)
|
||||
file(GLOB_RECURSE wpiutil_macos_src src/main/native/macOS/*.cpp)
|
||||
@@ -143,7 +146,12 @@ if(MSVC)
|
||||
target_compile_definitions(wpiutil PRIVATE -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
wpilib_target_warnings(wpiutil)
|
||||
target_link_libraries(wpiutil protobuf::libprotobuf Threads::Threads ${CMAKE_DL_LIBS})
|
||||
if(WITH_PROTOBUF)
|
||||
target_link_libraries(wpiutil protobuf::libprotobuf Threads::Threads ${CMAKE_DL_LIBS})
|
||||
else()
|
||||
target_link_libraries(wpiutil Threads::Threads ${CMAKE_DL_LIBS})
|
||||
target_compile_definitions(wpiutil PUBLIC NO_PROTOBUF)
|
||||
endif()
|
||||
|
||||
if(ATOMIC)
|
||||
target_link_libraries(wpiutil ${ATOMIC})
|
||||
|
||||
Reference in New Issue
Block a user