This is extremely easily done with the orocreate-pkg script, see Getting started.
You can use packages in two ways:
# User provided files: # Package directory: .../packagename/manifest.xml, Makefile, CMakeLists.txt,... # Sources: .../packagename/src/*.cpp # Headers: .../packagename/include/packagename/*.hpp # Build results: # Built Component libraries for 'packagename': .../packagename/lib/orocos/gnulinux/*.so|dll|... # Built Plugin libraries for 'packagename': .../packagename/lib/orocos/gnulinux/plugins/*.so|dll|... # Type libraries for 'packagename': .../packagename/lib/orocos/gnulinux/types/*.so|dll|... # Build information for 'packagename': .../packagename/packagename-gnulinux.pc
For allowing multi-target builds, the libraries are put in thelib/orocos/targetname/ directory in order to avoid loading a library for a different target. In the example above, the targetname is gnulinux.
When you use the UseOrocos.cmake macros (Orocos Toolchain 2.3.0 or later), linking with dependees will be done automatically for you.
You may add a link instruction using the classical CMake syntax:
orocos_component( mycomponent ComponentSource.cpp ) target_link_libraries( mycomponent ${YOUR_LIBRARY} )
The component and plugin loaders of RTT will search your ROS_PACKAGE_PATH, and its target subdirectory for components and plugins.
You can then import the package in the deployer application by using:
import("packagename")
# Install dir (the prefix): /opt/orocos # Headers: /opt/orocos/include/orocos/gnulinux/packagename/*.hpp # Component libraries for 'packagename': /opt/orocos/lib/orocos/gnulinux/packagename/*.so|dll|... # Plugin libraries for 'packagename': /opt/orocos/lib/orocos/gnulinux/packagename/plugins/*.so|dll|... # Type libraries for 'packagename': /opt/orocos/lib/orocos/gnulinux/packagename/types/*.so|dll|... # Build information for 'packagename': /opt/orocos/lib/pkgconfig/packagename-gnulinux.pc
For allowing multi-target installs, the packages will be installed in orocos/targetname/packagename (for example: orocos/xenomai/ocl) in order to avoid loading a library for a different target. In the example above, the targetname is gnulinux.
You may add a link instruction using the classical CMake syntax:
orocos_component( mycomponent ComponentSource.cpp ) target_link_libraries( mycomponent -lfoobar )
RTT_COMPONENT_PATH=/opt/orocos/lib/orocos export RTT_COMPONENT_PATH
The component and plugin loaders of RTT will search this directory, and its target subdirectory for components and plugins. So there is no need to encode the target name in the RTT_COMPONENT_PATH (but you may do so if it is required for some case).
You can then import the package in the deployer application by using:
import("packagename")