GithubHelp home page GithubHelp logo

protobuf3_catkin's Introduction

protobuf3_catkin

A catkin wrapper for Google protocol buffers

Usage

In your CMakeLists.txt, call the protobuf compiler:

set(PROTO_DEFNS proto/path-to-my-protos/my-proto.proto)
set(BASE_PATH "proto")
PROTOBUF_CATKIN_GENERATE_CPP2(${BASE_PATH} PROTO_SRCS PROTO_HDRS ${PROTO_DEFNS}) 

...

cs_add_library(${PROJECT_NAME} src/my-source-files.cc
                               ${PROTO_SRCS}
                               ${PROTO_HDRS})

where BASE_PATH is the base path to the folder containing all protobuf definitions (in this example, the base path is proto).

This will generate C++ codes for the protos given by PROTO_DEFNS. The C++ files will be generated under catkin_wsbuild/${PROJECT_NAME}/compiled_proto. The structure within this folder mirrors the structure of the source definitions (within BASE_PATH).

From the compiled C++ files, the generated headers (*.pb.h) are installed into catkin_ws/devel/include, again keeping the folder structure from within BASE_PATH. The *.proto definition files are installed into catkin_ws/devel/share/proto so that they can be used by other packages.

The example code above would generate the following files:

  • catkin_ws/build/${PROJECT_NAME}/compiled_proto/path-to-my-protos/my-proto.pb.cc
  • catkin_ws/build/${PROJECT_NAME}/compiled_proto/path-to-my-protos/my-proto.pb.h
  • catkin_ws/devel/include/path-to-my-protos/my-proto.pb.h
  • catkin_ws/devel/share/proto/path-to-my-protos/my-proto.pb.h

The protobuf definitions can then be used with #include <path-to-my-protos/my-proto.pb.h in C++ or with import "path-to-my-protos/my-proto.proto"; in other protobuf definition files.

protobuf3_catkin's People

Contributors

dymczykm avatar eggerk avatar esteve avatar ffurrer avatar furgalep avatar kappeler avatar mbuerki avatar mikebosse avatar simonlynen avatar tcies avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.