[ros-users] catkin support in python rospkg

William Woodall wwoodall at willowgarage.com
Thu Jan 17 21:16:14 UTC 2013


Catkin also provides CMake find_package infrastructure and pkg-config
infrastructure for each package.  I would think scons would support getting
build flags from pkg-config given its popularity in many dev libraries.
 That is likely easier than extracting them from CMake and probably the
easiest method in general.

--

On Thu, Jan 17, 2013 at 12:59 PM, Brian Wightman
<brian.j.wightman at nasa.gov>wrote:

> In rosbuild I was able to use rospkg to grab all of the [cflags, lflags]
> exports out of a given package's manifest. Is there a plan to add this
> functionality for catkin packages?
>
> My use-case may sound a bit odd:
>
> I have been using scons rather than cmake to build packages. The rospkg
> manifest.xml parsing makes this rather painless (20 lines of python to
> collect all the build flags). Now with the "exports" buried in cmake files,
> I don't have a convenient way to access them.
>
> In particular, I have code that forwards ROS messages between systems with
> separate roscore instances. I have to compile in a publisher/subscriber
> call for each message type so I've found it convenient to auto-generate the
> HPP/CPP files from a list of message-containing packages (std_msgs,
> sensor_msgs, etc.) using Python and rospkg.
>
> If anyone's curious, here's the scons build code I've been using:
>
> import os, rospkg
> def load_ros_deps(env):
>     pkg_name = os.path.basename(Dir('.').**srcnode().abspath)
>     depends = []
>     for d in map(repr, rospkg.RosPack().get_manifest(**pkg_name).depends):
>         depends.append(d)
>         # load exports
>         manifest = rospkg.RosPack().get_manifest(**d)
>         for f in [j for j in [manifest.get_export('cpp', i) for i in
> ['cflags', 'lflags']] if j]:
>             allf = f[0].split('`')
>             for conf in allf[1::2]:
>                 env.ParseConfig(conf)
>             env.MergeFlags(env.ParseFlags(**' '.join(allf[0::2])))
>         pkg_path = os.path.dirname(manifest.**filename)
>         msg_path = os.path.join(pkg_path, 'msg_gen', 'cpp', 'include')
>         if os.path.exists(msg_path):
>             env.MergeFlags(env.ParseFlags(**'-I{}'.format(msg_path)))
>
> env = Environment(
>     ENV = {'PYTHONPATH': os.environ['PYTHONPATH'], # allow us to call
> rosboost-cfg
>            'PKG_CONFIG_PATH': os.environ['PKG_CONFIG_PATH']}**,
>     ...
> )
>
> Certainly I can achieve the same thing with CMake, but I find scons to be
> much nicer to work with.
>
> Thanks,
> Brian Wightman
> ______________________________**_________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/**listinfo/ros-users<https://code.ros.org/mailman/listinfo/ros-users>
>



-- 
William Woodall
Willow Garage - Software Engineer
wwoodall at willowgarage.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20130117/074c3844/attachment-0004.html>


More information about the ros-users mailing list