Skip to content

Commit

Permalink
Merge Pull Request #10813 from bartlettroscoe/Trilinos/10774-install-…
Browse files Browse the repository at this point in the history
…run-demo

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: Add Trilinos install tests, test demo app, fix cmake --install, fix PR errors (#10774, #10810, #10842)
PR Author: bartlettroscoe
  • Loading branch information
trilinos-autotester committed Aug 12, 2022
2 parents 770992f + 38f4b53 commit e061ffc
Show file tree
Hide file tree
Showing 82 changed files with 551 additions and 301 deletions.
1 change: 1 addition & 0 deletions PackagesList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ TRIBITS_REPOSITORY_DEFINE_PACKAGES(
Pike packages/pike PT
xSDKTrilinos packages/xSDKTrilinos ST
TrilinosBuildStats commonTools/build_stats PT
TrilinosInstallTests packages/TrilinosInstallTests PT
)

# Allow builds even if some packages are missing
Expand Down
1 change: 1 addition & 0 deletions cmake/std/atdm/ATDMDisables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SET(ATDM_SE_PACKAGE_DISABLES
Pliris
Komplex
FEI
Krino
TriKota
Compadre
STKClassic
Expand Down
18 changes: 17 additions & 1 deletion cmake/tribits/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
ChangeLog for TriBITS
----------------------------------------


## 2022-08-11:

* **Changed:** Fix a bug where the test dependencies for an enabled
subpackage that resulted in a build error (see
[trilinos/Trilinos#10842](https://github.com/trilinos/Trilinos/issues/10842)
and
[TriBITSPub/TriBITS#510](https://github.com/TriBITSPub/TriBITS/issues/510)).

* **Changed:** Made setting parent package tests/examples enables correctly
propagate down to subpackages in a more intuitive way (see
[TriBITSPub/TriBITS#268](https://github.com/TriBITSPub/TriBITS/issues/268)).
This also results in not enabling tests for subpackages that are not
explicitly enabled or enabled as part of the forward sweep of packages
enables due to `<Project>_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON`.

## 2022-07-20:

* ** Changed:** Fixed TriBITS generated and installed `<tplName>Config.cmake`
* **Changed:** Fixed TriBITS generated and installed `<tplName>Config.cmake`
files to not point into the build dir but instead point into relative dir
for upstream TPL's when calling find_dependency() (see
[TribitsPub/TriBITS#500](https://github.com/TriBITSPub/TriBITS/issues/500)).
Expand Down
2 changes: 2 additions & 0 deletions cmake/tribits/common_tpls/FindTPLCGNSDependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tribits_extpkg_define_dependencies( CGNS
DEPENDENCIES HDF5)
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
#
##############################################################################

include_guard(GLOBAL)

## ---------------------------------------------------------------------------
## Compilers used by ${PROJECT_NAME}/${PACKAGE_NAME} build
## ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ include(PrintVar)
#
# If specified, then stdout and stderr for the test case will be sent to
# ``<outputFile>``. By default, the contents of this file will **also**
# be printed to STDOUT unless ``NO_ECHO_OUT`` is passed as well.
# be printed to STDOUT unless ``NO_ECHO_OUTPUT`` is passed as well.
#
# NOTE: Contrary to CMake documentation for execute_process(), STDOUT and
# STDERR may not get output in the correct order interleaved correctly,
Expand Down
13 changes: 3 additions & 10 deletions cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,14 @@ endfunction()


# Determine if to add the test based on if testing is enabled for the current
# package or subpackage.
# package.
#
function(tribits_add_test_process_enable_tests ADD_THE_TEST_OUT)
if(${PACKAGE_NAME}_ENABLE_TESTS OR ${PARENT_PACKAGE_NAME}_ENABLE_TESTS)
if(${PACKAGE_NAME}_ENABLE_TESTS)
set(ADD_THE_TEST TRUE)
else()
if (PARENT_PACKAGE_NAME STREQUAL PACKAGE_NAME)
set(PARENT_EANBLE_TESTS_DISABLE_MSG)
else()
set(PARENT_EANBLE_TESTS_DISABLE_MSG
", ${PARENT_PACKAGE_NAME}_ENABLE_TESTS='${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}'"
)
endif()
message_wrapper(
"-- ${TEST_NAME}: NOT added test because ${PACKAGE_NAME}_ENABLE_TESTS='${${PACKAGE_NAME}_ENABLE_TESTS}${PARENT_EANBLE_TESTS_DISABLE_MSG}'."
"-- ${TEST_NAME}: NOT added test because ${PACKAGE_NAME}_ENABLE_TESTS='${${PACKAGE_NAME}_ENABLE_TESTS}'."
)
set(ADD_THE_TEST FALSE)
endif()
Expand Down
81 changes: 65 additions & 16 deletions cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -999,14 +999,59 @@ macro(tribits_apply_test_example_enables PACKAGE_NAME)
endmacro()


# Macro to set ${TRIBITS_SUBPACKAGE)_ENABLE_TESTS and
# ${TRIBITS_SUBPACKAGE)_ENABLE_EXAMPLES based on
# ${TRIBITS_PARENTPACKAGE)_ENABLE_TESTS or
# ${TRIBITS_PARENTPACKAGE)_ENABLE_EXAMPLES
macro(tribits_apply_subpackage_tests_examples_enables PARENT_PACKAGE_NAME)
if ("${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}" STREQUAL ""
AND ${PARENT_PACKAGE_NAME}_ENABLE_TESTS
)
message("-- " "Setting"
" ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}"
" because"
" ${PARENT_PACKAGE_NAME}_ENABLE_TESTS=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}")
set(${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES ${${PARENT_PACKAGE_NAME}_ENABLE_TESTS})
endif()
foreach(spkg IN LISTS ${PARENT_PACKAGE_NAME}_SUBPACKAGES)
set(fullSpkgName ${PARENT_PACKAGE_NAME}${spkg})
if (${PROJECT_NAME}_ENABLE_${fullSpkgName})
if (${PARENT_PACKAGE_NAME}_ENABLE_TESTS)
if ("${${fullSpkgName}_ENABLE_TESTS}" STREQUAL "")
message("-- " "Setting"
" ${fullSpkgName}_ENABLE_TESTS=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}"
" because parent package"
" ${PARENT_PACKAGE_NAME}_ENABLE_TESTS"
"=${${PARENT_PACKAGE_NAME}_ENABLE_TESTS}")
set(${fullSpkgName}_ENABLE_TESTS ${${PARENT_PACKAGE_NAME}_ENABLE_TESTS})
endif()
endif()
if (${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES)
if ("${${fullSpkgName}_ENABLE_EXAMPLES}" STREQUAL "")
message("-- " "Setting"
" ${fullSpkgName}_ENABLE_EXAMPLES=${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}"
" because parent package"
" ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES"
"=${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES}")
set(${fullSpkgName}_ENABLE_EXAMPLES ${${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES})
endif()
endif()
endif()
endforeach()
endmacro()
# NOTE: Above, the parent package may not actually be enabled yet
# (i.e. ${PROJECT_NAME}_ENABLE_${PARENT_PACKAGE_NAME} my not be TRUE) if only
# subpackages needed to be enabled in the forward sweep but we want the tests
# and examples for subpackage to be enabled if
# ${PARENT_PACKAGE_NAME}_ENABLE_TESTS=ON or just examples i
# f${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES=ON


macro(tribits_private_enable_forward_package FORWARD_DEP_PACKAGE_NAME PACKAGE_NAME)
tribits_implicit_package_enable_is_allowed( "" ${FORWARD_DEP_PACKAGE_NAME}
ALLOW_PACKAGE_ENABLE )
#message("TRIBITS_PRIVATE_ENABLE_FORWARD_PACKAGE: "
# "${FORWARD_DEP_PACKAGE_NAME} ${PACKAGE_NAME} ${ALLOW_PACKAGE_ENABLE}")
# Enable the forward package if it is not already set to ON or OFF
assert_defined(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME})
if(${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME} STREQUAL ""
if("${${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}}" STREQUAL ""
AND ALLOW_PACKAGE_ENABLE
)
message("-- " "Setting ${PROJECT_NAME}_ENABLE_${FORWARD_DEP_PACKAGE_NAME}=ON"
Expand All @@ -1017,15 +1062,10 @@ macro(tribits_private_enable_forward_package FORWARD_DEP_PACKAGE_NAME PACKAGE_
endmacro()


# Macro used to set ${PROJECT_NAME}_ENABLE_${FWD_PACKAGE_NAME)=ON for all optional
# and required forward library dependencies of the package ${PACKAGE_NAME}
# Macro used to set ${PROJECT_NAME}_ENABLE_${FWD_PACKAGE_NAME)=ON for all
#
macro(tribits_enable_forward_lib_package_enables PACKAGE_NAME)

#message("\nPACKAGE_ARCH_ENABLE_FORWARD_PACKAGE_ENABLES ${PACKAGE_NAME}")
#print_var(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME})

# Enable the forward packages if this package is enabled
assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME})
if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME})

Expand All @@ -1042,15 +1082,12 @@ macro(tribits_enable_forward_lib_package_enables PACKAGE_NAME)
endmacro()


# Macro used to set ${PROJECT_NAME}_ENABLE_${FWD_PACKAGE_NAME)=ON for all optional
# and required forward test/example dependencies of the package ${PACKAGE_NAME}
# Macro used to set ${PROJECT_NAME}_ENABLE_${FWD_PACKAGE_NAME)=ON for all
# optional and required forward test dependencies of the package
# ${PACKAGE_NAME}
#
macro(tribits_enable_forward_test_package_enables PACKAGE_NAME)

#message("\nPACKAGE_ARCH_ENABLE_FORWARD_PACKAGE_ENABLES ${PACKAGE_NAME}")
#message("-- " "${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}=${${PROJECT_NAME}_ENABLE_${PACKAGE_NAME}}")

# Enable the forward packages if this package is enabled
assert_defined(${PROJECT_NAME}_ENABLE_${PACKAGE_NAME})
if (${PROJECT_NAME}_ENABLE_${PACKAGE_NAME})

Expand Down Expand Up @@ -1378,6 +1415,18 @@ macro(tribits_adjust_package_enables)
# packages so that we don't enable tests that don't need to be enabled based
# on the use of the option ${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES.

message("")
message("Enabling subpackage tests/examples based on parent package tests/examples enables ...")
message("")
foreach(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES})
tribits_apply_subpackage_tests_examples_enables(${TRIBITS_PACKAGE})
endforeach()
# NOTE: We want to apply this logic here instead of later after the backward
# sweep of package enables because we don't want to enable the
# tests/examples for a subpackage if it is not needed based on set of
# requested subpackages and packages to be enabled and the optional forward
# sweep of downstream packages.

#
# D) Sweep backwards and enable upstream required and optional SE packages
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,11 @@ function(tribits_extpkg_add_find_upstream_dependencies_str
message(FATAL_ERROR "ERROR: ${upstreamTplDepName}_DIR is empty!")
endif()
string(APPEND configFileFragStr
"set(${upstreamTplDepName}_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../${upstreamTplDepName}\")\n"
"find_dependency(${upstreamTplDepName} REQUIRED CONFIG \${${tplName}_SearchNoOtherPathsArgs})\n"
"unset(${upstreamTplDepName}_DIR)\n"
"if (NOT TARGET ${upstreamTplDepName}::all_libs)\n"
" set(${upstreamTplDepName}_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../${upstreamTplDepName}\")\n"
" find_dependency(${upstreamTplDepName} REQUIRED CONFIG \${${tplName}_SearchNoOtherPathsArgs})\n"
" unset(${upstreamTplDepName}_DIR)\n"
"endif()\n"
"\n"
)
endforeach()
Expand Down Expand Up @@ -583,8 +585,14 @@ function(tribits_extpkg_append_add_library_str
)
set(configFileStr "${${configFileStrInOut}}")
if (libEntryType STREQUAL "FULL_LIB_PATH")
get_filename_component(libExt "${libpath}" LAST_EXT)
if (libExt STREQUAL ".a")
set(libType STATIC)
else()
set(libType UNKNOWN)
endif()
string(APPEND configFileStr
"add_library(${prefixed_libname} IMPORTED UNKNOWN GLOBAL)\n"
"add_library(${prefixed_libname} IMPORTED ${libType})\n"
"set_target_properties(${prefixed_libname} PROPERTIES\n"
" IMPORTED_LOCATION \"${libpath}\")\n"
)
Expand All @@ -593,7 +601,7 @@ function(tribits_extpkg_append_add_library_str
OR (libEntryType STREQUAL "LIB_NAME")
)
string(APPEND configFileStr
"add_library(${prefixed_libname} IMPORTED INTERFACE GLOBAL)\n"
"add_library(${prefixed_libname} IMPORTED INTERFACE)\n"
"set_target_properties(${prefixed_libname} PROPERTIES\n"
" IMPORTED_LIBNAME \"${libname}\")\n"
)
Expand Down Expand Up @@ -776,7 +784,7 @@ function(tribits_extpkg_create_all_libs_target tplName)

# add_library()
string(APPEND configFileStr
"add_library(${tplName}::all_libs INTERFACE IMPORTED GLOBAL)\n")
"add_library(${tplName}::all_libs INTERFACE IMPORTED)\n")
# target_link_libraries()
if (libTargets)
string(APPEND configFileStr
Expand Down
80 changes: 28 additions & 52 deletions cmake/tribits/core/package_arch/TribitsPackageMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -401,49 +401,14 @@ endmacro()
# right effect.
#
# Currently, all this macro does macro is to call ``add_subdirectory(<diri>)``
# if ``${PACKAGE_NAME}_ENABLE_TESTS`` or
# ``${PARENT_PACKAGE_NAME}_ENABLE_TESTS`` are ``TRUE``. However, this macro
# may be extended in the future in order to modify behavior related to adding
# tests and examples in a uniform way.
# if ``${PACKAGE_NAME}_ENABLE_TESTS`` is ``TRUE``.
#
macro(tribits_add_test_directories)

if (CURRENTLY_PROCESSING_SUBPACKAGE)

# This is a subpackage being processed

if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_subpackage() before tribits_add_test_directories()"
" in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}")
endif()

if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_add_test_directories() before"
" tribits_subpackage_postprocess() in"
" ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}")
endif()

else()

# This is a package being processed

if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_package() or tribits_package_decl() before"
" tribits_add_test_directories() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}")
endif()

if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_add_test_directories() before "
" tribits_package_postprocess() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}")
endif()

endif()
tribits_add_test_example_directories_assert_call_context(
tribits_add_test_directories)

if(${PACKAGE_NAME}_ENABLE_TESTS OR ${PARENT_PACKAGE_NAME}_ENABLE_TESTS)
if(${PACKAGE_NAME}_ENABLE_TESTS)
foreach(TEST_DIR ${ARGN})
tribits_trace_file_processing(PACKAGE ADD_SUBDIR
"${CMAKE_CURRENT_SOURCE_DIR}/${TEST_DIR}/CMakeLists.txt")
Expand Down Expand Up @@ -563,46 +528,57 @@ endmacro()
#
macro(tribits_add_example_directories)

tribits_add_test_example_directories_assert_call_context(
tribits_add_example_directories)

if(${PACKAGE_NAME}_ENABLE_EXAMPLES)
foreach(EXAMPLE_DIR ${ARGN})
tribits_trace_file_processing(PACKAGE ADD_SUBDIR
"${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_DIR}/CMakeLists.txt")
add_subdirectory(${EXAMPLE_DIR})
endforeach()
endif()

endmacro()


macro(tribits_add_test_example_directories_assert_call_context macroName)

if (CURRENTLY_PROCESSING_SUBPACKAGE)

# This is a subpackage being processed

if(NOT ${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_subpackage() before tribits_add_example_directories()"
"Must call tribits_subpackage() before ${macroName}()"
" in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}")
endif()

if(${SUBPACKAGE_FULLNAME}_TRIBITS_SUBPACKAGE_POSTPROCESS_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_add_example_directories() before "
" tribits_subpackage_postprocess() in ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}")
"Must call ${macroName}() before"
" tribits_subpackage_postprocess() in"
" ${CURRENT_SUBPACKAGE_CMAKELIST_FILE}")
endif()

else()

# This is a package being processed

if(NOT ${PACKAGE_NAME}_TRIBITS_PACKAGE_DECL_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_package() or tribits_package_decl() before"
" tribits_add_example_directories() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}")
" ${macroName}() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}")
endif()

if(${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS_CALLED)
tribits_report_invalid_tribits_usage(
"Must call tribits_add_example_directories() before "
"Must call ${macroName}() before "
" tribits_package_postprocess() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}")
endif()

endif()

if(${PACKAGE_NAME}_ENABLE_EXAMPLES OR ${PARENT_PACKAGE_NAME}_ENABLE_EXAMPLES)
foreach(EXAMPLE_DIR ${ARGN})
tribits_trace_file_processing(PACKAGE ADD_SUBDIR
"${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_DIR}/CMakeLists.txt")
add_subdirectory(${EXAMPLE_DIR})
endforeach()
endif()

endmacro()


Expand Down
Loading

0 comments on commit e061ffc

Please sign in to comment.