diff --git a/Dockerfile b/Dockerfile index 01bd2e0..2a94d15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,6 @@ COPY upstream.jazzy.repos ./upstream.jazzy.repos # Import all upstream repostories RUN vcs import ./src/upstream < ./upstream.jazzy.repos -RUN cd ./src/upstream/FAST_LIO && \ - git submodule update --init - # Apply patches to upstream RUN ./patches/apply_patches.sh @@ -38,17 +35,11 @@ RUN apt-get update && \ rosdep install --from-paths src --ignore-src -r -y && \ rm -rf /var/lib/apt/lists/* -RUN cd src/upstream/livox_sdk && \ - mkdir -p build && \ - cd build && rm -rf * && \ - cmake .. -DCMAKE_BUILD_TYPE=Release && \ - make -j && \ - make install - # Build the workspace with symlink install +# livox_sdk is now an ament_cmake package built by colcon (no manual /usr/local install needed). RUN . /opt/ros/jazzy/setup.sh && \ colcon build --symlink-install \ - li --cmake-args -DROS_EDITION=ROS2 -DDISTRO_ROS=jazzy + --cmake-args -DROS_EDITION=ROS2 -DDISTRO_ROS=jazzy # Source the overlay on container startup RUN echo "source /opt/ros/jazzy/setup.bash" >> /root/.bashrc && \ diff --git a/patches/fast_lio.patch b/patches/fast_lio.patch index 494cbc3..3a68c9b 100644 --- a/patches/fast_lio.patch +++ b/patches/fast_lio.patch @@ -1,14 +1,37 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index be3040b..4931c35 100644 +index be3040b..3176847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -5,17 +5,16 @@ if(NOT CMAKE_BUILD_TYPE) +@@ -5,17 +5,39 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -ADD_COMPILE_OPTIONS(-std=c++14) -ADD_COMPILE_OPTIONS(-std=c++14) -set(CMAKE_CXX_FLAGS "-std=c++14 -O3") ++# Ensure the bundled ikd-Tree submodule (include/ikd-Tree/ikd_Tree.cpp) is present. ++# Auto-initialize it when building from a git checkout; otherwise fail with guidance. ++if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/ikd-Tree/ikd_Tree.cpp") ++ find_package(Git QUIET) ++ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") ++ message(STATUS "fast_lio: initializing git submodule include/ikd-Tree") ++ execute_process( ++ COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ RESULT_VARIABLE GIT_SUBMOD_RESULT) ++ if(NOT GIT_SUBMOD_RESULT EQUAL "0") ++ message(FATAL_ERROR ++ "git submodule update --init failed with ${GIT_SUBMOD_RESULT}. " ++ "Run it manually in ${CMAKE_CURRENT_SOURCE_DIR}.") ++ endif() ++ endif() ++ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/ikd-Tree/ikd_Tree.cpp") ++ message(FATAL_ERROR ++ "include/ikd-Tree/ikd_Tree.cpp is missing and could not be fetched automatically " ++ "(no git checkout available). Run: git submodule update --init --recursive") ++ endif() ++endif() ++ +ADD_COMPILE_OPTIONS(-std=c++17) +set(CMAKE_CXX_FLAGS "-std=c++17 -O3")