-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export informational variables to <Package>Config.cmake
files for downstream CMake projects
#516
Comments
…#516) This started failing for some reason and I have no idea why. This refactored command is better anyway.
This updates some existing tests for the export of selected package cache vars, including vars from parent package in subpackage <Package>Config.cmake files.
…iBITSPub#516) This provides a mechanism for packages to provide information about how they were configured to downstream CMake projects. Any cache vars set with tribits_add_option_and_define() are exported automatically but TriBITS packages can call tribits_pkg_export_cache_var(<cacheVarName>) to export any cache vars. See updated documentation for details.
These were pointed out by @KyleFromKitware in the review of PR TriBITSPub#520.
…b#516) I saw this while working on TriBITSPub#516.
Added macro tribits_assert_cache_and_local_vars_same_value(<cacheVarName>) (with strong unit tests) to ensure that if any exported cache vars also has local vars of the same name that they also have the same value. This was done in response to review of PR TriBITSPub#520 from @KyleFromKitware.
Add support for exporting package info vars into <Package>Config.cmake files (#516)
…g, refactor (TriBITSPub#516) In PR TriBITSPub#520, I accidentally put a requirement that the macro var name had to be set. Turns out, there is special logic for it to not be set. The documentation nor any TriBITS test hinted to this. But the file muelu/CMakeLists.txt actually calls tribits_add_option_and_define() with an empty macro var name. To catch this use case, I added unit tests (which will fail if you undo this patch). In order for the unit tests to cover what is needed, I had to factor out the function tribits_pkg_export_cache_var() into its own module TribitsPkgExportCacheVars.cmake so it could be included in the unit test driver. Then, I decided it would be a good idea to factor out a function tribits_pkg_append_set_commands_for_exported_vars() that is called in the module TribitsWriteClientExportFiles.cmake. Lastly, I moved the function tribits_assert_cache_and_local_vars_same_value() into this module as well. This encapsulates all of the logic to export of these package cache vars into a single module (with just a few dependencies).
tribits_add_option_and_define(): restore optional macro define var arg, refactor (#516) Should also fix trilinos/Trilinos#10925
With the merge of PRs #520 and #521, I think enough of this scope is done. I will defer the implementation of the macros I will put in review for now. |
…os#10774, TriBITSPub/TriBITS#516) A TriBITS update is exporting package cache vars to the <Package>Config.cmake file and you can't have a local var with the same name as a cache var with different values. In this case, it was just lucky that no downstream package was reading this var (through the cache var) because they would have gotten the wrong value. It seems that only code in CMakeLists.txt files under packages/pliris/ were reading this var.
…s:develop' (8906842). * trilinos-develop: (128 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate Testing on Geminga: Do not disable Kokkos in Epetra build ...
This is a safer way to check for an empty var I have found in the past. Something strange happens with macro arguments (at least in older versions of CMake). This is in response to feedback from @KyleFromKitware while reviewing PR #521.
Irina Tezaur confirmed that this works for the Anasazi_ENABLE_RBGen case described above. Closing as complete. |
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…s:develop' (8906842). * trilinos-develop: (130 commits) Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929) Tpetra: Adding configure option to disable Kokkos integration test MueLu: Allow to print Kokkos config when default node type is used Automatic snapshot commit from tribits at 142e5362 Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931) Force disable Pliris in ATS2 builds (trilinos#10931) Automatic snapshot commit from tribits at ab419429 Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522) Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516) Remove printing of vars that are now empty (TriBITSPub/TriBITS#299) Panzer: move periodic helper typedefs into namespace Revert incorrect fix in previous commit Fix typos in some docs fix scratch typos STK: Snapshot 08-22-22 12:44 Phalanx: remove cuda compiler warnings and add test for new use case for vov changed a double to a scalar_type to compile for complex arith MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp Amesos2 : trying to fix MKL header including issues MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate ...
…os#10774, TriBITSPub/TriBITS#516) A TriBITS update is exporting package cache vars to the <Package>Config.cmake file and you can't have a local var with the same name as a cache var with different values. In this case, it was just lucky that no downstream package was reading this var (through the cache var) because they would have gotten the wrong value. It seems that only code in CMakeLists.txt files under packages/pliris/ were reading this var.
Parent Issue
Description
It is often the case that downstream CMake projects need to know how an upstream CMake project was configured and what features it supports. For example:
Albany wants to know if the installed Anasazi package was configured with RBGen or not (i.e. the value of
Anasazi_ENABLE_RBGen
). (needed to resolve an issue for Address failures from merge of updated TriBITS (#10614, TriBITSPub/TriBITS#299) trilinos/Trilinos#10774).Once Trilinos packages are made to be built and installed independently, then downstream Trilinos packages will need to know a lot about upstream Trilinos packages. For example, downstream packages like MueLu need to know a lot about how upstream package Tpetra was configured (e.g. what scalar types it supports and has explicit template instantiations for).
Proposed solution
The proposed solution is to provide an easy mechanism for a TriBITS packages to make sure that the values of select cache vars are set in the generated
<Package>Config.cmake
file. For example, TriBITS could provide the function:such that when called, the variable
<cacheVarName>
and its value would get written into the<Package>Config.cmake
files for the package and its subpackages (if the package has subpackages). There would be code intribits_pkg_export_cache_var()
that asserted that the cache variable<cacheVarName>
existing and it was indeed a cache var (so that internal downstream packages can already see the value).Then many of the standard TriBITS variables like
tribits_add_option_and_define(<userOptionName> <macroDefineName> ...)
would calltribits_pkg_export_cache_var(<userOptionName>)
andtribits_pkg_export_cache_var(<macroDefineName>)
(when those functions are called with a package scope). Other examples of standard TriBITS option-setting functions that would calltribits_pkg_export_cache_var()
aretribits_add_debug_option()
, ???.And to avoid duplication, we could provide TriBITS functions
tribits_pkg_set_option_and_export(<optionName> <defaultVal>)
andtribits_pkg_set_and_export(<varName> <defaultVal> CACHE <type> "<doc>")
and packages could refactor that currently callsoption(<optionName> <defaultVal>)
andset(<varName> <defaultVal> CACHE <type> "<doc>")
, respectively.NOTE: The precedent of exporting
<Package>_ENABLE_<something>
variables into<Package>Config.cmake
files has already been done for the direct upstream dependencies of a TriBITS package to tell downstream CMake projects what upstream dependencies are enabled for a given packages. An example of this is inTribitsExampleApp2
:TriBITS/tribits/examples/TribitsExampleApp2/AppHelperFuncs.cmake
Lines 144 to 162 in 4c184b4
The text was updated successfully, but these errors were encountered: