From 3ce0ea44f546366a90785857aa75b623db1fbf49 Mon Sep 17 00:00:00 2001 From: mwlasiuk Date: Tue, 31 Mar 2026 19:52:50 +0200 Subject: [PATCH 1/2] Restructure external libs and prevent multiple compilations of the same file. --- CMakeLists.txt | 28 ++++++++++++++----- apps/lidar_odometry_step_1/CMakeLists.txt | 18 ++++++------ .../lidar_odometry_utils.h | 9 ++---- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- apps/mandeye_raw_data_viewer/CMakeLists.txt | 2 +- .../CMakeLists.txt | 8 ++++-- .../multi_view_tls_registration_gui.cpp | 4 +-- apps/quick_start_demo/CMakeLists.txt | 5 ++-- apps/quick_start_demo/quick_start_demo.cpp | 6 ++-- cmake/implot.cmake | 1 - core/CMakeLists.txt | 10 +++---- core/src/gnss.cpp | 4 +-- core/src/point_cloud.cpp | 2 +- docs/CMAKE_CONFIGURATION.md | 4 +-- external/WGS84toCartesian/CMakeLists.txt | 11 ++++++++ .../WGS84toCartesian}/WGS84toCartesian.hpp | 0 .../WGS84toCartesian/src/WGS84toCartesian.cpp | 1 + external/plycpp/CMakeLists.txt | 11 ++++++++ .../include/plycpp}/plycpp.h | 0 external/{ => plycpp}/src/plycpp.cpp | 2 +- external/wgs84_do_puwg92/CMakeLists.txt | 11 ++++++++ .../wgs84_do_puwg92}/wgs84_do_puwg92.h | 0 .../src/wgs84_do_puwg92.cc | 0 pybind/CMakeLists.txt | 2 +- pybind/README.md | 2 +- 26 files changed, 96 insertions(+), 49 deletions(-) create mode 100644 external/WGS84toCartesian/CMakeLists.txt rename external/{include => WGS84toCartesian/include/WGS84toCartesian}/WGS84toCartesian.hpp (100%) create mode 100644 external/WGS84toCartesian/src/WGS84toCartesian.cpp create mode 100644 external/plycpp/CMakeLists.txt rename external/{include => plycpp/include/plycpp}/plycpp.h (100%) rename external/{ => plycpp}/src/plycpp.cpp (99%) create mode 100644 external/wgs84_do_puwg92/CMakeLists.txt rename external/{include => wgs84_do_puwg92/include/wgs84_do_puwg92}/wgs84_do_puwg92.h (100%) rename external/{ => wgs84_do_puwg92}/src/wgs84_do_puwg92.cc (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 656376d4..b13412cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,12 +25,13 @@ set_property(CACHE HD_CPU_OPTIMIZATION PROPERTY STRINGS AUTO INTEL AMD ARM GENER # Options to enable / disable specific components option(BUILD_WITH_CLI_TOOLS "Build with command line tools" ON) option(BUILD_WITH_HD_MAPPER_APPLICATION "Build with hd_mapper tool" OFF) -option(UTL_PROFILER_DISABLE "Disable UTL profiler (zero overhead when ON)" ON) +option(BUILD_WITH_QUICK_START_DEMO "Build with quick_start_demo" OFF) +option(BUILD_WITH_UTL_PROFILER_DISABLED "Disable UTL profiler (zero overhead when ON)" ON) option(BUILD_WITH_BUNDLED_FREEGLUT "Build with bundled FreeGlut" ON) option(BUILD_WITH_BUNDLED_GLEW "Build with bundled GLEW" ON) option(BUILD_WITH_BUNDLED_LIBLASZIP "Build with bundled Lib LASZIP" ON) option(BUILD_WITH_BUNDLED_ONETBB "Build with bundled oneTBB" ON) -option(PYBIND "Enable pybind11 bindings" OFF) +option(BUILD_WITH_PYBIND "Enable pybind11 bindings" OFF) # Add definitions for all projects add_definitions(-DHDMAPPING_VERSION_MAJOR=${HDMAPPING_VERSION_MAJOR}) @@ -68,6 +69,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +# TODO(mwlasiuk) : fix +# if(WIN32) +# set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +# set(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +# endif() + # Include cmake configs include(cmake/cpu_optimizations.cmake) include(cmake/disable_target_warnings.cmake) @@ -175,8 +182,8 @@ MESSAGE(STATUS "Using bundled spdlog from: ${THIRDPARTY_DIRECTORY}/spdlog") add_subdirectory(${THIRDPARTY_DIRECTORY}/UTL) MESSAGE(STATUS "Using bundled UTL from: ${THIRDPARTY_DIRECTORY}/UTL") -if(PYBIND) - message(STATUS "PYBIND is enabled: fetching pybind.") +if(BUILD_WITH_PYBIND) + message(STATUS "BUILD_WITH_PYBIND is enabled: fetching pybind.") include(FetchContent) set(pybind11_SOURCE_DIR "${CMAKE_BINARY_DIR}/3rdparty/pybind11-src") set(pybind11_BINARY_DIR "${CMAKE_BINARY_DIR}/3rdparty/pybind11-build") @@ -193,13 +200,17 @@ if(PYBIND) endif() add_subdirectory(pybind) else() - message(STATUS "PYBIND is disabled.") + message(STATUS "BUILD_WITH_PYBIND is disabled.") endif() add_subdirectory(${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp) add_subdirectory(${THIRDPARTY_DIRECTORY}/Fusion/Fusion) +add_subdirectory(${EXTERNAL_LIBRARIES_DIRECTORY}/plycpp) +add_subdirectory(${EXTERNAL_LIBRARIES_DIRECTORY}/wgs84_do_puwg92) +add_subdirectory(${EXTERNAL_LIBRARIES_DIRECTORY}/WGS84toCartesian) + add_subdirectory(core) set(CORE_LIBRARIES core) @@ -213,6 +224,10 @@ if(BUILD_WITH_HD_MAPPER_APPLICATION) add_subdirectory(apps/hd_mapper) endif() +if(BUILD_WITH_QUICK_START_DEMO) + add_subdirectory(apps/quick_start_demo) +endif() + add_subdirectory(apps/lidar_odometry_step_1) add_subdirectory(apps/manual_color) add_subdirectory(apps/multi_session_registration) @@ -221,14 +236,13 @@ add_subdirectory(apps/split_multi_livox) add_subdirectory(apps/precision_forestry_tools) add_subdirectory(apps/mandeye_raw_data_viewer) add_subdirectory(apps/compare_trajectories) -#add_subdirectory(apps/quick_start_demo) add_subdirectory(apps/mandeye_mission_recorder_calibration) add_subdirectory(apps/mandeye_single_session_viewer) add_subdirectory(apps/livox_mid_360_intrinsic_calibration) add_subdirectory(apps/single_session_manual_coloring) add_subdirectory(apps/concatenate_multi_livox) -# NOTE(m.wlasiuk) : disable warnings for third party libraries so they do not pollute build logs +# NOTE(mwlasiuk) : disable warnings for third party libraries so they do not pollute build logs ### ### DISABLE WARNINGS FOR THIRDPARTY CODE - START diff --git a/apps/lidar_odometry_step_1/CMakeLists.txt b/apps/lidar_odometry_step_1/CMakeLists.txt index 744c7617..3f996977 100644 --- a/apps/lidar_odometry_step_1/CMakeLists.txt +++ b/apps/lidar_odometry_step_1/CMakeLists.txt @@ -22,7 +22,7 @@ add_executable( target_compile_definitions(lidar_odometry_step_1 PRIVATE WITH_GUI=1 - $<$:UTL_PROFILER_DISABLE>) + $<$:BUILD_WITH_UTL_PROFILER_DISABLED>) target_include_directories( lidar_odometry_step_1 @@ -47,14 +47,15 @@ target_include_directories( target_link_libraries( lidar_odometry_step_1 - PRIVATE vqf Fusion + PRIVATE + vqf + Fusion unordered_dense::unordered_dense spdlog::spdlog UTL::include - # PRIVATE ${THIRDPARTY_DIRECTORY}/glew-2.2.0/lib/Release/x64/glew32s.lib + OpenGL::GLU ${FREEGLUT_LIBRARY} ${OPENGL_gl_LIBRARY} - OpenGL::GLU ${PLATFORM_LASZIP_LIB} ${PLATFORM_MISCELLANEOUS_LIBS} ${CORE_LIBRARIES} @@ -80,7 +81,7 @@ add_executable( target_compile_definitions(drag_folder_with_mandeye_data_and_drop_here-precision_forestry PRIVATE WITH_GUI=1 - $<$:UTL_PROFILER_DISABLE>) + $<$:BUILD_WITH_UTL_PROFILER_DISABLED>) target_include_directories( drag_folder_with_mandeye_data_and_drop_here-precision_forestry @@ -105,14 +106,15 @@ target_include_directories( target_link_libraries( drag_folder_with_mandeye_data_and_drop_here-precision_forestry - PRIVATE vqf Fusion + PRIVATE + vqf + Fusion unordered_dense::unordered_dense spdlog::spdlog UTL::include - # PRIVATE ${THIRDPARTY_DIRECTORY}/glew-2.2.0/lib/Release/x64/glew32s.lib + OpenGL::GLU ${FREEGLUT_LIBRARY} ${OPENGL_gl_LIBRARY} - OpenGL::GLU ${PLATFORM_LASZIP_LIB} ${PLATFORM_MISCELLANEOUS_LIBS} ${CORE_LIBRARIES} diff --git a/apps/lidar_odometry_step_1/lidar_odometry_utils.h b/apps/lidar_odometry_step_1/lidar_odometry_utils.h index fe0beebf..2f64e95d 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry_utils.h +++ b/apps/lidar_odometry_step_1/lidar_odometry_utils.h @@ -16,6 +16,8 @@ #include #include +#include + #include #include #include @@ -39,12 +41,7 @@ using NDTBucketMapType2 = ankerl::unordered_dense::map; // Helper function for getting software version from CMake macros inline std::string get_software_version() { -#ifdef HDMAPPING_VERSION_MAJOR - return std::to_string(HDMAPPING_VERSION_MAJOR) + "." + std::to_string(HDMAPPING_VERSION_MINOR) + "." + - std::to_string(HDMAPPING_VERSION_PATCH); -#else - return "0.84.0"; // fallback if CMake macros not available -#endif + return HDMAPPING_VERSION_STRING; } struct LidarOdometryParams diff --git a/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt b/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt index d8343f2b..04a0a316 100644 --- a/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt +++ b/apps/livox_mid_360_intrinsic_calibration/CMakeLists.txt @@ -28,7 +28,7 @@ target_include_directories( ${THIRDPARTY_DIRECTORY}/observation_equations/codes ${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp) -target_compile_definitions(livox_mid_360_intrinsic_calibration PRIVATE UTL_PROFILER_DISABLE) +target_compile_definitions(livox_mid_360_intrinsic_calibration PRIVATE BUILD_WITH_UTL_PROFILER_DISABLED) target_link_libraries( livox_mid_360_intrinsic_calibration diff --git a/apps/mandeye_mission_recorder_calibration/CMakeLists.txt b/apps/mandeye_mission_recorder_calibration/CMakeLists.txt index 5e757086..6612f247 100644 --- a/apps/mandeye_mission_recorder_calibration/CMakeLists.txt +++ b/apps/mandeye_mission_recorder_calibration/CMakeLists.txt @@ -38,7 +38,7 @@ target_include_directories( ${THIRDPARTY_DIRECTORY}/observation_equations/codes ${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp) -target_compile_definitions(mandeye_mission_recorder_calibration PRIVATE UTL_PROFILER_DISABLE) +target_compile_definitions(mandeye_mission_recorder_calibration PRIVATE BUILD_WITH_UTL_PROFILER_DISABLED) target_link_libraries( mandeye_mission_recorder_calibration diff --git a/apps/mandeye_raw_data_viewer/CMakeLists.txt b/apps/mandeye_raw_data_viewer/CMakeLists.txt index 31e4e140..9765d440 100644 --- a/apps/mandeye_raw_data_viewer/CMakeLists.txt +++ b/apps/mandeye_raw_data_viewer/CMakeLists.txt @@ -42,7 +42,7 @@ target_include_directories( ${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp ${THIRDPARTY_DIRECTORY}/Fusion/Fusion) -target_compile_definitions(mandeye_raw_data_viewer PRIVATE UTL_PROFILER_DISABLE) +target_compile_definitions(mandeye_raw_data_viewer PRIVATE BUILD_WITH_UTL_PROFILER_DISABLED) target_link_libraries( mandeye_raw_data_viewer diff --git a/apps/multi_view_tls_registration/CMakeLists.txt b/apps/multi_view_tls_registration/CMakeLists.txt index b1386a2a..495300ff 100644 --- a/apps/multi_view_tls_registration/CMakeLists.txt +++ b/apps/multi_view_tls_registration/CMakeLists.txt @@ -42,12 +42,14 @@ target_include_directories( target_link_libraries( multi_view_tls_registration_step_2 - # PRIVATE ${THIRDPARTY_DIRECTORY}/glew-2.2.0/lib/Release/x64/glew32s.lib - PRIVATE ${FREEGLUT_LIBRARY} + PRIVATE + WGS84toCartesian + wgs84_do_puwg92 unordered_dense::unordered_dense spdlog::spdlog - ${OPENGL_gl_LIBRARY} OpenGL::GLU + ${FREEGLUT_LIBRARY} + ${OPENGL_gl_LIBRARY} ${PLATFORM_LASZIP_LIB} ${PLATFORM_MISCELLANEOUS_LIBS} ${CORE_LIBRARIES} 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 158a254c..7e9037cd 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 @@ -44,8 +44,8 @@ #include -#include "WGS84toCartesian.hpp" -#include "wgs84_do_puwg92.h" +#include "WGS84toCartesian/WGS84toCartesian.hpp" +#include "wgs84_do_puwg92/wgs84_do_puwg92.h" #include #ifdef _WIN32 diff --git a/apps/quick_start_demo/CMakeLists.txt b/apps/quick_start_demo/CMakeLists.txt index b14c9576..6803cd5b 100644 --- a/apps/quick_start_demo/CMakeLists.txt +++ b/apps/quick_start_demo/CMakeLists.txt @@ -28,16 +28,17 @@ target_include_directories( ${THIRDPARTY_DIRECTORY}/observation_equations/codes ${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp) -target_compile_definitions(quick_start_demo PRIVATE UTL_PROFILER_DISABLE) +target_compile_definitions(quick_start_demo PRIVATE BUILD_WITH_UTL_PROFILER_DISABLED) target_link_libraries( quick_start_demo PRIVATE vqf spdlog::spdlog UTL::include + OpenGL::GLU + unordered_dense::unordered_dense ${FREEGLUT_LIBRARY} ${OPENGL_gl_LIBRARY} - OpenGL::GLU ${PLATFORM_LASZIP_LIB} ${CORE_LIBRARIES} ${GUI_LIBRARIES} diff --git a/apps/quick_start_demo/quick_start_demo.cpp b/apps/quick_start_demo/quick_start_demo.cpp index 1f9779e9..c42b8187 100644 --- a/apps/quick_start_demo/quick_start_demo.cpp +++ b/apps/quick_start_demo/quick_start_demo.cpp @@ -15,13 +15,13 @@ #include -#include +#include +#include #include #include #include "../lidar_odometry_step_1/lidar_odometry_utils.h" -#include #include #include @@ -711,7 +711,7 @@ bool compute_step_2_demo(std::vector &worker_data, LidarOdometryPara int main(int argc, char *argv[]) { - #if 0 + #if 0 //ToDo params.in_out_params_indoor.resolution_X = 0.3; params.in_out_params_indoor.resolution_Y = 0.3; diff --git a/cmake/implot.cmake b/cmake/implot.cmake index c08e0752..62984537 100644 --- a/cmake/implot.cmake +++ b/cmake/implot.cmake @@ -2,7 +2,6 @@ include_guard() set(IMPLOT_LIBRARY_DIRECTORY ${THIRDPARTY_DIRECTORY}/implot) - set(IMPLOT_SOURCE_FILES ${IMPLOT_LIBRARY_DIRECTORY}/implot.cpp ${IMPLOT_LIBRARY_DIRECTORY}/implot_items.cpp diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 46660c97..4482eab5 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -24,9 +24,9 @@ set(CORE_BASE_SOURCES src/pose_graph_slam.cpp src/registration_plane_feature.cpp src/session.cpp - # src/utils.cpp # TODO(mwlasiuk) : broken AF ... - ${EXTERNAL_LIBRARIES_DIRECTORY}/src/wgs84_do_puwg92.cc - ${EXTERNAL_LIBRARIES_DIRECTORY}/src/plycpp.cpp + # # src/utils.cpp # TODO(mwlasiuk) : broken AF ... + # ${EXTERNAL_LIBRARIES_DIRECTORY}/src/wgs84_do_puwg92.cc + # ${EXTERNAL_LIBRARIES_DIRECTORY}/src/plycpp.cpp ) set(CORE_GUI_SOURCES @@ -46,7 +46,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} spdlog::spdlog vqf Fusion) + target_link_libraries(${target_name} PRIVATE ${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} @@ -58,8 +58,6 @@ function(add_core_target target_name with_gui) ${THIRDPARTY_DIRECTORY}/Fusion/Fusion ) - target_link_libraries(${target_name} PRIVATE PROJ::proj) - if(${with_gui}) target_include_directories(${target_name} PRIVATE ${THIRDPARTY_DIRECTORY}/imgui diff --git a/core/src/gnss.cpp b/core/src/gnss.cpp index 6b94f70e..7b444125 100644 --- a/core/src/gnss.cpp +++ b/core/src/gnss.cpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #if WITH_GUI == 1 #include diff --git a/core/src/point_cloud.cpp b/core/src/point_cloud.cpp index 9136d3fc..f9f4284f 100644 --- a/core/src/point_cloud.cpp +++ b/core/src/point_cloud.cpp @@ -7,7 +7,7 @@ #include #endif -#include +#include #include diff --git a/docs/CMAKE_CONFIGURATION.md b/docs/CMAKE_CONFIGURATION.md index 51bd0afe..4e4f3f9e 100644 --- a/docs/CMAKE_CONFIGURATION.md +++ b/docs/CMAKE_CONFIGURATION.md @@ -90,7 +90,7 @@ make pack | `BUILD_WITH_BUNDLED_FREEGLUT` | ON | ON, OFF | Use bundled FreeGLUT library | | `BUILD_WITH_BUNDLED_EIGEN` | ON | ON, OFF | Use bundled Eigen library | | `BUILD_WITH_BUNDLED_LIBLASZIP` | ON | ON, OFF | Use bundled LASzip library | -| `PYBIND` | OFF | ON, OFF | Enable Python bindings | +| `BUILD_WITH_PYBIND` | OFF | ON, OFF | Enable Python bindings | ## Troubleshooting @@ -107,7 +107,7 @@ cmake -DCMAKE_BUILD_TYPE=Release .. cmake -LA . # View only HDMapping variables -cmake -LA . | grep -E "(HD_|BUILD_WITH_|PYBIND)" +cmake -LA . | grep -E "(HD_|BUILD_WITH_|BUILD_WITH_PYBIND)" ``` ### Build Errors diff --git a/external/WGS84toCartesian/CMakeLists.txt b/external/WGS84toCartesian/CMakeLists.txt new file mode 100644 index 00000000..8a74870c --- /dev/null +++ b/external/WGS84toCartesian/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 4.0.0) + +project(WGS84toCartesian) + +set(WGS84TOCARTESIAN_INCLUDE_DIRECTORIES ${EXTERNAL_LIBRARIES_DIRECTORY}/WGS84toCartesian/include) + +add_library(WGS84toCartesian STATIC + src/WGS84toCartesian.cpp + ${WGS84TOCARTESIAN_INCLUDE_DIRECTORIES}/WGS84toCartesian/WGS84toCartesian.hpp) + +target_include_directories(WGS84toCartesian PUBLIC ${WGS84TOCARTESIAN_INCLUDE_DIRECTORIES}) \ No newline at end of file diff --git a/external/include/WGS84toCartesian.hpp b/external/WGS84toCartesian/include/WGS84toCartesian/WGS84toCartesian.hpp similarity index 100% rename from external/include/WGS84toCartesian.hpp rename to external/WGS84toCartesian/include/WGS84toCartesian/WGS84toCartesian.hpp diff --git a/external/WGS84toCartesian/src/WGS84toCartesian.cpp b/external/WGS84toCartesian/src/WGS84toCartesian.cpp new file mode 100644 index 00000000..f1e54ad0 --- /dev/null +++ b/external/WGS84toCartesian/src/WGS84toCartesian.cpp @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/external/plycpp/CMakeLists.txt b/external/plycpp/CMakeLists.txt new file mode 100644 index 00000000..0aa49669 --- /dev/null +++ b/external/plycpp/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 4.0.0) + +project(plycpp) + +set(PLYCPP_INCLUDE_DIRECTORIES ${EXTERNAL_LIBRARIES_DIRECTORY}/plycpp/include) + +add_library(plycpp STATIC + src/plycpp.cpp + ${PLYCPP_INCLUDE_DIRECTORIES}/plycpp/plycpp.h) + +target_include_directories(plycpp PUBLIC ${PLYCPP_INCLUDE_DIRECTORIES}) \ No newline at end of file diff --git a/external/include/plycpp.h b/external/plycpp/include/plycpp/plycpp.h similarity index 100% rename from external/include/plycpp.h rename to external/plycpp/include/plycpp/plycpp.h diff --git a/external/src/plycpp.cpp b/external/plycpp/src/plycpp.cpp similarity index 99% rename from external/src/plycpp.cpp rename to external/plycpp/src/plycpp.cpp index 98e44e79..4bc68005 100644 --- a/external/src/plycpp.cpp +++ b/external/plycpp/src/plycpp.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include +#include #include #include diff --git a/external/wgs84_do_puwg92/CMakeLists.txt b/external/wgs84_do_puwg92/CMakeLists.txt new file mode 100644 index 00000000..46d110fc --- /dev/null +++ b/external/wgs84_do_puwg92/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 4.0.0) + +project(wgs84_do_puwg92) + +set(WGS84_DO_PUWG92_INCLUDE_DIRECTORIES ${EXTERNAL_LIBRARIES_DIRECTORY}/wgs84_do_puwg92/include) + +add_library(wgs84_do_puwg92 STATIC + src/wgs84_do_puwg92.cc + ${WGS84_DO_PUWG92_INCLUDE_DIRECTORIES}/wgs84_do_puwg92/wgs84_do_puwg92.h) + +target_include_directories(wgs84_do_puwg92 PUBLIC ${WGS84_DO_PUWG92_INCLUDE_DIRECTORIES}) \ No newline at end of file diff --git a/external/include/wgs84_do_puwg92.h b/external/wgs84_do_puwg92/include/wgs84_do_puwg92/wgs84_do_puwg92.h similarity index 100% rename from external/include/wgs84_do_puwg92.h rename to external/wgs84_do_puwg92/include/wgs84_do_puwg92/wgs84_do_puwg92.h diff --git a/external/src/wgs84_do_puwg92.cc b/external/wgs84_do_puwg92/src/wgs84_do_puwg92.cc similarity index 100% rename from external/src/wgs84_do_puwg92.cc rename to external/wgs84_do_puwg92/src/wgs84_do_puwg92.cc diff --git a/pybind/CMakeLists.txt b/pybind/CMakeLists.txt index 54400962..f330e605 100644 --- a/pybind/CMakeLists.txt +++ b/pybind/CMakeLists.txt @@ -36,7 +36,7 @@ endif() add_library(lidar_odometry_py MODULE lidar_odometry_binding.cpp) target_compile_definitions(lidar_odometry_py PRIVATE WITH_GUI=0 - $<$:UTL_PROFILER_DISABLE>) + $<$:BUILD_WITH_UTL_PROFILER_DISABLED>) if (MSVC) target_compile_options(lidar_odometry_py PRIVATE /bigobj) endif() diff --git a/pybind/README.md b/pybind/README.md index 5333b930..1dfbd646 100644 --- a/pybind/README.md +++ b/pybind/README.md @@ -1,6 +1,6 @@ # Python Bindings for HDMapping -Here, Python bindings for the general registration process are available. To compile the bindings when building the project, select `PYBIND` option in the CMake project. This will create the bindings for step 1 and step 2 of the registration process. +Here, Python bindings for the general registration process are available. To compile the bindings when building the project, select `BUILD_WITH_PYBIND` option in the CMake project. This will create the bindings for step 1 and step 2 of the registration process. **Make sure to set the same Python interpreter that you plan to use in your project where you require bindings.** From e40c2eabd304c6dc81056d1501d92f0f99ed3c2b Mon Sep 17 00:00:00 2001 From: mwlasiuk Date: Tue, 31 Mar 2026 19:59:48 +0200 Subject: [PATCH 2/2] pybind --- .github/workflows/python-bindings-linux.yml | 2 +- .github/workflows/python-bindings-windows.yml | 2 +- docs/CMAKE_CONFIGURATION.md | 4 ++-- external/plycpp/CMakeLists.txt | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-bindings-linux.yml b/.github/workflows/python-bindings-linux.yml index 4632e3e3..e8b2065a 100644 --- a/.github/workflows/python-bindings-linux.yml +++ b/.github/workflows/python-bindings-linux.yml @@ -45,7 +45,7 @@ jobs: run: | cmake -B ${{github.workspace}}/build_pybind \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -DPYBIND=ON + -DBUILD_WITH_PYBIND=ON - name: Build Python bindings run: cmake --build ${{github.workspace}}/build_pybind --target pybind_all --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/python-bindings-windows.yml b/.github/workflows/python-bindings-windows.yml index 967b0ca3..6bf602f8 100644 --- a/.github/workflows/python-bindings-windows.yml +++ b/.github/workflows/python-bindings-windows.yml @@ -40,7 +40,7 @@ jobs: run: | cmake -B ${{github.workspace}}/build_pybind ` -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ` - -DPYBIND=ON ` + -DBUILD_WITH_PYBIND=ON ` shell: pwsh - name: Build Python bindings diff --git a/docs/CMAKE_CONFIGURATION.md b/docs/CMAKE_CONFIGURATION.md index 4e4f3f9e..8c858842 100644 --- a/docs/CMAKE_CONFIGURATION.md +++ b/docs/CMAKE_CONFIGURATION.md @@ -44,7 +44,7 @@ cmake -DCMAKE_BUILD_TYPE=Release \ ### Python Bindings ```bash # Enable Python bindings -cmake -DCMAKE_BUILD_TYPE=Release -DPYBIND=ON .. +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_PYBIND=ON .. ``` ### Complete Configuration Examples @@ -55,7 +55,7 @@ mkdir build-dev cd build-dev cmake -DCMAKE_BUILD_TYPE=Debug \ -DHD_CPU_OPTIMIZATION=AMD \ - -DPYBIND=ON .. + -DBUILD_WITH_PYBIND=ON .. cmake --build . --config Debug ``` diff --git a/external/plycpp/CMakeLists.txt b/external/plycpp/CMakeLists.txt index 0aa49669..78c94735 100644 --- a/external/plycpp/CMakeLists.txt +++ b/external/plycpp/CMakeLists.txt @@ -4,8 +4,11 @@ project(plycpp) set(PLYCPP_INCLUDE_DIRECTORIES ${EXTERNAL_LIBRARIES_DIRECTORY}/plycpp/include) + add_library(plycpp STATIC src/plycpp.cpp ${PLYCPP_INCLUDE_DIRECTORIES}/plycpp/plycpp.h) -target_include_directories(plycpp PUBLIC ${PLYCPP_INCLUDE_DIRECTORIES}) \ No newline at end of file +target_include_directories(plycpp PUBLIC ${PLYCPP_INCLUDE_DIRECTORIES}) + +set_target_properties(plycpp PROPERTIES POSITION_INDEPENDENT_CODE ON) \ No newline at end of file