-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Dependencies
Adding a dependency is super trivial task using DDS. (If you already have package you want to add as a dependency, you can skip this step).
You can view packages available to your DDS tool by using the command:
dds pkg search
This will list the name of the package, the available versions and the remote repository it is available on.
You can also confine your search using a glob/fnmatch-style pattern like so:
dds pkg search 'neo-*'
This will find packages with the name following the pattern of starting with 'neo-'.
In the packahe.json5 file:
- Add a comma to the end of the last line of the file (that is within the outermost
{}
pair) and add a newline. - You'll then need to add the keyword
depends:
followed by square braces and hit enter. - Within the array (square braces), create a empty string using single quotes.
- Within the single quotes, add the name of the package you want followed by the version range.
- Optional: If you want to add more packages, just add to the array of dependencies by added a comma to the last line (in the array) and hit newline and create a new string in single quotes following the same pattern as before.
It should look something like below:
{
name: 'Your-packages-name',
version: 'x.x.x',
namespace: 'namespace-name',
test_driver: 'Catch-Main',
depends: [
'package-in-use',
'anotherpackage-in-use'
]
}
Note: For information on how package versioning works for DDS, see: Dependency Versioning Range
In the library.json5 file (of the library root using your package)
- After the name variable, add the
use:
keyword followed by and array of strings in single quotes. - Added the packages namespace followed by a forward slash
/
and then the library you want to you use:
{
name: 'library-name',
uses: [
'external-package-namespace/consumed-library,
'another-package-namespace/another-package
]
}
It should look something like the above.
Finally #include
the headers that you want to use in the relevant files of your project. This will follow the library/header pattern
eg.
#include <library-name/header.hpp>
Note: The library name is note necessarily the name of the package. See the package authors documentation for what libraires their package contains.