From: Matthias Maier Date: Thu, 1 Dec 2022 05:39:13 +0000 (-0600) Subject: CMake: update detailed.log generation X-Git-Tag: v9.5.0-rc1~446^2~24 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c1d307cb5bcd2c1c196f453ae565313c9dd4d5a;p=dealii.git CMake: update detailed.log generation --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f48e7076f..d63ad2b955 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,6 @@ endforeach() verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_cpack.cmake) verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_custom_targets.cmake) -verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_write_config.cmake) ######################################################################## # # @@ -160,6 +159,8 @@ endif() add_subdirectory(contrib/python-bindings) # has to be included after tests +verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_write_config.cmake) + # # And finally, print the configuration: # diff --git a/cmake/macros/macro_print_target_properties.cmake b/cmake/macros/macro_print_target_properties.cmake index e627f17909..434f6b9b49 100644 --- a/cmake/macros/macro_print_target_properties.cmake +++ b/cmake/macros/macro_print_target_properties.cmake @@ -29,17 +29,16 @@ function(print_target_properties _target) list(APPEND _messages "Target: ${_target}") foreach(_property - TYPE - LINK_LIBRARIES INTERFACE_LINK_LIBRARIES - INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES - COMPILE_DEFINITIONS INTERFACE_COMPILE_DEFINITIONS - COMPILE_OPTIONS INTERFACE_COMPILE_OPTIONS - LINK_OPTIONS INTERFACE_LINK_OPTIONS + TYPE VERSION SOVERSION LINK_LIBRARIES INCLUDE_DIRECTORIES + COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_OPTIONS LINK_OPTIONS + INTERFACE_LINK_LIBRARIES INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_OPTIONS INTERFACE_LINK_OPTIONS ) get_target_property(_value ${_target} ${_property}) - if(NOT "${_value}" MATCHES "-NOTFOUND") + if(NOT "${_value}" MATCHES "-NOTFOUND" AND NOT "${_value}" STREQUAL "") string(REPLACE ";" " " _value "${_value}") - list(APPEND _messages " ${_property}: ${_value}") + list(APPEND _messages " ${_property}: ${_value}") endif() endforeach() diff --git a/cmake/setup_write_config.cmake b/cmake/setup_write_config.cmake index 402d6fb2d2..58c6bd5995 100644 --- a/cmake/setup_write_config.cmake +++ b/cmake/setup_write_config.cmake @@ -44,21 +44,28 @@ set(_log_detailed "${CMAKE_BINARY_DIR}/detailed.log") set(_log_summary "${CMAKE_BINARY_DIR}/summary.log") file(REMOVE ${_log_detailed} ${_log_summary}) -macro(_both) +function(_both) # Write to both log files: file(APPEND ${_log_detailed} "${ARGN}") file(APPEND ${_log_summary} "${ARGN}") -endmacro() +endfunction() -macro(_detailed) +function(_detailed) # Only write to detailed.log: file(APPEND ${_log_detailed} "${ARGN}") -endmacro() +endfunction() -macro(_summary) +function(_summary) # Only write to summary.log: file(APPEND ${_log_summary} "${ARGN}") -endmacro() +endfunction() + +function(_print_target _target) + print_target_properties(${_target} _messages) + foreach(_message ${_messages}) + _detailed("# ${_message}\n") + endforeach() +endfunction() _both( "### @@ -81,6 +88,14 @@ _both( # ${CMAKE_CXX_COMPILER} " ) +if(CMAKE_C_COMPILER_WORKS) + _detailed("# CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}\n") +endif() +if(CMAKE_Fortran_COMPILER_WORKS) + _detailed("# CMAKE_Fortran_COMPILER: ${CMAKE_Fortran_COMPILER}\n") +endif() +_detailed("# CMAKE_GENERATOR: ${CMAKE_GENERATOR}\n") + if(DEAL_II_HAVE_CXX20) _both("# C++ language standard: C++20\n") elseif(DEAL_II_HAVE_CXX17) @@ -89,13 +104,24 @@ elseif(DEAL_II_HAVE_CXX14) _both("# C++ language standard: C++14\n") endif() -if(CMAKE_C_COMPILER_WORKS) - _detailed("# CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}\n") +_both("# Vectorization level: ${DEAL_II_VECTORIZATION_WIDTH_IN_BITS} bit") +set(_instructions) +if(DEAL_II_HAVE_SSE2) + list(APPEND _instructions "sse2") endif() -if(CMAKE_Fortran_COMPILER_WORKS) - _detailed("# CMAKE_Fortran_COMPILER: ${CMAKE_Fortran_COMPILER}\n") +if(DEAL_II_HAVE_AVX) + list(APPEND _instructions "avx2") +endif() +if(DEAL_II_HAVE_AVX512) + list(APPEND _instructions "avx512*") +endif() +if(DEAL_II_HAVE_ALTIVEC) + list(APPEND _instructions "altivec") +endif() +if(NOT "${_instructions}" STREQUAL "") + to_string(_string ${_instructions}) + _both(" (${_string})\n") endif() -_detailed("# CMAKE_GENERATOR: ${CMAKE_GENERATOR}\n") if(CMAKE_CROSSCOMPILING) _both( @@ -105,11 +131,8 @@ endif() _both("#\n") -_detailed( -"# Base configuration: -# DEAL_II_CXX_FLAGS: ${DEAL_II_CXX_FLAGS} -" - ) +_detailed("# Exported compiler and linker flags:\n") +_detailed("# DEAL_II_CXX_FLAGS: ${DEAL_II_CXX_FLAGS}\n") if(CMAKE_BUILD_TYPE MATCHES "Release") _detailed("# DEAL_II_CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE}\n") endif() @@ -125,43 +148,13 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug") _detailed("# DEAL_II_LINKER_FLAGS_DEBUG: ${DEAL_II_LINKER_FLAGS_DEBUG}\n") endif() -_detailed("# DEAL_II_DEFINITIONS: ${DEAL_II_DEFINITIONS}\n") -if(CMAKE_BUILD_TYPE MATCHES "Release") - _detailed("# DEAL_II_DEFINITIONS_RELEASE: ${DEAL_II_DEFINITIONS_RELEASE}\n") -endif() -if(CMAKE_BUILD_TYPE MATCHES "Debug") - _detailed("# DEAL_II_DEFINITIONS_DEBUG: ${DEAL_II_DEFINITIONS_DEBUG}\n") -endif() - -_detailed("# DEAL_II_INCLUDE_DIRS ${DEAL_II_INCLUDE_DIRS}\n") - -_detailed("# DEAL_II_LIBRARIES: ${DEAL_II_LIBRARIES}\n") -if(CMAKE_BUILD_TYPE MATCHES "Release") - _detailed("# DEAL_II_LIBRARIES_RELEASE: ${DEAL_II_LIBRARIES_RELEASE}\n") -endif() -if(CMAKE_BUILD_TYPE MATCHES "Debug") - _detailed("# DEAL_II_LIBRARIES_DEBUG: ${DEAL_II_LIBRARIES_DEBUG}\n") -endif() - -_detailed("# DEAL_II_TARGETS: ${DEAL_II_TARGETS}\n") -if(CMAKE_BUILD_TYPE MATCHES "Release") - _detailed("# DEAL_II_TARGETS_RELEASE: ${DEAL_II_TARGETS_RELEASE}\n") -endif() -if(CMAKE_BUILD_TYPE MATCHES "Debug") - _detailed("# DEAL_II_TARGETS_DEBUG: ${DEAL_II_TARGETS_DEBUG}\n") -endif() - -_detailed("# DEAL_II_VECTORIZATION_WIDTH_IN_BITS: ${DEAL_II_VECTORIZATION_WIDTH_IN_BITS}\n") - -if(DEAL_II_HAVE_CXX20) - _detailed("# DEAL_II_HAVE_CXX20\n") -elseif(DEAL_II_HAVE_CXX17) - _detailed("# DEAL_II_HAVE_CXX17\n") -elseif(DEAL_II_HAVE_CXX14) - _detailed("# DEAL_II_HAVE_CXX14\n") -endif() - +_detailed("# Library targets:\n") +foreach(_build ${DEAL_II_BUILD_TYPES}) + string(TOLOWER "${_build}" _build_lowercase) + _detailed("#\n") + _print_target(${DEAL_II_NAMESPACE}_${_build_lowercase}) +endforeach() _detailed("#\n") _both("# Configured Features (") @@ -173,7 +166,6 @@ if(DEAL_II_FORCE_AUTODETECTION) endif() _both("DEAL_II_ALLOW_AUTODETECTION = ${DEAL_II_ALLOW_AUTODETECTION}):\n") - set(_deal_ii_features_sorted ${DEAL_II_FEATURES}) list(SORT _deal_ii_features_sorted) foreach(_feature ${_deal_ii_features_sorted}) @@ -196,55 +188,59 @@ foreach(_feature ${_deal_ii_features_sorted}) endif() # - # Print out version number: + # Print some non interface target related configuration values: # - if(DEFINED ${_feature}_VERSION) - _detailed("# ${_feature}_VERSION = ${${_feature}_VERSION}\n") - endif() + + foreach(_var + EXECUTABLE VERSION DIR C_COMPILER CXX_COMPILER Fortran_COMPILER + WITH_64BIT_BLAS_INDICES + ) + if(NOT "${${_feature}_${_var}}" STREQUAL "") + _detailed("# ${_feature}_${_var} = ${${_feature}_${_var}}\n") + endif() + endforeach() # - # Special version numbers: + # Special information: # - if(_feature MATCHES "THREADS" AND DEFINED TBB_VERSION) - _detailed("# TBB_VERSION = ${TBB_VERSION}\n") + + if(_feature MATCHES "MPI") + _detailed("# MPI_CXX_VERSION = ${MPI_CXX_VERSION}\n") endif() if(_feature MATCHES "KOKKOS") _detailed("# KOKKOS_BACKENDS = ${Kokkos_DEVICES}\n") _detailed("# KOKKOS_ARCHITECTURES = ${Kokkos_ARCH}\n") endif() - - # - # Print out ${_feature}_DIR: - # - if(NOT "${${_feature}_DIR}" STREQUAL "") - _detailed("# ${_feature}_DIR = ${${_feature}_DIR}\n") - endif() - - if(NOT "${${_feature}_SPLIT_CONFIGURATION}" STREQUAL "") - _detailed("# ${_feature}_SPLIT_CONFIGURATION = ${${_feature}_SPLIT_CONFIGURATION}\n") - endif() - - # - # Print the feature configuration: - # - foreach(_var2 - C_COMPILER CXX_COMPILER Fortran_COMPILER WITH_64BIT_BLAS_INDICES - ${DEAL_II_STRING_SUFFIXES} ${DEAL_II_LIST_SUFFIXES} - ) - if(DEFINED ${_feature}_${_var2}) - _detailed("# ${_feature}_${_var2} = ${${_feature}_${_var2}}\n") - endif() - endforeach() else() # FEATURE is disabled _both("# ( ${_var} = ${${_var}} )\n") endif() endforeach() -_both( - "#\n# Component configuration:\n" - ) +_detailed("#\n# Interface targets:\n") + +foreach(_feature ${_deal_ii_features_sorted}) + if(${DEAL_II_WITH_${_feature}}) + string(TOLOWER ${_feature} _feature_lowercase) + if(${${_feature}_SPLIT_CONFIGURATION}) + foreach(_build ${DEAL_II_BUILD_TYPE}) + string(TOLOWER ${_build} _build_lowercase) + if(TARGET interface_${_feature_lowercase}_${_build_lowercase}) + _detailed("#\n") + _print_target(interface_${_feature_lowercase}_${_build_lowercase}) + endif() + endforeach() + else() + if(TARGET interface_${_feature_lowercase}) + _detailed("#\n") + _print_target(interface_${_feature_lowercase}) + endif() + endif() + endif() +endforeach() + +_both("#\n# Component configuration:\n") foreach(_component ${DEAL_II_COMPONENTS}) set(_var DEAL_II_COMPONENT_${_component})