Skip to content

Conversation

jp-pino
Copy link
Contributor

@jp-pino jp-pino commented Jul 23, 2025

The new ZMQSubscriber and ZMQRepliers in libblunux require a typevals{} list to generate some code at compile time (https://github.com/BluEye-Robotics/libblunux/pull/255). It looks something like:

namespace blunux::zmq {
constexpr inline auto rep_messages =
    utils::typevals{} +
    utils::type_wrapper_2<blueye::protocol::SetOverlayParametersReq,
                          blueye::protocol::SetOverlayParametersRep>{} +
    utils::type_wrapper_2<blueye::protocol::GetOverlayParametersReq,
                          blueye::protocol::GetOverlayParametersRep>{} +
    utils::type_wrapper_2<blueye::protocol::SetCameraParametersReq,
                          blueye::protocol::SetCameraParametersRep>{} +
    utils::type_wrapper_2<blueye::protocol::GetCameraParametersReq,
                          blueye::protocol::GetCameraParametersRep>{} +
    utils::type_wrapper_2<blueye::protocol::SyncTimeReq,
                          blueye::protocol::SyncTimeRep>{} + ...

Managing these lists manually will be a little cumbersome, so I've written a script in libblunux that auto-generates that code based on the .proto files. To make sure we always have them in a consistent location I thought it best to include them in the headers.

The protobuf library itself also does this, installing files like:

  • /usr/include/google/protobuf/any.proto
  • /usr/include/google/protobuf/field_mask.proto
  • /usr/include/google/protobuf/wrappers.proto
  • /usr/include/google/protobuf/api.proto
  • /usr/include/google/protobuf/descriptor.proto
  • /usr/include/google/protobuf/duration.proto
  • /usr/include/google/protobuf/source_context.proto
  • /usr/include/google/protobuf/struct.proto
  • /usr/include/google/protobuf/timestamp.proto
  • /usr/include/google/protobuf/empty.proto
  • /usr/include/google/protobuf/type.proto

Same with other libraries using protobuf.

They install to the the path .../include/blueyeprotocol/protobuf/*.proto

@jp-pino jp-pino merged commit 71478e9 into master Jul 29, 2025
4 of 6 checks passed
@jp-pino jp-pino deleted the jp-pino/install-proto-files branch July 29, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants