From 55c0e489eae4ecfd9058b25f519f7ca89cb25329 Mon Sep 17 00:00:00 2001 From: mwlasiuk Date: Mon, 5 Oct 2026 20:36:56 +0200 Subject: [PATCH 1/2] Add automatic configure info --- CMakeLists.txt | 14 +- apps/camera_lidar_calibration/App.cpp | 4 +- .../IntrinsicsCalib.cpp | 4 +- .../TrajectoryViewer.cpp | 8 +- .../mandeye_compare_trajectories.cpp | 4 +- apps/hd_mapper/hd_mapper.cpp | 4 +- ..._data_and_drop_here-precision_forestry.cpp | 4 +- apps/lidar_odometry_step_1/lidar_odometry.cpp | 2 +- apps/lidar_odometry_step_1/lidar_odometry.h | 2 +- .../lidar_odometry_gui.cpp | 4 +- .../lidar_odometry_utils.h | 4 +- .../livox_mid_360_intrinsic_calibration.cpp | 4 +- .../mandeye_mission_recorder_calibration.cpp | 4 +- .../mandeye_raw_data_viewer.cpp | 4 +- .../mandeye_single_session_viewer.cpp | 4 +- .../multi_session_registration.cpp | 4 +- .../multi_session_registration_no_gui.cpp | 4 +- .../raylib_utils.cpp | 4 +- .../multi_session_registration.cpp | 4 +- .../multi_view_tls_registration_gui.cpp | 8 +- .../multi_view_tls_registration_gui.cpp | 4 +- .../precision_forestry_tools.cpp | 4 +- apps/split_multi_livox/split_multi_livox.cpp | 4 +- cmake/configure.cmake | 126 ++++++++++++++++++ cmake/configure/configure.hpp.in | 37 +++++ core/src/session.cpp | 4 +- core/src/utils.cpp | 4 +- .../include/RaylibWidgets/AppShell.h | 2 +- shared/include/HDMapping/.gitignore | 2 + shared/include/HDMapping/Version.hpp | 20 --- 30 files changed, 220 insertions(+), 81 deletions(-) create mode 100644 cmake/configure.cmake create mode 100644 cmake/configure/configure.hpp.in create mode 100644 shared/include/HDMapping/.gitignore delete mode 100644 shared/include/HDMapping/Version.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 54b30b2d..4c8bb1e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,12 @@ cmake_minimum_required(VERSION 4.0.0) -project(hd-mapping) +project(hd-mapping VERSION 0.105.0) # Common settings set(CMAKE_CXX_STANDARD 20) set(CMAKE_POLICY_VERSION_MINIMUM 3.5) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# Versioning settings -set(HDMAPPING_VERSION_MAJOR 0) -set(HDMAPPING_VERSION_MINOR 105) -set(HDMAPPING_VERSION_PATCH 0) # Set up common paths get_filename_component(REPOSITORY_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} ABSOLUTE) @@ -37,11 +33,6 @@ option(BUILD_WITH_BUNDLED_ONETBB "Build with bundled oneTBB" ON) option(BUILD_WITH_PYBIND "Enable pybind11 bindings" OFF) option(HDMAPPING_ASSERT_ALWAYS_ABORT "Make HDMAPPING_ASSERT() abort on failure even in release (NDEBUG) builds" OFF) -# Add definitions for all projects -add_definitions(-DHDMAPPING_VERSION_MAJOR=${HDMAPPING_VERSION_MAJOR}) -add_definitions(-DHDMAPPING_VERSION_MINOR=${HDMAPPING_VERSION_MINOR}) -add_definitions(-DHDMAPPING_VERSION_PATCH=${HDMAPPING_VERSION_PATCH}) - add_definitions(-D_USE_MATH_DEFINES) if (MSVC) @@ -92,6 +83,9 @@ endif() # set(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # endif() +# Configure shared header +include(${REPOSITORY_DIRECTORY}/cmake/configure.cmake) + # Include cmake configs include(cmake/cpu_optimizations.cmake) include(cmake/disable_target_warnings.cmake) diff --git a/apps/camera_lidar_calibration/App.cpp b/apps/camera_lidar_calibration/App.cpp index c15fbc19..c5b3ab3c 100644 --- a/apps/camera_lidar_calibration/App.cpp +++ b/apps/camera_lidar_calibration/App.cpp @@ -3,7 +3,7 @@ #include "raymath.h" #include "rlImGui.h" #include -#include +#include #include #include #include @@ -739,7 +739,7 @@ void App::run() // rendered as flat-shaded point sprites (no polygon edges to smooth), // so the visual benefit was marginal anyway. SetConfigFlags(FLAG_WINDOW_RESIZABLE); - InitWindow(W, H, ("LiDAR-Camera Calibration " HDMAPPING_VERSION_STRING)); + InitWindow(W, H, ("LiDAR-Camera Calibration " HDMAPPING_CONFIGURE_PROJECT_VERSION)); raylib_widgets::fitWindowToScreen(); // The 340px-wide side panel is fixed-width; below this the 3D/image // views and the panel start overlapping instead of scrolling. diff --git a/apps/camera_lidar_intrinsics_calib/IntrinsicsCalib.cpp b/apps/camera_lidar_intrinsics_calib/IntrinsicsCalib.cpp index 4cb45c8c..6246c5fd 100644 --- a/apps/camera_lidar_intrinsics_calib/IntrinsicsCalib.cpp +++ b/apps/camera_lidar_intrinsics_calib/IntrinsicsCalib.cpp @@ -3,7 +3,7 @@ #include "rlImGui.h" #include #include -#include +#include #include #include #include @@ -358,7 +358,7 @@ int main(int argc, char* argv[]) } SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_MSAA_4X_HINT); - InitWindow(1280, 800, ("Intrinsics Calibration " HDMAPPING_VERSION_STRING)); + InitWindow(1280, 800, ("Intrinsics Calibration " HDMAPPING_CONFIGURE_PROJECT_VERSION)); raylib_widgets::fitWindowToScreen(); // PANEL_W below (330) is fixed; below this the image view and panel // start overlapping instead of scrolling. diff --git a/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp b/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp index ca483d4f..ee18860f 100644 --- a/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp +++ b/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -1661,7 +1661,7 @@ static void exportE57(AppState& s) mandeye::e57io::E57WriteScan scan; scan.name = "colored_cloud"; - scan.description = std::string("HDMapping ") + HDMAPPING_VERSION_STRING + " camera_lidar_trajectory_viewer"; + scan.description = std::string("HDMapping ") + HDMAPPING_CONFIGURE_PROJECT_VERSION + " camera_lidar_trajectory_viewer"; scan.points = &pts; scan.colors = &cols; scan.intensities = &inten; @@ -1685,7 +1685,7 @@ static void exportE57Session(AppState& s) return; } - const std::string description = std::string("HDMapping ") + HDMAPPING_VERSION_STRING + " camera_lidar_trajectory_viewer segment"; + const std::string description = std::string("HDMapping ") + HDMAPPING_CONFIGURE_PROJECT_VERSION + " camera_lidar_trajectory_viewer segment"; const size_t nSeg = s.exportSegments.size(); std::vector> segPts(nSeg), segCols(nSeg); @@ -2272,7 +2272,7 @@ int main(int argc, char* argv[]) strncpy(s.maskBuf, args.get("mask").c_str(), sizeof(s.maskBuf) - 1); SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_MSAA_4X_HINT); - InitWindow(1400, 900, ("Trajectory Viewer " HDMAPPING_VERSION_STRING)); + InitWindow(1400, 900, ("Trajectory Viewer " HDMAPPING_CONFIGURE_PROJECT_VERSION)); // raylib's default exit key (Esc) closes the window outright -- too easy // to hit by accident. Disabled; there's no keyboard shortcut for quitting. SetExitKey(KEY_NULL); diff --git a/apps/compare_trajectories/mandeye_compare_trajectories.cpp b/apps/compare_trajectories/mandeye_compare_trajectories.cpp index 4f9c6fa6..49b7fc5e 100644 --- a/apps/compare_trajectories/mandeye_compare_trajectories.cpp +++ b/apps/compare_trajectories/mandeye_compare_trajectories.cpp @@ -22,7 +22,7 @@ #include "../lidar_odometry_step_1/lidar_odometry_utils.h" #include -#include +#include namespace fs = std::filesystem; @@ -988,7 +988,7 @@ bool initGL(int* argc, char** argv) glutInit(argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowSize(window_width, window_height); - glutCreateWindow("mandeye trajectory compare data viewer " HDMAPPING_VERSION_STRING); + glutCreateWindow("mandeye trajectory compare data viewer " HDMAPPING_CONFIGURE_PROJECT_VERSION); glutDisplayFunc(display); glutMotionFunc(motion); diff --git a/apps/hd_mapper/hd_mapper.cpp b/apps/hd_mapper/hd_mapper.cpp index 813067d1..92a50cb3 100644 --- a/apps/hd_mapper/hd_mapper.cpp +++ b/apps/hd_mapper/hd_mapper.cpp @@ -20,7 +20,7 @@ #include -#include +#include Eigen::Vector3d GLWidgetGetOGLPos(int x, int y, float picking_plane_height); @@ -302,7 +302,7 @@ bool initGL(int* argc, char** argv) glutInit(argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowSize(window_width, window_height); - glutCreateWindow("hd_mapper " HDMAPPING_VERSION_STRING); + glutCreateWindow("hd_mapper " HDMAPPING_CONFIGURE_PROJECT_VERSION); glutDisplayFunc(display); glutMotionFunc(motion); diff --git a/apps/lidar_odometry_step_1/drag_folder_with_mandeye_data_and_drop_here-precision_forestry.cpp b/apps/lidar_odometry_step_1/drag_folder_with_mandeye_data_and_drop_here-precision_forestry.cpp index 49821da1..e8535b88 100644 --- a/apps/lidar_odometry_step_1/drag_folder_with_mandeye_data_and_drop_here-precision_forestry.cpp +++ b/apps/lidar_odometry_step_1/drag_folder_with_mandeye_data_and_drop_here-precision_forestry.cpp @@ -19,7 +19,7 @@ #include #include "toml_io.h" -#include +#include #include #include #include @@ -39,7 +39,7 @@ // https://github.com/JanuszBedkowski/mandeye_controller The output is a session proving trajekctory and point clouds that can be further // processed by "multi_view_tls_registration" program. -std::string winTitle = std::string("drag_folder_with_mandeye_data_and_drop_here-precision_forestry ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("drag_folder_with_mandeye_data_and_drop_here-precision_forestry ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is first step in MANDEYE process.", diff --git a/apps/lidar_odometry_step_1/lidar_odometry.cpp b/apps/lidar_odometry_step_1/lidar_odometry.cpp index 1659bf02..5dea711c 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry.cpp +++ b/apps/lidar_odometry_step_1/lidar_odometry.cpp @@ -1058,7 +1058,7 @@ void save_result(std::vector& worker_data, LidarOdometryParams& para j["poses_file_name"] = path2.string(); j["initial_poses_file_name"] = path.string(); j["out_poses_file_name"] = path2.string(); - j["lidar_odometry_version"] = HDMAPPING_VERSION_STRING; + j["lidar_odometry_version"] = HDMAPPING_CONFIGURE_PROJECT_VERSION; j["length of trajectory[m]"] = params.total_length_of_calculated_trajectory; j["elapsed time seconds"] = elapsed_time_s; if (params.save_index_pose) diff --git a/apps/lidar_odometry_step_1/lidar_odometry.h b/apps/lidar_odometry_step_1/lidar_odometry.h index c5883812..41d9cb5e 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry.h +++ b/apps/lidar_odometry_step_1/lidar_odometry.h @@ -5,7 +5,7 @@ #include "lidar_odometry_utils.h" #include "toml_io.h" -#include +#include #include #include diff --git a/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp b/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp index 5fea0cf5..c528603c 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp +++ b/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp @@ -19,7 +19,7 @@ #include #include "toml_io.h" -#include +#include #include #include #include @@ -38,7 +38,7 @@ // https://github.com/JanuszBedkowski/mandeye_controller The output is a session proving trajekctory and point clouds that can be further // processed by "multi_view_tls_registration" program. -std::string winTitle = std::string("Step 1 (Lidar odometry) ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Step 1 (Lidar odometry) ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is first step in MANDEYE process.", diff --git a/apps/lidar_odometry_step_1/lidar_odometry_utils.h b/apps/lidar_odometry_step_1/lidar_odometry_utils.h index 27baae5c..72cbdcff 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry_utils.h +++ b/apps/lidar_odometry_step_1/lidar_odometry_utils.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -43,7 +43,7 @@ using NDTBucketMapType2 = ankerl::unordered_dense::map; // Helper function for getting software version from CMake macros inline std::string get_software_version() { - return HDMAPPING_VERSION_STRING; + return HDMAPPING_CONFIGURE_PROJECT_VERSION; } struct RawCloudLoader; // raw_cloud_loader.h: raw point clouds loaded per file during step 1 diff --git a/apps/livox_mid_360_intrinsic_calibration/livox_mid_360_intrinsic_calibration.cpp b/apps/livox_mid_360_intrinsic_calibration/livox_mid_360_intrinsic_calibration.cpp index b5c63842..09fe021e 100644 --- a/apps/livox_mid_360_intrinsic_calibration/livox_mid_360_intrinsic_calibration.cpp +++ b/apps/livox_mid_360_intrinsic_calibration/livox_mid_360_intrinsic_calibration.cpp @@ -23,7 +23,7 @@ #include "../lidar_odometry_step_1/lidar_odometry_utils.h" -#include +#include #include #include @@ -1225,7 +1225,7 @@ bool initGL(int* argc, char** argv) glutInit(argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowSize(window_width, window_height); - glutCreateWindow("livox_mid_360_intrinsic_calibration " HDMAPPING_VERSION_STRING); + glutCreateWindow("livox_mid_360_intrinsic_calibration " HDMAPPING_CONFIGURE_PROJECT_VERSION); glutDisplayFunc(display); glutMotionFunc(motion); diff --git a/apps/mandeye_mission_recorder_calibration/mandeye_mission_recorder_calibration.cpp b/apps/mandeye_mission_recorder_calibration/mandeye_mission_recorder_calibration.cpp index 7fbc53ca..fcc3e733 100644 --- a/apps/mandeye_mission_recorder_calibration/mandeye_mission_recorder_calibration.cpp +++ b/apps/mandeye_mission_recorder_calibration/mandeye_mission_recorder_calibration.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include @@ -37,7 +37,7 @@ /////////////////////////////////////////////////////////////////////////////////// -std::string winTitle = std::string("MR calibration ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("MR calibration ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is optional step in MANDEYE process", "", diff --git a/apps/mandeye_raw_data_viewer/mandeye_raw_data_viewer.cpp b/apps/mandeye_raw_data_viewer/mandeye_raw_data_viewer.cpp index 32eafac8..a938e25f 100644 --- a/apps/mandeye_raw_data_viewer/mandeye_raw_data_viewer.cpp +++ b/apps/mandeye_raw_data_viewer/mandeye_raw_data_viewer.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include "tbb/tbb.h" #include @@ -43,7 +43,7 @@ /////////////////////////////////////////////////////////////////////////////////// -std::string winTitle = std::string("Raw data viewer ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Raw data viewer ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is optional step in MANDEYE process", "", diff --git a/apps/mandeye_single_session_viewer/mandeye_single_session_viewer.cpp b/apps/mandeye_single_session_viewer/mandeye_single_session_viewer.cpp index 508785b6..542c0c31 100644 --- a/apps/mandeye_single_session_viewer/mandeye_single_session_viewer.cpp +++ b/apps/mandeye_single_session_viewer/mandeye_single_session_viewer.cpp @@ -25,7 +25,7 @@ #include "../lidar_odometry_step_1/lidar_odometry_utils.h" #include -#include +#include #include @@ -37,7 +37,7 @@ /////////////////////////////////////////////////////////////////////////////////// -std::string winTitle = std::string("Single session viewer ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Single session viewer ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is optional step in MANDEYE process", "", diff --git a/apps/multi_session_registration/multi_session_registration.cpp b/apps/multi_session_registration/multi_session_registration.cpp index b19e8f63..6a2d1dbf 100644 --- a/apps/multi_session_registration/multi_session_registration.cpp +++ b/apps/multi_session_registration/multi_session_registration.cpp @@ -36,7 +36,7 @@ #endif #include -#include +#include #ifdef _WIN32 #include "resource.h" @@ -46,7 +46,7 @@ #include "multi_session_factor_graph.h" #include "raylib_utils.h" -std::string winTitle = std::string("Step 3 (Multi session registration) ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Step 3 (Multi session registration) ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is third/final step in MANDEYE process", 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 97ef99ad..f4c4f4b0 100644 --- a/apps/multi_session_registration/multi_session_registration_no_gui.cpp +++ b/apps/multi_session_registration/multi_session_registration_no_gui.cpp @@ -18,7 +18,7 @@ #include -#include +#include #ifdef _WIN32 #include "resource.h" @@ -28,7 +28,7 @@ #include "multi_session_factor_graph.h" -std::string winTitle = std::string("Step 3 (Multi session registration) ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Step 3 (Multi session registration) ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is third/final step in MANDEYE process", diff --git a/apps/multi_session_registration/raylib_utils.cpp b/apps/multi_session_registration/raylib_utils.cpp index 7d6a0eae..d6c667cb 100644 --- a/apps/multi_session_registration/raylib_utils.cpp +++ b/apps/multi_session_registration/raylib_utils.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -450,7 +450,7 @@ void cor_window() void info_window(const std::vector& infoLines, const std::vector& appShortcuts) { - raylib_widgets::ShowInfoWindow(info_gui, infoLines, appShortcuts, HDMAPPING_VERSION_STRING, __DATE__); + raylib_widgets::ShowInfoWindow(info_gui, infoLines, appShortcuts, HDMAPPING_CONFIGURE_PROJECT_VERSION, __DATE__); } void drawMiniCompassWithRuler() diff --git a/apps/multi_session_registration_legacy/multi_session_registration.cpp b/apps/multi_session_registration_legacy/multi_session_registration.cpp index ca6a4bbf..bed35aa8 100644 --- a/apps/multi_session_registration_legacy/multi_session_registration.cpp +++ b/apps/multi_session_registration_legacy/multi_session_registration.cpp @@ -27,7 +27,7 @@ #include -#include +#include #ifdef _WIN32 #include "resource.h" @@ -37,7 +37,7 @@ #include "multi_session_factor_graph.h" -std::string winTitle = std::string("Step 3 (Multi session registration) ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Step 3 (Multi session registration) ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is third/final step in MANDEYE process", diff --git a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp index 27af27ec..47092af1 100644 --- a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp +++ b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp @@ -90,7 +90,7 @@ #include "../lidar_odometry_step_1/lidar_odometry_utils.h" #include "multi_view_tls_registration.h" -#include +#include #include "WGS84toCartesian/WGS84toCartesian.hpp" #include "wgs84_do_puwg92/wgs84_do_puwg92.h" @@ -863,7 +863,7 @@ bool consWin = true; #endif bool consImGui = false; -std::string winTitle = std::string("Step 2 (Multi view TSL registration) ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Step 2 (Multi view TSL registration) ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is second step in MANDEYE process", @@ -3097,7 +3097,7 @@ void saveSessionAsE57() if (out.empty()) return; - const std::string description = std::string("HDMapping ") + HDMAPPING_VERSION_STRING + " session"; + const std::string description = std::string("HDMapping ") + HDMAPPING_CONFIGURE_PROJECT_VERSION + " session"; std::vector scans; scans.reserve(session.point_clouds_container.point_clouds.size()); @@ -6114,7 +6114,7 @@ void display() raylib_widgets::showEulerCenterOfRotationWindow(cor_gui, app_state.camera, xText, yText, zText); - raylib_widgets::ShowInfoWindow(app_state.info_gui, infoLines, appShortcuts, HDMAPPING_VERSION_STRING, __DATE__); + raylib_widgets::ShowInfoWindow(app_state.info_gui, infoLines, appShortcuts, HDMAPPING_CONFIGURE_PROJECT_VERSION, __DATE__); draw_translate_preview(); diff --git a/apps/multi_view_tls_registration_legacy/multi_view_tls_registration_gui.cpp b/apps/multi_view_tls_registration_legacy/multi_view_tls_registration_gui.cpp index 84c26ef2..3b97cfe1 100644 --- a/apps/multi_view_tls_registration_legacy/multi_view_tls_registration_gui.cpp +++ b/apps/multi_view_tls_registration_legacy/multi_view_tls_registration_gui.cpp @@ -42,7 +42,7 @@ #include "../lidar_odometry_step_1/lidar_odometry_utils.h" #include "multi_view_tls_registration.h" -#include +#include #include "WGS84toCartesian/WGS84toCartesian.hpp" #include "wgs84_do_puwg92/wgs84_do_puwg92.h" @@ -61,7 +61,7 @@ bool consWin = true; #endif bool consImGui = false; -std::string winTitle = std::string("Step 2 (Multi view TSL registration) ") + HDMAPPING_VERSION_STRING; +std::string winTitle = std::string("Step 2 (Multi view TSL registration) ") + HDMAPPING_CONFIGURE_PROJECT_VERSION; std::vector infoLines = { "This program is second step in MANDEYE process", diff --git a/apps/precision_forestry_tools/precision_forestry_tools.cpp b/apps/precision_forestry_tools/precision_forestry_tools.cpp index d6e9ea30..7dbdad78 100644 --- a/apps/precision_forestry_tools/precision_forestry_tools.cpp +++ b/apps/precision_forestry_tools/precision_forestry_tools.cpp @@ -15,7 +15,7 @@ #include -#include +#include #include #include @@ -821,7 +821,7 @@ bool initGL(int* argc, char** argv) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowSize(window_width, window_height); - glutCreateWindow("precision_forestry_tools " HDMAPPING_VERSION_STRING); + glutCreateWindow("precision_forestry_tools " HDMAPPING_CONFIGURE_PROJECT_VERSION); glutDisplayFunc(display); glutMotionFunc(motion); diff --git a/apps/split_multi_livox/split_multi_livox.cpp b/apps/split_multi_livox/split_multi_livox.cpp index a82bdde0..281c2930 100644 --- a/apps/split_multi_livox/split_multi_livox.cpp +++ b/apps/split_multi_livox/split_multi_livox.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -124,7 +124,7 @@ std::unordered_map GetIdToStringMapping(const std::string& fil int main(int argc, char* argv[]) { - std::cout << "Version " HDMAPPING_VERSION_STRING << std::endl; + std::cout << "Version " HDMAPPING_CONFIGURE_PROJECT_VERSION << std::endl; std::vector arguments; for (int i = 1; i < argc; i++) { diff --git a/cmake/configure.cmake b/cmake/configure.cmake new file mode 100644 index 00000000..cc434d32 --- /dev/null +++ b/cmake/configure.cmake @@ -0,0 +1,126 @@ +include_guard() + +# ------------------------------------------------------------ +# Build configuration +# ------------------------------------------------------------ + +if(CMAKE_CONFIGURATION_TYPES) + set(HDMAPPING_CONFIGURE_IS_MULTICONFIG "ON") + list(JOIN CMAKE_CONFIGURATION_TYPES ";" HDMAPPING_CONFIGURE_BUILD_TYPES) +else() + set(HDMAPPING_CONFIGURE_IS_MULTICONFIG "OFF") + set(HDMAPPING_CONFIGURE_BUILD_TYPES "${CMAKE_BUILD_TYPE}") +endif() + +# ------------------------------------------------------------ +# Platform +# ------------------------------------------------------------ + +set(HDMAPPING_CONFIGURE_SYSTEM "${CMAKE_SYSTEM_NAME}") +set(HDMAPPING_CONFIGURE_SYSTEM_VERSION "${CMAKE_SYSTEM_VERSION}") +set(HDMAPPING_CONFIGURE_CPU "${CMAKE_SYSTEM_PROCESSOR}") + +# ------------------------------------------------------------ +# Compiler +# ------------------------------------------------------------ + +set(HDMAPPING_CONFIGURE_COMPILER "${CMAKE_CXX_COMPILER_ID}") +set(HDMAPPING_CONFIGURE_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}") +set(HDMAPPING_CONFIGURE_COMPILER_PATH "${CMAKE_CXX_COMPILER}") + +# ------------------------------------------------------------ +# CMake +# ------------------------------------------------------------ + +set(HDMAPPING_CONFIGURE_CMAKE_VERSION "${CMAKE_VERSION}") +set(HDMAPPING_CONFIGURE_GENERATOR "${CMAKE_GENERATOR}") + +# ------------------------------------------------------------ +# Project +# ------------------------------------------------------------ + +set(HDMAPPING_CONFIGURE_PROJECT_NAME "${PROJECT_NAME}") +set(HDMAPPING_CONFIGURE_PROJECT_VERSION "${PROJECT_VERSION}") + +# ------------------------------------------------------------ +# Language +# ------------------------------------------------------------ + +set(HDMAPPING_CONFIGURE_CXX_STANDARD "${CMAKE_CXX_STANDARD}") + +# ------------------------------------------------------------ +# Timestamp +# ------------------------------------------------------------ + +string(TIMESTAMP HDMAPPING_CONFIGURE_TIMESTAMP "%Y-%m-%d %H:%M:%S") + +# ------------------------------------------------------------ +# Git +# ------------------------------------------------------------ + +execute_process( + COMMAND git rev-parse HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE HDMAPPING_CONFIGURE_GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + +execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE HDMAPPING_CONFIGURE_GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) + +foreach(VAR + HDMAPPING_CONFIGURE_GIT_HASH + HDMAPPING_CONFIGURE_GIT_BRANCH) + if(NOT ${VAR}) + set(${VAR} "unknown") + endif() +endforeach() + +execute_process( + COMMAND git status --porcelain + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE HDMAPPING_CONFIGURE_GIT_STATUS_PORCELAIN + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) +if(HDMAPPING_CONFIGURE_GIT_STATUS_PORCELAIN STREQUAL "") + set(HDMAPPING_CONFIGURE_GIT_IS_DIRTY "false") +else() + set(HDMAPPING_CONFIGURE_GIT_IS_DIRTY "true") +endif() + +# ------------------------------------------------------------ +# Architecture and Flags +# ------------------------------------------------------------ + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(HDMAPPING_CONFIGURE_IS_64_BIT "true") +else() + set(HDMAPPING_CONFIGURE_IS_64_BIT "false") +endif() + +set(HDMAPPING_CONFIGURE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +set(HDMAPPING_CONFIGURE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") +set(HDMAPPING_CONFIGURE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + +set(HDMAPPING_CONFIGURE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + +# ------------------------------------------------------------ +# Host System +# ------------------------------------------------------------ + +set(HDMAPPING_CONFIGURE_HOST_SYSTEM "${CMAKE_HOST_SYSTEM_NAME}") +set(HDMAPPING_CONFIGURE_HOST_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") +set(HDMAPPING_CONFIGURE_HOST_CPU "${CMAKE_HOST_SYSTEM_PROCESSOR}") + +configure_file( + "${REPOSITORY_DIRECTORY}/cmake/configure/configure.hpp.in" + "${REPOSITORY_DIRECTORY}/shared/include/HDMapping/HDMAPPING_ConfigureInfo.hpp" + @ONLY +) \ No newline at end of file diff --git a/cmake/configure/configure.hpp.in b/cmake/configure/configure.hpp.in new file mode 100644 index 00000000..e733f262 --- /dev/null +++ b/cmake/configure/configure.hpp.in @@ -0,0 +1,37 @@ +#pragma once + +#define HDMAPPING_CONFIGURE_BUILD_TYPES "@HDMAPPING_CONFIGURE_BUILD_TYPES@" +#define HDMAPPING_CONFIGURE_IS_MULTICONFIG "@HDMAPPING_CONFIGURE_IS_MULTICONFIG@" + +#define HDMAPPING_CONFIGURE_SYSTEM "@HDMAPPING_CONFIGURE_SYSTEM@" +#define HDMAPPING_CONFIGURE_SYSTEM_VERSION "@HDMAPPING_CONFIGURE_SYSTEM_VERSION@" +#define HDMAPPING_CONFIGURE_CPU "@HDMAPPING_CONFIGURE_CPU@" + +#define HDMAPPING_CONFIGURE_COMPILER "@HDMAPPING_CONFIGURE_COMPILER@" +#define HDMAPPING_CONFIGURE_COMPILER_VERSION "@HDMAPPING_CONFIGURE_COMPILER_VERSION@" +#define HDMAPPING_CONFIGURE_COMPILER_PATH "@HDMAPPING_CONFIGURE_COMPILER_PATH@" + +#define HDMAPPING_CONFIGURE_CMAKE_VERSION "@HDMAPPING_CONFIGURE_CMAKE_VERSION@" +#define HDMAPPING_CONFIGURE_GENERATOR "@HDMAPPING_CONFIGURE_GENERATOR@" + +#define HDMAPPING_CONFIGURE_PROJECT_NAME "@HDMAPPING_CONFIGURE_PROJECT_NAME@" +#define HDMAPPING_CONFIGURE_PROJECT_VERSION "@HDMAPPING_CONFIGURE_PROJECT_VERSION@" + +#define HDMAPPING_CONFIGURE_CXX_STANDARD "@HDMAPPING_CONFIGURE_CXX_STANDARD@" + +#define HDMAPPING_CONFIGURE_TIMESTAMP "@HDMAPPING_CONFIGURE_TIMESTAMP@" + +#define HDMAPPING_CONFIGURE_GIT_HASH "@HDMAPPING_CONFIGURE_GIT_HASH@" +#define HDMAPPING_CONFIGURE_GIT_BRANCH "@HDMAPPING_CONFIGURE_GIT_BRANCH@" +#define HDMAPPING_CONFIGURE_GIT_IS_DIRTY "@HDMAPPING_CONFIGURE_GIT_IS_DIRTY@" + +#define HDMAPPING_CONFIGURE_IS_64_BIT "@HDMAPPING_CONFIGURE_IS_64_BIT@" + +#define HDMAPPING_CONFIGURE_CXX_FLAGS "@HDMAPPING_CONFIGURE_CXX_FLAGS@" +#define HDMAPPING_CONFIGURE_CXX_FLAGS_DEBUG "@HDMAPPING_CONFIGURE_CXX_FLAGS_DEBUG@" +#define HDMAPPING_CONFIGURE_CXX_FLAGS_RELEASE "@HDMAPPING_CONFIGURE_CXX_FLAGS_RELEASE@" +#define HDMAPPING_CONFIGURE_EXE_LINKER_FLAGS "@HDMAPPING_CONFIGURE_EXE_LINKER_FLAGS@" + +#define HDMAPPING_CONFIGURE_HOST_SYSTEM "@HDMAPPING_CONFIGURE_HOST_SYSTEM@" +#define HDMAPPING_CONFIGURE_HOST_SYSTEM_VERSION "@HDMAPPING_CONFIGURE_HOST_SYSTEM_VERSION@" +#define HDMAPPING_CONFIGURE_HOST_CPU "@HDMAPPING_CONFIGURE_HOST_CPU@" diff --git a/core/src/session.cpp b/core/src/session.cpp index af012137..d903a4fa 100644 --- a/core/src/session.cpp +++ b/core/src/session.cpp @@ -4,7 +4,7 @@ #include -#include +#include namespace fs = std::filesystem; @@ -331,7 +331,7 @@ bool Session::save( j["initial_poses_file_name"] = initial_poses_file_name; // point_clouds_container.initial_poses_file_name; j["out_poses_file_name"] = point_clouds_container.out_poses_file_name; j["ground_truth"] = is_ground_truth; - j["exporting_software_version"] = HDMAPPING_VERSION_STRING; + j["exporting_software_version"] = HDMAPPING_CONFIGURE_PROJECT_VERSION; jj["Session Settings"] = j; nlohmann::json jloop_closure_edges; diff --git a/core/src/utils.cpp b/core/src/utils.cpp index 8490769e..e417b86a 100644 --- a/core/src/utils.cpp +++ b/core/src/utils.cpp @@ -17,7 +17,7 @@ #include -#include +#include #ifdef _WIN32 #include @@ -1127,7 +1127,7 @@ void info_window(const std::vector& infoLines, const std::vector& infoLines, const std::vector& appShortcuts, const char* versionString, const char* buildDate); diff --git a/shared/include/HDMapping/.gitignore b/shared/include/HDMapping/.gitignore new file mode 100644 index 00000000..4ac2fc5a --- /dev/null +++ b/shared/include/HDMapping/.gitignore @@ -0,0 +1,2 @@ +# File automatically generated when compiling project from source - do NOT include in commit +HDMAPPING_ConfigureInfo.hpp \ No newline at end of file diff --git a/shared/include/HDMapping/Version.hpp b/shared/include/HDMapping/Version.hpp deleted file mode 100644 index 47c9e0a2..00000000 --- a/shared/include/HDMapping/Version.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#ifndef HDMAPPING_VERSION_MAJOR -#error "Major version not defined - define HDMAPPING_VERSION_MAJOR inside top-level CMakeLists.txt file." -#endif - -#ifndef HDMAPPING_VERSION_MINOR -#error "Minor version not defined - define HDMAPPING_VERSION_MINOR inside top-level CMakeLists.txt file." -#endif - -#ifndef HDMAPPING_VERSION_PATCH -#error "Minor version not defined - define HDMAPPING_VERSION_PATCH inside top-level CMakeLists.txt file." -#endif - -#define HDMAPPING_DEFINITION_TO_STRING_X(definition) #definition -#define HDMAPPING_DEFINITION_TO_STRING(definition) HDMAPPING_DEFINITION_TO_STRING_X(definition) - -#define HDMAPPING_VERSION_STRING \ - "v" HDMAPPING_DEFINITION_TO_STRING(HDMAPPING_VERSION_MAJOR) "." HDMAPPING_DEFINITION_TO_STRING( \ - HDMAPPING_VERSION_MINOR) "." HDMAPPING_DEFINITION_TO_STRING(HDMAPPING_VERSION_PATCH) From c289e3ee2f505512caf3fff517492b130bf33225 Mon Sep 17 00:00:00 2001 From: mwlasiuk Date: Tue, 6 Oct 2026 18:53:59 +0200 Subject: [PATCH 2/2] Fix clang-format --- apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp b/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp index ee18860f..f4800d6b 100644 --- a/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp +++ b/apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -1685,7 +1685,8 @@ static void exportE57Session(AppState& s) return; } - const std::string description = std::string("HDMapping ") + HDMAPPING_CONFIGURE_PROJECT_VERSION + " camera_lidar_trajectory_viewer segment"; + const std::string description = + std::string("HDMapping ") + HDMAPPING_CONFIGURE_PROJECT_VERSION + " camera_lidar_trajectory_viewer segment"; const size_t nSeg = s.exportSegments.size(); std::vector> segPts(nSeg), segCols(nSeg);