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 -0500

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

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 imagetfoote ( 2019-06-12 03:13:43 -0500 )edit

Appreciate that. Thanks

Left4taco gravatar imageLeft4taco ( 2019-06-12 08:56:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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 imageLeft4taco ( 2019-06-12 11:10:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 14 times

Last updated: Jun 12