catkin build protobuf?
Hi folks,
how can I get catkin
to build and deploy the results of protobuf's .proto
files? What's the SOTA in this regard? I've tried
find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS protobuf/imu_data.proto)
protobuf_generate_python(PROTO_PY protobuf/imu_data.proto)
But that does nothing. It finds Protobuf but the bottom two commands basically do nothing. Not even throw an error.
Is this the recommended way?
Thank you!
Cheers, Hendrik
PS: I'm using python-catkin-tools
, say, catkin build
instead of catkin_make
. In case that's some vital information...
Update 1:
I managed to make it build by adding the line
add_custom_target(imu_sys_proto ALL DEPENDS ${PROTO_PY})
to the CMakeLists.txt
. This makes catkin
(or rather cmake
) build the Python bindings for my .proto
file. But it does not install it.
Question extension 1
So I'll extend my question to: what do I need to add to the CMakeLists.txt
in order for catkin
to copy the resulting ...pb2.py
file(s) to the correct folder (whichever that might be)?
This is not a Catkin question, but a CMake one.
How would you do this with pure CMake?
Probably exactly like in the example. But it still does not seem to work... maybe it's CMake related. I thought there might be some catkin specific CMake commands for that.
I'm not aware of any protobuf specific infrastructure in Catkin.
I'd first get things working in a regular CMake context.
Then integrate that into a Catkin based
CMakeList.txt
.In my experience it should just work and there is nothing different between the two contexts (wrt protobuf at least).
I've extended the question to be a little more
catkin
specific.