CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # Copyright(c) 2019 livoxtech limited.
  2. cmake_minimum_required(VERSION 2.8.3)
  3. #---------------------------------------------------------------------------------------
  4. # Start livox_ros_driver project
  5. #---------------------------------------------------------------------------------------
  6. project(lio_livox_cpp)
  7. #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  8. SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  9. #---------------------------------------------------------------------------------------
  10. # find package and the dependecy
  11. #---------------------------------------------------------------------------------------
  12. find_package(Boost 1.54 REQUIRED COMPONENTS
  13. system
  14. thread
  15. chrono
  16. )
  17. find_package (Eigen3 REQUIRED CONFIG QUIET)
  18. find_package(Pangolin 0.8 REQUIRED)
  19. find_package(PCL REQUIRED)
  20. find_package(Ceres REQUIRED)
  21. find_package(OpenCV REQUIRED)
  22. find_package(SuiteSparse REQUIRED)
  23. find_package(PkgConfig)
  24. pkg_check_modules(APR apr-1)
  25. if (APR_FOUND)
  26. message(${APR_INCLUDE_DIRS})
  27. message(${APR_LIBRARIES})
  28. endif (APR_FOUND)
  29. #---------------------------------------------------------------------------------------
  30. # Set default build to release
  31. #---------------------------------------------------------------------------------------
  32. if(NOT CMAKE_BUILD_TYPE)
  33. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
  34. endif()
  35. #---------------------------------------------------------------------------------------
  36. # Compiler config
  37. #---------------------------------------------------------------------------------------
  38. set(CMAKE_CXX_STANDARD 17)
  39. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  40. set(CMAKE_CXX_EXTENSIONS OFF)
  41. ## make sure the livox_sdk_static library is installed
  42. find_library(LIVOX_SDK_LIBRARY liblivox_sdk_static.a /usr/local/lib)
  43. include_directories(
  44. define
  45. lio/include
  46. lio/src
  47. ${Pangolin_INCLUDE_DIRS}
  48. ${EIGEN3_INCLUDE_DIR}
  49. ${PCL_INCLUDE_DIRS}
  50. ${CERES_INCLUDE_DIRS}
  51. ${OpenCV_INCLUDE_DIRS}
  52. ${SUITESPARSE_INCLUDE_DIRS}
  53. ${APR_INCLUDE_DIRS}
  54. livox/common
  55. livox/common/rapidjson
  56. livox/comon/rapdidxml
  57. livox/common/comm
  58. livox/timesync
  59. livox/timesync/user_uart
  60. livox/livox_driver)
  61. ## PCL library
  62. link_directories(${PCL_LIBRARY_DIRS})
  63. add_definitions(${PCL_DEFINITIONS})
  64. #---------------------------------------------------------------------------------------
  65. # generate excutable and add libraries
  66. #---------------------------------------------------------------------------------------
  67. add_executable(${PROJECT_NAME}_node
  68. main.cpp
  69. lio/src/segment/LidarFeatureExtractor.cpp
  70. lio/src/segment/segment.cpp
  71. lio/src/segment/pointsCorrect.cpp
  72. lio/src/lio/LocalMapIvox.cpp
  73. lio/src/lio/mapper.cpp
  74. lio/src/lio/Estimator.cpp
  75. lio/src/lio/IMUIntegrator.cpp
  76. lio/src/lio/ceresfunc.cpp
  77. lio/src/lio/ndtMap.cpp
  78. lio/src/utils/TimerRecord.cpp
  79. livox/livox_driver/lvx_file.cpp
  80. livox/livox_driver/ldq.cpp
  81. livox/livox_driver/lds.cpp
  82. livox/livox_driver/lds_lvx.cpp
  83. livox/livox_driver/lds_lidar.cpp
  84. livox/livox_driver/lds_hub.cpp
  85. livox/livox_driver/lddc.cpp
  86. livox/timesync/timesync.cpp
  87. livox/timesync/user_uart/user_uart.cpp
  88. livox/common/comm/comm_protocol.cpp
  89. livox/common/comm/sdk_protocol.cpp
  90. livox/common/comm/gps_protocol.cpp
  91. pangolinViewer.cpp
  92. )
  93. #---------------------------------------------------------------------------------------
  94. # precompile macro and compile option
  95. #---------------------------------------------------------------------------------------
  96. target_compile_options(${PROJECT_NAME}_node
  97. PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wall>
  98. )
  99. #---------------------------------------------------------------------------------------
  100. # link libraries
  101. #---------------------------------------------------------------------------------------
  102. target_link_libraries(${PROJECT_NAME}_node
  103. pango_display
  104. livox_sdk_static.a
  105. ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${CERES_LIBRARIES}
  106. ${Boost_LIBRARY}
  107. ${APR_LIBRARIES}
  108. -lpthread
  109. ipopt
  110. )
  111. #---------------------------------------------------------------------------------------
  112. # end of CMakeList.txt
  113. #---------------------------------------------------------------------------------------