-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependency: Add detail about defining deps in package.xml, CMakeLists…
….txt
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
source/Tutorials/Intermediate/Dependency/define_dependencies.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <Rosdep.rst>`_, 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. | ||
|
||
``<depend>`` | ||
'''''''''''' | ||
|
||
It is generally sufficient to mention each ROS package dependency once, like this:: | ||
|
||
<depend>rclcpp</depend> | ||
|
||
Sometimes, you may need or want more granularity for certain dependencies. The following sections explain how to do that. If in doubt, use the ``<depend>`` tag, it's simpler. | ||
|
||
``<build_depend>`` | ||
'''''''''''''''''' | ||
|
||
If you only use some particular dependency for building your package, and not at execution time, you can use the ``<build_depend>`` tag. | ||
For example, the ROS ``angles`` package only provides C++ headers and CMake configuration files:: | ||
|
||
<build_depend>angles</build_depend> | ||
|
||
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 ``<angles/angles.h>`` header. In that case you also need a ``<build_export_depend>``. | ||
|
||
``<build_export_depend>`` | ||
''''''''''''''''''''''''' | ||
|
||
If you export a header that includes ``<angles/angles.h>``, it will be needed by other packages that ``<build_depend>`` on yours:: | ||
|
||
<build_export_depend>angles</build_export_depend> | ||
|
||
This mainly applies to headers and CMake configuration files. Library packages referenced by libraries you export should normally specify ``<depend>``, because they are also needed at execution time. | ||
|
||
``<exec_depend>`` | ||
''''''''''''''''' | ||
|
||
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:: | ||
|
||
<exec_depend>launch_xml</exec_depend> | ||
|