Skip to content

Commit

Permalink
Merge pull request #583 from TriBITSPub/63-deprecate-tpls-deps-list
Browse files Browse the repository at this point in the history
Allow TPLs to be listed in LIB_[REQUIRED|OPTIONAL]_PACKAGES (#63)
  • Loading branch information
bartlettroscoe authored Jun 7, 2023
2 parents b669da7 + 2dd9509 commit a0d4293
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Package dependencies information:
-- Ifpack_FORWARD_LIB_DEFINED_DEPENDENCIES: ML[O] Stratimikos[O]
-- Ifpack_FORWARD_TEST_DEFINED_DEPENDENCIES: Belos[O] Phalanx[O]

-- ML_LIB_DEFINED_DEPENDENCIES: Teuchos[O] Epetra[O] Zoltan[O] Galeri[O] Amesos[O] Ifpack[O] AztecOO[O] EpetraExt[O] Isorropia[O] BLAS[R] LAPACK[R] MPI[O] METIS[O] ParMETIS[O] PETSC[O]
-- ML_LIB_DEFINED_DEPENDENCIES: BLAS[R] LAPACK[R] Teuchos[O] Epetra[O] Zoltan[O] Galeri[O] Amesos[O] Ifpack[O] AztecOO[O] EpetraExt[O] Isorropia[O] MPI[O] METIS[O] ParMETIS[O] PETSC[O]
-- ML_TEST_DEFINED_DEPENDENCIES: METIS[O] ParMETIS[O]
-- ML_FORWARD_LIB_DEFINED_DEPENDENCIES: Stratimikos[O]
-- ML_FORWARD_TEST_DEFINED_DEPENDENCIES: Belos[O]
Expand All @@ -158,13 +158,13 @@ Package dependencies information:
-- Stratimikos_TEST_DEFINED_DEPENDENCIES: Triutils[O]
-- Stratimikos_FORWARD_TEST_DEFINED_DEPENDENCIES: Panzer[O]

-- RBGen_LIB_DEFINED_DEPENDENCIES: Teuchos[R] Epetra[O] EpetraExt[O] DUMMY[R]
-- RBGen_LIB_DEFINED_DEPENDENCIES: Teuchos[R] DUMMY[R] Epetra[O] EpetraExt[O]

-- Phalanx_LIB_DEFINED_DEPENDENCIES: Teuchos[R] Shards[R] Sacado[R] Boost[R]
-- Phalanx_TEST_DEFINED_DEPENDENCIES: Belos[O] Epetra[O] Ifpack[O] Intrepid[O] TVMET[O]
-- Phalanx_FORWARD_LIB_DEFINED_DEPENDENCIES: Panzer[R]

-- Panzer_LIB_DEFINED_DEPENDENCIES: Teuchos[R] Sacado[R] Phalanx[R] Intrepid[R] Thyra[R] Tpetra[R] Epetra[R] EpetraExt[R] Stokhos[O] MPI[R] Boost[R]
-- Panzer_LIB_DEFINED_DEPENDENCIES: Teuchos[R] Sacado[R] Phalanx[R] Intrepid[R] Thyra[R] Tpetra[R] Epetra[R] EpetraExt[R] MPI[R] Boost[R] Stokhos[O]
-- Panzer_TEST_DEFINED_DEPENDENCIES: Stratimikos[O]

Dumping direct enabled dependencies for each package ...
Expand Down Expand Up @@ -255,13 +255,13 @@ Dumping direct enabled dependencies for each package ...

-- Ifpack_LIB_ENABLED_DEPENDENCIES: Teuchos[R] Epetra[R] Amesos[O] AztecOO[O]

-- ML_LIB_ENABLED_DEPENDENCIES: Teuchos[O] Epetra[O] Zoltan[O] Galeri[O] Amesos[O] Ifpack[O] AztecOO[O] EpetraExt[O] Isorropia[O] BLAS[R] LAPACK[R]
-- ML_LIB_ENABLED_DEPENDENCIES: BLAS[R] LAPACK[R] Teuchos[O] Epetra[O] Zoltan[O] Galeri[O] Amesos[O] Ifpack[O] AztecOO[O] EpetraExt[O] Isorropia[O]

-- Belos: No enabled dependencies!

-- Stratimikos_LIB_ENABLED_DEPENDENCIES: ThyraEpetraExt[R] ThyraCoreLibs[R] Amesos[O] AztecOO[O] Ifpack[O] ML[O]

-- RBGen_LIB_ENABLED_DEPENDENCIES: Teuchos[R] Epetra[O] EpetraExt[O] DUMMY[R]
-- RBGen_LIB_ENABLED_DEPENDENCIES: Teuchos[R] DUMMY[R] Epetra[O] EpetraExt[O]

-- Phalanx: No enabled dependencies!

Expand Down
2 changes: 1 addition & 1 deletion test/core/TribitsAdjustPackageEnables_UnitTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function(unittest_enable_all_packages_st_extra_test_deps)
unittest_compare_const(Ex2Package2_LIB_DEFINED_DEPENDENCIES "Teuchos;Ex2Package1")
unittest_compare_const(Ex2Package2_TEST_ENABLED_DEPENDENCIES "")
unittest_compare_const(Ex2Package2_TEST_DEFINED_DEPENDENCIES
"Teuchos;RTOp;Ex2Package1;Boost;MPI;Boost")
"Teuchos;Boost;RTOp;Ex2Package1;MPI;Boost")

endfunction()

Expand Down
16 changes: 15 additions & 1 deletion tribits/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@
ChangeLog for TriBITS
----------------------------------------

## 2023-5-03:
## 2023-06-02:

* **Added/Deprecated:** External packages/TPLs can now be (and should be)
listed in the `[TEST|LIB]_[REQUIRED|OPTIONAL]_PACKAGES` arguments/lists in
the macro `tribits_package_define_dependencies()` and the
`[TEST|LIB]_[REQUIRED|OPTIONAL]_TPLS` arguments/lists are deprecated (but
with no deprecation warning yet). This makes it easier to write
`<packageDir>/cmake/Dependencies.cmake` files for packages where the set of
internal and external upstream dependent packages is dynamic and changes
depending on the TriBITS project where these package are configured under.
(And conceptually, a downstream package should not care if an upstream
dependent package is pulled in as an external package or built as an
internal package.)

## 2023-05-03:

* **Added:** Added support for non-fully TriBITS-compatible external packages.
Now, a `<Package>Config.cmake` file need not define
Expand Down
88 changes: 37 additions & 51 deletions tribits/core/package_arch/TribitsPackageDefineDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ include(TribitsGeneralMacros)
# [LIB_OPTIONAL_TPLS <tpl1> <tpl2> ...]
# [TEST_REQUIRED_TPLS <tpl1> <tpl2> ...]
# [TEST_OPTIONAL_TPLS <tpl1> <tpl2> ...]
# [REGRESSION_EMAIL_LIST <regression-email-address>]
# [SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
# <spkg1_name> <spkg1_dir> <spkg1_classifications> <spkg1_optreq>
# <spkg2_name> <spkg2_dir> <spkg2_classifications> <spkg2_optreq>
# ...
# ]
# [REGRESSION_EMAIL_LIST <regression-email-address>]
# )
#
# Every argument in this macro is optional (that is, an package can have no
Expand All @@ -84,49 +84,62 @@ include(TribitsGeneralMacros)
# ``TEST_REQUIRED_PACKAGES``
#
# List of additional upstream packages that must be enabled in order to
# build and/or run the tests and/or examples in this package. If any
# of these upstream packages are not enabled, then there will be no
# tests or examples defined or run for this package.
# build and/or run the tests and/or examples in this package. If any of
# these upstream packages are not enabled, then there will be no tests or
# examples defined or run for this package.
#
# ``TEST_OPTIONAL_PACKAGES``
#
# List of additional optional upstream packages that can be used by the
# tests in this package. These upstream packages need not be enabled in
# order to run some basic tests or examples for this package. Typically,
# extra tests that depend on optional test packages involve integration
# testing of some type.
# testing of some type. Not enabling these optional upstream packages
# will result in diminished tests or examples.
#
# ``LIB_REQUIRED_TPLS``
#
# List of required upstream TPLs that must be enabled in order to build
# and use the libraries (or capabilities) in this package.
# **DEPRECATED:** List of required upstream TPLs that must be enabled in
# order to build and use the libraries (or capabilities) in this package.
# (Add these to ``LIB_REQUIRED_PACKAGES`` instead.)
#
# ``LIB_OPTIONAL_TPLS``
#
# List of additional optional upstream TPLs that can be used in this
# package if enabled. These upstream TPLs need not be enabled in order to
# use this package but not enabling one or more of these optional upstream
# TPLs will result in diminished capabilities of this package.
# **DEPRECATED:** List of additional optional upstream TPLs that can be
# used in this package if enabled. These upstream TPLs need not be
# enabled in order to use this package but not enabling one or more of
# these optional upstream TPLs will result in diminished capabilities of
# this package. (Add these to ``LIB_OPTIONAL_PACKAGES`` instead.)
#
# ``TEST_REQUIRED_TPLS``
#
# List of additional upstream TPLs that must be enabled in order to build
# and/or run the tests and/or examples in this package. If any of
# these upstream TPLs are not enabled, then there will be no tests or
# examples defined or run for this package.
# **DEPRECATED:** List of additional upstream TPLs that must be enabled in
# order to build and/or run the tests and/or examples in this package. If
# any of these upstream TPLs are not enabled, then there will be no tests
# or examples defined or run for this package. (Add these to
# ``TEST_REQUIRED_PACKAGES`` instead.)
#
# ``TEST_OPTIONAL_TPLS``
#
# List of additional optional upstream TPLs that can be used by the tests
# in this package. These upstream TPLs need not be enabled in order to
# run basic tests for this package. Typically, extra tests that depend
# on optional TPLs involve integration testing or some additional testing
# of some type.
# **DEPRECATED:** List of additional optional upstream TPLs that can be
# used by the tests in this package. These upstream TPLs need not be
# enabled in order to run basic tests for this package. Typically, extra
# tests that depend on optional TPLs involve integration testing or some
# additional testing of some type. (Add these to
# ``TEST_OPTIONAL_PACKAGES`` instead.)
#
# NOTE: The ``XXX_TPLS`` arguments/lists are **deprecated**. At the package
# level, there is no distinction between upstream internal and external
# packages (i.e. TPLs) so all upstream package dependencies can (and should)
# be listed in the ``XXX_PACKAGES`` arguments/lists. (There is no change in
# behavior listing upstream packages in ``XXX_PACKAGES`` or the ``XXX_TPLS``
# arguments/lists.)
#
# Only upstream packages can be listed (as defined by the order the packages
# are listed in `tribits_repository_define_packages()`_ in the
# `<repoDir>/PackagesList.cmake`_ file). Otherwise an error will occur and
# processing will stop. Misspelled package names are caught as well.
# `<repoDir>/PackagesList.cmake`_ or `<repoDir>/TPLsList.cmake`_ files).
# Otherwise an error will occur and processing will stop. Misspelled package
# names are caught as well.
#
# Only direct package dependencies need to be listed. Indirect package
# dependencies are automatically handled. For example, if this package
Expand All @@ -136,14 +149,10 @@ include(TribitsGeneralMacros)
# The dependency on ``PKG1`` will be taken care of automatically by the
# TriBITS dependency management system.
#
# However, currently, all TPL dependencies must be listed, even the indirect
# ones. This is a requirement that will be dropped in a future version of
# TriBITS.
#
# The packages listed in ``LIB_REQUIRED_PACKAGES`` are implicitly also
# dependencies in ``TEST_REQUIRED_PACKAGES``. Likewise
# ``LIB_OPTIONAL_PACKAGES`` are implicitly also dependencies in
# ``TEST_OPTIONAL_PACKAGES``. Same goes for TPL dependencies.
# ``TEST_OPTIONAL_PACKAGES``.
#
# The upstream dependencies within a single list do not need to be listed in
# any order. For example if ``PKG2`` depends on ``PKG1``, and this given
Expand All @@ -153,9 +162,7 @@ include(TribitsGeneralMacros)
#
# or::
#
# "LIB_REQUIRED_PACKAGES PKG1 PKG2
#
# Likewise the order that dependent TPLs are listed is not significant.
# LIB_REQUIRED_PACKAGES PKG1 PKG2
#
# If some upstream packages are allowed to be missing, this can be specified
# by calling the macro `tribits_allow_missing_external_packages()`_.
Expand Down Expand Up @@ -199,27 +206,6 @@ include(TribitsGeneralMacros)
# argument is missing, then the email list that CDash errors go to is
# determined by other means (see `CDash regression email addresses`_).
#
# NOTE: All this macro really does is to just define the variables:
#
# * ``LIB_REQUIRED_DEP_PACKAGES``
# * ``LIB_OPTIONAL_DEP_PACKAGES``
# * ``TEST_REQUIRED_DEP_PACKAGES``
# * ``TEST_OPTIONAL_DEP_PACKAGES``
# * ``LIB_REQUIRED_DEP_TPLS``
# * ``LIB_OPTIONAL_DEP_TPLS``
# * ``TEST_REQUIRED_DEP_TPLS``
# * ``TEST_OPTIONAL_DEP_TPLS``
# * ``REGRESSION_EMAIL_LIST``
# * ``SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS``
#
# which are then read by the TriBITS cmake code to build the package
# dependency graph. The advantage of using this macro instead of just
# directly setting the variables is that an package only needs to list
# dependencies that exist. Otherwise, the ``Dependencies.cmake`` file will
# need to set all of the above local variables, even those that are empty.
# This is an error checking property of the TriBITS system to avoid misspelling
# the names of these variables.
#
macro(tribits_package_define_dependencies)

cmake_parse_arguments(
Expand Down
32 changes: 16 additions & 16 deletions tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,21 @@ macro(tribits_process_package_dependencies_lists packageName)
set(${packageName}_LIB_DEFINED_DEPENDENCIES "")
set(${packageName}_TEST_DEFINED_DEPENDENCIES "")

# Append the XXX_TPLS list on the end of the XXX_PACKAGES list
list(APPEND LIB_REQUIRED_DEP_PACKAGES ${LIB_REQUIRED_DEP_TPLS})
list(APPEND LIB_OPTIONAL_DEP_PACKAGES ${LIB_OPTIONAL_DEP_TPLS})
list(APPEND TEST_REQUIRED_DEP_PACKAGES ${TEST_REQUIRED_DEP_TPLS})
list(APPEND TEST_OPTIONAL_DEP_PACKAGES ${TEST_OPTIONAL_DEP_TPLS})
set(LIB_REQUIRED_DEP_TPLS "")
set(LIB_OPTIONAL_DEP_TPLS "")
set(TEST_REQUIRED_DEP_TPLS "")
set(TEST_OPTIONAL_DEP_TPLS "")

# Fill the backward dependency vars
tribits_set_dep_packages(${packageName} LIB REQUIRED PACKAGES)
tribits_set_dep_packages(${packageName} LIB OPTIONAL PACKAGES)
tribits_set_dep_packages(${packageName} LIB REQUIRED TPLS)
tribits_set_dep_packages(${packageName} LIB OPTIONAL TPLS)
tribits_set_dep_packages(${packageName} TEST REQUIRED PACKAGES)
tribits_set_dep_packages(${packageName} TEST OPTIONAL PACKAGES)
tribits_set_dep_packages(${packageName} TEST REQUIRED TPLS)
tribits_set_dep_packages(${packageName} TEST OPTIONAL TPLS)

# Fill forward deps lists #63
tribits_append_forward_dep_packages(${packageName} LIB)
Expand Down Expand Up @@ -512,7 +518,7 @@ macro(tribits_set_dep_packages packageName testOrLib requiredOrOptional pkgs
if (${depPkg} STREQUAL ${packageName})
tribits_abort_on_self_dep("${packageName}" "${inputListType}")
endif()
tribits_is_pkg_defined(${depPkg} ${pkgsOrTpls} depPkgIsDefined)
tribits_is_pkg_defined(${depPkg} depPkgIsDefined)
if (depPkgIsDefined)
list(APPEND ${packageName}_${testOrLib}_DEFINED_DEPENDENCIES ${depPkg})
if ("${requiredOrOptional}" STREQUAL "REQUIRED")
Expand All @@ -534,18 +540,12 @@ endmacro()

# Determine if a (internal or external) package is defined or not
#
function(tribits_is_pkg_defined depPkg pkgsOrTpls depPkgIsDefinedOut)
function(tribits_is_pkg_defined depPkg depPkgIsDefinedOut)
set(depPkgIsDefined FALSE)
if (pkgsOrTpls STREQUAL "PACKAGES")
if (${depPkg}_SOURCE_DIR)
set(depPkgIsDefined TRUE)
endif()
elseif(pkgsOrTpls STREQUAL "TPLS")
if (${depPkg}_FINDMOD)
set(depPkgIsDefined TRUE)
endif()
else()
message(FATAL_ERROR "Invalid value for pkgsOrTpls = '${pkgsOrTpls}'")
if (${depPkg}_SOURCE_DIR)
set(depPkgIsDefined TRUE)
elseif(${depPkg}_FINDMOD)
set(depPkgIsDefined TRUE)
endif()
set(${depPkgIsDefinedOut} ${depPkgIsDefined} PARENT_SCOPE)
endfunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ the dependencies for each external package/TPL and internal package:
This list of all **define direct** extra package test required and
optional upstream external package/TPL and internal package dependencies.
This list is set regardless if the package ``${PACKAGE_NAME}`` is enabled
or not.
or not. NOTE: This list does **not** contain the items in the list
`${PACKAGE_NAME}_LIB_DEFINED_DEPENDENCIES`_ (but those are implicitly also
required/optional test dependencies as well).

.. _${PACKAGE_NAME}_TEST_ENABLED_DEPENDENCIES:

Expand Down
Loading

0 comments on commit a0d4293

Please sign in to comment.