123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- cmake_minimum_required(VERSION 2.8.3)
- project(lio_sam)
- set(CMAKE_BUILD_TYPE "Release")
- set(CMAKE_CXX_FLAGS "-std=c++14")
- set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -pthread")
- find_package(catkin REQUIRED COMPONENTS
- tf
- roscpp
- rospy
- cv_bridge
- # pcl library
- pcl_conversions
- # msgs
- std_msgs
- sensor_msgs
- geometry_msgs
- nav_msgs
- message_generation
- )
- find_package(OpenMP REQUIRED)
- find_package(PCL REQUIRED QUIET)
- find_package(OpenCV REQUIRED QUIET)
- find_package(GTSAM REQUIRED QUIET)
- find_package(RapidJSON)
- add_message_files(
- DIRECTORY msg
- FILES
- cloud_info.msg
- )
- generate_messages(
- DEPENDENCIES
- geometry_msgs
- std_msgs
- nav_msgs
- sensor_msgs
- )
- catkin_package(
- INCLUDE_DIRS include
- DEPENDS PCL GTSAM
- CATKIN_DEPENDS
- std_msgs
- nav_msgs
- geometry_msgs
- sensor_msgs
- message_runtime
- message_generation
- )
- # include directories
- include_directories(
- include
- ${catkin_INCLUDE_DIRS}
- ${PCL_INCLUDE_DIRS}
- ${OpenCV_INCLUDE_DIRS}
- ${GTSAM_INCLUDE_DIR}
- )
- # link directories
- link_directories(
- include
- ${PCL_LIBRARY_DIRS}
- ${OpenCV_LIBRARY_DIRS}
- ${GTSAM_LIBRARY_DIRS}
- )
- ###########
- ## Build ##
- ###########
- # Range Image Projection
- add_executable(${PROJECT_NAME}_imageProjection src/imageProjection.cpp)
- add_dependencies(${PROJECT_NAME}_imageProjection ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
- target_link_libraries(${PROJECT_NAME}_imageProjection ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
- # Feature Association
- add_executable(${PROJECT_NAME}_featureExtraction src/featureExtraction.cpp)
- add_dependencies(${PROJECT_NAME}_featureExtraction ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
- target_link_libraries(${PROJECT_NAME}_featureExtraction ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
- # Mapping Optimization
- add_executable(${PROJECT_NAME}_mapOptmization src/mapOptmization.cpp)
- add_dependencies(${PROJECT_NAME}_mapOptmization ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
- target_compile_options(${PROJECT_NAME}_mapOptmization PRIVATE ${OpenMP_CXX_FLAGS})
- target_link_libraries(${PROJECT_NAME}_mapOptmization ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${OpenMP_CXX_FLAGS} gtsam)
- # localization
- add_executable(${PROJECT_NAME}_localization src/localization.cpp)
- add_dependencies(${PROJECT_NAME}_localization ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
- target_compile_options(${PROJECT_NAME}_localization PRIVATE ${OpenMP_CXX_FLAGS})
- target_link_libraries(${PROJECT_NAME}_localization ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${OpenMP_CXX_FLAGS} gtsam)
- # IMU Preintegration
- add_executable(${PROJECT_NAME}_imuPreintegration src/imuPreintegration.cpp)
- target_link_libraries(${PROJECT_NAME}_imuPreintegration ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} gtsam)
- #############
- ## Install ##
- #############
- # all install targets should use catkin DESTINATION variables
- # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
- ## Mark executable scripts (Python etc.) for installation
- ## in contrast to setup.py, you can choose the destination
- # catkin_install_python(PROGRAMS
- # scripts/my_python_script
- # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
- # )
- ## Mark executables for installation
- ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
- install(TARGETS
- ${PROJECT_NAME}_imageProjection
- ${PROJECT_NAME}_featureExtraction
- ${PROJECT_NAME}_mapOptmization
- ${PROJECT_NAME}_localization
- ${PROJECT_NAME}_imuPreintegration
- RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
- )
- #
- ## Mark libraries for installation
- ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
- # install(TARGETS ${PROJECT_NAME}
- # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
- # )
- # Mark cpp header files for installation
- install(DIRECTORY include/${PROJECT_NAME}/
- DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
- FILES_MATCHING PATTERN "*.h"
- PATTERN ".svn" EXCLUDE
- )
- # Mark cpp header files for installation
- install(DIRECTORY
- launch
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
- )
- # Mark cpp header files for installation
- install(DIRECTORY
- config
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
- )
- ## Mark other files for installation (e.g. launch and bag files, etc.)
- # install(FILES
- # # myfile1
- # # myfile2
- # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
- # )
|