| 1 |
===================================== |
| 2 |
Tribits Dependencies |
| 3 |
===================================== |
| 4 |
|
| 5 |
:Author: Joe Frye ([email protected]) |
| 6 |
:Date: |date| |
| 7 |
|
| 8 |
.. |date| date:: |
| 9 |
|
| 10 |
.. sectnum:: |
| 11 |
:depth: 2 |
| 12 |
|
| 13 |
.. Sections in this document use the underlines: |
| 14 |
.. |
| 15 |
.. Level-1 ================== |
| 16 |
.. Level-2 ------------------ |
| 17 |
.. Level-3 ++++++++++++++++++ |
| 18 |
.. Level-4 .................. |
| 19 |
|
| 20 |
.. contents:: |
| 21 |
|
| 22 |
|
| 23 |
TriBITS Example Project |
| 24 |
======================== |
| 25 |
|
| 26 |
The previous tutorial had you create all the files nesseasary for a |
| 27 |
very simple tribits project. This time we will look at an example of |
| 28 |
a more complicated example project that is included when you clone the |
| 29 |
tribits repository. If you go to:: |
| 30 |
|
| 31 |
TriBITS/tribits/examples/ |
| 32 |
|
| 33 |
you will see several examples including one very similar to what we |
| 34 |
constructed in the last tutorial. In this tutorial we will be using |
| 35 |
the TribitsExampleProject. This project has multiple packages as well |
| 36 |
as TPL dependencies so we will be able to see how tribits deals with |
| 37 |
both types of dependencies. In TribitsExampleProject, look at:: |
| 38 |
|
| 39 |
PackagesList.cmake |
| 40 |
TPLsList.cmake |
| 41 |
|
| 42 |
and you will see that we have a several packages defined for the |
| 43 |
project in PackageList.cmake and a couple TPLs defined in |
| 44 |
TPLsList.cmake. Recall that the package definitions looks like the |
| 45 |
following:: |
| 46 |
|
| 47 |
tribits_repository_define_packages( |
| 48 |
NameOfPackageA location/of/packageA <options> |
| 49 |
NameOfPackageB path/to/packageB <options> |
| 50 |
) |
| 51 |
|
| 52 |
you must specify the name of the package and where it is located. |
| 53 |
Each package must contain a CmakeLists.cmake file and a |
| 54 |
Dependencies.cmake file. The CmakeLists file defines targets for this |
| 55 |
package and must begin with a call to tribits_package() and end with |
| 56 |
a call to tribits_package_postprocess(). |
| 57 |
|
| 58 |
Tribits TPLs are defined similarly in TPLsList.cmake:: |
| 59 |
|
| 60 |
tribits_repository_define_tpls( |
| 61 |
NameOfTPL-1 location/of/TPL-1 <options> |
| 62 |
NameOfTPL-2 path/to/TPL-2 <options> |
| 63 |
) |
| 64 |
|
| 65 |
Tribits Packages |
| 66 |
----------------- |
| 67 |
|
| 68 |
A Package is software that will be built at the same time as the rest |
| 69 |
of your project. It is a modular piece of your software that you may |
| 70 |
want to enable or disable. A tribits package can have dependencies on |
| 71 |
other packages or on TPLs. |
| 72 |
|
| 73 |
Enabling Packages |
| 74 |
+++++++++++++++++++++++ |
| 75 |
|
| 76 |
If you enable a package Then TriBITS will enable |
| 77 |
all of that projects dependencies. You do not have to explicitly |
| 78 |
enable the whole chain of dependencies. Just enable the packages that |
| 79 |
you directly depend on and TriBITS will make sure that everything you |
| 80 |
need for those packages is enabled as well |
| 81 |
|
| 82 |
Package Options |
| 83 |
++++++++++++++++ |
| 84 |
|
| 85 |
For <options> you will see PT, ST, or EX. |
| 86 |
|
| 87 |
- *PT (Primary Tested)* - This tpl is essential to developer |
| 88 |
productivity and would adversly effect customers if broken. |
| 89 |
- *ST (Secondary Tested)* - This tpl is important to the project but |
| 90 |
may be difficult to install or the TPL is not available on all |
| 91 |
development platforms. |
| 92 |
- *EX (Experimental)* - TPL is experimental, unstable and/or difficult to |
| 93 |
maintain. |
| 94 |
|
| 95 |
Most packages belong in the PT category and you will be fine if you |
| 96 |
only use that categroy for your packages to begin with |
| 97 |
|
| 98 |
|
| 99 |
Important things to know when listing packages |
| 100 |
++++++++++++++++++++++++++++++++++++++++++++++++ |
| 101 |
|
| 102 |
**Important - Read this section** |
| 103 |
|
| 104 |
* TriBITS packages must be listed in dependency order in |
| 105 |
the PackageList.cmake file. A package must be listed after all |
| 106 |
packages on which it depends. |
| 107 |
* Circular dependencies are not allowed in TriBITS. If you have |
| 108 |
packages with circular dependencies then they really should be one |
| 109 |
package |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
TriBITS TPLs |
| 114 |
------------- |
| 115 |
|
| 116 |
A TPL is software you depend on that is built and installed prior to |
| 117 |
building your project from source. For example, many projects dependo |
| 118 |
nthe boost libraries but it is rare atha anyone wants to build them as |
| 119 |
part of building their project. Projects assume that they areinstalled |
| 120 |
already and we just need to point tribits to them. TPLs are assumed to |
| 121 |
be self contained and will not trigger additional dependencies in your |
| 122 |
build. TPLs are always leaf nodes in the dependency tree. |