|
| 1 | +cmake_minimum_required(VERSION 2.8.3) |
| 2 | +project(groundgrid) |
| 3 | + |
| 4 | +# use c++17 |
| 5 | +SET(CMAKE_CXX_STANDARD 17) |
| 6 | + |
| 7 | +###################################### |
| 8 | +## Find catkin macros and libraries ## |
| 9 | +###################################### |
| 10 | + |
| 11 | +find_package(catkin REQUIRED COMPONENTS |
| 12 | + dynamic_reconfigure |
| 13 | + nodelet |
| 14 | + roscpp |
| 15 | + geometry_msgs |
| 16 | + pcl_ros |
| 17 | + pcl_conversions |
| 18 | + grid_map_core |
| 19 | + grid_map_ros |
| 20 | + grid_map_cv |
| 21 | + grid_map_filters |
| 22 | + grid_map_loader |
| 23 | + grid_map_msgs |
| 24 | + grid_map_rviz_plugin |
| 25 | + grid_map_visualization |
| 26 | + cv_bridge |
| 27 | + image_transport |
| 28 | + std_msgs |
| 29 | + sensor_msgs |
| 30 | + nav_msgs |
| 31 | + tf2 |
| 32 | + tf2_ros |
| 33 | + tf2_msgs |
| 34 | + message_generation |
| 35 | +) |
| 36 | + |
| 37 | +################################ |
| 38 | +## include common CMake setup ## |
| 39 | +################################ |
| 40 | +find_package(OpenCV REQUIRED) |
| 41 | +find_package(PCL REQUIRED COMPONENTS common) |
| 42 | +find_package(Eigen3 REQUIRED) |
| 43 | + |
| 44 | +####################################### |
| 45 | +## dynamic_reconfigure configuration ## |
| 46 | +####################################### |
| 47 | + |
| 48 | +generate_dynamic_reconfigure_options( |
| 49 | + cfg/GroundGrid.cfg |
| 50 | +) |
| 51 | + |
| 52 | +################################################ |
| 53 | +## Declare ROS messages, services and actions ## |
| 54 | +################################################ |
| 55 | +add_service_files( |
| 56 | + FILES |
| 57 | + NextCloud.srv |
| 58 | +) |
| 59 | + |
| 60 | + |
| 61 | +## Generate added messages and services with any dependencies listed here |
| 62 | +generate_messages( |
| 63 | + DEPENDENCIES |
| 64 | + std_msgs |
| 65 | +) |
| 66 | + |
| 67 | +################################### |
| 68 | +## catkin specific configuration ## |
| 69 | +################################### |
| 70 | + |
| 71 | +catkin_package( |
| 72 | + INCLUDE_DIRS include |
| 73 | + LIBRARIES ${PROJECT_NAME}_lib |
| 74 | + CATKIN_DEPENDS |
| 75 | + dynamic_reconfigure |
| 76 | + nodelet |
| 77 | +) |
| 78 | + |
| 79 | +########### |
| 80 | +## Build ## |
| 81 | +########### |
| 82 | + |
| 83 | +## Specify additional locations of header files |
| 84 | +## Your package locations should be listed before other locations |
| 85 | + |
| 86 | +include_directories(SYSTEM |
| 87 | + ${catkin_INCLUDE_DIRS} |
| 88 | + include |
| 89 | +) |
| 90 | + |
| 91 | + |
| 92 | +##################################################### |
| 93 | +## Build library, node and nodelet of this package ## |
| 94 | +##################################################### |
| 95 | + |
| 96 | +## Declare a cpp library |
| 97 | +add_library(${PROJECT_NAME}_lib |
| 98 | + src/GroundGrid.cpp |
| 99 | +) |
| 100 | + |
| 101 | +## Add cmake target dependencies of the executable/library |
| 102 | +## as an example, message headers may need to be generated before nodes |
| 103 | +add_dependencies(${PROJECT_NAME}_lib |
| 104 | + ${PROJECT_NAME}_gencfg |
| 105 | +) |
| 106 | + |
| 107 | +## Specify libraries to link a library or executable target against |
| 108 | +target_link_libraries(${PROJECT_NAME}_lib |
| 109 | + ${catkin_LIBRARIES} |
| 110 | +) |
| 111 | + |
| 112 | +## Declare a cpp library |
| 113 | +add_library(${PROJECT_NAME}_groundsegmentation_lib |
| 114 | + src/GroundSegmentation.cpp |
| 115 | +) |
| 116 | + |
| 117 | +## Add cmake target dependencies of the executable/library |
| 118 | +## as an example, message headers may need to be generated before nodes |
| 119 | +add_dependencies(${PROJECT_NAME}_groundsegmentation_lib |
| 120 | + ${PROJECT_NAME}_gencfg |
| 121 | +) |
| 122 | + |
| 123 | +## Specify libraries to link a library or executable target against |
| 124 | +target_link_libraries(${PROJECT_NAME}_groundsegmentation_lib |
| 125 | + ${catkin_LIBRARIES} |
| 126 | +) |
| 127 | + |
| 128 | +## determines target name as lib[name].so, here: libfub_dummy_nodelet.so |
| 129 | +## the library path in nodelet_plugins.xml refers to this file |
| 130 | +add_library(${PROJECT_NAME}_nodelet |
| 131 | + src/GroundGridNodelet.cpp |
| 132 | +) |
| 133 | + |
| 134 | +add_dependencies(${PROJECT_NAME}_nodelet |
| 135 | + ${PROJECT_NAME}_gencfg |
| 136 | + ${catkin_EXPORTED_TARGETS} |
| 137 | + ${PROJECT_NAME}_lib |
| 138 | + ${PROJECT_NAME}_groundsegmentation_lib |
| 139 | +) |
| 140 | + |
| 141 | +target_link_libraries(${PROJECT_NAME}_nodelet |
| 142 | + ${catkin_LIBRARIES} |
| 143 | + ${PROJECT_NAME}_lib |
| 144 | + ${PROJECT_NAME}_groundsegmentation_lib |
| 145 | +) |
| 146 | + |
| 147 | +## Declare a cpp executable |
| 148 | +add_executable(${PROJECT_NAME}_node |
| 149 | + src/GroundGridNode.cpp |
| 150 | +) |
| 151 | + |
| 152 | +add_dependencies(${PROJECT_NAME}_node |
| 153 | + ${PROJECT_NAME}_nodelet |
| 154 | +) |
| 155 | + |
| 156 | +target_link_libraries(${PROJECT_NAME}_node |
| 157 | + ${catkin_LIBRARIES} |
| 158 | +) |
| 159 | + |
| 160 | +############# |
| 161 | +## Install ## |
| 162 | +############# |
| 163 | + |
| 164 | +## Mark executables and/or libraries for installation |
| 165 | +install( |
| 166 | + TARGETS |
| 167 | + ${PROJECT_NAME}_lib |
| 168 | + ${PROJECT_NAME}_groundsegmentation_lib |
| 169 | + ${PROJECT_NAME}_node |
| 170 | + ${PROJECT_NAME}_nodelet |
| 171 | + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 172 | + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 173 | + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
| 174 | +) |
| 175 | + |
| 176 | +## Mark cpp header files for installation |
| 177 | +install(DIRECTORY include/${PROJECT_NAME}/ |
| 178 | + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
| 179 | + FILES_MATCHING PATTERN "*.h" |
| 180 | +) |
| 181 | + |
| 182 | + |
| 183 | +## Mark other files for installation (e.g. launch and bag files, etc.) |
| 184 | +install( |
| 185 | + DIRECTORY launch |
| 186 | + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 187 | +) |
| 188 | + |
| 189 | +install( |
| 190 | + FILES nodelet_plugins.xml |
| 191 | + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 192 | +) |
| 193 | + |
0 commit comments