From aaa82739284656d57fc35ccf2f14141d142b8b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pe=C5=82ka?= Date: Thu, 10 Sep 2026 11:29:29 +0200 Subject: [PATCH 1/2] add install prefix to executables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Pełka --- CMakeLists.txt | 1 + apps/camera_lidar_calibration/CMakeLists.txt | 2 +- apps/camera_lidar_intrinsics_calib/CMakeLists.txt | 2 +- .../camera_lidar_trajectory_viewer/CMakeLists.txt | 2 +- apps/compare_trajectories/CMakeLists.txt | 2 +- apps/concatenate_multi_livox/CMakeLists.txt | 2 +- apps/console_tools/CMakeLists.txt | 15 ++++++++++++++- apps/hd_mapper/CMakeLists.txt | 2 +- apps/lidar_odometry_step_1/CMakeLists.txt | 4 +++- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- apps/mandeye_raw_data_viewer/CMakeLists.txt | 2 +- apps/mandeye_single_session_viewer/CMakeLists.txt | 2 +- apps/manual_color/CMakeLists.txt | 2 +- apps/multi_session_registration/CMakeLists.txt | 2 +- apps/multi_view_tls_registration/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- apps/precision_forestry_tools/CMakeLists.txt | 2 +- .../single_session_manual_coloring/CMakeLists.txt | 2 +- apps/split_multi_livox/CMakeLists.txt | 2 +- deploy_mandeye.bat | 13 +++++++++---- 21 files changed, 44 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 914e91c1..b88a85ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # Include cmake configs include(cmake/cpu_optimizations.cmake) include(cmake/disable_target_warnings.cmake) +include(cmake/install_app.cmake) include(cmake/platform.cmake) include(cmake/imgui.cmake) include(cmake/imguizmo.cmake) diff --git a/apps/camera_lidar_calibration/CMakeLists.txt b/apps/camera_lidar_calibration/CMakeLists.txt index ce28ef36..568ad7cc 100644 --- a/apps/camera_lidar_calibration/CMakeLists.txt +++ b/apps/camera_lidar_calibration/CMakeLists.txt @@ -60,4 +60,4 @@ if(MSVC) target_compile_options(camera_lidar_calibration PRIVATE /bigobj) endif() -install(TARGETS camera_lidar_calibration DESTINATION bin) +hdmapping_install_app(camera_lidar_calibration) diff --git a/apps/camera_lidar_intrinsics_calib/CMakeLists.txt b/apps/camera_lidar_intrinsics_calib/CMakeLists.txt index 9765bcc6..21e9abfc 100644 --- a/apps/camera_lidar_intrinsics_calib/CMakeLists.txt +++ b/apps/camera_lidar_intrinsics_calib/CMakeLists.txt @@ -50,4 +50,4 @@ if(MSVC) target_compile_options(camera_lidar_intrinsics_calib PRIVATE /bigobj) endif() -install(TARGETS camera_lidar_intrinsics_calib DESTINATION bin) +hdmapping_install_app(camera_lidar_intrinsics_calib) diff --git a/apps/camera_lidar_trajectory_viewer/CMakeLists.txt b/apps/camera_lidar_trajectory_viewer/CMakeLists.txt index 895e68ee..47445a92 100644 --- a/apps/camera_lidar_trajectory_viewer/CMakeLists.txt +++ b/apps/camera_lidar_trajectory_viewer/CMakeLists.txt @@ -106,4 +106,4 @@ if(MSVC) target_compile_options(camera_lidar_trajectory_viewer PRIVATE /bigobj) endif() -install(TARGETS camera_lidar_trajectory_viewer DESTINATION bin) +hdmapping_install_app(camera_lidar_trajectory_viewer) diff --git a/apps/compare_trajectories/CMakeLists.txt b/apps/compare_trajectories/CMakeLists.txt index 862882bf..f8c316f3 100644 --- a/apps/compare_trajectories/CMakeLists.txt +++ b/apps/compare_trajectories/CMakeLists.txt @@ -54,4 +54,4 @@ if (MSVC) target_compile_options(mandeye_compare_trajectories PRIVATE /bigobj) endif() -install(TARGETS mandeye_compare_trajectories DESTINATION bin) \ No newline at end of file +hdmapping_install_app(mandeye_compare_trajectories) \ No newline at end of file diff --git a/apps/concatenate_multi_livox/CMakeLists.txt b/apps/concatenate_multi_livox/CMakeLists.txt index 644a9b62..1723f5c4 100644 --- a/apps/concatenate_multi_livox/CMakeLists.txt +++ b/apps/concatenate_multi_livox/CMakeLists.txt @@ -42,4 +42,4 @@ if (MSVC) target_compile_options(concatenate_multi_livox PRIVATE /bigobj) endif() -install (TARGETS concatenate_multi_livox DESTINATION bin) \ No newline at end of file +hdmapping_install_app(concatenate_multi_livox) \ No newline at end of file diff --git a/apps/console_tools/CMakeLists.txt b/apps/console_tools/CMakeLists.txt index 9fdab971..860920f2 100644 --- a/apps/console_tools/CMakeLists.txt +++ b/apps/console_tools/CMakeLists.txt @@ -117,4 +117,17 @@ endif() if (MSVC) target_compile_options(laz_to_mcap PRIVATE /bigobj) -endif() \ No newline at end of file +endif() + +# These are built whenever BUILD_WITH_CLI_TOOLS is ON (the default), so they +# ship in the DEB package alongside the GUI apps. +hdmapping_install_app( + matrix_mul + multiply_timestamps_session_point_cloud_laz + multiply_timestamps_session_trajectory_csv + laz_to_ply + laz_to_pcd + pcd_to_laz + laz_to_txt + laz_to_mcap + mcap_to_laz) diff --git a/apps/hd_mapper/CMakeLists.txt b/apps/hd_mapper/CMakeLists.txt index c800bc9d..b100feb9 100644 --- a/apps/hd_mapper/CMakeLists.txt +++ b/apps/hd_mapper/CMakeLists.txt @@ -48,4 +48,4 @@ if(WIN32) COMMAND_EXPAND_LISTS) endif() -install(TARGETS hd_mapper DESTINATION bin) \ No newline at end of file +hdmapping_install_app(hd_mapper) \ No newline at end of file diff --git a/apps/lidar_odometry_step_1/CMakeLists.txt b/apps/lidar_odometry_step_1/CMakeLists.txt index dbcdf0e2..3c5ef37a 100644 --- a/apps/lidar_odometry_step_1/CMakeLists.txt +++ b/apps/lidar_odometry_step_1/CMakeLists.txt @@ -146,4 +146,6 @@ if (MSVC) target_compile_options(drag_folder_with_mandeye_data_and_drop_here-precision_forestry PRIVATE /bigobj) endif() -install(TARGETS drag_folder_with_mandeye_data_and_drop_here-precision_forestry DESTINATION bin) \ No newline at end of file +hdmapping_install_app( + lidar_odometry_step_1 + drag_folder_with_mandeye_data_and_drop_here-precision_forestry) \ No newline at end of file diff --git a/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt b/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt index fd20d27a..dfc89566 100644 --- a/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt +++ b/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt @@ -56,4 +56,4 @@ if (MSVC) target_compile_options(livox_mid_360_intrinsic_calibration PRIVATE /bigobj) endif() -install(TARGETS livox_mid_360_intrinsic_calibration DESTINATION bin) \ No newline at end of file +hdmapping_install_app(livox_mid_360_intrinsic_calibration) \ No newline at end of file diff --git a/apps/mandeye_mission_recorder_calibration/CMakeLists.txt b/apps/mandeye_mission_recorder_calibration/CMakeLists.txt index cffa1847..04feb1b4 100644 --- a/apps/mandeye_mission_recorder_calibration/CMakeLists.txt +++ b/apps/mandeye_mission_recorder_calibration/CMakeLists.txt @@ -66,4 +66,4 @@ if (MSVC) target_compile_options(mandeye_mission_recorder_calibration PRIVATE /bigobj) endif() -install(TARGETS mandeye_mission_recorder_calibration DESTINATION bin) \ No newline at end of file +hdmapping_install_app(mandeye_mission_recorder_calibration) \ No newline at end of file diff --git a/apps/mandeye_raw_data_viewer/CMakeLists.txt b/apps/mandeye_raw_data_viewer/CMakeLists.txt index 87362d60..ad213454 100644 --- a/apps/mandeye_raw_data_viewer/CMakeLists.txt +++ b/apps/mandeye_raw_data_viewer/CMakeLists.txt @@ -71,4 +71,4 @@ if (MSVC) target_compile_options(mandeye_raw_data_viewer PRIVATE /bigobj) endif() -install(TARGETS mandeye_raw_data_viewer DESTINATION bin) \ No newline at end of file +hdmapping_install_app(mandeye_raw_data_viewer) \ No newline at end of file diff --git a/apps/mandeye_single_session_viewer/CMakeLists.txt b/apps/mandeye_single_session_viewer/CMakeLists.txt index 0313b5fa..c8379fbc 100644 --- a/apps/mandeye_single_session_viewer/CMakeLists.txt +++ b/apps/mandeye_single_session_viewer/CMakeLists.txt @@ -65,4 +65,4 @@ if (MSVC) target_compile_options(mandeye_single_session_viewer PRIVATE /bigobj) endif() -install(TARGETS mandeye_single_session_viewer DESTINATION bin) \ No newline at end of file +hdmapping_install_app(mandeye_single_session_viewer) \ No newline at end of file diff --git a/apps/manual_color/CMakeLists.txt b/apps/manual_color/CMakeLists.txt index aff345ec..0b946882 100644 --- a/apps/manual_color/CMakeLists.txt +++ b/apps/manual_color/CMakeLists.txt @@ -47,4 +47,4 @@ if (MSVC) target_compile_options(mandeye_with_360_camera_manual_coloring PRIVATE /bigobj) endif() -install(TARGETS mandeye_with_360_camera_manual_coloring DESTINATION bin) \ No newline at end of file +hdmapping_install_app(mandeye_with_360_camera_manual_coloring) \ No newline at end of file diff --git a/apps/multi_session_registration/CMakeLists.txt b/apps/multi_session_registration/CMakeLists.txt index 2a5fa72e..bd9be085 100644 --- a/apps/multi_session_registration/CMakeLists.txt +++ b/apps/multi_session_registration/CMakeLists.txt @@ -64,4 +64,4 @@ if (MSVC) target_compile_options(multi_session_registration_step_3 PRIVATE /bigobj) endif() -install (TARGETS multi_session_registration_step_3 DESTINATION bin) \ No newline at end of file +hdmapping_install_app(multi_session_registration_step_3) \ No newline at end of file diff --git a/apps/multi_view_tls_registration/CMakeLists.txt b/apps/multi_view_tls_registration/CMakeLists.txt index ca83491b..03beee8e 100644 --- a/apps/multi_view_tls_registration/CMakeLists.txt +++ b/apps/multi_view_tls_registration/CMakeLists.txt @@ -95,4 +95,4 @@ if (MSVC) target_compile_options(multi_view_tls_registration_step_2 PRIVATE /bigobj) endif() -install (TARGETS multi_view_tls_registration_step_2 DESTINATION bin) +hdmapping_install_app(multi_view_tls_registration_step_2) diff --git a/apps/multi_view_tls_registration_legacy/CMakeLists.txt b/apps/multi_view_tls_registration_legacy/CMakeLists.txt index 57549a5b..51331851 100644 --- a/apps/multi_view_tls_registration_legacy/CMakeLists.txt +++ b/apps/multi_view_tls_registration_legacy/CMakeLists.txt @@ -77,4 +77,4 @@ if (MSVC) target_compile_options(multi_view_tls_registration_step_2_legacy PRIVATE /bigobj) endif() -install (TARGETS multi_view_tls_registration_step_2_legacy DESTINATION bin) +hdmapping_install_app(multi_view_tls_registration_step_2_legacy) diff --git a/apps/precision_forestry_tools/CMakeLists.txt b/apps/precision_forestry_tools/CMakeLists.txt index afc596e2..d14aafaf 100644 --- a/apps/precision_forestry_tools/CMakeLists.txt +++ b/apps/precision_forestry_tools/CMakeLists.txt @@ -48,4 +48,4 @@ if (MSVC) target_compile_options(precision_forestry_tools PRIVATE /bigobj) endif() -install (TARGETS precision_forestry_tools DESTINATION bin) \ No newline at end of file +hdmapping_install_app(precision_forestry_tools) \ No newline at end of file diff --git a/apps/single_session_manual_coloring/CMakeLists.txt b/apps/single_session_manual_coloring/CMakeLists.txt index bcc1f1ea..12a28435 100644 --- a/apps/single_session_manual_coloring/CMakeLists.txt +++ b/apps/single_session_manual_coloring/CMakeLists.txt @@ -49,4 +49,4 @@ if (MSVC) target_compile_options(single_session_manual_coloring PRIVATE /bigobj) endif() -install(TARGETS single_session_manual_coloring DESTINATION bin) \ No newline at end of file +hdmapping_install_app(single_session_manual_coloring) \ No newline at end of file diff --git a/apps/split_multi_livox/CMakeLists.txt b/apps/split_multi_livox/CMakeLists.txt index 4d9853a8..a00f677a 100644 --- a/apps/split_multi_livox/CMakeLists.txt +++ b/apps/split_multi_livox/CMakeLists.txt @@ -38,4 +38,4 @@ if (MSVC) target_compile_options(split_multi_livox PRIVATE /bigobj) endif() -install (TARGETS split_multi_livox DESTINATION bin) \ No newline at end of file +hdmapping_install_app(split_multi_livox) \ No newline at end of file diff --git a/deploy_mandeye.bat b/deploy_mandeye.bat index c0def0e5..5a2dd265 100644 --- a/deploy_mandeye.bat +++ b/deploy_mandeye.bat @@ -52,10 +52,15 @@ echo Copying executables and DLLs... xcopy /Y /Q "%BUILD_DIR%\*.exe" "%DEPLOY_DIR%\" >nul xcopy /Y /Q "%BUILD_DIR%\*.dll" "%DEPLOY_DIR%\" >nul -rem Everything the last known-good build produced. If a target wasn't -rem built (e.g. you only built a subset), it just won't be in BUILD_DIR -rem and xcopy above silently skips it - so check explicitly and warn. -set "EXPECTED=concatenate_multi_livox.exe drag_folder_with_mandeye_data_and_drop_here-precision_forestry.exe laz_to_pcd.exe laz_to_ply.exe laz_to_txt.exe lidar_odometry_step_1.exe livox_mid_360_intrinsic_calibration.exe mandeye_compare_trajectories.exe mandeye_mission_recorder_calibration.exe mandeye_raw_data_viewer.exe mandeye_single_session_viewer.exe mandeye_with_360_camera_manual_coloring.exe matrix_mul.exe multiply_timestamps_session_point_cloud_laz.exe multiply_timestamps_session_trajectory_csv.exe multi_session_registration_step_3.exe multi_view_tls_registration_step_2.exe pcd_to_laz.exe precision_forestry_tools.exe single_session_manual_coloring.exe split_multi_livox.exe freeglut.dll laszip3.dll opencv_world4130.dll proj_9_3.dll tbb12.dll z.dll" +rem Everything a default build produces. If a target wasn't built (e.g. you +rem only built a subset), it just won't be in BUILD_DIR and the xcopy above +rem silently skips it - so check explicitly and warn. +rem +rem This list has to be kept in sync by hand with the hdmapping_install_app() +rem calls in apps/*/CMakeLists.txt. hd_mapper is deliberately absent: it is +rem gated behind BUILD_WITH_HD_MAPPER_APPLICATION, which defaults to OFF, so +rem listing it would warn on every normal build. +set "EXPECTED=camera_lidar_calibration.exe camera_lidar_intrinsics_calib.exe camera_lidar_trajectory_viewer.exe concatenate_multi_livox.exe drag_folder_with_mandeye_data_and_drop_here-precision_forestry.exe laz_to_mcap.exe laz_to_pcd.exe laz_to_ply.exe laz_to_txt.exe lidar_odometry_step_1.exe livox_mid_360_intrinsic_calibration.exe mandeye_compare_trajectories.exe mandeye_mission_recorder_calibration.exe mandeye_raw_data_viewer.exe mandeye_single_session_viewer.exe mandeye_with_360_camera_manual_coloring.exe matrix_mul.exe mcap_to_laz.exe multiply_timestamps_session_point_cloud_laz.exe multiply_timestamps_session_trajectory_csv.exe multi_session_registration_step_3.exe multi_view_tls_registration_step_2.exe multi_view_tls_registration_step_2_legacy.exe pcd_to_laz.exe precision_forestry_tools.exe single_session_manual_coloring.exe split_multi_livox.exe freeglut.dll laszip3.dll opencv_world4130.dll proj_9_3.dll tbb12.dll z.dll" set "MISSING=" for %%F in (%EXPECTED%) do ( From d7a42df6f93ce3af861c80e4c12b7f3f457b11de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pe=C5=82ka?= Date: Thu, 10 Sep 2026 11:33:34 +0200 Subject: [PATCH 2/2] missing file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Pełka --- cmake/install_app.cmake | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 cmake/install_app.cmake diff --git a/cmake/install_app.cmake b/cmake/install_app.cmake new file mode 100644 index 00000000..e1925f80 --- /dev/null +++ b/cmake/install_app.cmake @@ -0,0 +1,50 @@ +include_guard() + +# Prefix applied to installed executable names, so that generic tool names +# (laz_to_ply, matrix_mul, pcd_to_laz, ...) do not collide with unrelated +# binaries once they land in a shared directory like /usr/local/bin. +set(HDMAPPING_BINARY_PREFIX "hdmapping-" CACHE STRING + "Prefix applied to installed executable names") + +# hdmapping_install_app(...) +# +# Installs each target into /bin as "${HDMAPPING_BINARY_PREFIX}", +# leaving the build-tree name alone. Keeping build/bin/ unprefixed is +# deliberate: deploy_mandeye.bat validates the build output against a hardcoded +# list of plain .exe names, and IDE run configurations reference them too. +# +# install(TARGETS) has no RENAME option, and the obvious workaround -- +# install(PROGRAMS $ RENAME ...) -- is wrong here: it copies the +# binary verbatim, so the installed executable keeps the build-tree RUNPATH +# (build/3rdparty/LASzip/lib) instead of having it stripped, and would resolve +# the bundled liblaszip.so from the build directory rather than the system +# liblaszip that CPACK_DEBIAN_PACKAGE_DEPENDS declares. So install(TARGETS) +# stays responsible for the copy (and its RPATH rewriting), and the file is +# renamed immediately afterwards by an install-time script. +# +# $ (not the target name) carries the platform executable +# suffix, so the installed Windows name keeps its .exe. DESTDIR has to be +# honoured explicitly, the way CMake's own generated cmake_install.cmake does, +# because CPack stages the DEB through it. +function(hdmapping_install_app) + foreach(target_name IN LISTS ARGN) + if(NOT TARGET ${target_name}) + message(FATAL_ERROR "hdmapping_install_app: no such target '${target_name}'") + endif() + + install(TARGETS ${target_name} RUNTIME DESTINATION bin) + + # Declared after the install(TARGETS) above and in the same directory, + # so it runs after it. + install(CODE " + set(_hdmapping_bindir \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin\") + set(_hdmapping_plain \"\${_hdmapping_bindir}/$\") + set(_hdmapping_prefixed \"\${_hdmapping_bindir}/${HDMAPPING_BINARY_PREFIX}$\") + if(EXISTS \"\${_hdmapping_plain}\") + file(REMOVE \"\${_hdmapping_prefixed}\") + file(RENAME \"\${_hdmapping_plain}\" \"\${_hdmapping_prefixed}\") + message(STATUS \"Installing: \${_hdmapping_prefixed}\") + endif() + ") + endforeach() +endfunction()