Merge pull request #2253 from gridley/buildinfo

Can now print some build info
This commit is contained in:
Paul Romano 2022-10-21 07:00:04 -05:00 committed by GitHub
commit dc0731c949
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 0 deletions

View file

@ -482,6 +482,19 @@ if (OPENMC_USE_MPI)
target_link_libraries(libopenmc MPI::MPI_CXX)
endif()
#===============================================================================
# Log build info that this executable can report later
#===============================================================================
target_compile_definitions(libopenmc PRIVATE BUILD_TYPE=${CMAKE_BUILD_TYPE})
target_compile_definitions(libopenmc PRIVATE COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
target_compile_definitions(libopenmc PRIVATE COMPILER_VERSION=${CMAKE_CXX_COMPILER_VERSION})
if (OPENMC_ENABLE_PROFILE)
target_compile_definitions(libopenmc PRIVATE PROFILINGBUILD)
endif()
if (OPENMC_ENABLE_COVERAGE)
target_compile_definitions(libopenmc PRIVATE COVERAGEBUILD)
endif()
#===============================================================================
# openmc executable
#===============================================================================

View file

@ -40,6 +40,9 @@ void print_usage();
//! Display current version and copright/license information
void print_version();
//! Display compile flags employed, etc
void print_build_info();
//! Display header listing what physical values will displayed
void print_columns();

View file

@ -260,6 +260,7 @@ int parse_command_line(int argc, char* argv[])
} else if (arg == "-v" || arg == "--version") {
print_version();
print_build_info();
return OPENMC_E_UNASSIGNED;
} else if (arg == "-t" || arg == "--track") {

View file

@ -347,6 +347,61 @@ void print_version()
//==============================================================================
void print_build_info()
{
const std::string n("no");
const std::string y("yes");
std::string mpi(n);
std::string phdf5(n);
std::string dagmc(n);
std::string libmesh(n);
std::string png(n);
std::string profiling(n);
std::string coverage(n);
#ifdef PHDF5
phdf5 = y;
#endif
#ifdef OPENMC_MPI
mpi = y;
#endif
#ifdef DAGMC
dagmc = y;
#endif
#ifdef LIBMESH
libmesh = y;
#endif
#ifdef USE_LIBPNG
png = y;
#endif
#ifdef PROFILINGBUILD
profiling = y;
#endif
#ifdef COVERAGEBUILD
coverage = y;
#endif
// Wraps macro variables in quotes
#define STRINGIFY(x) STRINGIFY2(x)
#define STRINGIFY2(x) #x
if (mpi::master) {
fmt::print("Build type: {}\n", STRINGIFY(BUILD_TYPE));
fmt::print("Compiler ID: {} {}\n", STRINGIFY(COMPILER_ID),
STRINGIFY(COMPILER_VERSION));
fmt::print("MPI enabled: {}\n", mpi);
fmt::print("Parallel HDF5 enabled: {}\n", phdf5);
fmt::print("PNG support: {}\n", png);
fmt::print("DAGMC support: {}\n", dagmc);
fmt::print("libMesh support: {}\n", libmesh);
fmt::print("Coverage testing: {}\n", coverage);
fmt::print("Profiling flags: {}\n", profiling);
}
}
//==============================================================================
void print_columns()
{
if (settings::entropy_on) {