|
| 1 | +cmake_minimum_required(VERSION 3.8) |
| 2 | +project(fastlio2) |
| 3 | + |
| 4 | +set(CMAKE_BUILD_TYPE "Release") |
| 5 | +set(CMAKE_CXX_STANDARD 17) |
| 6 | +set(CMAKE_CXX_STANDARD_REQUIRED True) |
| 7 | + |
| 8 | +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" ) |
| 9 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fexceptions") |
| 10 | + |
| 11 | + |
| 12 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 13 | + add_compile_options(-O3) |
| 14 | + add_compile_options(-Wall -Wextra -Wpedantic) |
| 15 | +endif() |
| 16 | + |
| 17 | +add_compile_definitions(SOPHUS_USE_BASIC_LOGGING) |
| 18 | + |
| 19 | +add_definitions(-DMP_EN) |
| 20 | +add_definitions(-DMP_PROC_NUM=2) |
| 21 | + |
| 22 | +# find dependencies |
| 23 | +find_package(ament_cmake REQUIRED) |
| 24 | +find_package(rclcpp REQUIRED) |
| 25 | +find_package(std_msgs REQUIRED) |
| 26 | +find_package(tf2 REQUIRED) |
| 27 | +find_package(tf2_ros REQUIRED) |
| 28 | +find_package(nav_msgs REQUIRED) |
| 29 | +find_package(sensor_msgs REQUIRED) |
| 30 | +find_package(livox_ros_driver2 REQUIRED) |
| 31 | +find_package(pcl_conversions REQUIRED) |
| 32 | +find_package(geometry_msgs REQUIRED) |
| 33 | + |
| 34 | +find_package(OpenMP QUIET) |
| 35 | +find_package(PCL REQUIRED) |
| 36 | +find_package(Eigen3 REQUIRED) |
| 37 | +find_package(Sophus REQUIRED) |
| 38 | +find_package(yaml-cpp REQUIRED) |
| 39 | + |
| 40 | + |
| 41 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") |
| 42 | +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") |
| 43 | + |
| 44 | +set(SRC_LIST src/map_builder/commons.cpp |
| 45 | + src/map_builder/ieskf.cpp |
| 46 | + src/map_builder/imu_processor.cpp |
| 47 | + src/map_builder/ikd_Tree.cpp |
| 48 | + src/map_builder/lidar_processor.cpp |
| 49 | + src/map_builder/map_builder.cpp |
| 50 | + src/utils.cpp) |
| 51 | + |
| 52 | +add_executable(lio_node src/lio_node.cpp ${SRC_LIST}) |
| 53 | +ament_target_dependencies(lio_node rclcpp std_msgs tf2 tf2_ros nav_msgs sensor_msgs livox_ros_driver2 pcl_conversions geometry_msgs) |
| 54 | +target_link_libraries(lio_node |
| 55 | + yaml-cpp |
| 56 | + ${PCL_LIBRARIES} |
| 57 | +) |
| 58 | + |
| 59 | + |
| 60 | +install(TARGETS lio_node DESTINATION lib/${PROJECT_NAME}) |
| 61 | +install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) |
| 62 | +install(DIRECTORY rviz DESTINATION share/${PROJECT_NAME}) |
| 63 | +install(DIRECTORY config DESTINATION share/${PROJECT_NAME}) |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +if(BUILD_TESTING) |
| 69 | + find_package(ament_lint_auto REQUIRED) |
| 70 | + # the following line skips the linter which checks for copyrights |
| 71 | + # comment the line when a copyright and license is added to all source files |
| 72 | + set(ament_cmake_copyright_FOUND TRUE) |
| 73 | + # the following line skips cpplint (only works in a git repo) |
| 74 | + # comment the line when this package is in a git repo and when |
| 75 | + # a copyright and license is added to all source files |
| 76 | + set(ament_cmake_cpplint_FOUND TRUE) |
| 77 | + ament_lint_auto_find_test_dependencies() |
| 78 | +endif() |
| 79 | + |
| 80 | +ament_package() |
0 commit comments