Ask Your Question
0

How do package.xml and CMakeLists.txt work

asked 2018-05-26 04:02:20 -0600

bear234 gravatar image

As we know, each ROS package contains these two files: package.xml and CMakeLists.txt.

I don't understand exactly how they works together.

For example, the package.xml of the package actionlib shows us that it depends on python-wxtools because it conains such a line:

<exec_depend>python-wxtools</exec_depend>

However, after reading the file CMakeLists.txt of the package actionlib, I don't see that it depends on python-wxtools. Here is the CMakeLists.txt of actionlib:

find_package(catkin REQUIRED COMPONENTS actionlib_msgs message_generation roscpp rosunit std_msgs)
find_package(Boost REQUIRED COMPONENTS thread)

include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
link_directories(${catkin_LIBRARY_DIRS})

catkin_python_setup()

add_action_files(DIRECTORY action FILES Test.action TestRequest.action TwoInts.action)
generate_messages(DEPENDENCIES actionlib_msgs std_msgs)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES actionlib
  CATKIN_DEPENDS actionlib_msgs message_runtime roscpp std_msgs
  DEPENDS Boost
)

add_library(actionlib src/connection_monitor.cpp src/goal_id_generator.cpp)
target_link_libraries(actionlib ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies(actionlib actionlib_gencpp)

catkin_install_python(PROGRAMS tools/axclient.py tools/axserver.py tools/dynamic_action.py tools/library.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(TARGETS ${PROJECT_NAME}
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  FILES_MATCHING PATTERN "*.h")

if(CATKIN_ENABLE_TESTING)
  find_package(rostest)
  add_subdirectory(test)
endif()
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-26 04:32:10 -0600

cagatay gravatar image

updated 2018-05-26 04:33:26 -0600

Taken from package.xml

This file defines properties about the package such as the package name, version numbers, authors, maintainers, and dependencies on other catkin packages.

but the critical part is about package.xml

Your system package dependencies are declared in package.xml. If they are missing or incorrect, you may be able to build from source and run tests on your own machine, but your package will not work correctly when released to the ROS community. Others depend on this information to install the software they need for using your package.

Execution Dependencies specify which packages are needed to run code in this package. This is the case when you depend on shared libraries in this package (especially when these packages are declared as (CATKIN_)DEPENDS in catkin_package() in CMake).

There is a problem with Cmakefile I guess, they should have added python-wxtools in CATKIN_DEPENDS in catkin_package

edit flag offensive delete link more

Comments

1

Additional info: #q217475 (and #q215059).

gvdhoorn gravatar imagegvdhoorn ( 2018-05-26 05:02:15 -0600 )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

1 follower

Stats

Asked: 2018-05-26 04:02:20 -0600

Seen: 358 times

Last updated: May 26 '18