From 3a97ae4ca4b4ac21853fa9785cda46535f478c5b Mon Sep 17 00:00:00 2001 From: Michal Date: Thu, 30 Jul 2026 22:54:24 +0200 Subject: [PATCH 1/3] Compilation with ReleaseWithDebugInfo stucks on Xcode. We compile automatic jacoians (24 k chars headers) without debug symbols. --- core/CMakeLists.txt | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index a13e0ef9..9e1967f1 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -8,25 +8,48 @@ set(CORE_BASE_SOURCES src/gnss.cpp src/ground_control_points.cpp src/hash_utils.cpp - src/icp.cpp src/imu_preintegration.cpp - src/ndt.cpp src/nmea.cpp + src/pair_wise_iterative_closest_point.cpp + src/point_cloud.cpp + src/point_clouds.cpp + src/session.cpp + # # src/utils.cpp # TODO(mwlasiuk) : broken AF ... +) + +# core_math holds the registration/optimization sources with auto-generated Jacobian headers (up to ~24k chars/line, expensive to compile); built once as a static lib shared by core and core_no_gui since none of it branches on WITH_GUI. +set(CORE_MATH_SOURCES + src/icp.cpp + src/ndt.cpp src/optimization_point_to_point_source_to_target.cpp src/optimize_distance_point_to_plane_source_to_target.cpp src/optimize_plane_to_plane_source_to_target.cpp src/optimize_point_to_plane_source_to_target.cpp src/optimize_point_to_projection_onto_plane_source_to_target.cpp - src/pair_wise_iterative_closest_point.cpp - src/point_cloud.cpp - src/point_clouds.cpp src/pose_graph_loop_closure.cpp src/pose_graph_slam.cpp src/registration_plane_feature.cpp - src/session.cpp - # # src/utils.cpp # TODO(mwlasiuk) : broken AF ... ) +add_library(core_math STATIC ${CORE_MATH_SOURCES}) +target_compile_definitions(core_math PRIVATE WITH_GUI=0) +target_link_libraries(core_math PRIVATE PROJ::proj spdlog::spdlog vqf Fusion wgs84_do_puwg92 plycpp WGS84toCartesian) +target_include_directories(core_math PRIVATE + include + ${EIGEN3_INCLUDE_DIR} + ${LASZIP_INCLUDE_DIR}/LASzip/include + ${THIRDPARTY_DIRECTORY}/json/include + ${THIRDPARTY_DIRECTORY}/observation_equations/codes + ${EXTERNAL_LIBRARIES_DIRECTORY}/include + ${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp + ${THIRDPARTY_DIRECTORY}/Fusion/Fusion +) +set_target_properties(core_math PROPERTIES POSITION_INDEPENDENT_CODE ON) +if(NOT MSVC) + # DWARF generation for these auto-generated Jacobian expression trees dominates -g compile time far more than -O2 codegen, so RelWithDebInfo builds this target without -g. + target_compile_options(core_math PRIVATE $<$:-g0>) +endif() + set(CORE_GUI_SOURCES src/manual_pose_graph_loop_closure.cpp src/observation_picking.cpp @@ -44,7 +67,7 @@ function(add_core_target target_name with_gui) add_library(${target_name} STATIC ${SOURCES}) target_compile_definitions(${target_name} PRIVATE ${DEFINES}) - target_link_libraries(${target_name} PRIVATE ${PLATFORM_LASZIP_LIB} ${PLATFORM_MISCELLANEOUS_LIBS} PROJ::proj spdlog::spdlog vqf Fusion wgs84_do_puwg92 plycpp WGS84toCartesian) + target_link_libraries(${target_name} PRIVATE core_math ${PLATFORM_LASZIP_LIB} ${PLATFORM_MISCELLANEOUS_LIBS} PROJ::proj spdlog::spdlog vqf Fusion wgs84_do_puwg92 plycpp WGS84toCartesian) target_include_directories(${target_name} PRIVATE include ${EIGEN3_INCLUDE_DIR} From 0e0dbbdbf57bab9a21d95deeca91d2acc5c6b746 Mon Sep 17 00:00:00 2001 From: Michal Date: Sat, 1 Aug 2026 17:55:34 +0200 Subject: [PATCH 2/3] Fix circular core/core_math link dependency pair_wise_iterative_closest_point.cpp stayed in CORE_BASE_SOURCES while pose_graph_loop_closure.cpp (which calls PairWiseICP::compute) moved to CORE_MATH_SOURCES, splitting a symbol and its only definition across two static libs with a link-order dependency in the wrong direction. This broke linking for any executable that pulls in PoseGraphLoopClosure without referencing PairWiseICP directly, e.g. multi_view_tls_registration_step_2. pair_wise_iterative_closest_point.cpp also includes an auto-generated Jacobian header, so it belongs in core_math anyway. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01DiH2pr8ruiHu6k7Y2wSXS2 --- core/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 9e1967f1..dedd44cc 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -10,7 +10,6 @@ set(CORE_BASE_SOURCES src/hash_utils.cpp src/imu_preintegration.cpp src/nmea.cpp - src/pair_wise_iterative_closest_point.cpp src/point_cloud.cpp src/point_clouds.cpp src/session.cpp @@ -26,6 +25,7 @@ set(CORE_MATH_SOURCES src/optimize_plane_to_plane_source_to_target.cpp src/optimize_point_to_plane_source_to_target.cpp src/optimize_point_to_projection_onto_plane_source_to_target.cpp + src/pair_wise_iterative_closest_point.cpp src/pose_graph_loop_closure.cpp src/pose_graph_slam.cpp src/registration_plane_feature.cpp From c8430cc126d89fd93e78287db2a5a6b53d4c8ca7 Mon Sep 17 00:00:00 2001 From: Michal Date: Sat, 1 Aug 2026 18:34:55 +0200 Subject: [PATCH 3/3] Move hash_utils.cpp into core_math too pair_wise_iterative_closest_point.cpp (moved into core_math in the previous commit) calls get_rgd_index_3d(), which lived in hash_utils.cpp under CORE_BASE_SOURCES -- reintroducing the same cross-archive circular dependency, just in the opposite direction (core_math needing a symbol from core/core_no_gui instead of the other way around). Nothing else in CORE_BASE_SOURCES/CORE_GUI_SOURCES calls into core_math, so moving hash_utils.cpp there too makes the dependency one-directional again (core/core_no_gui -> core_math, never the reverse). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01DiH2pr8ruiHu6k7Y2wSXS2 --- core/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index dedd44cc..bc4d409a 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -7,7 +7,6 @@ set(CORE_BASE_SOURCES src/control_points.cpp src/gnss.cpp src/ground_control_points.cpp - src/hash_utils.cpp src/imu_preintegration.cpp src/nmea.cpp src/point_cloud.cpp @@ -17,7 +16,9 @@ set(CORE_BASE_SOURCES ) # core_math holds the registration/optimization sources with auto-generated Jacobian headers (up to ~24k chars/line, expensive to compile); built once as a static lib shared by core and core_no_gui since none of it branches on WITH_GUI. +# hash_utils.cpp lives here (not CORE_BASE_SOURCES) because pair_wise_iterative_closest_point.cpp needs get_rgd_index_3d() from it -- keeping both in the same archive avoids a circular static-lib link dependency between core_math and core/core_no_gui. set(CORE_MATH_SOURCES + src/hash_utils.cpp src/icp.cpp src/ndt.cpp src/optimization_point_to_point_source_to_target.cpp