CMakeLists.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(fast_lio)
  3. SET(CMAKE_BUILD_TYPE "Debug")
  4. ADD_COMPILE_OPTIONS(-std=c++14 )
  5. ADD_COMPILE_OPTIONS(-std=c++14 )
  6. set( CMAKE_CXX_FLAGS "-std=c++14 -O3" )
  7. add_definitions(-DROOT_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\")
  8. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" )
  9. set(CMAKE_CXX_STANDARD 14)
  10. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  11. set(CMAKE_CXX_EXTENSIONS OFF)
  12. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -std=c++0x -std=c++14 -fexceptions")
  13. message("Current CPU archtecture: ${CMAKE_SYSTEM_PROCESSOR}")
  14. if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)" )
  15. include(ProcessorCount)
  16. ProcessorCount(N)
  17. message("Processer number: ${N}")
  18. if(N GREATER 4)
  19. add_definitions(-DMP_EN)
  20. add_definitions(-DMP_PROC_NUM=3)
  21. message("core for MP: 3")
  22. elseif(N GREATER 3)
  23. add_definitions(-DMP_EN)
  24. add_definitions(-DMP_PROC_NUM=2)
  25. message("core for MP: 2")
  26. else()
  27. add_definitions(-DMP_PROC_NUM=1)
  28. endif()
  29. else()
  30. add_definitions(-DMP_PROC_NUM=1)
  31. endif()
  32. find_package(OpenMP QUIET)
  33. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  34. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  35. find_package(PythonLibs REQUIRED)
  36. find_path(MATPLOTLIB_CPP_INCLUDE_DIRS "matplotlibcpp.h")
  37. find_package(catkin REQUIRED COMPONENTS
  38. geometry_msgs
  39. nav_msgs
  40. sensor_msgs
  41. roscpp
  42. rospy
  43. std_msgs
  44. pcl_ros
  45. tf
  46. livox_ros_driver
  47. message_generation
  48. eigen_conversions
  49. )
  50. find_package(Eigen3 REQUIRED)
  51. find_package(PCL 1.8 REQUIRED)
  52. message(Eigen: ${EIGEN3_INCLUDE_DIR})
  53. include_directories(
  54. ${catkin_INCLUDE_DIRS}
  55. ${EIGEN3_INCLUDE_DIR}
  56. ${PCL_INCLUDE_DIRS}
  57. ${PYTHON_INCLUDE_DIRS}
  58. include)
  59. add_message_files(
  60. FILES
  61. Pose6D.msg
  62. )
  63. generate_messages(
  64. DEPENDENCIES
  65. geometry_msgs
  66. )
  67. catkin_package(
  68. CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs message_runtime
  69. DEPENDS EIGEN3 PCL
  70. INCLUDE_DIRS
  71. )
  72. add_executable(fastlio_mapping src/laserMapping.cpp include/ikd-Tree/ikd_Tree.cpp src/preprocess.cpp)
  73. target_link_libraries(fastlio_mapping ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${PYTHON_LIBRARIES})
  74. target_include_directories(fastlio_mapping PRIVATE ${PYTHON_INCLUDE_DIRS})