| 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 |
|
| 11 |
include(PrintNonemptyVarWithSpaces) |
| 12 |
|
| 13 |
|
| 14 |
# @FUNCTION: tribits_print_initial_dependency_info() |
| 15 |
# |
| 16 |
# Usage:: |
| 17 |
# |
| 18 |
# tribits_print_initial_dependency_info() |
| 19 |
# |
| 20 |
# Function that prints whatever initial dependency information that is |
| 21 |
# available that is requested by the user after the initial construction of |
| 22 |
# the package dependency graph but **before** the call of |
| 23 |
# `tribits_adjust_package_enables()`_. |
| 24 |
# |
| 25 |
# Calls: |
| 26 |
# |
| 27 |
# * `tribits_print_tentatively_enabled_tpls()`_ |
| 28 |
# * `tribits_dump_package_dependencies_info()`_ |
| 29 |
# |
| 30 |
function(tribits_print_initial_dependency_info) |
| 31 |
tribits_print_tentatively_enabled_tpls() |
| 32 |
tribits_dump_package_dependencies_info() |
| 33 |
endfunction() |
| 34 |
|
| 35 |
|
| 36 |
# @FUNCTION: tribits_print_tentatively_enabled_tpls() |
| 37 |
# |
| 38 |
# Usage:: |
| 39 |
# |
| 40 |
# tribits_print_tentatively_enabled_tpls() |
| 41 |
# |
| 42 |
# Function that print the set of tentatively enabled TPLs. |
| 43 |
# |
| 44 |
# Does **not** modify any state! |
| 45 |
# |
| 46 |
function(tribits_print_tentatively_enabled_tpls) |
| 47 |
foreach(TPL ${${PROJECT_NAME}_DEFINED_TPLS}) |
| 48 |
if (TPL_TENTATIVE_ENABLE_${TPL}) |
| 49 |
message("-- Tentatively enabling TPL '${TPL}'") |
| 50 |
#print_var(TPL_ENABLE_${TPL}) |
| 51 |
endif() |
| 52 |
endforeach() |
| 53 |
endfunction() |
| 54 |
|
| 55 |
|
| 56 |
# @FUNCTION: tribits_dump_package_dependencies_info() |
| 57 |
# |
| 58 |
# Usage: |
| 59 |
# |
| 60 |
# tribits_dump_package_dependencies_info() |
| 61 |
# |
| 62 |
# Function that dumps (prints to STDOUT) the package dependency info if |
| 63 |
# ``${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES==TRUE``. |
| 64 |
# |
| 65 |
# This function does **not** modify any state! |
| 66 |
# |
| 67 |
function(tribits_dump_package_dependencies_info) |
| 68 |
|
| 69 |
advanced_option(${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES |
| 70 |
"Dump the package dependency information." |
| 71 |
"${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) |
| 72 |
|
| 73 |
advanced_option(${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES |
| 74 |
"Dump the package forward dependency information." |
| 75 |
"${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) |
| 76 |
|
| 77 |
message("\nPackage dependencies information:") |
| 78 |
|
| 79 |
tribits_print_project_list_var_and_num(DEFINED_TPLS) |
| 80 |
tribits_print_project_list_var_and_num(DEFINED_INTERNAL_TOPLEVEL_PACKAGES) |
| 81 |
tribits_print_project_list_var_and_num(DEFINED_TOPLEVEL_PACKAGES) |
| 82 |
tribits_print_project_list_var_and_num(DEFINED_INTERNAL_PACKAGES) |
| 83 |
tribits_print_project_list_var_and_num(DEFINED_PACKAGES) |
| 84 |
|
| 85 |
if (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) |
| 86 |
message("") |
| 87 |
foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_DEFINED_PACKAGES}) |
| 88 |
tribits_print_package_dependencies(${TRIBITS_PACKAGE}) |
| 89 |
message("") |
| 90 |
endforeach() |
| 91 |
endif() |
| 92 |
|
| 93 |
endfunction() |
| 94 |
|
| 95 |
|
| 96 |
# Optionally print out a global project list var with spaces and |
| 97 |
# unconditionally print out the number of items in that list |
| 98 |
# |
| 99 |
function(tribits_print_project_list_var_and_num listVarSuffix) |
| 100 |
message("") |
| 101 |
if (${PROJECT_NAME}_DUMP_PACKAGE_DEPENDENCIES) |
| 102 |
print_nonempty_var_with_spaces(${PROJECT_NAME}_${listVarSuffix} wasPrinted) |
| 103 |
endif() |
| 104 |
print_var(${PROJECT_NAME}_NUM_${listVarSuffix}) |
| 105 |
endfunction() |
| 106 |
|
| 107 |
|
| 108 |
# Print out dependencies for a package |
| 109 |
# |
| 110 |
function(tribits_print_package_dependencies packageName) |
| 111 |
|
| 112 |
set(printedVar "") |
| 113 |
|
| 114 |
# Print deps vars |
| 115 |
|
| 116 |
if (printedVar) |
| 117 |
message("") |
| 118 |
endif() |
| 119 |
|
| 120 |
tribits_print_nonempty_package_deps_list(${packageName} LIB DEFINED printedVar) |
| 121 |
tribits_print_nonempty_package_deps_list(${packageName} TEST DEFINED printedVar) |
| 122 |
|
| 123 |
if (${PROJECT_NAME}_DUMP_FORWARD_PACKAGE_DEPENDENCIES) |
| 124 |
tribits_print_nonempty_package_forward_defined_deps_list(${packageName} LIB |
| 125 |
printedVar) |
| 126 |
tribits_print_nonempty_package_forward_defined_deps_list(${packageName} TEST |
| 127 |
printedVar) |
| 128 |
endif() |
| 129 |
|
| 130 |
if (NOT printedVar) |
| 131 |
message("-- ${packageName}: No defined dependencies!") |
| 132 |
endif() |
| 133 |
|
| 134 |
endfunction() |
| 135 |
|
| 136 |
|
| 137 |
# Print out a dependency list including if each item is optional or required |
| 138 |
# ('R' or 'O') |
| 139 |
# |
| 140 |
# Usage:: |
| 141 |
# |
| 142 |
# tribits_print_nonempty_package_deps_list(<packageName> <libOrTest> |
| 143 |
# <printedListOut>) |
| 144 |
# |
| 145 |
# which prints out the list:: |
| 146 |
# |
| 147 |
# <packageName>_<libOrTest>_DEFINED_DEPENDENCIES |
| 148 |
# |
| 149 |
# if it is non-empty. |
| 150 |
# |
| 151 |
function(tribits_print_nonempty_package_deps_list packageName |
| 152 |
libOrTest definedOrEnabled printedListOut |
| 153 |
) |
| 154 |
set(depsListName ${packageName}_${libOrTest}_${definedOrEnabled}_DEPENDENCIES) |
| 155 |
if (NOT "${${depsListName}}" STREQUAL "") |
| 156 |
set(lineStr "-- ${depsListName}:") |
| 157 |
foreach (depPkg IN LISTS ${depsListName}) |
| 158 |
string(APPEND lineStr " ${depPkg}") |
| 159 |
if (${packageName}_${libOrTest}_DEP_REQUIRED_${depPkg}) |
| 160 |
string(APPEND lineStr "[R]") |
| 161 |
else() |
| 162 |
string(APPEND lineStr "[O]") |
| 163 |
endif() |
| 164 |
endforeach() |
| 165 |
message("${lineStr}") |
| 166 |
set(${printedListOut} TRUE PARENT_SCOPE) |
| 167 |
endif() |
| 168 |
endfunction() |
| 169 |
|
| 170 |
|
| 171 |
# Print out a forward dependency list including if each item is optional or |
| 172 |
# required ('R' or 'O') |
| 173 |
# |
| 174 |
# Usage:: |
| 175 |
# |
| 176 |
# tribits_print_nonempty_package_forward_defined_deps_list(<packageName> <libOrTest> |
| 177 |
# <printedListOut>) |
| 178 |
# |
| 179 |
# which prints out the list:: |
| 180 |
# |
| 181 |
# <packageName>_FORWARD_<libOrTest>_DEFINED_DEPENDENCIES |
| 182 |
# |
| 183 |
# if it is non-empty. |
| 184 |
# |
| 185 |
function(tribits_print_nonempty_package_forward_defined_deps_list packageName |
| 186 |
libOrTest printedListOut |
| 187 |
) |
| 188 |
set(fwdDepsListName ${packageName}_FORWARD_${libOrTest}_DEFINED_DEPENDENCIES) |
| 189 |
if (NOT "${${fwdDepsListName}}" STREQUAL "") |
| 190 |
set(lineStr "-- ${fwdDepsListName}:") |
| 191 |
foreach (fwdDepPkg IN LISTS ${fwdDepsListName}) |
| 192 |
string(APPEND lineStr " ${fwdDepPkg}") |
| 193 |
if (${fwdDepPkg}_${libOrTest}_DEP_REQUIRED_${packageName}) |
| 194 |
string(APPEND lineStr "[R]") |
| 195 |
else() |
| 196 |
string(APPEND lineStr "[O]") |
| 197 |
endif() |
| 198 |
endforeach() |
| 199 |
message("${lineStr}") |
| 200 |
set(${printedListOut} TRUE PARENT_SCOPE) |
| 201 |
endif() |
| 202 |
endfunction() |
| 203 |
|
| 204 |
|
| 205 |
# LocalWords: TRIBITS |