### Installing ROS1 Artifacts (CMake) Source: https://github.com/koide3/ndt_omp/blob/master/CMakeLists.txt This snippet defines the installation rules for the `ndt_omp` library and its headers when building for ROS1. It specifies destination paths for archives, runtimes, libraries, and include directories using Catkin's global installation variables. ```CMake ############# ## INSTALL ## ############# install( TARGETS ndt_omp ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} ) # install headers install(DIRECTORY include/pclomp DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}) ``` -------------------------------- ### Configuring, Building, and Installing for ROS2 (CMake) Source: https://github.com/koide3/ndt_omp/blob/master/CMakeLists.txt This block handles ROS2-specific configurations. It uses `ament_cmake_auto` to find build dependencies, builds `ndt_omp` as a shared library, links it with PCL and OpenMP (if found), and defines installation rules for the library, including exporting its targets for other ROS2 packages. ```CMake else() # ROS2 find_package(ament_cmake_auto REQUIRED) ament_auto_find_build_dependencies() ########### ## Build ## ########### include_directories(include) include_directories( ${catkin_INCLUDE_DIRS} ) add_library(ndt_omp SHARED src/pclomp/voxel_grid_covariance_omp.cpp src/pclomp/ndt_omp.cpp src/pclomp/gicp_omp.cpp ) ament_export_targets(ndt_omp HAS_LIBRARY_TARGET) target_link_libraries(ndt_omp ${PCL_LIBRARIES}) if(OpenMP_CXX_FOUND) target_link_libraries(ndt_omp OpenMP::OpenMP_CXX) else() message(WARNING "OpenMP not found") endif() install( TARGETS ndt_omp EXPORT ndt_omp LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin INCLUDES DESTINATION include ) ament_auto_package() endif() ``` -------------------------------- ### Running NDT_OMP Benchmark in Bash Source: https://github.com/koide3/ndt_omp/blob/master/README.md This command sequence navigates to the ndt_omp/data directory and then executes the align utility from the ndt_omp package. It performs a point cloud alignment benchmark using two specified PCD files, demonstrating the performance of the NDT algorithm variants. ```Bash $ roscd ndt_omp/data $ rosrun ndt_omp align 251370668.pcd 251371071.pcd ``` -------------------------------- ### Configuring and Building for ROS1 (CMake) Source: https://github.com/koide3/ndt_omp/blob/master/CMakeLists.txt This block handles ROS1-specific configurations. It finds `catkin` and required components, defines the `ndt_omp` package, adds include directories, builds the `ndt_omp` library from specified source files, and creates an `align` executable linking against `ndt_omp`, `catkin`, and PCL libraries. ```CMake if($ENV{ROS_VERSION} EQUAL 1) # ROS1 find_package(catkin REQUIRED COMPONENTS roscpp pcl_ros ) ################################### ## catkin specific configuration ## ################################### catkin_package( INCLUDE_DIRS include LIBRARIES ndt_omp ) ########### ## Build ## ########### include_directories(include) include_directories( ${catkin_INCLUDE_DIRS} ) add_library(ndt_omp src/pclomp/voxel_grid_covariance_omp.cpp src/pclomp/ndt_omp.cpp src/pclomp/gicp_omp.cpp ) add_executable(align apps/align.cpp ) add_dependencies(align ndt_omp ) target_link_libraries(align ${catkin_LIBRARIES} ${PCL_LIBRARIES} ndt_omp ) ``` -------------------------------- ### Setting Project and Compiler Flags (CMake) Source: https://github.com/koide3/ndt_omp/blob/master/CMakeLists.txt This snippet initializes the CMake project, sets the C++ standard to C++14, and conditionally adds architecture-specific compile options (e.g., -march=native or SSE flags) based on the `BUILD_WITH_MARCH_NATIVE` variable. It also forces the build type to RELEASE to avoid PCL debug segfaults. ```CMake cmake_minimum_required(VERSION 3.10) project(ndt_omp) add_definitions(-std=c++14) set(CMAKE_CXX_FLAGS "-std=c++14") if (BUILD_WITH_MARCH_NATIVE) add_compile_options(-march=native) else() add_definitions(-msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2) set(CMAKE_CXX_FLAGS "-msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2") endif() # pcl 1.7 causes a segfault when it is built with debug mode set(CMAKE_BUILD_TYPE "RELEASE") ``` -------------------------------- ### Finding PCL and OpenMP Dependencies (CMake) Source: https://github.com/koide3/ndt_omp/blob/master/CMakeLists.txt This section locates the PCL library (version 1.7 or higher) and OpenMP. It includes PCL directories and definitions, and if OpenMP is found, it appends its compiler flags to C and C++ flags, enabling parallel processing support. ```CMake find_package(PCL 1.7 REQUIRED) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) message(STATUS "PCL_INCLUDE_DIRS:" ${PCL_INCLUDE_DIRS}) message(STATUS "PCL_LIBRARY_DIRS:" ${PCL_LIBRARY_DIRS}) message(STATUS "PCL_DEFINITIONS:" ${PCL_DEFINITIONS}) find_package(OpenMP) if (OPENMP_FOUND) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.