From 58036595e1102656e51aa374ec3a262be272eded Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 9 Oct 2023 10:40:12 -0600 Subject: [PATCH] Revert "Tribits snapshot 09 26 2023" --- cmake/tribits/CHANGELOG.md | 37 -- cmake/tribits/README.DIRECTORY_CONTENTS.rst | 53 +- .../ci_support/CDashQueryAnalyzeReport.py | 48 +- .../ci_support/TribitsDumpDepsXmlScript.cmake | 8 +- .../TribitsGetExtraReposForCheckinTest.cmake | 3 +- .../TribitsWriteXmlDependenciesFiles.cmake | 3 - .../ci_support/cdash_analyze_and_report.py | 4 - .../common_tpls/utils/ParseLibraryList.cmake | 2 +- .../TribitsAddAdvancedTest.cmake | 57 +- .../TribitsAddAdvancedTestHelpers.cmake | 2 +- .../package_arch/TribitsAddExecutable.cmake | 4 +- .../TribitsAddExecutableAndTest.cmake | 3 +- .../TribitsAddExecutableTestHelpers.cmake | 13 +- .../core/package_arch/TribitsAddLibrary.cmake | 4 +- .../TribitsAddTest.cmake | 9 +- .../TribitsAddTestHelpers.cmake | 30 +- .../TribitsAdjustPackageEnables.cmake | 26 +- .../TribitsCMakePolicies.cmake | 0 .../package_arch/TribitsConfigureTiming.cmake | 97 ---- .../TribitsConstants.cmake | 0 .../TribitsCopyFilesToBinaryDir.cmake | 1 + .../TribitsFindMostRecentFileTimestamp.cmake | 3 - .../package_arch/TribitsGeneralMacros.cmake | 56 ++ .../package_arch/TribitsGlobalMacros.cmake | 368 ++++++++++++- .../package_arch/TribitsInstallHeaders.cmake | 2 +- ...ribitsInternalPackageWriteConfigFile.cmake | 84 ++- .../TribitsPackageDefineDependencies.cmake | 88 ++-- .../TribitsPackageDependencies.cmake | 3 +- .../package_arch/TribitsPackageMacros.cmake | 5 +- .../TribitsPackagingSupport.cmake | 354 ------------- .../TribitsProcessEnabledTpls.cmake | 55 +- .../TribitsProcessPackagesAndDirsLists.cmake | 12 +- .../TribitsProcessTplsLists.cmake | 2 +- .../core/package_arch/TribitsProject.cmake | 2 +- .../package_arch/TribitsProjectImpl.cmake | 10 +- ...adAllProjectDepsFilesCreateDepsGraph.cmake | 3 +- .../TribitsReadDepsFilesCreateDepsGraph.cmake | 35 +- ...TribitsSortListAccordingToMasterList.cmake | 42 +- ...itsSystemDataStructuresMacrosFunctions.rst | 125 ++--- .../TribitsTestCategories.cmake | 8 +- .../TribitsSetTribitsPackageName.cmake | 55 -- .../tribits/core/utils/AppendGlobalSet.cmake | 4 +- .../tribits/core/utils/AppendStringVar.cmake | 8 +- .../core/utils/AppendStringVarWithSep.cmake | 2 +- cmake/tribits/core/utils/ConcatStrings.cmake | 2 +- .../core/utils/DriveAdvancedTest.cmake | 12 +- cmake/tribits/core/utils/MessageWrapper.cmake | 2 +- cmake/tribits/core/utils/TimingUtils.cmake | 2 +- .../core/utils/TribitsDeprecatedHelpers.cmake | 6 +- .../utils/TribitsParseArgumentsHelpers.cmake | 2 +- .../utils/TribitsSetCacheVarAndDefault.cmake | 89 ---- .../ctest_driver/TribitsCTestDriverCore.cmake | 10 +- .../build_ref/TribitsBuildReferenceBody.rst | 51 +- cmake/tribits/doc/guides/.gitignore | 3 - .../guides/Makefile.common_generated_files | 1 - .../tribits/doc/guides/TribitsGuidesBody.rst | 490 ++++++------------ .../TribitsSystemMacroFunctionDocTemplate.rst | 3 +- .../guides/UtilsMacroFunctionDocTemplate.rst | 2 - cmake/tribits/doc/guides/generate-guide.sh | 30 +- cmake/tribits/doc/utils/gen_doc_utils.sh | 3 +- .../DependsOnLAPACK/cmake/Dependencies.cmake | 2 +- .../packages/epetra/cmake/Dependencies.cmake | 4 +- .../epetraext/cmake/Dependencies.cmake | 9 +- .../packages/teuchos/cmake/Dependencies.cmake | 4 +- .../TribitsExampleApp2/AppHelperFuncs.cmake | 5 +- .../simple_cxx/cmake/Dependencies.cmake | 4 +- .../packages/package1/CMakeLists.raw.cmake | 23 - .../package1/CMakeLists.tribits.cmake | 5 - .../packages/package1/CMakeLists.txt | 22 +- .../package1/cmake/Dependencies.cmake | 2 +- .../cmake/raw/DefineAllLibsTarget.cmake | 11 - .../cmake/raw/EnableTribitsTestSupport.cmake | 10 - ...GeneratePackageConfigFileForBuildDir.cmake | 13 - ...neratePackageConfigFileForInstallDir.cmake | 15 - .../cmake/raw/Package1Config.cmake.in | 3 - .../package1/src/CMakeLists.raw.cmake | 23 - .../package1/src/CMakeLists.tribits.cmake | 4 - .../packages/package1/src/CMakeLists.txt | 23 +- .../packages/package1/src/Package1_Prg.cpp | 6 +- .../package1/test/CMakeLists.raw.cmake | 19 - .../package1/test/CMakeLists.tribits.cmake | 14 - .../packages/package1/test/CMakeLists.txt | 17 +- .../package2/cmake/Dependencies.cmake | 2 +- .../package3/cmake/Dependencies.cmake | 6 +- cmake/tribits/python_utils/gitdist-setup.sh | 8 +- cmake/tribits/python_utils/gitdist.py | 73 +-- .../libraries/ioss/src/Ioss_ChainGenerator.C | 6 +- 87 files changed, 983 insertions(+), 1788 deletions(-) rename cmake/tribits/core/{test_support => package_arch}/TribitsAddAdvancedTest.cmake (97%) rename cmake/tribits/core/{test_support => package_arch}/TribitsAddAdvancedTestHelpers.cmake (98%) rename cmake/tribits/core/{test_support => package_arch}/TribitsAddExecutableTestHelpers.cmake (92%) rename cmake/tribits/core/{test_support => package_arch}/TribitsAddTest.cmake (99%) rename cmake/tribits/core/{test_support => package_arch}/TribitsAddTestHelpers.cmake (96%) rename cmake/tribits/core/{common => package_arch}/TribitsCMakePolicies.cmake (100%) delete mode 100644 cmake/tribits/core/package_arch/TribitsConfigureTiming.cmake rename cmake/tribits/core/{common => package_arch}/TribitsConstants.cmake (100%) delete mode 100644 cmake/tribits/core/package_arch/TribitsPackagingSupport.cmake rename cmake/tribits/core/{utils => package_arch}/TribitsSortListAccordingToMasterList.cmake (62%) rename cmake/tribits/core/{test_support => package_arch}/TribitsTestCategories.cmake (94%) delete mode 100644 cmake/tribits/core/test_support/TribitsSetTribitsPackageName.cmake delete mode 100644 cmake/tribits/core/utils/TribitsSetCacheVarAndDefault.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.tribits.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/DefineAllLibsTarget.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/EnableTribitsTestSupport.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.tribits.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake delete mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake diff --git a/cmake/tribits/CHANGELOG.md b/cmake/tribits/CHANGELOG.md index b3f1edd1ef..5a982fcfff 100644 --- a/cmake/tribits/CHANGELOG.md +++ b/cmake/tribits/CHANGELOG.md @@ -2,43 +2,6 @@ ChangeLog for TriBITS ---------------------------------------- -## 2023-06-22: - -* **Added:** Packages are now determined to be missing if their dependencies - file `/cmake/Dependencies.cmake` is missing. If the package - directory `` exists but the dependencies file is missing, the - package is determined to be missing but a warning is printed. (This expands - behavior to gracefully deal with a situation where a package source - directory is only partially removed, such as with `git rm -r `, - but the base directory still exists. Therefore, this allows the project to - gracefully configure with the package being considered missing and avoids a - fatal error in this case.) - -## 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 - `/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 `Config.cmake` file need not define - `::all_libs` targets for all of its upstream dependencies. The - updated macro `tribits_process_enabled_tpls()` will find any missing - upstream external packages/TPLs as needed (see updated documentation in the - section "TriBITS-Compliant External Packages" in the "TriBITS Users Guide" - and the section "Processing of external packages/TPLs and TriBITS-compliant - external packages" in the "TriBITS Maintainers Guide"). - ## 2023-02-24: * **Changed:** Upgraded minimum required CMake version from 3.17 to 3.23. diff --git a/cmake/tribits/README.DIRECTORY_CONTENTS.rst b/cmake/tribits/README.DIRECTORY_CONTENTS.rst index a0f3d8ab74..80067d5a83 100644 --- a/cmake/tribits/README.DIRECTORY_CONTENTS.rst +++ b/cmake/tribits/README.DIRECTORY_CONTENTS.rst @@ -22,10 +22,9 @@ TriBITS refactorings of TriBITS. .. _TriBITS Core: -**core/**: Core TriBITS test support and package-based architecture for CMake -projects. This only depends on raw CMake and contains just the minimal support -for building, testing, installing, and deployment. This CMake code depends -only on CMake and nothing else. +**core/**: Core TriBITS package-based architecture for CMake projects. This +only depends on raw CMake and contains just the minimal support for building, +testing, installing, and deployment. Only depends on CMake and nothing else. **python_utils/**: Some basic Python utilities that are not specific to TriBITS but are used in TriBITS CI and testing support software. There are @@ -87,49 +86,3 @@ subdirectory. It supports the argument ``--components`` with values ``core``, * ``examples`` => (external tribits installation) * ``doc`` => ``core``, ``ci_support``, ``examples`` * ``devtools_install`` => ``python_utils`` - - -TriBITS Core Directory Contents -............................... - -The TriBITS ``core/`` directory is broken down into several subdirectories of -its own: - -**core/utils**: General CMake utilities that are not specific to the TriBITS -system and can be reused in any CMake project. - -**core/common**: As small set of common modules that the different TriBITS -Core module files in different directories depend on. These include things -like common TriBITS constants and TriBITS CMake policies. - -**core/test_support**: Modules that help define CTest tests using functions -like `tribits_add_test()`_ and `tribits_add_advanced_test()`_. These can be -used in CMake projects that are not full-blown TriBITS projects. - -**core/config_tests**: Some basic configure-time tests used by the TriBITS -package architecture framework. - -**core/std_tpls**: Some ``Find.cmake`` files for key external -dependencies handled as TriBITS TPLs but are more central to the TriBITS -system. (Examples include CUDA and MPI support.) - -**core/installation**: A collection of ``*.cmake.in`` and related Cmake code -supporting installations. - -**core/package_arch**: Modules for the full-blown TriBITS package architecture -framework including package dependency management, multi-repository support, -installations (including the generation of ``Config.cmake`` files), -etc. - -The dependencies between these different TriBITS `core` subdirectories are: - -* ``core/utils`` => (external CMake) -* ``core/common`` => ``core/utils`` -* ``core/test_support`` => ``core/utils``, ``core/common`` -* ``core/config_tests`` => (external CMake) -* ``core/std_tpls`` => (external CMake) -* ``core/installation`` <=> ``core/package_arch`` (bidirectional) -* ``core/package_arch`` => ``core/utils``, ``core/common``, - ``core/test_support``, ``core/config_tests``, ``core/std_tpls``, - ``core/installation`` - diff --git a/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py b/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py index dc20a2f54e..157866a1b8 100644 --- a/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py +++ b/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py @@ -40,11 +40,9 @@ try: # Python 2 from urllib2 import urlopen - from urllib2 import quote as urlquote except ImportError: # Python 3 from urllib.request import urlopen - from urllib.parse import quote as urlquote import sys import hashlib @@ -718,45 +716,41 @@ def getAndCacheCDashQueryDataOrReadFromCache( return cdashQueryData -def normalizeUrlStrings(*args): - return [urlquote(x) for x in args] - - # Construct full cdash/api/v1/index.php query URL to pull data down given the # pieces def getCDashIndexQueryUrl(cdashUrl, projectName, date, filterFields): - # for legacy reasons, this function assumes we normalized projectName - projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" return cdashUrl+"/api/v1/index.php?project="+projectName+dateArg \ - + "&"+filterFields + + "&"+filterFields # Construct full cdash/index.php browser URL given the pieces def getCDashIndexBrowserUrl(cdashUrl, projectName, date, filterFields): - # for legacy reasons, this function assumes we normalized projectName - projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" return cdashUrl+"/index.php?project="+projectName+dateArg \ - + "&"+filterFields + + "&"+filterFields # Construct full cdash/api/v1/queryTests.php query URL given the pieces def getCDashQueryTestsQueryUrl(cdashUrl, projectName, date, filterFields): - # for legacy reasons, this function assumes we normalized projectName - projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" cdashTestUrl = cdashUrl+"/api/v1/queryTests.php?project="+projectName+dateArg+"&"+filterFields - return cdashTestUrl + return replaceNonUrlCharsInUrl(cdashTestUrl) + + +# Replace non-URL chars and return new URL string +def replaceNonUrlCharsInUrl(url): + urlNew = url + urlNew = urlNew.replace(' ', '%20') + # ToDo: Replace other chars as needed + return urlNew # Construct full cdash/queryTests.php browser URL given the pieces def getCDashQueryTestsBrowserUrl(cdashUrl, projectName, date, filterFields): - # for legacy reasons, this function assumes we normalized projectName - projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" return cdashUrl+"/queryTests.php?project="+projectName+dateArg+"&"+filterFields @@ -1707,33 +1701,29 @@ def __call__(self, testDict): dateRangeEndDateStr = self.__date beginEndUrlFields = "begin="+dateRangeBeginDateStr+"&end="+dateRangeEndDateStr - # normalize names for query - projectName_url, buildName_url, testname_url, site_url = normalizeUrlStrings( - projectName, buildName, testname, site) - # Define queryTests.php query filters for test history testHistoryQueryFilters = \ beginEndUrlFields+"&"+\ "filtercombine=and&filtercombine=&filtercount=3&showfilters=1&filtercombine=and"+\ - "&field1=buildname&compare1=61&value1="+buildName_url+\ - "&field2=testname&compare2=61&value2="+testname_url+\ - "&field3=site&compare3=61&value3="+site_url + "&field1=buildname&compare1=61&value1="+buildName+\ + "&field2=testname&compare2=61&value2="+testname+\ + "&field3=site&compare3=61&value3="+site # URL used to get the history of the test in JSON form testHistoryQueryUrl = \ - getCDashQueryTestsQueryUrl(cdashUrl, projectName_url, None, testHistoryQueryFilters) + getCDashQueryTestsQueryUrl(cdashUrl, projectName, None, testHistoryQueryFilters) # URL to embed in email to show the history of the test to humans testHistoryBrowserUrl = \ - getCDashQueryTestsBrowserUrl(cdashUrl, projectName_url, None, testHistoryQueryFilters) + getCDashQueryTestsBrowserUrl(cdashUrl, projectName, None, testHistoryQueryFilters) # URL for to the build summary on index.php page buildHistoryEmailUrl = getCDashIndexBrowserUrl( - cdashUrl, projectName_url, None, + cdashUrl, projectName, None, beginEndUrlFields+"&"+\ "filtercombine=and&filtercombine=&filtercount=2&showfilters=1&filtercombine=and"+\ - "&field1=buildname&compare1=61&value1="+buildName_url+\ - "&field2=site&compare2=61&value2="+site_url + "&field1=buildname&compare1=61&value1="+buildName+\ + "&field2=site&compare2=61&value2="+site ) # ToDo: Replace this with the the URL to just this one build the index.php # page. To do that, get the build stamp from the list of builds on CDash diff --git a/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake b/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake index 2d13260c0b..f55d03364c 100644 --- a/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake +++ b/cmake/tribits/ci_support/TribitsDumpDepsXmlScript.cmake @@ -100,16 +100,16 @@ endif() get_filename_component( ${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE ) message("-- Setting ${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") -include("${CMAKE_CURRENT_LIST_DIR}/../core/common/TribitsConstants.cmake") -tribits_asesrt_minimum_cmake_version() -include("${CMAKE_CURRENT_LIST_DIR}/../core/common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) - set( CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support" ) +include(TribitsConstants) +tribits_asesrt_minimum_cmake_version() +include(TribitsCMakePolicies NO_POLICY_SCOPE) + include(TribitsGlobalMacros) include(TribitsPrintDependencyInfo) include(TribitsWriteXmlDependenciesFiles) diff --git a/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake b/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake index 36853a8d98..d0afd980bd 100644 --- a/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake +++ b/cmake/tribits/ci_support/TribitsGetExtraReposForCheckinTest.cmake @@ -82,12 +82,11 @@ set(${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST ${CHECK_EXTRAREPOS_EXIST}) # B) Include files from TriBITS # -include("${CMAKE_CURRENT_LIST_DIR}/../core/common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) - set( CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" ) +include(TribitsCMakePolicies NO_POLICY_SCOPE) include(Split) include(AppendStringVar) include(SetDefaultAndFromEnv) # Used in ExtraRepositoriesList.cmake file? diff --git a/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake b/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake index 0173750f19..2360acf162 100644 --- a/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake +++ b/cmake/tribits/ci_support/TribitsWriteXmlDependenciesFiles.cmake @@ -45,9 +45,6 @@ ################################################################################ -include(TribitsConfigureTiming) - - # @MACRO: tribits_write_xml_dependency_files() # # Usage:: diff --git a/cmake/tribits/ci_support/cdash_analyze_and_report.py b/cmake/tribits/ci_support/cdash_analyze_and_report.py index 201502a9ec..6556b97615 100755 --- a/cmake/tribits/ci_support/cdash_analyze_and_report.py +++ b/cmake/tribits/ci_support/cdash_analyze_and_report.py @@ -542,10 +542,6 @@ def getTestHistory(self, testLOD): # D.2.a) Get list of dicts of builds off cdash/index.phpp # - # @arghdos: note, we do not have to normalize the URLs from the input - # options because they are currently taken from the cdash site already - # (i.e., they are already in normalized form). - cdashIndexBuildsBrowserUrl = CDQAR.getCDashIndexBrowserUrl( inOptions.cdashSiteUrl, inOptions.cdashProjectName, inOptions.date, inOptions.cdashBuildsFilters) diff --git a/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake b/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake index 74affbecc9..3f1423b312 100644 --- a/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake +++ b/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake @@ -100,7 +100,7 @@ function(parse_library_list) endforeach() - # Now set output variables + # Now set output vairables set(${PARSE_ARGS_DEBUG} "${_debug_libs}" PARENT_SCOPE) set(${PARSE_ARGS_OPT} "${_opt_libs}" PARENT_SCOPE) set(${PARSE_ARGS_GENERAL} "${_gen_libs}" PARENT_SCOPE) diff --git a/cmake/tribits/core/test_support/TribitsAddAdvancedTest.cmake b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake similarity index 97% rename from cmake/tribits/core/test_support/TribitsAddAdvancedTest.cmake rename to cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake index b9af5d0748..b1904b985b 100644 --- a/cmake/tribits/core/test_support/TribitsAddAdvancedTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake @@ -37,16 +37,14 @@ # ************************************************************************ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsConstants.cmake") +include(TribitsCMakePolicies NO_POLICY_SCOPE) -set(tribitsAddAdvancedTestModuleDir "${CMAKE_CURRENT_LIST_DIR}") +include(TribitsAddAdvancedTestHelpers) +include(TribitsConstants) -include("${CMAKE_CURRENT_LIST_DIR}/TribitsAddAdvancedTestHelpers.cmake") - -include("${CMAKE_CURRENT_LIST_DIR}/../utils/TribitsPrintList.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/AppendStringVar.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/PrintVar.cmake") +include(TribitsPrintList) +include(AppendStringVar) +include(PrintVar) # @FUNCTION: tribits_add_advanced_test() @@ -375,7 +373,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/../utils/PrintVar.cmake") # instead. **WARNING:** If you want to run such tests using valgrind, you # have to use the raw executable as the ```` argument and *not* # the script. For example, if you have a python script -# ``my_python_test.py`` with ``/usr/bin/env python`` at the top, you can't +# ``my_python_test.py`` with ``/usr/bin/env pyhton`` at the top, you can't # just use:: # # CMND /my_python_test.py ARGS "" "" ... @@ -855,9 +853,10 @@ include("${CMAKE_CURRENT_LIST_DIR}/../utils/PrintVar.cmake") # # The function ``tribits_add_advanced_test()`` can be used to add tests in # non-TriBITS projects. To do so, one just needs to set the variables -# ``${PROJECT_NAME}_ENABLE_TESTS=TRUE`` and ``${PROJECT_NAME}_TRIBITS_DIR`` -# (pointing to the TriBITS location). For example, a valid project can be a -# simple as:: +# ``PROJECT_NAME``, ``PACKAGE_NAME`` (which could be the same as +# ``PROJECT_NAME``), ``${PACKAGE_NAME}_ENABLE_TESTS=TRUE``, and +# ``${PROJECT_NAME}_TRIBITS_DIR`` (pointing to the TriBITS location). For example, +# a valid project can be a simple as:: # # cmake_minimum_required(VERSION 3.22.0) # set(PROJECT_NAME TAATDriver) @@ -867,40 +866,36 @@ include("${CMAKE_CURRENT_LIST_DIR}/../utils/PrintVar.cmake") # "Location of TriBITS to use." ) # set(PACKAGE_NAME ${PROJECT_NAME}) # set(${PACKAGE_NAME}_ENABLE_TESTS TRUE) -# include("${${PROJECT_NAME}_TRIBITS_DIR}/core/test_support/TribitsAddAdvancedTest.cmake") +# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${TRIBITS_DIR}/core/utils +# ${TRIBITS_DIR}/core/package_arch ) +# include(TribitsAddAdvancedTest) # include(CTest) # enable_testing() # -# tribits_add_advanced_test( HelloWorld +# tribits_add_advanced_test( +# TAAT_COPY_FILES_TO_TEST_DIR_bad_file_name # OVERALL_WORKING_DIRECTORY TEST_NAME # TEST_0 CMND echo ARGS "Hello World!" # PASS_REGULAR_EXPRESIOIN "Hello World" # ) # -# Above, one can replace:: -# -# include("${${PROJECT_NAME}_TRIBITS_DIR}/core/test_support/TribitsAddAdvancedTest.cmake") -# -# with:: -# -# list(PREPEND CMAKE_MODULE_PATH "${${PROJECT_NAME}_TRIBITS_DIR}/core/test_support") -# include(TribitsAddAdvancedTest) -# -# and it will have the same effect. -# function(tribits_add_advanced_test TEST_NAME_IN) if (${PROJECT_NAME}_VERBOSE_CONFIGURE) message("\nPACKAGE_ADD_ADVANCED_TEST: ${TEST_NAME_IN}\n") endif() - tribits_set_tribits_package_name() - global_set(TRIBITS_SET_TEST_PROPERTIES_INPUT) global_set(MESSAGE_WRAPPER_INPUT) # Set the full TEST_NAME - set(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME_IN}) + if (PACKAGE_NAME) + set(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME_IN}) + else() + set(TEST_NAME ${TEST_NAME_IN}) + endif() + # # A) Parse the overall arguments and figure out how many tests @@ -1523,8 +1518,6 @@ function(tribits_add_advanced_test TEST_NAME_IN) # F.2) Write the cmake -P script # - set(coreUtilsDir "${tribitsAddAdvancedTestModuleDir}/../utils") - cmake_path(NORMAL_PATH coreUtilsDir) string(APPEND TEST_SCRIPT_STR "\n" "set(PROJECT_NAME ${PROJECT_NAME})\n" @@ -1555,7 +1548,9 @@ function(tribits_add_advanced_test TEST_NAME_IN) "# Test invocation\n" "#\n" "\n" - "include(\"${coreUtilsDir}/DriveAdvancedTest.cmake\")\n" + "set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_UTILS_DIR})\n" + "\n" + "include(DriveAdvancedTest)\n" "\n" "drive_advanced_test()\n" ) diff --git a/cmake/tribits/core/test_support/TribitsAddAdvancedTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake similarity index 98% rename from cmake/tribits/core/test_support/TribitsAddAdvancedTestHelpers.cmake rename to cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake index c7fb556b4d..8c2e11df36 100644 --- a/cmake/tribits/core/test_support/TribitsAddAdvancedTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddAdvancedTestHelpers.cmake @@ -38,7 +38,7 @@ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/TribitsAddTestHelpers.cmake") +include(TribitsAddTestHelpers) # Set default ax number of TEST_ blocks in tribits_add_advanced_test() diff --git a/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake b/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake index 567d22f4c2..ec989628f8 100644 --- a/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddExecutable.cmake @@ -38,9 +38,9 @@ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsAddExecutableTestHelpers.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsAddTestHelpers.cmake") +include(TribitsAddExecutableTestHelpers) include(TribitsCommonArgsHelpers) +include(TribitsAddTestHelpers) include(TribitsGeneralMacros) include(TribitsLibIsTestOnly) include(TribitsReportInvalidTribitsUsage) diff --git a/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake b/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake index 7328f18558..73148b8a8a 100644 --- a/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddExecutableAndTest.cmake @@ -38,9 +38,8 @@ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsAddTest.cmake") - include(TribitsAddExecutable) +include(TribitsAddTest) include(TribitsDeprecatedHelpers) diff --git a/cmake/tribits/core/test_support/TribitsAddExecutableTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake similarity index 92% rename from cmake/tribits/core/test_support/TribitsAddExecutableTestHelpers.cmake rename to cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake index c2bc95d0dd..78f98f0bac 100644 --- a/cmake/tribits/core/test_support/TribitsAddExecutableTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddExecutableTestHelpers.cmake @@ -37,23 +37,22 @@ # ************************************************************************ # @HEADER -include_guard() +include(TribitsCMakePolicies NO_POLICY_SCOPE) -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) - -include("${CMAKE_CURRENT_LIST_DIR}/../utils/AdvancedSet.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/MessageWrapper.cmake") +include(AdvancedSet) +include(MessageWrapper) advanced_set( ${PROJECT_NAME}_CMAKE_EXECUTABLE_SUFFIX ".exe" CACHE STRING "Default exec suffix on all platforms (can be overridden by each executable added)." ) - +# # Process the COMM arguments # # NOTE: The COMM array arguments is passed as ${ARGN} # -function(tribits_process_comm_args ADD_SERIAL_FEATURE_OUT ADD_MPI_FEATURE_OUT ) + +function( tribits_process_comm_args ADD_SERIAL_FEATURE_OUT ADD_MPI_FEATURE_OUT ) set(COMM_ARRAY ${ARGN}) diff --git a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake index 0e249f4f9c..30036149db 100644 --- a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake @@ -271,7 +271,7 @@ include(TribitsSetAndIncDirs) # ``${CMAKE_INSTALL_PREFIX}/lib/`` (actual install directory is given by # ``${PROJECT}_INSTALL_LIB_DIR``, see `Setting the install prefix`_). # However, this install target will not get created if -# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FALSE`` and +# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE`` and # ``BUILD_SHARD_LIBS=OFF``. But when ``BUILD_SHARD_LIBS=ON``, the install # target will get added. Also, this install target will *not* get added if # ``TESTONLY`` or ``NO_INSTALL_LIB_OR_HEADERS`` are passed in. @@ -280,7 +280,7 @@ include(TribitsSetAndIncDirs) # added using ``install(FILES

...)``, but only if ``TESTONLY`` and # ``NO_INSTALL_LIB_OR_HEADERS`` are not passed in as well. Also, the install # target for the headers will not get added if -# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FALSE``. If this +# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE``. If this # install target is added, then the headers get installed into the flat # directory ``${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/`` (default is # ``${CMAKE_INSTALL_PREFIX}/include/``, see `Setting the install prefix`_). diff --git a/cmake/tribits/core/test_support/TribitsAddTest.cmake b/cmake/tribits/core/package_arch/TribitsAddTest.cmake similarity index 99% rename from cmake/tribits/core/test_support/TribitsAddTest.cmake rename to cmake/tribits/core/package_arch/TribitsAddTest.cmake index 9e23d71c3c..6f388fdaca 100644 --- a/cmake/tribits/core/test_support/TribitsAddTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTest.cmake @@ -37,9 +37,8 @@ # ************************************************************************ # @HEADER - -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) -include("${CMAKE_CURRENT_LIST_DIR}/TribitsAddTestHelpers.cmake") +include(TribitsCMakePolicies NO_POLICY_SCOPE) +include(TribitsAddTestHelpers) # @FUNCTION: tribits_add_test() @@ -818,8 +817,6 @@ function(tribits_add_test EXE_NAME) message("TRIBITS_ADD_TEST: ${EXE_NAME} ${ARGN}") endif() - tribits_set_tribits_package_name() - global_set(TRIBITS_ADD_TEST_ADD_TEST_INPUT) global_set(TRIBITS_SET_TEST_PROPERTIES_INPUT) global_set(MESSAGE_WRAPPER_INPUT) @@ -938,6 +935,8 @@ function(tribits_add_test EXE_NAME) tribits_add_test_adjust_directory( ${EXE_BINARY_NAME} "${PARSE_DIRECTORY}" EXECUTABLE_PATH) + #message("TRIBITS_ADD_TEST: ${EXE_NAME}: EXECUTABLE_PATH = ${EXECUTABLE_PATH}") + # # D) Determine if we will add the serial or MPI tests based on input COMM # and TPL_ENABLE_MPI diff --git a/cmake/tribits/core/test_support/TribitsAddTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake similarity index 96% rename from cmake/tribits/core/test_support/TribitsAddTestHelpers.cmake rename to cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake index 98190718a4..715bca20f9 100644 --- a/cmake/tribits/core/test_support/TribitsAddTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake @@ -37,25 +37,19 @@ # ************************************************************************ # @HEADER -include_guard() -include("${CMAKE_CURRENT_LIST_DIR}/TribitsAddExecutableTestHelpers.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/TribitsSetTribitsPackageName.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/TribitsTestCategories.cmake") - -include("${CMAKE_CURRENT_LIST_DIR}/../utils/GlobalSet.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/AppendGlobalSet.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/AppendStringVarWithSep.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/PrintVar.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/AdvancedSet.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/MessageWrapper.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/TribitsGetCategoriesString.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/TribitsSetCacheVarAndDefault.cmake") - - -tribits_advanced_set_cache_var_and_default(${PROJECT_NAME}_TRACE_ADD_TEST BOOL - "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" - "Show a configure-time trace of every test added or not added any why (one line).") +include(TribitsAddExecutableTestHelpers) +include(TribitsGeneralMacros) +include(TribitsTestCategories) + +include(CMakeParseArguments) +include(GlobalSet) +include(AppendGlobalSet) +include(AppendStringVarWithSep) +include(PrintVar) +include(AdvancedSet) +include(MessageWrapper) +include(TribitsGetCategoriesString) # Do initialization for test helpers diff --git a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake index 814533ea35..cc6da7aba6 100644 --- a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake +++ b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake @@ -853,7 +853,7 @@ macro(tribits_set_package_and_related_upstream_packages_to_external packageName tribits_set_upstream_dep_packages_as_external(${packageName} ${subpackageTriggeredParentPackageExternal}) - tribits_mark_package_as_upstream_of_tribits_compliant_external_package(${packageName}) + tribits_set_package_as_processed_by_downstream_tribits_external_package(${packageName}) endmacro() # NOTE: In the above macro, if ${packageName} is made EXTERNAL because it one @@ -1317,16 +1317,10 @@ macro(tribits_set_upstream_dep_packages_as_external packageName endmacro() -# Mark a package as being upstream of a TriBITS-compliant external package -# (and therefore should be processed by a downstream TriBITS-complaint -# package) -# -# NOTE: These packages are initially marked by setting -# ``${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. -# If this packages are not actually defined by a downstream TriBITS-compliant -# external package, then this variable will be set to ``FALSE`` later. +# Mark a package as being processed by a downstream TriBITS-compliant external +# package # -macro(tribits_mark_package_as_upstream_of_tribits_compliant_external_package packageName) +macro(tribits_set_package_as_processed_by_downstream_tribits_external_package packageName) set_default(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) @@ -1350,10 +1344,10 @@ macro(tribits_mark_package_as_upstream_of_tribits_compliant_external_package pa endif() if (packageEnable AND (NOT ${packageName}_IS_TRIBITS_COMPLIANT)) message("-- " - "NOTE: ${packageName} is ${directOrIndirectStr} upstream from a" + "NOTE: ${packageName} is ${directOrIndirectStr} downstream from a" " TriBITS-compliant external package${downstreamPkgStr}") endif() - set(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE TRUE) + set(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE TRUE) break() endif() @@ -1364,7 +1358,6 @@ macro(tribits_mark_package_as_upstream_of_tribits_compliant_external_package pa endmacro() - # Macro that sets ``_ENABLE_=ON`` if not already # enabled for all enabled subpackages of a parent package. # @@ -1431,6 +1424,13 @@ macro(tribits_set_internal_package_to_external depPkgName) endmacro() +macro(tribits_set_as_processed_by_downstream_tribits_external_package packageName + depPkgName + ) + +endmacro() + + # Function to return if is to be treated as an EXTERNAL package # in processing of the package # diff --git a/cmake/tribits/core/common/TribitsCMakePolicies.cmake b/cmake/tribits/core/package_arch/TribitsCMakePolicies.cmake similarity index 100% rename from cmake/tribits/core/common/TribitsCMakePolicies.cmake rename to cmake/tribits/core/package_arch/TribitsCMakePolicies.cmake diff --git a/cmake/tribits/core/package_arch/TribitsConfigureTiming.cmake b/cmake/tribits/core/package_arch/TribitsConfigureTiming.cmake deleted file mode 100644 index 00db385c17..0000000000 --- a/cmake/tribits/core/package_arch/TribitsConfigureTiming.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# @HEADER -# ************************************************************************ -# -# TriBITS: Tribal Build, Integrate, and Test System -# Copyright 2013 Sandia Corporation -# -# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, -# the U.S. Government retains certain rights in this software. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ************************************************************************ -# @HEADER - - -include(TimingUtils) - - -# Optionally start CMake code configure timing -# -function(tribits_config_code_start_timer START_TIMER_SECONDS_VAR_OUT) - if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - timer_get_raw_seconds(START_TIMER_SECONDS) - set(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) - endif() -endfunction() - - -# Optionally stop CMake code configure timing -# -function(tribits_config_code_stop_timer START_TIMER_SECONDS_VAR_IN - TIMER_STR - ) - if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) - timer_get_raw_seconds(TIMER_STOP_SECONDS) - timer_print_rel_time(${${START_TIMER_SECONDS_VAR_IN}} - ${TIMER_STOP_SECONDS} - "${TIMER_STR}") - endif() -endfunction() - - -# Optionally start CMake code **package** configure timing -# -function(tribits_package_config_code_start_timer START_TIMER_SECONDS_VAR_OUT) - if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING - AND - ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING - OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) - ) - timer_get_raw_seconds(START_TIMER_SECONDS) - set(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) - endif() -endfunction() - - -# Optionally stop CMake code **package** configure timing -# -function(tribits_package_config_code_stop_timer START_TIMER_SECONDS_VAR_IN - TIMER_STR - ) - if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING - AND - ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING - OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) - ) - timer_get_raw_seconds(TIMER_STOP_SECONDS) - timer_print_rel_time(${${START_TIMER_SECONDS_VAR_IN}} - ${TIMER_STOP_SECONDS} - "${TIMER_STR}") - endif() -endfunction() diff --git a/cmake/tribits/core/common/TribitsConstants.cmake b/cmake/tribits/core/package_arch/TribitsConstants.cmake similarity index 100% rename from cmake/tribits/core/common/TribitsConstants.cmake rename to cmake/tribits/core/package_arch/TribitsConstants.cmake diff --git a/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake b/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake index ffeef4bdbb..f4e1e3bc75 100644 --- a/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake +++ b/cmake/tribits/core/package_arch/TribitsCopyFilesToBinaryDir.cmake @@ -38,6 +38,7 @@ # @HEADER +include(TribitsAddTestHelpers) include(CMakeParseArguments) diff --git a/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake b/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake index b35afaea47..a136e8f341 100644 --- a/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake +++ b/cmake/tribits/core/package_arch/TribitsFindMostRecentFileTimestamp.cmake @@ -37,9 +37,6 @@ # ************************************************************************ # @HEADER - -include(TribitsConfigureTiming) - include(CMakeParseArguments) diff --git a/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake b/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake index 8236e47a5b..0dc079655a 100644 --- a/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGeneralMacros.cmake @@ -46,6 +46,62 @@ include(TribitsDeprecatedHelpers) include(TribitsGetPackageEnableStatus) +# Optionally start CMake code configure timing +# +function(tribits_config_code_start_timer START_TIMER_SECONDS_VAR_OUT) + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) + timer_get_raw_seconds(START_TIMER_SECONDS) + set(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) + endif() +endfunction() + + +# Optionally stop CMake code configure timing +# +function(tribits_config_code_stop_timer START_TIMER_SECONDS_VAR_IN + TIMER_STR + ) + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING) + timer_get_raw_seconds(TIMER_STOP_SECONDS) + timer_print_rel_time(${${START_TIMER_SECONDS_VAR_IN}} + ${TIMER_STOP_SECONDS} + "${TIMER_STR}") + endif() +endfunction() + + +# Optionally start CMake code **package** configure timing +# +function(tribits_package_config_code_start_timer START_TIMER_SECONDS_VAR_OUT) + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING + AND + ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING + OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) + ) + timer_get_raw_seconds(START_TIMER_SECONDS) + set(${START_TIMER_SECONDS_VAR_OUT} ${START_TIMER_SECONDS} PARENT_SCOPE) + endif() +endfunction() + + +# Optionally stop CMake code **package** configure timing +# +function(tribits_package_config_code_stop_timer START_TIMER_SECONDS_VAR_IN + TIMER_STR + ) + if (${PROJECT_NAME}_ENABLE_CONFIGURE_TIMING + AND + ( ${PROJECT_NAME}_ENABLE_PACKAGE_CONFIGURE_TIMING + OR ${TRIBITS_PACKAGE}_PACKAGE_CONFIGURE_TIMING ) + ) + timer_get_raw_seconds(TIMER_STOP_SECONDS) + timer_print_rel_time(${${START_TIMER_SECONDS_VAR_IN}} + ${TIMER_STOP_SECONDS} + "${TIMER_STR}") + endif() +endfunction() + + # Set the combined directory name taking into account '.' repos. # function(tribits_get_repo_name REPO_DIR REPO_NAME_OUT) diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index 63149a3750..5315bb0a6a 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -38,14 +38,11 @@ # @HEADER # Standard TriBITS system includes - -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsConstants.cmake") - -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsTestCategories.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsAddTestHelpers.cmake") - +include(TribitsConstants) include(TribitsSetupMPI) +include(TribitsTestCategories) include(TribitsGeneralMacros) +include(TribitsAddTestHelpers) include(TribitsVerbosePrintVar) include(TribitsProcessEnabledTpls) include(TribitsInstallHeaders) @@ -55,7 +52,6 @@ include(TribitsReadAllProjectDepsFilesCreateDepsGraph) include(TribitsAdjustPackageEnables) include(TribitsGitRepoVersionInfo) include(TribitsSetUpEnabledOnlyDependencies) -include(TribitsConfigureTiming) # Standard TriBITS utilities includes include(TribitsAddOptionAndDefine) @@ -467,6 +463,13 @@ macro(tribits_define_global_options_and_define_extra_repos) "Make the ${PROJECT_NAME} configure process verbose." ) + if ("${${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT ${${PROJECT_NAME}_VERBOSE_CONFIGURE}) + endif() + advanced_set(${PROJECT_NAME}_TRACE_ADD_TEST ${${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT} + CACHE BOOL + "Show a configure time trace of every test added or not added any why (one line)." ) + advanced_option(${PROJECT_NAME}_DUMP_LINK_LIBS "Dump the link libraries for every library and executable created." "${${PROJECT_NAME}_VERBOSE_CONFIGURE}" ) @@ -1130,6 +1133,106 @@ macro(tribits_setup_installation_paths) endmacro() +# +# Macros to process repository specializaiton call-back functions +# +# NOTE: The Tribits system promises to only include these call-back files once +# (in order) and to only the call call-back macros they provide once (in +# order). +# + + +macro(create_empty_tribits_repository_setup_extra_options) + macro(tribits_repository_setup_extra_options) + endmacro() +endmacro() + + +macro(tribits_repository_setup_extra_options_runner REPO_NAME) + set(CALLBACK_SETUP_EXTRA_OPTIONS_FILE + "${${REPO_NAME}_SOURCE_DIR}/cmake/CallbackSetupExtraOptions.cmake") + #print_var(CALLBACK_SETUP_EXTRA_OPTIONS_FILE) + if (EXISTS ${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing call-back file and macros in" + " '${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}'") + endif() + # Define the callback macros as empty in case it is not defined + # in this file. + create_empty_tribits_repository_setup_extra_options() + # Include the file which will define the callback macros + set(REPOSITORY_NAME ${REPO_NAME}) + tribits_trace_file_processing(REPOSITORY INCLUDE + "${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}") + include(${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) + # Call the callback macros to inject repository-specific behavir + tribits_repository_setup_extra_options() + # Set back the callback macros to empty to ensure that nonone calls them + create_empty_tribits_repository_setup_extra_options() + endif() +endmacro() + + +macro(create_empty_tribits_repository_define_packaging) + macro(tribits_repository_define_packaging) + endmacro() +endmacro() + + +macro(tribits_repository_define_packaging_runner REPO_NAME) + set(CALLBACK_DEFINE_PACKAGING_FILE + "${${REPO_NAME}_SOURCE_DIR}/cmake/CallbackDefineRepositoryPackaging.cmake") + #print_var(CALLBACK_DEFINE_PACKAGING_FILE) + if (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing call-back file and macros in" + " '${CALLBACK_DEFINE_PACKAGING_FILE}'") + endif() + # Define the callback macros as empty in case it is not defined + # in this file. + create_empty_tribits_repository_define_packaging() + # Include the file which will define the callback macros + tribits_trace_file_processing(REPOSITORY INCLUDE + "${CALLBACK_DEFINE_PACKAGING_FILE}") + include(${CALLBACK_DEFINE_PACKAGING_FILE}) + # Call the callback macros to inject repository-specific behavir + tribits_repository_define_packaging() + # Set back the callback macros to empty to ensure that nonone calls them + create_empty_tribits_repository_define_packaging() + endif() +endmacro() + + +macro(create_empty_tribits_project_define_packaging) + macro(tribits_project_define_packaging) + endmacro() +endmacro() + + +macro(tribits_project_define_packaging_runner) + set(CALLBACK_DEFINE_PACKAGING_FILE + "${PROJECT_SOURCE_DIR}/cmake/CallbackDefineProjectPackaging.cmake") + #print_var(CALLBACK_DEFINE_PACKAGING_FILE) + if (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing call-back file and macros in" + " '${CALLBACK_DEFINE_PACKAGING_FILE}'") + endif() + # Define the callback macros as empty in case it is not defined + # in this file. + create_empty_tribits_project_define_packaging() + # Include the file which will define the callback macros + tribits_trace_file_processing(PROJECT INCLUDE + "${CALLBACK_DEFINE_PACKAGING_FILE}") + include(${CALLBACK_DEFINE_PACKAGING_FILE}) + # Call the callback macros to inject project-specific behavir + tribits_project_define_packaging() + # Set back the callback macros to empty to ensure that nonone calls them + create_empty_tribits_project_define_packaging() + endif() +endmacro() + + # Read in the Project's native repositories. # # On output, the variable ${PRJOECT_NAME}_NATIVE_REPOSITORIES is set. @@ -2068,20 +2171,17 @@ macro(tribits_configure_enabled_packages) tribits_trace_file_processing(PACKAGE ADD_SUBDIR "${TRIBITS_PACKAGE_CMAKELIST_FILE}") if (NOT ${TRIBITS_PACKAGE}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) - add_subdirectory(${${TRIBITS_PACKAGE}_SOURCE_DIR} - ${${TRIBITS_PACKAGE}_BINARY_DIR}) + add_subdirectory(${${TRIBITS_PACKAGE}_SOURCE_DIR} ${${TRIBITS_PACKAGE}_BINARY_DIR}) else() include("${TRIBITS_PACKAGE_CMAKELIST_FILE}") endif() - if ((NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS) AND - (NOT TARGET ${PACKAGE_NAME}::all_libs) - ) + if (NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS) tribits_report_invalid_tribits_usage( "ERROR: Forgot to call tribits_package_postprocess() in" " ${TRIBITS_PACKAGE_CMAKELIST_FILE}") endif() - list(APPEND ENABLED_PACKAGE_LIBS_TARGETS ${TRIBITS_PACKAGE}::all_libs) + list(APPEND ENABLED_PACKAGE_LIBS_TARGETS ${TRIBITS_PACKAGE}_libs) list(APPEND ${PROJECT_NAME}_LIBRARIES ${${TRIBITS_PACKAGE}_LIBRARIES}) tribits_package_config_code_stop_timer(PROCESS_THIS_PACKAGE_TIME_START_SECONDS @@ -2197,6 +2297,150 @@ macro(tribits_configure_enabled_packages) endmacro() +# Set up for packaging and distribution +# +macro(tribits_setup_packaging_and_distribution) + + tribits_config_code_start_timer(CPACK_SETUP_TIME_START_SECONDS) + + # K.1) Run callback function for the base project. + + tribits_project_define_packaging_runner() + # The above must define the basic project settings for CPACK that are + # specific to the project and should not be provided by the user. + + # K.2) Removing any packages or packages not enabled from the tarball + + if (${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION) + set(tribitsPackageList ${${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES}) + else() + set(tribitsPackageList ${${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES}) + endif() + + tribits_get_sublist_nonenabled(tribitsPackageList nonEnabledTribitsPackage "") + + foreach(TRIBITS_PACKAGE ${nonEnabledTribitsPackage}) + + # Determine if this is a package to not ignore + find_list_element(TRIBITS_CPACK_PACKAGES_TO_NOT_IGNORE + ${TRIBITS_PACKAGE} TRIBITS_PACKAGE_DONT_IGNORE) + + if (NOT TRIBITS_PACKAGE_DONT_IGNORE) + + # Checking if we have a relative path to the package's files. Since the + # exclude is a regular expression any "../" will be interpreted as / which would never match the package's actual + # directory. There isn't a direct way in cmake to convert a relative + # path into an absolute path with string operations so as a way of + # making sure that we get the correct path of the package we use a + # find_path for the CMakeLists.txt file for the package. Since the + # package has to have this file to work correctly it should be + # guaranteed to be there. + string(REGEX MATCH "[.][.]/" RELATIVE_PATH_CHARS_MATCH + ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) + if ("${RELATIVE_PATH_CHARS_MATCH}" STREQUAL "") + set(CPACK_SOURCE_IGNORE_FILES + "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}/" + ${CPACK_SOURCE_IGNORE_FILES}) + else() + find_path(ABSOLUTE_PATH CMakeLists.txt PATHS + "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}" + NO_DEFAULT_PATH) + if ("${ABSOLUTE_PATH}" STREQUAL "ABSOLUTE_PATH-NOTFOUND") + message(AUTHOR_WARNING "Relative path found for disabled package" + " ${TRIBITS_PACKAGE} but package was missing a CMakeLists.txt file." + " This disabled package will likely not be excluded from a source release") + endif() + set(CPACK_SOURCE_IGNORE_FILES ${ABSOLUTE_PATH} ${CPACK_SOURCE_IGNORE_FILES}) + endif() + endif() + + endforeach() + + # Add excludes for VC files/dirs + set(CPACK_SOURCE_IGNORE_FILES + ${CPACK_SOURCE_IGNORE_FILES} + /[.]git/ + [.]gitignore$ + ) + + # Print the set of excluded files + if(${PROJECT_NAME}_VERBOSE_CONFIGURE OR + ${PROJECT_NAME}_DUMP_CPACK_SOURCE_IGNORE_FILES + ) + message("Exclude files when building source packages") + foreach(item ${CPACK_SOURCE_IGNORE_FILES}) + message(${item}) + endforeach() + endif() + + # K.3) Set up install component dependencies + + tribits_get_sublist_enabled( + ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES + enabledInternalToplevelPackages "") + + foreach(pkgName ${enabledInternalToplevelPackages}) + if(NOT "${${pkgName}_LIB_ENABLED_DEPENDENCIES}" STREQUAL "") + string(TOUPPER ${pkgName} upperPkgName) + set(CPACK_COMPONENT_${upperPkgName}_DEPENDS ${${pkgName}_LIB_ENABLED_DEPENDENCIES}) + # ToDo: The above needs to be changed to the list of *internal* enabled + # package dependencies! (But there are no tests for this currently and + # I am not sure who is using this.) + endif() + endforeach() + + # K.4) Resetting the name to avoid overwriting registry keys when installing + + if(WIN32) + set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}") + if (TPL_ENABLE_MPI) + set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-mpi") + ELSE () + set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-serial") + endif() + set(CPACK_GENERATOR "NSIS") + set(CPACK_NSIS_MODIFY_PATH OFF) + endif() + + # K.5) Determine the source generator + if ("${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT "TGZ") + endif() + set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR + ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT} + CACHE STRING + "The types of source generators to use for CPACK_SOURCE_GENERATOR.") + set(CPACK_SOURCE_GENERATOR ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR}) + + # K.6) Loop through the Repositories and run their callback functions. + foreach(REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) + tribits_get_repo_name_dir(${REPO} REPO_NAME REPO_DIR) + if (${PROJECT_NAME}_VERBOSE_CONFIGURE) + message("Processing packaging call-backs for ${REPO_NAME}") + endif() + tribits_repository_define_packaging_runner(${REPO_NAME}) + endforeach() + + # K.7) Include RepoVersion.txt if generated + set(PROJECT_REPO_VERSION_FILE + "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}") + if (EXISTS "${PROJECT_REPO_VERSION_FILE}") + foreach(SOURCE_GEN ${CPACK_SOURCE_GENERATOR}) + set(CPACK_INSTALL_COMMANDS ${CPACK_INSTALL_COMMANDS} + "${CMAKE_COMMAND} -E copy '${PROJECT_REPO_VERSION_FILE}' '${CMAKE_CURRENT_BINARY_DIR}/_CPack_Packages/Linux-Source/${SOURCE_GEN}/${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}-Source/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}'") + endforeach() + endif() + + # K.8) Finally process with CPack + include(CPack) + + tribits_config_code_stop_timer(CPACK_SETUP_TIME_START_SECONDS + "Total time to set up for CPack packaging") + +endmacro() + + # Create custom 'install_package_by_package' target # function(tribits_add_install_package_by_package_target) @@ -2244,6 +2488,104 @@ macro(tribits_setup_for_installation) endmacro() + +# @MACRO: tribits_exclude_files() +# +# Exclude package files/dirs from the source distribution by appending +# ``CPACK_SOURCE_IGNORE_FILES``. +# +# Usage:: +# +# tribits_exclude_files( ...) +# +# This is called in the top-level parent package's +# `/CMakeLists.txt`_ file and each file or directory name +# ```` is actually interpreted by CMake/CPack as a regex that is +# prefixed by the project's and package's source directory names so as to not +# exclude files and directories of the same name and path from other packages. +# If ```` is an absolute path it is not prefixed but is appended to +# ``CPACK_SOURCE_IGNORE_FILES`` unmodified. +# +# In general, do **NOT** put in excludes for files and directories that are +# not under this package's source tree. If the given package is not enabled, +# then this command will never be called! For example, don't put in excludes +# for PackageB's files in PackageA's ``CMakeLists.txt`` file because if +# PackageB is enabled but PackageA is not, the excludes for PackageB will +# never get added to ``CPACK_SOURCE_IGNORE_FILES``. +# +# Also, be careful to note that the ```` arguments are actually regexes +# and one must be very careful to understand how CPack will use these regexes +# to match files that get excluded from the tarball. For more details, see +# `Creating Source Distributions`_. +# +macro(tribits_exclude_files) + + if (NOT "${${PACKAGE_NAME}_PARENT_PACKAGE}" STREQUAL "") + message(FATAL_ERROR + "ERROR: tribits_exclude_files() was called in a subpackage CmakeLists.txt file!" + " Instead, move this call to the file" + " ${${${PACKAGE_NAME}_PARENT_PACKAGE}_SOURCE_DIR}/CMakeLists.txt" + " and adjust the paths accordingly!" ) + endif() + + set(FILES_TO_EXCLUDE ${ARGN}) + + # Need to add "///" to each file to prevent + # someone from trying to exclude a file like "readme" and having it + # inadvertently exclude a file matching that name in another package. + set(MODIFIED_FILES_TO_EXCLUDE "") + + set(${PROJECT_NAME}_SOURCE_PATH ${${PROJECT_NAME}_SOURCE_DIR}) + + foreach(FILE ${FILES_TO_EXCLUDE}) + #Ensure that if the full path was specified for the file that we don't add + #"///" again. + set(MATCH_STRING "${${PACKAGE_NAME}_SOURCE_DIR}") + string(REGEX MATCH ${MATCH_STRING} MATCHED ${FILE} ) + if(NOT MATCHED) + list(APPEND MODIFIED_FILES_TO_EXCLUDE + "${${PACKAGE_NAME}_SOURCE_DIR}/${FILE}") + else() + list(APPEND MODIFIED_FILES_TO_EXCLUDE ${FILE}) + endif() + endforeach() + +#Leaving in for debugging purposes +# message("List of files being excluded for package ${PACKAGE_NAME}") +# foreach(NEW_FILE ${MODIFIED_FILES_TO_EXCLUDE}) +# message(${NEW_FILE}) +# endforeach() + + list(APPEND CPACK_SOURCE_IGNORE_FILES ${MODIFIED_FILES_TO_EXCLUDE}) + if (NOT ${PROJECT_NAME}_BINARY_DIR STREQUAL ${PACKAGE_NAME}_BINARY_DIR) + set(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} PARENT_SCOPE) + endif() + +endmacro() + + +# Exclude files only for the packages that will not be supporting autotools. +# +macro(tribits_exclude_autotools_files) # PACKAGE_NAME LIST_RETURN) + set(AUTOTOOLS_FILES + configure.ac$ + configure$ + Makefile.am$ + Makefile.in$ + bootstrap$ + .*[.]m4$ + config/ + ) + + set(FILES_TO_EXCLUDE) + foreach(FILE ${AUTOTOOLS_FILES}) + list(APPEND FILES_TO_EXCLUDE ${FILE} \(.*/\)*${FILE}) + endforeach() + + tribits_exclude_files(${FILES_TO_EXCLUDE}) + +endmacro() + # LocalWords: # LocalWords: Sandia SANDIA Redistributions # LocalWords: tribits TriBITS TRIBITS diff --git a/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake b/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake index 7ac01b81ed..c1bf530397 100644 --- a/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake +++ b/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake @@ -76,7 +76,7 @@ include(CMakeParseArguments) # If specified, then ``COMPONENT `` will be passed into # ``install()``. Otherwise, ``COMPONENT ${PROJECT_NAME}`` will get used. # -# If `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FALSE``, then the +# If `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE``, then the # headers will not get installed. # function(tribits_install_headers) diff --git a/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake b/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake index e820d6222e..914825ffad 100644 --- a/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake +++ b/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake @@ -84,12 +84,12 @@ function(tribits_write_package_client_export_files PACKAGE_NAME) tribits_write_flexible_package_client_export_files(${EXPORT_FILES_ARGS}) - tribits_write_package_client_export_files_export_and_install_targets(${EXPORT_FILES_ARGS}) + tribits_write_package_client_export_files_install_targets(${EXPORT_FILES_ARGS}) endfunction() -# @FUNCTION: tribits_write_package_client_export_files_export_and_install_targets() +# @FUNCTION: tribits_write_package_client_export_files_install_targets() # # Create the ``ConfigTargets.cmake`` file and install rules and the # install() target for the previously generated @@ -98,7 +98,7 @@ endfunction() # # Usage:: # -# tribits_write_package_client_export_files_export_and_install_targets( +# tribits_write_package_client_export_files_install_targets( # PACKAGE_NAME # PACKAGE_CONFIG_FOR_BUILD_BASE_DIR # PACKAGE_CONFIG_FOR_INSTALL_BASE_DIR @@ -107,7 +107,7 @@ endfunction() # The install() commands must be in a different subroutine or CMake will not # allow you to call the routine, even if you if() it out! # -function(tribits_write_package_client_export_files_export_and_install_targets) +function(tribits_write_package_client_export_files_install_targets) cmake_parse_arguments( #prefix @@ -333,10 +333,10 @@ endfunction() # @FUNCTION: tribits_write_flexible_package_client_export_files() # -# Utility function for writing the ``${PACKAGE_NAME}Config.cmake`` files for -# the build dir and/or for the install dir for the package ```` -# with some flexibility . (See NOTE below for what is actually generated and -# what is *NOT* generated.) +# Utility function for writing ``${PACKAGE_NAME}Config.cmake`` files for +# package ``${PACKAGE_NAME}`` with some greater flexibility than what is +# provided by the function ``tribits_write_package_client_export_files()`` and +# to allow unit testing the generation of these files.. # # Usage:: # @@ -352,8 +352,7 @@ endfunction() # ``PACKAGE_NAME `` # # Gives the name of the TriBITS package for which the export files should -# be created. (This must match the export set for the libraries for the -# generated/exported ``ConfigTargets.cmake`` file.) +# be created. # # ``EXPORT_FILE_VAR_PREFIX `` # @@ -363,39 +362,28 @@ endfunction() # # ``PACKAGE_CONFIG_FOR_BUILD_BASE_DIR `` # -# If specified, then the package's ``Config.cmake`` file will -# be written under the directory ``/`` (and -# any subdirs that do not exist will be created). The generated file -# ``Config.cmake`` is for usage of the package in the build -# tree (not the install tree) and points to include directories and -# libraries in the build tree. (NOTE: The included -# ``Targets.cmake`` file is *NOT* generated in this -# function.) +# If specified, then the package's ``Config.cmake`` file and +# supporting files will be written under the directory +# ``/`` (and any subdirs that does exist +# will be created). The generated file ``Config.cmake`` is +# for usage of the package in the build tree (not the install tree) and +# points to include directories and libraries in the build tree. # # ``PACKAGE_CONFIG_FOR_INSTALL_BASE_DIR `` # # If specified, then the package's ``Config_install.cmake`` -# file will be written under the directory -# ``/`` (and any subdirs that do not exist +# file and supporting files will be written under the directory +# ``/`` (and any subdirs that does exist # will be created). The file ``${PACKAGE_NAME}Config_install.cmake`` is # meant to be installed renamed as ``Config.cmake`` in the # install tree and it points to installed include directories and -# libraries. (NOTE: The included ``Targets.cmake`` -# file is *NOT* generated in this function.) -# -# NOTE: This function does *not* generate the ``Config.cmake`` -# files (which will be created later using ``export()`` or ``include()`) which -# are included in these generated package config files and this function. -# Also, this function does *not* invoke the ``install()`` command to install -# the package config file for the install directory. The ``export()`` and -# ``install()`` project commands are bot allowed in `cmake -P` scripting mode -# that is used for unit testing this function. Instead, the commands to -# generate the ``Targets.cmake`` files and install the package -# config file for the install tree are produced by the function -# ``tribits_write_package_client_export_files_export_and_install_targets()`` -# which is called after this function. This allows this function -# ``tribits_write_package_client_export_files()`` to be run in unit testing -# with a `cmake -P` script. +# libraries. +# +# NOTE: This function does *not* contain any ``install()`` command itself +# because CMake will not allow those to even be present in scripting mode that +# is used for unit testing this function. Instead, the commands to install +# the files are added by the function +# ``tribits_write_package_client_export_files_install_targets()``. # function(tribits_write_flexible_package_client_export_files) @@ -537,35 +525,25 @@ function(tribits_append_dependent_package_config_file_includes_and_enables_str p # Include configurations of dependent packages string(APPEND configFileStr "\n# Include configuration of dependent packages\n") - set(DOLLAR "$") - set(externalPkgsDir - "${DOLLAR}{CMAKE_CURRENT_LIST_DIR}/../../${${PROJECT_NAME}_BUILD_DIR_EXTERNAL_PKGS_DIR}") foreach(depPkg IN LISTS ${packageName}_LIB_ENABLED_DEPENDENCIES) - set(findDepPkgCode "") # Start out not including anything + set(packageConfigBaseDir "") # Initially, no add include() if (${depPkg}_PACKAGE_BUILD_STATUS STREQUAL "INTERNAL") - set(findDepPkgCode - " include(\"${DOLLAR}{CMAKE_CURRENT_LIST_DIR}/../${depPkg}/${depPkg}Config.cmake\")\n") + set(packageConfigBaseDir "\${CMAKE_CURRENT_LIST_DIR}/../${depPkg}") elseif (${depPkg}_PACKAGE_BUILD_STATUS STREQUAL "EXTERNAL") if (NOT "${${depPkg}_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR}" STREQUAL "") - set(findDepPkgCode - " include(\"${${depPkg}_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR}/${depPkg}Config.cmake\")\n") - elseif (${depPkg}_FINDMOD STREQUAL "TRIBITS_PKG") - assert_defined(${depPkg}_CONFIG) - string(APPEND findDepPkgCode - " include(\"${${depPkg}_CONFIG}\")\n" - " set(${depPkg}_CONFIG \"${${depPkg}_CONFIG}\")\n") + set(packageConfigBaseDir "${${depPkg}_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR}") else() - set(findDepPkgCode - " include(\"${externalPkgsDir}/${depPkg}/${depPkg}Config.cmake\")\n") + set(packageConfigBaseDir + "\${CMAKE_CURRENT_LIST_DIR}/../../${${PROJECT_NAME}_BUILD_DIR_EXTERNAL_PKGS_DIR}/${depPkg}") endif() else() message(FATAL_ERROR "ERROR:" " ${depPkg}_PACKAGE_BUILD_STATUS='${${depPkg}_PACKAGE_BUILD_STATUS}' invalid!") endif() - if (findDepPkgCode) + if (packageConfigBaseDir) string(APPEND configFileStr "if (NOT TARGET ${depPkg}::all_libs)\n" - "${findDepPkgCode}" + " include(\"${packageConfigBaseDir}/${depPkg}Config.cmake\")\n" "endif()\n" ) endif() diff --git a/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake b/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake index a5584fb85a..c2136eb745 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageDefineDependencies.cmake @@ -57,12 +57,12 @@ include(TribitsGeneralMacros) # [LIB_OPTIONAL_TPLS ...] # [TEST_REQUIRED_TPLS ...] # [TEST_OPTIONAL_TPLS ...] +# [REGRESSION_EMAIL_LIST ] # [SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS # # # ... # ] -# [REGRESSION_EMAIL_LIST ] # ) # # Every argument in this macro is optional (that is, an package can have no @@ -84,9 +84,9 @@ 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`` # @@ -94,52 +94,39 @@ include(TribitsGeneralMacros) # 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. Not enabling these optional upstream packages -# will result in diminished tests or examples. +# testing of some type. # # ``LIB_REQUIRED_TPLS`` # -# **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.) +# List of required upstream TPLs that must be enabled in order to build +# and use the libraries (or capabilities) in this package. # # ``LIB_OPTIONAL_TPLS`` # -# **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.) +# 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. # # ``TEST_REQUIRED_TPLS`` # -# **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.) +# 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. # # ``TEST_OPTIONAL_TPLS`` # -# **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.) +# 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. # # Only upstream packages can be listed (as defined by the order the packages # are listed in `tribits_repository_define_packages()`_ in the -# `/PackagesList.cmake`_ or `/TPLsList.cmake`_ files). -# Otherwise an error will occur and processing will stop. Misspelled package -# names are caught as well. +# `/PackagesList.cmake`_ file). 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 @@ -149,10 +136,14 @@ 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``. +# ``TEST_OPTIONAL_PACKAGES``. Same goes for TPL dependencies. # # 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 @@ -162,7 +153,9 @@ include(TribitsGeneralMacros) # # or:: # -# LIB_REQUIRED_PACKAGES PKG1 PKG2 +# "LIB_REQUIRED_PACKAGES PKG1 PKG2 +# +# Likewise the order that dependent TPLs are listed is not significant. # # If some upstream packages are allowed to be missing, this can be specified # by calling the macro `tribits_allow_missing_external_packages()`_. @@ -206,6 +199,27 @@ 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( diff --git a/cmake/tribits/core/package_arch/TribitsPackageDependencies.cmake b/cmake/tribits/core/package_arch/TribitsPackageDependencies.cmake index 5f2e31595b..0f4a956dd7 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageDependencies.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageDependencies.cmake @@ -50,8 +50,7 @@ include_guard() -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsCMakePolicies.cmake" - NO_POLICY_SCOPE) +include(TribitsCMakePolicies NO_POLICY_SCOPE) include(TribitsParseArgumentsHelpers) include(MessageWrapper) diff --git a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake index d7931c4067..0a091c4d2d 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake @@ -51,14 +51,13 @@ include(PrependGlobalSet) include(RemoveGlobalDuplicates) include(TribitsGatherBuildTargets) -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsAddTest.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsAddAdvancedTest.cmake") - include(TribitsAddOptionAndDefine) include(TribitsPkgExportCacheVars) include(TribitsLibraryMacros) include(TribitsAddExecutable) include(TribitsAddExecutableAndTest) +include(TribitsAddTest) +include(TribitsAddAdvancedTest) include(TribitsCopyFilesToBinaryDir) include(TribitsReportInvalidTribitsUsage) diff --git a/cmake/tribits/core/package_arch/TribitsPackagingSupport.cmake b/cmake/tribits/core/package_arch/TribitsPackagingSupport.cmake deleted file mode 100644 index e4dc246368..0000000000 --- a/cmake/tribits/core/package_arch/TribitsPackagingSupport.cmake +++ /dev/null @@ -1,354 +0,0 @@ -# @HEADER -# ************************************************************************ -# -# TriBITS: Tribal Build, Integrate, and Test System -# Copyright 2013 Sandia Corporation -# -# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, -# the U.S. Government retains certain rights in this software. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ************************************************************************ -# @HEADER - - -# TriBITS package_arch includes -include(TribitsConfigureTiming) -include(TribitsGetPackageSublists) - -# TriBITS utils includes -include(FindListElement) - - -# @MACRO: tribits_exclude_files() -# -# Exclude package files/dirs from the source distribution by appending -# ``CPACK_SOURCE_IGNORE_FILES``. -# -# Usage:: -# -# tribits_exclude_files( ...) -# -# This is called in the top-level parent package's -# `/CMakeLists.txt`_ file and each file or directory name -# ```` is actually interpreted by CMake/CPack as a regex that is -# prefixed by the project's and package's source directory names so as to not -# exclude files and directories of the same name and path from other packages. -# If ```` is an absolute path it is not prefixed but is appended to -# ``CPACK_SOURCE_IGNORE_FILES`` unmodified. -# -# In general, do **NOT** put in excludes for files and directories that are -# not under this package's source tree. If the given package is not enabled, -# then this command will never be called! For example, don't put in excludes -# for PackageB's files in PackageA's ``CMakeLists.txt`` file because if -# PackageB is enabled but PackageA is not, the excludes for PackageB will -# never get added to ``CPACK_SOURCE_IGNORE_FILES``. -# -# Also, be careful to note that the ```` arguments are actually regexes -# and one must be very careful to understand how CPack will use these regexes -# to match files that get excluded from the tarball. For more details, see -# `Creating Source Distributions`_. -# -macro(tribits_exclude_files) - - if (NOT "${${PACKAGE_NAME}_PARENT_PACKAGE}" STREQUAL "") - message(FATAL_ERROR - "ERROR: tribits_exclude_files() was called in a subpackage CmakeLists.txt file!" - " Instead, move this call to the file" - " ${${${PACKAGE_NAME}_PARENT_PACKAGE}_SOURCE_DIR}/CMakeLists.txt" - " and adjust the paths accordingly!" ) - endif() - - set(FILES_TO_EXCLUDE ${ARGN}) - - # Need to add "///" to each file to prevent - # someone from trying to exclude a file like "readme" and having it - # inadvertently exclude a file matching that name in another package. - set(MODIFIED_FILES_TO_EXCLUDE "") - - set(${PROJECT_NAME}_SOURCE_PATH ${${PROJECT_NAME}_SOURCE_DIR}) - - foreach(FILE ${FILES_TO_EXCLUDE}) - #Ensure that if the full path was specified for the file that we don't add - #"///" again. - set(MATCH_STRING "${${PACKAGE_NAME}_SOURCE_DIR}") - string(REGEX MATCH ${MATCH_STRING} MATCHED ${FILE} ) - if(NOT MATCHED) - list(APPEND MODIFIED_FILES_TO_EXCLUDE - "${${PACKAGE_NAME}_SOURCE_DIR}/${FILE}") - else() - list(APPEND MODIFIED_FILES_TO_EXCLUDE ${FILE}) - endif() - endforeach() - -#Leaving in for debugging purposes -# message("List of files being excluded for package ${PACKAGE_NAME}") -# foreach(NEW_FILE ${MODIFIED_FILES_TO_EXCLUDE}) -# message(${NEW_FILE}) -# endforeach() - - list(APPEND CPACK_SOURCE_IGNORE_FILES ${MODIFIED_FILES_TO_EXCLUDE}) - if (NOT ${PROJECT_NAME}_BINARY_DIR STREQUAL ${PACKAGE_NAME}_BINARY_DIR) - set(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} PARENT_SCOPE) - endif() - -endmacro() - - -# Set up for packaging and distribution -# -macro(tribits_setup_packaging_and_distribution) - - tribits_config_code_start_timer(CPACK_SETUP_TIME_START_SECONDS) - - # K.1) Run callback function for the base project. - - tribits_project_define_packaging_runner() - # The above must define the basic project settings for CPACK that are - # specific to the project and should not be provided by the user. - - # K.2) Removing any packages or packages not enabled from the tarball - - if (${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION) - set(tribitsPackageList ${${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES}) - else() - set(tribitsPackageList ${${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES}) - endif() - - tribits_get_sublist_nonenabled(tribitsPackageList nonEnabledTribitsPackage "") - - foreach(TRIBITS_PACKAGE ${nonEnabledTribitsPackage}) - - # Determine if this is a package to not ignore - find_list_element(TRIBITS_CPACK_PACKAGES_TO_NOT_IGNORE - ${TRIBITS_PACKAGE} TRIBITS_PACKAGE_DONT_IGNORE) - - if (NOT TRIBITS_PACKAGE_DONT_IGNORE) - - # Checking if we have a relative path to the package's files. Since the - # exclude is a regular expression any "../" will be interpreted as / which would never match the package's actual - # directory. There isn't a direct way in cmake to convert a relative - # path into an absolute path with string operations so as a way of - # making sure that we get the correct path of the package we use a - # find_path for the CMakeLists.txt file for the package. Since the - # package has to have this file to work correctly it should be - # guaranteed to be there. - string(REGEX MATCH "[.][.]/" RELATIVE_PATH_CHARS_MATCH - ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) - if ("${RELATIVE_PATH_CHARS_MATCH}" STREQUAL "") - list(PREPEND CPACK_SOURCE_IGNORE_FILES - "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}/") - else() - find_path(ABSOLUTE_PATH CMakeLists.txt PATHS - "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}" - NO_DEFAULT_PATH) - if ("${ABSOLUTE_PATH}" STREQUAL "ABSOLUTE_PATH-NOTFOUND") - message(AUTHOR_WARNING "Relative path found for disabled package" - " ${TRIBITS_PACKAGE} but package was missing a CMakeLists.txt file." - " This disabled package will likely not be excluded from a source release") - endif() - list(PREPEND CPACK_SOURCE_IGNORE_FILES "${ABSOLUTE_PATH}") - endif() - endif() - - endforeach() - - # Add excludes for VC files/dirs - list(APPEND CPACK_SOURCE_IGNORE_FILES - /[.]git/ - [.]gitignore$ - ) - - # K.3) Set up install component dependencies - - tribits_get_sublist_enabled( - ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES - enabledInternalToplevelPackages "") - - foreach(pkgName ${enabledInternalToplevelPackages}) - if(NOT "${${pkgName}_LIB_ENABLED_DEPENDENCIES}" STREQUAL "") - string(TOUPPER ${pkgName} upperPkgName) - set(CPACK_COMPONENT_${upperPkgName}_DEPENDS ${${pkgName}_LIB_ENABLED_DEPENDENCIES}) - # ToDo: The above needs to be changed to the list of *internal* enabled - # package dependencies! (But there are no tests for this currently and - # I am not sure who is using this.) - endif() - endforeach() - - # K.4) Resetting the name to avoid overwriting registry keys when installing - - if(WIN32) - set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}") - if (TPL_ENABLE_MPI) - set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-mpi") - ELSE () - set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-serial") - endif() - set(CPACK_GENERATOR "NSIS") - set(CPACK_NSIS_MODIFY_PATH OFF) - endif() - - # K.5) Determine the source generator - if ("${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT}" STREQUAL "") - set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT "TGZ") - endif() - set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR - ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT} - CACHE STRING - "The types of source generators to use for CPACK_SOURCE_GENERATOR.") - set(CPACK_SOURCE_GENERATOR ${${PROJECT_NAME}_CPACK_SOURCE_GENERATOR}) - - # K.6) Loop through the Repositories and run their callback functions. - foreach(REPO ${${PROJECT_NAME}_ALL_REPOSITORIES}) - tribits_get_repo_name_dir(${REPO} REPO_NAME REPO_DIR) - if (${PROJECT_NAME}_VERBOSE_CONFIGURE) - message("Processing packaging call-backs for ${REPO_NAME}") - endif() - tribits_repository_define_packaging_runner(${REPO_NAME}) - endforeach() - - # K.7) Include RepoVersion.txt if generated - set(PROJECT_REPO_VERSION_FILE - "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}") - if (EXISTS "${PROJECT_REPO_VERSION_FILE}") - foreach(SOURCE_GEN ${CPACK_SOURCE_GENERATOR}) - set(CPACK_INSTALL_COMMANDS ${CPACK_INSTALL_COMMANDS} - "${CMAKE_COMMAND} -E copy '${PROJECT_REPO_VERSION_FILE}' '${CMAKE_CURRENT_BINARY_DIR}/_CPack_Packages/Linux-Source/${SOURCE_GEN}/${CPACK_PACKAGE_NAME}-${${PROJECT_NAME}_VERSION}-Source/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}'") - endforeach() - endif() - - # Print the set of excluded files - if(${PROJECT_NAME}_VERBOSE_CONFIGURE OR - ${PROJECT_NAME}_DUMP_CPACK_SOURCE_IGNORE_FILES - ) - message("Exclude files when building source packages:") - foreach(item IN LISTS CPACK_SOURCE_IGNORE_FILES) - message(${item}) - endforeach() - endif() - - # K.8) Finally process with CPack - include(CPack) - - tribits_config_code_stop_timer(CPACK_SETUP_TIME_START_SECONDS - "Total time to set up for CPack packaging") - -endmacro() - - -macro(tribits_project_define_packaging_runner) - set(CALLBACK_DEFINE_PACKAGING_FILE - "${PROJECT_SOURCE_DIR}/cmake/CallbackDefineProjectPackaging.cmake") - #print_var(CALLBACK_DEFINE_PACKAGING_FILE) - if (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) - if (${PROJECT_NAME}_VERBOSE_CONFIGURE) - message("Processing call-back file and macros in" - " '${CALLBACK_DEFINE_PACKAGING_FILE}'") - endif() - # Define the callback macros as empty in case it is not defined - # in this file. - create_empty_tribits_project_define_packaging() - # Include the file which will define the callback macros - tribits_trace_file_processing(PROJECT INCLUDE - "${CALLBACK_DEFINE_PACKAGING_FILE}") - include(${CALLBACK_DEFINE_PACKAGING_FILE}) - # Call the callback macros to inject project-specific behavir - tribits_project_define_packaging() - # Set back the callback macros to empty to ensure that no-one calls them - create_empty_tribits_project_define_packaging() - endif() -endmacro() - - -macro(create_empty_tribits_repository_setup_extra_options) - macro(tribits_repository_setup_extra_options) - endmacro() -endmacro() - - -macro(tribits_repository_setup_extra_options_runner REPO_NAME) - set(CALLBACK_SETUP_EXTRA_OPTIONS_FILE - "${${REPO_NAME}_SOURCE_DIR}/cmake/CallbackSetupExtraOptions.cmake") - #print_var(CALLBACK_SETUP_EXTRA_OPTIONS_FILE) - if (EXISTS ${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) - if (${PROJECT_NAME}_VERBOSE_CONFIGURE) - message("Processing call-back file and macros in" - " '${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}'") - endif() - # Define the callback macros as empty in case it is not defined - # in this file. - create_empty_tribits_repository_setup_extra_options() - # Include the file which will define the callback macros - set(REPOSITORY_NAME ${REPO_NAME}) - tribits_trace_file_processing(REPOSITORY INCLUDE - "${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}") - include(${CALLBACK_SETUP_EXTRA_OPTIONS_FILE}) - # Call the callback macros to inject repository-specific behavir - tribits_repository_setup_extra_options() - # Set back the callback macros to empty to ensure that nonone calls them - create_empty_tribits_repository_setup_extra_options() - endif() -endmacro() - - -macro(create_empty_tribits_repository_define_packaging) - macro(tribits_repository_define_packaging) - endmacro() -endmacro() - - -macro(tribits_repository_define_packaging_runner REPO_NAME) - set(CALLBACK_DEFINE_PACKAGING_FILE - "${${REPO_NAME}_SOURCE_DIR}/cmake/CallbackDefineRepositoryPackaging.cmake") - #print_var(CALLBACK_DEFINE_PACKAGING_FILE) - if (EXISTS ${CALLBACK_DEFINE_PACKAGING_FILE}) - if (${PROJECT_NAME}_VERBOSE_CONFIGURE) - message("Processing call-back file and macros in" - " '${CALLBACK_DEFINE_PACKAGING_FILE}'") - endif() - # Define the callback macros as empty in case it is not defined - # in this file. - create_empty_tribits_repository_define_packaging() - # Include the file which will define the callback macros - tribits_trace_file_processing(REPOSITORY INCLUDE - "${CALLBACK_DEFINE_PACKAGING_FILE}") - include(${CALLBACK_DEFINE_PACKAGING_FILE}) - # Call the callback macros to inject repository-specific behavir - tribits_repository_define_packaging() - # Set back the callback macros to empty to ensure that nonone calls them - create_empty_tribits_repository_define_packaging() - endif() -endmacro() - - -macro(create_empty_tribits_project_define_packaging) - macro(tribits_project_define_packaging) - endmacro() -endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake b/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake index bcc591d638..b161a9edef 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake @@ -43,20 +43,13 @@ include(TribitsExternalPackageWithImportedTargetsFindTplModuleHelpers) include(TribitsExternalPackageWriteConfigFile) include(TribitsTplFindIncludeDirsAndLibraries) include(TribitsGeneralMacros) -include(TribitsConfigureTiming) # Standard TriBITS utilities includes include(AppendStringVar) include(TribitsStandardizePaths) -include(TribitsCreateReverseList) -# @MACRO: tribits_process_enabled_tpls() -# -# Gather information and targets from enabled TPLs -# -# For more info, see `Processing of external packages/TPLs and -# TriBITS-compliant external packages`_. +# Gather information from enabled TPLs # macro(tribits_process_enabled_tpls) @@ -72,13 +65,10 @@ macro(tribits_process_enabled_tpls) if (projectHasTribitsCompliantExternalPackages) message("") message("Getting information for all enabled TriBITS-compliant" - " or upstream external packages/TPLs in reverse order ...") + " or upstream external packages/TPLs ...") message("") - tribits_create_reverse_list(${PROJECT_NAME}_enabledExternalTopLevelPackages - ${PROJECT_NAME}_reverseEnabledExternalTopLevelPackages) - - foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_reverseEnabledExternalTopLevelPackages) + foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_enabledExternalTopLevelPackages) if (${TPL_NAME}_IS_TRIBITS_COMPLIANT OR ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE ) @@ -118,37 +108,16 @@ macro(tribits_process_enabled_tribits_compliant_or_upstream_tpl TPL_NAME) message("${tplProcessingString}") if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - if ( (NOT TARGET ${TPL_NAME}::all_libs) AND ${TPL_NAME}_IS_TRIBITS_COMPLIANT ) + if (NOT ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE) tribits_process_enabled_tribits_compliant_tpl(${TPL_NAME}) - set(${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) - elseif (TARGET ${TPL_NAME}::all_libs) - message("-- " - "The external package/TPL ${TPL_NAME} was defined by a downstream" - " TriBITS-compliant external package already processed") - elseif (${TPL_NAME}_FINDMOD AND (NOT ${TPL_NAME}_FINDMOD STREQUAL "TRIBITS_PKG")) - message("-- " - "The external package/TPL ${TPL_NAME} was *NOT* defined by a downstream" - " TriBITS-compliant external package and must be found again in below loop") - set(${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) else() - message(FATAL_ERROR - "Error, the external package/TPL ${TPL_NAME} was *NOT* defined by a downstream" - " TriBITS-compliant external package and has not find module!") + message("-- " + "The external package/TPL ${TPL_NAME} will be read in by a downstream" + " TriBITS-compliant external package") endif() endif() endmacro() -# NOTE: Above, handles the case where an upstream external package/TPL should -# have been defined a downstream external package that was already processed -# but it was not defined (because the downstream packages was not a fully -# TriBITS-compliant external package). For a TriBITS-compliant external -# package/TPL that should have been defined by a downstream TriBITS-compliant -# an external package/TPL, the first if-statement above takes care of that -# case by calling find_package(${TPL_NAME}) (because ${TPL_NAME}::all_libs -# will not be defined). However, if the upstream external package/TPL is -# *NOT* TriBITS-compliant, then it may be a legacy TriBITS TPL which means -# that it must be processed in ascending order in order to build the -# downstream TriBITS TPLs correctly. # @MACRO: tribits_process_enabled_standard_tpl() @@ -191,19 +160,13 @@ function(tribits_get_enabled_tpl_processing_string TPL_NAME tplProcessingStrin endfunction() -# Process an enabled TPL defined using a TriBITS-compliant external package -# Config.cmake file +# Process an enabled TPL defined using a TriBITS-compliant external +# packages Config.cmake file # macro(tribits_process_enabled_tribits_compliant_tpl TPL_NAME) message("-- " "Calling find_package(${TPL_NAME}) for TriBITS-compliant external package") find_package(${TPL_NAME} CONFIG REQUIRED) - if (${TPL_NAME}_DIR) - message("-- " "Found ${TPL_NAME}_DIR='${${TPL_NAME}_DIR}'") - else() - message(FATAL_ERROR - "ERROR! Failed to find TriBITS-compliant external package ${TPL_NAME}!") - endif() endmacro() diff --git a/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake b/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake index 4fd5f1d96b..447f98265c 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake @@ -535,8 +535,7 @@ macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR) endif() - set(packageDependenciesFile "${PACKAGE_ABS_DIR}/cmake/Dependencies.cmake") - if (EXISTS "${packageDependenciesFile}") + if (EXISTS ${PACKAGE_ABS_DIR}) set(PACKAGE_EXISTS TRUE) else() set(PACKAGE_EXISTS FALSE) @@ -558,16 +557,9 @@ macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR) ) message( "\n***" - "\n*** Error, the package ${TRIBITS_PACKAGE} dependencies file" - " '${packageDependenciesFile}' does *NOT* exist!" + "\n*** Error, the package ${TRIBITS_PACKAGE} directory ${PACKAGE_ABS_DIR} does not exist!" "\n***\n" ) message(FATAL_ERROR "Stopping due to above error!") - elseif((NOT PACKAGE_EXISTS) AND (EXISTS "${PACKAGE_ABS_DIR}") - AND (${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES STREQUAL "WARNING") - ) - message(WARNING "${TRIBITS_PACKAGE}: Package base directory '${PACKAGE_ABS_DIR}'" - " exists but the dependencies file '${packageDependenciesFile}' does *NOT*" - " exist! Package is being ignored anyway!") endif() if (PACKAGE_EXISTS OR ${PROJECT_NAME}_IGNORE_PACKAGE_EXISTS_CHECK) diff --git a/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake b/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake index a30a094045..f5e5a6e55d 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessTplsLists.cmake @@ -38,7 +38,7 @@ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsConstants.cmake") +include(TribitsConstants) include(TribitsListHelpers) include(PrintVar) diff --git a/cmake/tribits/core/package_arch/TribitsProject.cmake b/cmake/tribits/core/package_arch/TribitsProject.cmake index c2385f1665..035e089e3a 100644 --- a/cmake/tribits/core/package_arch/TribitsProject.cmake +++ b/cmake/tribits/core/package_arch/TribitsProject.cmake @@ -66,7 +66,7 @@ if (${PROJECT_NAME}_VERBOSE_CONFIGURE) endif() # Overrides that we have for CMake functions -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) +include(TribitsCMakePolicies NO_POLICY_SCOPE) include(TribitsProjectImpl) diff --git a/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake b/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake index 8eab07d42c..f27caa3e66 100644 --- a/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake +++ b/cmake/tribits/core/package_arch/TribitsProjectImpl.cmake @@ -47,8 +47,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${${PROJECT_NAME}_TRIBITS_DIR}/core/utils - ${${PROJECT_NAME}_TRIBITS_DIR}/core/common - ${${PROJECT_NAME}_TRIBITS_DIR}/core/test_support ${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch ${${PROJECT_NAME}_TRIBITS_DIR}/core/config_tests ${${PROJECT_NAME}_TRIBITS_DIR}/core/modules @@ -59,11 +57,10 @@ if (${PROJECT_NAME}_VERBOSE_CONFIGURE) message("CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") endif() -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsConstants.cmake") +include(TribitsConstants) tribits_asesrt_minimum_cmake_version() -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) +include(TribitsCMakePolicies NO_POLICY_SCOPE) -# TriBITS package_arch includes include(TribitsIncludeDirectories) include(TribitsFindPythonInterp) include(TribitsGlobalMacros) @@ -71,10 +68,7 @@ include(TribitsConfigureCTestCustom) include(TribitsGenerateResourceSpecFile) include(TribitsPackageDependencies) include(TribitsPrintDependencyInfo) -include(TribitsPackagingSupport) -include(TribitsConfigureTiming) -# TriBITS utils includes include(AdvancedSet) include(AdvancedOption) include(TimingUtils) diff --git a/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake b/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake index 14175ee5ad..2b71d82885 100644 --- a/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake +++ b/cmake/tribits/core/package_arch/TribitsReadAllProjectDepsFilesCreateDepsGraph.cmake @@ -39,12 +39,11 @@ # Standard TriBITS system includes -include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsConstants.cmake") +include(TribitsConstants) include(TribitsProcessExtraRepositoriesList) include(TribitsProcessPackagesAndDirsLists) include(TribitsProcessTplsLists) include(TribitsReadDepsFilesCreateDepsGraph) -include(TribitsConfigureTiming) # Standard TriBITS utilities includes include(TimingUtils) diff --git a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake index 43b0063368..4c193adeff 100644 --- a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake +++ b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake @@ -182,7 +182,8 @@ macro(tribits_read_all_package_deps_files_create_deps_graph) set(${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES "") # Packages and subpackages foreach(TRIBITS_PACKAGE IN LISTS ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES) - tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE}) + tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE} + ${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}) endforeach() list(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES @@ -455,21 +456,15 @@ 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) @@ -517,7 +512,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} depPkgIsDefined) + tribits_is_pkg_defined(${depPkg} ${pkgsOrTpls} depPkgIsDefined) if (depPkgIsDefined) list(APPEND ${packageName}_${testOrLib}_DEFINED_DEPENDENCIES ${depPkg}) if ("${requiredOrOptional}" STREQUAL "REQUIRED") @@ -539,12 +534,18 @@ endmacro() # Determine if a (internal or external) package is defined or not # -function(tribits_is_pkg_defined depPkg depPkgIsDefinedOut) +function(tribits_is_pkg_defined depPkg pkgsOrTpls depPkgIsDefinedOut) set(depPkgIsDefined FALSE) - if (${depPkg}_SOURCE_DIR) - set(depPkgIsDefined TRUE) - elseif(${depPkg}_FINDMOD) - set(depPkgIsDefined TRUE) + 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}'") endif() set(${depPkgIsDefinedOut} ${depPkgIsDefined} PARENT_SCOPE) endfunction() diff --git a/cmake/tribits/core/utils/TribitsSortListAccordingToMasterList.cmake b/cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake similarity index 62% rename from cmake/tribits/core/utils/TribitsSortListAccordingToMasterList.cmake rename to cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake index 4b01327027..5d079a4174 100644 --- a/cmake/tribits/core/utils/TribitsSortListAccordingToMasterList.cmake +++ b/cmake/tribits/core/package_arch/TribitsSortListAccordingToMasterList.cmake @@ -37,28 +37,40 @@ # ************************************************************************ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/../utils/PrintVar.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/AppendSet.cmake") +include(PrintVar) +include(AppendSet) - -# Do an in-place sort of a list of items according to the ordering in a master -# list. # -# NOTE: This function has worst-case complexity N*n where N is the number of -# elements in the ```` and n is the number of elements in the -# ```` list. +# Function that does an in-place sort of a list of items according to the +# ordering in a master list +# +# NOTE: This function has wost-case N^2 complexity as the number of packages N +# or TPLs increases. It actually has N * n complexity where N is the total +# number of packages/TPLs and n is the number of passed-in packages/TPLs. +# However, since N is not likely to ever be more than a few hundred, this is +# likely not going to be a big performance problem. If this does become a +# performance problem, list(SORT ...) could be used but would require some +# work to build up the datastructures to make this very efficient. # -function(tribits_sort_list_according_to_master_list masterList listVarInOut) - set(sortedList) +function(tribits_sort_list_according_to_master_list MASTER_LIST LIST_VAR_INOUT) + + #message("TRIBITS_SORT_LIST_ACCORDING_TO_MASTER_LIST:") + #print_var(MASTER_LIST) + #print_var(LIST_VAR_INOUT) + #print_var(${LIST_VAR_INOUT}) - foreach(item ${masterList}) - list(FIND ${listVarInOut} ${item} itemIdx) - if (NOT itemIdx EQUAL -1) - list(APPEND sortedList ${item}) + set(SORTED_LIST) + + foreach(ITEM ${MASTER_LIST}) + list(FIND ${LIST_VAR_INOUT} ${ITEM} ITEM_IDX) + if (NOT ITEM_IDX EQUAL -1) + list(APPEND SORTED_LIST ${ITEM}) endif() endforeach() - set(${listVarInOut} ${sortedList} PARENT_SCOPE) + #print_var(SORTED_LIST) + + set(${LIST_VAR_INOUT} ${SORTED_LIST} PARENT_SCOPE) endfunction() diff --git a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst index 32e2d10d31..f30a089c67 100644 --- a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst +++ b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst @@ -334,9 +334,7 @@ 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. 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). + or not. .. _${PACKAGE_NAME}_TEST_ENABLED_DEPENDENCIES: @@ -462,89 +460,76 @@ Processing of external packages/TPLs and TriBITS-compliant external packages +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The processing of external packages/TPLs is influenced by whether the external -package is a regular TriBITS TPL (i.e with a ``FindTPL.cmake`` -modules) or is a TriBITS-compliant external package. Here, a -**TriBITS-Compliant External Package** has a ``Config.cmake`` file -that satisfies the following properties: - -* Has the target ``::all_libs`` which is a fully specified modern - CMake target. -* Calls ``find_dependency()`` or the equivalent for all upstream packages that - it depends on. -* Every upstream dependent package ```` has the target - ``::all_libs``. (But a minimally TriBITS-compliant external - package need not define this for all of its upstream dependencies.) - -That means that when calling ``find_package()`` for a fully TriBITS-compliant +package is a regular TriBITS TPL or is a TriBITS-compliant external +package. Here, a **TriBITS-Compliant External Package** has a +``Config.cmake`` file that satisfies the following properties: + +* Has the target ``::all_libs``. +* Calls ``find_dependency()`` for all upstream packages it depends on. +* Every upstream dependent package ```` has the target + ``::all_libs``. + +That means that when calling ``find_package()`` for a TriBITS-compliant external package, there is no need to worry about finding any of its upstream dependent external packages. That means that any external packages/TPLs -defined a TriBITS project which is upstream from a TriBITS-compliant external -package will be uniquely defined by calling ``find_package()`` on the most -downstream TriBITS-compliant external package that depends on it. Therefore, -defining the external packages and their targets in this set of external -packages just involves calling ``find_package()`` on the terminal -TriBITS-compliant external packages (i.e. TriBITS-compliant external packages -that don't have any downstream dependencies that are external packages). Then -the remaining subset of external packages/TPLs that don't have a downstream -TriBITS-compliant external package dependency will be defined as usual. -(However, as mentioned above, some of these are not fully TriBITS compliant and -don't fully define the ``::all_libs`` for all of their upstream -dependencies (see below).) - -By having all fully TriBITS-compliant external packages, an external -dependency is never found more than once. +defined a TriBITS project which is upstream from a TriBITS-compliant +external package will be uniquely defined by calling ``find_package()`` on the +most downstream TriBITS-compliant external package that depends on it. +Therefore, defining the external packages and their targets in this set of +external packages just involves calling ``find_package()`` on the terminal +TriBITS-compliant external packages (i.e. TriBITS-compliant +external packages that don't have any downstream dependencies that are +external packages). Then the remaining subset of external packages/TPLs that +don't have a downstream TriBITS-compliant external package dependency +will be defined as usual. (ToDo: Put in a more detailed examples explaining +how this works.) The variables that are set internally to define these different subsets of external packages/TPLs are: * ``_IS_TRIBITS_COMPLIANT``: Set the ``TRUE`` if the package - ```` provides the ``::all_libs`` by just calling - ``find_package( CONFIG REQUIRED)``. + ```` provides the ``::all_libs`` target for itself and all + of its upstream dependent (internal or external) packages (whether this + package is treated as an internal or external package). * ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE``: Set to - ``TRUE`` if the external package/TPL should be (or was after the fact) - defined by a downstream TriBITS-compliant external package. + ``TRUE`` if the external package/TPL will be processed by downstream TriBITS + compliant package. In this case, we just print that we are skipping the + find operation and explain why. An external package with ``_IS_TRIBITS_COMPLIANT=TRUE`` **AND** ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE`` is the one for which ``find_package( CONFIG REQUIRED)`` will be called and does not have any downstream packages that are being treated as external -packages. Also, ``find_package( CONFIG REQUIRED)`` will be called on -TriBITS-compliant external packages if ``::all_libs`` was not defined -by a downstream non fully TriBITS-compliant external package. +packages. -The variable ``_IS_TRIBITS_COMPLIANT`` is set right when the packages -are initially defined by reading in the various input files. That is, all -initially internal packages that are listed in a +The variable ``_IS_TRIBITS_COMPLIANT`` is set right when the +packages are initially defined by reading in the various input files. That +is, all initially internal packages that are listed in a `/PackagesList.cmake`_ file will have -``_IS_TRIBITS_COMPLIANT=TRUE`` set while all external packages/TPLs -listed in a `/TPLsList.cmake`_ file will have -``_IS_TRIBITS_COMPLIANT=FALSE`` set (except for those tagged with -``TRIBITS_PKG`` which will have ``_IS_TRIBITS_COMPLIANT=FALSE`` set). - -The processing of external packages/TPLs is done in two loops: - -* The first loop over external packages/TPLs will be those external - packages/TPLs that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **OR** - ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. And we - only call ``find_package()`` for those TriBITS-compliant external packages - that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **AND** don't have - ``::all_libs`` already defined. This is a reverse loop to give an - opportunity for downstream TriBITS-compliant external packages to define - their upstream external packages/TPLs. NOTE: If - ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE`` was set to - ``TRUE`` before this loop starts, it will be set to ``FALSE`` for - non-TriBITS-compliant external packages - (i.e. ``_IS_TRIBITS_COMPLIANT=FALSE``). - -* The second loop processes remaining external packages/TPLs that where not - defined by a downstream TriBITS-compliant external package in the first - loop. These are all TriBITS TPLs for which - ``_IS_TRIBITS_COMPLIANT=FALSE`` **AND** - ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE`` **AND** - for which ``_FINDMOD`` is not empty and is not ``TRIBITS_PKG``. - -For more details, see the implementation in `tribits_process_enabled_tpls()`_. +``_IS_TRIBITS_COMPLIANT=TRUE`` set. While all external +packages/TPLs listed in a `/TPLsList.cmake`_ file will have +``_IS_TRIBITS_COMPLIANT=FALSE`` set (except for those tagged +with ``TRIBITS_PKG`` which will have +``_IS_TRIBITS_COMPLIANT=FALSE`` set). + +NOTE: When a TriBITS TPL (i.e. ``_IS_TRIBITS_COMPLIANT=FALSE``) +is being processed, we can't assume where its +``Config.cmake`` file exists so we must find upstream +dependencies using ``set(_DIR ...)`` and +``find_dependency( CONFIG REQUIRED)``. + +So the first loop over external packages/TPLs will be those external +packages/TPLs that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **OR** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. And we +only call ``find_package()`` for those TriBITS-compliant external +packages that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **AND** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE``. + +The second loop are those external packages/TPLs that don't have a downstream +TriBITS-compliant external package which are all of those external +packages for which ``_IS_TRIBITS_COMPLIANT=FALSE`` **AND** +``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE``. Other package-related variables diff --git a/cmake/tribits/core/test_support/TribitsTestCategories.cmake b/cmake/tribits/core/package_arch/TribitsTestCategories.cmake similarity index 94% rename from cmake/tribits/core/test_support/TribitsTestCategories.cmake rename to cmake/tribits/core/package_arch/TribitsTestCategories.cmake index a6f053d639..acd55cee15 100644 --- a/cmake/tribits/core/test_support/TribitsTestCategories.cmake +++ b/cmake/tribits/core/package_arch/TribitsTestCategories.cmake @@ -37,10 +37,10 @@ # ************************************************************************ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/../utils/FindListElement.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/MessageWrapper.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/Join.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/../utils/TribitsDeprecatedHelpers.cmake") +include(FindListElement) +include(MessageWrapper) +include(Join) +include(TribitsDeprecatedHelpers) # Define the valid categories that will be recognized in the CATEGORIES keyword diff --git a/cmake/tribits/core/test_support/TribitsSetTribitsPackageName.cmake b/cmake/tribits/core/test_support/TribitsSetTribitsPackageName.cmake deleted file mode 100644 index 2a08b4bebf..0000000000 --- a/cmake/tribits/core/test_support/TribitsSetTribitsPackageName.cmake +++ /dev/null @@ -1,55 +0,0 @@ -# @HEADER -# ************************************************************************ -# -# TriBITS: Tribal Build, Integrate, and Test System -# Copyright 2013 Sandia Corporation -# -# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, -# the U.S. Government retains certain rights in this software. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ************************************************************************ -# @HEADER - - -include("${CMAKE_CURRENT_LIST_DIR}/../utils/MessageWrapper.cmake") - - -# Set the TriBITS package name var if it has not already been set -# -macro(tribits_set_tribits_package_name) - if ("${PACKAGE_NAME}" STREQUAL "") - if (NOT "${PROJECT_NAME}" STREQUAL "") - set(PACKAGE_NAME ${PROJECT_NAME}) - else() - message_wrapper(FATAL_ERROR "Error! Can't set default PACKAGE_NAME because" - " PROJECT_NAME is not set!") - endif() - endif() -endmacro() diff --git a/cmake/tribits/core/utils/AppendGlobalSet.cmake b/cmake/tribits/core/utils/AppendGlobalSet.cmake index 04d95f2b54..51251dc326 100644 --- a/cmake/tribits/core/utils/AppendGlobalSet.cmake +++ b/cmake/tribits/core/utils/AppendGlobalSet.cmake @@ -37,8 +37,8 @@ # ************************************************************************ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/GlobalSet.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/AssertDefined.cmake") +include(GlobalSet) +include(AssertDefined) # @FUNCTION: append_global_set() diff --git a/cmake/tribits/core/utils/AppendStringVar.cmake b/cmake/tribits/core/utils/AppendStringVar.cmake index bac3a6bac8..dbd0c1fb5d 100644 --- a/cmake/tribits/core/utils/AppendStringVar.cmake +++ b/cmake/tribits/core/utils/AppendStringVar.cmake @@ -37,11 +37,9 @@ # ************************************************************************ # @HEADER -include_guard() - -include("${CMAKE_CURRENT_LIST_DIR}/ConcatStrings.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/PrintVar.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/TribitsDeprecatedHelpers.cmake") +include(ConcatStrings) +include(PrintVar) +include(TribitsDeprecatedHelpers) # @FUNCTION: append_string_var() diff --git a/cmake/tribits/core/utils/AppendStringVarWithSep.cmake b/cmake/tribits/core/utils/AppendStringVarWithSep.cmake index 6e8ccf9fb6..c671ff582e 100644 --- a/cmake/tribits/core/utils/AppendStringVarWithSep.cmake +++ b/cmake/tribits/core/utils/AppendStringVarWithSep.cmake @@ -37,7 +37,7 @@ # ************************************************************************ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/ConcatStrings.cmake") +include(ConcatStrings) # @FUNCTION: append_string_var_with_sep() diff --git a/cmake/tribits/core/utils/ConcatStrings.cmake b/cmake/tribits/core/utils/ConcatStrings.cmake index cf5fd64e6e..a2fdc3c41a 100644 --- a/cmake/tribits/core/utils/ConcatStrings.cmake +++ b/cmake/tribits/core/utils/ConcatStrings.cmake @@ -37,7 +37,7 @@ # ************************************************************************ # @HEADER -include("${CMAKE_CURRENT_LIST_DIR}/PrintVar.cmake") +include(PrintVar) # @FUNCTION: concat_strings() diff --git a/cmake/tribits/core/utils/DriveAdvancedTest.cmake b/cmake/tribits/core/utils/DriveAdvancedTest.cmake index 6ccb55fd7a..87a4a82308 100644 --- a/cmake/tribits/core/utils/DriveAdvancedTest.cmake +++ b/cmake/tribits/core/utils/DriveAdvancedTest.cmake @@ -37,13 +37,11 @@ # ************************************************************************ # @HEADER -include_guard() - -include("${CMAKE_CURRENT_LIST_DIR}/PrintVar.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/AppendStringVar.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/Join.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/TimingUtils.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/TribitsGetCategoriesString.cmake") +include(PrintVar) +include(AppendStringVar) +include(Join) +include(TimingUtils) +include(TribitsGetCategoriesString) function(print_current_date_time PREFIX_STR) diff --git a/cmake/tribits/core/utils/MessageWrapper.cmake b/cmake/tribits/core/utils/MessageWrapper.cmake index 220f9c8ff6..bdcd9e5e29 100644 --- a/cmake/tribits/core/utils/MessageWrapper.cmake +++ b/cmake/tribits/core/utils/MessageWrapper.cmake @@ -39,7 +39,7 @@ include_guard() -include("${CMAKE_CURRENT_LIST_DIR}/GlobalSet.cmake") +include(GlobalSet) # @FUNCTION: message_wrapper() # diff --git a/cmake/tribits/core/utils/TimingUtils.cmake b/cmake/tribits/core/utils/TimingUtils.cmake index ac6351ab9d..a83445663f 100644 --- a/cmake/tribits/core/utils/TimingUtils.cmake +++ b/cmake/tribits/core/utils/TimingUtils.cmake @@ -44,7 +44,7 @@ # platforms so call with care. # -include("${CMAKE_CURRENT_LIST_DIR}/Split.cmake") +include(Split) # @FUNCTION: timer_get_raw_seconds() diff --git a/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake b/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake index ee6c7fae22..0ae57138e0 100644 --- a/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake +++ b/cmake/tribits/core/utils/TribitsDeprecatedHelpers.cmake @@ -37,10 +37,8 @@ # ************************************************************************ # @HEADER -include_guard() - -include("${CMAKE_CURRENT_LIST_DIR}/MessageWrapper.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/TribitsParseArgumentsHelpers.cmake") +include(MessageWrapper) +include(TribitsParseArgumentsHelpers) set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_VALUES_THAT_CALL_MESSAGE diff --git a/cmake/tribits/core/utils/TribitsParseArgumentsHelpers.cmake b/cmake/tribits/core/utils/TribitsParseArgumentsHelpers.cmake index 9058db674d..75327668f6 100644 --- a/cmake/tribits/core/utils/TribitsParseArgumentsHelpers.cmake +++ b/cmake/tribits/core/utils/TribitsParseArgumentsHelpers.cmake @@ -46,7 +46,7 @@ ################################################################################ -include("${CMAKE_CURRENT_LIST_DIR}/MessageWrapper.cmake") +include(MessageWrapper) # @FUNCTION: tribits_check_for_unparsed_arguments() diff --git a/cmake/tribits/core/utils/TribitsSetCacheVarAndDefault.cmake b/cmake/tribits/core/utils/TribitsSetCacheVarAndDefault.cmake deleted file mode 100644 index a90c45aad4..0000000000 --- a/cmake/tribits/core/utils/TribitsSetCacheVarAndDefault.cmake +++ /dev/null @@ -1,89 +0,0 @@ -# @HEADER -# ************************************************************************ -# -# TriBITS: Tribal Build, Integrate, and Test System -# Copyright 2013 Sandia Corporation -# -# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, -# the U.S. Government retains certain rights in this software. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ************************************************************************ -# @HEADER - -include_guard() - - -# @MACRO: tribits_advanced_set_cache_var_and_default() -# -# Set an advanced cache variable with a default value (passing in a default -# default value). -# -# Usage:: -# -# tribits_advanced_set_cache_var_and_default( -# ) -# -# If the variable ``_DEFAULT`` already exists with a value, that -# is used as the default cache variable. Otherwise, -# ``_DEFAULT`` is set set to ```` first. -# -macro(tribits_advanced_set_cache_var_and_default cacheVarName cacheVarType - defaultDefaultVal docString - ) - tribits_set_cache_var_and_default("${cacheVarName}" "${cacheVarType}" - "${defaultDefaultVal}" "${docString}") - mark_as_advanced(${cacheVarName}) -endmacro() - - -# @MACRO: tribits_set_cache_var_and_default() -# -# Set a cache variable with a default value (passing in a default default -# value). -# -# Usage:: -# -# tribits_set_cache_var_and_default( -# ) -# -# If the variable ``_DEFAULT`` already exists with a value, that -# is used as the default cache variable. Otherwise, -# ``_DEFAULT`` is set set to ```` first. -# -macro(tribits_set_cache_var_and_default cacheVarName cacheVarType - defaultDefaultVal docString - ) - if ("${${cacheVarName}_DEFAULT}" STREQUAL "") - set(${cacheVarName}_DEFAULT "${defaultDefaultVal}") - endif() - set(${cacheVarName} "${${cacheVarName}_DEFAULT}" - CACHE ${cacheVarType} - "${docString}" ) -endmacro() diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake index 2515e9892b..6b2b536bac 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -137,10 +137,6 @@ if ("${CTEST_BINARY_DIRECTORY}" STREQUAL "") set(CTEST_BINARY_DIRECTORY $ENV{PWD}/BUILD) endif() -include("${CMAKE_CURRENT_LIST_DIR}/../core/common/TribitsConstants.cmake") -tribits_asesrt_minimum_cmake_version() -include("${CMAKE_CURRENT_LIST_DIR}/../core/common/TribitsCMakePolicies.cmake" NO_POLICY_SCOPE) - # # Set CMAKE_MODULE_PATH # @@ -148,13 +144,15 @@ set( CMAKE_MODULE_PATH "${TRIBITS_PROJECT_ROOT}" "${TRIBITS_PROJECT_ROOT}/cmake" "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" - "${${PROJECT_NAME}_TRIBITS_DIR}/core/common" - "${${PROJECT_NAME}_TRIBITS_DIR}/core/test_support" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support" "${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver" ) +include(TribitsConstants) +tribits_asesrt_minimum_cmake_version() +include(TribitsCMakePolicies NO_POLICY_SCOPE) + include(Split) include(PrintVar) include(MultilineSet) diff --git a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index 06600479e9..b0acf3131b 100644 --- a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -1333,7 +1333,7 @@ c) **Setting up to run MPI programs:** MPI test and example executables are passed to CTest ``add_test()`` as:: - add_test(NAME COMMAND + add_test( ${MPI_EXEC} ${MPI_EXEC_PRE_NUMPROCS_FLAGS} ${MPI_EXEC_NUMPROCS_FLAG} ${MPI_EXEC_POST_NUMPROCS_FLAGS} @@ -1994,10 +1994,9 @@ external packages has several consequences: (Otherwise, a configure error will result from the mismatch.) * The definition of any TriBITS external packages/TPLs that are enabled - upstream dependencies from any of these external packages should be defined - automatically and will **not** be found again. (But there can be exceptions - for minimally TriBITS-compliant external packages; see the section - "TriBITS-Compliant External Packages" in the "TriBITS Users Guide".) + upstream dependencies from any of these internally defined packages being + treated as external packages will be defined by the calls to + ``find_package()`` and will **not** be found again. The logic for treating internally defined packages as external packages will be printed in the CMake configure output in the section ``Adjust the set of @@ -2017,35 +2016,22 @@ the terminal TriBITS-compliant external packages. This is shown in the CMake output in the section ``Getting information for all enabled TriBITS-compliant or upstream external packages/TPLs`` and looks like:: - Getting information for all enabled TriBITS-compliant or upstream external packages/TPLs in reverse order ... + Getting information for all enabled TriBITS-compliant or upstream external packages/TPLs ... + Processing enabled external package/TPL: (...) + -- The external package/TPL will be read in by a downstream TriBITS-compliant external package + Processing enabled external package/TPL: (...) + -- The external package/TPL will be read in by a downstream TriBITS-compliant external package + Processing enabled external package/TPL: (...) + -- The external package/TPL will be read in by a downstream TriBITS-compliant external package Processing enabled external package/TPL: (...) -- Calling find_package( for TriBITS-compliant external package - Processing enabled external package/TPL: (...) - -- The external package/TPL was defined by a downstream TriBITS-compliant external package already processed - Processing enabled external package/TPL: (...) - -- The external package/TPL was defined by a downstream TriBITS-compliant external package already processed - Processing enabled external package/TPL: (...) - -- The external package/TPL was defined by a downstream TriBITS-compliant external package already processed In the above example ````, ```` and ```` are all direct or indirect dependencies of ```` and therefore calling just ``find_package()`` fully defines those TriBITS-compliant external packages as well. -All remaining TPLs that are not defined in that first reverse loop are defined -in a second forward loop over regular TPLs:: - - Getting information for all remaining enabled external packages/TPLs ... - -NOTE: The case is also supported where a TriBITS-compliant external package -like ```` does not define all of it upstream dependencies (i.e. does not -define the ``::all_libs`` target) and these external packages/TPLs will -be found again. This allows the possibility of finding different/inconsistent -upstream dependencies but this is allowed to accommodate some packages with -non-TriBITS CMake build systems that don't create fully TriBITS-compliant -external packages. - xSDK Configuration Options -------------------------- @@ -4182,23 +4168,14 @@ match files to exclude, set:: -D _DUMP_CPACK_SOURCE_IGNORE_FILES=ON -Extra directories or files can be excluded from the reduced source tarball by -adding the configure argument:: - - "-DCPACK_SOURCE_IGNORE_FILES=;;..." - -NOTE: The entries in ``CPACK_SOURCE_IGNORE_FILES`` are regexes and **not** -file globs, so be careful when specifying these or more files and directories -will be excluded from the reduced source tarball that intended/desired. - While a set of default CPack source generator types is defined for this project (see the ``CMakeCache.txt`` file), it can be overridden using, for example:: -D _CPACK_SOURCE_GENERATOR="TGZ;TBZ2" -(See CMake documentation to find out the types of CPack source generators -supported on your system.) +(see CMake documentation to find out the types of supported CPack source +generators on your system). NOTE: When configuring from an untarred source tree that has missing packages, one must configure with:: @@ -4228,7 +4205,7 @@ just using the standard ``ctest -D Experimental`` command are: For more details, see `tribits_ctest_driver()`_. To use the ``dashboard`` target, first, configure as normal but add cache vars -for the build and test parallel levels with:: +for the the build and test parallel levels with:: -DCTEST_BUILD_FLAGS=-j4 -DCTEST_PARALLEL_LEVEL=4 diff --git a/cmake/tribits/doc/guides/.gitignore b/cmake/tribits/doc/guides/.gitignore index 6c3878b7fb..7f018678f2 100644 --- a/cmake/tribits/doc/guides/.gitignore +++ b/cmake/tribits/doc/guides/.gitignore @@ -4,9 +4,6 @@ /TriBITS.README.DIRECTORY_CONTENTS.rst.tmp /TribitsCommonTPLsList.txt /TribitsCommonTPLsList.txt.tmp -/TribitsExampleProject2_Package1_CMakeLists.raw.external.cmake* -/TribitsExampleProject2_Package1_CMakeLists.raw.internal.cmake* -/TribitsExampleProject2_Package1_CMakeLists.raw.tribits_test.cmake* /TribitsGitVersion.txt /TribitsGitVersion.txt.tmp /TribitsHelloWorldDirAndFiles.txt diff --git a/cmake/tribits/doc/guides/Makefile.common_generated_files b/cmake/tribits/doc/guides/Makefile.common_generated_files index 6984ee3c63..c6a352d122 100644 --- a/cmake/tribits/doc/guides/Makefile.common_generated_files +++ b/cmake/tribits/doc/guides/Makefile.common_generated_files @@ -27,7 +27,6 @@ COMMON_DEPENDENT_FILES = \ ../get-tribits-packages-from-files-list.txt \ ../install_devtools-help.txt \ ../TriBITS.README.DIRECTORY_CONTENTS.rst \ - $(wildcard ../*.cmake) \ TribitsMacroFunctionDoc.rst \ UtilsMacroFunctionDoc.rst diff --git a/cmake/tribits/doc/guides/TribitsGuidesBody.rst b/cmake/tribits/doc/guides/TribitsGuidesBody.rst index 210e4cc805..b8f77bd5b0 100644 --- a/cmake/tribits/doc/guides/TribitsGuidesBody.rst +++ b/cmake/tribits/doc/guides/TribitsGuidesBody.rst @@ -1379,7 +1379,7 @@ The variable ``HAVE_SIMPLECXX___INT64`` is set up in the base file ``SimpleCxx/CMakeLists.txt`` (see `/CMakeLists.txt`_ below). For an explanation of ``HAVE_SIMPLECXX_DEBUG``, see `tribits_add_debug_option()`_. For an explanation of ``HAVE_SIMPLECXX_SIMPLETPL``, see `How to add a new -TriBITS Package dependency`_. For an explanation of +TriBITS external package/TPL dependency`_. For an explanation of ``@SIMPLECXX_DEPRECATED_DECLARATIONS@``, see `Setting up support for deprecated code handling`_. @@ -1617,7 +1617,7 @@ are defined before a Package's ``CMakeLists.txt`` file is processed: **NOTE:** The value of this variable also determines the value of the macro define variable name - `HAVE__`_. + `HAVE__`_. .. _${PACKAGE_NAME}_ENABLE_TESTS: @@ -1643,23 +1643,23 @@ The following local **TriBITS Package Optional Dependency Macro Variables** are defined in the top-level project scope before a Package's ``CMakeLists.txt`` file is processed: - .. _HAVE__: + .. _HAVE__: - ``HAVE__`` + ``HAVE__`` Set to ``ON`` if support for optional upstream package ``${OPTIONAL_DEP_PACKAGE}`` is enabled in downstream package ``${PACKAGE_NAME}`` (i.e. `${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}`_ = ``ON``) and is set to ``FALSE`` otherwise. Here, ```` and - ```` are the upper-case names for the packages + ```` are the upper-case names for the packages ``${PACKAGE_NAME}`` and ``${OPTIONAL_DEP_PACKAGE_NAME}``, respectively. For example, if optional support for upstream package ``Triutils`` is enabled in downstream package ``EpetraExt`` in `ReducedMockTrilinos`_, then ``EpetraExt_ENABLE_TriUtils=ON`` and ``HAVE_EPETRAEXT_TRIUTILS=ON``. This variable is meant to be used in:: - #cmakedefine HAVE__ + #cmakedefine HAVE__ in configured header files (e.g. `/cmake/_config.h.in`_). For example, for @@ -2615,20 +2615,33 @@ packages** as imposed by downstream TriBITS internal packages are: CMake macros or functions that downstream CMake packages may need to use the upstream package ````. -* [Optional] All of the upstream dependencies (listed in the - ``INTERFACE_LINK_LIBRARIES`` property recursively) are also - `TriBITS-compliant packages`_ +* All of the upstream dependencies (listed in the ``INTERFACE_LINK_LIBRARIES`` + property recursively) are also `TriBITS-compliant packages`_ The TriBITS system will also set the variable: * ``_IS_TRIBITS_COMPLIANT``: Set to ``TRUE`` -for all packages that are determined to be TriBITS-compliant packages and -satisfy the above criteria. +for all packages that are determined to be TriBITS-compliant packages. The above are all that is needed by downstream TriBITS packages to build and link against their upstream dependencies. +If a TriBITS package provides any CTest tests/examples, then it must also +satsify the following requirements: + +* Test names must be prefixed with the package name ``_``. + +* Tests should only be added if the variable ``_ENABLE_TESTS`` is + true. + +* Examples (that run as CTest tests) should only be added if the variable + ``_ENABLE_EXAMPLES`` is true. + +* The test ``PROCESSORS`` and other test properties must be set in a way + consistent with `tribits_add_test()`_ so as to run in parallel with other + tests and not overwhelm the computing resources on the machine. + Additional requirements are placed on TriBITS-compliant packages depending on if they are defined as internal CMake packages (i.e. `TriBITS-compliant internal packages`_) or are pulled in as external pre-built/pre-installed @@ -2659,38 +2672,15 @@ The requirements for **TriBITS-compliant internal packages** are: directory ``/lib/cmake//`` allowing the installed package to be used by downstream CMake packages/projects. -* [Optional] All of the upstream dependencies (recursively) are also - `TriBITS-compliant packages`_. - -If a TriBITS package provides any CTest tests/examples, then it must also -satisfy the following requirements: - -* Test names must be prefixed with the package name ``_``. - -* Tests should only be added if the variable ``_ENABLE_TESTS`` is - true. - -* Examples (that run as CTest tests) should only be added if the variable - ``_ENABLE_EXAMPLES`` is true. - -* The ``PROCESSORS`` test property and other test properties must be set in a - way consistent with `tribits_add_test()`_ so as to run in parallel with - other tests and not overwhelm the computing resources on the machine. - -* The test ```` must not be added if the cache variable - ``_DISABLE`` is set to ``TRUE`` or if the cache variable - ``_SET_DISABLED_AND_MSG`` is set to non-empty (and the message - string should be printed to STDOUT). +* All of the upstream dependencies (recursively) are also `TriBITS-compliant + packages`_ TriBITS internal packages that are defined using the TriBITS framework using -the TriBITS-provided macros and functions such as `tribits_add_library()`_ and -have tests defined using the functions `tribits_add_test()`_ and -`tribits_add_advanced_test()`_ are automatically `TriBITS-compliant internal -packages`_. And when these TriBITS-implemented internal packages are -installed, they automatically provide `TriBITS-compliant external packages`_. +the TriBITS-provided macros and functions such as `tribits_add_library()`_ are +automatically `TriBITS-compliant internal packages`_ and when they are +installed they automatically provide `TriBITS-compliant external packages`_. But it is possible for a CMake package to write its own raw CMake code to -satisfy these basic requirements for both internal and (installed) external -packages. +satisfy these basic requirements for both internal and external packages. .. _TriBITS-Compliant External Package: @@ -2702,9 +2692,8 @@ For packages that are installed on the system and not built in the current CMake project, a streamlined type of `TriBITS External Package/TPL`_ is a *TriBITS-compliant external package*. These special types of external package's don't need to provide a `FindTPL.cmake`_ find module. -Instead, they are fully defined by calling ``find_package()`` or -``include(/Config.cmake)`` to load their -``Config.cmake`` package config file. +Instead, they are fully defined by calling ``find_package()`` to +locate and load their ``Config.cmake`` package config file. The requirements for **TriBITS-compliant external packages** are: @@ -2719,23 +2708,18 @@ The requirements for **TriBITS-compliant external packages** are: ``_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE``: Points to the file ``Config.cmake`` (i.e. ``${CMAKE_CURRENT_LIST_FILE}``) -* [Optional] All of the upstream dependencies (recursively) are also provided - as `TriBITS-compliant external packages`_ with + * ``_DIR`` or + ``_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR`` Points to the base + directory for ``Config.cmake`` + (i.e. ``${CMAKE_CURRENT_LIST_DIR}``) + +* All of the upstream dependencies (recursively) are also provided as + `TriBITS-compliant external packages`_ with ``Config.cmake`` files (see above) and all of the targets and variables for a TriBITS-compliant external package are defined when the ``Config.cmake`` file is included (or pulled in with ``find_package()`` or ``find_dependency()``). -NOTE: TriBITS-compliant external packages that provide TriBITS-compliant -external packages for all of their upstream dependencies are said to be *fully -TriBITS-compliant external packages* while those that support the minimal -requirements are said to be *minimally TriBITS-compliant external packages*. -The TriBITS external package/TPL system is robust enough to deal with -minimally TriBITS-compliant external packages. Any TriBITS external -packages/TPLs upstream from a minimally TriBITS-compliant external package -will be found again in the current TriBITS project. (In these cases, it is up -to the user to make sure that the same upstream packages are found.) - Example TriBITS Projects ========================= @@ -2970,28 +2954,6 @@ should be copied from this example project as they represent best practice when using TriBITS for the typical use cases. -TribitsExampleProject2 ----------------------- - -``TribitsExampleProject2`` in an example `TriBITS Project`_ and `TriBITS -Repository`_ contained in the TriBITS source tree under:: - - tribits/examples/TribitsExampleProject2/ - -This example TriBITS project provides some examples for a few other features -and testing scenarios. It contains three internal packages ``Package1``, -``Package2``, and ``Package3`` as shown in its ``PackagesList.cmake`` file: - -.. include:: ../../examples/TribitsExampleProject2/PackagesList.cmake - :literal: - -and supports four external packages/TPLs ``Tpl1``, ``Tpl2``, ``Tpl3``, and -``Tpl4`` as shown in its ``TPLsList.cmake`` file: - -.. include:: ../../examples/TribitsExampleProject2/TPLsList.cmake - :literal: - - MockTrilinos ------------- @@ -5992,14 +5954,14 @@ links. How to add a new TriBITS Package dependency -------------------------------------------- +---------------------------------------------- It is often the case where one will want to add a new dependency for an -existing `downstream`_ package to an existing `upstream`_ (internal or -external) `TriBITS Package`_. This can either be a required dependency or an -optional dependency. Here, we will refer to the downstream package as -```` with base directory ```` and will refer to the -upstream (internal or external) package as ````. +existing `downstream`_ package to an existing `upstream`_ `TriBITS Package`_. +This can either be a required dependency or an optional dependency. Here, we +will refer to the downstream package as ```` with base directory +```` and will refer to the upstream package as +````. The process for adding a new dependency to an existing upstream package is as follows: @@ -6024,9 +5986,9 @@ as follows: typically a C/C++ processor macro will be added to the package's configured `/cmake/_config.h.in`_ file using the line:: - #cmakedefine HAVE__ + #cmakedefine HAVE__ - (see `HAVE__`_.) + (see `HAVE__`_.) .. _Warning, do not add optional defines for tests/examples to configured header files: @@ -6055,29 +6017,21 @@ as follows: #include "_config.h" - #if HAVE__ + #if HAVE__ # include "_" #endif 4) **For an optional dependency, use CMake if() statements based on - ${PACKAGE_NAME}_ENABLE_:** When a package + ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}:** When a package ``PACKAGE_NAME`` has an optional dependency on an upstream package - ```` and needs to put in optional logic in a - ``CMakeLists.txt`` file, then the ``if()`` statements should use the - variable ``${PACKAGE_NAME}_ENABLE_`` and **not** the - variable ``${PROJECT_NAME}_ENABLE_`` or - ``TPL_ENABLE_`` (if ```` is an - external package/TPL). For example, to optionally enable a test that - depends on the enable of the optional upstream dependent package - ````, one would use:: - - tribits_add_test( ... - EXCLUDE_IF_NOT_TRUE ${PACKAGE_NAME}_ENABLE_ - ) - - or:: - - if (${PACKAGE_NAME}_ENABLE_) + ``OPTIONAL_DEP_PACKAGE_NAME`` and needs to put in optional logic in a + CMakeLists.txt file, then the if() statements should use the variable + `${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}`_ and **not** the + variable ``${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}``. For + example, to optionally enable a test that depends on the enable of the + optional upstream dep package, one would use:: + + if (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}) tribits_add_test( ... ) endif() @@ -6091,13 +6045,100 @@ package library and executable links. See documentation in the functions argument to these functions, for more details. +How to add a new TriBITS external package/TPL dependency +-------------------------------------------------------- + +It is often the case where one will want to add a new dependency for an +existing `downstream`_ package to an existing `upstream`_ `TriBITS external +package/TPL`_. This can either be a required dependency or an optional +dependency. Here, we will refer to the downstream package as +```` with base directory ```` and will refer to the +upstream TPL as ````. + +The process for adding a new dependency to an existing upstream TPL is as +follows: + +1) **Add the name of the upstream TPL to the downstream package's + Dependencies.cmake file:** Add ```` to the call of + `tribits_package_define_dependencies()`_ in the downstream package's + `/cmake/Dependencies.cmake`_ file. If this is to be a required + library dependency, then ```` is added to the + ``LIB_REQUIRED_TPLs`` argument. Alternatively, if this is to be an + optional library dependency, then ```` is added to the + ``LIB_OPTIONAL_TPL`` argument. (For example, see the file + ``packages/Teuchos/cmake/Dependencies.cmake`` file in the + `ReducedMockTrilinos`_ project.) If only the test and/or example sources, + and not the package's core library sources, will have the required or + optional dependency, then ```` is added to the arguments + ``TEST_REQUIRED_TPLs`` or ``TEST_OPTIONAL_TPLS``, respectively. + +2) **For an optional dependency, add `HAVE_` preprocessor macro to the + package's configured header file:** If this is an optional dependency, + typically a C/C++ processor macro will be added to the package's configured + `/cmake/_config.h.in`_ file using the line:: + + #cmakedefine HAVE__ + + (see `HAVE__`_.) + + **WARNING:** If this is a test-only and/or example-only dependency then + please do **not** add a ``#cmakedefine`` to the package's core + `/cmake/_config.h.in`_ file. See `Warning, do not + add optional defines for tests/examples to configured header files`_. + +3) **Use the features of the upstream TPL in the source files of the + downstream package sources and/or tests/examples:** Usage of the features + of the upstream package ```` in the downstream package + ```` will typically involve adding ``#include + _`` in the package's C/C++ source (or test/example) + files (or the equivalent in Fortran). If it is an optional dependency, + then these includes will typically be protected using preprocessor ifdefs, + for example, as:: + + #include "_config.h" + + #if HAVE__ + # include "_" + #endif + +4) **For an optional dependency, use CMake if() statements based on + ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}:** When a package + ``PACKAGE_NAME`` has an optional dependency on TPL + ``OPTIONAL_DEP_PACKAGE_NAME`` and needs to put in optional logic in a + CMakeLists.txt file, then the if() statements should use the variable + `${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}`_ and **not** the + variable ``${PROJECT_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}``. For + example, to optionally enable a test that depends on the enable of the + optional TPL, one could use:: + + if (${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME}) + tribits_add_test( ... ) + endif() + + or:: + + tribits_add_test( + EXCLUDE_IF_NOT_TRUE ${PACKAGE_NAME}_ENABLE_${OPTIONAL_DEP_PACKAGE_NAME} + [other args] + ) + + .. ToDo: Find an example to point to in TribitsExampleProject. + +NOTE: TriBITS will automatically add the include directories for the upstream +TPL to the compile lines for the downstream package source builds and will add +the libraries for the upstream TPL to the link lines to the downstream package +library and executable links. See documentation in the functions +`tribits_add_library()`_ and `tribits_add_executable()`_, and the ``DEPLIBS`` +argument to these functions, for more details. + + How to tentatively enable an external package/TPL ------------------------------------------------- A TriBITS package can request the tentative enable of any of its optional -external packagse/TPLs (see `How to add a new TriBITS Package dependency`_). -This is done by calling `tribits_tpl_tentatively_enable()`_ in the package's -`/cmake/Dependencies.cmake`_ file. For example:: +external packagse/TPLs (see `How to add a new TriBITS external package/TPL +dependency`_). This is done by calling `tribits_tpl_tentatively_enable()`_ in +the package's `/cmake/Dependencies.cmake`_ file. For example:: tribits_package_define_dependencies( ... @@ -6262,243 +6303,6 @@ file as well. Then every ``CMakeLists.txt`` file in subdirectories just calls ``include_tribits_build()``. That is it. -How to implement a TriBITS-compliant internal package using raw CMake ---------------------------------------------------------------------- - -As described in `TriBITS-Compliant Internal Packages`_, it is possible to -create a raw CMake build system for a CMake package that can build under a -parent TriBITS CMake project. The raw CMake code for such a package must -provide the ``::all_libs`` target both in the current CMake build -system and also in the generated ``Config.cmake`` file for the build -directory and in the installed ``Config.cmake`` file. Every such -TriBITS-compliant internal package therefore is **also capable of installing a -TriBITS-compliant external package** ``Config.cmake`` file (see `How -to implement a TriBITS-compliant external package using raw CMake`_). - -.. ToDo: Consider listing out the key features of a raw CMake build system - that is needed for a TriBITS-compliant internal package. - -A raw CMake build system for a TriBITS-compliant internal package is -demonstrated in the `TribitsExampleProject2`_ project ``Package1`` package. -The base ``CMakeLists.txt`` file for building ``Package1`` with a raw CMake -build system (called ``package1/CMakeLists.raw.cmake`` in that directory) -looks like: - -.. include:: TribitsExampleProject2_Package1_CMakeLists.raw.internal.cmake - :literal: - -As shown above, this simple CMake package contains the basic features of any -CMake project/package including calling the ``cmake_minimum_required()`` and -``project()`` commands as well as including ``GNUInstallDirs``. In this -example, the project/package being built ``Package1`` has a dependency on an -external upstream package ``Tpl1`` pulled in with ``find_package(Tpl1)``. -Also in this example, the package has native tests it defines with -``include(CTest)`` and ``add_subdirectory()`` (if ``Package1_ENABLE_TESTS`` is -set to ``ON``). - -The file ``package1/src/CMakeLists.raw.cmake`` (which gets included from -``package1/src/CMakeLists.txt``) creates a library and executable for the -package and has the contents: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake - :literal: - -This creates a single installable library target ``Package1_package1`` which -is aliased as ``Package1::package1`` in the current CMake project and sets up -to create the IMPORTED target ``Package1::package1`` in the generated -``Package1ConfigTarget.cmake`` file, which gets included in the installed -``Package1Config.cmake`` (``Config.cmake``) file (as recommenced in -the book "Professional CMake", see below). In addition, the above code -creates the installable executable ``package1-prg``. - -The ``Package1::all_libs`` (``::all_libs``) target is defined and set -up inside of the included file -``package1/cmake/raw/DefineAllLibsTarget.cmake`` which contains the code: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/cmake/raw/DefineAllLibsTarget.cmake - :literal: - -The above code contains the ALIAS library target ``Package1::all_libs`` -(``::all_libs``) for the current CMake project as well as sets up for -the IMPORTED target ``Package1::all_libs`` (``::all_libs``) getting -put in the generated ``Package1ConfigTargets.cmake`` file (see below). - -The ``Package1Config.cmake`` (``Config.cmake``) file for the build -directory is generated inside of the included file -``package1/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake`` which has -the contents: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake - :literal: - -The above code uses the ``export(EXPORT ...)`` command to generate the file -``Package1ConfigTargets.cmake`` for the build directory which provides the -IMPORTED targets ``Package1::package1`` and ``Package1::all_libs``. The -command ``configure_file(...)`` generates the ``Package1Config.cmake`` file -that includes it for the build directory -``/cmake_packages/Package1/``. (NOTE: The above code only runs when -the package is being built from inside of a TriBITS project which defines the -command ``tribits_package``. So this code gets skipped when building -``Package1`` as a stand-alone raw CMake project.) - -Finally, the code for generating and installing the ``Package1Config.cmake`` -file for the install directory ``CMAKE_PREFIX_PATH=`` is specified -in the included file -``package1/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake`` with the -contents: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake - :literal: - -The above uses the command ``install(EXPORT ...)`` to have CMake automatically -generate and install the file ``Package1ConfigTargets.cmake`` in the install -directory ``/libs/cmake/Package1/`` which provides the IMPORTED -targets ``Package1::package1`` and ``Package1::all_libs``. The command -``configure_file()`` is used to generate the file -``Package1Config.install.cmake`` in the build directory from the template file -``Package1Config.cmake.in``. Finally, the ``install()`` command is used in -the file ``GeneratePackageConfigFileForInstallDir.cmake`` to set up the -installation of the ``Package1Config.cmake`` file. - -Note, the template file ``package1/cmake/raw/Package1Config.cmake.in`` (which -is unique to ``Package1``) is: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in - :literal: - -As shown in the all of the above code, there is a lot of boilerplate CMake -code needed to correctly define the targets such that they get put into the -installed ``Package1Config.cmake`` file using the correct namespace -``Package1::`` and care must be taken to ensure that a consistent "export set" -is used for this purpose. (For more details, see the book "Professional -CMake".) - -**NOTE:** One should compare the above raw CMakeLists files to the more -compact TriBITS versions for the base ``package1/CMakeLists.txt`` file (called -``package1/CMakeLists.tribits.cmake`` in the base directory ``pacakge1/``): - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/CMakeLists.tribits.cmake - :literal: - -and the TriBITS ``package1/src/CMakeLists.txt`` file (called -``package1/src/CMakeLists.tribits.cmake``): - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/src/CMakeLists.tribits.cmake - :literal: - -This shows the amount of boilerplate code that TriBITS addresses automatically -(which reduces the overhead of finer-grained packages and avoids common -mistakes with tedious low-level CMake code). - - -How to implement a TriBITS-compliant external package using raw CMake ---------------------------------------------------------------------- - -As described in `TriBITS-Compliant External Packages`_, it is possible to -create a raw CMake build system for a CMake package such that once it is -installed, satisfies the requirements for a TriBITS-compliant external -package. These installed packages provide a ``Config.cmake`` file -that provides the required targets and behaviors as if it was produced by a -TriBITS project. For most existing raw CMake projects that already produce a -"Professional CMake" compliant ``Config.cmake`` file, that usually -just means adding the IMPORTED target called ``::all_libs`` to the -installed ``Config.cmake`` file. - -A raw CMake build system for a TriBITS-compliant external package is -demonstrated in the `TribitsExampleProject2`_ project ``Package1`` package. -The base ``package1/CMakeLists.txt`` file for building ``Package1`` with a raw -CMake build system (called ``package1/CMakeLists.raw.cmake``) for implementing -a TriBITS-compliant internal package looks like: - -.. include:: TribitsExampleProject2_Package1_CMakeLists.raw.external.cmake - :literal: - -Note that the raw build system this example is identical to the build system -for the raw TriBITS-compliant internal package described in `How to implement -a TriBITS-compliant internal package using raw CMake`_. The only differences -are: - -1) The ``Package1Config.cmake`` (``Config.cmake``) file does **not** - need to be generated for the build directory and therefore the code in - ``cmake/raw/GeneratePackageConfigFileForBuildDir.cmake`` does **not** need - to be included. - -2) The ALIAS library target ``Package1::all_libs`` (``::all_libs``) - does **not** need to be generated (but should be to be "Professional CMake" - compliant). - -Other than that, see `How to implement a TriBITS-compliant internal package -using raw CMake`_ for how to implement a TriBITS-compliant external package. - - -How to use TriBITS testing support in non-TriBITS project ---------------------------------------------------------- - -The TriBITS test support functions `tribits_add_test()`_ and -`tribits_add_advanced_test()`_ can be used from any raw (i.e. non-TriBITS) -CMake project. To do so, one just needs to include the TriBITS modules: - -* ``/core/test_support/TribitsAddTest.cmake`` -* ``/core/test_support/TribitsAddAdvancedTest.cmake`` - -and set the variable ``${PROJECT_NAME}_ENABLE_TESTS`` to ``ON``. For an -MPI-enabled CMake project, the CMake variables ``MPI_EXEC``, -``MPI_EXEC_PRE_NUMPROCS_FLAGS``, ``MPI_EXEC_NUMPROCS_FLAG`` and -``MPI_EXEC_POST_NUMPROCS_FLAGS`` must also be set which define the MPI runtime -program launcher command-line used in the TriBITS testing functions:: - - ${MPI_EXEC} ${MPI_EXEC_PRE_NUMPROCS_FLAGS} - ${MPI_EXEC_NUMPROCS_FLAG} - ${MPI_EXEC_POST_NUMPROCS_FLAGS} - - -(NOTE: These variables are defined automatically in a TriBITS project when -``TPL_ENABLE_MPI`` is set to ``ON``.) - -This is demonstrated in the `TribitsExampleProject2`_ project ``Package1`` -package. The base ``pacakge1/CMakeLists.txt`` file for building ``Package1`` -with a raw CMake build system using TriBITS testing functions (called -``package1/CMakeLists.raw.cmake``) looks like: - -.. include:: TribitsExampleProject2_Package1_CMakeLists.raw.tribits_test.cmake - :literal: - -The only difference between this base ``package1/CMakeLists.txt`` file and one -for a raw CMake project is the inclusion of the file -``package1/cmake/raw/EnableTribitsTestSupport.cmake`` which has the contents: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/cmake/raw/EnableTribitsTestSupport.cmake - :literal: - -The key lines are:: - - include("${Package1_TRIBITS_DIR}/core/test_support/TribitsAddTest.cmake") - include("${Package1_TRIBITS_DIR}/core/test_support/TribitsAddAdvancedTest.cmake") - -This defines the CMake functions `tribits_add_test()`_ and -`tribits_add_advanced_test()`_, respectively. - -The above code demonstrates that ``CMAKE_MODULE_PATH`` does **not** need to be -updated to use these TriBITS ``test_support`` modules. However, one is free -to update ``CMAKE_MODULE_PATH`` and then include the modules by name only -like:: - - list(PREPEND CMAKE_MODULE_PATH "${Package1_TRIBITS_DIR}/core/test_support") - include(TribitsAddTest) - include(TribitsAddAdvancedTest) - -Once these TriBITS modules are included, one can use the TriBITS functions as -demonstrated in the file ``package1/test/CMakeLists.tribits.cmake`` (which is -included from the file ``package1/test/CMakeLists.txt``) and has the contents: - -.. include:: ../../examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake - :literal: - -Note that in this example, the executable ``package1-prg`` was already -created. If new test libraries and executables need to be created, then the -raw CMake commands to create those will need to be added as well. - - How to check for and tweak TriBITS "ENABLE" cache variables ----------------------------------------------------------- diff --git a/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst b/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst index 3723c3b7c8..6a71292c45 100644 --- a/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst @@ -34,7 +34,6 @@ understand the internals of TriBITS. @MACRO: tribits_parse_subpackages_append_packages_add_options() + @MACRO: tribits_prep_to_read_dependencies() + @MACRO: tribits_process_all_repository_deps_setup_files() + -@MACRO: tribits_process_enabled_tpls() + @MACRO: tribits_process_package_dependencies_lists() + @MACRO: tribits_process_packages_and_dirs_lists() + @MACRO: tribits_process_project_dependency_setup_file() + @@ -51,6 +50,6 @@ understand the internals of TriBITS. @MACRO: tribits_save_off_dependency_vars() + @MACRO: tribits_set_dep_packages() + @FUNCTION: tribits_trace_file_processing() + -@FUNCTION: tribits_write_package_client_export_files_export_and_install_targets() + +@FUNCTION: tribits_write_package_client_export_files_install_targets() + @MACRO: tribits_write_xml_dependency_files() + @FUNCTION: tribits_write_xml_dependency_files_if_supported() + diff --git a/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst b/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst index 79bb6ea0df..acc98214c1 100644 --- a/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/guides/UtilsMacroFunctionDocTemplate.rst @@ -39,11 +39,9 @@ @FUNCTION: timer_get_rel_seconds() + @FUNCTION: timer_print_rel_time() + @FUNCTION: tribits_add_enum_cache_var() + -@MACRO: tribits_advanced_set_cache_var_and_default() + @FUNCTION: tribits_deprecated() + @FUNCTION: tribits_deprecated_command() + @MACRO: tribits_create_reverse_list() + -@MACRO: tribits_set_cache_var_and_default() + @FUNCTION: tribits_strip_quotes_from_str() + @FUNCTION: unittest_compare_const() + @FUNCTION: unittest_has_substr_const() + diff --git a/cmake/tribits/doc/guides/generate-guide.sh b/cmake/tribits/doc/guides/generate-guide.sh index da7e128ebe..ce7a2c6565 100755 --- a/cmake/tribits/doc/guides/generate-guide.sh +++ b/cmake/tribits/doc/guides/generate-guide.sh @@ -112,7 +112,7 @@ function tribits_extract_rst_cmake_doc { echo "Extracting TriBITS documentation from *.cmake files ..." echo ../../../python_utils/extract_rst_cmake_doc.py \ - --extract-from=../../../ctest_driver/,../../../ci_support/,../../../core/package_arch/,../../../core/test_support/,../../../core/utils/ \ + --extract-from=../../../core/package_arch/,../../../ci_support/,../../../core/utils/,../../../ctest_driver/ \ --rst-file-pairs=../TribitsMacroFunctionDocTemplate.rst:TribitsMacroFunctionDoc.rst.tmp,../UtilsMacroFunctionDocTemplate.rst:UtilsMacroFunctionDoc.rst.tmp,../TribitsSystemMacroFunctionDocTemplate.rst:TribitsSystemMacroFunctionDoc.rst.tmp \ ${extra_args} \ --file-name-path-base-dir=../../.. \ @@ -152,30 +152,6 @@ function tribits_extract_other_doc { &> TribitsHelloWorldDirAndFiles.txt.tmp update_if_different TribitsHelloWorldDirAndFiles.txt tmp - echo - echo "Generating TribitsExampleProject2/Package1 CMakeList file variants ..." - echo - - cat ../../examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake \ - | grep -v EnableTribitsTestSupport \ - | grep -v GeneratePackageConfigFileForBuildDir \ - &> TribitsExampleProject2_Package1_CMakeLists.raw.external.cmake.tmp - update_if_different TribitsExampleProject2_Package1_CMakeLists.raw.external.cmake tmp - - cat ../../examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake \ - | grep -v EnableTribitsTestSupport \ - &> TribitsExampleProject2_Package1_CMakeLists.raw.internal.cmake.tmp - update_if_different TribitsExampleProject2_Package1_CMakeLists.raw.internal.cmake tmp - - cat ../../examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake \ - | grep -v "that TriBITS does automatically" \ - | grep -v DefineAllLibsTarget \ - | grep -v GeneratePackageConfigFileForBuildDir \ - | grep -v GeneratePackageConfigFileForInstallDir \ - &> TribitsExampleProject2_Package1_CMakeLists.raw.tribits_test.cmake.tmp - update_if_different \ - TribitsExampleProject2_Package1_CMakeLists.raw.tribits_test.cmake tmp - echo echo "Generating output for 'checkin-test.py --help' ..." echo @@ -270,8 +246,8 @@ function make_final_doc_in_subdir { if [[ "${skip_final_generation}" == "0" ]] ; then cd $dir_name echo $PWD - time make - cd - > /dev/null + make + cd - else echo echo "Skipping final generation of '${dir_name}' on request!" diff --git a/cmake/tribits/doc/utils/gen_doc_utils.sh b/cmake/tribits/doc/utils/gen_doc_utils.sh index 253418e44b..639aa68ddf 100644 --- a/cmake/tribits/doc/utils/gen_doc_utils.sh +++ b/cmake/tribits/doc/utils/gen_doc_utils.sh @@ -51,8 +51,7 @@ function generate_git_version_file { echo echo "Generating git version" echo - git describe --always --match="$_TRIBITS_TAG_PREFIX*" > TribitsGitVersion.txt || \ - echo "$_TRIBITS_TAG_PREFIX.{Unknown version}" > TribitsGitVersion.txt + echo `git describe --match="$_TRIBITS_TAG_PREFIX*"` > TribitsGitVersion.txt else echo "$_TRIBITS_TAG_PREFIX.{Unknown version}" > TribitsGitVersion.txt fi diff --git a/cmake/tribits/examples/ReducedMockTrilinos/extraRepos/DependsOnLAPACK/cmake/Dependencies.cmake b/cmake/tribits/examples/ReducedMockTrilinos/extraRepos/DependsOnLAPACK/cmake/Dependencies.cmake index da10035235..3f688dcd49 100644 --- a/cmake/tribits/examples/ReducedMockTrilinos/extraRepos/DependsOnLAPACK/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/ReducedMockTrilinos/extraRepos/DependsOnLAPACK/cmake/Dependencies.cmake @@ -1,3 +1,3 @@ tribits_package_define_dependencies( - LIB_REQUIRED_PACKAGES LAPACK + LIB_REQUIRED_TPLS LAPACK ) diff --git a/cmake/tribits/examples/ReducedMockTrilinos/packages/epetra/cmake/Dependencies.cmake b/cmake/tribits/examples/ReducedMockTrilinos/packages/epetra/cmake/Dependencies.cmake index d08c7ab682..e3a218cf82 100644 --- a/cmake/tribits/examples/ReducedMockTrilinos/packages/epetra/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/ReducedMockTrilinos/packages/epetra/cmake/Dependencies.cmake @@ -1,4 +1,4 @@ tribits_package_define_dependencies( - LIB_REQUIRED_PACKAGES BLAS LAPACK - LIB_OPTIONAL_PACKAGES MPI + LIB_REQUIRED_TPLS BLAS LAPACK + LIB_OPTIONAL_TPLS MPI ) diff --git a/cmake/tribits/examples/ReducedMockTrilinos/packages/epetraext/cmake/Dependencies.cmake b/cmake/tribits/examples/ReducedMockTrilinos/packages/epetraext/cmake/Dependencies.cmake index d0b518696b..1cd83d35ef 100644 --- a/cmake/tribits/examples/ReducedMockTrilinos/packages/epetraext/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/ReducedMockTrilinos/packages/epetraext/cmake/Dependencies.cmake @@ -1,14 +1,15 @@ if (SHOW_TEST_REQUIRED_PACKAGE_DEP) - set(TEST_REQUIRED_PACKAGES Triutils) + set(TEST_REQUIRED_PACKAGES_ARGS TEST_REQUIRED_PACKAGES Triutils) endif() if (SHOW_TEST_REQUIRED_TPL_DEP) - set(TEST_REQUIRED_PACKAGES ${TEST_REQUIRED_PACKAGES} AMD) + set(TEST_REQUIRED_TPLS_ARGS TEST_REQUIRED_TPLS AMD) endif() tribits_package_define_dependencies( LIB_REQUIRED_PACKAGES Teuchos Epetra LIB_OPTIONAL_PACKAGES Triutils - LIB_OPTIONAL_PACKAGES UMFPACK AMD PETSC - TEST_REQUIRED_PACKAGES ${TEST_REQUIRED_PACKAGES} + LIB_OPTIONAL_TPLS UMFPACK AMD PETSC + ${TEST_REQUIRED_PACKAGES_ARGS} + ${TEST_REQUIRED_TPLS_ARGS} ) diff --git a/cmake/tribits/examples/ReducedMockTrilinos/packages/teuchos/cmake/Dependencies.cmake b/cmake/tribits/examples/ReducedMockTrilinos/packages/teuchos/cmake/Dependencies.cmake index 6e5f9d4aa3..1d5eb60933 100644 --- a/cmake/tribits/examples/ReducedMockTrilinos/packages/teuchos/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/ReducedMockTrilinos/packages/teuchos/cmake/Dependencies.cmake @@ -1,4 +1,4 @@ tribits_package_define_dependencies( - LIB_REQUIRED_PACKAGES BLAS LAPACK - LIB_OPTIONAL_PACKAGES Boost MPI + LIB_REQUIRED_TPLS BLAS LAPACK + LIB_OPTIONAL_TPLS Boost MPI ) diff --git a/cmake/tribits/examples/TribitsExampleApp2/AppHelperFuncs.cmake b/cmake/tribits/examples/TribitsExampleApp2/AppHelperFuncs.cmake index ebb23e1789..cbed66bcd7 100644 --- a/cmake/tribits/examples/TribitsExampleApp2/AppHelperFuncs.cmake +++ b/cmake/tribits/examples/TribitsExampleApp2/AppHelperFuncs.cmake @@ -37,7 +37,7 @@ macro(getTribitsExProj2StuffForAppByPackage) # Find each package and gather up all the ::all_libs targets set(APP_DEPS_LIB_TARGETS "") foreach (packageName IN LISTS ${PROJECT_NAME}_USE_COMPONENTS) - find_package(${packageName} CONFIG REQUIRED) + find_package(${packageName} REQUIRED) message("Found ${packageName}!") list(APPEND APP_DEPS_LIB_TARGETS ${packageName}::all_libs) endforeach() @@ -59,8 +59,7 @@ endmacro() # macro(getTribitsExProj2StuffForAppByProject) - find_package(TribitsExProj2 CONFIG REQUIRED - COMPONENTS ${${PROJECT_NAME}_USE_COMPONENTS}) + find_package(TribitsExProj2 REQUIRED COMPONENTS ${${PROJECT_NAME}_USE_COMPONENTS}) message("\nFound TribitsExProj2! Here are the details: ") message(" TribitsExProj2_DIR = ${TribitsExProj2_DIR}") diff --git a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/cmake/Dependencies.cmake b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/cmake/Dependencies.cmake index 4ee6c7ee90..13461825af 100644 --- a/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/TribitsExampleProject/packages/simple_cxx/cmake/Dependencies.cmake @@ -1,5 +1,5 @@ tribits_package_define_dependencies( - LIB_REQUIRED_PACKAGES HeaderOnlyTpl - LIB_OPTIONAL_PACKAGES SimpleTpl MPI + LIB_REQUIRED_TPLS HeaderOnlyTpl + LIB_OPTIONAL_TPLS SimpleTpl MPI REGRESSION_EMAIL_LIST simplecxx-regressions@someurl.none ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake deleted file mode 100644 index ad2a181827..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.raw.cmake +++ /dev/null @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 3.23.0 FATAL_ERROR) - -if (COMMAND tribits_package) - message("Configuring raw CMake package Package1") -else() - message("Configuring raw CMake project Package1") -endif() - -# Standard project-level stuff -project(Package1 LANGUAGES C CXX) -include(GNUInstallDirs) -find_package(Tpl1 CONFIG REQUIRED) -add_subdirectory(src) -if (Package1_ENABLE_TESTS) - include(CTest) - include("${CMAKE_CURRENT_LIST_DIR}/cmake/raw/EnableTribitsTestSupport.cmake") - add_subdirectory(test) -endif() - -# Stuff that TriBITS does automatically -include("${CMAKE_CURRENT_LIST_DIR}/cmake/raw/DefineAllLibsTarget.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake") diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.tribits.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.tribits.cmake deleted file mode 100644 index 2c2fc1f8a6..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.tribits.cmake +++ /dev/null @@ -1,5 +0,0 @@ -message("Configuring package Package1 as full TriBITS package") -tribits_package(Package1) -add_subdirectory(src) -tribits_add_test_directories(test) -tribits_package_postprocess() diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt index c8511aab35..bf2638c61f 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt @@ -1,18 +1,4 @@ -cmake_minimum_required(VERSION 3.23.0 FATAL_ERROR) - -set(Package1_USE_RAW_CMAKE OFF CACHE BOOL - "Use raw CMake for package build, even if TriBITS could be used.") - -# Macro to select the TriBITS or the raw CMake build system -macro(include_cmakelists_file) - if ((NOT COMMAND tribits_project) OR Package1_USE_RAW_CMAKE) - include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.raw.cmake" - NO_POLICY_SCOPE) - else() - include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.tribits.cmake" - NO_POLICY_SCOPE) - endif() -endmacro() - -# Pull in the base CMakeLists.txt file variant -include_cmakelists_file() +tribits_package(Package1) +add_subdirectory(src) +tribits_add_test_directories(test) +tribits_package_postprocess() diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/Dependencies.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/Dependencies.cmake index 5383950e6a..64ccf196ee 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/Dependencies.cmake @@ -1,3 +1,3 @@ tribits_package_define_dependencies( - LIB_REQUIRED_PACKAGES Tpl1 + LIB_REQUIRED_TPLS Tpl1 ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/DefineAllLibsTarget.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/DefineAllLibsTarget.cmake deleted file mode 100644 index 902b1cdf15..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/DefineAllLibsTarget.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Generate the all_libs target(s) -add_library(Package1_all_libs INTERFACE) -set_target_properties(Package1_all_libs - PROPERTIES EXPORT_NAME all_libs) -target_link_libraries(Package1_all_libs - INTERFACE Package1_package1) -install(TARGETS Package1_all_libs - EXPORT ${PROJECT_NAME} - COMPONENT ${PROJECT_NAME} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -add_library(Package1::all_libs ALIAS Package1_all_libs) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/EnableTribitsTestSupport.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/EnableTribitsTestSupport.cmake deleted file mode 100644 index c4449e5432..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/EnableTribitsTestSupport.cmake +++ /dev/null @@ -1,10 +0,0 @@ -set(Package1_USE_TRIBITS_TEST_FUNCTIONS OFF CACHE BOOL - "Use TriBITS testing functions") -set(Package1_TRIBITS_DIR "" CACHE PATH - "Path to TriBITS implementation base dir (e.g. TriBITS/tribits)") -if (Package1_USE_TRIBITS_TEST_FUNCTIONS AND Package1_TRIBITS_DIR) - # Pull in and turn on TriBITS testing support - include("${Package1_TRIBITS_DIR}/core/test_support/TribitsAddTest.cmake") - include("${Package1_TRIBITS_DIR}/core/test_support/TribitsAddAdvancedTest.cmake") - set(Package1_ENABLE_TESTS ON) -endif() diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake deleted file mode 100644 index 9f937dcda5..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForBuildDir.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if (COMMAND tribits_package) - # Generate Package1Config.cmake file for the build tree (for internal - # TriBITS-compliant package) - set(packageBuildDirCMakePackagesDir - "${${CMAKE_PROJECT_NAME}_BINARY_DIR}/cmake_packages/${PROJECT_NAME}") - export(EXPORT ${PROJECT_NAME} - NAMESPACE ${PROJECT_NAME}:: - FILE "${packageBuildDirCMakePackagesDir}/${PROJECT_NAME}ConfigTargets.cmake" ) - configure_file( - "${CMAKE_CURRENT_LIST_DIR}/Package1Config.cmake.in" - "${packageBuildDirCMakePackagesDir}/${PROJECT_NAME}/Package1Config.cmake" - @ONLY ) -endif() diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake deleted file mode 100644 index 535685e614..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/GeneratePackageConfigFileForInstallDir.cmake +++ /dev/null @@ -1,15 +0,0 @@ -# Generate and install the Package1Config.cmake file for the install tree -# (needed for both internal and external TriBITS package) -set(pkgConfigInstallDir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") -install(EXPORT ${PROJECT_NAME} - DESTINATION "${pkgConfigInstallDir}" - NAMESPACE ${PROJECT_NAME}:: - FILE ${PROJECT_NAME}ConfigTargets.cmake ) -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/raw/Package1Config.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Package1Config.install.cmake" - @ONLY ) -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Package1Config.install.cmake" - RENAME "Package1Config.cmake" - DESTINATION "${pkgConfigInstallDir}" ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in deleted file mode 100644 index 63cffb7867..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -set(Tpl1_DIR "@Tpl1_DIR@") -find_package(Tpl1 CONFIG REQUIRED) -include("${CMAKE_CURRENT_LIST_DIR}/Package1ConfigTargets.cmake") diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake deleted file mode 100644 index f15cdc5898..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# Create and install library 'package1' -add_library(Package1_package1 Package1.hpp Package1.cpp) -target_include_directories(Package1_package1 - PUBLIC $) -target_link_libraries(Package1_package1 - PRIVATE tpl1::tpl1 ) -set_target_properties(Package1_package1 PROPERTIES - EXPORT_NAME package1) -add_library(Package1::package1 ALIAS Package1_package1) -install(TARGETS Package1_package1 - EXPORT ${PROJECT_NAME} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install( - FILES Package1.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - -# Create and install executable 'package1-prg' -add_executable(package1-prg Package1_Prg.cpp) -target_link_libraries(package1-prg PRIVATE Package1::package1) -install( - TARGETS package1-prg - EXPORT ${PROJECT_NAME} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.tribits.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.tribits.cmake deleted file mode 100644 index 8e69c53a57..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.tribits.cmake +++ /dev/null @@ -1,4 +0,0 @@ -tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -tribits_add_library(package1 HEADERS Package1.hpp SOURCES Package1.cpp) -tribits_add_executable(package1-prg NOEXEPREFIX NOEXESUFFIX - SOURCES Package1_Prg.cpp INSTALLABLE ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt index 870958046e..b74162bb25 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt @@ -1 +1,22 @@ -include_cmakelists_file() +set(HEADERS "") +set(SOURCES "") + +tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +append_set(HEADERS + Package1.hpp + ) +append_set(SOURCES + Package1.cpp + ) + +tribits_add_library( + package1 + HEADERS ${HEADERS} + SOURCES ${SOURCES} + ) + +tribits_add_executable(package1-prg NOEXEPREFIX NOEXESUFFIX + SOURCES Package1_Prg.cpp + INSTALLABLE + ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_Prg.cpp b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_Prg.cpp index 33d4dc0cef..2ce91f102a 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_Prg.cpp +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_Prg.cpp @@ -1,13 +1,9 @@ #include -#include #include "Package1.hpp" -int main(int argc, char* argv[]) +int main() { std::cout << "Package1 Deps: " << Package1::deps() << "\n"; - for (int arg_i = 0; arg_i < argc; ++arg_i) { - std::cout << argv[arg_i+1] << "\n"; - } return 0; } diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake deleted file mode 100644 index fef3221526..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake +++ /dev/null @@ -1,19 +0,0 @@ -add_test(NAME Package1_Prg COMMAND package1-prg) -set_tests_properties(Package1_Prg - PROPERTIES PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1") - -add_test(NAME Package1_Prg-advanced COMMAND package1-prg something_extra) -set_tests_properties(Package1_Prg-advanced - PROPERTIES PASS_REGULAR_EXPRESSION "something_extra") - -# NOTE: With raw CMake/CTest, it is not possible to require the matches of -# multiple regexes (i.e. not the require the match of *both* "Package1 Deps: -# tpl1" and "something_extra"). Also, it is not possible to require a -# non-zero return code in addition to requiring a regex match the output. -# These more advanced features of tribits_add_advanced_test() would need to be -# provided by writing a wrapper script (e.g. using a Python script, a cmake -P -# script, etc.). Also, these tests don't support other features like: b) -# allow tests to be disabled for a variety of reasons like number of MPI -# processes required, incompatible system, disable cache variables -D -# _DISABLE=ON, etc.; b) printing which tests got added or did -# not get added and why when _TRACE_ADD_TEST=ON, etc. diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake deleted file mode 100644 index 48d1f6e192..0000000000 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake +++ /dev/null @@ -1,14 +0,0 @@ -tribits_add_test(package1-prg NOEXEPREFIX NOEXESUFFIX - NAME Prg DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../src" NUM_MPI_PROCS 1 - PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" ) - -tribits_add_advanced_test(Prg-advanced - TEST_0 - EXEC package1-prg DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../src" - NOEXEPREFIX NOEXESUFFIX - ARGS "something_extra" - PASS_REGULAR_EXPRESSION_ALL - "Package1 Deps: tpl1" - "something_extra" - ALWAYS_FAIL_ON_NONZERO_RETURN - ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt index 11b72aec01..afef4e708a 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt @@ -1,11 +1,6 @@ -if ((NOT COMMAND tribits_project) OR Package1_USE_RAW_CMAKE) - if (Package1_USE_TRIBITS_TEST_FUNCTIONS AND (COMMAND tribits_add_test)) - message("-- Using TriBITS Test Functions in raw CMake Package1 build!") - include("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.tribits.cmake") - else() - message("-- Using Raw CMake add_test() in raw CMake Package1 build!") - include("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.raw.cmake") - endif() -else() - include("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.tribits.cmake") -endif() +tribits_add_test(package1-prg NOEXEPREFIX NOEXESUFFIX + NAME Prg + DIRECTORY ${PACKAGE_BINARY_DIR}/src + NUM_MPI_PROCS 1 + PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" + ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package2/cmake/Dependencies.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package2/cmake/Dependencies.cmake index e299aef0d7..46c260a264 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package2/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package2/cmake/Dependencies.cmake @@ -1,4 +1,4 @@ tribits_package_define_dependencies( LIB_REQUIRED_PACKAGES Package1 - LIB_OPTIONAL_PACKAGES Tpl3 + LIB_OPTIONAL_TPLS Tpl3 ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package3/cmake/Dependencies.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package3/cmake/Dependencies.cmake index b2c5eec262..6e9a0e1e47 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package3/cmake/Dependencies.cmake +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package3/cmake/Dependencies.cmake @@ -1,4 +1,6 @@ tribits_package_define_dependencies( - LIB_REQUIRED_PACKAGES Package1 Tpl2 - LIB_OPTIONAL_PACKAGES Package2 Tpl4 + LIB_REQUIRED_PACKAGES Package1 + LIB_OPTIONAL_PACKAGES Package2 + LIB_REQUIRED_TPLS Tpl2 + LIB_OPTIONAL_TPLS Tpl4 ) diff --git a/cmake/tribits/python_utils/gitdist-setup.sh b/cmake/tribits/python_utils/gitdist-setup.sh index 928c058838..0df08515dc 100644 --- a/cmake/tribits/python_utils/gitdist-setup.sh +++ b/cmake/tribits/python_utils/gitdist-setup.sh @@ -44,7 +44,7 @@ if [[ "${existing_gitdist}" == "" ]] ; then fi function gitdist_repo_versions { - gitdist "$@" --dist-no-color log --color=never -1 --pretty=format:"%H [%cd] <%ae>%n%s" | grep -v "^$" + gitdist "$@" --dist-no-color log -1 --pretty=format:"%H [%cd] <%ae>%n%s" | grep -v "^$" } export -f gitdist_repo_versions @@ -60,7 +60,7 @@ function gitdist_show_full_repo_state { echo echo "Repo remotes:" echo - gitdist --dist-no-color "$@" remote -v | grep --color=never "\(Git Repo\|push\)" + gitdist --dist-no-color "$@" remote -v | grep "\(Git Repo\|push\)" } export -f gitdist_show_full_repo_state @@ -73,7 +73,7 @@ alias gitdist-show-full-repo-state=gitdist_show_full_repo_state # Setup for completions for git command and gitdist options commands complete -o default -o nospace -F _git \ - -W "dist-repo-status --dist-help --dist-use-git --dist-repos --dist-not-repos --dist-version-file --dist-version-file2 --dist-no-color --dist-debug --dist-no-opt --dist-mod-only" \ + -W "dist-repo-status --dist-help --dist-use-git --dist-repos --dist-not-repos --dist-version-file --dist-version-file2 --dist-no-color --dist-debug --dist-no-opt --dist-mod-only --dist-legend" \ gitdist gitdist-mod complete -o default -o nospace \ -W "--dist-use-git --dist-repos --dist-not-repos --dist-mod-only" \ @@ -82,5 +82,5 @@ complete -o default -o nospace \ -W "--dist-use-git --dist-repos --dist-not-repos --dist-mod-only" \ gitdist_show_full_repo_state gitdist-show-full-repo-state complete -o default -o nospace \ - -W "--dist-repos --dist-not-repos --dist-mod-only --dist-legend" \ + -W "--dist-repos --dist-not-repos --dist-mod-only" \ gitdist-status diff --git a/cmake/tribits/python_utils/gitdist.py b/cmake/tribits/python_utils/gitdist.py index 6800e2e20c..db20c7ddfa 100755 --- a/cmake/tribits/python_utils/gitdist.py +++ b/cmake/tribits/python_utils/gitdist.py @@ -36,7 +36,7 @@ def s(x): distRepoStatusLegend = r"""Legend: * ID: Repository ID, zero based (order git commands are run) * Repo Dir: Relative to base repo (base repo shown first with '(Base)') -* Branch: Current branch, or (if detached HEAD) tag name or SHA1 +* Branch: Current branch (or detached HEAD) * Tracking Branch: Tracking branch (or empty if no tracking branch exists) * C: Number local commits w.r.t. tracking branch (empty if zero or no TB) * M: Number of tracked modified (uncommitted) files (empty if zero) @@ -333,7 +333,7 @@ def getHelpTopicsStr(): |----|-----------------------|--------|-----------------|---|----|---| | 0 | BaseRepo (Base) | dummy | | | | | | 1 | ExtraRepo1 | master | origin/master | 1 | 2 | | - | 2 | ExtraRepo1/ExtraRepo2 | abc123 | | | 25 | 4 | + | 2 | ExtraRepo1/ExtraRepo2 | HEAD | | | 25 | 4 | | 3 | ExtraRepo3 | master | origin/master | | | | ---------------------------------------------------------------------- @@ -341,13 +341,6 @@ def getHelpTopicsStr(): """+distRepoStatusLegend+\ r""" - -In the case of a detached head state, as shown above with the repo -'ExtraRepo3', the SHA1 (e.g. 'abc123') was printed instead of 'HEAD'. -However, if the repo is in the detached head state but a tag happens to point -to the current commit (e.g. 'git tag --points-at' returns non-empy), then the -tag name (e.g. 'v1.2.3') is printed instead of the SHA1 of the commit. - One can also show the status of only changed repos with the command: $ gitdist dist-repo-status --dist-mod-only # alias 'gitdist-mod-status' @@ -358,7 +351,7 @@ def getHelpTopicsStr(): | ID | Repo Dir | Branch | Tracking Branch | C | M | ? | |----|-----------------------|--------|-----------------|---|----|---| | 1 | ExtraRepo1 | master | origin/master | 1 | 2 | | - | 2 | ExtraRepo1/ExtraRepo2 | abc123 | | | 25 | 4 | + | 2 | ExtraRepo1/ExtraRepo2 | HEAD | | | 25 | 4 | ---------------------------------------------------------------------- (see the alias 'gitdist-mod-status' in --dist-help=aliases). @@ -403,13 +396,13 @@ def getHelpTopicsStr(): with this script listing three lines per repo (e.g. as shown above) using (for example): - $ gitdist --dist-no-color log --color=never -1 --pretty=format:"%h [%ad] <%ae>%n%s" \ + $ gitdist --dist-no-color log -1 --pretty=format:"%h [%ad] <%ae>%n%s" \ | grep -v "^$" &> RepoVersion.txt (which is defined as the alias 'gitdist-repo-versions' in the file 'gitdist-setup.sh') or two lines per repo using (for example): - $ gitdist --dist-no-color log --color=never -1 --pretty=format:"%h [%ad] <%ae>" \ + $ gitdist --dist-no-color log -1 --pretty=format:"%h [%ad] <%ae>" \ | grep -v "^$" &> RepoVersion.txt This allows checking out consistent versions of the set git repos, diffing two @@ -502,7 +495,7 @@ def getHelpTopicsStr(): $ alias gitdist-status="gitdist dist-repo-status" $ alias gitdist-mod="gitdist --dist-mod-only" $ alias gitdist-mod-status="gitdist dist-repo-status --dist-mod-only" - $ alias gitdist-repo-versions="gitdist --dist-no-color log --color=never -1 \ + $ alias gitdist-repo-versions="gitdist --dist-no-color log -1 \ --pretty=format:\"%h [%ad] <%ae>%n%s\" | grep -v \"^$\"" These are added by sourcing the provided file 'gitdist-setup.sh' (which should @@ -851,8 +844,7 @@ def createTable(tableData, utf8=False): if mockSttySize: sttySize = mockSttySize else: - with os.popen("stty size", "r") as subprocess: - sttySize = subprocess.read() + sttySize = os.popen("stty size", "r").read() rows, columns = sttySize.split() except: shrink = False @@ -1079,7 +1071,7 @@ def getCmndOutput(cmnd, rtnCode=False): child = subprocess.Popen(cmnd, shell=True, stdout=subprocess.PIPE, stderr = subprocess.STDOUT) output = child.stdout.read() - child.communicate() + child.wait() if rtnCode: return (s(output), child.returncode) return s(output) @@ -1312,10 +1304,7 @@ def getCommandlineOps(): clp.add_option( noColorArgName, dest="useColor", action="store_false", - help="If set, don't use color in the output for gitdist and set" - +" '-c color.status=never' before the git command (like 'status')." - +" NOTE: user should also pass in --color=never for git commands " - +" accept that argument. (Better for output to a file).", + help="If set, don't use color in the output for gitdist (better for output to a file).", default=True ) clp.add_option( @@ -1555,12 +1544,7 @@ def runRepoCmnd(options, cmndLineArgsArray, repoDirName, baseDir, \ repoDirName, repoVersionDict, repoVersionDict2) cmndLineArgsArrayDefaultBranch = replaceDefaultBranchInCmndLineArgs( \ cmndLineArgsArrayRepo, repoDirName, defaultBranchDict) - egCmndArray = [ options.useGit ] - if options.useColor: - egCmndArray.extend(['-c', 'color.status=always']) - else: - egCmndArray.extend(['-c', 'color.status=never']) - egCmndArray.extend(cmndLineArgsArrayDefaultBranch) + egCmndArray = [ options.useGit ] + cmndLineArgsArrayDefaultBranch runCmnd(options, egCmndArray) @@ -1582,20 +1566,6 @@ def repoExistsAndNotExcluded(options, extraRepo, notReposList): return True -# Get the identifier for the current commit in the repo -def getRepoVersionIdentifier(options, getCmndOutputFunc, showMoreHeadDetails): - branch = getLocalBranch(options, getCmndOutputFunc) - if showMoreHeadDetails != "SHOW_MORE_HEAD_DETAILS": - return branch - if branch != "HEAD": - return branch - tagName = getCmndOutputFunc(options.useGit + " tag --points-at").strip() - if tagName != "": - return tagName - sha1 = getCmndOutputFunc(options.useGit + " log --pretty=%h -1").strip() - return sha1 - - # Get the tracking branch for a repo def getLocalBranch(options, getCmndOutputFunc): (resp, rtnCode) = getCmndOutputFunc( @@ -1685,9 +1655,7 @@ def getNumModifiedAndUntracked(options, getCmndOutputFunc): class RepoStatsStruct: - def __init__(self, branch, trackingBranch, numCommits, numModified, - numUntracked \ - ): + def __init__(self, branch, trackingBranch, numCommits, numModified, numUntracked): self.branch = branch self.trackingBranch = trackingBranch self.numCommits = numCommits @@ -1721,16 +1689,21 @@ def hasLocalChanges(self): return False -def getRepoStats(options, getCmndOutputFunc=None, showMoreHeadDetails=""): +def getRepoStats(options, getCmndOutputFunc=None): if not getCmndOutputFunc: getCmndOutputFunc = getCmndOutput - branch = getRepoVersionIdentifier(options, getCmndOutputFunc, showMoreHeadDetails) + branch = getLocalBranch(options, getCmndOutputFunc) trackingBranch = getTrackingBranch(options, getCmndOutputFunc) - numCommits = getNumCommitsWrtTrackingBranch(options, trackingBranch, getCmndOutputFunc) + numCommits = getNumCommitsWrtTrackingBranch(options, + trackingBranch, + getCmndOutputFunc) (numModified, numUntracked) = getNumModifiedAndUntracked(options, - getCmndOutputFunc) - return RepoStatsStruct(branch, trackingBranch, numCommits, - numModified, numUntracked) + getCmndOutputFunc) + return RepoStatsStruct(branch, + trackingBranch, + numCommits, + numModified, + numUntracked) class RepoVersionStruct: @@ -1921,7 +1894,7 @@ def getRepoName(repoDir, baseRepoName): # Get repo stats repoStats = None if options.modifiedOnly or distRepoStatus: - repoStats = getRepoStats(options, showMoreHeadDetails="SHOW_MORE_HEAD_DETAILS") + repoStats = getRepoStats(options) repoVersions = None if distRepoVersionTable: repoVersions = getRepoVersions(options) diff --git a/packages/seacas/libraries/ioss/src/Ioss_ChainGenerator.C b/packages/seacas/libraries/ioss/src/Ioss_ChainGenerator.C index b6220ef3c6..5d1501cca0 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_ChainGenerator.C +++ b/packages/seacas/libraries/ioss/src/Ioss_ChainGenerator.C @@ -151,9 +151,9 @@ namespace { connectivity_t &face_connectivity) { for (const auto &face : faces) { - for (const auto &face_element : face.element) { - auto element = face_element / 10 - offset; - auto side = face_element % 10; // 0-based side + for (int i = 0; i < face.elementCount_; i++) { + auto element = face.element[i] / 10 - offset; + auto side = face.element[i] % 10; // 0-based side face_connectivity[element][side] = &face; } }