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

Why need to parse package.xml to build/<pkg>/ament_cmake_code/package.cmake?

asked 2019-06-12 02:00:36 -0600

Left4taco gravatar image

updated 2019-06-12 08:57:45 -0600

I'm reading the source code of ament_cmake now. The omnipresent ament_package() CMake function calls ament_package_xml, which parses the package.xml into build/<pkg>/ament_cmake_code/package.cmake, and then include this file. The content of which is like:

set(_AMENT_PACKAGE_NAME "rcl")
set(rcl_VERSION "0.6.4")
set(rcl_MAINTAINER "William Woodall <william@osrfoundation.org>")
set(rcl_BUILD_DEPENDS "rcl_interfaces" "rcutils" "rosidl_generator_c" "rmw_implementation")
set(rcl_BUILDTOOL_DEPENDS "ament_cmake_ros")
set(rcl_BUILD_EXPORT_DEPENDS "rmw" "rcl_interfaces" "rcutils" "rosidl_generator_c" "rmw_implementation")
set(rcl_BUILDTOOL_EXPORT_DEPENDS )
set(rcl_EXEC_DEPENDS "ament_cmake" "rcutils" "rosidl_default_runtime" "rmw_implementation")
set(rcl_TEST_DEPENDS "ament_cmake_gtest" "ament_cmake_ros_isolated_gtest" "ament_cmake_pytest" "ament_lint_auto" "ament_lint_common" "rmw" "rmw_implementation_cmake" "launch" "osrf_testing_tools_cpp" "std_msgs" "test_msgs")
set(rcl_GROUP_DEPENDS "rcl_logging_packages")
set(rcl_MEMBER_OF_GROUPS )
set(rcl_DEPRECATED "")
set(rcl_EXPORT_TAGS)
list(APPEND rcl_EXPORT_TAGS "<build_type>ament_cmake</build_type>")

But I didn't see any variable in this file being used later. And also, shouldn't it be colcon's responsibility to parse the xml and calculate the dependency graph?

Could you guys please show me the purpose of this file? Thanks.


One late finding is that, these <pkg>_EXEC_DEPENDS. <pkg>_BUILDTOOL_EXPORT_DEPENDS, etc., are only used in ament_auto_packages. Is that the reason why this package.cmake exists?

edit retag flag offensive close merge delete

Comments

It is not necessary to use colcon to build ament packages. You can use the standard cmake .. && make && make install paradigm without colcon installed and all of the system will work.

As you're just learning about the system I suggest that you reword your question to be a little less confrontational and you might find people more willing to take the time to help you understand the intricacies of how things work that you might not see in the first read through.

tfoote gravatar image tfoote  ( 2019-06-12 03:13:43 -0600 )edit

Appreciate that. Thanks

Left4taco gravatar image Left4taco  ( 2019-06-12 08:56:23 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-12 10:29:15 -0600

Dirk Thomas gravatar image

These variables are used in many places - just a few examples:

edit flag offensive delete link more

Comments

Thanks Dirk. That's very helpful.

Left4taco gravatar image Left4taco  ( 2019-06-12 11:10:14 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-06-12 02:00:36 -0600

Seen: 293 times

Last updated: Jun 12 '19