-
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
EPIC: Refactoring TriBITS Core and TriBITS-based CMake projects to conform to modern CMake #411
Comments
…riBITSPub#411) I just noticed that CMake 3.17 suppports string(APPEND ...). The more that we can remove from TriBITS the better.
…riBITSPub#411) I just noticed that CMake 3.17 suppports string(APPEND ...). The more that we can remove from TriBITS the better.
All of the major systems at SNL and LLNL should have CMake 3.23+ installed. This allows the elimination of a lot of technical debt in TriBITS (see TriBITSPub/TriBITS#411).
All of the major systems at SNL and LLNL should have CMake 3.23+ installed. This allows the elimination of a lot of technical debt in TriBITS (see TriBITSPub/TriBITS#411).
All of the major systems at SNL and LLNL should have CMake 3.23+ installed. This allows the elimination of a lot of technical debt in TriBITS (see TriBITSPub/TriBITS#411).
This is part of allowing TriBITS to take advantage of newer CMake features and replacing some older TriBITS code that now has (better or compatiable) native implementations in CMake (many years later). The min version of CMake 3.23 is chosen due to Trilinos (see trilinos/Trilinos#10355). Some non-obvious changes made were: * For some reason, find_file() wiht CMake 3.23 (and using CMak 3.23 default policies) adds on an extra '/' before the file name. This messed up the test checks but I fixed that by putting in '[/]*' in the regex to account for that. * Updated the GitHub Actions testing jobs to all be CMake 3.23+. (I updated the patch versions as well to the most recent patch releases as of right now. CMake 3.25 is still the most recent release of CMake as CMake 3.26 is still in release candidate testing.) * Add checks for setting CTEST_RESOURCE_SPEC_FILE in CTestTestfile.cmake now that CMake is >= 3.18. * Removed constant ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES since it is hard-coded since CMake is 3.17+. * Removed some documentation discussing older versions of CMakew (which are no longer supported). * install-cmake.py: Changed the default version of CMake to install from 3.17 to 3.23. * install-cmake.py: Removed patch for CMake 3.17 * Removed documentation for Kitware fork of Ninja version < 1.10 since Ninja 1.10 has been out for many years.
This is part of allowing TriBITS to take advantage of newer CMake features and replacing some older TriBITS code that now has (better or compatiable) native implementations in CMake (many years later). The min version of CMake 3.23 is chosen due to Trilinos (see trilinos/Trilinos#10355). Some non-obvious changes made were: * For some reason, find_file() wiht CMake 3.23 (and using CMak 3.23 default policies) adds on an extra '/' before the file name. This messed up the test checks but I fixed that by putting in '[/]*' in the regex to account for that. * Updated the GitHub Actions testing jobs to all be CMake 3.23+. (I updated the patch versions as well to the most recent patch releases as of right now. CMake 3.25 is still the most recent release of CMake as CMake 3.26 is still in release candidate testing.) * Add checks for setting CTEST_RESOURCE_SPEC_FILE in CTestTestfile.cmake now that CMake is >= 3.18. * Removed constant ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES since it is hard-coded since CMake is 3.17+. * Removed some documentation discussing older versions of CMakew (which are no longer supported). * install-cmake.py: Changed the default version of CMake to install from 3.17 to 3.23. * install-cmake.py: Removed patch for CMake 3.17 * Removed documentation for Kitware fork of Ninja version < 1.10 since Ninja 1.10 has been out for many years.
This is part of allowing TriBITS to take advantage of newer CMake features and replacing some older TriBITS code that now has (better or compatiable) native implementations in CMake (many years later). The min version of CMake 3.23 is chosen due to Trilinos (see trilinos/Trilinos#10355). Some non-obvious changes made were: * For some reason, find_file() wiht CMake 3.23 (and using CMak 3.23 default policies) adds on an extra '/' before the file name. This messed up the test checks but I fixed that by putting in '[/]*' in the regex to account for that. * Updated the GitHub Actions testing jobs to all be CMake 3.23+. (I updated the patch versions as well to the most recent patch releases as of right now. CMake 3.25 is still the most recent release of CMake as CMake 3.26 is still in release candidate testing.) * Add checks for setting CTEST_RESOURCE_SPEC_FILE in CTestTestfile.cmake now that CMake is >= 3.18. * Removed constant ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES since it is hard-coded since CMake is 3.17+. * Removed some documentation discussing older versions of CMakew (which are no longer supported). * install-cmake.py: Changed the default version of CMake to install from 3.17 to 3.23. * install-cmake.py: Removed patch for CMake 3.17 * Removed documentation for Kitware fork of Ninja version < 1.10 since Ninja 1.10 has been out for many years.
This is the first step in allowing TriBITS to take advantage of newer CMake features and replacing some older TriBITS code that now has (better or compatible) native implementations in CMake (many years after the TriBITS support was created). The min version of CMake 3.23 is chosen due to Trilinos changing its min version to 3.23 (see trilinos/Trilinos#10355). Some non-obvious changes made in this commit were: * For some reason, find_file() with CMake 3.23 (and using CMake 3.23 default policies) adds on an extra '/' before the file name in the found path. This messed up some of the test checks in TriBITS but I fixed that by putting '[/]*' in the regex to account for that extra '/'. * Updated the GitHub Actions testing jobs to all be CMake 3.23+. (I updated the patch versions of the different versions as well to the most recent patch releases for those minor versions as of right now. CMake 3.25 is still the most recent release of CMake as CMake 3.26 is still in release candidate testing. Therefore, CMake 3.26.2 is still the most current release of CMake.) * Added checks for setting CTEST_RESOURCE_SPEC_FILE in CTestTestfile.cmake now that CMake is >= 3.18. * Removed constant ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES since it is hard-coded now that CMake is 3.17+ is required. * Removed some documentation discussing older versions of CMake (which are no longer supported by TriBITS). * install-cmake.py: Changed the default version of CMake to install from 3.17 to 3.23. * install-cmake.py: Removed patch for CMake 3.17 * Removed documentation for the Kitware fork of Ninja versions < 1.10 since Ninja 1.10 has been out for several years with Fortran support.
This is part of allowing TriBITS to take advantage of newer CMake features and replacing some older TriBITS code that now has (better or compatible) native implementations in CMake (often many years after the TriBITS support was created). This allows unconditionally using CMake features up to version 3.23 (where we were limited unconditionally using features up to CMake version 3.17). The min version of CMake 3.23 is chosen due to Trilinos changing its min version to 3.23 (see trilinos/Trilinos#10355). Some non-obvious changes made in this commit were: * For some reason, find_file() with CMake 3.23 (and using CMake 3.23 default policies) adds on an extra '/' before the file name in the found path. This messed up some of the test checks in TriBITS but I fixed that by putting '[/]*' in the regex to account for that extra '/'. * Updated the GitHub Actions testing jobs to all be CMake 3.23+. (I updated the patch versions of the different versions as well to the most recent patch releases for those minor versions as of right now. CMake 3.25 is still the most recent release of CMake as CMake 3.26 is still in release candidate testing. Therefore, CMake 3.26.2 is still the most current release of CMake.) * Added checks for setting CTEST_RESOURCE_SPEC_FILE in CTestTestfile.cmake now that CMake is >= 3.18. * Removed constant ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES since it is hard-coded now that CMake is 3.17+ is required. * Removed some documentation discussing older versions of CMake (which are no longer supported by TriBITS). * install-cmake.py: Changed the default version of CMake to install from 3.17 to 3.23. * install-cmake.py: Removed patch for CMake 3.17 * Removed documentation for the Kitware fork of Ninja versions < 1.10 since Ninja 1.10 has been out for several years with Fortran support.
…SPub#411) This replaces '[/]*/' which will match one or more '/' chars in a row with '/?/' which will match one or two '/' in a row (which is what I wanted). This addreses review feedback from @KyleFromKitware in PR TriBITSPub#565.
This checks that the timing in the correct format is printed (but can't check the actual times). This will allow for trying to use updated CMake feature to get the raw seconds.
This checks that the timing in the correct format is printed (but can't check the actual times). This will allow for trying to use updated CMake feature to get the raw seconds.
This checks that the timing in the correct format is printed (but can't check the actual times). This will allow for trying to use updated CMake feature to get the raw seconds.
This checks that the timing in the correct format is printed (but can't check the actual times). This will allow for trying to use updated CMake feature to get the raw seconds.
This checks that the timing in the correct format is printed (but can't check the actual times). This will allow for trying to use updated CMake feature to get the raw seconds.
FYI, the non-usage of the standard CMake |
FYI: It is amazing the shockwaves that have been produced in switching Trilinos to just use
SIDENOTE: It is amazing how much of a shockwave this one seemingly small non-backward compatible change to adopt one modern CMake practice has made on even just the local the Trilinos user community. This does not bode well for all of the changes to switch to modern CMake listed above |
NOTE: The TriBITS module the See: |
This was missed on the upgrade of CMake 3.17 to 3.23. See commit: 45b514c "Update CMake min version from 3.17 to 3.23 (TriBITSPub#411)" Author: Roscoe A. Bartlett <[email protected]> Date: Sat Feb 25 07:01:29 2023 -0700 (1 year, 5 months ago) CMake 3.23 was already required by TriBITS so this just makes it consistent.
This was missed on the upgrade of CMake 3.17 to 3.23. See commit: 45b514c "Update CMake min version from 3.17 to 3.23 (TriBITSPub#411)" Author: Roscoe A. Bartlett <[email protected]> Date: Sat Feb 25 07:01:29 2023 -0700 (1 year, 5 months ago) CMake 3.23 was already required by TriBITS so this just makes it consistent.
This was missed on the upgrade of CMake 3.17 to 3.23. See commit: 45b514c "Update CMake min version from 3.17 to 3.23 (TriBITSPub#411)" Author: Roscoe A. Bartlett <[email protected]> Date: Sat Feb 25 07:01:29 2023 -0700 (1 year, 5 months ago) CMake 3.23 was already required by TriBITS so this just makes it consistent.
Blocked by::
Description
An initial version of TriBITS was created back in 2008 when CMake was on version 2.6.z (prior to 2.8, when CMake was still using even numbers for releases). There was a lot missing in those early versions of CMake needed to create a portable, scalable, build system for something like Trilinos. Therefore, a lot of features had to be added to TriBITS in those early days and in the next few years to address development, testing, and deployment challenges of Trilinos and other projects. That CMake build system was split out of Trilinos and named "TriBITS" around 2011 as part of the CASL project and was reused in several other projects (where it is still used today) and the majority of the development work for what is now TriBITS was completed by around 2014 (around the time that CMake 3.0 was released).
Around CMake 3.0 (which was not released until 2014), great improvements started to be made in CMake and the idioms for its usage, and the usage of CMake steadily improved across the computational and scientific and engineering community. In the 12 years since TriBITS was first created and especially in the last 7 years since CMake 3.0 and future releases of CMake 3.Y have come out, a lot of the functionality that was added to TriBITS has since been added to CMake proper and has been slowly adopted by the larger software development community using CMake. While reading the book "Professional CMake: 10th Edition", I have come to realize just how much of the functionality that we had to add to TriBITS ourselves has now been added to CMake proper. (And reading that book one realizes just how much functionality has been added to CMake in general since CMake 3.0 to address so many difficult cross-platform issues.)
It is in the best interest of Trilinos and all of the projects that use TriBITS to refactor their CMake build systems (and TriBITS itself) to switch over to the newer native CMake implementations of these features and to remove these features from TriBITS. In this process, TriBITS should be reduced the its smallest useful essence that provides value and does not stand in the way of adopting future CMake features as those are added in future CMake releases.
However, these changes need to be made incrementally against the develop branch of Trilinos and the master branch of TriBITS with frequent topic branch and frequent integrations to smooth the transitions with Trilinos developers and users.
This epic will list some of the areas where TriBITS, Trilinos, and other projects using TriBITS should be refactored to use native modern CMake features and idoms:
Switch from using deprecated
find_package(PythonInterp)
tofind_package(Python3)
to accommodatepython3
installations (see Switch from find_package(PythonInterp) to find_package(Python3) #610). [Major break in backward comparability]Use the standard CMake
FortranCInterface.cmake
module to handle Fortran/C name mangling. (This will replace a module copied into TriBITS back in 2007 that does this manually at configure time.) [Minor break in backward comparability]Require standard install locations defined by the standard
GNUInstallDirs.cmake
module and varsCMAKE_INSTALL_<XXX>
forBINDIR
,LIBDIR
,LIBDIR
,INCLUDEDIR
and replace TriBITS-defined locations<Project>_INSTALL_INCLUDE_DIR
,<Project>_INSTALL_LIB_DIR
,<Project>_INSTALL_RUNTIME_DIR
. (NOTE:GNUInstallDirs.cmake
has no equivalent for<Project>_INSTALL_EXAMPLE_DIR
.) [Minor break in backward comparability]Replace and remove old TriBITS General Utility Macros and Functions that have native implementations in newer versions of raw CMake. (E.g.,
append_string_var()
=>string(APPEND ...)
,append_string_var_with_sep()
=>string(JOIN ...)
,concat_strings()
=>string(CONCAT ...)
,join()
=>string(JOIN ...)
,multiline_set()
=>string(CONCAT ...)
, etc.)Revise how RPATH is handled with TriBITS according to new RPATH variables and target properties for more flexibility and to better support relocatable installs (i.e. set
set(CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN${relBinToLibDir})
by default) . (Or, strip out RPATH handling altogether from TriBITS and leave raw CMake behavior for projects to deal with themselves.) [Minor break in backward comparability]Use correct CamelCase for
CMAKE_BULD_TYPE
(see Allow CamelCase names for CMAKE_BUILD_TYPE ‘Debug’, ‘Release’ and empty '' #131) [Minor break in backward comparability]Support multi-configuration generators (e.g. Ninja and Visual Code), which requires not relying on
CMAKE_BULD_TYPE
and instead using generator expressionsTriBITS stop setting/manipulating compiler options:
Remove TriBITS overriding defaults for
CMAKE_<LANG>_<CONFIG>
(SeeCMAKE_<LANG>_<CONFIG>_OVERRIDE
). (TriBITS should get out of the business of manipulating compiler options if possible.) [Minor break in backward comparability]Don't set options for strong warnings. Let the project do that itself if it wants to. [Minor break in backward comparability]
Have TriBITS use
find_package(OpenMP)
and link againstOpenMP::OpenMP_<lang>
to handle compiler options (see Trilinos nightly failure, OpenMP backend: simpleBuildAgainstTrilinos app builds against install fails with "Target "MyApp" links to target "OpenMP::OpenMP_CXX" but the target was not found." kokkos/kokkos#5514 (comment)). [Minor break in backward comparability]???
Switch deprecated code macros to the deprecation macros with the
GenerateExportHeader.cmake
module and thegenerate_export_header()
function. [Minor break in backward comparability]Switch from manual include guards to
include_guard()
.Move numerous checks for things like
time.h
,stdinit.h
,inittypes.h
, checks forisnan()
,isinf()
, etc., checks for doxygen, out of TriBITS env probing (individual projects or even individual packages should be doing that). [Minor break in backward comparability]Consider switching to using
find_package(MPI)
(and the standard CMakeFindMPI.cmake
module) [Major break in backward comparability?]???
Completed refactorings
<Pacakge>Config.cmake
files that are TriBITS-Compliant External Packages. (This will allow incorporating external raw CMake projects as TriBITS packages with little work and few changes.) [Done]Child Issues
The text was updated successfully, but these errors were encountered: