| 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(TribitsPackageDefineDependencies) |
| 11 |
include(TribitsPackageDependencies) |
| 12 |
include(SetDefault) |
| 13 |
include(DualScopeSet) |
| 14 |
|
| 15 |
# @MACRO: tribits_read_deps_files_create_deps_graph() |
| 16 |
# |
| 17 |
# Usage:: |
| 18 |
# |
| 19 |
# tribits_read_deps_files_create_deps_graph() |
| 20 |
# |
| 21 |
# This macro reads of all the package dependencies and builds the package |
| 22 |
# dependency graph. This first executes the logic in the files |
| 23 |
# `<repoDir>/cmake/RepositoryDependenciesSetup.cmake`_ (for each TriBITS repo) |
| 24 |
# and `<projectDir>/cmake/ProjectDependenciesSetup.cmake`_ and then reads in |
| 25 |
# all of the `<packageDir>/cmake/Dependencies.cmake`_ and |
| 26 |
# `<packageDir>/<spkgDir>/cmake/Dependencies.cmake`_ files and builds the |
| 27 |
# package dependency graph variables. |
| 28 |
# |
| 29 |
# This macro reads from the variables: |
| 30 |
# |
| 31 |
# * `${PROJECT_NAME}_ALL_REPOSITORIES`_ |
| 32 |
# * `${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES`_ |
| 33 |
# |
| 34 |
# and writes to the variables: |
| 35 |
# |
| 36 |
# * `${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES`_ |
| 37 |
# |
| 38 |
# as well creates the package dependency variables described in `Variables |
| 39 |
# defining the package dependencies graph`_ that defines the directed acyclic |
| 40 |
# dependency (DAG) package dependency graph (with navigation up and down the |
| 41 |
# graph). |
| 42 |
# |
| 43 |
# See `Function call tree for constructing package dependency graph`_. |
| 44 |
# |
| 45 |
macro(tribits_read_deps_files_create_deps_graph) |
| 46 |
|
| 47 |
message("") |
| 48 |
message("Processing Project, Repository, and Package dependency files and building internal dependencies graph ...") |
| 49 |
message("") |
| 50 |
|
| 51 |
tribits_process_all_repository_deps_setup_files() |
| 52 |
|
| 53 |
tribits_process_project_dependency_setup_file() |
| 54 |
|
| 55 |
tribits_read_all_package_deps_files_create_deps_graph() |
| 56 |
|
| 57 |
endmacro() |
| 58 |
|
| 59 |
|
| 60 |
# @MACRO: tribits_process_all_repository_deps_setup_files() |
| 61 |
# |
| 62 |
# Process any dependency logic at the repo level by loading |
| 63 |
# `<repoDir>/cmake/RepositoryDependenciesSetup.cmake`_ files. |
| 64 |
# |
| 65 |
# See `Function call tree for constructing package dependency graph`_. |
| 66 |
# |
| 67 |
macro(tribits_process_all_repository_deps_setup_files) |
| 68 |
foreach(TIBITS_REPO IN LISTS ${PROJECT_NAME}_ALL_REPOSITORIES) |
| 69 |
tribits_get_repo_name_dir(${TIBITS_REPO} REPO_NAME REPO_DIR) |
| 70 |
tribits_set_base_repo_dir(${PROJECT_SOURCE_DIR} ${REPO_DIR} BASE_REPO_DIR) |
| 71 |
tribits_get_repo_name(${TIBITS_REPO} REPOSITORY_NAME) |
| 72 |
set(REPO_DEPENDENCIES_SETUP_FILE |
| 73 |
"${BASE_REPO_DIR}/cmake/RepositoryDependenciesSetup.cmake") |
| 74 |
if (EXISTS ${REPO_DEPENDENCIES_SETUP_FILE}) |
| 75 |
tribits_trace_file_processing(REPOSITORY INCLUDE |
| 76 |
"${REPO_DEPENDENCIES_SETUP_FILE}") |
| 77 |
include(${REPO_DEPENDENCIES_SETUP_FILE}) |
| 78 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 79 |
print_var(${REPO_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) |
| 80 |
print_var(${REPO_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) |
| 81 |
endif() |
| 82 |
else() |
| 83 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 84 |
message("-- " |
| 85 |
"The ${REPO_NAME} file ${REPO_DEPENDENCIES_SETUP_FILE} does not exist! ...") |
| 86 |
endif() |
| 87 |
endif() |
| 88 |
endforeach() |
| 89 |
endmacro() |
| 90 |
|
| 91 |
|
| 92 |
# @MACRO: tribits_process_project_dependency_setup_file() |
| 93 |
# |
| 94 |
# Process any dependency logic at the project level by loading the |
| 95 |
# `<projectDir>/cmake/ProjectDependenciesSetup.cmake`_ file |
| 96 |
# |
| 97 |
# See `Function call tree for constructing package dependency graph`_. |
| 98 |
# |
| 99 |
macro(tribits_process_project_dependency_setup_file) |
| 100 |
set(PROJECT_DEPENDENCIES_SETUP_FILE |
| 101 |
"${PROJECT_SOURCE_DIR}/cmake/ProjectDependenciesSetup.cmake") |
| 102 |
if (EXISTS ${PROJECT_DEPENDENCIES_SETUP_FILE}) |
| 103 |
tribits_trace_file_processing(PROJECT INCLUDE |
| 104 |
"${PROJECT_DEPENDENCIES_SETUP_FILE}") |
| 105 |
include(${PROJECT_DEPENDENCIES_SETUP_FILE}) |
| 106 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 107 |
print_var(${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) |
| 108 |
print_var(${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) |
| 109 |
endif() |
| 110 |
else() |
| 111 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 112 |
message("-- " |
| 113 |
"The ${PROJECT_NAME} file ${PROJECT_DEPENDENCIES_SETUP_FILE} does not exist! ...") |
| 114 |
endif() |
| 115 |
endif() |
| 116 |
endmacro() |
| 117 |
|
| 118 |
|
| 119 |
# @MACRO: tribits_read_all_package_deps_files_create_deps_graph() |
| 120 |
# |
| 121 |
# Usage:: |
| 122 |
# |
| 123 |
# tribits_read_all_package_deps_files_create_deps_graph() |
| 124 |
# |
| 125 |
# This macro reads in all of the `<packageDir>/cmake/Dependencies.cmake`_ and |
| 126 |
# `<packageDir>/<spkgDir>/cmake/Dependencies.cmake`_ files for top-level |
| 127 |
# packages and subpackages, respectively, and builds the package dependency |
| 128 |
# graph variables. |
| 129 |
# |
| 130 |
# This macro reads from the variables: |
| 131 |
# |
| 132 |
# * `${PROJECT_NAME}_ALL_REPOSITORIES`_ |
| 133 |
# * `${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES`_ |
| 134 |
# |
| 135 |
# And writes to the variable: |
| 136 |
# |
| 137 |
# * `${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES`_ |
| 138 |
# |
| 139 |
# as well creates the package dependency variables described in `Variables |
| 140 |
# defining the package dependencies graph`_ that defines the directed acyclic |
| 141 |
# dependency (DAG) package dependency graph (with navigation up and down the |
| 142 |
# graph). |
| 143 |
# |
| 144 |
# See `Function call tree for constructing package dependency graph`_. |
| 145 |
# |
| 146 |
macro(tribits_read_all_package_deps_files_create_deps_graph) |
| 147 |
|
| 148 |
foreach(tribitsExternalPkg IN LISTS ${PROJECT_NAME}_DEFINED_TPLS) |
| 149 |
tribits_read_external_package_deps_files_add_to_graph(${tribitsExternalPkg}) |
| 150 |
endforeach() |
| 151 |
|
| 152 |
set(${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES "") # Packages and subpackages |
| 153 |
|
| 154 |
foreach(TRIBITS_PACKAGE IN LISTS ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES) |
| 155 |
tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE}) |
| 156 |
endforeach() |
| 157 |
|
| 158 |
list(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES |
| 159 |
${PROJECT_NAME}_NUM_DEFINED_INTERNAL_PACKAGES) |
| 160 |
print_var(${PROJECT_NAME}_NUM_DEFINED_INTERNAL_PACKAGES) |
| 161 |
|
| 162 |
endmacro() |
| 163 |
|
| 164 |
|
| 165 |
# @MACRO: tribits_read_external_package_deps_files_add_to_graph() |
| 166 |
# |
| 167 |
# Reads in dependencies for the external packages/TPL ``<tplName>`` and |
| 168 |
# creates the package dependency graph entries for it. |
| 169 |
# |
| 170 |
# Usage:: |
| 171 |
# |
| 172 |
# tribits_read_external_package_deps_files_add_to_graph(<tplName>) |
| 173 |
# |
| 174 |
# This reads in the file ``${<tplName>_DEPENDENCIES_FILE}`` and sets the |
| 175 |
# variable:: |
| 176 |
# |
| 177 |
# <tplName>_LIB_DEFINED_DEPENDENCIES |
| 178 |
# |
| 179 |
# See `Function call tree for constructing package dependency graph`_. |
| 180 |
# |
| 181 |
macro(tribits_read_external_package_deps_files_add_to_graph tplName) |
| 182 |
# Set up empty lists for forward dependencies |
| 183 |
set(${tplName}_FORWARD_LIB_DEFINED_DEPENDENCIES "") |
| 184 |
set(${tplName}_FORWARD_TEST_DEFINED_DEPENDENCIES "") |
| 185 |
# Read in and process the external package/TPL dependency file |
| 186 |
if (IS_ABSOLUTE "${${tplName}_DEPENDENCIES_FILE}") |
| 187 |
set(absTplDepsFile "${${tplName}_DEPENDENCIES_FILE}") |
| 188 |
else() |
| 189 |
set(absTplDepsFile "${${PROJECT_NAME}_SOURCE_DIR}/${${tplName}_DEPENDENCIES_FILE}") |
| 190 |
endif() |
| 191 |
if (EXISTS "${absTplDepsFile}") |
| 192 |
tribits_trace_file_processing(TPL INCLUDE "${absTplDepsFile}") |
| 193 |
include(${absTplDepsFile}) |
| 194 |
foreach(depPkg IN LISTS ${tplName}_LIB_DEFINED_DEPENDENCIES) |
| 195 |
global_set(${tplName}_LIB_DEP_REQUIRED_${depPkg} FALSE) |
| 196 |
endforeach() |
| 197 |
tribits_append_forward_dep_packages(${tplName} LIB) |
| 198 |
endif() |
| 199 |
endmacro() |
| 200 |
|
| 201 |
|
| 202 |
# @MACRO: tribits_read_toplevel_package_deps_files_add_to_graph() |
| 203 |
# |
| 204 |
# Usage:: |
| 205 |
# |
| 206 |
# tribits_read_toplevel_package_deps_files_add_to_graph(<packageName>) |
| 207 |
# |
| 208 |
# Macro that reads in package dependencies for a top-level package from the |
| 209 |
# file `<packageDir>/cmake/Dependencies.cmake`_ and appends the forward |
| 210 |
# dependencies list vars for packages already read in for this package |
| 211 |
# ``<packageName>`` (see `Variables defining the package dependencies |
| 212 |
# graph`_). |
| 213 |
# |
| 214 |
# It also appends the list variable: |
| 215 |
# |
| 216 |
# * `${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES`_ |
| 217 |
# |
| 218 |
# Also, the subpackage dependencies under this top-level package are read in |
| 219 |
# order and then this top-level package is appended and dependencies are |
| 220 |
# created for them. |
| 221 |
# |
| 222 |
# See `Function call tree for constructing package dependency graph`_. |
| 223 |
# |
| 224 |
macro(tribits_read_toplevel_package_deps_files_add_to_graph PACKAGE_NAME) |
| 225 |
|
| 226 |
# A) Get ready to read in the contents of this package's Dependencies.cmake |
| 227 |
# file |
| 228 |
|
| 229 |
tribits_prep_to_read_dependencies(${PACKAGE_NAME}) |
| 230 |
|
| 231 |
# Listing of subpackages |
| 232 |
set(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) # Allow to be empty |
| 233 |
|
| 234 |
# B) Read in this package's Dependencies file and save off read dependency vars. |
| 235 |
|
| 236 |
set(PACKAGE_DEPENDENCIES_FILE |
| 237 |
"${PROJECT_SOURCE_DIR}/${${PACKAGE_NAME}_REL_SOURCE_DIR}/cmake/Dependencies.cmake") |
| 238 |
|
| 239 |
tribits_trace_file_processing(PACKAGE INCLUDE "${PACKAGE_DEPENDENCIES_FILE}") |
| 240 |
include(${PACKAGE_DEPENDENCIES_FILE}) |
| 241 |
|
| 242 |
tribits_assert_read_dependency_vars(${PACKAGE_NAME}) |
| 243 |
|
| 244 |
tribits_save_off_dependency_vars(PARENTPACK) |
| 245 |
|
| 246 |
# B.1) Set up the mail addresses (one regression email list for the package |
| 247 |
# and all subpackages) |
| 248 |
|
| 249 |
tribits_set_package_regression_email_list(${PACKAGE_NAME}) |
| 250 |
|
| 251 |
# B.2) Process this package's subpackages first *before* finishing this packages! |
| 252 |
|
| 253 |
tribits_parse_subpackages_append_packages_add_options(${PACKAGE_NAME}) |
| 254 |
|
| 255 |
tribits_read_package_subpackage_deps_files_add_to_graph(${PACKAGE_NAME}) |
| 256 |
|
| 257 |
# C) Finish processing this package's dependencies into dependency graph vars |
| 258 |
# |
| 259 |
# NOTE: The subpackages for this package are automatically treated as |
| 260 |
# optional or required library dependent packages for this outer package! |
| 261 |
|
| 262 |
tribits_read_back_dependencies_vars(PARENTPACK) |
| 263 |
|
| 264 |
# Append the subpackages to the dependencies list if this top-level package |
| 265 |
set(SUBPACKAGE_IDX 0) |
| 266 |
foreach(TRIBITS_SUBPACKAGE IN LISTS ${PACKAGE_NAME}_SUBPACKAGES) |
| 267 |
set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${TRIBITS_SUBPACKAGE}) |
| 268 |
list(GET ${PACKAGE_NAME}_SUBPACKAGE_OPTREQ ${SUBPACKAGE_IDX} SUBPACKAGE_OPTREQ) |
| 269 |
list(APPEND LIB_${SUBPACKAGE_OPTREQ}_DEP_PACKAGES ${SUBPACKAGE_FULLNAME}) |
| 270 |
math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") |
| 271 |
endforeach() |
| 272 |
|
| 273 |
# Append this package to list of packages *after* subpackages are added! |
| 274 |
list(APPEND ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES ${PACKAGE_NAME}) |
| 275 |
|
| 276 |
# Process this parent package's dependency lists! |
| 277 |
tribits_process_package_dependencies_lists(${PACKAGE_NAME}) |
| 278 |
|
| 279 |
endmacro() |
| 280 |
|
| 281 |
|
| 282 |
################################################################################ |
| 283 |
# Helper macros for reading in and processing dependency lists from a single |
| 284 |
# Dependencies.cmake file. |
| 285 |
################################################################################ |
| 286 |
|
| 287 |
|
| 288 |
# @MACRO: tribits_prep_to_read_dependencies() |
| 289 |
# |
| 290 |
# Usage:: |
| 291 |
# |
| 292 |
# tribits_prep_to_read_dependencies(<packageName>) |
| 293 |
# |
| 294 |
# Macro that sets to undefined all of the variables that must be set by the |
| 295 |
# `tribits_package_define_dependencies()`_ macro. |
| 296 |
# |
| 297 |
# It also sets to empty the forward dependency list vars: |
| 298 |
# |
| 299 |
# * `${PACKAGE_NAME}_FORWARD_LIB_DEFINED_DEPENDENCIES`_ |
| 300 |
# * `${PACKAGE_NAME}_FORWARD_TEST_DEFINED_DEPENDENCIES`_ |
| 301 |
# |
| 302 |
# for each of the forward/downstream package/dependency in `Variables defining |
| 303 |
# the package dependencies graph`_. |
| 304 |
# |
| 305 |
# See `Function call tree for constructing package dependency graph`_. |
| 306 |
# |
| 307 |
macro(tribits_prep_to_read_dependencies PACKAGE_NAME_IN) |
| 308 |
|
| 309 |
# Initial vars that must be set in the Dependencies.cmake file |
| 310 |
tribits_declare_undefined(LIB_REQUIRED_DEP_PACKAGES) |
| 311 |
tribits_declare_undefined(LIB_OPTIONAL_DEP_PACKAGES) |
| 312 |
tribits_declare_undefined(TEST_REQUIRED_DEP_PACKAGES) |
| 313 |
tribits_declare_undefined(TEST_OPTIONAL_DEP_PACKAGES) |
| 314 |
|
| 315 |
tribits_declare_undefined(LIB_REQUIRED_DEP_TPLS) |
| 316 |
tribits_declare_undefined(LIB_OPTIONAL_DEP_TPLS) |
| 317 |
tribits_declare_undefined(TEST_REQUIRED_DEP_TPLS) |
| 318 |
tribits_declare_undefined(TEST_OPTIONAL_DEP_TPLS) |
| 319 |
|
| 320 |
set(REGRESSION_EMAIL_LIST "") # Allow to be empty |
| 321 |
|
| 322 |
# Initialize other vars |
| 323 |
set(${PACKAGE_NAME_IN}_FORWARD_LIB_DEFINED_DEPENDENCIES "") |
| 324 |
set(${PACKAGE_NAME_IN}_FORWARD_TEST_DEFINED_DEPENDENCIES "") |
| 325 |
|
| 326 |
endmacro() |
| 327 |
|
| 328 |
|
| 329 |
# @MACRO: tribits_assert_read_dependency_vars() |
| 330 |
# |
| 331 |
# Usage:: |
| 332 |
# |
| 333 |
# tribits_assert_read_dependency_vars(<packageName>) |
| 334 |
# |
| 335 |
# Assert that all of the required variables set by the function |
| 336 |
# `tribits_package_define_dependencies()`_ in the file |
| 337 |
# `<packageDir>/cmake/Dependencies.cmake`_ have been set. |
| 338 |
# |
| 339 |
# See `Function call tree for constructing package dependency graph`_. |
| 340 |
# |
| 341 |
macro(tribits_assert_read_dependency_vars PACKAGE_NAME) |
| 342 |
|
| 343 |
tribits_assert_defined_package_var(LIB_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) |
| 344 |
tribits_assert_defined_package_var(LIB_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) |
| 345 |
tribits_assert_defined_package_var(TEST_REQUIRED_DEP_PACKAGES ${PACKAGE_NAME}) |
| 346 |
tribits_assert_defined_package_var(TEST_OPTIONAL_DEP_PACKAGES ${PACKAGE_NAME}) |
| 347 |
|
| 348 |
tribits_assert_defined_package_var(LIB_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) |
| 349 |
tribits_assert_defined_package_var(LIB_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) |
| 350 |
tribits_assert_defined_package_var(TEST_REQUIRED_DEP_TPLS ${PACKAGE_NAME}) |
| 351 |
tribits_assert_defined_package_var(TEST_OPTIONAL_DEP_TPLS ${PACKAGE_NAME}) |
| 352 |
|
| 353 |
endmacro() |
| 354 |
|
| 355 |
|
| 356 |
# @MACRO: tribits_save_off_dependency_vars() |
| 357 |
# |
| 358 |
# Usage:: |
| 359 |
# |
| 360 |
# tribits_save_off_dependency_vars(<postfix>) |
| 361 |
# |
| 362 |
# Saves off package dependency variables with variable suffix ``_<postfix>``. |
| 363 |
# |
| 364 |
# See `Function call tree for constructing package dependency graph`_. |
| 365 |
# |
| 366 |
macro(tribits_save_off_dependency_vars POSTFIX) |
| 367 |
|
| 368 |
set(LIB_REQUIRED_DEP_PACKAGES_${POSTFIX} ${LIB_REQUIRED_DEP_PACKAGES}) |
| 369 |
set(LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${LIB_OPTIONAL_DEP_PACKAGES}) |
| 370 |
set(TEST_REQUIRED_DEP_PACKAGES_${POSTFIX} ${TEST_REQUIRED_DEP_PACKAGES}) |
| 371 |
set(TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX} ${TEST_OPTIONAL_DEP_PACKAGES}) |
| 372 |
|
| 373 |
set(LIB_REQUIRED_DEP_TPLS_${POSTFIX} ${LIB_REQUIRED_DEP_TPLS}) |
| 374 |
set(LIB_OPTIONAL_DEP_TPLS_${POSTFIX} ${LIB_OPTIONAL_DEP_TPLS}) |
| 375 |
set(TEST_REQUIRED_DEP_TPLS_${POSTFIX} ${TEST_REQUIRED_DEP_TPLS}) |
| 376 |
set(TEST_OPTIONAL_DEP_TPLS_${POSTFIX} ${TEST_OPTIONAL_DEP_TPLS}) |
| 377 |
|
| 378 |
endmacro() |
| 379 |
|
| 380 |
|
| 381 |
# @MACRO: tribits_read_back_dependencies_vars() |
| 382 |
# |
| 383 |
# Usage:: |
| 384 |
# |
| 385 |
# tribits_read_back_dependencies_vars(<postfix>) |
| 386 |
# |
| 387 |
# Read back the local package dependency vars from the saved-off vars with |
| 388 |
# suffix ``_<postfix>``. |
| 389 |
# |
| 390 |
# See `Function call tree for constructing package dependency graph`_. |
| 391 |
# |
| 392 |
macro(tribits_read_back_dependencies_vars POSTFIX) |
| 393 |
|
| 394 |
set(LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_PACKAGES_${POSTFIX}}) |
| 395 |
set(LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) |
| 396 |
set(TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_PACKAGES_${POSTFIX}}) |
| 397 |
set(TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_PACKAGES_${POSTFIX}}) |
| 398 |
|
| 399 |
set(LIB_REQUIRED_DEP_TPLS ${LIB_REQUIRED_DEP_TPLS_${POSTFIX}}) |
| 400 |
set(LIB_OPTIONAL_DEP_TPLS ${LIB_OPTIONAL_DEP_TPLS_${POSTFIX}}) |
| 401 |
set(TEST_REQUIRED_DEP_TPLS ${TEST_REQUIRED_DEP_TPLS_${POSTFIX}}) |
| 402 |
set(TEST_OPTIONAL_DEP_TPLS ${TEST_OPTIONAL_DEP_TPLS_${POSTFIX}}) |
| 403 |
|
| 404 |
endmacro() |
| 405 |
|
| 406 |
|
| 407 |
# @MACRO: tribits_process_package_dependencies_lists() |
| 408 |
# |
| 409 |
# Usage:: |
| 410 |
# |
| 411 |
# tribits_process_package_dependencies_lists(<packageName>) |
| 412 |
# |
| 413 |
# Sets up the upstream/backward and downstream/forward package dependency list |
| 414 |
# variables for ``<packageName>`` described in `Variables defining the package |
| 415 |
# dependencies graph`_. Note that the downstream/forward dependencies of |
| 416 |
# upstream packages for this package ``<packageName>`` are built up |
| 417 |
# incrementally. (The forward dependency list vars are initialized to empty |
| 418 |
# in `tribits_prep_to_read_dependencies()`_.) |
| 419 |
# |
| 420 |
# See `Function call tree for constructing package dependency graph`_. |
| 421 |
# |
| 422 |
macro(tribits_process_package_dependencies_lists packageName) |
| 423 |
|
| 424 |
# Initialize backward dep vars |
| 425 |
set(${packageName}_LIB_DEFINED_DEPENDENCIES "") |
| 426 |
set(${packageName}_TEST_DEFINED_DEPENDENCIES "") |
| 427 |
|
| 428 |
# Append the XXX_TPLS list on the end of the XXX_PACKAGES list |
| 429 |
list(APPEND LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_TPLS}) |
| 430 |
list(APPEND LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_TPLS}) |
| 431 |
list(APPEND TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_TPLS}) |
| 432 |
list(APPEND TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_TPLS}) |
| 433 |
set(LIB_REQUIRED_DEP_TPLS "") |
| 434 |
set(LIB_OPTIONAL_DEP_TPLS "") |
| 435 |
set(TEST_REQUIRED_DEP_TPLS "") |
| 436 |
set(TEST_OPTIONAL_DEP_TPLS "") |
| 437 |
|
| 438 |
# Fill the backward dependency vars |
| 439 |
tribits_set_dep_packages(${packageName} LIB REQUIRED PACKAGES) |
| 440 |
tribits_set_dep_packages(${packageName} LIB OPTIONAL PACKAGES) |
| 441 |
tribits_set_dep_packages(${packageName} TEST REQUIRED PACKAGES) |
| 442 |
tribits_set_dep_packages(${packageName} TEST OPTIONAL PACKAGES) |
| 443 |
|
| 444 |
# Fill forward deps lists #63 |
| 445 |
tribits_append_forward_dep_packages(${packageName} LIB) |
| 446 |
tribits_append_forward_dep_packages(${packageName} TEST) |
| 447 |
|
| 448 |
endmacro() |
| 449 |
|
| 450 |
|
| 451 |
# @MACRO: tribits_set_dep_packages() |
| 452 |
# |
| 453 |
# Macro set up backward package dependency lists for a given package given the |
| 454 |
# vars read in from the macro `tribits_package_define_dependencies()`_. |
| 455 |
# |
| 456 |
# Usage:: |
| 457 |
# |
| 458 |
# tribits_set_dep_packages(<packageName> <testOrLib> <requiredOrOptional> <pkgsOrTpls>) |
| 459 |
# |
| 460 |
# where: |
| 461 |
# |
| 462 |
# * ``<testOrLib>``: ``LIB`` or ``TEST`` |
| 463 |
# * ``<requiredOrOptional>``: ``REQUIRED`` or ``OPTIONAL`` |
| 464 |
# * ``<pkgsOrTpls>``: ``PACKAGES`` or ``TPLS`` |
| 465 |
# |
| 466 |
# |
| 467 |
# Sets the upstream/backward dependency variables defined in the section |
| 468 |
# `Variables defining the package dependencies graph`_. |
| 469 |
# |
| 470 |
# This also handles the several types of issues: |
| 471 |
# |
| 472 |
# * A package declaring a dependency on itself |
| 473 |
# (`tribits_abort_on_self_dep()`_). |
| 474 |
# |
| 475 |
# * A missing upstream dependent package (either error out with |
| 476 |
# `tribits_abort_on_missing_package()`_ or allow to be missing and disable |
| 477 |
# this package if this is a required dependency). |
| 478 |
# |
| 479 |
# See `Function call tree for constructing package dependency graph`_. |
| 480 |
# |
| 481 |
macro(tribits_set_dep_packages packageName testOrLib requiredOrOptional pkgsOrTpls) |
| 482 |
|
| 483 |
set(inputListType ${testOrLib}_${requiredOrOptional}_DEP_${pkgsOrTpls}) |
| 484 |
set(packageEnableVar ${PROJECT_NAME}_ENABLE_${packageName}) |
| 485 |
|
| 486 |
foreach(depPkg IN LISTS ${inputListType}) |
| 487 |
if (${depPkg} STREQUAL ${packageName}) |
| 488 |
tribits_abort_on_self_dep("${packageName}" "${inputListType}") |
| 489 |
endif() |
| 490 |
tribits_is_pkg_defined(${depPkg} depPkgIsDefined) |
| 491 |
if (depPkgIsDefined) |
| 492 |
list(APPEND ${packageName}_${testOrLib}_DEFINED_DEPENDENCIES ${depPkg}) |
| 493 |
if ("${requiredOrOptional}" STREQUAL "REQUIRED") |
| 494 |
global_set(${packageName}_${testOrLib}_DEP_REQUIRED_${depPkg} TRUE) |
| 495 |
elseif ("${requiredOrOptional}" STREQUAL "OPTIONAL") |
| 496 |
global_set(${packageName}_${testOrLib}_DEP_REQUIRED_${depPkg} FALSE) |
| 497 |
else() |
| 498 |
message(FATAL_ERROR |
| 499 |
"Invalid value for requiredOrOptional='${requiredOrOptional}'!") |
| 500 |
endif() |
| 501 |
else() |
| 502 |
tribits_set_dep_packages__handle_undefined_pkg(${packageName} ${depPkg} |
| 503 |
${requiredOrOptional} ${pkgsOrTpls} ${packageEnableVar}) |
| 504 |
endif() |
| 505 |
endforeach() |
| 506 |
|
| 507 |
endmacro() |
| 508 |
|
| 509 |
|
| 510 |
# Determine if a (internal or external) package is defined or not |
| 511 |
# |
| 512 |
function(tribits_is_pkg_defined depPkg depPkgIsDefinedOut) |
| 513 |
set(depPkgIsDefined FALSE) |
| 514 |
if (${depPkg}_SOURCE_DIR) |
| 515 |
set(depPkgIsDefined TRUE) |
| 516 |
elseif(${depPkg}_FINDMOD) |
| 517 |
set(depPkgIsDefined TRUE) |
| 518 |
endif() |
| 519 |
set(${depPkgIsDefinedOut} ${depPkgIsDefined} PARENT_SCOPE) |
| 520 |
endfunction() |
| 521 |
|
| 522 |
|
| 523 |
# Implementation macro for tribits_set_dep_packages() to deal with a package |
| 524 |
# that is not defined by TriBITS. |
| 525 |
# |
| 526 |
# ToDo #63: This may need to be modified when dealing with TriBITS-compliant |
| 527 |
# packages already installed out on the system. We may need a mode where we |
| 528 |
# don't assert packages that are not defined but instead just assume they are |
| 529 |
# TriBITS-compliant packages already installed. |
| 530 |
# |
| 531 |
macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg |
| 532 |
requiredOrOptional pkgsOrTpls packageEnableVar |
| 533 |
) |
| 534 |
# Determine if it is allowed for this depPkg to not be defined |
| 535 |
set(errorOutForUndefinedDepPkg TRUE) |
| 536 |
if (${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE) |
| 537 |
set(errorOutForUndefinedDepPkg FALSE) |
| 538 |
elseif (NOT ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST |
| 539 |
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST |
| 540 |
) |
| 541 |
set(errorOutForUndefinedDepPkg FALSE) |
| 542 |
endif() |
| 543 |
# Produce error or deal with allowed undefined ${depPkg} |
| 544 |
if (errorOutForUndefinedDepPkg) |
| 545 |
tribits_abort_on_missing_package("${depPkg}" "${packageName}") |
| 546 |
else() |
| 547 |
if (${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE) |
| 548 |
if (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES) |
| 549 |
message_wrapper("NOTE: ${depPkg} is being ignored since its directory" |
| 550 |
" is missing and ${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE =" |
| 551 |
" ${${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE}!") |
| 552 |
endif() |
| 553 |
if ("${requiredOrOptional}" STREQUAL "REQUIRED") |
| 554 |
message_wrapper("NOTE: Setting ${packageEnableVar}=OFF because" |
| 555 |
" package ${packageName} has a required dependency on missing" |
| 556 |
" package ${depPkg}!") |
| 557 |
set(${packageEnableVar} OFF) |
| 558 |
endif() |
| 559 |
endif() |
| 560 |
# Must set enable vars for missing package to off so that logic in |
| 561 |
# existing downstream packages that key off of these vars will still |
| 562 |
# work. |
| 563 |
set(${PROJECT_NAME}_ENABLE_${depPkg} OFF) |
| 564 |
set(${packageName}_ENABLE_${depPkg} OFF) |
| 565 |
endif() |
| 566 |
endmacro() |
| 567 |
|
| 568 |
|
| 569 |
# @MACRO: tribits_append_forward_dep_packages() |
| 570 |
# |
| 571 |
# Appends forward/downstream package dependency lists for the upstream |
| 572 |
# dependent package list provided. |
| 573 |
# |
| 574 |
# Usage:: |
| 575 |
# |
| 576 |
# tribits_append_forward_dep_packages(<packageName> <listType>) |
| 577 |
# |
| 578 |
# In particular, it appends the var:: |
| 579 |
# |
| 580 |
# <packageName>_FORWARD_<listType> |
| 581 |
# |
| 582 |
# for one of the vars listed in `Variables defining the package dependencies |
| 583 |
# graph`_. |
| 584 |
# |
| 585 |
# This function is called multiple times to build up the forward package |
| 586 |
# dependencies for a given ``<packageName>`` by the downstream packages that |
| 587 |
# declare dependencies on it. |
| 588 |
# |
| 589 |
# See `Function call tree for constructing package dependency graph`_. |
| 590 |
# |
| 591 |
macro(tribits_append_forward_dep_packages packageName libOrTest) |
| 592 |
|
| 593 |
foreach(depPkg IN LISTS ${packageName}_${libOrTest}_DEFINED_DEPENDENCIES) |
| 594 |
set(fwdDepPkgListName ${depPkg}_FORWARD_${libOrTest}_DEFINED_DEPENDENCIES) |
| 595 |
if (DEFINED ${fwdDepPkgListName}) |
| 596 |
list(APPEND ${fwdDepPkgListName} ${packageName}) |
| 597 |
else() |
| 598 |
if (${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST |
| 599 |
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST |
| 600 |
) |
| 601 |
tribits_abort_on_missing_package(${depPkg} ${packageName}) |
| 602 |
else() |
| 603 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 604 |
message( |
| 605 |
"\n***" |
| 606 |
"\n*** NOTE: The package ${depPkg} has forward dependent package" |
| 607 |
" ${packageName}, but that dependency is being ignored because the package" |
| 608 |
" ${depPkg} is missing!" |
| 609 |
"\n***\n" ) |
| 610 |
endif() |
| 611 |
endif() |
| 612 |
endif() |
| 613 |
endforeach() |
| 614 |
|
| 615 |
endmacro() |
| 616 |
|
| 617 |
|
| 618 |
# @MACRO: tribits_set_package_regression_email_list() |
| 619 |
# |
| 620 |
# Usage:: |
| 621 |
# |
| 622 |
# tribits_set_package_regression_email_list(<packageName>) |
| 623 |
# |
| 624 |
# Macro that sets a pacakge's regression email address |
| 625 |
# ``${PACKAGE_NAME}_REGRESSION_EMAIL_LIST`` as described in ???. |
| 626 |
# |
| 627 |
# See `Function call tree for constructing package dependency graph`_. |
| 628 |
# |
| 629 |
macro(tribits_set_package_regression_email_list PACKAGE_NAME) |
| 630 |
|
| 631 |
# Lower-case package name To be used with auto email naming based on base email address |
| 632 |
string(TOLOWER "${PACKAGE_NAME}" LPACKAGE) |
| 633 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 634 |
print_var(REGRESSION_EMAIL_LIST) |
| 635 |
endif() |
| 636 |
|
| 637 |
tribits_get_repo_name(${${PACKAGE_NAME}_PARENT_REPOSITORY} REPOSITORY_NAME) |
| 638 |
|
| 639 |
if(${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST) |
| 640 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST |
| 641 |
${${REPOSITORY_NAME}_REPOSITORY_OVERRIDE_PACKAGE_EMAIL_LIST}) |
| 642 |
elseif (REGRESSION_EMAIL_LIST) |
| 643 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST ${REGRESSION_EMAIL_LIST}) |
| 644 |
elseif (${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE) |
| 645 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST |
| 646 |
"${LPACKAGE}-regression@${${REPOSITORY_NAME}_REPOSITORY_EMAIL_URL_ADDRESS_BASE}") |
| 647 |
elseif (${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS) |
| 648 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST |
| 649 |
"${${REPOSITORY_NAME}_REPOSITORY_MASTER_EMAIL_ADDRESS}") |
| 650 |
elseif (${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE) |
| 651 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST |
| 652 |
"${LPACKAGE}-regression@${${PROJECT_NAME}_PROJECT_EMAIL_URL_ADDRESS_BASE}") |
| 653 |
elseif (${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS) |
| 654 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST |
| 655 |
"${${PROJECT_NAME}_PROJECT_MASTER_EMAIL_ADDRESS}") |
| 656 |
else() |
| 657 |
set(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST "") |
| 658 |
endif() |
| 659 |
|
| 660 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 661 |
print_var(${PACKAGE_NAME}_REGRESSION_EMAIL_LIST) |
| 662 |
endif() |
| 663 |
|
| 664 |
endmacro() |
| 665 |
|
| 666 |
|
| 667 |
# @FUNCTION: tribits_abort_on_missing_package() |
| 668 |
# |
| 669 |
# Usage:: |
| 670 |
# |
| 671 |
# tribits_abort_on_missing_package(<depPkg> <packageName>) |
| 672 |
# |
| 673 |
# Function that creates error message about missing/misspelled package. This |
| 674 |
# error message also suggests that the package might be defining an upstream |
| 675 |
# dependency on a downstream dependency (i.e. a circular dependency). |
| 676 |
# |
| 677 |
# See `Function call tree for constructing package dependency graph`_. |
| 678 |
# |
| 679 |
function(tribits_abort_on_missing_package depPkg packageName) |
| 680 |
multiline_set(ERRMSG |
| 681 |
"Error, the package '${depPkg}' is listed as a dependency of the package" |
| 682 |
" '${packageName}' but the package '${depPkg}' is either not defined or" |
| 683 |
" is listed later in the package order." |
| 684 |
" This may also be an attempt to create a circular dependency between" |
| 685 |
" the packages '${depPkg}' and '${packageName}' (which is not allowed)." |
| 686 |
" Check the spelling of '${depPkg}' or see how it is listed in" |
| 687 |
" a call to tribits_repository_define_packages() in relation to" |
| 688 |
" '${packageName}'." |
| 689 |
" To ignore/disable the undefined package '${depPkg}', set the cache" |
| 690 |
" variable ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES=IGNORE." |
| 691 |
) |
| 692 |
message(${${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES} "${ERRMSG}") |
| 693 |
endfunction() |
| 694 |
|
| 695 |
|
| 696 |
# @FUNCTION: tribits_abort_on_self_dep() |
| 697 |
# |
| 698 |
# Usage:: |
| 699 |
# |
| 700 |
# tribits_abort_on_self_dep(<packageName> <depPkgListName>) |
| 701 |
# |
| 702 |
# Prints a fatal error message for an attempt for a self dependency |
| 703 |
# declaration and which list it comes from. |
| 704 |
# |
| 705 |
# See `Function call tree for constructing package dependency graph`_. |
| 706 |
# |
| 707 |
function(tribits_abort_on_self_dep PACKAGE_NAME DEP_PKG_LIST_NAME) |
| 708 |
multiline_set(ERRMSG |
| 709 |
"Error, the package '${PACKAGE_NAME}' is listed as a dependency of itself" |
| 710 |
" in the list '${DEP_PKG_LIST_NAME}'!") |
| 711 |
message(FATAL_ERROR ${ERRMSG}) |
| 712 |
endfunction() |
| 713 |
|
| 714 |
|
| 715 |
################################################################################ |
| 716 |
# Macros/functions for processing dependency info for subpackages |
| 717 |
################################################################################ |
| 718 |
|
| 719 |
|
| 720 |
# @MACRO: tribits_parse_subpackages_append_packages_add_options() |
| 721 |
# |
| 722 |
# Usage:: |
| 723 |
# |
| 724 |
# tribits_parse_subpackages_append_packages_add_options(<parentPackageName>) |
| 725 |
# |
| 726 |
# Macro that parses the read-in variable |
| 727 |
# ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS`` set by the macro |
| 728 |
# `tribits_package_define_dependencies()`_ , adds subpackages to the list of |
| 729 |
# defined packages, and defines user cache var options for those subpackages. |
| 730 |
# |
| 731 |
# This sets the list variables for the parent package |
| 732 |
# ``<parentPackageName>``:: |
| 733 |
# |
| 734 |
# <parentPackageName>_SUBPACKAGES |
| 735 |
# <parentPackageName>_SUBPACKAGE_DIRS |
| 736 |
# <parentPackageName>_SUBPACKAGE_OPTREQ |
| 737 |
# |
| 738 |
# For each subpackage ``<subpackageFullName>``, this sets:: |
| 739 |
# |
| 740 |
# <subpackageFullName>_SOURCE_DIR |
| 741 |
# <subpackageFullName>_REL_SOURCE_DIR |
| 742 |
# <subpackageFullName>_PARENT_PACKAGE |
| 743 |
# <subpackageFullName>_PARENT_REPOSITORY |
| 744 |
# |
| 745 |
# And it appends each subpackage to the list variable: |
| 746 |
# |
| 747 |
# * `${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES`_ |
| 748 |
# |
| 749 |
# See `Function call tree for constructing package dependency graph`_. |
| 750 |
# |
| 751 |
macro(tribits_parse_subpackages_append_packages_add_options parentPackageName) |
| 752 |
|
| 753 |
# Fields in the list var SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS |
| 754 |
set(SPDC_SP_NAME_OFFSET 0) |
| 755 |
set(SPDC_SP_DIR_OFFSET 1) |
| 756 |
set(SPDC_SP_CLASSIFICATION_OFFSET 2) |
| 757 |
set(SPDC_SP_OPTREQ_OFFSET 3) |
| 758 |
set(SPDC_NUM_FIELDS 4) # Number of the above files |
| 759 |
|
| 760 |
set(${parentPackageName}_SUBPACKAGES "") |
| 761 |
set(${parentPackageName}_SUBPACKAGE_DIRS "") |
| 762 |
set(${parentPackageName}_SUBPACKAGE_OPTREQ "") |
| 763 |
|
| 764 |
if (SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) |
| 765 |
|
| 766 |
list(LENGTH SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS SPDC_TOTAL_LENGTH) |
| 767 |
math(EXPR numSubpackages "${SPDC_TOTAL_LENGTH}/${SPDC_NUM_FIELDS}") |
| 768 |
math(EXPR subpackagesLastIdx "${numSubpackages}-1") |
| 769 |
|
| 770 |
foreach(SUBPACKAGE_IDX RANGE ${subpackagesLastIdx}) |
| 771 |
|
| 772 |
# subpkgName |
| 773 |
math(EXPR subpkgNameIdx |
| 774 |
"${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_NAME_OFFSET}") |
| 775 |
list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${subpkgNameIdx} subpkgName) |
| 776 |
|
| 777 |
# subpkgFullname |
| 778 |
set(subpkgFullname ${parentPackageName}${subpkgName}) |
| 779 |
|
| 780 |
# subpkgDir |
| 781 |
math(EXPR subpkgDirIdx |
| 782 |
"${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_DIR_OFFSET}") |
| 783 |
list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${subpkgDirIdx} subpkgDir) |
| 784 |
|
| 785 |
# subpkgClassification |
| 786 |
math(EXPR subpkgClassificationIdx |
| 787 |
"${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_CLASSIFICATION_OFFSET}") |
| 788 |
list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${subpkgClassificationIdx} |
| 789 |
subpkgClassification ) |
| 790 |
|
| 791 |
# ToDo: Parse out TESTGROUP and MATURITYLEVEL (Trilinos #6042) |
| 792 |
set(subpkgTestgroup ${subpkgClassification}) |
| 793 |
|
| 794 |
tribits_update_ps_pt_ss_st(Subpackage ${subpkgFullname} subpkgTestgroup) |
| 795 |
|
| 796 |
# subpkgOptreq |
| 797 |
math(EXPR subpkgOptreqIdx |
| 798 |
"${SUBPACKAGE_IDX}*${SPDC_NUM_FIELDS}+${SPDC_SP_OPTREQ_OFFSET}") |
| 799 |
list(GET SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS ${subpkgOptreqIdx} |
| 800 |
subpkgOptreq ) |
| 801 |
|
| 802 |
# Determine if this subpackage exists |
| 803 |
set(subpkgFullSrcDir |
| 804 |
"${PROJECT_SOURCE_DIR}/${${parentPackageName}_REL_SOURCE_DIR}/${subpkgDir}") |
| 805 |
if (EXISTS "${subpkgFullSrcDir}") |
| 806 |
set(subpkgExists TRUE) |
| 807 |
else() |
| 808 |
set(subpkgExists FALSE) |
| 809 |
endif() |
| 810 |
|
| 811 |
if (NOT subpkgExists AND ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST |
| 812 |
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST |
| 813 |
) |
| 814 |
message(SEND_ERROR "ERROR: Subpackage dir '${subpkgFullSrcDir}' is missing!") |
| 815 |
endif() |
| 816 |
|
| 817 |
# Append to lists and global variables |
| 818 |
|
| 819 |
if (subpkgExists) |
| 820 |
|
| 821 |
list(APPEND ${parentPackageName}_SUBPACKAGES ${subpkgName}) |
| 822 |
list(APPEND ${parentPackageName}_SUBPACKAGE_DIRS ${subpkgDir}) |
| 823 |
list(APPEND ${parentPackageName}_SUBPACKAGE_OPTREQ ${subpkgOptreq}) |
| 824 |
list(APPEND ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES ${subpkgFullname}) |
| 825 |
set(${subpkgFullname}_SOURCE_DIR "${subpkgFullSrcDir}") |
| 826 |
set(${subpkgFullname}_REL_SOURCE_DIR |
| 827 |
"${${parentPackageName}_REL_SOURCE_DIR}/${subpkgDir}") |
| 828 |
set(${subpkgFullname}_PARENT_PACKAGE ${parentPackageName}) |
| 829 |
set(${subpkgFullname}_PARENT_REPOSITORY |
| 830 |
${${parentPackageName}_PARENT_REPOSITORY}) |
| 831 |
|
| 832 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE) |
| 833 |
print_var(${subpkgFullname}_PARENT_PACKAGE) |
| 834 |
print_var(${subpkgFullname}_PARENT_REPOSITORY) |
| 835 |
endif() |
| 836 |
|
| 837 |
set(${subpkgFullname}_PACKAGE_BUILD_STATUS INTERNAL) |
| 838 |
|
| 839 |
# Set up the input options for this subpackage |
| 840 |
tribits_insert_standard_package_options(${subpkgFullname} ${subpkgTestgroup}) |
| 841 |
|
| 842 |
endif() |
| 843 |
|
| 844 |
endforeach() |
| 845 |
|
| 846 |
endif() |
| 847 |
|
| 848 |
endmacro() |
| 849 |
|
| 850 |
|
| 851 |
# @MACRO: tribits_read_package_subpackage_deps_files_add_to_graph() |
| 852 |
# |
| 853 |
# Usage:: |
| 854 |
# |
| 855 |
# tribits_read_package_subpackage_deps_files_add_to_graph(<toplevelPackageName>) |
| 856 |
# |
| 857 |
# Read in subpackages dependencies files and add to dependencies graph |
| 858 |
# variables. |
| 859 |
# |
| 860 |
# See `Function call tree for constructing package dependency graph`_. |
| 861 |
# |
| 862 |
macro(tribits_read_package_subpackage_deps_files_add_to_graph PACKAGE_NAME) |
| 863 |
|
| 864 |
set(SUBPACKAGE_IDX 0) |
| 865 |
foreach(TRIBITS_SUBPACKAGE IN LISTS ${PACKAGE_NAME}_SUBPACKAGES) |
| 866 |
list(GET ${PACKAGE_NAME}_SUBPACKAGE_DIRS ${SUBPACKAGE_IDX} SUBPACKAGE_DIR) |
| 867 |
tribits_read_subpackage_deps_file_add_to_graph(${TRIBITS_PACKAGE} |
| 868 |
${TRIBITS_SUBPACKAGE} ${SUBPACKAGE_DIR}) |
| 869 |
math(EXPR SUBPACKAGE_IDX "${SUBPACKAGE_IDX}+1") |
| 870 |
endforeach() |
| 871 |
|
| 872 |
endmacro() |
| 873 |
|
| 874 |
|
| 875 |
# @MACRO: tribits_read_subpackage_deps_file_add_to_graph() |
| 876 |
# |
| 877 |
# Usage:: |
| 878 |
# |
| 879 |
# tribits_read_subpackage_deps_file_add_to_graph(<toplevelPackageName> |
| 880 |
# <subpackageName> <subpackageDir>) |
| 881 |
# |
| 882 |
# Macro that reads in a single subpackage dependencies file |
| 883 |
# `<packageDir>/<spkgDir>/cmake/Dependencies.cmake`_ and sets up the |
| 884 |
# dependency structure for it. |
| 885 |
# |
| 886 |
# See `Function call tree for constructing package dependency graph`_. |
| 887 |
# |
| 888 |
macro(tribits_read_subpackage_deps_file_add_to_graph PACKAGE_NAME |
| 889 |
SUBPACKAGE_NAME SUBPACKAGE_DIR |
| 890 |
) |
| 891 |
|
| 892 |
set(SUBPACKAGE_FULLNAME ${PACKAGE_NAME}${SUBPACKAGE_NAME}) |
| 893 |
|
| 894 |
# |
| 895 |
# A) Get ready to read in the contents of this this subpackage's |
| 896 |
# Dependencies.cmake file |
| 897 |
# |
| 898 |
|
| 899 |
tribits_prep_to_read_dependencies(${SUBPACKAGE_FULLNAME}) |
| 900 |
|
| 901 |
# NOTE: Subpackages use the regression email list from the parent package. |
| 902 |
|
| 903 |
# NOTE: Subpackages are not allowed to have subpackages! |
| 904 |
set(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS) |
| 905 |
|
| 906 |
# |
| 907 |
# B) Read in this subpackage's Dependencies file |
| 908 |
# |
| 909 |
|
| 910 |
set(SUBPACKAGE_FULL_DIR "${${PACKAGE_NAME}_REL_SOURCE_DIR}/${SUBPACKAGE_DIR}") |
| 911 |
|
| 912 |
set(SUBPACKAGE_ABS_DIR "${PROJECT_SOURCE_DIR}/${SUBPACKAGE_FULL_DIR}") |
| 913 |
set(SUBPAKCAGE_DEPENDENCIES_FILE "${SUBPACKAGE_ABS_DIR}/cmake/Dependencies.cmake") |
| 914 |
|
| 915 |
if (EXISTS ${SUBPAKCAGE_DEPENDENCIES_FILE}) |
| 916 |
set(SUBPACKAGE_EXISTS TRUE) |
| 917 |
else() |
| 918 |
set(SUBPACKAGE_EXISTS FALSE) |
| 919 |
endif() |
| 920 |
|
| 921 |
if (SUBPACKAGE_EXISTS OR ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST |
| 922 |
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST |
| 923 |
) |
| 924 |
|
| 925 |
tribits_trace_file_processing(PACKAGE INCLUDE "${SUBPAKCAGE_DEPENDENCIES_FILE}") |
| 926 |
include(${SUBPAKCAGE_DEPENDENCIES_FILE}) |
| 927 |
|
| 928 |
tribits_assert_read_dependency_vars(${SUBPACKAGE_FULLNAME}) |
| 929 |
|
| 930 |
tribits_process_package_dependencies_lists(${SUBPACKAGE_FULLNAME}) |
| 931 |
|
| 932 |
set(${SUBPACKAGE_FULLNAME}_IS_TRIBITS_COMPLIANT TRUE) |
| 933 |
|
| 934 |
set(${SUBPACKAGE_FULLNAME}_REGRESSION_EMAIL_LIST |
| 935 |
${${PACKAGE_NAME}_REGRESSION_EMAIL_LIST}) |
| 936 |
|
| 937 |
endif() |
| 938 |
|
| 939 |
endmacro() |
| 940 |
|
| 941 |
|
| 942 |
# |
| 943 |
# Private utility functions |
| 944 |
# |
| 945 |
|
| 946 |
|
| 947 |
# Function that sets a variable to DECLARED-UNDEFINED |
| 948 |
# |
| 949 |
function(tribits_declare_undefined VAR_NAME) |
| 950 |
set(${VAR_NAME} DECLARED-UNDEFINED PARENT_SCOPE) |
| 951 |
endfunction() |
| 952 |
|
| 953 |
|
| 954 |
# Function that asserts that a package dependency variable is defined |
| 955 |
# correctly |
| 956 |
# |
| 957 |
function(tribits_assert_defined_package_var PACKAGE_VAR PACKAGE_NAME) |
| 958 |
if (${PACKAGE_VAR} STREQUAL DECLARED-UNDEFINED) |
| 959 |
message(FATAL_ERROR |
| 960 |
"Error, the package variable ${PACKAGE_VAR} was not defined correctly for package ${PACKAGE_NAME}!" |
| 961 |
) |
| 962 |
endif() |
| 963 |
endfunction() |