ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

CATKIN_DEVEL_PREFIX in catkin_make vs catkin tools

asked 2016-11-23 14:13:06 -0500

mallanmba gravatar image

updated 2016-12-07 15:12:23 -0500

gvdhoorn gravatar image

I'm trying to make our build compatible with catkin_make and catkin tools, but how CATKIN_DEVEL_PREFIX is handled in the two tools is causing me some trouble.

We have some (non-ROS) tools that generate headers that need to be included by the current package being built, and by downstream packages. Our pure-cmake build system would create these headers in the out-of-source build directory and install them into the install directory. Downstream packages would include the $INSTALL/include directory and all would be well. We adapted our build to be catkin_make compatible by copying the files into ${CATKIN_DEVEL_PREFIX}/include at configure time, and downstream packages could find them by adding ${CATKIN_DEVEL_PREFIX}/include to their include path.

This doesn't work with catkin tools, because CATKIN_DEVEL_PREFIX points to a devel/.private directory and then symlinks content into devel space. Is there a variable available at configure time in CMake that points to workspace/devel that is available in both catkin_make and catkin tools?

I know this problem can be solved by making foo-extras.cmake.develspace.in and foo-extras.cmake.installspace.in for each project, but that'll be a huge pain. A variable that is consistent between the two tools that points to the workspace/devel directory would be a lot more straightforward.

Thanks, -Mark


Edit: Creating a minimal example would take a fair amount of work, I'll point to some of the relevant files and hopefully that will be sufficient.

Here's our cmake macro for generating source from RTI DDS IDL: https://github.com/mallanmba/irg_cmak...

Here's a CMakeLists.txt that uses the macro: https://github.com/mallanmba/soraCore...

There's a block at the end that checks for catkin_FOUND and copies the generated headers into devel space. If that block is not there, none of the headers show up in devel space. I've never observed catkin_make or catkin_tools putting headers into devel space unless I explicitly copy them there. How is the "automatic" placement of includes in devel supposed to work?

The issue that I'm having with CATKIN_DEVEL_PREFIX between catkin_make and catkin tools is that catkin_make sets that variable to foo_ws/devel and catkin tools sets it to foo_ws/devel/.private/bar_project and then symlinks into foo_ws/devel. If I have project_B that depends on generated headers from project_A, and I add ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_INCLUDE_DESTINATION} to the include path of a project_B, it works fine for catkin_make. But it fails for catkin tools because ${CATKIN_DEVEL_PREFIX} is pointing to foo_ws/devel/.private/project_B, and project_B can't see project_A's generated headers.

edit retag flag offensive close merge delete

Comments

In response to the "automatic" placement of headers into the devel space, if the package is a cmake package, then the catkin tools will make install with the install prefix set to the devel space. If it is a catkin package then it does need to be copied.

William gravatar image William  ( 2016-12-07 15:53:22 -0500 )edit

I think the issue is that you assume that two different packages will share the same devel space. I think your packages would also fail to work if you split them between two catkin workspaces (even if you build them both with catkin_make).

William gravatar image William  ( 2016-12-07 15:54:07 -0500 )edit

Instead you should find_package project_A from project_B and add the include directories exported by project_A in the CMakeLists.txt for project_B.

William gravatar image William  ( 2016-12-07 15:56:26 -0500 )edit

Put another way, Project A generates files and puts them in a folder, then exports that folder in the project_A_INCLUDE_DIRS variable and then project B does find_package(... project_A) and adds the folder it exported as an include directory with the CMake macro include_directories(...).

William gravatar image William  ( 2016-12-07 15:57:32 -0500 )edit

Is there an easier way to export foo_INCLUDE_DIRS than having to create foo-extras.cmake.installspace.in and foo-extras.cmake.develspace.in for each project? The catkin_package() INCLUDE_DIRS is relative to CMAKE_CURRENT_SOURCE_DIR which doesn't help

mallanmba gravatar image mallanmba  ( 2016-12-07 17:26:12 -0500 )edit

This line from gencpp (which also generates header files like this and makes them available in the devel space), adds the include directory to be exported automatically by the catkin_package call: https://github.com/ros/gencpp/blob/in...

William gravatar image William  ( 2016-12-07 17:47:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-28 15:54:24 -0500

William gravatar image

If your packages are plain cmake, then catkin tools will "install" all the files to the devel space, so you need not copy the files. If you packages are catkin packages, then the CATKIN_DEVEL_PREFIX cmake variable should be set. I don't see any reason this shouldn't work in catkin tools as it does in catkin_make. Please provide a minimal example of the problem or instructions on how to reproduce the issue with your packages if you want someone to look into it in more detail.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-11-23 14:13:06 -0500

Seen: 2,227 times

Last updated: Dec 07 '16