From 32447aff61b7fb47bd2600fa872753eec5290df4 Mon Sep 17 00:00:00 2001 From: "Isaac I.Y. Saito" <130s@2000.jukuin.keio.ac.jp> Date: Thu, 29 Jun 2023 12:33:46 -0400 Subject: [PATCH] Dependency: Add detail about defining deps in package.xml, CMakeLists.txt --- .../Intermediate/Dependency/Rosdep.rst | 2 + .../Dependency/define_dependencies.rst | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 source/Tutorials/Intermediate/Dependency/define_dependencies.rst diff --git a/source/Tutorials/Intermediate/Dependency/Rosdep.rst b/source/Tutorials/Intermediate/Dependency/Rosdep.rst index 45f7df64244..500c38b13f3 100644 --- a/source/Tutorials/Intermediate/Dependency/Rosdep.rst +++ b/source/Tutorials/Intermediate/Dependency/Rosdep.rst @@ -97,6 +97,8 @@ They specify in what situation each of the dependencies are required in. These dependencies are manually populated in the ``package.xml`` file by the package's creators and should be an exhaustive list of any non-builtin libraries and packages it requires. +You can find more in detail about the `types of dependencies and how to define them in package.xml and CMakeLists.txt Catkin's document <./define_dependencies.rst>`_. + How does rosdep work? --------------------- diff --git a/source/Tutorials/Intermediate/Dependency/define_dependencies.rst b/source/Tutorials/Intermediate/Dependency/define_dependencies.rst new file mode 100644 index 00000000000..7b15d9e3c8f --- /dev/null +++ b/source/Tutorials/Intermediate/Dependency/define_dependencies.rst @@ -0,0 +1,61 @@ +Defining dependencies in your ament package +=========================================== + +**Goal:** Understand the types of dependencies supported by ``ament`` package. + +**Tutorial level:** Intermediate + +**Time:** 5 minutes + +.. contents:: Contents + :depth: 2 + :local: + +ament package dependencies +-------------------------- + +When your package depends on C++ packages, source or binary, there are usually several kinds of dependencies which must be declared in your ``package.xml`` and ``CMakeLists.txt`` files. This document describes about package.xml. For CMakeLists.txt, see `ament_cmake documentation <../../../How-To-Guides/Ament-CMake-Documentation.rst>`_. + +package.xml +----------- + +Your package dependencies must be declared in ``package.xml``. If they are missing or incorrect, you may still be able to build from source and run tests in your own workspace, but ``ament/ROS`` toolsuite, e.g. ``colcon``, `rosdep `_, may not function. Also `release into public registry <../../../How-To-Guides/Releasing/>`_ would not be an option. Others rely on this information to install the software they need for using your package. + +```` +'''''''''''' + +It is generally sufficient to mention each ROS package dependency once, like this:: + + rclcpp + +Sometimes, you may need or want more granularity for certain dependencies. The following sections explain how to do that. If in doubt, use the ```` tag, it's simpler. + +```` +'''''''''''''''''' + +If you only use some particular dependency for building your package, and not at execution time, you can use the ```` tag. +For example, the ROS ``angles`` package only provides C++ headers and CMake configuration files:: + + angles + +With this type of dependency, an installed binary of your package does not require the angles package to be installed. + +**But**, that could create a problem if your package exports a header that includes the ```` header. In that case you also need a ````. + +```` +''''''''''''''''''''''''' + +If you export a header that includes ````, it will be needed by other packages that ```` on yours:: + + angles + +This mainly applies to headers and CMake configuration files. Library packages referenced by libraries you export should normally specify ````, because they are also needed at execution time. + +```` +''''''''''''''''' + +This tag declares dependencies for shared libraries, executables, Python modules, launch scripts and other files required when running your package. For example, the ROS ``launch_xml`` package provides +launch scripts, which are only needed at execution time:: + + launch_xml +