Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
#===============================================================================
Expand Down
3 changes: 3 additions & 0 deletions include/openmc/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions src/initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
55 changes: 55 additions & 0 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down