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.<div>

<br></div><div>--<br><br><div class="gmail_quote">On Thu, Jan 17, 2013 at 12:59 PM, Brian Wightman <span dir="ltr"><<a href="mailto:brian.j.wightman@nasa.gov" target="_blank">brian.j.wightman@nasa.gov</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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?<br>


<br>
My use-case may sound a bit odd:<br>
<br>
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.<br>


<br>
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.<br>


<br>
If anyone's curious, here's the scons build code I've been using:<br>
<br>
import os, rospkg<br>
def load_ros_deps(env):<br>
    pkg_name = os.path.basename(Dir('.').<u></u>srcnode().abspath)<br>
    depends = []<br>
    for d in map(repr, rospkg.RosPack().get_manifest(<u></u>pkg_name).depends):<br>
        depends.append(d)<br>
        # load exports<br>
        manifest = rospkg.RosPack().get_manifest(<u></u>d)<br>
        for f in [j for j in [manifest.get_export('cpp', i) for i in ['cflags', 'lflags']] if j]:<br>
            allf = f[0].split('`')<br>
            for conf in allf[1::2]:<br>
                env.ParseConfig(conf)<br>
            env.MergeFlags(env.ParseFlags(<u></u>' '.join(allf[0::2])))<br>
        pkg_path = os.path.dirname(manifest.<u></u>filename)<br>
        msg_path = os.path.join(pkg_path, 'msg_gen', 'cpp', 'include')<br>
        if os.path.exists(msg_path):<br>
            env.MergeFlags(env.ParseFlags(<u></u>'-I{}'.format(msg_path)))<br>
<br>
env = Environment(<br>
    ENV = {'PYTHONPATH': os.environ['PYTHONPATH'], # allow us to call rosboost-cfg<br>
           'PKG_CONFIG_PATH': os.environ['PKG_CONFIG_PATH']}<u></u>,<br>
    ...<br>
)<br>
<br>
Certainly I can achieve the same thing with CMake, but I find scons to be much nicer to work with.<br>
<br>
Thanks,<br>
Brian Wightman<br>
______________________________<u></u>_________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org" target="_blank">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/<u></u>listinfo/ros-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>William Woodall<div>Willow Garage - Software Engineer</div><div><a href="mailto:wwoodall@willowgarage.com" target="_blank">wwoodall@willowgarage.com</a></div>
</div>