[ros-users] best practice for own but ROS-independant libraries

Ruben Smits ruben.smits at mech.kuleuven.be
Wed Jan 12 15:14:18 UTC 2011


On Wednesday 12 January 2011 15:07:35 Stéphane Magnenat wrote:
> Hi Troy,
> 
> Thank you very much for this nice list of suggestions. I will sleep over
> the question and see to which direction my feelings bring me, as there
> is no optimal solution ;-)

For the orocos_toolchain_ros stack we have been playing around a bit. We 
converted both rtt and ocl into "native" ros packages which means we provide a 
manifest.xml and a Makefile. 

The manifest should not hurt any other build system, actually we also support 
autoproj, which also takes advantage of the manifest to track dependencies. 

The Makefile checks whether ROS_ROOT is defined, if so it includes the 
mk/cmake.mk file and goes on, since rtt/ocl's build system is cmake this is 
enough for most cases (we need to include an install step to make sure that 
all headers are put in the right place)

You can check how its done on:

http://www.gitorious.org/orocos-toolchain/rtt/blobs/master/Makefile :

ifdef ROS_ROOT
default: install
include $(shell rospack find mk)/cmake.mk
install: all
	cd build; make install
else
$(warning This Makefile only works with ROS rosmake. Without rosmake, create a 
build directory and run cmake ..)
endif


we also created some cmake macros that will use rosbuild_add_library instead 
of add_library if ROS_ROOT is detected:

http://www.gitorious.org/orocos-toolchain/rtt/blobs/master/UseOROCOS-RTT.cmake


This set-up has proven to be very usefull for us and make all our orocos 
component packages ros independent but uses rosbuild if available to make our 
life easier.

> All the best,
> 
> Stéphane

--Ruben



More information about the ros-users mailing list