CMakeLists.txt 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(scan_matcher_ICP)
  3. add_compile_options(-std=c++11)
  4. # -mavx causes a lot of errors!!
  5. add_definitions(-std=c++11 -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2)
  6. set(CMAKE_CXX_FLAGS "-std=c++11 -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2")
  7. # pcl 1.7 causes a segfault when it is built with debug mode
  8. set(CMAKE_BUILD_TYPE "RELEASE")
  9. find_package(OpenMP)
  10. if (OPENMP_FOUND)
  11. set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  12. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  13. endif()
  14. ## Compile as C++11, supported in ROS Kinetic and newer
  15. # add_compile_options(-std=c++11)
  16. ## Find catkin macros and libraries
  17. ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
  18. ## is used, also find other catkin packages
  19. find_package(catkin REQUIRED COMPONENTS
  20. roscpp
  21. sensor_msgs
  22. tf
  23. geometry_msgs
  24. nav_msgs
  25. pcl_ros
  26. pcl_conversions
  27. PCL REQUIRED
  28. )
  29. find_package(Eigen3 REQUIRED)
  30. ## System dependencies are found with CMake's conventions
  31. # find_package(Boost REQUIRED COMPONENTS system)
  32. # Find csm project
  33. find_package(PkgConfig)
  34. pkg_check_modules(csm REQUIRED csm)
  35. include_directories(
  36. include
  37. ${catkin_INCLUDE_DIRS}
  38. ${csm_INCLUDE_DIRS}
  39. ${PCL_INCLUDE_DIRS}
  40. ${EIGEN3_INCLUDE_DIRS}
  41. ./src/
  42. )
  43. link_directories(${csm_LIBRARY_DIRS})
  44. ## Uncomment this if the package has a setup.py. This macro ensures
  45. ## modules and global scripts declared therein get installed
  46. ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
  47. # catkin_python_setup()
  48. ################################################
  49. ## Declare ROS messages, services and actions ##
  50. ################################################
  51. ## To declare and build messages, services or actions from within this
  52. ## package, follow these steps:
  53. ## * Let MSG_DEP_SET be the set of packages whose message types you use in
  54. ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
  55. ## * In the file package.xml:
  56. ## * add a build_depend tag for "message_generation"
  57. ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
  58. ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
  59. ## but can be declared for certainty nonetheless:
  60. ## * add a exec_depend tag for "message_runtime"
  61. ## * In this file (CMakeLists.txt):
  62. ## * add "message_generation" and every package in MSG_DEP_SET to
  63. ## find_package(catkin REQUIRED COMPONENTS ...)
  64. ## * add "message_runtime" and every package in MSG_DEP_SET to
  65. ## catkin_package(CATKIN_DEPENDS ...)
  66. ## * uncomment the add_*_files sections below as needed
  67. ## and list every .msg/.srv/.action file to be processed
  68. ## * uncomment the generate_messages entry below
  69. ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
  70. ## Generate messages in the 'msg' folder
  71. # add_message_files(
  72. # FILES
  73. # Message1.msg
  74. # Message2.msg
  75. # )
  76. ## Generate services in the 'srv' folder
  77. # add_service_files(
  78. # FILES
  79. # Service1.srv
  80. # Service2.srv
  81. # )
  82. ## Generate actions in the 'action' folder
  83. # add_action_files(
  84. # FILES
  85. # Action1.action
  86. # Action2.action
  87. # )
  88. ## Generate added messages and services with any dependencies listed here
  89. # generate_messages(
  90. # DEPENDENCIES
  91. # std_msgs # Or other packages containing msgs
  92. # )
  93. ################################################
  94. ## Declare ROS dynamic reconfigure parameters ##
  95. ################################################
  96. ## To declare and build dynamic reconfigure parameters within this
  97. ## package, follow these steps:
  98. ## * In the file package.xml:
  99. ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
  100. ## * In this file (CMakeLists.txt):
  101. ## * add "dynamic_reconfigure" to
  102. ## find_package(catkin REQUIRED COMPONENTS ...)
  103. ## * uncomment the "generate_dynamic_reconfigure_options" section below
  104. ## and list every .cfg file to be processed
  105. ## Generate dynamic reconfigure parameters in the 'cfg' folder
  106. # generate_dynamic_reconfigure_options(
  107. # cfg/DynReconf1.cfg
  108. # cfg/DynReconf2.cfg
  109. # )
  110. ###################################
  111. ## catkin specific configuration ##
  112. ###################################
  113. ## The catkin_package macro generates cmake config files for your package
  114. ## Declare things to be passed to dependent projects
  115. ## INCLUDE_DIRS: uncomment this if your package contains header files
  116. ## LIBRARIES: libraries you create in this project that dependent projects also need
  117. ## CATKIN_DEPENDS: catkin_packages dependent projects also need
  118. ## DEPENDS: system dependencies of this project that dependent projects also need
  119. catkin_package(
  120. INCLUDE_DIRS include
  121. # LIBRARIES scan_matcher_ICP
  122. CATKIN_DEPENDS roscpp sensor_msgs tf geometry_msgs nav_msgs pcl_ros pcl_conversions
  123. DEPENDS PCL
  124. )
  125. ###########
  126. ## Build ##
  127. ###########
  128. ## Specify additional locations of header files
  129. ## Your package locations should be listed before other locations
  130. ## Declare a C++ library
  131. # add_library(${PROJECT_NAME}
  132. # src/${PROJECT_NAME}/scan_matcher_ICP.cpp
  133. # )
  134. ## Add cmake target dependencies of the library
  135. ## as an example, code may need to be generated before libraries
  136. ## either from message generation or dynamic reconfigure
  137. # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  138. ## Declare a C++ executable
  139. ## With catkin_make all packages are built within a single CMake context
  140. ## The recommended prefix ensures that target names across packages don't collide
  141. # add_executable(${PROJECT_NAME}_node src/scan_matcher_ICP_node.cpp)
  142. # add_executable(laser_scan_matcher src/laser_scan_matcher.cpp)
  143. # target_link_libraries(laser_scan_matcher ${catkin_LIBRARIES} ${csm_LIBRARIES} )
  144. add_library(ndt_omp
  145. src/pclomp/voxel_grid_covariance_omp.cpp
  146. src/pclomp/ndt_omp.cpp
  147. src/pclomp/gicp_omp.cpp
  148. )
  149. #Create node
  150. add_executable(scan_matcher_ICP_node src/laser_scan_matcher_node.cpp src/laser_scan_matcher.cpp src/kalmanFilter.cpp)
  151. add_dependencies(scan_matcher_ICP_node
  152. ndt_omp
  153. )
  154. target_link_libraries(scan_matcher_ICP_node ${catkin_LIBRARIES} ${csm_LIBRARIES} ndt_omp)
  155. ## Rename C++ executable without prefix
  156. ## The above recommended prefix causes long target names, the following renames the
  157. ## target back to the shorter version for ease of user use
  158. ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
  159. # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
  160. ## Add cmake target dependencies of the executable
  161. ## same as for the library above
  162. # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  163. ## Specify libraries to link a library or executable target against
  164. # target_link_libraries(${PROJECT_NAME}_node
  165. # ${catkin_LIBRARIES}
  166. # )
  167. #############
  168. ## Install ##
  169. #############
  170. # all install targets should use catkin DESTINATION variables
  171. # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
  172. ## Mark executable scripts (Python etc.) for installation
  173. ## in contrast to setup.py, you can choose the destination
  174. # install(PROGRAMS
  175. # scripts/my_python_script
  176. # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  177. # )
  178. ## Mark executables and/or libraries for installation
  179. # install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
  180. # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  181. # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  182. # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  183. # )
  184. ## Mark cpp header files for installation
  185. # install(DIRECTORY include/${PROJECT_NAME}/
  186. # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  187. # FILES_MATCHING PATTERN "*.h"
  188. # PATTERN ".svn" EXCLUDE
  189. # )
  190. ## Mark other files for installation (e.g. launch and bag files, etc.)
  191. # install(FILES
  192. # # myfile1
  193. # # myfile2
  194. # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
  195. # )
  196. #############
  197. ## Testing ##
  198. #############
  199. ## Add gtest based cpp test target and link libraries
  200. # catkin_add_gtest(${PROJECT_NAME}-test test/test_scan_matcher_ICP.cpp)
  201. # if(TARGET ${PROJECT_NAME}-test)
  202. # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
  203. # endif()
  204. ## Add folders to be run by python nosetests
  205. # catkin_add_nosetests(test)