From 24fa4944e584cbca2a77cf081c59182ba1203e60 Mon Sep 17 00:00:00 2001 From: mwlasiuk Date: Thu, 26 Nov 2026 19:32:39 +0100 Subject: [PATCH] Add build configuration information to steps 2 and 3 --- .../multi_session_registration.cpp | 2 ++ .../multi_session_registration_no_gui.cpp | 2 ++ core/src/session.cpp | 2 ++ shared/include/HDMapping/BuildInfo.h | 36 +++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 shared/include/HDMapping/BuildInfo.h diff --git a/apps/multi_session_registration/multi_session_registration.cpp b/apps/multi_session_registration/multi_session_registration.cpp index 172a647b..04724830 100644 --- a/apps/multi_session_registration/multi_session_registration.cpp +++ b/apps/multi_session_registration/multi_session_registration.cpp @@ -36,6 +36,7 @@ #endif #include +#include #include #include @@ -1331,6 +1332,7 @@ bool save_project_settings(const std::string& file_name, const ProjectSettings& jloop_closure_edges.push_back(jloop_closure_edge); } jj["loop_closure_edges"] = jloop_closure_edges; + jj["build_info"] = buildInfoJson(); std::ofstream fs(file_name); if (!fs.good()) diff --git a/apps/multi_session_registration/multi_session_registration_no_gui.cpp b/apps/multi_session_registration/multi_session_registration_no_gui.cpp index 7e85bf79..e3af6da1 100644 --- a/apps/multi_session_registration/multi_session_registration_no_gui.cpp +++ b/apps/multi_session_registration/multi_session_registration_no_gui.cpp @@ -18,6 +18,7 @@ #include +#include #include #include @@ -362,6 +363,7 @@ bool save_project_settings(const std::string& file_name, const ProjectSettings& jloop_closure_edges.push_back(jloop_closure_edge); } jj["loop_closure_edges"] = jloop_closure_edges; + jj["build_info"] = buildInfoJson(); std::ofstream fs(file_name); if (!fs.good()) diff --git a/core/src/session.cpp b/core/src/session.cpp index b40aadc8..07a435b4 100644 --- a/core/src/session.cpp +++ b/core/src/session.cpp @@ -4,6 +4,7 @@ #include +#include #include #include @@ -394,6 +395,7 @@ bool Session::save( j["ground_truth"] = is_ground_truth; j["exporting_software_version"] = HDMAPPING_CONFIGURE_PROJECT_VERSION; jj["Session Settings"] = j; + jj["build_info"] = buildInfoJson(); nlohmann::json jloop_closure_edges; if (!is_subsession) diff --git a/shared/include/HDMapping/BuildInfo.h b/shared/include/HDMapping/BuildInfo.h new file mode 100644 index 00000000..f687d353 --- /dev/null +++ b/shared/include/HDMapping/BuildInfo.h @@ -0,0 +1,36 @@ +#pragma once +#include + +#include + +//! Build configuration from HDMAPPING_ConfigureInfo.hpp, stored as "build_info" in session and project files. +inline nlohmann::json buildInfoJson() +{ + return { + { "build_types", HDMAPPING_CONFIGURE_BUILD_TYPES }, + { "is_multiconfig", HDMAPPING_CONFIGURE_IS_MULTICONFIG }, + { "system", HDMAPPING_CONFIGURE_SYSTEM }, + { "system_version", HDMAPPING_CONFIGURE_SYSTEM_VERSION }, + { "cpu", HDMAPPING_CONFIGURE_CPU }, + { "compiler", HDMAPPING_CONFIGURE_COMPILER }, + { "compiler_version", HDMAPPING_CONFIGURE_COMPILER_VERSION }, + { "compiler_path", HDMAPPING_CONFIGURE_COMPILER_PATH }, + { "cmake_version", HDMAPPING_CONFIGURE_CMAKE_VERSION }, + { "generator", HDMAPPING_CONFIGURE_GENERATOR }, + { "project_name", HDMAPPING_CONFIGURE_PROJECT_NAME }, + { "project_version", HDMAPPING_CONFIGURE_PROJECT_VERSION }, + { "cxx_standard", HDMAPPING_CONFIGURE_CXX_STANDARD }, + { "timestamp", HDMAPPING_CONFIGURE_TIMESTAMP }, + { "git_hash", HDMAPPING_CONFIGURE_GIT_HASH }, + { "git_branch", HDMAPPING_CONFIGURE_GIT_BRANCH }, + { "git_is_dirty", HDMAPPING_CONFIGURE_GIT_IS_DIRTY }, + { "is_64_bit", HDMAPPING_CONFIGURE_IS_64_BIT }, + { "cxx_flags", HDMAPPING_CONFIGURE_CXX_FLAGS }, + { "cxx_flags_debug", HDMAPPING_CONFIGURE_CXX_FLAGS_DEBUG }, + { "cxx_flags_release", HDMAPPING_CONFIGURE_CXX_FLAGS_RELEASE }, + { "exe_linker_flags", HDMAPPING_CONFIGURE_EXE_LINKER_FLAGS }, + { "host_system", HDMAPPING_CONFIGURE_HOST_SYSTEM }, + { "host_system_version", HDMAPPING_CONFIGURE_HOST_SYSTEM_VERSION }, + { "host_cpu", HDMAPPING_CONFIGURE_HOST_CPU }, + }; +}