CMakeLists.txt 7.9 KB

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