| 1 |
# @HEADER |
| 2 |
# ***************************************************************************** |
| 3 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 4 |
# |
| 5 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 6 |
# SPDX-License-Identifier: BSD-3-Clause |
| 7 |
# ***************************************************************************** |
| 8 |
# @HEADER |
| 9 |
|
| 10 |
include(TribitsGeneralMacros) |
| 11 |
|
| 12 |
|
| 13 |
# @MACRO: tribits_package_define_dependencies() |
| 14 |
# |
| 15 |
# Define the dependencies for a given `TriBITS Package`_ (i.e. a top-level |
| 16 |
# `TriBITS Package`_ or a `TriBITS Subpackage`_) in the package's |
| 17 |
# `<packageDir>/cmake/Dependencies.cmake`_ file. |
| 18 |
# |
| 19 |
# Usage:: |
| 20 |
# |
| 21 |
# tribits_package_define_dependencies( |
| 22 |
# [LIB_REQUIRED_PACKAGES <pkg1> <pkg2> ...] |
| 23 |
# [LIB_OPTIONAL_PACKAGES <pkg1> <pkg2> ...] |
| 24 |
# [TEST_REQUIRED_PACKAGES <pkg1> <pkg2> ...] |
| 25 |
# [TEST_OPTIONAL_PACKAGES <pkg1> <pkg2> ...] |
| 26 |
# [LIB_REQUIRED_TPLS <tpl1> <tpl2> ...] |
| 27 |
# [LIB_OPTIONAL_TPLS <tpl1> <tpl2> ...] |
| 28 |
# [TEST_REQUIRED_TPLS <tpl1> <tpl2> ...] |
| 29 |
# [TEST_OPTIONAL_TPLS <tpl1> <tpl2> ...] |
| 30 |
# [SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS |
| 31 |
# <spkg1_name> <spkg1_dir> <spkg1_classifications> <spkg1_optreq> |
| 32 |
# <spkg2_name> <spkg2_dir> <spkg2_classifications> <spkg2_optreq> |
| 33 |
# ... |
| 34 |
# ] |
| 35 |
# [REGRESSION_EMAIL_LIST <regression-email-address>] |
| 36 |
# ) |
| 37 |
# |
| 38 |
# Every argument in this macro is optional (that is, an package can have no |
| 39 |
# upstream dependencies). The arguments that apply to all packages are: |
| 40 |
# |
| 41 |
# ``LIB_REQUIRED_PACKAGES`` |
| 42 |
# |
| 43 |
# List of required upstream packages that must be enabled in order to |
| 44 |
# build and use the libraries (or capabilities) in this package. |
| 45 |
# |
| 46 |
# ``LIB_OPTIONAL_PACKAGES`` |
| 47 |
# |
| 48 |
# List of additional optional upstream packages that can be used in |
| 49 |
# this package if enabled. These upstream packages need not be |
| 50 |
# enabled in order to enable this package but not enabling one or more |
| 51 |
# of these optional upstream packages will result in diminished |
| 52 |
# capabilities of this package. |
| 53 |
# |
| 54 |
# ``TEST_REQUIRED_PACKAGES`` |
| 55 |
# |
| 56 |
# List of additional upstream packages that must be enabled in order to |
| 57 |
# build and/or run the tests and/or examples in this package. If any of |
| 58 |
# these upstream packages are not enabled, then there will be no tests or |
| 59 |
# examples defined or run for this package. |
| 60 |
# |
| 61 |
# ``TEST_OPTIONAL_PACKAGES`` |
| 62 |
# |
| 63 |
# List of additional optional upstream packages that can be used by the |
| 64 |
# tests in this package. These upstream packages need not be enabled in |
| 65 |
# order to run some basic tests or examples for this package. Typically, |
| 66 |
# extra tests that depend on optional test packages involve integration |
| 67 |
# testing of some type. Not enabling these optional upstream packages |
| 68 |
# will result in diminished tests or examples. |
| 69 |
# |
| 70 |
# ``LIB_REQUIRED_TPLS`` |
| 71 |
# |
| 72 |
# **DEPRECATED:** List of required upstream TPLs that must be enabled in |
| 73 |
# order to build and use the libraries (or capabilities) in this package. |
| 74 |
# (Add these to ``LIB_REQUIRED_PACKAGES`` instead.) |
| 75 |
# |
| 76 |
# ``LIB_OPTIONAL_TPLS`` |
| 77 |
# |
| 78 |
# **DEPRECATED:** List of additional optional upstream TPLs that can be |
| 79 |
# used in this package if enabled. These upstream TPLs need not be |
| 80 |
# enabled in order to use this package but not enabling one or more of |
| 81 |
# these optional upstream TPLs will result in diminished capabilities of |
| 82 |
# this package. (Add these to ``LIB_OPTIONAL_PACKAGES`` instead.) |
| 83 |
# |
| 84 |
# ``TEST_REQUIRED_TPLS`` |
| 85 |
# |
| 86 |
# **DEPRECATED:** List of additional upstream TPLs that must be enabled in |
| 87 |
# order to build and/or run the tests and/or examples in this package. If |
| 88 |
# any of these upstream TPLs are not enabled, then there will be no tests |
| 89 |
# or examples defined or run for this package. (Add these to |
| 90 |
# ``TEST_REQUIRED_PACKAGES`` instead.) |
| 91 |
# |
| 92 |
# ``TEST_OPTIONAL_TPLS`` |
| 93 |
# |
| 94 |
# **DEPRECATED:** List of additional optional upstream TPLs that can be |
| 95 |
# used by the tests in this package. These upstream TPLs need not be |
| 96 |
# enabled in order to run basic tests for this package. Typically, extra |
| 97 |
# tests that depend on optional TPLs involve integration testing or some |
| 98 |
# additional testing of some type. (Add these to |
| 99 |
# ``TEST_OPTIONAL_PACKAGES`` instead.) |
| 100 |
# |
| 101 |
# NOTE: The above ``XXX_TPLS`` arguments/lists are **deprecated**. At the |
| 102 |
# package level, there is no distinction between upstream internal and |
| 103 |
# external packages/TPLs, so all upstream package dependencies can (and should) |
| 104 |
# be listed in the ``XXX_PACKAGES`` arguments/lists. (There is no change in |
| 105 |
# behavior listing upstream packages in ``XXX_PACKAGES`` or the ``XXX_TPLS`` |
| 106 |
# arguments/lists.) |
| 107 |
# |
| 108 |
# Only upstream packages can be listed (as defined by the order the packages |
| 109 |
# are listed in `tribits_repository_define_packages()`_ in the |
| 110 |
# `<repoDir>/PackagesList.cmake`_ or `<repoDir>/TPLsList.cmake`_ files). |
| 111 |
# Otherwise an error will occur and processing will stop. Misspelled package |
| 112 |
# names are caught as well. |
| 113 |
# |
| 114 |
# Only direct package dependencies need to be listed. Indirect package |
| 115 |
# dependencies are automatically handled. For example, if this package |
| 116 |
# directly depends on package ``PKG2`` which depends on package ``PKG1`` |
| 117 |
# (but this package does not directly depend on anything in ``PKG1``) then |
| 118 |
# this package only needs to list a dependency on ``PKG2``, not ``PKG1``. |
| 119 |
# The dependency on ``PKG1`` will be taken care of automatically by the |
| 120 |
# TriBITS dependency management system. |
| 121 |
# |
| 122 |
# The packages listed in ``LIB_REQUIRED_PACKAGES`` are implicitly also |
| 123 |
# dependencies in ``TEST_REQUIRED_PACKAGES``. Likewise |
| 124 |
# ``LIB_OPTIONAL_PACKAGES`` are implicitly also dependencies in |
| 125 |
# ``TEST_OPTIONAL_PACKAGES``. |
| 126 |
# |
| 127 |
# The upstream dependencies within a single list do not need to be listed in |
| 128 |
# any particular order. For example, if ``PKG2`` depends on ``PKG1``, and |
| 129 |
# this given package depends on both, then one can list the dependencies as:: |
| 130 |
# |
| 131 |
# LIB_REQUIRED_PACKAGES PKG2 PKG1 |
| 132 |
# |
| 133 |
# or:: |
| 134 |
# |
| 135 |
# LIB_REQUIRED_PACKAGES PKG1 PKG2 |
| 136 |
# |
| 137 |
# If some upstream packages are allowed to be missing, this can be specified |
| 138 |
# by calling the macro `tribits_allow_missing_external_packages()`_. |
| 139 |
# |
| 140 |
# A top-level `TriBITS Package`_ can also be broken down into `TriBITS |
| 141 |
# Subpackages`_. In this case, the following argument must be passed in: |
| 142 |
# |
| 143 |
# .. _SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS: |
| 144 |
# |
| 145 |
# ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` |
| 146 |
# |
| 147 |
# 2D array with rows listing the subpackages where each row has the |
| 148 |
# columns: |
| 149 |
# |
| 150 |
# * **SUBPACKAGE** (Column 0): The name of the subpackage ``<spkg_name>``. |
| 151 |
# The full package name is ``${PARENT_PACKAGE_NAME}<spkg_name>``. |
| 152 |
# The full package name is what is used in listing dependencies in |
| 153 |
# other packages. |
| 154 |
# |
| 155 |
# * **DIRS** (Column 1): The subdirectory ``<spkg_dir>`` relative to the |
| 156 |
# parent package's base directory. All of the contents of the |
| 157 |
# subpackage should be under this subdirectory. This is assumed by the |
| 158 |
# TriBITS testing support software when mapping modified files to |
| 159 |
# packages that need to be tested (see `checkin-test.py`_). |
| 160 |
# |
| 161 |
# * **CLASSIFICATIONS** (Column 2): The `Test Test Category`_ `PT`_, |
| 162 |
# `ST`_, `EX`_ and the maturity level ``EP``, ``RS``, ``PG``, ``PM``, |
| 163 |
# ``GRS``, ``GPG``, ``GPM``, and ``UM``, separated by a coma ',' with no |
| 164 |
# spaces in between (e.g. ``"PT,GPM"``). These have exactly the same |
| 165 |
# meaning as for full packages (see |
| 166 |
# `tribits_repository_define_packages()`_). |
| 167 |
# |
| 168 |
# * **OPTREQ** (Column 3): Determines if the outer parent package has an |
| 169 |
# ``OPTIONAL`` or ``REQUIRED`` dependence on this subpackage. |
| 170 |
# |
| 171 |
# Other variables that this macro handles: |
| 172 |
# |
| 173 |
# ``REGRESSION_EMAIL_LIST`` |
| 174 |
# |
| 175 |
# The email list that is used to send CDash error messages. If this |
| 176 |
# argument is missing, then the email list that CDash errors go to is |
| 177 |
# determined by other means (see `CDash regression email addresses`_). |
| 178 |
# |
| 179 |
macro(tribits_package_define_dependencies) |
| 180 |
|
| 181 |
cmake_parse_arguments( |
| 182 |
#prefix |
| 183 |
PARSE |
| 184 |
#options |
| 185 |
"" |
| 186 |
#one_value_keywords |
| 187 |
"" |
| 188 |
#multi_value_keywords |
| 189 |
"LIB_REQUIRED_PACKAGES;LIB_OPTIONAL_PACKAGES;TEST_REQUIRED_PACKAGES;TEST_OPTIONAL_PACKAGES;LIB_REQUIRED_TPLS;LIB_OPTIONAL_TPLS;TEST_REQUIRED_TPLS;TEST_OPTIONAL_TPLS;REGRESSION_EMAIL_LIST;SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS" |
| 190 |
${ARGN} |
| 191 |
) |
| 192 |
|
| 193 |
tribits_check_for_unparsed_arguments() |
| 194 |
|
| 195 |
set(LIB_REQUIRED_DEP_PACKAGES ${PARSE_LIB_REQUIRED_PACKAGES}) |
| 196 |
set(LIB_OPTIONAL_DEP_PACKAGES ${PARSE_LIB_OPTIONAL_PACKAGES}) |
| 197 |
set(TEST_REQUIRED_DEP_PACKAGES ${PARSE_TEST_REQUIRED_PACKAGES}) |
| 198 |
set(TEST_OPTIONAL_DEP_PACKAGES ${PARSE_TEST_OPTIONAL_PACKAGES}) |
| 199 |
set(LIB_REQUIRED_DEP_TPLS ${PARSE_LIB_REQUIRED_TPLS}) |
| 200 |
set(LIB_OPTIONAL_DEP_TPLS ${PARSE_LIB_OPTIONAL_TPLS}) |
| 201 |
set(TEST_REQUIRED_DEP_TPLS ${PARSE_TEST_REQUIRED_TPLS}) |
| 202 |
set(TEST_OPTIONAL_DEP_TPLS ${PARSE_TEST_OPTIONAL_TPLS}) |
| 203 |
set(REGRESSION_EMAIL_LIST ${PARSE_REGRESSION_EMAIL_LIST}) |
| 204 |
set(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS |
| 205 |
${PARSE_SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS}) |
| 206 |
|
| 207 |
# ToDo: |
| 208 |
# * Assert that REGRESSION_EMAIL_LIST has only one entry |
| 209 |
# * Assert that SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS is divisible |
| 210 |
# by the number of columns! |
| 211 |
|
| 212 |
endmacro() |