diff --git a/.github/workflows/build_external_lib.yml b/.github/workflows/build_external_lib.yml index b3a01b8a89..c4c1239690 100644 --- a/.github/workflows/build_external_lib.yml +++ b/.github/workflows/build_external_lib.yml @@ -9,6 +9,10 @@ on: - master workflow_dispatch: +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-deps: diff --git a/.github/workflows/build_netcdf_no_hdf5.yml b/.github/workflows/build_netcdf_no_hdf5.yml index 06560b74e5..43d1105d01 100644 --- a/.github/workflows/build_netcdf_no_hdf5.yml +++ b/.github/workflows/build_netcdf_no_hdf5.yml @@ -10,6 +10,10 @@ on: branches: - master +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-deps: diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 5f5de18914..bbdb278731 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -8,6 +8,10 @@ on: branches: - master +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-deps: diff --git a/.github/workflows/build_variant.yml b/.github/workflows/build_variant.yml index c43c349f26..853b327978 100644 --- a/.github/workflows/build_variant.yml +++ b/.github/workflows/build_variant.yml @@ -10,8 +10,11 @@ on: branches: - master -jobs: +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true +jobs: build-deps: runs-on: ubuntu-latest diff --git a/.github/workflows/docker-exodus.yml b/.github/workflows/docker-exodus.yml index dcdeca959c..b452662065 100644 --- a/.github/workflows/docker-exodus.yml +++ b/.github/workflows/docker-exodus.yml @@ -2,6 +2,11 @@ name: docker-exodus on: push: branches: [ "master" ] + +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-latest: runs-on: ubuntu-latest diff --git a/.github/workflows/docker-seacas.yml b/.github/workflows/docker-seacas.yml index 7f61b226bb..ad7982f8c7 100644 --- a/.github/workflows/docker-seacas.yml +++ b/.github/workflows/docker-seacas.yml @@ -2,6 +2,11 @@ name: docker-seacas on: push: branches: [ "master" ] + +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-latest: runs-on: ubuntu-latest diff --git a/.github/workflows/intel-build.yml b/.github/workflows/intel-build.yml index 669c25f897..f4e6378c55 100644 --- a/.github/workflows/intel-build.yml +++ b/.github/workflows/intel-build.yml @@ -8,6 +8,11 @@ on: branches: - master + +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-deps: @@ -25,6 +30,14 @@ jobs: shell: bash --noprofile --norc {0} steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + root-reserve-mb: 30000 + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' - uses: actions/checkout@v3 - name: setup repo run: | @@ -79,6 +92,14 @@ jobs: cgns: [ 4.3.0 ] steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + root-reserve-mb: 30000 + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' - uses: actions/checkout@v3 - name: setup repo run: | diff --git a/.github/workflows/msys2.yml b/.github/workflows/msys2.yml index 2af9345ddd..0a8b20087b 100644 --- a/.github/workflows/msys2.yml +++ b/.github/workflows/msys2.yml @@ -7,6 +7,10 @@ on: branches: - master +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build: runs-on: windows-latest diff --git a/TPLsList.cmake b/TPLsList.cmake index 67ec4d6857..0a97a635f9 100644 --- a/TPLsList.cmake +++ b/TPLsList.cmake @@ -53,6 +53,9 @@ # SET( Seacas_TPLS_FINDMODS_CLASSIFICATIONS + X11 "cmake/TPLs/" ST + DLlib "cmake/TPLs/" ST + fmt "cmake/TPLs/" ST GTest "cmake/TPLs/" PT Zlib "cmake/TPLs/" ST Pthread "cmake/TPLs/" PT @@ -66,10 +69,7 @@ SET( Seacas_TPLS_FINDMODS_CLASSIFICATIONS ParMETIS "cmake/TPLs/" ST Pamgen "cmake/TPLs/" ST Matio "cmake/TPLs/" ST - X11 "cmake/TPLs/" ST - DLlib "cmake/TPLs/" ST CUDA "cmake/TPLs/" ST - fmt "cmake/TPLs/" ST Kokkos "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/" ST Faodel "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" ST Cereal "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" ST diff --git a/cmake-config b/cmake-config index 6181884365..13d4748eb8 100755 --- a/cmake-config +++ b/cmake-config @@ -540,8 +540,7 @@ ${FAODEL_SYMBOLS} \ -D Metis_ROOT:PATH=${METIS_PATH} \ -D ParMETIS_ROOT:PATH=${PARMETIS_PATH} \ -D PNetCDF_ROOT:PATH=${PNETCDF_PATH} \ --D fmt_LIBRARY_DIRS:PATH=${FMT_PATH}/lib \ --D fmt_INCLUDE_DIRS:PATH=${FMT_PATH}/include \ +-D fmt_ROOT:PATH=${FMT_PATH} \ $EXTRA_ARGS \ ${ACCESS} diff --git a/cmake/TPLs/FindTPLfmt.cmake b/cmake/TPLs/FindTPLfmt.cmake index c6ec212f9e..f749486a22 100644 --- a/cmake/TPLs/FindTPLfmt.cmake +++ b/cmake/TPLs/FindTPLfmt.cmake @@ -53,8 +53,15 @@ # ************************************************************************ # @HEADER +message("-- Using find_package(fmt CONFIG) ...") +find_package(fmt CONFIG) +if (fmt_FOUND) + message("-- Found fmt_CONFIG=${fmt_CONFIG}") + message("-- Generating fmt::all_libs and fmtConfig.cmake") + tribits_extpkg_create_imported_all_libs_target_and_config_file( + fmt + INNER_FIND_PACKAGE_NAME fmt + IMPORTED_TARGETS_FOR_ALL_LIBS fmt::fmt) + set(TPL_fmt_NOT_FOUND FALSE) +endif() -TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( fmt - REQUIRED_HEADERS fmt/format.h - REQUIRED_LIBS_NAMES fmt - ) 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/FindTPLCGNS.cmake b/cmake/tribits/common_tpls/FindTPLCGNS.cmake index d508636b7c..649ab49855 100644 --- a/cmake/tribits/common_tpls/FindTPLCGNS.cmake +++ b/cmake/tribits/common_tpls/FindTPLCGNS.cmake @@ -49,10 +49,14 @@ if ((CGNS_ALLOW_MODERN AND HDF5_FOUND_MODERN_CONFIG_FILE) OR CGNS_FORCE_MODERN) if (CGNS_FOUND) message("-- Found CGNS_CONFIG=${CGNS_CONFIG}") message("-- Generating CGNS::all_libs and CGNSConfig.cmake") + set(CGNS_TARGET CGNS::cgns_shared) + if(NOT TARGET CGNS::cgns_shared) + set(CGNS_TARGET CGNS::cgns_static) + endif() tribits_extpkg_create_imported_all_libs_target_and_config_file( CGNS INNER_FIND_PACKAGE_NAME CGNS - IMPORTED_TARGETS_FOR_ALL_LIBS cgns) + IMPORTED_TARGETS_FOR_ALL_LIBS ${CGNS_TARGET}) set(TPL_CGNS_NOT_FOUND FALSE) endif() @@ -107,4 +111,4 @@ tribits_tpl_find_include_dirs_and_libraries( CGNS REQUIRED_HEADERS ${REQUIRED_HEADERS} REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES}) -endif() \ No newline at end of file +endif() diff --git a/cmake/tribits/common_tpls/FindTPLHDF5.cmake b/cmake/tribits/common_tpls/FindTPLHDF5.cmake index c94a502625..71e0dd640e 100644 --- a/cmake/tribits/common_tpls/FindTPLHDF5.cmake +++ b/cmake/tribits/common_tpls/FindTPLHDF5.cmake @@ -11,13 +11,14 @@ if (Netcdf_ALLOW_MODERN) find_package(HDF5 CONFIG) if (HDF5_FOUND) message("-- Found HDF5_CONFIG=${HDF5_CONFIG}") - message("-- Generating Netcdf::all_libs and NetcdfConfig.cmake") + message("-- Generating HDF5::all_libs and HDF5Config.cmake") message("-- HDF5_EXPORT_LIBRARIES=${HDF5_EXPORT_LIBRARIES}") tribits_extpkg_create_imported_all_libs_target_and_config_file( HDF5 INNER_FIND_PACKAGE_NAME HDF5 IMPORTED_TARGETS_FOR_ALL_LIBS ${HDF5_EXPORT_LIBRARIES}) set(HDF5_INTERNAL_IS_MODERN TRUE) + set(TPL_HDF5_NOT_FOUND FALSE) else() message("-- Could not find HDF5_CONFIG (FindTPLHDF5.cmake)") endif() 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/Jamfile b/packages/seacas/Jamfile index 2ad19374a4..23dc6d5766 100644 --- a/packages/seacas/Jamfile +++ b/packages/seacas/Jamfile @@ -1390,6 +1390,7 @@ lib aprepro_lib exodus /tpl/netcdf-c//netcdf : EXODUS_SUPPORT + FMT_SUPPORT [ ifdevbuild # Any parameters within this 'ifdevbuild' block apply to development # builds only and will not be present for user builds. @@ -1402,6 +1403,7 @@ lib aprepro_lib ] : : EXODUS_SUPPORT + FMT_SUPPORT [ ifdevbuild # Any parameters within this 'ifdevbuild' block apply to development # builds only and will not be present for user builds. @@ -1472,6 +1474,7 @@ exe aprepro : $(seacas-root)/applications/aprepro/aprepro.C aprepro_lib + suplib_cpp : $(seacas-root)/applications/aprepro $(seacas-root)/applications/aprepro @utility-exec-tag @@ -1499,6 +1502,7 @@ exe slice : $(seacas-root)/applications/slice/Slice.C $(seacas-root)/applications/slice/SL_SystemInterface.C + $(seacas-root)/applications/slice/SL_Decompose.C suplib_cpp suplib_c ioinit diff --git a/packages/seacas/applications/conjoin/CJ_Internals.C b/packages/seacas/applications/conjoin/CJ_Internals.C index cefcd9b141..47355c2c26 100644 --- a/packages/seacas/applications/conjoin/CJ_Internals.C +++ b/packages/seacas/applications/conjoin/CJ_Internals.C @@ -190,19 +190,9 @@ int Excn::Internals::write_meta_data(const Mesh &mesh, const std::vector max_entity) { - max_entity = mesh.nodesetCount; - } - if (mesh.sidesetCount > max_entity) { - max_entity = mesh.sidesetCount; - } - if (mesh.blockCount > 0) { - for (size_t i = 0; i < mesh.blockCount; i++) { - if (blocks[i].attributeCount > max_entity) { - max_entity = blocks[i].attributeCount; - } - } + size_t max_entity = std::max({mesh.blockCount, mesh.nodesetCount, mesh.sidesetCount}); + for (size_t i = 0; i < mesh.blockCount; i++) { + max_entity = std::max(max_entity, blocks[i].attributeCount); } size_t name_size = ex_inquire_int(exodusFilePtr, EX_INQ_MAX_READ_NAME_LENGTH); diff --git a/packages/seacas/applications/conjoin/Conjoin.C b/packages/seacas/applications/conjoin/Conjoin.C index 3858f733aa..b350e4f576 100644 --- a/packages/seacas/applications/conjoin/Conjoin.C +++ b/packages/seacas/applications/conjoin/Conjoin.C @@ -415,8 +415,7 @@ int conjoin(Excn::SystemInterface &interFace, T /* dummy */, INT /* dummy int */ const T alive = interFace.alive_value(); size_t part_count = interFace.inputFiles_.size(); - auto *mytitle = new char[MAX_LINE_LENGTH + 1]; - memset(mytitle, '\0', MAX_LINE_LENGTH + 1); + std::array mytitle{}; Excn::Mesh global; @@ -446,7 +445,7 @@ int conjoin(Excn::SystemInterface &interFace, T /* dummy */, INT /* dummy int */ local_mesh[p].sidesetCount = info.num_side_sets; if (p == 0) { - global.title = mytitle; + global.title = mytitle.data(); global.dimensionality = local_mesh[p].count(Excn::ObjectType::DIM); global.blockCount = local_mesh[p].count(Excn::ObjectType::EBLK); } @@ -464,8 +463,6 @@ int conjoin(Excn::SystemInterface &interFace, T /* dummy */, INT /* dummy int */ } // end for (p=0..part_count) - delete[] mytitle; - if (interFace.omit_nodesets()) { global.nodesetCount = 0; } @@ -1016,18 +1013,16 @@ namespace { error += ex_get_qa(id, qaRecord[0].qa_record); } - char buffer[MAX_STR_LENGTH + 1]; - copy_string(qaRecord[num_qa_records].qa_record[0][0], qainfo[0], MAX_STR_LENGTH + 1); // Code copy_string(qaRecord[num_qa_records].qa_record[0][1], qainfo[2], MAX_STR_LENGTH + 1); // Version - time_t date_time = time(nullptr); - strftime(buffer, MAX_STR_LENGTH, "%Y/%m/%d", localtime(&date_time)); + std::time_t date_time = std::time(nullptr); - copy_string(qaRecord[num_qa_records].qa_record[0][2], buffer, MAX_STR_LENGTH + 1); + auto date = fmt::format("{:%Y/%m/%d}", fmt::localtime(date_time)); + copy_string(qaRecord[num_qa_records].qa_record[0][2], date.c_str(), MAX_STR_LENGTH + 1); - strftime(buffer, MAX_STR_LENGTH, "%H:%M:%S", localtime(&date_time)); - copy_string(qaRecord[num_qa_records].qa_record[0][3], buffer, MAX_STR_LENGTH + 1); + auto time = fmt::format("{:%T}", fmt::localtime(date_time)); + copy_string(qaRecord[num_qa_records].qa_record[0][3], time.c_str(), MAX_STR_LENGTH + 1); error += ex_put_qa(id_out, num_qa_records + 1, qaRecord[0].qa_record); diff --git a/packages/seacas/applications/ejoin/EJoin.C b/packages/seacas/applications/ejoin/EJoin.C index 7d1e18f97a..cc2328e7c7 100644 --- a/packages/seacas/applications/ejoin/EJoin.C +++ b/packages/seacas/applications/ejoin/EJoin.C @@ -790,7 +790,7 @@ namespace { for (const auto &field_name : fields) { if (valid_variable(field_name, 0, variable_list)) { Ioss::Field field = nb->get_field(field_name); - ons->field_add(field); + ons->field_add(std::move(field)); } } } @@ -1335,7 +1335,7 @@ namespace { for (const auto &field_name : fields) { if (valid_variable(field_name, 0, variable_list)) { Ioss::Field field = pm->get_field(field_name); - output_region.field_add(field); + output_region.field_add(std::move(field)); } } } @@ -1360,7 +1360,7 @@ namespace { if (valid_variable(field_name, 0, variable_list)) { Ioss::Field field = nb->get_field(field_name); field.reset_count(node_count); - onb->field_add(field); + onb->field_add(std::move(field)); } } } @@ -1390,7 +1390,7 @@ namespace { for (const auto &field_name : fields) { if (valid_variable(field_name, id, variable_list)) { Ioss::Field field = ieb->get_field(field_name); - oeb->field_add(field); + oeb->field_add(std::move(field)); } } } @@ -1424,7 +1424,7 @@ namespace { for (const auto &field_name : fields) { if (valid_variable(field_name, id, variable_list)) { Ioss::Field field = in->get_field(field_name); - ons->field_add(field); + ons->field_add(std::move(field)); } } } @@ -1464,7 +1464,7 @@ namespace { for (const auto &field_name : fields) { if (valid_variable(field_name, id, variable_list)) { Ioss::Field field = eb->get_field(field_name); - (*II)->field_add(field); + (*II)->field_add(std::move(field)); } } ++II; @@ -1488,7 +1488,7 @@ namespace { Ioss::Utils::substr_equal(prefix, field_name)) { // If the field does not already exist, add it to the output node block Ioss::Field field = ige->get_field(field_name); - oge->field_add(field); + oge->field_add(std::move(field)); } } } diff --git a/packages/seacas/applications/epu/EP_Internals.C b/packages/seacas/applications/epu/EP_Internals.C index 9a7a5c4d1d..848152ba16 100644 --- a/packages/seacas/applications/epu/EP_Internals.C +++ b/packages/seacas/applications/epu/EP_Internals.C @@ -21,11 +21,6 @@ #include // for string, basic_string #include // for vector -#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || \ - defined(__MINGW32__) || defined(_WIN64) || defined(__MINGW64__) -#include -#endif - extern "C" { #define NO_NETCDF_2 #include @@ -265,25 +260,10 @@ int Excn::Internals::write_meta_data(const Mesh &mesh, const std::vector max_entity) { - max_entity = mesh.nodesetCount; - } - if (mesh.sidesetCount > max_entity) { - max_entity = mesh.sidesetCount; - } - if (mesh.edgeBlockCount > max_entity) { - max_entity = mesh.edgeBlockCount; - } - if (mesh.faceBlockCount > max_entity) { - max_entity = mesh.faceBlockCount; - } - if (mesh.blockCount > 0) { - for (int i = 0; i < mesh.blockCount; i++) { - if (blocks[i].attributeCount > max_entity) { - max_entity = blocks[i].attributeCount; - } - } + int max_entity = std::max({mesh.blockCount, mesh.nodesetCount, mesh.sidesetCount, + mesh.edgeBlockCount, mesh.faceBlockCount}); + for (const auto &block : blocks) { + max_entity = std::max(max_entity, block.attributeCount); } size_t name_size = ex_inquire_int(exodusFilePtr, EX_INQ_MAX_READ_NAME_LENGTH); diff --git a/packages/seacas/applications/epu/epu.C b/packages/seacas/applications/epu/epu.C index 0cb8c9999f..23bfb8245d 100644 --- a/packages/seacas/applications/epu/epu.C +++ b/packages/seacas/applications/epu/epu.C @@ -1775,12 +1775,21 @@ namespace { copy_string(qaRecord[num_qa_records].qa_record[0][0], qainfo[0], MAX_STR_LENGTH + 1); // Code copy_string(qaRecord[num_qa_records].qa_record[0][1], qainfo[2], MAX_STR_LENGTH + 1); // Version - time_t date_time = std::time(nullptr); - auto *lt = std::localtime(&date_time); - buffer = fmt::format("{:%Y/%m/%d}", *lt); + time_t date_time = std::time(nullptr); +#if defined __NVCC__ + auto *lt = std::localtime(&date_time); + buffer = fmt::format("{:%Y/%m/%d}", *lt); +#else + auto const lt = fmt::localtime(date_time); + buffer = fmt::format("{:%Y/%m/%d}", lt); +#endif copy_string(qaRecord[num_qa_records].qa_record[0][2], buffer, MAX_STR_LENGTH + 1); +#if defined __NVCC__ buffer = fmt::format("{:%H:%M:%S}", *lt); +#else + buffer = fmt::format("{:%H:%M:%S}", lt); +#endif copy_string(qaRecord[num_qa_records].qa_record[0][3], buffer, MAX_STR_LENGTH + 1); error = ex_put_qa(id_out, num_qa_records + 1, qaRecord[0].qa_record); diff --git a/packages/seacas/applications/exodiff/exodiff.C b/packages/seacas/applications/exodiff/exodiff.C index 3b4b1bb4e8..6398c0d50f 100644 --- a/packages/seacas/applications/exodiff/exodiff.C +++ b/packages/seacas/applications/exodiff/exodiff.C @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -55,11 +56,16 @@ struct TimeInterp std::string Date() { - char tbuf[32]; time_t calendar_time = time(nullptr); +#if defined __NVCC__ + char tbuf[32]; struct tm *local_time = localtime(&calendar_time); strftime(tbuf, 32, "%Y/%m/%d %H:%M:%S %Z", local_time); std::string time_string(tbuf); +#else + auto const local_time = fmt::localtime(calendar_time); + auto time_string = fmt::format("{:%Y/%m/%d %H:%M:%S %Z}", local_time); +#endif return time_string; } diff --git a/packages/seacas/applications/slice/SL_Decompose.C b/packages/seacas/applications/slice/SL_Decompose.C index 5bddf0a749..786c592e72 100644 --- a/packages/seacas/applications/slice/SL_Decompose.C +++ b/packages/seacas/applications/slice/SL_Decompose.C @@ -21,7 +21,9 @@ #include #include +#if !defined __NVCC__ #include +#endif #include #include #include @@ -923,11 +925,19 @@ void output_decomposition_statistics(const std::vector &elem_to_proc, int p std::string stars(star_cnt, '*'); std::string format = "\tProcessor {:{}}, work = {:{}} ({:.2f})\t{}\n"; if (elem_per_rank[i] == max_work) { - fmt::print(fg(fmt::color::red), format, i, proc_width, fmt::group_digits(elem_per_rank[i]), + fmt::print( +#if !defined __NVCC__ + fg(fmt::color::red), +#endif + format, i, proc_width, fmt::group_digits(elem_per_rank[i]), work_width, (double)elem_per_rank[i] / avg_work, stars); } else if (elem_per_rank[i] == min_work) { - fmt::print(fg(fmt::color::green), format, i, proc_width, + fmt::print( +#if !defined __NVCC__ + fg(fmt::color::green), +#endif + format, i, proc_width, fmt::group_digits(elem_per_rank[i]), work_width, elem_per_rank[i] / avg_work, stars); } diff --git a/packages/seacas/applications/slice/Slice.C b/packages/seacas/applications/slice/Slice.C index 29274e3c5b..fcec96880d 100644 --- a/packages/seacas/applications/slice/Slice.C +++ b/packages/seacas/applications/slice/Slice.C @@ -159,7 +159,7 @@ namespace { for (const auto &block : blocks) { auto field = Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::MAP).set_index(1); - block->field_add(field); + block->field_add(std::move(field)); } } @@ -188,11 +188,11 @@ namespace { auto field = Ioss::Field(decomp_variable_name, Ioss::Field::INT32, IOSS_SCALAR(), Ioss::Field::MAP) .set_index(1); - block->field_add(field); + block->field_add(std::move(field)); if (add_chain_info) { auto ch_field = Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::MAP).set_index(2); - block->field_add(ch_field); + block->field_add(std::move(ch_field)); } } } @@ -243,10 +243,10 @@ namespace { const auto &blocks = region.get_element_blocks(); for (const auto &block : blocks) { block->field_add(Ioss::Field(decomp_variable_name, region.field_int_type(), IOSS_SCALAR(), - Ioss::Field::TRANSIENT)); + Ioss::Field::TRANSIENT)); if (add_chain_info) { block->field_add( - Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::TRANSIENT)); + Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::TRANSIENT)); } } region.end_mode(Ioss::STATE_DEFINE_TRANSIENT); diff --git a/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc b/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc index 255159ff80..a20117a8e5 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc @@ -34,8 +34,8 @@ #endif namespace { - const std::string version_short{"6.22"}; - const std::string version_date{"(2023/09/28)"}; + const std::string version_short{"6.25"}; + const std::string version_date{"(2023/10/12)"}; const std::string version_string = version_short + " " + version_date; void output_copyright(); @@ -391,6 +391,22 @@ namespace SEAMS { return pointer; } + Aprepro::SYMBOL_TYPE Aprepro::get_symbol_type(const SEAMS::symrec *symbol) const + { + switch (symbol->type) { + case Parser::token::VAR: return SYMBOL_TYPE::VARIABLE; + case Parser::token::SVAR: return SYMBOL_TYPE::STRING_VARIABLE; + case Parser::token::AVAR: return SYMBOL_TYPE::ARRAY_VARIABLE; + case Parser::token::IMMVAR: return SYMBOL_TYPE::IMMUTABLE_VARIABLE; + case Parser::token::IMMSVAR: return SYMBOL_TYPE::IMMUTABLE_STRING_VARIABLE; + case Parser::token::UNDVAR: return SYMBOL_TYPE::UNDEFINED_VARIABLE; + case Parser::token::FNCT: return SYMBOL_TYPE::FUNCTION; + case Parser::token::SFNCT: return SYMBOL_TYPE::STRING_FUNCTION; + case Parser::token::AFNCT: return SYMBOL_TYPE::ARRAY_FUNCTION; + default: return SYMBOL_TYPE::INTERNAL; + } + } + symrec *Aprepro::putsym(const std::string &sym_name, SYMBOL_TYPE sym_type, bool is_internal) { int parser_type = 0; @@ -414,6 +430,7 @@ namespace SEAMS { parser_type = Parser::token::AFNCT; is_function = true; break; + case SYMBOL_TYPE::INTERNAL: parser_type = Parser::token::UNDVAR; break; } // If the type is a function type, it can be overloaded as long as diff --git a/packages/seacas/libraries/aprepro_lib/apr_scanner.cc b/packages/seacas/libraries/aprepro_lib/apr_scanner.cc index 8a644a03af..17c31a764d 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_scanner.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_scanner.cc @@ -1002,7 +1002,8 @@ namespace { bool string_is_ascii(const char *line, size_t len) { for (size_t i = 0; i < len; i++) { - if (!(std::isspace(line[i]) || std::isprint(line[i]))) { + if (!(std::isspace(static_cast(line[i])) || + std::isprint(static_cast(line[i])))) { return false; } } @@ -1396,51 +1397,60 @@ YY_DECL } } - temp_f = get_temp_filename(); - SEAMS::file_rec new_file(temp_f, 0, true, loop_iterations); - outer_file = &aprepro.ap_file_list.top(); - new_file.loop_level = outer_file->loop_level + 1; - - // Get optional loop index... - std::string sym_name; - if (tokens.size() == 1) { - // Default loop index variable name if not specified in loop command. - sym_name = fmt::format("__loop_{}", new_file.loop_level); + if (loop_iterations <= 0) { + BEGIN(LOOP_SKIP); + if (aprepro.ap_options.debugging) { + fmt::print(stderr, "DEBUG LOOP: iteration count = {}, Skipping loop...\n", + loop_iterations); + } } else { - sym_name = tokens[1]; - } - SEAMS::symrec *li = aprepro.getsym(sym_name); - if (li == nullptr) { - li = aprepro.putsym(sym_name, SEAMS::Aprepro::SYMBOL_TYPE::VARIABLE, true); - } - - // Get optional loop index initial value. Default to 0 if not specified. - double init = 0.0; - if (tokens.size() >= 3) { - init = std::stod(tokens[2]); - } - li->value.var = init; + temp_f = get_temp_filename(); + SEAMS::file_rec new_file(temp_f, 0, true, loop_iterations); + outer_file = &aprepro.ap_file_list.top(); + new_file.loop_level = outer_file->loop_level + 1; + + // Get optional loop index... + std::string sym_name; + if (tokens.size() == 1) { + // Default loop index variable name if not specified in loop command. + sym_name = fmt::format("__loop_{}", new_file.loop_level); + } + else { + sym_name = tokens[1]; + } + SEAMS::symrec *li = aprepro.getsym(sym_name); + if (li == nullptr) { + li = aprepro.putsym(sym_name, SEAMS::Aprepro::SYMBOL_TYPE::VARIABLE, true); + } - // Get optional loop index increment value. Default to 1 if not specified. - if (tokens.size() >= 4) { - double increment = std::stod(tokens[3]); - new_file.loop_increment = increment; - } + // Get optional loop index initial value. Default to 0 if not specified. + double init = 0.0; + if (tokens.size() >= 3) { + init = std::stod(tokens[2]); + } + li->value.var = init; - new_file.loop_index = li; - aprepro.ap_file_list.push(new_file); + // Get optional loop index increment value. Default to 1 if not specified. + if (tokens.size() >= 4) { + double increment = std::stod(tokens[3]); + new_file.loop_increment = increment; + } - tmp_file = new std::fstream(temp_f, std::ios::out); - loop_lvl++; - BEGIN(LOOP); - aprepro.isCollectingLoop = true; - if (aprepro.ap_options.debugging) { - fmt::print( - stderr, - "DEBUG LOOP: iteration count = {}, loop_index variable = {}, initial value = " - "{}, increment = {}\n", - loop_iterations, sym_name, init, new_file.loop_increment); + new_file.loop_index = li; + aprepro.ap_file_list.push(new_file); + + tmp_file = new std::fstream(temp_f, std::ios::out); + loop_lvl++; + BEGIN(LOOP); + aprepro.isCollectingLoop = true; + if (aprepro.ap_options.debugging) { + fmt::print( + stderr, + "DEBUG LOOP: iteration count = {}, loop_index variable = {}, initial value = " + "{}, increment = {}\n", + loop_iterations, sym_name, init, new_file.loop_increment); + } } } YY_BREAK @@ -1643,6 +1653,7 @@ YY_DECL unput('i'); unput('_'); unput('{'); + curr_index = 0; } YY_BREAK case 28: @@ -1659,6 +1670,7 @@ YY_DECL unput('i'); unput('_'); unput('{'); + curr_index = 0; } YY_BREAK @@ -1890,9 +1902,9 @@ YY_DECL pt = yytext; } - add_include_file(pt, file_must_exist); + bool added = add_include_file(pt, file_must_exist); - if (!aprepro.doIncludeSubstitution) + if (added && !aprepro.doIncludeSubstitution) yy_push_state(VERBATIM); aprepro.ap_file_list.top().lineno++; @@ -3288,8 +3300,8 @@ namespace SEAMS { } if (!string_is_ascii(line, strlen(line))) { - yyerror("input line contains non-ASCII (probably UTF-8) characters which will most likely " - "be parsed incorrectly."); + aprepro.warning("input line contains non-ASCII (probably UTF-8) characters which might be " + "parsed incorrectly."); } SEAMS::gl_histadd(line); @@ -3312,9 +3324,8 @@ namespace SEAMS { } else { if (!string_is_ascii(buf, yyin->gcount())) { - yyerror( - "input file contains non-ASCII (probably UTF-8) characters which will most likely " - "be parsed incorrectly."); + aprepro.warning("input file contains non-ASCII (probably UTF-8) characters which might " + "be parsed incorrectly."); } return yyin->gcount(); } @@ -3643,6 +3654,11 @@ namespace SEAMS { if (len <= 0) return; + // Clear any possible end-of-stream if e.g., reading from a istringstream. + std::ios::iostate state = yyin->rdstate(); + size_t loc = yyin->tellg(); + yyin->clear(); + // Go back in the stream to where we started keeping history. yyin->seekg(hist_start); if (!yyin->good()) { @@ -3662,6 +3678,10 @@ namespace SEAMS { history_string = tmp; delete[] tmp; hist_start = 0; + + // restore stream state + yyin->seekg(loc); + yyin->setstate(state); } } // namespace SEAMS diff --git a/packages/seacas/libraries/aprepro_lib/apr_scanner.h b/packages/seacas/libraries/aprepro_lib/apr_scanner.h index fe708bd6d8..721f77a87a 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_scanner.h +++ b/packages/seacas/libraries/aprepro_lib/apr_scanner.h @@ -1,20 +1,18 @@ /* - * Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * * See packages/seacas/LICENSE for details */ -#ifndef EXAMPLE_SCANNER_H -#define EXAMPLE_SCANNER_H +#ifndef APR_SCANNER_H +#define APR_SCANNER_H // Flex expects the signature of yylex to be defined in the macro YY_DECL, and // the C++ parser expects it to be declared. We can factor both as follows. -#ifndef YY_DECL - +#undef YY_DECL #define YY_DECL SEAMS::Parser::token_type SEAMS::Scanner::lex(SEAMS::Parser::semantic_type *yylval) -#endif #ifndef __FLEX_LEXER_H #define yyFlexLexer SEAMSFlexLexer @@ -31,6 +29,7 @@ namespace SEAMS { * macros to SEAMSFlexLexer. However we change the context of the generated * yylex() function to be contained within the Scanner class. This is required * because the yylex() defined in SEAMSFlexLexer has no parameters. */ + class Aprepro; class Scanner : public SEAMSFlexLexer { public: @@ -75,4 +74,4 @@ namespace SEAMS { } // namespace SEAMS -#endif // EXAMPLE_SCANNER_H +#endif // APR_SCANNER_H diff --git a/packages/seacas/libraries/aprepro_lib/apr_test.cc b/packages/seacas/libraries/aprepro_lib/apr_test.cc index bbf801cf9d..c5e85ff67c 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_test.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_test.cc @@ -109,15 +109,19 @@ int main(int argc, char *argv[]) if (result) { std::string res_str = aprepro.parsing_results().str(); - std::cout << " : " << res_str; + std::cout << " : " << res_str; // Example showing how to get the substitution history for the current line. if (aprepro.ap_options.keep_history) { std::vector hist = aprepro.get_history(); for (const auto &curr_history : hist) { - std::cout << curr_history.original << " was substituted with " - << curr_history.substitution << " at index " << curr_history.index << '\n'; + auto substitution = curr_history.substitution; + if (substitution == "\n") { + substitution = ""; + } + std::cout << "\t'" << curr_history.original << "' was substituted with '" << substitution + << "' at index " << curr_history.index << '\n'; } aprepro.clear_history(); diff --git a/packages/seacas/libraries/aprepro_lib/aprepro.h b/packages/seacas/libraries/aprepro_lib/aprepro.h index feea00f7ae..ba57ff91fd 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro.h +++ b/packages/seacas/libraries/aprepro_lib/aprepro.h @@ -96,6 +96,7 @@ namespace SEAMS { Aprepro &operator=(const Aprepro &) = delete; enum class SYMBOL_TYPE { + INTERNAL = 0, VARIABLE = 1, STRING_VARIABLE = 2, UNDEFINED_VARIABLE = 5, @@ -171,6 +172,7 @@ namespace SEAMS { std::stack outputStream{}; + SYMBOL_TYPE get_symbol_type(const SEAMS::symrec *symbol) const; SEAMS::symrec *getsym(const char *sym_name) const; SEAMS::symrec *getsym(const std::string &sym_name) const; SEAMS::symrec *putsym(const std::string &sym_name, SYMBOL_TYPE sym_type, bool is_internal); diff --git a/packages/seacas/libraries/aprepro_lib/aprepro.ll b/packages/seacas/libraries/aprepro_lib/aprepro.ll index 31c8aabda3..a8fa0482c2 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro.ll +++ b/packages/seacas/libraries/aprepro_lib/aprepro.ll @@ -51,7 +51,7 @@ namespace { bool string_is_ascii(const char *line, size_t len) { for (size_t i = 0; i < len; i++) { - if (!(std::isspace(line[i]) || std::isprint(line[i]))) { + if (!(std::isspace(static_cast(line[i])) || std::isprint(static_cast(line[i])))) { return false; } } @@ -177,48 +177,58 @@ integer {D}+({E})? } } - temp_f = get_temp_filename(); - SEAMS::file_rec new_file(temp_f, 0, true, loop_iterations); - outer_file = &aprepro.ap_file_list.top(); - new_file.loop_level = outer_file->loop_level + 1; - - // Get optional loop index... - std::string sym_name; - if (tokens.size() == 1) { - // Default loop index variable name if not specified in loop command. - sym_name = fmt::format("__loop_{}", new_file.loop_level); + if (loop_iterations <= 0) { + BEGIN(LOOP_SKIP); + if (aprepro.ap_options.debugging) { + fmt::print( + stderr, + "DEBUG LOOP: iteration count = {}, Skipping loop...\n", loop_iterations); + } } else { - sym_name = tokens[1]; - } - SEAMS::symrec *li = aprepro.getsym(sym_name); - if (li == nullptr) { - li = aprepro.putsym(sym_name, SEAMS::Aprepro::SYMBOL_TYPE::VARIABLE, true); - } + temp_f = get_temp_filename(); + SEAMS::file_rec new_file(temp_f, 0, true, loop_iterations); + outer_file = &aprepro.ap_file_list.top(); + new_file.loop_level = outer_file->loop_level + 1; + + // Get optional loop index... + std::string sym_name; + if (tokens.size() == 1) { + // Default loop index variable name if not specified in loop command. + sym_name = fmt::format("__loop_{}", new_file.loop_level); + } + else { + sym_name = tokens[1]; + } + SEAMS::symrec *li = aprepro.getsym(sym_name); + if (li == nullptr) { + li = aprepro.putsym(sym_name, SEAMS::Aprepro::SYMBOL_TYPE::VARIABLE, true); + } - // Get optional loop index initial value. Default to 0 if not specified. - double init = 0.0; - if (tokens.size() >= 3) { - init = std::stod(tokens[2]); - } - li->value.var = init; + // Get optional loop index initial value. Default to 0 if not specified. + double init = 0.0; + if (tokens.size() >= 3) { + init = std::stod(tokens[2]); + } + li->value.var = init; - // Get optional loop index increment value. Default to 1 if not specified. - if (tokens.size() >= 4) { - double increment = std::stod(tokens[3]); - new_file.loop_increment = increment; - } + // Get optional loop index increment value. Default to 1 if not specified. + if (tokens.size() >= 4) { + double increment = std::stod(tokens[3]); + new_file.loop_increment = increment; + } - new_file.loop_index = li; - aprepro.ap_file_list.push(new_file); + new_file.loop_index = li; + aprepro.ap_file_list.push(new_file); - tmp_file = new std::fstream(temp_f, std::ios::out); - loop_lvl++; - BEGIN(LOOP); - aprepro.isCollectingLoop = true; - if (aprepro.ap_options.debugging) { - fmt::print(stderr, "DEBUG LOOP: iteration count = {}, loop_index variable = {}, initial value = {}, increment = {}\n", - loop_iterations, sym_name, init, new_file.loop_increment); + tmp_file = new std::fstream(temp_f, std::ios::out); + loop_lvl++; + BEGIN(LOOP); + aprepro.isCollectingLoop = true; + if (aprepro.ap_options.debugging) { + fmt::print(stderr, "DEBUG LOOP: iteration count = {}, loop_index variable = {}, initial value = {}, increment = {}\n", + loop_iterations, sym_name, init, new_file.loop_increment); + } } } } @@ -385,6 +395,7 @@ integer {D}+({E})? unput('i'); unput('_'); unput('{'); + curr_index = 0; } {WS}"{"[Ii]"fndef"{WS}"(" { @@ -399,6 +410,7 @@ integer {D}+({E})? unput('i'); unput('_'); unput('{'); + curr_index = 0; } } @@ -586,9 +598,9 @@ integer {D}+({E})? pt = yytext; } - add_include_file(pt, file_must_exist); + bool added = add_include_file(pt, file_must_exist); - if(!aprepro.doIncludeSubstitution) + if(added && !aprepro.doIncludeSubstitution) yy_push_state(VERBATIM); aprepro.ap_file_list.top().lineno++; @@ -839,8 +851,7 @@ integer {D}+({E})? } if (!string_is_ascii(line, strlen(line))) { - yyerror("input line contains non-ASCII (probably UTF-8) characters which will most likely " - "be parsed incorrectly."); + aprepro.warning("input line contains non-ASCII (probably UTF-8) characters which might be parsed incorrectly."); } SEAMS::gl_histadd(line); @@ -863,8 +874,7 @@ integer {D}+({E})? } else { if (!string_is_ascii(buf, yyin->gcount())) { - yyerror("input file contains non-ASCII (probably UTF-8) characters which will most likely " - "be parsed incorrectly."); + aprepro.warning("input file contains non-ASCII (probably UTF-8) characters which will might be parsed incorrectly."); } return yyin->gcount(); } @@ -1191,6 +1201,11 @@ integer {D}+({E})? if (len <= 0) return; + // Clear any possible end-of-stream if e.g., reading from a istringstream. + std::ios::iostate state = yyin->rdstate(); + size_t loc = yyin->tellg(); + yyin->clear(); + // Go back in the stream to where we started keeping history. yyin->seekg(hist_start); if (!yyin->good()) { @@ -1210,6 +1225,10 @@ integer {D}+({E})? history_string = tmp; delete[] tmp; hist_start = 0; + + // restore stream state + yyin->seekg(loc); + yyin->setstate(state); } } diff --git a/packages/seacas/libraries/aprepro_lib/test.inp_app b/packages/seacas/libraries/aprepro_lib/test.inp_app index e89ca173fb..ec54c83b1f 100644 --- a/packages/seacas/libraries/aprepro_lib/test.inp_app +++ b/packages/seacas/libraries/aprepro_lib/test.inp_app @@ -251,4 +251,10 @@ $ Test string tokenization optimization Word {_i} of list1 and list2 are {get_word(_i,list1,',')} and {get_word(_i,list2,',')} {endloop} +{loop(0)} +This should not be echoed +{endloop} +{loop(undefined)} +This should not be echoed +{endloop} $End of test file 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; } } diff --git a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C index d87c3a233e..b5875cb7aa 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C +++ b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C @@ -1099,7 +1099,7 @@ namespace { if (field_name != "ids" && !oge->field_exists(field_name) && Ioss::Utils::substr_equal(prefix, field_name)) { // If the field does not already exist, add it to the output node block - oge->field_add(field); + oge->field_add(std::move(field)); } } } diff --git a/packages/seacas/libraries/ioss/src/Ioss_Field.h b/packages/seacas/libraries/ioss/src/Ioss_Field.h index 86238fdea3..6b64a68323 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Field.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Field.h @@ -96,6 +96,8 @@ namespace Ioss { Field(const Ioss::Field &from) = default; Field &operator=(const Field &from) = default; + Field(Ioss::Field &&from) = default; + Field &operator=(Field &&from) = default; ~Field() = default; // Compare two fields (used for STL container) diff --git a/packages/seacas/libraries/ioss/src/Ioss_FileInfo.C b/packages/seacas/libraries/ioss/src/Ioss_FileInfo.C index 50e012cf52..46272e1378 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_FileInfo.C +++ b/packages/seacas/libraries/ioss/src/Ioss_FileInfo.C @@ -27,9 +27,12 @@ #endif #else #include -#if defined(__APPLE__) && defined(__MACH__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) #include #include +#elif defined(__OpenBSD__) +#include +#include #else #include #endif @@ -170,18 +173,13 @@ namespace Ioss { bool FileInfo::is_nfs() const { #if !defined(__IOSS_WINDOWS__) -#define NFS_FS 0x6969 /* statfs defines that 0x6969 is NFS filesystem */ auto tmp_path = pathname(); if (tmp_path.empty()) { char *current_cwd = getcwd(nullptr, 0); tmp_path = std::string(current_cwd); free(current_cwd); } -#if defined(__IOSS_WINDOWS__) - char *path = _fullpath(nullptr, tmp_path.c_str(), _MAX_PATH); -#else char *path = ::realpath(tmp_path.c_str(), nullptr); -#endif if (path != nullptr) { struct statfs stat_fs; @@ -193,7 +191,13 @@ namespace Ioss { IOSS_ERROR(errmsg); } free(path); - return (stat_fs.f_type == NFS_FS); + +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) + return (0 == ::strcmp("nfs", stat_fs.f_fstypename)); +#else + /* linux statfs defines that 0x6969 is NFS filesystem */ + return (stat_fs.f_type == 0x6969); +#endif } #endif return false; diff --git a/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h b/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h index e85af86977..3a94f12fbc 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h +++ b/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h @@ -28,8 +28,6 @@ namespace Ioss { - class EntityBlock; - /** \brief Base class for all 'grouping' entities. * The following derived classes are typical: * diff --git a/packages/seacas/libraries/ioss/src/Ioss_Property.h b/packages/seacas/libraries/ioss/src/Ioss_Property.h index 2a76a0a99b..6a378e7090 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Property.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Property.h @@ -47,8 +47,10 @@ namespace Ioss { // To set implicit property Property(const GroupingEntity *ge, std::string name, BasicType type); - Property(const Property &from) = default; - Property &operator=(Property &rhs); + Property(const Property &from) = default; + Property &operator=(const Property &rhs) = default; + Property(Property &&from) = default; + Property &operator=(Property &&rhs) = default; ~Property() = default; diff --git a/packages/seacas/libraries/ioss/src/Ioss_Region.h b/packages/seacas/libraries/ioss/src/Ioss_Region.h index 5d94933e8e..7b63763ad1 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Region.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Region.h @@ -18,7 +18,9 @@ #include // for State #include // for size_t, nullptr #include // for int64_t +#if !defined BUILT_IN_SIERRA #include +#endif #include // for less #include // for ostream #include // for map, map<>::value_compare @@ -427,11 +429,17 @@ namespace Ioss { if (found && field.get_role() != role) { std::ostringstream errmsg; +#if defined BUILT_IN_SIERRA + errmsg << "ERROR: Field " << field.get_name() << " with role " << field.role_string() + << " on entity " << entity->name() << " does not match previously found role " + << Ioss::Field::role_string(role) << ".\n", +#else fmt::print(errmsg, "ERROR: Field {} with role {} on entity {} does not match previously found " "role {}.\n", field.get_name(), field.role_string(), entity->name(), Ioss::Field::role_string(role)); +#endif IOSS_ERROR(errmsg); } diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C b/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C index 4e8c272ab6..ef8d7a45b3 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C @@ -96,7 +96,7 @@ namespace { char donorname[CGNS_MAX_NAME_LENGTH + 1]; std::array range; std::array donor_range; - Ioss::IJK_t transform; + Ioss::IJK_t transform{}; cg_1to1_read(cgns_file_ptr, base, zone, zgc_idx, connectname, donorname, range.data(), donor_range.data(), transform.data()); @@ -203,9 +203,9 @@ namespace { for (int ii = 0; ii < nconn; ii++) { char connectname[CGNS_MAX_NAME_LENGTH + 1]; char donorname[CGNS_MAX_NAME_LENGTH + 1]; - std::array range; - std::array donor_range; - Ioss::IJK_t transform; + std::array range{}; + std::array donor_range{}; + Ioss::IJK_t transform{}; CGCHECK(cg_1to1_read(cgns_file_ptr, base, db_zone, ii + 1, connectname, donorname, range.data(), donor_range.data(), transform.data())); @@ -386,7 +386,7 @@ namespace { char donorname[CGNS_MAX_NAME_LENGTH + 1]; std::array range; std::array donor_range; - Ioss::IJK_t transform; + Ioss::IJK_t transform{}; CGCHECK(cg_1to1_read(cgns_file_ptr, base, zone, i + 1, connectname, donorname, range.data(), donor_range.data(), transform.data())); @@ -1188,7 +1188,7 @@ namespace Iocgns { char donorname[CGNS_MAX_NAME_LENGTH + 1]; std::array range; std::array donor_range; - Ioss::IJK_t transform; + Ioss::IJK_t transform{}; CGCHECKM(cg_1to1_read(get_file_pointer(), base, zone, i + 1, connectname, donorname, range.data(), donor_range.data(), transform.data())); diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h index fa3affb691..950b16e298 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C index 972e5b4c19..784d2382b7 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C @@ -543,7 +543,7 @@ namespace Ioex { auto field = Ioss::Field(name, block->field_int_type(), IOSS_SCALAR(), Ioss::Field::MAP, my_element_count) .set_index(i + 1); - block->field_add(field); + block->field_add(std::move(field)); continue; } @@ -569,7 +569,7 @@ namespace Ioex { auto field = Ioss::Field(base, block->field_int_type(), storage, Ioss::Field::MAP, my_element_count) .set_index(i + 1); - block->field_add(field); + block->field_add(std::move(field)); i = ii - 1; } diff --git a/packages/seacas/libraries/ioss/src/main/cth_pressure_map.C b/packages/seacas/libraries/ioss/src/main/cth_pressure_map.C index 29404dc8b3..edf5f8656d 100644 --- a/packages/seacas/libraries/ioss/src/main/cth_pressure_map.C +++ b/packages/seacas/libraries/ioss/src/main/cth_pressure_map.C @@ -772,7 +772,7 @@ namespace { Ioss::Utils::substr_equal(prefix, field_name)) { // If the field does not already exist, add it to the output node block Ioss::Field field = ige->get_field(field_name); - oge->field_add(field); + oge->field_add(std::move(field)); } } } @@ -1217,7 +1217,7 @@ namespace { int num_nodes = nb->entity_count(); Ioss::Field node_normal("node_normal", Ioss::Field::REAL, v3d, Ioss::Field::TRANSIENT, num_nodes); - nb->field_add(node_normal); + nb->field_add(std::move(node_normal)); // Iterate over the element blocks and calculate both node normals and face normals... const auto &ebs = output_region.get_element_blocks(); @@ -1225,7 +1225,7 @@ namespace { int num_elem = eb->entity_count(); Ioss::Field face_normal("face_normal", Ioss::Field::REAL, v3d, Ioss::Field::TRANSIENT, num_elem); - eb->field_add(face_normal); + eb->field_add(std::move(face_normal)); } output_region.end_mode(Ioss::STATE_DEFINE_TRANSIENT); } diff --git a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h index 9c56768205..df7958985d 100644 --- a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h +++ b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h @@ -36,8 +36,6 @@ #include #include -#include - #include #include #include diff --git a/packages/seacas/libraries/ioss/src/utest/Utst_blob_write_read.C b/packages/seacas/libraries/ioss/src/utest/Utst_blob_write_read.C index ff3dc27d70..fb03e9c17c 100644 --- a/packages/seacas/libraries/ioss/src/utest/Utst_blob_write_read.C +++ b/packages/seacas/libraries/ioss/src/utest/Utst_blob_write_read.C @@ -142,7 +142,7 @@ void write_blob() blob1->field_add(x); blob1->field_add(dx); - blob1->field_add(ddx); + blob1->field_add(std::move(ddx)); // Blobs can have different fields blob2->field_add(x);