From a04073592e69e1ae4950bbbd8c69f375ac93d6d1 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Wed, 20 Apr 2022 16:08:11 -0700 Subject: [PATCH 01/60] Add utility macro for converting to system includes --- cmake/BLTMacros.cmake | 18 ++++++++++++++++++ docs/api/utility.rst | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 6d5d78547..c3010dc52 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1401,3 +1401,21 @@ macro(blt_export_tpl_targets) endif() endforeach() endmacro() + +macro(blt_convert_to_system_includes) + set(options) + set(singleValuedArgs TARGET) + set(multiValuedArgs) + + ## parse the arguments to the macro + cmake_parse_arguments(arg + "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) + + if(NOT DEFINED arg_TARGET) + message(FATAL_ERROR "TARGET is a required parameter for the blt_convert_to_system_includes macro.") + endif() + + get_target_property(_include_dirs ${arg_TARGET} INTERFACE_INCLUDE_DIRECTORIES) + set_property(TARGET ${arg_TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_include_dirs}") +endmacro() + diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 85753f2cf..c039cab51 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -167,3 +167,21 @@ command but doesn't throw an error if the list is empty or not defined. set(mylist A B A) blt_list_remove_duplicates( TO mylist ) +.. _blt_convert_to_system_includes: + +blt_convert_to_system_includes +~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_convert_to_system_includes(TARGET ) + +Converts the interface includes to system interface includes. + +.. code-block:: cmake + :caption: **Example** + :linenos: + + ## convert to system includes for the foo target + blt_convert_to_system_includes(TARGET foo) + From 6fe179a4baf653eb7342c2ea960e892fff59af01 Mon Sep 17 00:00:00 2001 From: Alan Dayton <6393677+adayton1@users.noreply.github.com> Date: Thu, 21 Apr 2022 08:46:55 -0700 Subject: [PATCH 02/60] Document blt_convert_to_system_includes macro Co-authored-by: Chris White --- cmake/BLTMacros.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index c3010dc52..c7d428852 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1402,6 +1402,11 @@ macro(blt_export_tpl_targets) endforeach() endmacro() +##------------------------------------------------------------------------------ +## blt_convert_to_system_includes(TARGET ) +## +## Converts existing interface includes as system interface includes. +##------------------------------------------------------------------------------ macro(blt_convert_to_system_includes) set(options) set(singleValuedArgs TARGET) From 4e77d08c4c1087272730f1c670f220beafc42a7d Mon Sep 17 00:00:00 2001 From: Alan Dayton <6393677+adayton1@users.noreply.github.com> Date: Fri, 22 Apr 2022 13:12:09 -0700 Subject: [PATCH 03/60] Clarify documentation Co-authored-by: Chris White --- docs/api/utility.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/utility.rst b/docs/api/utility.rst index c039cab51..09a23682c 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -176,7 +176,7 @@ blt_convert_to_system_includes blt_convert_to_system_includes(TARGET ) -Converts the interface includes to system interface includes. +Converts existing interface includes to system interface includes. .. code-block:: cmake :caption: **Example** From f8e6ed6dc54cfadab967629893fb7db6c3f6b612 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 22 Apr 2022 13:12:28 -0700 Subject: [PATCH 04/60] Fix grammar error --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index c7d428852..44649dbc9 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1405,7 +1405,7 @@ endmacro() ##------------------------------------------------------------------------------ ## blt_convert_to_system_includes(TARGET ) ## -## Converts existing interface includes as system interface includes. +## Converts existing interface includes to system interface includes. ##------------------------------------------------------------------------------ macro(blt_convert_to_system_includes) set(options) From 7d9cf5395585583259a4bb600245c412a815896f Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 22 Apr 2022 13:15:23 -0700 Subject: [PATCH 05/60] Remove original interface includes --- cmake/BLTMacros.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 44649dbc9..b892bf1a8 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1422,5 +1422,6 @@ macro(blt_convert_to_system_includes) get_target_property(_include_dirs ${arg_TARGET} INTERFACE_INCLUDE_DIRECTORIES) set_property(TARGET ${arg_TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_include_dirs}") + set_property(TARGET ${arg_TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "") endmacro() From 5a36306a6306455395ede69eab4c5f18d1b19008 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 22 Apr 2022 13:16:59 -0700 Subject: [PATCH 06/60] Change order of operations --- cmake/BLTMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index b892bf1a8..63a39a9a6 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1421,7 +1421,7 @@ macro(blt_convert_to_system_includes) endif() get_target_property(_include_dirs ${arg_TARGET} INTERFACE_INCLUDE_DIRECTORIES) - set_property(TARGET ${arg_TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_include_dirs}") set_property(TARGET ${arg_TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "") + set_property(TARGET ${arg_TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_include_dirs}") endmacro() From 3e04e99e6f07a4e76b7f325ba7b8dd0ac1690c14 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 25 Apr 2022 16:49:34 -0700 Subject: [PATCH 07/60] Use target_include_directories --- cmake/BLTMacros.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 63a39a9a6..8407caee2 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1421,7 +1421,6 @@ macro(blt_convert_to_system_includes) endif() get_target_property(_include_dirs ${arg_TARGET} INTERFACE_INCLUDE_DIRECTORIES) - set_property(TARGET ${arg_TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "") - set_property(TARGET ${arg_TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_include_dirs}") + target_include_directories(${arg_TARGET} SYSTEM INTERFACE ${_include_dirs})) endmacro() From c1a6d119b8c89030719c4c1c24721bcb802816b7 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Tue, 26 Apr 2022 09:25:56 -0700 Subject: [PATCH 08/60] Go back to original implementation --- cmake/BLTMacros.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 8407caee2..42d77c8fc 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1421,6 +1421,7 @@ macro(blt_convert_to_system_includes) endif() get_target_property(_include_dirs ${arg_TARGET} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${arg_TARGET} SYSTEM INTERFACE ${_include_dirs})) + set_property(TARGET ${arg_TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_include_dirs}") + unset(_include_dirs) endmacro() From f711e3e4da21cc17f16d6b4447a570859f377817 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Tue, 26 Apr 2022 10:28:21 -0700 Subject: [PATCH 09/60] Add release notes for blt_convert_to_system_includes macro --- RELEASE-NOTES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 60519a26e..9a19310f4 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -9,6 +9,9 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd +### Added +- Added 'blt_convert_to_system_includes' macro to convert existing interface includes to system interface includes. + ## [Version 0.5.1] - Release date 2022-04-22 ### Added From 417a7bdd0c5fb6813b6b562708602e816938e46a Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 24 Jul 2022 16:29:52 -0700 Subject: [PATCH 10/60] In blt_list_append macro, only check that ELEMENTS was provided when appending --- cmake/BLTMacros.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 42d77c8fc..498e2d4ba 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -69,10 +69,6 @@ macro(blt_list_append) message(FATAL_ERROR "blt_list_append() requires a TO argument") endif() - if ( NOT DEFINED arg_ELEMENTS ) - message(FATAL_ERROR "blt_list_append() requires ELEMENTS to be specified" ) - endif() - # determine if we should add the elements to the list set(_shouldAdd FALSE ) set(_listVar "${ARGN}") # convert macro arguments to list variable @@ -84,6 +80,11 @@ macro(blt_list_append) # append if if ( ${_shouldAdd} ) + # check that ELEMENTS parameter is defined/non-empty before appending + if ( NOT DEFINED arg_ELEMENTS ) + message(FATAL_ERROR "blt_list_append() requires ELEMENTS to be specified and non-empty" ) + endif() + list( APPEND ${arg_TO} ${arg_ELEMENTS} ) endif() From 2efcccc2646215c921d1fe7e679a86a9cc5d12d1 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 24 Jul 2022 16:30:29 -0700 Subject: [PATCH 11/60] Adds tests for blt_list_append with empty ELEMENTS when IF is false --- tests/internal/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 3bcacf7d2..704150a0d 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -227,6 +227,10 @@ if(ENABLE_GTEST) blt_list_append(TO _actual_list ELEMENTS "empty_escaped" IF ${_defined_empty_var}) blt_list_append(TO _actual_list ELEMENTS "nonempty_escaped" IF ${_defined_nonempty_var}) + # Check that ELEMENTS can be empty or missing when the IF condition is false + blt_list_append(TO _actual_list IF FALSE) + blt_list_append(TO _actual_list ELEMENTS "" IF FALSE) + # Check the results list(LENGTH _actual_list _actual_size) if(NOT "${_actual_list}" STREQUAL "${_expected_list}" From 7b0c24c2533ec43d767c0b993e8297d70d23393b Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 24 Jul 2022 16:44:04 -0700 Subject: [PATCH 12/60] Updates RELEASE-NOTES --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9a19310f4..cca7d499d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -24,6 +24,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ CMAKE_CUDA_STANDARD if set otherwise falls back on BLT_CXX_STD or CMAKE_CXX_STANDARD. - Removed extra HIP offload flags that were being added as generator expressions as opposed to simple flags. +- Skip check for valid `ELEMENTS` parameter in `blt_list_append` macro when not appending ### Removed - Removed support for deprecated HCC. From 7563ed852ccdaf4f09b4760954772bcc9a1d0e8c Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 3 Aug 2022 16:13:26 -0700 Subject: [PATCH 13/60] recursive and regex --- cmake/BLTMacros.cmake | 103 +++++++++++++++++++++-------------- cmake/BLTPrivateMacros.cmake | 77 ++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 41 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 498e2d4ba..72387df63 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -49,6 +49,7 @@ macro(blt_assert_exists) endmacro(blt_assert_exists) + ##------------------------------------------------------------------------------ ## blt_list_append( TO ELEMENTS [ ...] IF ) ## @@ -1274,14 +1275,14 @@ endmacro(blt_combine_static_libraries) ##------------------------------------------------------------------------------ -## blt_print_target_properties(TARGET ) +## blt_print_target_properties(TARGET CHILDREN INCLUDE_REGEX ) ## ## Prints out all properties of the given target. ##------------------------------------------------------------------------------ macro(blt_print_target_properties) set(options) - set(singleValuedArgs TARGET) + set(singleValuedArgs TARGET CHILDREN INCLUDE_REGEX) set(multiValuedArgs) ## parse the arguments to the macro @@ -1293,7 +1294,12 @@ macro(blt_print_target_properties) message(FATAL_ERROR "TARGET is a required parameter for the blt_print_target_properties macro") endif() - ## check if this is a valid cmake target of blt_registered target + # set optional argument default values + if(NOT DEFINED arg_CHILDREN) + set(arg_CHILDREN, FALSE) + endif() + + ## check if this is a valid cmake target or blt_registered target set(_is_cmake_target FALSE) if(TARGET ${arg_TARGET}) set(_is_cmake_target TRUE) @@ -1307,63 +1313,78 @@ macro(blt_print_target_properties) message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a blt_registered target") endif() - if(NOT _is_cmake_target AND NOT _is_blt_registered_target) + if(_is_cmake_target OR _is_blt_registered_target) + blt_print_single_target_properties(TARGET ${arg_TARGET}) + else() message (STATUS "[blt_print_target_properties] Invalid argument '${arg_TARGET}'. " "This macro applies only to valid cmake targets or blt_registered targets.") endif() + if(${arg_CHILDREN}) + # create list of link libraries and interface link libraries from target properties + # TODO question: is "OR _is_blt_registered_target" required here + # since it will not have these two properties? + set(_child_target_list "") + if(_is_cmake_target) + # get link libaries if whitelisted + get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) + if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") + get_property(_propval TARGET ${arg_TARGET} PROPERTY LINK_LIBRARIES SET) + get_target_property(_propval ${arg_TARGET} LINK_LIBRARIES) + if (_propval) + set(_child_target_list "${_child_targets}${_propval}") + endif() + endif() + + # add semicolon to list + if (NOT "${_child_target_list}" STREQUAL "") + set(_child_target_list "${_child_targets};") + endif() - if(_is_cmake_target) - ## Solution adapted from https://stackoverflow.com/q/32183975 - ## Create list of cmake properties - set(_property_list) - execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE _property_list) - string(REGEX REPLACE ";" "\\\\;" _property_list "${_property_list}") - string(REGEX REPLACE "\n" ";" _property_list "${_property_list}") - blt_filter_list(TO _property_list REGEX "^LOCATION$|^LOCATION_|_LOCATION$" OPERATION "exclude") - blt_list_remove_duplicates(TO _property_list) - - ## For interface targets, filter against whitelist of valid properties - get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) - if("${_target_type}" STREQUAL "INTERFACE_LIBRARY") - blt_filter_list(TO _property_list - REGEX "^(INTERFACE_|IMPORTED_LIBNAME_|COMPATIBLE_INTERFACE_|MAP_IMPORTED_CONFIG_)|^(NAME|TYPE|EXPORT_NAME)$" - OPERATION "include") + # get interface link libraries + get_property(_propval TARGET ${arg_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES SET) + get_target_property(_propval ${arg_TARGET} INTERFACE_LINK_LIBRARIES) + if (_propval) + set(_child_target_list "${_child_targets}${_propval}") + endif() + unset(_property_list) + unset(_propval) endif() - ## Print all such properties that have been SET - foreach (prop ${_property_list}) - string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) - get_property(_propval TARGET ${arg_TARGET} PROPERTY ${prop} SET) - if (_propval) - get_target_property(_propval ${arg_TARGET} ${prop}) - message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") + + blt_list_remove_duplicates(TO _child_target_list) + if(DEFINED arg_INCLUDE_REGEX) + blt_filter_list(TO _child_target_list REGEX "${arg_INCLUDE_REGEX}" OPERATION "include") + endif() + foreach(_child_target ${_child_target_list}) + ## check if _child_target is a valid cmake target or blt_registered target + set(_is_cmake_target FALSE) + if(TARGET ${_child_target}) + set(_is_cmake_target TRUE) endif() - endforeach() - unset(_property_list) - unset(_propval) - endif() - ## Additionally, output variables generated via blt_register_target of the form "_BLT__*" - if(_is_blt_registered_target) - set(_target_prefix "_BLT_${_target_upper}_") + set(_is_blt_registered_target FALSE) + string(TOUPPER ${_child_target} _target_upper) + if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) + set(_is_blt_registered_target TRUE) + endif() - ## Filter to get variables of the form _BLT__ and print - get_cmake_property(_variable_names VARIABLES) - foreach (prop ${_variable_names}) - if(prop MATCHES "^${_target_prefix}") - message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") + # recursively print _child_target properties + if (_is_cmake_target OR _is_blt_registered_target) + message(STATUS "[${arg_TARGET}'s child, ${_child_target}, properties START]") + blt_print_target_properties(TARGET ${_child_target} CHILDREN ${arg_CHILDREN} REGEX ${arg_INCLUDE_REGEX}) + message(STATUS "[${arg_TARGET}'s child, ${_child_target}, properties END]") endif() endforeach() - unset(_target_prefix) - unset(_variable_names) endif() + unset(_child_target_list) unset(_target_upper) unset(_is_blt_registered_target) unset(_is_cmake_target) endmacro(blt_print_target_properties) + ##------------------------------------------------------------------------------ ## blt_export_tpl_targets(EXPORT NAMESPACE ) ## diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 5c980accd..10d168a57 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -842,3 +842,80 @@ macro(blt_clean_target) endforeach() endmacro(blt_clean_target) + + +##------------------------------------------------------------------------------ +## blt_print_target_properties(TARGET ) +## +## Prints out all properties of the one given target. +##------------------------------------------------------------------------------ +macro(blt_print_single_target_properties) + + set(options) + set(singleValuedArgs TARGET) + set(multiValuedArgs) + + ## parse the arguments to the macro + cmake_parse_arguments(arg + "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) + + ## check if this is a valid cmake target or blt_registered target + set(_is_cmake_target FALSE) + if(TARGET ${arg_TARGET}) + set(_is_cmake_target TRUE) + endif() + + set(_is_blt_registered_target FALSE) + string(TOUPPER ${arg_TARGET} _target_upper) + if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) + set(_is_blt_registered_target TRUE) + endif() + + + if(_is_cmake_target) + ## Solution adapted from https://stackoverflow.com/q/32183975 + ## Create list of cmake properties + set(_property_list) + execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE _property_list) + string(REGEX REPLACE ";" "\\\\;" _property_list "${_property_list}") + string(REGEX REPLACE "\n" ";" _property_list "${_property_list}") + blt_filter_list(TO _property_list REGEX "^LOCATION$|^LOCATION_|_LOCATION$" OPERATION "exclude") + blt_list_remove_duplicates(TO _property_list) + + ## For interface targets, filter against whitelist of valid properties + get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) + if("${_target_type}" STREQUAL "INTERFACE_LIBRARY") + blt_filter_list(TO _property_list + REGEX "^(INTERFACE_|IMPORTED_LIBNAME_|COMPATIBLE_INTERFACE_|MAP_IMPORTED_CONFIG_)|^(NAME|TYPE|EXPORT_NAME)$" + OPERATION "include") + endif() + + ## Print all such properties that have been SET + foreach (prop ${_property_list}) + string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) + get_property(_propval TARGET ${arg_TARGET} PROPERTY ${prop} SET) + if (_propval) + get_target_property(_propval ${arg_TARGET} ${prop}) + message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") + endif() + endforeach() + unset(_property_list) + unset(_propval) + endif() + + ## Additionally, output variables generated via blt_register_target of the form "_BLT__*" + if(_is_blt_registered_target) + set(_target_prefix "_BLT_${_target_upper}_") + + ## Filter to get variables of the form _BLT__ and print + get_cmake_property(_variable_names VARIABLES) + foreach (prop ${_variable_names}) + if(prop MATCHES "^${_target_prefix}") + message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") + endif() + endforeach() + unset(_target_prefix) + unset(_variable_names) + endif() +endmacro(blt_print_single_target_properties) + From 051804325bd76e8f5c6acb97802f1ff7012b3e09 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 3 Aug 2022 16:21:22 -0700 Subject: [PATCH 14/60] gitignore workspace --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..4d67604d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.code-workspace From efb0907fd4fb4caaf2cdeea0c38ceadcbdf3f089 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 3 Aug 2022 16:28:09 -0700 Subject: [PATCH 15/60] desc --- cmake/BLTMacros.cmake | 4 ++++ cmake/BLTPrivateMacros.cmake | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 72387df63..64febcf51 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1278,6 +1278,10 @@ endmacro(blt_combine_static_libraries) ## blt_print_target_properties(TARGET CHILDREN INCLUDE_REGEX ) ## ## Prints out all properties of the given target. +## +## Has the options to print target's link libraries and interface link libraries +## with the CHILDREN argument, as well as only a specific child using a regular +## expression. ##------------------------------------------------------------------------------ macro(blt_print_target_properties) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 10d168a57..1c715ecd1 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -847,7 +847,7 @@ endmacro(blt_clean_target) ##------------------------------------------------------------------------------ ## blt_print_target_properties(TARGET ) ## -## Prints out all properties of the one given target. +## Prints out all properties of one given target. ##------------------------------------------------------------------------------ macro(blt_print_single_target_properties) From 0e3153d4cafa4e32487ec15465ce7e51b288588f Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 5 Aug 2022 16:48:00 -0700 Subject: [PATCH 16/60] quiet warning about if(ON) - cmp0012 --- cmake/BLTPrivateMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 5c980accd..d829f2f38 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -190,7 +190,7 @@ macro(blt_find_executable) string(TOUPPER ${arg_NAME} _ucname) message(STATUS "${arg_NAME} support is ${ENABLE_${_ucname}}") - if (${ENABLE_${_ucname}}) + if (ENABLE_${_ucname}) set(_exes ${arg_NAME}) if (DEFINED arg_EXECUTABLES) set(_exes ${arg_EXECUTABLES}) From 0b1a6ce1ccc1ea72edc34b90b8fddd8da1556fa0 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 5 Aug 2022 16:56:08 -0700 Subject: [PATCH 17/60] quiet cmake_minimum_required warning --- .../googletest-master-2020-01-07/googlemock/CMakeLists.txt | 2 +- .../googletest-master-2020-01-07/googletest/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt index 17ca62f5a..dde8aec39 100644 --- a/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt +++ b/thirdparty_builtin/googletest-master-2020-01-07/googlemock/CMakeLists.txt @@ -42,7 +42,7 @@ else() cmake_policy(SET CMP0048 NEW) project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) endif() -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 3.0) if (COMMAND set_up_hermetic_build) set_up_hermetic_build() diff --git a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt index ae080855c..c956939ed 100644 --- a/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt +++ b/thirdparty_builtin/googletest-master-2020-01-07/googletest/CMakeLists.txt @@ -53,7 +53,7 @@ else() cmake_policy(SET CMP0048 NEW) project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) endif() -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 3.0) if (POLICY CMP0063) # Visibility cmake_policy(SET CMP0063 NEW) From ccd77046854985a73b22c24afab6982b9af3d400 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 5 Aug 2022 17:16:19 -0700 Subject: [PATCH 18/60] add basic host-config for radiuss aws instance --- host-configs/other/radiuss-aws-ec2.cmake | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 host-configs/other/radiuss-aws-ec2.cmake diff --git a/host-configs/other/radiuss-aws-ec2.cmake b/host-configs/other/radiuss-aws-ec2.cmake new file mode 100644 index 000000000..c08d19ab7 --- /dev/null +++ b/host-configs/other/radiuss-aws-ec2.cmake @@ -0,0 +1,38 @@ +# Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level LICENSE file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) + +#------------------------------------------------------------------------------ +# Example host-config file for the a basic AWS EC2 instance with OpenMPI +#------------------------------------------------------------------------------ +# +# This file provides CMake with paths / details for: +# C, C++, & Fortran compilers + MPI +# +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# gcc@7.3.1 compilers +#------------------------------------------------------------------------------ + +set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE PATH "") + +set(ENABLE_FORTRAN ON CACHE BOOL "") +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +#------------------------------------------------------------------------------ +# MPI Support +#------------------------------------------------------------------------------ +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_HOME "/usr/lib64/openmpi" CACHE PATH "") + +set(MPI_C_COMPILER "${MPI_HOME}/bin/mpicc" CACHE PATH "") +set(MPI_CXX_COMPILER "${MPI_HOME}/bin/mpicxx" CACHE PATH "") +set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpif90" CACHE PATH "") + +set(MPIEXEC "${MPI_HOME}/bin/mpirun" CACHE PATH "") +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "") +setBLT_MPI_COMMAND_APPEND "-oversubscribe" CACHE STRING "") From aa67a27cb66c1fc555bfd4022ef18524f5a443e6 Mon Sep 17 00:00:00 2001 From: Chris White Date: Sun, 7 Aug 2022 12:13:27 -0700 Subject: [PATCH 19/60] fix append command --- host-configs/other/radiuss-aws-ec2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-configs/other/radiuss-aws-ec2.cmake b/host-configs/other/radiuss-aws-ec2.cmake index c08d19ab7..c6de49370 100644 --- a/host-configs/other/radiuss-aws-ec2.cmake +++ b/host-configs/other/radiuss-aws-ec2.cmake @@ -35,4 +35,4 @@ set(MPI_Fortran_COMPILER "${MPI_HOME}/bin/mpif90" CACHE PATH "") set(MPIEXEC "${MPI_HOME}/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "") -setBLT_MPI_COMMAND_APPEND "-oversubscribe" CACHE STRING "") +set(BLT_MPI_COMMAND_APPEND "--oversubscribe" CACHE STRING "") From 7b3e519a6bedbe6ff8e8843d7ea27c89a091b475 Mon Sep 17 00:00:00 2001 From: Chris White Date: Sun, 7 Aug 2022 22:49:34 -0700 Subject: [PATCH 20/60] fix capitalization --- docs/tutorial/third_party_libraries.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/third_party_libraries.rst b/docs/tutorial/third_party_libraries.rst index 2d6a6b2d2..0e92b0baa 100644 --- a/docs/tutorial/third_party_libraries.rst +++ b/docs/tutorial/third_party_libraries.rst @@ -102,7 +102,7 @@ Then ``lua`` is available to be used in the ``DEPENDS_ON`` list in the following option to :ref:`blt_import_library` can also be used to manage visibility. -Cmake's Find Modules +CMake's Find Modules ~~~~~~~~~~~~~~~~~~~~ This time we will do exactly the same thing but using the new CMake provided ``FindLua.cmake`` module. From 19311d8d3a66396c8f9b1c8cad9081063b9c9ab4 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 9 Aug 2022 16:20:08 -0700 Subject: [PATCH 21/60] regex for properties --- cmake/BLTMacros.cmake | 33 +++++++++++++++++++-------------- cmake/BLTPrivateMacros.cmake | 8 ++++---- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 64febcf51..bdd83e1bd 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1275,18 +1275,23 @@ endmacro(blt_combine_static_libraries) ##------------------------------------------------------------------------------ -## blt_print_target_properties(TARGET CHILDREN INCLUDE_REGEX ) +## blt_print_target_properties(TARGET CHILDREN PROP_REGEX ) ## -## Prints out all properties of the given target. +## Prints out properties of the given target. ## ## Has the options to print target's link libraries and interface link libraries -## with the CHILDREN argument, as well as only a specific child using a regular +## with the CHILDREN argument, as well as specific properties using a regular ## expression. +## +## Defaults: +## CHILDREN = false (non recursive) +## PROP_REGEX = .* (print every property) +## ##------------------------------------------------------------------------------ macro(blt_print_target_properties) set(options) - set(singleValuedArgs TARGET CHILDREN INCLUDE_REGEX) + set(singleValuedArgs TARGET CHILDREN PROP_REGEX) set(multiValuedArgs) ## parse the arguments to the macro @@ -1298,9 +1303,14 @@ macro(blt_print_target_properties) message(FATAL_ERROR "TARGET is a required parameter for the blt_print_target_properties macro") endif() - # set optional argument default values + # set default value if(NOT DEFINED arg_CHILDREN) - set(arg_CHILDREN, FALSE) + set(arg_CHILDREN FALSE) + endif() + + # set default value + if(NOT DEFINED arg_PROP_REGEX) + set(arg_PROP_REGEX ".*") endif() ## check if this is a valid cmake target or blt_registered target @@ -1318,7 +1328,8 @@ macro(blt_print_target_properties) endif() if(_is_cmake_target OR _is_blt_registered_target) - blt_print_single_target_properties(TARGET ${arg_TARGET}) + # non-recursive run of original target + blt_print_single_target_properties(TARGET ${arg_TARGET} PROP_REGEX ${arg_PROP_REGEX}) else() message (STATUS "[blt_print_target_properties] Invalid argument '${arg_TARGET}'. " "This macro applies only to valid cmake targets or blt_registered targets.") @@ -1326,8 +1337,6 @@ macro(blt_print_target_properties) if(${arg_CHILDREN}) # create list of link libraries and interface link libraries from target properties - # TODO question: is "OR _is_blt_registered_target" required here - # since it will not have these two properties? set(_child_target_list "") if(_is_cmake_target) # get link libaries if whitelisted @@ -1355,11 +1364,7 @@ macro(blt_print_target_properties) unset(_propval) endif() - blt_list_remove_duplicates(TO _child_target_list) - if(DEFINED arg_INCLUDE_REGEX) - blt_filter_list(TO _child_target_list REGEX "${arg_INCLUDE_REGEX}" OPERATION "include") - endif() foreach(_child_target ${_child_target_list}) ## check if _child_target is a valid cmake target or blt_registered target set(_is_cmake_target FALSE) @@ -1376,7 +1381,7 @@ macro(blt_print_target_properties) # recursively print _child_target properties if (_is_cmake_target OR _is_blt_registered_target) message(STATUS "[${arg_TARGET}'s child, ${_child_target}, properties START]") - blt_print_target_properties(TARGET ${_child_target} CHILDREN ${arg_CHILDREN} REGEX ${arg_INCLUDE_REGEX}) + blt_print_target_properties(TARGET ${_child_target} CHILDREN ${arg_CHILDREN} PROP_REGEX ${arg_PROP_REGEX}) message(STATUS "[${arg_TARGET}'s child, ${_child_target}, properties END]") endif() endforeach() diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 1c715ecd1..8d295c897 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -845,14 +845,14 @@ endmacro(blt_clean_target) ##------------------------------------------------------------------------------ -## blt_print_target_properties(TARGET ) +## blt_print_target_properties(TARGET PROP_REGEX TLIST ) ## ## Prints out all properties of one given target. ##------------------------------------------------------------------------------ macro(blt_print_single_target_properties) set(options) - set(singleValuedArgs TARGET) + set(singleValuedArgs TARGET PROP_REGEX TLIST) set(multiValuedArgs) ## parse the arguments to the macro @@ -894,7 +894,7 @@ macro(blt_print_single_target_properties) foreach (prop ${_property_list}) string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) get_property(_propval TARGET ${arg_TARGET} PROPERTY ${prop} SET) - if (_propval) + if ("${_propval}" AND "${prop}" MATCHES "${arg_PROP_REGEX}") get_target_property(_propval ${arg_TARGET} ${prop}) message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") endif() @@ -910,7 +910,7 @@ macro(blt_print_single_target_properties) ## Filter to get variables of the form _BLT__ and print get_cmake_property(_variable_names VARIABLES) foreach (prop ${_variable_names}) - if(prop MATCHES "^${_target_prefix}") + if("${prop}" MATCHES "^${_target_prefix}" AND "${prop}" MATCHES "${arg_PROP_REGEX}") message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") endif() endforeach() From 0ce11e4d64533a7825dd25220091a963dd19419a Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 10 Aug 2022 12:10:10 -0700 Subject: [PATCH 22/60] remove duplicates of entire tree --- cmake/BLTMacros.cmake | 87 +++++++++++------------------------- cmake/BLTPrivateMacros.cmake | 75 ++++++++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 65 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index bdd83e1bd..ef2cdfd16 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1294,11 +1294,11 @@ macro(blt_print_target_properties) set(singleValuedArgs TARGET CHILDREN PROP_REGEX) set(multiValuedArgs) - ## parse the arguments to the macro + # parse the arguments to the macro cmake_parse_arguments(arg "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) - ## check for required arguments + # check for required arguments if(NOT DEFINED arg_TARGET) message(FATAL_ERROR "TARGET is a required parameter for the blt_print_target_properties macro") endif() @@ -1313,81 +1313,48 @@ macro(blt_print_target_properties) set(arg_PROP_REGEX ".*") endif() - ## check if this is a valid cmake target or blt_registered target + # check if this is a valid cmake target or blt_registered target set(_is_cmake_target FALSE) if(TARGET ${arg_TARGET}) set(_is_cmake_target TRUE) - message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a cmake target") endif() set(_is_blt_registered_target FALSE) string(TOUPPER ${arg_TARGET} _target_upper) if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) set(_is_blt_registered_target TRUE) - message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a blt_registered target") endif() - if(_is_cmake_target OR _is_blt_registered_target) - # non-recursive run of original target - blt_print_single_target_properties(TARGET ${arg_TARGET} PROP_REGEX ${arg_PROP_REGEX}) - else() + if(NOT _is_cmake_target AND NOT _is_blt_registered_target) message (STATUS "[blt_print_target_properties] Invalid argument '${arg_TARGET}'. " "This macro applies only to valid cmake targets or blt_registered targets.") - endif() - - if(${arg_CHILDREN}) - # create list of link libraries and interface link libraries from target properties - set(_child_target_list "") - if(_is_cmake_target) - # get link libaries if whitelisted - get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) - if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") - get_property(_propval TARGET ${arg_TARGET} PROPERTY LINK_LIBRARIES SET) - get_target_property(_propval ${arg_TARGET} LINK_LIBRARIES) - if (_propval) - set(_child_target_list "${_child_targets}${_propval}") - endif() - endif() - - # add semicolon to list - if (NOT "${_child_target_list}" STREQUAL "") - set(_child_target_list "${_child_targets};") - endif() - - # get interface link libraries - get_property(_propval TARGET ${arg_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES SET) - get_target_property(_propval ${arg_TARGET} INTERFACE_LINK_LIBRARIES) - if (_propval) - set(_child_target_list "${_child_targets}${_propval}") - endif() - unset(_property_list) - unset(_propval) + else() + set(_temp_target "${arg_TARGET}") + message (STATUS "==========${_temp_target}==========") + + # print properties + blt_print_target_properties_private(TARGET ${arg_TARGET} + PROP_REGEX ${arg_PROP_REGEX}) + + if(${arg_CHILDREN}) + # find all targets from dependency tree + set(tlist "") + blt_find_all_targets_recursive(TARGET ${arg_TARGET} TLIST tlist) + blt_list_remove_duplicates(TO tlist) + + # print all targets from dependency tree + foreach(t ${tlist}) + message (STATUS "---${_temp_target}->${t}---") + blt_print_target_properties_private(TARGET ${t} + PROP_REGEX ${arg_PROP_REGEX}) + message (STATUS "---${_temp_target}->${t}---") + endforeach() + unset(tlist) endif() - blt_list_remove_duplicates(TO _child_target_list) - foreach(_child_target ${_child_target_list}) - ## check if _child_target is a valid cmake target or blt_registered target - set(_is_cmake_target FALSE) - if(TARGET ${_child_target}) - set(_is_cmake_target TRUE) - endif() - - set(_is_blt_registered_target FALSE) - string(TOUPPER ${_child_target} _target_upper) - if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) - set(_is_blt_registered_target TRUE) - endif() - - # recursively print _child_target properties - if (_is_cmake_target OR _is_blt_registered_target) - message(STATUS "[${arg_TARGET}'s child, ${_child_target}, properties START]") - blt_print_target_properties(TARGET ${_child_target} CHILDREN ${arg_CHILDREN} PROP_REGEX ${arg_PROP_REGEX}) - message(STATUS "[${arg_TARGET}'s child, ${_child_target}, properties END]") - endif() - endforeach() + message (STATUS "==========${_temp_target}==========\n") endif() - unset(_child_target_list) unset(_target_upper) unset(_is_blt_registered_target) unset(_is_cmake_target) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 8d295c897..1cc2da0ef 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -845,14 +845,15 @@ endmacro(blt_clean_target) ##------------------------------------------------------------------------------ -## blt_print_target_properties(TARGET PROP_REGEX TLIST ) +## blt_print_target_properties_private(TARGET +## PROP_REGEX ) ## -## Prints out all properties of one given target. +## Prints target properties of one target ##------------------------------------------------------------------------------ -macro(blt_print_single_target_properties) +macro(blt_print_target_properties_private) set(options) - set(singleValuedArgs TARGET PROP_REGEX TLIST) + set(singleValuedArgs TARGET PROP_REGEX) set(multiValuedArgs) ## parse the arguments to the macro @@ -863,12 +864,14 @@ macro(blt_print_single_target_properties) set(_is_cmake_target FALSE) if(TARGET ${arg_TARGET}) set(_is_cmake_target TRUE) + message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a cmake target") endif() set(_is_blt_registered_target FALSE) string(TOUPPER ${arg_TARGET} _target_upper) if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) set(_is_blt_registered_target TRUE) + message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a blt_registered target") endif() @@ -917,5 +920,67 @@ macro(blt_print_single_target_properties) unset(_target_prefix) unset(_variable_names) endif() -endmacro(blt_print_single_target_properties) + unset(_target_upper) + unset(_is_blt_registered_target) + unset(_is_cmake_target) +endmacro(blt_print_target_properties_private) + +##------------------------------------------------------------------------------ +## blt_find_all_targets_recursive(TARGET TLIST tlist) +## +## Store all target's dependancies (link libraries and interface link libraries) +## recursively in TLIST. +## +## NOTE: TLIST should be an empty string at the start. TLIST must be called tlist +## And this function does NOT remove duplicates. +## +##------------------------------------------------------------------------------ +macro(blt_find_all_targets_recursive) + + set(options) + set(singleValuedArgs TARGET TLIST) + set(multiValuedArgs) + + # parse the arguments to the macro + cmake_parse_arguments(arg + "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) + + # check for required arguments + if(NOT DEFINED arg_TARGET) + message(FATAL_ERROR "TARGET is a required parameter for the blt_find_all_targets_recursive macro") + endif() + if(NOT DEFINED tlist) + message(FATAL_ERROR "TLIST parameter must be named tlist for the blt_find_all_targets_recursive macro") + endif() + + # check if this is a valid cmake target + if(TARGET ${arg_TARGET}) + # get link libaries if whitelisted + set(_property_list "") + get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) + if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") + get_property(_propval TARGET ${arg_TARGET} PROPERTY LINK_LIBRARIES SET) + get_target_property(_propval ${arg_TARGET} LINK_LIBRARIES) + if (_propval) + list(APPEND _property_list ${_propval}) + endif() + endif() + + # get interface link libraries + get_property(_propval TARGET ${arg_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES SET) + get_target_property(_propval ${arg_TARGET} INTERFACE_LINK_LIBRARIES) + if (_propval) + list(APPEND _property_list ${_propval}) + endif() + + # recursive call + foreach(t ${_property_list}) + list(APPEND tlist ${t}) + blt_find_all_targets_recursive(TARGET ${t} TLIST tlist) + endforeach() + + unset(_property_list) + unset(_propval) + endif() +endmacro(blt_find_all_targets_recursive) From 6b79fcee66e99541f6064c23950dc3db84a4d170 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 10 Aug 2022 12:10:58 -0700 Subject: [PATCH 23/60] remove enter --- cmake/BLTMacros.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index ef2cdfd16..efd1958be 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -49,7 +49,6 @@ macro(blt_assert_exists) endmacro(blt_assert_exists) - ##------------------------------------------------------------------------------ ## blt_list_append( TO ELEMENTS [ ...] IF ) ## From ed3eae6d70b9a6a002d935b58f83a53890c45447 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 10 Aug 2022 12:13:43 -0700 Subject: [PATCH 24/60] lowercase a --- cmake/BLTPrivateMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 1cc2da0ef..b814b38da 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -933,7 +933,7 @@ endmacro(blt_print_target_properties_private) ## recursively in TLIST. ## ## NOTE: TLIST should be an empty string at the start. TLIST must be called tlist -## And this function does NOT remove duplicates. +## and this function does NOT remove duplicates. ## ##------------------------------------------------------------------------------ macro(blt_find_all_targets_recursive) From 488aff364e60d461b9fd3742634fe3cb075c3305 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 15 Aug 2022 14:36:16 -0700 Subject: [PATCH 25/60] add script from rich to create a local branch --- scripts/make_local_branch_from_fork_pr.sh | 78 +++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 scripts/make_local_branch_from_fork_pr.sh diff --git a/scripts/make_local_branch_from_fork_pr.sh b/scripts/make_local_branch_from_fork_pr.sh new file mode 100755 index 000000000..75a72f044 --- /dev/null +++ b/scripts/make_local_branch_from_fork_pr.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +############################################################################### +# Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and +# other BLT Project Developers. See the top-level LICENSE file for details +# +# SPDX-License-Identifier: (BSD-3-Clause) +############################################################################### + +############################################################################### +# Help +############################################################################### +Help() +{ + # Display Help + echo + echo "This script will make a branch in a local git repo for a PR from a " + echo "branch in a forked repo. The script must be run inside the local repo." + echo + echo "Syntax: make_local_branch_from_fork_pr [-h | -c num | num]" + echo "options:" + echo "-h Print this help usage message." + echo "-c <#> Check whether there is a PR with given number." + echo "-b <#> Make local branch from branch associated with given PR number." + echo +} + +############################################################################### +# Process the input args. +############################################################################### +if [ "$1" == "" ]; then + echo + echo "You must pass an arg to script. Pass -h to see correct usage." + exit +fi + +while [ "$1" != "" ]; do + case $1 in + -h) # display help message + Help + exit;; + -c) # check PR exists + shift + num=$1 + echo + echo "Running git ls-remote on origin to see if PR ${num} exists..." + echo "If you don't see it in the output, it does not exist." + echo + git ls-remote --refs origin | grep "pull/${num}" + exit;; + -b) # make local branch for given PR number + shift + num=$1 + echo + echo "Attempting to make local branch from branch on fork for PR ${num}" + echo + echo "If successful, you will be on local branch pr-from-fork/${num}" + echo "when script exits." + echo + echo "Run 'git branch' to be sure the new branch exists." + echo + echo "You can then push the new branch to the main repo; e.g.," + echo " git push " + echo + echo "If you make a PR for the new branch, it is a good idea to " + echo "reference the original PR from the forked repo to track the " + echo "original PR discussion." + echo + git fetch origin pull/${num}/head:pr-from-fork/${num} && git checkout pr-from-fork/${num} + echo + + exit;; + \?) # incorrect option + echo + echo "Error: $1 is an invalid option" + exit;; + esac +done From 44bdd7add10116cd1014992cd888c25ba1bd532d Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman <100869159+chapman39@users.noreply.github.com> Date: Mon, 22 Aug 2022 13:26:07 -0700 Subject: [PATCH 26/60] Update cmake/BLTMacros.cmake Co-authored-by: Chris White --- cmake/BLTMacros.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index efd1958be..970b362d5 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1274,7 +1274,9 @@ endmacro(blt_combine_static_libraries) ##------------------------------------------------------------------------------ -## blt_print_target_properties(TARGET CHILDREN PROP_REGEX ) +## blt_print_target_properties(TARGET +## CHILDREN +## PROP_REGEX ) ## ## Prints out properties of the given target. ## From 6a37c245acd139a5416f448adba19fb8cff2de8a Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Mon, 22 Aug 2022 14:27:07 -0700 Subject: [PATCH 27/60] if regex undefined, don't use MATCHES --- cmake/BLTMacros.cmake | 15 +++++---------- cmake/BLTPrivateMacros.cmake | 16 +++++++++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 970b362d5..b7e5c478c 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1286,7 +1286,7 @@ endmacro(blt_combine_static_libraries) ## ## Defaults: ## CHILDREN = false (non recursive) -## PROP_REGEX = .* (print every property) +## PROP_REGEX = undefined (print every property) ## ##------------------------------------------------------------------------------ macro(blt_print_target_properties) @@ -1309,11 +1309,6 @@ macro(blt_print_target_properties) set(arg_CHILDREN FALSE) endif() - # set default value - if(NOT DEFINED arg_PROP_REGEX) - set(arg_PROP_REGEX ".*") - endif() - # check if this is a valid cmake target or blt_registered target set(_is_cmake_target FALSE) if(TARGET ${arg_TARGET}) @@ -1331,7 +1326,7 @@ macro(blt_print_target_properties) "This macro applies only to valid cmake targets or blt_registered targets.") else() set(_temp_target "${arg_TARGET}") - message (STATUS "==========${_temp_target}==========") + message (STATUS "==========${_temp_target} START==========") # print properties blt_print_target_properties_private(TARGET ${arg_TARGET} @@ -1345,15 +1340,15 @@ macro(blt_print_target_properties) # print all targets from dependency tree foreach(t ${tlist}) - message (STATUS "---${_temp_target}->${t}---") + message (STATUS "---${_temp_target}->${t} START---") blt_print_target_properties_private(TARGET ${t} PROP_REGEX ${arg_PROP_REGEX}) - message (STATUS "---${_temp_target}->${t}---") + message (STATUS "---${_temp_target}->${t} END---") endforeach() unset(tlist) endif() - message (STATUS "==========${_temp_target}==========\n") + message (STATUS "==========${_temp_target} END==========\n") endif() unset(_target_upper) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 2c02fec0c..54c3b25f1 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -897,9 +897,12 @@ macro(blt_print_target_properties_private) foreach (prop ${_property_list}) string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) get_property(_propval TARGET ${arg_TARGET} PROPERTY ${prop} SET) - if ("${_propval}" AND "${prop}" MATCHES "${arg_PROP_REGEX}") - get_target_property(_propval ${arg_TARGET} ${prop}) - message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") + if ("${_propval}") + if ((NOT DEFINED arg_PROP_REGEX) OR + (DEFINED arg_PROP_REGEX AND "${prop}" MATCHES "${arg_PROP_REGEX}")) + get_target_property(_propval ${arg_TARGET} ${prop}) + message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") + endif() endif() endforeach() unset(_property_list) @@ -913,8 +916,11 @@ macro(blt_print_target_properties_private) ## Filter to get variables of the form _BLT__ and print get_cmake_property(_variable_names VARIABLES) foreach (prop ${_variable_names}) - if("${prop}" MATCHES "^${_target_prefix}" AND "${prop}" MATCHES "${arg_PROP_REGEX}") - message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") + if("${prop}" MATCHES "^${_target_prefix}") + if ((NOT DEFINED arg_PROP_REGEX) OR + (DEFINED arg_PROP_REGEX AND "${prop}" MATCHES "${arg_PROP_REGEX}")) + message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") + endif() endif() endforeach() unset(_target_prefix) From c7fe9543189b4d5d07cb2a14f487355b6331a99a Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Mon, 22 Aug 2022 14:34:25 -0700 Subject: [PATCH 28/60] tlist doesn't need a particular name --- cmake/BLTPrivateMacros.cmake | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 54c3b25f1..93e7ea04e 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -938,9 +938,6 @@ endmacro(blt_print_target_properties_private) ## Store all target's dependancies (link libraries and interface link libraries) ## recursively in TLIST. ## -## NOTE: TLIST should be an empty string at the start. TLIST must be called tlist -## and this function does NOT remove duplicates. -## ##------------------------------------------------------------------------------ macro(blt_find_all_targets_recursive) @@ -956,8 +953,9 @@ macro(blt_find_all_targets_recursive) if(NOT DEFINED arg_TARGET) message(FATAL_ERROR "TARGET is a required parameter for the blt_find_all_targets_recursive macro") endif() - if(NOT DEFINED tlist) - message(FATAL_ERROR "TLIST parameter must be named tlist for the blt_find_all_targets_recursive macro") + + if(NOT DEFINED ${arg_TLIST}) + message(FATAL_ERROR "TLIST is a required parameter for the blt_find_all_targets_recursive macro") endif() # check if this is a valid cmake target @@ -982,8 +980,8 @@ macro(blt_find_all_targets_recursive) # recursive call foreach(t ${_property_list}) - list(APPEND tlist ${t}) - blt_find_all_targets_recursive(TARGET ${t} TLIST tlist) + list(APPEND ${arg_TLIST} ${t}) + blt_find_all_targets_recursive(TARGET ${t} TLIST ${arg_TLIST}) endforeach() unset(_property_list) From 56b745d76907643d20cd85bd85a1e58d7cc6f304 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 14:44:17 -0700 Subject: [PATCH 29/60] docs and simpler print --- RELEASE-NOTES.md | 4 ++++ cmake/BLTMacros.cmake | 7 ------- docs/api/target_properties.rst | 10 +++++++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index cca7d499d..0570565d8 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -12,6 +12,10 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Added - Added 'blt_convert_to_system_includes' macro to convert existing interface includes to system interface includes. +### Changed +- Added extra options to 'blt_print_target_properties' macro to print properties of +target's children as well as limit the properties printed with a regular expression. + ## [Version 0.5.1] - Release date 2022-04-22 ### Added diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index b7e5c478c..2751404e2 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1325,9 +1325,6 @@ macro(blt_print_target_properties) message (STATUS "[blt_print_target_properties] Invalid argument '${arg_TARGET}'. " "This macro applies only to valid cmake targets or blt_registered targets.") else() - set(_temp_target "${arg_TARGET}") - message (STATUS "==========${_temp_target} START==========") - # print properties blt_print_target_properties_private(TARGET ${arg_TARGET} PROP_REGEX ${arg_PROP_REGEX}) @@ -1340,15 +1337,11 @@ macro(blt_print_target_properties) # print all targets from dependency tree foreach(t ${tlist}) - message (STATUS "---${_temp_target}->${t} START---") blt_print_target_properties_private(TARGET ${t} PROP_REGEX ${arg_PROP_REGEX}) - message (STATUS "---${_temp_target}->${t} END---") endforeach() unset(tlist) endif() - - message (STATUS "==========${_temp_target} END==========\n") endif() unset(_target_upper) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 70af9464a..c7442ed87 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -155,13 +155,21 @@ blt_print_target_properties .. code-block:: cmake - blt_print_target_properties(TARGET ) + blt_print_target_properties(TARGET + CHILDREN + PROP_REGEX ) Prints out all properties of the given target. TARGET Name of CMake target +CHILDREN + Whether or not to print the properties of the target's children (false by default) + +PROP_REGEX + Limit the properties to print (all by default) + The given target must be added via ``add_executable()`` or ``add_library()`` or with the corresponding :ref:`blt_add_executable`, :ref:`blt_add_library`, :ref:`blt_import_library`, or :ref:`blt_register_library` macros. From f6b9ac5b369350197dfc8e2b1aadeb837b4fa070 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 15:23:57 -0700 Subject: [PATCH 30/60] adding tioga --- .gitlab/build_tioga.yml | 46 +++++++++++++ .../clang@14.0.0_hip.cmake | 65 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 .gitlab/build_tioga.yml create mode 100644 host-configs/llnl/toss_4_x86_64_ib_cray/clang@14.0.0_hip.cmake diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml new file mode 100644 index 000000000..aa1db4e29 --- /dev/null +++ b/.gitlab/build_tioga.yml @@ -0,0 +1,46 @@ +#### +# This is the shared configuration of jobs for tioga +.on_tioga: + tags: + - shell + - tioga + rules: + - if: '$CI_COMMIT_BRANCH =~ /_qnone/ || $ON_TIOGA == "OFF"' #run except if ... + when: never + - when: on_success + +#### +# Template +.src_build_on_tioga: + stage: build + variables: + ALLOC_COMMAND: "srun -p pdebug -t 25 -N 1 " + EXTRA_OPTIONS: "--test-serial" + extends: [.src_build_script, .on_tioga, .src_workflow] + needs: [] + +.full_build_on_tioga: + stage: build + variables: + ALLOC_COMMAND: "srun -p pbatch -t 60 -N 1 " + extends: [.full_build_script, .on_tioga, .full_workflow] + needs: [] + +#### +# PR Build jobs +tioga-clang_14_0_0_hip-src: + variables: + COMPILER: "clang@14.0.0_hip" + HOST_CONFIG: "tioga-toss_4_x86_64_ib_cray-${COMPILER}.cmake" + extends: .src_build_on_tioga + allow_failure: true + +#### +# Full Build jobs +tioga-clang_14_0_0_hip-full: + variables: + COMPILER: "clang@14.0.0_hip" + SPEC: "%${COMPILER}~openmp+rocm+mfem+c2c" + EXTRASPEC: "amdgpu_target=gfx90a ^raja~openmp+rocm ^umpire~openmp+rocm" + extends: .full_build_on_tioga + allow_failure: true diff --git a/host-configs/llnl/toss_4_x86_64_ib_cray/clang@14.0.0_hip.cmake b/host-configs/llnl/toss_4_x86_64_ib_cray/clang@14.0.0_hip.cmake new file mode 100644 index 000000000..2c5302944 --- /dev/null +++ b/host-configs/llnl/toss_4_x86_64_ib_cray/clang@14.0.0_hip.cmake @@ -0,0 +1,65 @@ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# CMake executable path: /usr/tce/packages/cmake/cmake-3.21.1/bin/cmake +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Compilers +#------------------------------------------------------------------------------ +# Compiler Spec: clang@14.0.0 +#------------------------------------------------------------------------------ +set(CMAKE_C_COMPILER "/opt/rocm-5.1.1/llvm/bin/amdclang" CACHE PATH "") + +set(CMAKE_CXX_COMPILER "/opt/rocm-5.1.1/llvm/bin/amdclang++" CACHE PATH "") + +set(CMAKE_Fortran_COMPILER "/opt/rocm-5.1.1/llvm/bin/amdflang" CACHE PATH "") + +set(CMAKE_Fortran_FLAGS "-Mfreeform" CACHE STRING "") + +set(ENABLE_FORTRAN ON CACHE BOOL "") + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(MPI_C_COMPILER "/usr/tce/packages/cray-mpich-tce/cray-mpich-8.1.16-rocmcc-5.1.1/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/usr/tce/packages/cray-mpich-tce/cray-mpich-8.1.16-rocmcc-5.1.1/bin/mpicxx" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/usr/tce/packages/cray-mpich-tce/cray-mpich-8.1.16-rocmcc-5.1.1/bin/mpif90" CACHE PATH "") + +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "") + +set(ENABLE_MPI ON CACHE BOOL "") + +#------------------------------------------------------------------------------ +# Hardware +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ + +# HIP + +#------------------------------------------------------------------------------ + + +set(ENABLE_HIP ON CACHE BOOL "") + +set(HIP_ROOT_DIR "/opt/rocm-5.1.1/hip" CACHE STRING "") + +set(HIP_CLANG_PATH "/opt/rocm-5.1.1/hip/../llvm/bin" CACHE STRING "") + +set(CMAKE_HIP_ARCHITECTURES "gfx90a" CACHE STRING "") + +set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags -L/opt/rocm-5.1.1/hip/../llvm/lib -L/opt/rocm-5.1.1/hip/lib -Wl,-rpath,/opt/rocm-5.1.1/hip/../llvm/lib:/opt/rocm-5.1.1/hip/lib -lpgmath -lflang -lflangrti -lompstub -lamdhip64 -L/opt/rocm-5.1.1/hip/../lib64 -Wl,-rpath,/opt/rocm-5.1.1/hip/../lib64 -lhsakmt -lamd_comgr" CACHE STRING "") + +#------------------------------------------------ +# Hardware Specifics +#------------------------------------------------ + +set(ENABLE_OPENMP OFF CACHE BOOL "") + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") From e86f9796a3bd6fc127eed476585c1da35e013903 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 15:28:13 -0700 Subject: [PATCH 31/60] remove corona and add tioga to ci --- .gitlab-ci.yml | 2 +- .gitlab/build_corona.yml | 51 ---------------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 .gitlab/build_corona.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 620d4da42..5b5d969db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,4 +35,4 @@ stages: include: - local: .gitlab/build_quartz.yml - local: .gitlab/build_lassen.yml - - local: .gitlab/build_corona.yml + - local: .gitlab/build_tioga.yml diff --git a/.gitlab/build_corona.yml b/.gitlab/build_corona.yml deleted file mode 100644 index ee19a551a..000000000 --- a/.gitlab/build_corona.yml +++ /dev/null @@ -1,51 +0,0 @@ -#### -# This is the share configuration of jobs for corona -.on_corona: - tags: - - shell - - corona - rules: - - if: '$CI_COMMIT_BRANCH =~ /_qnone/ || $ON_CORONA == "OFF"' #run except if ... - when: never - - if: '$CI_JOB_NAME =~ /corona_release/' - when: always - - when: on_success - -#### -# In pre-build phase, allocate a node for builds -corona_allocate: - variables: - GIT_STRATEGY: none - extends: [.on_corona] - stage: allocate - script: - - salloc -p pbatch -N 1 -t 10 --no-shell --job-name=${PROJECT_ALLOC_NAME} --mpibind=off - needs: [] - -#### -# In post-build phase, deallocate resources -# Note : make sure this is run even on build phase failure -corona_release: - variables: - GIT_STRATEGY: none - extends: [.on_corona] - stage: release - script: - - export JOBID=$(squeue -h --name=${PROJECT_ALLOC_NAME} --format=%A) - - if [[ -n "${JOBID}" ]]; then scancel ${JOBID}; fi - -#### -# Template -.build_on_corona: - stage: build - variables: - ALLOC_COMMAND: "srun -p pbatch -t 10 -N 1 ${ASSIGN_ID} --interactive" - extends: [.build_script, .on_corona] - needs: [corona_allocate] - -#### -# Build jobs -corona-rocm_4_5_2_hip: - variables: - HOST_CONFIG: "rocm@4.5.2_hip.cmake" - extends: [.build_on_corona] From 9d977f5303e5094c536642cb7296137fc64467e6 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 16:04:40 -0700 Subject: [PATCH 32/60] no --test-serial --- .gitlab/build_tioga.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index aa1db4e29..a98ab9e27 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -15,7 +15,6 @@ stage: build variables: ALLOC_COMMAND: "srun -p pdebug -t 25 -N 1 " - EXTRA_OPTIONS: "--test-serial" extends: [.src_build_script, .on_tioga, .src_workflow] needs: [] From b6cb3a493248cfc980e894a96e4d3120330bfbbb Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 16:46:39 -0700 Subject: [PATCH 33/60] fix errors --- .gitlab/build_tioga.yml | 48 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index a98ab9e27..58718d249 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -10,36 +10,42 @@ - when: on_success #### -# Template -.src_build_on_tioga: - stage: build +# In pre-build phase, allocate a node for builds +tioga_allocate: variables: - ALLOC_COMMAND: "srun -p pdebug -t 25 -N 1 " - extends: [.src_build_script, .on_tioga, .src_workflow] + GIT_STRATEGY: none + extends: [.on_tioga] + stage: allocate + script: + - salloc -p pbatch -N 1 -t 10 --no-shell --job-name=${PROJECT_ALLOC_NAME} --mpibind=off needs: [] -.full_build_on_tioga: - stage: build +#### +# In post-build phase, deallocate resources +# Note : make sure this is run even on build phase failure +tioga_release: variables: - ALLOC_COMMAND: "srun -p pbatch -t 60 -N 1 " - extends: [.full_build_script, .on_tioga, .full_workflow] - needs: [] + GIT_STRATEGY: none + extends: [.on_tioga] + stage: release + script: + - export JOBID=$(squeue -h --name=${PROJECT_ALLOC_NAME} --format=%A) + - if [[ -n "${JOBID}" ]]; then scancel ${JOBID}; fi #### -# PR Build jobs -tioga-clang_14_0_0_hip-src: +# Template +.src_build_on_tioga: + stage: build variables: - COMPILER: "clang@14.0.0_hip" - HOST_CONFIG: "tioga-toss_4_x86_64_ib_cray-${COMPILER}.cmake" - extends: .src_build_on_tioga - allow_failure: true + ALLOC_COMMAND: "srun -p pbatch -t 10 -N 1 ${ASSIGN_ID} --interactive" + extends: [.build_script, .on_tioga] + needs: [tioga_allocate] #### -# Full Build jobs -tioga-clang_14_0_0_hip-full: +# Build jobs +tioga-clang_14_0_0_hip: variables: COMPILER: "clang@14.0.0_hip" - SPEC: "%${COMPILER}~openmp+rocm+mfem+c2c" - EXTRASPEC: "amdgpu_target=gfx90a ^raja~openmp+rocm ^umpire~openmp+rocm" - extends: .full_build_on_tioga + HOST_CONFIG: "tioga-toss_4_x86_64_ib_cray-${COMPILER}.cmake" + extends: .build_on_tioga allow_failure: true From 0e79e466f062389be8da1adecc214fb1a338c4ac Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 17:00:42 -0700 Subject: [PATCH 34/60] no build_on_tioga --- .gitlab/build_tioga.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index 58718d249..134e07557 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -47,5 +47,4 @@ tioga-clang_14_0_0_hip: variables: COMPILER: "clang@14.0.0_hip" HOST_CONFIG: "tioga-toss_4_x86_64_ib_cray-${COMPILER}.cmake" - extends: .build_on_tioga allow_failure: true From e950724289ed8a19891269216f87d63b6369bf00 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 23 Aug 2022 17:30:18 -0700 Subject: [PATCH 35/60] typo --- .gitlab/build_tioga.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index 134e07557..9503caf15 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -47,4 +47,5 @@ tioga-clang_14_0_0_hip: variables: COMPILER: "clang@14.0.0_hip" HOST_CONFIG: "tioga-toss_4_x86_64_ib_cray-${COMPILER}.cmake" + extends: .src_build_on_tioga allow_failure: true From 8cbd0d389606a99282076d6a6f89d2b317aefebf Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 30 Aug 2022 16:49:10 -0700 Subject: [PATCH 36/60] using flux --- .gitlab/build_tioga.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index 9503caf15..651e6ea9f 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -17,7 +17,7 @@ tioga_allocate: extends: [.on_tioga] stage: allocate script: - - salloc -p pbatch -N 1 -t 10 --no-shell --job-name=${PROJECT_ALLOC_NAME} --mpibind=off + - flux mini run -t10m -n1 -o mpibind=off --setattr=user.comment=${PROJECT_ALLOC_NAME} needs: [] #### From 7f57b0f56eda1443a9f1b079d04af112215912dd Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Thu, 1 Sep 2022 16:52:31 -0700 Subject: [PATCH 37/60] update flux cmds --- .gitlab/build_tioga.yml | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index 651e6ea9f..c2599a98b 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -9,37 +9,13 @@ when: never - when: on_success -#### -# In pre-build phase, allocate a node for builds -tioga_allocate: - variables: - GIT_STRATEGY: none - extends: [.on_tioga] - stage: allocate - script: - - flux mini run -t10m -n1 -o mpibind=off --setattr=user.comment=${PROJECT_ALLOC_NAME} - needs: [] - -#### -# In post-build phase, deallocate resources -# Note : make sure this is run even on build phase failure -tioga_release: - variables: - GIT_STRATEGY: none - extends: [.on_tioga] - stage: release - script: - - export JOBID=$(squeue -h --name=${PROJECT_ALLOC_NAME} --format=%A) - - if [[ -n "${JOBID}" ]]; then scancel ${JOBID}; fi - #### # Template .src_build_on_tioga: stage: build variables: - ALLOC_COMMAND: "srun -p pbatch -t 10 -N 1 ${ASSIGN_ID} --interactive" + ALLOC_COMMAND: "flux mini run -t10m -n1" extends: [.build_script, .on_tioga] - needs: [tioga_allocate] #### # Build jobs From 4141f19afdf9204c23c70b54f28a77a6d1fa81dd Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Tue, 13 Sep 2022 10:26:04 -0700 Subject: [PATCH 38/60] fixed host-config path --- .gitlab/build_tioga.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab/build_tioga.yml b/.gitlab/build_tioga.yml index c2599a98b..32f94c857 100644 --- a/.gitlab/build_tioga.yml +++ b/.gitlab/build_tioga.yml @@ -21,7 +21,6 @@ # Build jobs tioga-clang_14_0_0_hip: variables: - COMPILER: "clang@14.0.0_hip" - HOST_CONFIG: "tioga-toss_4_x86_64_ib_cray-${COMPILER}.cmake" + HOST_CONFIG: "clang@14.0.0_hip.cmake" extends: .src_build_on_tioga allow_failure: true From 3d08ef371023685a1b07f79532f4865a6401559a Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 14 Sep 2022 16:29:40 -0700 Subject: [PATCH 39/60] PROPERTY_VALUE_REGEX, prints blt_reg depends_on --- cmake/BLTMacros.cmake | 26 ++++++++++++++++++-------- cmake/BLTPrivateMacros.cmake | 33 ++++++++++++++++++++------------- tests/internal/CMakeLists.txt | 7 ++++++- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 2751404e2..70b408d00 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1276,23 +1276,25 @@ endmacro(blt_combine_static_libraries) ##------------------------------------------------------------------------------ ## blt_print_target_properties(TARGET ## CHILDREN -## PROP_REGEX ) +## PROPERTY_NAME_REGEX +## PROPERTY_VALUE_REGEX ) ## ## Prints out properties of the given target. ## ## Has the options to print target's link libraries and interface link libraries -## with the CHILDREN argument, as well as specific properties using a regular -## expression. +## with the CHILDREN argument, as well as specific properties using regular +## expressions. ## ## Defaults: ## CHILDREN = false (non recursive) -## PROP_REGEX = undefined (print every property) +## PROPERTY_NAME_REGEX = .* (print every property name) +## PROPERTY_VALUE_REGEX = .* (print every property value) ## ##------------------------------------------------------------------------------ macro(blt_print_target_properties) set(options) - set(singleValuedArgs TARGET CHILDREN PROP_REGEX) + set(singleValuedArgs TARGET CHILDREN PROPERTY_NAME_REGEX PROPERTY_VALUE_REGEX) set(multiValuedArgs) # parse the arguments to the macro @@ -1304,11 +1306,19 @@ macro(blt_print_target_properties) message(FATAL_ERROR "TARGET is a required parameter for the blt_print_target_properties macro") endif() - # set default value + # set default values if(NOT DEFINED arg_CHILDREN) set(arg_CHILDREN FALSE) endif() + if(NOT DEFINED arg_PROPERTY_NAME_REGEX) + set(arg_PROPERTY_NAME_REGEX ".*") + endif() + + if(NOT DEFINED arg_PROPERTY_VALUE_REGEX) + set(arg_PROPERTY_VALUE_REGEX ".*") + endif() + # check if this is a valid cmake target or blt_registered target set(_is_cmake_target FALSE) if(TARGET ${arg_TARGET}) @@ -1327,7 +1337,7 @@ macro(blt_print_target_properties) else() # print properties blt_print_target_properties_private(TARGET ${arg_TARGET} - PROP_REGEX ${arg_PROP_REGEX}) + PROPERTY_NAME_REGEX ${arg_PROPERTY_NAME_REGEX}) if(${arg_CHILDREN}) # find all targets from dependency tree @@ -1338,7 +1348,7 @@ macro(blt_print_target_properties) # print all targets from dependency tree foreach(t ${tlist}) blt_print_target_properties_private(TARGET ${t} - PROP_REGEX ${arg_PROP_REGEX}) + PROPERTY_NAME_REGEX ${arg_PROPERTY_NAME_REGEX}) endforeach() unset(tlist) endif() diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 93e7ea04e..914271244 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -846,14 +846,15 @@ endmacro(blt_clean_target) ##------------------------------------------------------------------------------ ## blt_print_target_properties_private(TARGET -## PROP_REGEX ) +## PROPERTY_NAME_REGEX +## PROPERTY_VALUE_REGEX ) ## ## Prints target properties of one target ##------------------------------------------------------------------------------ macro(blt_print_target_properties_private) set(options) - set(singleValuedArgs TARGET PROP_REGEX) + set(singleValuedArgs TARGET PROPERTY_NAME_REGEX PROPERTY_VALUE_REGEX) set(multiValuedArgs) ## parse the arguments to the macro @@ -897,12 +898,9 @@ macro(blt_print_target_properties_private) foreach (prop ${_property_list}) string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) get_property(_propval TARGET ${arg_TARGET} PROPERTY ${prop} SET) - if ("${_propval}") - if ((NOT DEFINED arg_PROP_REGEX) OR - (DEFINED arg_PROP_REGEX AND "${prop}" MATCHES "${arg_PROP_REGEX}")) - get_target_property(_propval ${arg_TARGET} ${prop}) - message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") - endif() + if ("${_propval}" AND "${prop}" MATCHES "${arg_PROPERTY_NAME_REGEX}" AND "${_propval}" MATCHES "${arg_PROPERTY_VALUE_REGEX}") + get_target_property(_propval ${arg_TARGET} ${prop}) + message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") endif() endforeach() unset(_property_list) @@ -916,11 +914,8 @@ macro(blt_print_target_properties_private) ## Filter to get variables of the form _BLT__ and print get_cmake_property(_variable_names VARIABLES) foreach (prop ${_variable_names}) - if("${prop}" MATCHES "^${_target_prefix}") - if ((NOT DEFINED arg_PROP_REGEX) OR - (DEFINED arg_PROP_REGEX AND "${prop}" MATCHES "${arg_PROP_REGEX}")) - message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") - endif() + if("${prop}" MATCHES "^${_target_prefix}" AND "${prop}" MATCHES "${arg_PROPERTY_NAME_REGEX}" AND "${_propval}" MATCHES "${arg_PROPERTY_VALUE_REGEX}") + message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") endif() endforeach() unset(_target_prefix) @@ -958,6 +953,18 @@ macro(blt_find_all_targets_recursive) message(FATAL_ERROR "TLIST is a required parameter for the blt_find_all_targets_recursive macro") endif() + # check if this is a blt_registered target + string(TOUPPER ${arg_TARGET} _target_upper) + if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) + # recursive call + set (_depends_on "${_BLT_${_target_upper}_DEPENDS_ON}") + foreach(t ${_depends_on}) + list(APPEND ${arg_TLIST} ${t}) + blt_find_all_targets_recursive(TARGET ${t} TLIST ${arg_TLIST}) + endforeach() + unset(_depends_on) + endif() + # check if this is a valid cmake target if(TARGET ${arg_TARGET}) # get link libaries if whitelisted diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 704150a0d..61de95fbb 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -260,9 +260,14 @@ endif() message(STATUS "Exercising blt_print_target_properties macro on some targets and non-targets.") message(STATUS "") foreach(_target gtest example t_example_smoke not-a-target blt_header_only mpi cuda cuda_runtime blt::hip blt::hip_runtime) - blt_print_target_properties(TARGET ${_target}) + blt_print_target_properties(TARGET ${_target} CHILDREN true) endforeach() +message(STATUS "Exercising blt_print_target_properties macro on some blt_registered target.") +blt_register_library(NAME foo) +blt_register_library(NAME bar DEPENDS_ON foo) +blt_print_target_properties(TARGET bar CHILDREN true) + add_subdirectory(src/object_library_test) if(ENABLE_CLANGQUERY OR ENABLE_CLANGTIDY) From 62261a0373179094ccbd81963ec929c7142b42c4 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman <100869159+chapman39@users.noreply.github.com> Date: Fri, 16 Sep 2022 15:09:12 -0700 Subject: [PATCH 40/60] typo Co-authored-by: Kenny Weiss --- cmake/BLTPrivateMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 914271244..388b67d51 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -930,7 +930,7 @@ endmacro(blt_print_target_properties_private) ##------------------------------------------------------------------------------ ## blt_find_all_targets_recursive(TARGET TLIST tlist) ## -## Store all target's dependancies (link libraries and interface link libraries) +## Store all target's dependencies (link libraries and interface link libraries) ## recursively in TLIST. ## ##------------------------------------------------------------------------------ From 0fcafac3da15904cccaa99f7d64beb515a5c43e1 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Fri, 16 Sep 2022 16:02:15 -0700 Subject: [PATCH 41/60] updated docs, added examples, fixed bugs --- cmake/BLTMacros.cmake | 8 +++++--- cmake/BLTPrivateMacros.cmake | 20 +++++++++++++++----- docs/api/target_properties.rst | 24 ++++++++++++++++++------ tests/internal/CMakeLists.txt | 17 ++++++++++++----- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 70b408d00..70864db5e 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1332,12 +1332,13 @@ macro(blt_print_target_properties) endif() if(NOT _is_cmake_target AND NOT _is_blt_registered_target) - message (STATUS "[blt_print_target_properties] Invalid argument '${arg_TARGET}'. " + message (STATUS "[blt_print_target_properties] Invalid argument '${arg_TARGET}'." "This macro applies only to valid cmake targets or blt_registered targets.") else() # print properties blt_print_target_properties_private(TARGET ${arg_TARGET} - PROPERTY_NAME_REGEX ${arg_PROPERTY_NAME_REGEX}) + PROPERTY_NAME_REGEX ${arg_PROPERTY_NAME_REGEX} + PROPERTY_VALUE_REGEX ${arg_PROPERTY_VALUE_REGEX}) if(${arg_CHILDREN}) # find all targets from dependency tree @@ -1348,7 +1349,8 @@ macro(blt_print_target_properties) # print all targets from dependency tree foreach(t ${tlist}) blt_print_target_properties_private(TARGET ${t} - PROPERTY_NAME_REGEX ${arg_PROPERTY_NAME_REGEX}) + PROPERTY_NAME_REGEX ${arg_PROPERTY_NAME_REGEX} + PROPERTY_VALUE_REGEX ${arg_PROPERTY_VALUE_REGEX}) endforeach() unset(tlist) endif() diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 914271244..0742a324f 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -863,18 +863,26 @@ macro(blt_print_target_properties_private) ## check if this is a valid cmake target or blt_registered target set(_is_cmake_target FALSE) + set(_target_type_str "") if(TARGET ${arg_TARGET}) set(_is_cmake_target TRUE) - message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a cmake target") + set(_target_type_str "${_target_type_str}cmake target") endif() set(_is_blt_registered_target FALSE) string(TOUPPER ${arg_TARGET} _target_upper) if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) set(_is_blt_registered_target TRUE) - message (STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a blt_registered target") + if (_is_cmake_target) + set(_target_type_str "${_target_type_str} and a ") + endif() + set(_target_type_str "${_target_type_str}blt_registered target") endif() + if (_is_cmake_target OR _is_blt_registered_target) + message(STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a ${_target_type_str}") + endif() + unset(_target_type_str) if(_is_cmake_target) ## Solution adapted from https://stackoverflow.com/q/32183975 @@ -898,9 +906,11 @@ macro(blt_print_target_properties_private) foreach (prop ${_property_list}) string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) get_property(_propval TARGET ${arg_TARGET} PROPERTY ${prop} SET) - if ("${_propval}" AND "${prop}" MATCHES "${arg_PROPERTY_NAME_REGEX}" AND "${_propval}" MATCHES "${arg_PROPERTY_VALUE_REGEX}") + if ("${_propval}" AND "${prop}" MATCHES "${arg_PROPERTY_NAME_REGEX}") get_target_property(_propval ${arg_TARGET} ${prop}) - message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") + if ("${_propval}" MATCHES "${arg_PROPERTY_VALUE_REGEX}") + message (STATUS "[${arg_TARGET} property] ${prop}: ${_propval}") + endif() endif() endforeach() unset(_property_list) @@ -914,7 +924,7 @@ macro(blt_print_target_properties_private) ## Filter to get variables of the form _BLT__ and print get_cmake_property(_variable_names VARIABLES) foreach (prop ${_variable_names}) - if("${prop}" MATCHES "^${_target_prefix}" AND "${prop}" MATCHES "${arg_PROPERTY_NAME_REGEX}" AND "${_propval}" MATCHES "${arg_PROPERTY_VALUE_REGEX}") + if("${prop}" MATCHES "^${_target_prefix}" AND "${prop}" MATCHES "${arg_PROPERTY_NAME_REGEX}" AND "${${prop}}" MATCHES "${arg_PROPERTY_VALUE_REGEX}") message (STATUS "[${arg_TARGET} property] ${prop}: ${${prop}}") endif() endforeach() diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index c7442ed87..4a3e76943 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -155,20 +155,24 @@ blt_print_target_properties .. code-block:: cmake - blt_print_target_properties(TARGET - CHILDREN - PROP_REGEX ) + blt_print_target_properties(TARGET + CHILDREN + PROPERTY_NAME_REGEX + PROPERTY_VALUE_REGEX ) Prints out all properties of the given target. TARGET - Name of CMake target + Name of CMake target (required) CHILDREN Whether or not to print the properties of the target's children (false by default) -PROP_REGEX - Limit the properties to print (all by default) +PROPERTY_NAME_REGEX + Limit the properties to print by name (all by default) + +PROPERTY_VALUE_REGEX + Limit the properties to print by value (all by default) The given target must be added via ``add_executable()`` or ``add_library()`` or with the corresponding :ref:`blt_add_executable`, :ref:`blt_add_library`, @@ -177,6 +181,14 @@ with the corresponding :ref:`blt_add_executable`, :ref:`blt_add_library`, Output is of the form for each property: | [ property] : +.. code-block:: cmake + :caption: **Example** + :linenos: + + blt_print_target_properties(TARGET foo) + blt_print_target_properties(TARGET foo CHILDREN TRUE) + blt_print_target_properties(TARGET foo CHILDREN TRUE PROPERTY_NAME_REGEX "CXX") + blt_print_target_properties(TARGET foo PROPERTY_NAME_REGEX "CXX" PROPERTY_VALUE_REGEX "ON") .. _blt_set_target_folder: diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 61de95fbb..5061cefd1 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -257,13 +257,20 @@ if (ENABLE_CUDA AND ENABLE_MPI AND NUM_MPI_TASKS 4) endif() -message(STATUS "Exercising blt_print_target_properties macro on some targets and non-targets.") message(STATUS "") +message(STATUS "Exercising blt_print_target_properties macro default options.") foreach(_target gtest example t_example_smoke not-a-target blt_header_only mpi cuda cuda_runtime blt::hip blt::hip_runtime) - blt_print_target_properties(TARGET ${_target} CHILDREN true) + blt_print_target_properties(TARGET ${_target}) endforeach() -message(STATUS "Exercising blt_print_target_properties macro on some blt_registered target.") +message(STATUS "") +message(STATUS "Exercising blt_print_target_properties macro using regex arguments.") +foreach(_target gtest example t_example_smoke not-a-target blt_header_only mpi cuda cuda_runtime blt::hip blt::hip_runtime) + blt_print_target_properties(TARGET ${_target} CHILDREN true PROPERTY_NAME_REGEX "CXX_STANDARD_REQUIRED" PROPERTY_VALUE_REGEX "ON") +endforeach() + +message(STATUS "") +message(STATUS "Exercising blt_print_target_properties macro on dummy blt_registered target.") blt_register_library(NAME foo) blt_register_library(NAME bar DEPENDS_ON foo) blt_print_target_properties(TARGET bar CHILDREN true) @@ -271,11 +278,11 @@ blt_print_target_properties(TARGET bar CHILDREN true) add_subdirectory(src/object_library_test) if(ENABLE_CLANGQUERY OR ENABLE_CLANGTIDY) - add_subdirectory(src/static_analysis) + add_subdirectory(src/static_analysis) endif() if(ENABLE_HIP) - add_subdirectory(src/hip_defines_test) + add_subdirectory(src/hip_defines_test) endif() add_subdirectory(unit) From d3c40a1f762d63924f8e1179e284e24457a3a30a Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Fri, 16 Sep 2022 16:07:20 -0700 Subject: [PATCH 42/60] rename recursive function --- cmake/BLTMacros.cmake | 2 +- cmake/BLTPrivateMacros.cmake | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 70864db5e..82da9b917 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1343,7 +1343,7 @@ macro(blt_print_target_properties) if(${arg_CHILDREN}) # find all targets from dependency tree set(tlist "") - blt_find_all_targets_recursive(TARGET ${arg_TARGET} TLIST tlist) + blt_find_target_dependencies(TARGET ${arg_TARGET} TLIST tlist) blt_list_remove_duplicates(TO tlist) # print all targets from dependency tree diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index f05236856..1938b682d 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -938,13 +938,13 @@ macro(blt_print_target_properties_private) endmacro(blt_print_target_properties_private) ##------------------------------------------------------------------------------ -## blt_find_all_targets_recursive(TARGET TLIST tlist) +## blt_find_target_dependencies(TARGET TLIST tlist) ## ## Store all target's dependencies (link libraries and interface link libraries) ## recursively in TLIST. ## ##------------------------------------------------------------------------------ -macro(blt_find_all_targets_recursive) +macro(blt_find_target_dependencies) set(options) set(singleValuedArgs TARGET TLIST) @@ -956,11 +956,11 @@ macro(blt_find_all_targets_recursive) # check for required arguments if(NOT DEFINED arg_TARGET) - message(FATAL_ERROR "TARGET is a required parameter for the blt_find_all_targets_recursive macro") + message(FATAL_ERROR "TARGET is a required parameter for the blt_find_target_dependencies macro") endif() if(NOT DEFINED ${arg_TLIST}) - message(FATAL_ERROR "TLIST is a required parameter for the blt_find_all_targets_recursive macro") + message(FATAL_ERROR "TLIST is a required parameter for the blt_find_target_dependencies macro") endif() # check if this is a blt_registered target @@ -970,7 +970,7 @@ macro(blt_find_all_targets_recursive) set (_depends_on "${_BLT_${_target_upper}_DEPENDS_ON}") foreach(t ${_depends_on}) list(APPEND ${arg_TLIST} ${t}) - blt_find_all_targets_recursive(TARGET ${t} TLIST ${arg_TLIST}) + blt_find_target_dependencies(TARGET ${t} TLIST ${arg_TLIST}) endforeach() unset(_depends_on) endif() @@ -998,10 +998,10 @@ macro(blt_find_all_targets_recursive) # recursive call foreach(t ${_property_list}) list(APPEND ${arg_TLIST} ${t}) - blt_find_all_targets_recursive(TARGET ${t} TLIST ${arg_TLIST}) + blt_find_target_dependencies(TARGET ${t} TLIST ${arg_TLIST}) endforeach() unset(_property_list) unset(_propval) endif() -endmacro(blt_find_all_targets_recursive) +endmacro(blt_find_target_dependencies) From f314801ccc6b7a67d68443a495f17f7c18ef7c50 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Mon, 19 Sep 2022 13:32:35 -0700 Subject: [PATCH 43/60] infinite loop edge case fix --- cmake/BLTPrivateMacros.cmake | 14 ++++++++------ tests/internal/CMakeLists.txt | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 1938b682d..797fdebfd 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -943,11 +943,12 @@ endmacro(blt_print_target_properties_private) ## Store all target's dependencies (link libraries and interface link libraries) ## recursively in TLIST. ## +## ##------------------------------------------------------------------------------ macro(blt_find_target_dependencies) set(options) - set(singleValuedArgs TARGET TLIST) + set(singleValuedArgs TARGET TLIST CUR_TARGET) set(multiValuedArgs) # parse the arguments to the macro @@ -963,14 +964,15 @@ macro(blt_find_target_dependencies) message(FATAL_ERROR "TLIST is a required parameter for the blt_find_target_dependencies macro") endif() - # check if this is a blt_registered target string(TOUPPER ${arg_TARGET} _target_upper) if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) # recursive call set (_depends_on "${_BLT_${_target_upper}_DEPENDS_ON}") foreach(t ${_depends_on}) - list(APPEND ${arg_TLIST} ${t}) - blt_find_target_dependencies(TARGET ${t} TLIST ${arg_TLIST}) + if (NOT "${t}" IN_LIST ${arg_TLIST}) + list(APPEND ${arg_TLIST} ${t}) + blt_find_target_dependencies(TARGET ${t} TLIST ${arg_TLIST}) + endif() endforeach() unset(_depends_on) endif() @@ -983,7 +985,7 @@ macro(blt_find_target_dependencies) if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") get_property(_propval TARGET ${arg_TARGET} PROPERTY LINK_LIBRARIES SET) get_target_property(_propval ${arg_TARGET} LINK_LIBRARIES) - if (_propval) + if (_propval AND NOT "${_propval}" IN_LIST ${arg_TLIST}) list(APPEND _property_list ${_propval}) endif() endif() @@ -991,7 +993,7 @@ macro(blt_find_target_dependencies) # get interface link libraries get_property(_propval TARGET ${arg_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES SET) get_target_property(_propval ${arg_TARGET} INTERFACE_LINK_LIBRARIES) - if (_propval) + if (_propval AND NOT "${_propval}" IN_LIST ${arg_TLIST}) list(APPEND _property_list ${_propval}) endif() diff --git a/tests/internal/CMakeLists.txt b/tests/internal/CMakeLists.txt index 5061cefd1..c746f368e 100644 --- a/tests/internal/CMakeLists.txt +++ b/tests/internal/CMakeLists.txt @@ -275,6 +275,12 @@ blt_register_library(NAME foo) blt_register_library(NAME bar DEPENDS_ON foo) blt_print_target_properties(TARGET bar CHILDREN true) +message(STATUS "") +message(STATUS "Exercising blt_print_target_properties macro. Testing infinite recursion") +blt_register_library(NAME foo DEPENDS_ON bar) +blt_register_library(NAME bar DEPENDS_ON foo) +blt_print_target_properties(TARGET bar CHILDREN true) + add_subdirectory(src/object_library_test) if(ENABLE_CLANGQUERY OR ENABLE_CLANGTIDY) From fd80b9057d61e0c670dde24f81ab0041bd72d4d7 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 21 Sep 2022 13:45:10 -0700 Subject: [PATCH 44/60] explain new print options --- RELEASE-NOTES.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0570565d8..14dd31c35 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -13,8 +13,11 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ - Added 'blt_convert_to_system_includes' macro to convert existing interface includes to system interface includes. ### Changed -- Added extra options to 'blt_print_target_properties' macro to print properties of -target's children as well as limit the properties printed with a regular expression. +- Added three extra options to 'blt_print_target_properties' macro to print properties of +targets children as well as limit the properties printed with regular expressions: + - CHILDREN (true/ false) whether or not you want to print the target's children's properties as well (recursively) + - PROPERTY_NAME_REGEX (regular expression string) reduce which properties to print by name + - PROPERTY_VALUE_REGEX (regular expression string) reduce which properties to print by value ## [Version 0.5.1] - Release date 2022-04-22 From 376099c1b694e0c5e99b4bbda6ab513e514b62ce Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 21 Sep 2022 13:46:30 -0700 Subject: [PATCH 45/60] apostrophe --- RELEASE-NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 14dd31c35..6bb4c0931 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -14,7 +14,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Changed - Added three extra options to 'blt_print_target_properties' macro to print properties of -targets children as well as limit the properties printed with regular expressions: +target's children as well as limit the properties printed with regular expressions: - CHILDREN (true/ false) whether or not you want to print the target's children's properties as well (recursively) - PROPERTY_NAME_REGEX (regular expression string) reduce which properties to print by name - PROPERTY_VALUE_REGEX (regular expression string) reduce which properties to print by value From d8089910156020c425ef00f919ef2dd8586f29bd Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Wed, 21 Sep 2022 13:48:09 -0700 Subject: [PATCH 46/60] code style --- RELEASE-NOTES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6bb4c0931..3e672acdd 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,10 +10,10 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd ### Added -- Added 'blt_convert_to_system_includes' macro to convert existing interface includes to system interface includes. +- Added `blt_convert_to_system_includes` macro to convert existing interface includes to system interface includes. ### Changed -- Added three extra options to 'blt_print_target_properties' macro to print properties of +- Added three extra options to `blt_print_target_properties` macro to print properties of target's children as well as limit the properties printed with regular expressions: - CHILDREN (true/ false) whether or not you want to print the target's children's properties as well (recursively) - PROPERTY_NAME_REGEX (regular expression string) reduce which properties to print by name From e31b6de41dc09a9cfce97f9c7cb762f4ea4e42a6 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Thu, 22 Sep 2022 16:51:25 -0700 Subject: [PATCH 47/60] wording --- cmake/BLTPrivateMacros.cmake | 6 ++---- docs/api/target_properties.rst | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 797fdebfd..b9a995e7e 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -938,12 +938,10 @@ macro(blt_print_target_properties_private) endmacro(blt_print_target_properties_private) ##------------------------------------------------------------------------------ -## blt_find_target_dependencies(TARGET TLIST tlist) +## blt_find_target_dependencies(TARGET TLIST ) ## ## Store all target's dependencies (link libraries and interface link libraries) -## recursively in TLIST. -## -## +## recursively in the variable name TLIST holds. ##------------------------------------------------------------------------------ macro(blt_find_target_dependencies) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 4a3e76943..10985816d 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -166,7 +166,7 @@ TARGET Name of CMake target (required) CHILDREN - Whether or not to print the properties of the target's children (false by default) + Whether or not to print the properties of the target's children recursively (false by default) PROPERTY_NAME_REGEX Limit the properties to print by name (all by default) From 1f0463a19bea6143d31424d020c46bb14f4c5b4f Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Thu, 22 Sep 2022 17:01:31 -0700 Subject: [PATCH 48/60] new macos imagename --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 293eba47d..fdde52e81 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -51,7 +51,7 @@ strategy: MPI_DIR: '/usr' CMAKE_FLAGS: '$(C_COMPILERS) $(MPI_FLAGS) -DENABLE_GTEST_DEATH_TESTS=OFF -DENABLE_OPENMP=ON' osx_gcc: - VM_ImageName: 'macos-1015' + VM_ImageName: 'macos-12' CMAKE_FLAGS: '' windows: VM_ImageName: 'windows-2019' From 401f967a4e0e87b83ba09b914cbd88fdddbeefc9 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman <100869159+chapman39@users.noreply.github.com> Date: Mon, 26 Sep 2022 12:55:02 -0700 Subject: [PATCH 49/60] Update RELEASE-NOTES.md Co-authored-by: Chris White --- RELEASE-NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3e672acdd..df4b7dee2 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -14,7 +14,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Changed - Added three extra options to `blt_print_target_properties` macro to print properties of -target's children as well as limit the properties printed with regular expressions: + target's children as well as limit the properties printed with regular expressions: - CHILDREN (true/ false) whether or not you want to print the target's children's properties as well (recursively) - PROPERTY_NAME_REGEX (regular expression string) reduce which properties to print by name - PROPERTY_VALUE_REGEX (regular expression string) reduce which properties to print by value From 1bfd1d16635a822cc0d1f5f613c962397a90df29 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Wed, 28 Sep 2022 14:33:40 -0700 Subject: [PATCH 50/60] Add BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE variable --- RELEASE-NOTES.md | 3 +++ cmake/SetupCompilerOptions.cmake | 19 +++++++++++++++++++ .../clang@upstream_nvcc_xlf.cmake | 2 ++ 3 files changed, 24 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index cca7d499d..a535cc041 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,6 +11,9 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Added - Added 'blt_convert_to_system_includes' macro to convert existing interface includes to system interface includes. +- Added variable ``BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE`` for filtering + link libraries implicitly added by CMake. See the following example host-config: + ``host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake`` ## [Version 0.5.1] - Release date 2022-04-22 diff --git a/cmake/SetupCompilerOptions.cmake b/cmake/SetupCompilerOptions.cmake index 2af48cd8d..d78263694 100644 --- a/cmake/SetupCompilerOptions.cmake +++ b/cmake/SetupCompilerOptions.cmake @@ -373,3 +373,22 @@ if(BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE) message(STATUS "Updated CUDA implicit Link Directories: ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") endif () endif() + +################################## +# Remove implicit link libraries +################################## +if(BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE) + message(STATUS "Removing implicit link libraries: ${BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE}") + list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_LIBRARIES ${BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE}) + message(STATUS "Updated CXX implicit Link Libraries: ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}") + list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES ${BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE}) + message(STATUS "Updated C implicit Link Libraries: ${CMAKE_C_IMPLICIT_LINK_LIBRARIES}") + if (ENABLE_FORTRAN) + list(REMOVE_ITEM CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES ${BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE}) + message(STATUS "Updated Fortran implicit Link Libraries: ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}") + endif () + if (ENABLE_CUDA) + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES ${BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE}) + message(STATUS "Updated CUDA implicit Link Libraries: ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES}") + endif () +endif() diff --git a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake index 90f78288f..a4513012b 100644 --- a/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake +++ b/host-configs/llnl/blueos_3_ppc64le_ib_p9/clang@upstream_nvcc_xlf.cmake @@ -57,6 +57,8 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") set(BLT_FORTRAN_FLAGS "-WF,-C!" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") +set(BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE "xlomp_ser" CACHE STRING "") + #------------------------------------------------------------------------------ # CUDA support #------------------------------------------------------------------------------ From f2dbca50299527d81ebd84fdf030a20d663c1596 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Thu, 29 Sep 2022 10:53:08 -0700 Subject: [PATCH 51/60] clarity/ cleanup suggestions --- cmake/BLTPrivateMacros.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index b9a995e7e..31989ba5c 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -866,7 +866,7 @@ macro(blt_print_target_properties_private) set(_target_type_str "") if(TARGET ${arg_TARGET}) set(_is_cmake_target TRUE) - set(_target_type_str "${_target_type_str}cmake target") + set(_target_type_str "CMake target") endif() set(_is_blt_registered_target FALSE) @@ -876,11 +876,11 @@ macro(blt_print_target_properties_private) if (_is_cmake_target) set(_target_type_str "${_target_type_str} and a ") endif() - set(_target_type_str "${_target_type_str}blt_registered target") + set(_target_type_str "${_target_type_str}BLT Registered target") endif() if (_is_cmake_target OR _is_blt_registered_target) - message(STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a ${_target_type_str}") + message(STATUS "[${arg_TARGET}] '${arg_TARGET}' is a ${_target_type_str}") endif() unset(_target_type_str) @@ -946,7 +946,7 @@ endmacro(blt_print_target_properties_private) macro(blt_find_target_dependencies) set(options) - set(singleValuedArgs TARGET TLIST CUR_TARGET) + set(singleValuedArgs TARGET TLIST) set(multiValuedArgs) # parse the arguments to the macro @@ -958,7 +958,7 @@ macro(blt_find_target_dependencies) message(FATAL_ERROR "TARGET is a required parameter for the blt_find_target_dependencies macro") endif() - if(NOT DEFINED ${arg_TLIST}) + if(NOT DEFINED arg_TLIST OR NOT DEFINED ${arg_TLIST}) message(FATAL_ERROR "TLIST is a required parameter for the blt_find_target_dependencies macro") endif() From 74d1cd9f7140deeab976baa696ac458368fc0ca1 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Thu, 29 Sep 2022 11:52:29 -0700 Subject: [PATCH 52/60] wording --- docs/api/target_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/target_properties.rst b/docs/api/target_properties.rst index 10985816d..2c4bf652b 100644 --- a/docs/api/target_properties.rst +++ b/docs/api/target_properties.rst @@ -160,7 +160,7 @@ blt_print_target_properties PROPERTY_NAME_REGEX PROPERTY_VALUE_REGEX ) -Prints out all properties of the given target. +Prints all (or filtered) properties of a given target and optionally its dependencies as well. TARGET Name of CMake target (required) From 0142ece2b0aff0f316e0469f0fc1a6fff3c1f028 Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Thu, 29 Sep 2022 11:54:17 -0700 Subject: [PATCH 53/60] wording for print target macro desc --- cmake/BLTMacros.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 82da9b917..092daf8da 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1279,7 +1279,8 @@ endmacro(blt_combine_static_libraries) ## PROPERTY_NAME_REGEX ## PROPERTY_VALUE_REGEX ) ## -## Prints out properties of the given target. +## Prints all (or filtered) properties of a given target and optionally its +## dependencies as well. ## ## Has the options to print target's link libraries and interface link libraries ## with the CHILDREN argument, as well as specific properties using regular From 5aa089a8c82e884fd3fdc075a0b494a9fa9494dc Mon Sep 17 00:00:00 2001 From: Alex Tyler Chapman Date: Mon, 3 Oct 2022 10:09:27 -0700 Subject: [PATCH 54/60] re-add 'property' to target type --- cmake/BLTPrivateMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index 31989ba5c..34f19a625 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -880,7 +880,7 @@ macro(blt_print_target_properties_private) endif() if (_is_cmake_target OR _is_blt_registered_target) - message(STATUS "[${arg_TARGET}] '${arg_TARGET}' is a ${_target_type_str}") + message(STATUS "[${arg_TARGET} property] '${arg_TARGET}' is a ${_target_type_str}") endif() unset(_target_type_str) From 6bd825019b832658eeeb07d6a1e5dc3769dae7da Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Mon, 3 Oct 2022 18:21:01 -0700 Subject: [PATCH 55/60] add axom try_compile macro to blt --- cmake/BLTMacros.cmake | 71 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index 092daf8da..e89f3b5b9 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1425,3 +1425,74 @@ macro(blt_convert_to_system_includes) unset(_include_dirs) endmacro() + +##------------------------------------------------------------------------------ +## blt_check_code_compiles(CODE_COMPILES +## VERBOSE_OUTPUT +## SOURCE_STRING ) +## +## This macro checks if a snippet of C++ code compiles. +## +## SOURCE_STRING The source snippet to compile. +## Must be a valid C++ program with a main() function. +## Note: This parameter should be passed in as a quoted string variable. Otherwise, +## cmake will convert the string into a list and lose the semicolons. +## E.g. blt_check_code_compiles(SOURCE_STRING "${str_var}" ...) +## +## CODE_COMPILES A boolean variable the contains the compilation result. +## +## VERBOSE_OUTPUT Optional parameter to output debug information (Default: off) +##------------------------------------------------------------------------------ +macro(blt_check_code_compiles) + + set(options) + set(singleValueArgs CODE_COMPILES VERBOSE_OUTPUT) + set(multiValueArgs SOURCE_STRING) + + # Parse the arguments to the macro + cmake_parse_arguments(arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) + + # Check the arguments + if(NOT DEFINED arg_SOURCE_STRING) + message(FATAL_ERROR "blt_check_code_compiles() requires SOURCE_STRING to be specified") + endif() + + if(NOT DEFINED arg_CODE_COMPILES) + message(FATAL_ERROR "blt_check_code_compiles() requires CODE_COMPILES to be specified") + endif() + + if(NOT DEFINED arg_VERBOSE_OUTPUT) + set(arg_VERBOSE_OUTPUT FALSE) + endif() + + if(${arg_VERBOSE_OUTPUT}) + message(STATUS "[blt_check_code_compiles] Attempting to compile source string: \n${arg_SOURCE_STRING}") + endif() + + # Write string as temp file, try to compile it and then remove file + string(RANDOM LENGTH 5 _rand) + set(_fname ${CMAKE_CURRENT_BINARY_DIR}/_bltCheckCompiles${_rand}.cpp) + file(WRITE ${_fname} "${arg_SOURCE_STRING}") + try_compile(${arg_CODE_COMPILES} + ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp + SOURCES ${_fname} + CXX_STANDARD ${CMAKE_CXX_STANDARD} + OUTPUT_VARIABLE _res) + file(REMOVE ${_fname}) + + if(${arg_VERBOSE_OUTPUT}) + message(STATUS "[blt_check_code_compiles] Compiler output: \n${_res}\n") + + if(${arg_CODE_COMPILES}) + message(STATUS "[blt_check_code_compiles] The code snippet successfully compiled") + else() + message(STATUS "[blt_check_code_compiles] The code snippet failed to compile") + endif() + endif() + + # clear the variables set within the macro + unset(_fname) + unset(_res) + +endmacro(blt_check_code_compiles) From 8b6a419a2e97b31a150725de7e9a7195c47d4f1d Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 3 Oct 2022 18:21:46 -0700 Subject: [PATCH 56/60] turn on CMP0067 even though it only works on some CMake versions --- SetupBLT.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SetupBLT.cmake b/SetupBLT.cmake index 460c8d75c..dcb5b8f06 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -66,6 +66,13 @@ if (NOT BLT_LOADED) cmake_policy(SET CMP0057 NEW) endif() + # Make `check_cxx_source_compiles` honor `CMAKE_CXX_STANDARD` + # NOTE: This only works on a few CMake versions even though it was + # added in CMake 3.14. (for example, 3.20.2, 3.21.1, and 3.23.1 did not work) + if(POLICY CMP0067) + cmake_policy(SET CMP0067 NEW) + endif() + # Policy to use _ROOT variable in find_ commands # Policy added in 3.12+ if(POLICY CMP0074) From 79015982cfc73b9c03a60ac9482238b900db8a54 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 3 Oct 2022 18:22:08 -0700 Subject: [PATCH 57/60] documentation and release notes for blt_check_code_compiles --- RELEASE-NOTES.md | 1 + docs/api/utility.rst | 28 ++++++++++++++++++++++++++++ tests/internal/unit/CMakeLists.txt | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index df4b7dee2..0af466890 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,6 +11,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Added - Added `blt_convert_to_system_includes` macro to convert existing interface includes to system interface includes. +- `blt_check_code_compiles` which compiles a C++ code snippet and returns the result. ### Changed - Added three extra options to `blt_print_target_properties` macro to print properties of diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 09a23682c..86822b3a0 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -77,6 +77,34 @@ When using the Intel toolchain within Visual Studio, we use the ``MSVC_INTEL`` flag, when provided, with a fallback to the ``MSVC`` flag. +.. blt_check_code_compiles: + +blt_check_code_compiles +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + blt_check_code_compiles(CODE_COMPILES + VERBOSE_OUTPUT + SOURCE_STRING ) + +This macro checks if a snippet of C++ code compiles. + +CODE_COMPILES + The boolean variable that will be filled with the compilation result. + +VERBOSE_OUTPUT + Optional parameter to output debug information (Default: OFF) + +SOURCE_STRING + The source snippet to compile. + +``SOURCE_STRING`` must be a valid C++ program with a main() function and +must be passed in as a quoted string variable. Otherwise, CMake will convert +the string into a list and lose the semicolons. +E.g. blt_check_code_compiles(SOURCE_STRING "${str_var}" ...) + + .. _blt_find_libraries: blt_find_libraries diff --git a/tests/internal/unit/CMakeLists.txt b/tests/internal/unit/CMakeLists.txt index edcad9ae2..5c09c6c78 100644 --- a/tests/internal/unit/CMakeLists.txt +++ b/tests/internal/unit/CMakeLists.txt @@ -151,3 +151,24 @@ message( "Tests passed for `blt_split_source_list_by_language`.\n" "*****************************************************") +message(STATUS "Checking for blt_check_code_compiles") + +blt_check_code_compiles(CODE_COMPILES _hello_world_compiled + VERBOSE_OUTPUT ON + SOURCE_STRING +"#include + +int main(int, char**) +{ + + std::cout << \"Hello World!\" << std::endl; + + return 0; +} +") + +if(_hello_world_compiled) + message(STATUS "... passed") +else() + message(FATAL_ERROR "... failed to compile.") +endif() From a3e380ee3a39421ff9d7363744819d74ebc2e5f5 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 3 Oct 2022 18:38:09 -0700 Subject: [PATCH 58/60] add clarifying note --- cmake/BLTMacros.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/BLTMacros.cmake b/cmake/BLTMacros.cmake index e89f3b5b9..5601933f5 100644 --- a/cmake/BLTMacros.cmake +++ b/cmake/BLTMacros.cmake @@ -1446,7 +1446,8 @@ endmacro() macro(blt_check_code_compiles) set(options) - set(singleValueArgs CODE_COMPILES VERBOSE_OUTPUT) + set(singleValueArgs CODE_COMPILES VERBOSE_OUTPUT ) + # NOTE: SOURCE_STRING must be a multiValueArg otherwise CMake removes all semi-colons set(multiValueArgs SOURCE_STRING) # Parse the arguments to the macro From a2216410a80e9008c1e844f4eb7866ff89b79ec6 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 3 Oct 2022 18:38:30 -0700 Subject: [PATCH 59/60] add comment about bracket arguments --- docs/api/utility.rst | 24 ++++++++++++++++++++++-- tests/internal/unit/CMakeLists.txt | 7 ++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 86822b3a0..94fe70ca4 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -101,8 +101,28 @@ SOURCE_STRING ``SOURCE_STRING`` must be a valid C++ program with a main() function and must be passed in as a quoted string variable. Otherwise, CMake will convert -the string into a list and lose the semicolons. -E.g. blt_check_code_compiles(SOURCE_STRING "${str_var}" ...) +the string into a list and lose the semicolons. You can use any CMake method +of sending a string, but we recommend the +`bracket argument method `_ +shown below so you do not have to escape your quotes: + +.. code-block:: cmake + + blt_check_code_compiles(CODE_COMPILES hello_world_compiled + SOURCE_STRING + [=[ + #include + + int main(int, char**) + { + + std::cout << "Hello World!" << std::endl; + + return 0; + } + ]=]) + + .. _blt_find_libraries: diff --git a/tests/internal/unit/CMakeLists.txt b/tests/internal/unit/CMakeLists.txt index 5c09c6c78..5d7887361 100644 --- a/tests/internal/unit/CMakeLists.txt +++ b/tests/internal/unit/CMakeLists.txt @@ -156,16 +156,17 @@ message(STATUS "Checking for blt_check_code_compiles") blt_check_code_compiles(CODE_COMPILES _hello_world_compiled VERBOSE_OUTPUT ON SOURCE_STRING -"#include +[=[ +#include int main(int, char**) { - std::cout << \"Hello World!\" << std::endl; + std::cout << "Hello World!" << std::endl; return 0; } -") +]=]) if(_hello_world_compiled) message(STATUS "... passed") From ee5d4302e44d70ba276e2bf0a841585c31f9fe65 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 5 Oct 2022 11:38:58 -0700 Subject: [PATCH 60/60] bump version --- RELEASE-NOTES.md | 5 ++++- SetupBLT.cmake | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6bbcb2fb2..7142d55ba 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -9,6 +9,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ## [Unreleased] - Release date yyyy-mm-dd +## [Version 0.5.2] - Release date 2022-10-05 + ### Added - Added `blt_convert_to_system_includes` macro to convert existing interface includes to system interface includes. - `blt_check_code_compiles` which compiles a C++ code snippet and returns the result. @@ -266,7 +268,8 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ -[Unreleased]: https://github.com/LLNL/blt/compare/v0.5.1...develop +[Unreleased]: https://github.com/LLNL/blt/compare/v0.5.2...develop +[Version 0.5.2]: https://github.com/LLNL/blt/compare/v0.5.1...v0.5.2 [Version 0.5.1]: https://github.com/LLNL/blt/compare/v0.5.0...v0.5.1 [Version 0.5.0]: https://github.com/LLNL/blt/compare/v0.4.1...v0.5.0 [Version 0.4.1]: https://github.com/LLNL/blt/compare/v0.4.0...v0.4.1 diff --git a/SetupBLT.cmake b/SetupBLT.cmake index dcb5b8f06..9de833e14 100644 --- a/SetupBLT.cmake +++ b/SetupBLT.cmake @@ -4,7 +4,7 @@ # SPDX-License-Identifier: (BSD-3-Clause) if (NOT BLT_LOADED) - set(BLT_VERSION "0.5.1" CACHE STRING "") + set(BLT_VERSION "0.5.2" CACHE STRING "") mark_as_advanced(BLT_VERSION) message(STATUS "BLT Version: ${BLT_VERSION}")