-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge: Output information after CMake configuration.
This PR outputs information from the CMake step onto the screen and also onto log files. + CI jobs now automatically output detailed configuration to the screen. Related PR: #610
- Loading branch information
Showing
9 changed files
with
251 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,8 @@ option(GINKGO_WITH_IWYU "Make Ginkgo call `iwyu` (Include What You Use) to find | |
option(GINKGO_CHECK_CIRCULAR_DEPS | ||
"Enable compile-time checks detecting circular dependencies between libraries and non-self-sufficient headers." | ||
OFF) | ||
option(GINKGO_CONFIG_LOG_DETAILED | ||
"Enable printing of detailed configuration log to screen in addition to the writing of files," OFF) | ||
set(GINKGO_VERBOSE_LEVEL "1" CACHE STRING | ||
"Verbosity level. Put 0 to turn off. 1 activates a few important messages.") | ||
if(MSVC) | ||
|
@@ -254,6 +256,8 @@ include(cmake/information_helpers.cmake) | |
ginkgo_interface_information() | ||
ginkgo_git_information() | ||
|
||
include(cmake/get_info.cmake) | ||
|
||
if(GINKGO_BUILD_DOC) | ||
add_subdirectory(doc) | ||
endif() | ||
|
@@ -297,3 +301,12 @@ set(CPACK_RESOURCE_FILE_LICENSE "${Ginkgo_SOURCE_DIR}/LICENSE") | |
set(CPACK_PACKAGE_ICON "${Ginkgo_SOURCE_DIR}/assets/logo.png") | ||
set(CPACK_PACKAGE_CONTACT "[email protected]") | ||
include(CPack) | ||
|
||
# And finally, print the configuration to screen: | ||
# | ||
if(GINKGO_CONFIG_LOG_DETAILED) | ||
FILE(READ ${CMAKE_BINARY_DIR}/detailed.log GINKGO_LOG_SUMMARY) | ||
else() | ||
FILE(READ ${CMAKE_BINARY_DIR}/minimal.log GINKGO_LOG_SUMMARY) | ||
endif() | ||
MESSAGE("${GINKGO_LOG_SUMMARY}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
SET(detailed_log "${CMAKE_BINARY_DIR}/detailed.log") | ||
SET(minimal_log "${CMAKE_BINARY_DIR}/minimal.log") | ||
FILE(REMOVE ${detailed_log} ${minimal_log}) | ||
|
||
MACRO(_both) | ||
# Write to both log files: | ||
FILE(APPEND ${detailed_log} "${ARGN}") | ||
FILE(APPEND ${minimal_log} "${ARGN}") | ||
ENDMACRO() | ||
|
||
MACRO(_detailed) | ||
# Only write to detailed.log: | ||
FILE(APPEND ${detailed_log} "${ARGN}") | ||
ENDMACRO() | ||
|
||
MACRO(_minimal) | ||
# Only write to minimal.log: | ||
FILE(APPEND ${minimal_log} "${ARGN}") | ||
ENDMACRO() | ||
|
||
function(ginkgo_print_generic_header log_type optional_string) | ||
set(upd_string | ||
" | ||
--------------------------------------------------------------------------------------------------------- | ||
-- | ||
-- ${optional_string}" | ||
) | ||
FILE(APPEND ${log_type} "${upd_string}") | ||
endfunction() | ||
|
||
function(ginkgo_print_module_header log_type module_name) | ||
set(upd_string | ||
"The ${module_name} module is being compiled. | ||
-- | ||
-- CMake related ${module_name} module variables:" | ||
) | ||
ginkgo_print_generic_header(${log_type} "${upd_string}") | ||
endfunction() | ||
|
||
function(ginkgo_print_module_footer log_type optional_string) | ||
set(upd_string | ||
" | ||
-- ${optional_string}" | ||
) | ||
FILE(APPEND ${log_type} "${upd_string}") | ||
endfunction() | ||
|
||
FUNCTION(ginkgo_print_flags log_type var_name) | ||
string(TOUPPER "${CMAKE_BUILD_TYPE}" suff) | ||
set(var_string "${var_name}_${suff}") | ||
if(${var_string} STREQUAL "") | ||
set(str_value "<empty>") | ||
else() | ||
set(str_value "${${var_string}}") | ||
endif() | ||
string(SUBSTRING " | ||
-- ${var_string}: " 0 55 upd_string) | ||
string(APPEND upd_string "${str_value}") | ||
FILE(APPEND ${log_type} ${upd_string}) | ||
ENDFUNCTION() | ||
|
||
function(ginkgo_print_variable log_type var_name) | ||
string(SUBSTRING | ||
" | ||
-- ${var_name}: " 0 55 upd_string) | ||
if(${var_name} STREQUAL "") | ||
set(str_value "<empty>") | ||
else() | ||
set(str_value "${${var_name}}") | ||
endif() | ||
string(APPEND upd_string "${str_value}") | ||
FILE(APPEND ${log_type} "${upd_string}") | ||
endfunction() | ||
|
||
IF("${GINKGO_GIT_SHORTREV}" STREQUAL "") | ||
set(to_print "Summary of Configuration for Ginkgo (version ${Ginkgo_VERSION} with tag ${Ginkgo_VERSION_TAG}) | ||
--" | ||
) | ||
ginkgo_print_generic_header(${detailed_log} "${to_print}") | ||
ginkgo_print_generic_header(${minimal_log} "${to_print}") | ||
ELSE() | ||
set(to_print "Summary of Configuration for (Ginkgo version ${Ginkgo_VERSION} with tag ${Ginkgo_VERSION_TAG}, shortrev ${GINKGO_GIT_SHORTREV})" | ||
) | ||
ginkgo_print_generic_header(${detailed_log} "${to_print}") | ||
ginkgo_print_generic_header(${minimal_log} "${to_print}") | ||
ENDIF() | ||
|
||
set(log_types "detailed_log;minimal_log") | ||
foreach(log_type ${log_types}) | ||
ginkgo_print_module_footer(${${log_type}} "Ginkgo configuration:") | ||
set(print_var | ||
"CMAKE_BUILD_TYPE;BUILD_SHARED_LIBS;CMAKE_INSTALL_PREFIX;CMAKE_SOURCE_DIR;CMAKE_BINARY_DIR" | ||
) | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
string(SUBSTRING | ||
" | ||
-- CMAKE_CXX_COMPILER: " 0 55 print_string) | ||
set(str2 "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}") | ||
string(APPEND print_string "${str2}") | ||
FILE(APPEND ${${log_type}} "${print_string}") | ||
string(SUBSTRING | ||
" | ||
-- " 0 55 print_string) | ||
set(str2 "${CMAKE_CXX_COMPILER}") | ||
string(APPEND print_string "${str2}") | ||
FILE(APPEND ${${log_type}} "${print_string}") | ||
ginkgo_print_module_footer(${${log_type}} "User configuration:") | ||
ginkgo_print_module_footer(${${log_type}} " Enabled modules:") | ||
set(print_var | ||
"GINKGO_BUILD_OMP;GINKGO_BUILD_REFERENCE;GINKGO_BUILD_CUDA;GINKGO_BUILD_HIP" | ||
) | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
ginkgo_print_module_footer(${${log_type}} " Tests, benchmarks and examples:") | ||
set(print_var | ||
"GINKGO_BUILD_TESTS;GINKGO_BUILD_EXAMPLES;GINKGO_EXTLIB_EXAMPLE;GINKGO_BUILD_BENCHMARKS") | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
ginkgo_print_module_footer(${${log_type}} " Documentation:") | ||
set(print_var | ||
"GINKGO_BUILD_DOC;GINKGO_VERBOSE_LEVEL") | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
ginkgo_print_module_footer(${${log_type}} " Developer helpers:") | ||
set(print_var | ||
"GINKGO_DEVEL_TOOLS;GINKGO_WITH_CLANG_TIDY;GINKGO_WITH_IWYU" | ||
"GINKGO_CHECK_CIRCULAR_DEPS;GINKGO_CHECK_PATH") | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
ginkgo_print_module_footer(${${log_type}} "") | ||
endforeach() | ||
|
||
set(to_print | ||
"Compiled Modules | ||
--" | ||
) | ||
ginkgo_print_generic_header(${detailed_log} "${to_print}") | ||
|
||
include(core/get_info.cmake) | ||
|
||
IF(GINKGO_BUILD_REFERENCE) | ||
include(reference/get_info.cmake) | ||
ENDIF() | ||
|
||
IF(GINKGO_BUILD_OMP) | ||
include(omp/get_info.cmake) | ||
ENDIF() | ||
|
||
IF(GINKGO_BUILD_CUDA) | ||
include(cuda/get_info.cmake) | ||
ENDIF() | ||
|
||
IF(GINKGO_BUILD_HIP) | ||
include(hip/get_info.cmake) | ||
ENDIF() | ||
|
||
ginkgo_print_generic_header(${detailed_log} "Optional Components:") | ||
ginkgo_print_variable(${detailed_log} "GKO_HAVE_PAPI_SDE") | ||
if(PAPI_sde_FOUND) | ||
ginkgo_print_variable(${detailed_log} "PAPI_VERSION") | ||
ginkgo_print_variable(${detailed_log} "PAPI_INCLUDE_DIR") | ||
ginkgo_print_flags(${detailed_log} "PAPI_LIBRARY") | ||
endif() | ||
|
||
_minimal( | ||
"\n | ||
--\n-- Detailed information (More compiler flags, module configuration) can be found in detailed.log | ||
") | ||
_both( | ||
"\n--\n-- Now, run cmake --build . to compile Ginkgo!\n" | ||
) | ||
_both("-- | ||
---------------------------------------------------------------------------------------------------------\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ginkgo_print_module_header(${detailed_log} "Core") | ||
ginkgo_print_variable(${detailed_log} "BUILD_SHARED_LIBS") | ||
ginkgo_print_variable(${detailed_log} "CMAKE_C_COMPILER") | ||
ginkgo_print_flags(${detailed_log} "CMAKE_C_FLAGS") | ||
ginkgo_print_variable(${detailed_log} "CMAKE_CXX_COMPILER") | ||
ginkgo_print_flags(${detailed_log} "CMAKE_CXX_FLAGS") | ||
ginkgo_print_variable(${detailed_log} "CMAKE_GENERATOR") | ||
ginkgo_print_module_footer(${detailed_log} "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ginkgo_print_module_header(${detailed_log} "CUDA") | ||
ginkgo_print_variable(${detailed_log} "GINKGO_CUDA_ARCHITECTURES") | ||
ginkgo_print_variable(${detailed_log} "GINKGO_CUDA_COMPILER_FLAGS") | ||
ginkgo_print_variable(${detailed_log} "GINKGO_CUDA_DEFAULT_HOST_COMPILER") | ||
ginkgo_print_module_footer(${detailed_log} "CUDA variables:") | ||
ginkgo_print_variable(${detailed_log} "CMAKE_CUDA_COMPILER") | ||
ginkgo_print_variable(${detailed_log} "CMAKE_CUDA_COMPILER_VERSION") | ||
ginkgo_print_flags(${detailed_log} "CMAKE_CUDA_FLAGS") | ||
ginkgo_print_variable(${detailed_log} "CMAKE_CUDA_HOST_COMPILER") | ||
ginkgo_print_variable(${detailed_log} "CUDA_INCLUDE_DIRS") | ||
ginkgo_print_module_footer(${detailed_log} "CUDA Libraries:") | ||
ginkgo_print_variable(${detailed_log} "CUBLAS") | ||
ginkgo_print_variable(${detailed_log} "CUDA_RUNTIME_LIBS") | ||
ginkgo_print_variable(${detailed_log} "CUSPARSE") | ||
ginkgo_print_module_footer(${detailed_log} "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
set(log_types "detailed_log") | ||
foreach(log_type ${log_types}) | ||
ginkgo_print_module_header(${${log_type}} "HIP") | ||
set(print_var "GINKGO_HIPCONFIG_PATH;GINKGO_HIP_AMDGPU;GINKGO_HIP_HCC_COMPILER_FLAGS;GINKGO_HIP_NVCC_COMPILER_FLAGS;GINKGO_HIP_THRUST_PATH" | ||
) | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
endforeach() | ||
foreach(log_type ${log_types}) | ||
ginkgo_print_module_footer(${${log_type}} "HIP variables:") | ||
set(print_var "HIP_VERSION;HIP_COMPILER;HIP_PATH;ROCM_PATH;HIP_PLATFORM;HIP_ROOT_DIR;HCC_PATH;HIP_RUNTIME;HIPBLAS_PATH;HIPSPARSE_PATH;HIP_CLANG_INCLUDE_PATH;HIP_CLANG_PATH;HIP_HIPCC_EXECUTABLE;HIP_HIPCONFIG_EXECUTABLE;HIP_HOST_COMPILATION_CPP" | ||
) | ||
foreach(var ${print_var}) | ||
ginkgo_print_variable(${${log_type}} ${var} ) | ||
endforeach() | ||
ginkgo_print_flags(${detailed_log} "HIP_HCC_FLAGS") | ||
ginkgo_print_flags(${detailed_log} "HIP_HIPCC_FLAGS") | ||
ginkgo_print_flags(${detailed_log} "HIP_NVCC_FLAGS") | ||
ginkgo_print_module_footer(${detailed_log} "") | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ginkgo_print_module_header(${detailed_log} "OpenMP") | ||
ginkgo_print_variable(${detailed_log} "OpenMP_CXX_FLAGS") | ||
ginkgo_print_variable(${detailed_log} "OpenMP_CXX_LIB_NAMES") | ||
ginkgo_print_variable(${detailed_log} "OpenMP_CXX_LIBRARIES") | ||
ginkgo_print_module_footer(${detailed_log} "OMP variables:") | ||
ginkgo_print_variable(${detailed_log} "GINKGO_COMPILER_FLAGS") | ||
ginkgo_print_module_footer(${detailed_log} "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ginkgo_print_module_header(${detailed_log} "Reference") | ||
ginkgo_print_variable(${detailed_log} "GINKGO_BUILD_REFERENCE") | ||
ginkgo_print_variable(${detailed_log} "GINKGO_COMPILER_FLAGS") | ||
ginkgo_print_module_footer(${detailed_log} "") |