Skip to content
Snippets Groups Projects
Commit 76999127 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Improve code build info

Now indicated build options, compiler and enabled Kokkos devices in execution
preamble
parent cc4e19d5
No related branches found
No related tags found
No related merge requests found
#include <BuildInfo.hpp>
#include <pastis_build_info.hpp>
std::string BuildInfo::type()
{
return PASTIS_BUILD_TYPE;
}
std::string BuildInfo::compiler()
{
return PASTIS_BUILD_COMPILER;
}
std::string BuildInfo::kokkosDevices()
{
return PASTIS_BUILD_KOKKOS_DEVICES;
}
#ifndef BUILD_INFO_HPP
#define BUILD_INFO_HPP
#include <string>
struct BuildInfo
{
static std::string type();
static std::string compiler();
static std::string kokkosDevices();
};
#endif // BUILD_INFO_HPP
...@@ -5,6 +5,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) ...@@ -5,6 +5,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library( add_library(
PastisUtils PastisUtils
BuildInfo.cpp
BacktraceManager.cpp BacktraceManager.cpp
ConsoleManager.cpp ConsoleManager.cpp
FPEManager.cpp FPEManager.cpp
...@@ -99,3 +100,8 @@ endif() ...@@ -99,3 +100,8 @@ endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pastis_config.hpp.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pastis_config.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/pastis_config.hpp" "${CMAKE_CURRENT_BINARY_DIR}/pastis_config.hpp"
@ONLY) @ONLY)
# Generates pastis_build_info.hpp
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pastis_build_info.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/pastis_build_info.hpp"
@ONLY)
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include <Kokkos_Core.hpp> #include <Kokkos_Core.hpp>
#include <RevisionInfo.hpp> #include <RevisionInfo.hpp>
#include <BuildInfo.hpp>
#include <rang.hpp> #include <rang.hpp>
#include <FPEManager.hpp> #include <FPEManager.hpp>
...@@ -24,8 +26,7 @@ std::string initialize(int& argc, char* argv[]) ...@@ -24,8 +26,7 @@ std::string initialize(int& argc, char* argv[])
<< rang::fg::reset << rang::fg::reset
<<" -------------------------" <<" -------------------------"
<< '\n'; << '\n';
std::cout << "tag: " << rang::fg::reset std::cout << "tag: " << rang::style::bold << RevisionInfo::gitTag() << rang::style::reset << '\n';
<< rang::style::bold << RevisionInfo::gitTag() << rang::style::reset << '\n';
std::cout << "HEAD: " << rang::style::bold << RevisionInfo::gitHead() << rang::style::reset << '\n'; std::cout << "HEAD: " << rang::style::bold << RevisionInfo::gitHead() << rang::style::reset << '\n';
std::cout << "hash: " << rang::style::bold << RevisionInfo::gitHash() << rang::style::reset << " ("; std::cout << "hash: " << rang::style::bold << RevisionInfo::gitHash() << rang::style::reset << " (";
...@@ -35,6 +36,15 @@ std::string initialize(int& argc, char* argv[]) ...@@ -35,6 +36,15 @@ std::string initialize(int& argc, char* argv[])
std::cout << rang::fgB::red << "dirty" << rang::fg::reset; std::cout << rang::fgB::red << "dirty" << rang::fg::reset;
} }
std::cout << ")\n"; std::cout << ")\n";
std::cout << "-------------------- "
<< rang::fg::green
<< "build info"
<< rang::fg::reset
<<" -----------------------"
<< '\n';
std::cout << "type: " << rang::style::bold << BuildInfo::type() << rang::style::reset << '\n';
std::cout << "compiler: " << rang::style::bold << BuildInfo::compiler() << rang::style::reset << '\n';
std::cout << "devices: " << rang::style::bold << BuildInfo::kokkosDevices() << rang::style::reset << '\n';
std::cout << "-------------------------------------------------------\n"; std::cout << "-------------------------------------------------------\n";
{ {
CLI::App app{"Pastis help"}; CLI::App app{"Pastis help"};
......
#ifndef PASTIS_BUILD_INFO_HPP
#define PASTIS_BUILD_INFO_HPP
#define PASTIS_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
#define PASTIS_BUILD_COMPILER "@CMAKE_CXX_COMPILER@"
#define PASTIS_BUILD_KOKKOS_DEVICES "@KOKKOS_GMAKE_DEVICES@"
#endif // PASTIS_BUILD_INFO_HPP
...@@ -6,4 +6,6 @@ ...@@ -6,4 +6,6 @@
#cmakedefine SYSTEM_IS_DARWIN #cmakedefine SYSTEM_IS_DARWIN
#cmakedefine SYSTEM_IS_WINDOWS #cmakedefine SYSTEM_IS_WINDOWS
#define PASTIS_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
#endif // PASTIS_CONFIG_HPP #endif // PASTIS_CONFIG_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment