After including msg_boost_python
in find_package
as a catkin component, you
have access to two macros:
- the main macro
generate_msg_boost_python_converters
- a convenience macro
set_boost_python_module
The main macro generate_msg_boost_python_converters
has two arguments:
FROM_PACKAGE
the "source" package containing the messages you want wrappers for (default is the currentPROJECT_NAME
)PYTHON_NAME
the name of the generated python module (default ismsg_boost_python
)
There are two possible use cases:
- Generate converters for messages from your own package
- Generate converters for messages from some other package
In any case make sure you do the catkin_python_setup()
to at least generate an
empty Python package for your Catkin package. Minimal setups can be found in
the common_msgs packages (geometry_msgs_boost_python etc.).
Simply put generate_msg_boost_python_converters()
in your CMakeLists.txt.
Then, in your python scripts use import my_package.msg_boost_python
(or for "local" scripts import msg_boost_python
).
Look at the common_msgs packages (geometry_msgs_boost_python etc.) for examples.
The macro set_boost_python_module
does some routine steps to set up a
Boost.Python module within the Catkin build system.
- Correct the filename depending on the OS (currently Ubuntu or OS X)
- By default build and install into the package's Python destination
Arguments:
TARGET
the name of the CMake target you defined previously withadd_library
BOOST_PYTHON_MODULE_NAME
the name you gave the Boost.Python module with theBOOST_PYTHON_MODULE
declaration in your C++ code (by default takes the value fromTARGET
)DEVEL_DESTINATION
set this if you want to specify a custom build destinationINSTALL_DESTINATION
set this if you want to specify a custom install destination
Note: the macro does not do any linking.
More information and examples can be found on my GitHub page.