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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#endif

#include <HDMapping/Assert.h>
#include <HDMapping/BuildInfo.h>
#include <HDMapping/HDMAPPING_ConfigureInfo.hpp>
#include <HDMapping/SessionPaths.h>

Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <portable-file-dialogs.h>

#include <HDMapping/BuildInfo.h>
#include <HDMapping/HDMAPPING_ConfigureInfo.hpp>
#include <HDMapping/SessionPaths.h>

Expand Down Expand Up @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions core/src/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <nlohmann/json.hpp>

#include <HDMapping/BuildInfo.h>
#include <HDMapping/HDMAPPING_ConfigureInfo.hpp>
#include <HDMapping/SessionPaths.h>

Expand Down Expand Up @@ -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)
Expand Down
36 changes: 36 additions & 0 deletions shared/include/HDMapping/BuildInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once
#include <nlohmann/json.hpp>

#include <HDMapping/HDMAPPING_ConfigureInfo.hpp>

//! 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 },
};
}
Loading