TriBITSPub / TriBITS

TriBITS: Tribal Build, Integrate, and Test System,
http://tribits.org
Other
36 stars 46 forks source link

Add support for exporting package info vars into <Package>Config.cmake files (#516) #520

Closed bartlettroscoe closed 2 years ago

bartlettroscoe commented 2 years ago

Addresses #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.

bartlettroscoe commented 2 years ago

Hello @KyleFromKitware, can you do a quick review? If not, I can merge and we can set this up for a post-merge review when you have the time.

bartlettroscoe commented 2 years ago

So asserting these exported cache vars has exposed one error in Trilinos CMakeLists.txt files that will need to be fixed in the Pliris package. Details are shown below

Testing against Trilinos and identification of defect with Pliris_ENABLE_DREAL: (click to expand)
NOTE: I tested this with the Trilinos clang-10.0.0 PR build for Trilinos 'develop' version: ``` $ cd Trilinos/ $ gitdist-status --dist-repos=.,TriBITS ----------------------------------------------------------------------------------------------------- | ID | Repo Dir | Branch | Tracking Branch | C | M | ? | |----|-----------------|--------------------------|-------------------------------------|---|---|---| | 0 | Trilinos (Base) | develop | github/develop | | | | | 1 | TriBITS | 516-export-pkg-info-vars | rab-github/516-export-pkg-info-vars | | | | ----------------------------------------------------------------------------------------------------- $ gitdist-repo-versions --dist-repos=.,TriBITS *** Base Git Repo: Trilinos f0ba7236d6c0e36c3e7f7fbe0cd66e9ec26798a2 [Mon Aug 22 15:14:05 2022 -0600] Merge Pull Request #10914 from trilinos/Trilinos/stk-snapshot *** Git Repo: TriBITS 903b9a1cd298d87b52550dd6ef420f75e9e3502e [Tue Aug 23 08:42:45 2022 -0600] Assert exported cache and local vars have same value (#516) ``` I ran: ``` $ ssh crf450 $ cd ~/Trilinos.base/BUILDS/PR/clang-10.0.0/ $ cat load-env.sh export TRILINOS_DIR=${HOME}/Trilinos.base/Trilinos source ${TRILINOS_SRC}/packages/framework/GenConfig/gen-config.sh \ --cmake-fragment GenConfigSettings.cmake \ rhel7_sems-clang-10.0.0-openmpi-1.10.1-serial_release-debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables \ --force -y \ "$@" \ ${TRILINOS_DIR} $ cat do-configure rm -rf CMakeCache.txt CMakeFiles cmake \ -G Ninja \ -C GenConfigSettings.cmake \ -D Trilinos_TRIBITS_DIR:STRING=TriBITS/tribits \ -D Trilinos_ENABLE_ALL_FORWARD_DEP_PACKAGES=OFF \ -D Trilinos_ENABLE_TESTS=ON \ "$@" \ ${TRILINOS_DIR} $ . load-env.sh $ time ./do-configure -DTrilinos_ENABLE_ALL_PACKAGES=ON &> configure.out real 0m41.081s user 0m35.373s sys 0m11.629s $ tail configure.out Finished configuring Trilinos! Total time to configure Trilinos: 0m38.652s -- If publishing results using Trilinos, please cite us: https://trilinos.github.io/cite.html -- Configuring incomplete, errors occurred! See also "/ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/CMakeFiles/CMakeOutput.log". See also "/ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/CMakeFiles/CMakeError.log". ``` This showed the errors: ``` $ grep -A 2 ERROR: configure.out ERROR: The cache variable Pliris_ENABLE_DREAL with the cache var value 'OFF' is not the same value as the local variable Pliris_ENABLE_DREAL with value 'ON'! -- ERROR: The cache variable Pliris_ENABLE_DREAL with the cache var value 'OFF' is not the same value as the local variable Pliris_ENABLE_DREAL with value 'ON'! ``` And reconfiguring with: ``` $ cmake . &> configure.2.out ``` showed the same errors. A search of that package shows: ``` $ cd packages/pliris/ $ find . -name CMakeLists.txt -exec grep -nH _ENABLE_DREAL {} \; ./CMakeLists.txt:23:TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DREAL ./CMakeLists.txt:41: NOT ${PACKAGE_NAME}_ENABLE_DREAL) ./CMakeLists.txt:43: SET(${PACKAGE_NAME}_ENABLE_DREAL ON) ./test/CMakeLists.txt:1:IF(Pliris_ENABLE_DREAL) ./src/CMakeLists.txt:118: IF(Pliris_ENABLE_DREAL) ./src/CMakeLists.txt:170:ELSEIF(Pliris_ENABLE_DREAL) ``` and you can see the error on line 43 :-(