|
| 1 | +cmake_minimum_required(VERSION 2.8.3) |
| 2 | +project(spinnaker_camera_driver) |
| 3 | + |
| 4 | +## Compile as C++11, supported in ROS Kinetic and newer |
| 5 | +# add_compile_options(-std=c++11) |
| 6 | + |
| 7 | + |
| 8 | +### |
| 9 | +# camera Acquisition specific |
| 10 | +### |
| 11 | +#SET("OpenCV_DIR" "~/apps/opencv-2.4.13/") |
| 12 | +set(PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include" CACHE PATH "Project Include Directory") |
| 13 | +set(SPINNAKER_INCLUDE_DIR "/usr/include/spinnaker" CACHE PATH "Spinnaker Include Directory") |
| 14 | +set(SPINNAKER_LIB_DIR "/usr/lib" CACHE PATH "Spinnaker Libs Directory") |
| 15 | +# set(yaml-cpp_DIR "~/apps/yaml-cpp" CACHE PATH "yaml-cpp Directory") |
| 16 | +set(CUDA_USE_STATIC_CUDA_RUNTIME OFF) |
| 17 | + |
| 18 | + |
| 19 | +## Find catkin macros and libraries |
| 20 | +## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) |
| 21 | +## is used, also find other catkin packages |
| 22 | +find_package(catkin REQUIRED COMPONENTS |
| 23 | + roscpp |
| 24 | + rospy |
| 25 | + std_msgs |
| 26 | + message_generation |
| 27 | + cv_bridge |
| 28 | + image_transport |
| 29 | + sensor_msgs |
| 30 | +# tf |
| 31 | +) |
| 32 | + |
| 33 | +#find_package(PCL REQUIRED) |
| 34 | + |
| 35 | +### |
| 36 | +# Acquisition specific |
| 37 | +### |
| 38 | +# Find Packages |
| 39 | +find_package(OpenCV REQUIRED) |
| 40 | + |
| 41 | +find_package(Boost) |
| 42 | +if(Boost_FOUND) |
| 43 | + find_package ( Boost COMPONENTS filesystem system serialization REQUIRED ) |
| 44 | + set(Boost_GENERAL ${Boost_LIBRARIES}) |
| 45 | +elseif(NOT Boost_FOUND) |
| 46 | + message("Boost not found!") |
| 47 | +endif() |
| 48 | + |
| 49 | +## System dependencies are found with CMake's conventions |
| 50 | +# find_package(Boost REQUIRED COMPONENTS system) |
| 51 | + |
| 52 | + |
| 53 | +## Uncomment this if the package has a setup.py. This macro ensures |
| 54 | +## modules and global scripts declared therein get installed |
| 55 | +## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html |
| 56 | +# catkin_python_setup() |
| 57 | + |
| 58 | +################################################ |
| 59 | +## Declare ROS messages, services and actions ## |
| 60 | +################################################ |
| 61 | + |
| 62 | +## To declare and build messages, services or actions from within this |
| 63 | +## package, follow these steps: |
| 64 | +## * Let MSG_DEP_SET be the set of packages whose message types you use in |
| 65 | +## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). |
| 66 | +## * In the file package.xml: |
| 67 | +## * add a build_depend tag for "message_generation" |
| 68 | +## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET |
| 69 | +## * If MSG_DEP_SET isn't empty the following dependency has been pulled in |
| 70 | +## but can be declared for certainty nonetheless: |
| 71 | +## * add a run_depend tag for "message_runtime" |
| 72 | +## * In this file (CMakeLists.txt): |
| 73 | +## * add "message_generation" and every package in MSG_DEP_SET to |
| 74 | +## find_package(catkin REQUIRED COMPONENTS ...) |
| 75 | +## * add "message_runtime" and every package in MSG_DEP_SET to |
| 76 | +## catkin_package(CATKIN_DEPENDS ...) |
| 77 | +## * uncomment the add_*_files sections below as needed |
| 78 | +## and list every .msg/.srv/.action file to be processed |
| 79 | +## * uncomment the generate_messages entry below |
| 80 | +## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) |
| 81 | + |
| 82 | +## Generate messages in the 'msg' folder |
| 83 | + add_message_files( |
| 84 | + FILES |
| 85 | + spinnaker_image_names.msg |
| 86 | + ) |
| 87 | + |
| 88 | +## Generate added messages and services with any dependencies listed here |
| 89 | + generate_messages( |
| 90 | + DEPENDENCIES |
| 91 | + std_msgs |
| 92 | + ) |
| 93 | + |
| 94 | +## Generate services in the 'srv' folder |
| 95 | +# add_service_files( |
| 96 | +# FILES |
| 97 | +# Service1.srv |
| 98 | +# Service2.srv |
| 99 | +# ) |
| 100 | + |
| 101 | +## Generate actions in the 'action' folder |
| 102 | +# add_action_files( |
| 103 | +# FILES |
| 104 | +# Action1.action |
| 105 | +# Action2.action |
| 106 | +# ) |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +################################################ |
| 111 | +## Declare ROS dynamic reconfigure parameters ## |
| 112 | +################################################ |
| 113 | + |
| 114 | +## To declare and build dynamic reconfigure parameters within this |
| 115 | +## package, follow these steps: |
| 116 | +## * In the file package.xml: |
| 117 | +## * add a build_depend and a run_depend tag for "dynamic_reconfigure" |
| 118 | +## * In this file (CMakeLists.txt): |
| 119 | +## * add "dynamic_reconfigure" to |
| 120 | +## find_package(catkin REQUIRED COMPONENTS ...) |
| 121 | +## * uncomment the "generate_dynamic_reconfigure_options" section below |
| 122 | +## and list every .cfg file to be processed |
| 123 | + |
| 124 | +## Generate dynamic reconfigure parameters in the 'cfg' folder |
| 125 | +# generate_dynamic_reconfigure_options( |
| 126 | +# cfg/DynReconf1.cfg |
| 127 | +# cfg/DynReconf2.cfg |
| 128 | +# ) |
| 129 | + |
| 130 | +################################### |
| 131 | +## catkin specific configuration ## |
| 132 | +################################### |
| 133 | +## The catkin_package macro generates cmake config files for your package |
| 134 | +## Declare things to be passed to dependent projects |
| 135 | +## INCLUDE_DIRS: uncomment this if you package contains header files |
| 136 | +## LIBRARIES: libraries you create in this project that dependent projects also need |
| 137 | +## CATKIN_DEPENDS: catkin_packages dependent projects also need |
| 138 | +## DEPENDS: system dependencies of this project that dependent projects also need |
| 139 | +catkin_package( |
| 140 | + INCLUDE_DIRS include |
| 141 | + #LIBRARIES datacollection_neu |
| 142 | + CATKIN_DEPENDS roscpp rospy std_msgs message_runtime |
| 143 | +# DEPENDS system_lib |
| 144 | +) |
| 145 | + |
| 146 | +########### |
| 147 | +## Build ## |
| 148 | +########### |
| 149 | + |
| 150 | +## Specify additional locations of header files |
| 151 | +## Your package locations should be listed before other locations |
| 152 | +include_directories( |
| 153 | +# include |
| 154 | + ${catkin_INCLUDE_DIRS} |
| 155 | +# ${PCL_INCLUDE_DIRS} |
| 156 | +) |
| 157 | +include_directories( ${PROJECT_INCLUDE_DIR} ) |
| 158 | +include_directories( ${SPINNAKER_INCLUDE_DIR} ) |
| 159 | +include_directories( ${OpenCV_INCLUDE_DIRS} ) |
| 160 | +include_directories( ${Boost_INCLUDE_DIR} ) |
| 161 | +#include_directories( ${YAML_CPP_INCLUDE_DIR} ) |
| 162 | + |
| 163 | +## Declare a C++ library |
| 164 | +add_library (acquilib SHARED |
| 165 | + # ${PROJECT_SOURCE_DIR}/src/utils.cpp |
| 166 | + src/capture.cpp |
| 167 | + src/camera.cpp) |
| 168 | + |
| 169 | +link_directories( ${SPINNAKER_LIB_DIR} ) |
| 170 | + |
| 171 | +# Settings libraries to link to |
| 172 | +# set (ROS_LIBS ${cv_bridge_LIBRARIES} ${image_transport_LIBRARIES}) |
| 173 | +#set (LIBS glog gflags gomp unwind Spinnaker yaml-cpp ${OpenCV_LIBS} ${Boost_GENERAL}) # ${ROS_LIBS} profiler |
| 174 | +set (LIBS gomp unwind Spinnaker ${OpenCV_LIBS} ${Boost_GENERAL}) # ${ROS_LIBS} profiler |
| 175 | +# Custom compiler flags |
| 176 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -std=c++11") |
| 177 | + |
| 178 | +# add_library(${PROJECT_NAME} |
| 179 | +# src/${PROJECT_NAME}/datacollection_neu.cpp |
| 180 | +# ) |
| 181 | + |
| 182 | +## Add cmake target dependencies of the library |
| 183 | +## as an example, code may need to be generated before libraries |
| 184 | +## either from message generation or dynamic reconfigure |
| 185 | +# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) |
| 186 | + |
| 187 | +## Declare a C++ executable |
| 188 | +## With catkin_make all packages are built within a single CMake context |
| 189 | +## The recommended prefix ensures that target names across packages don't collide |
| 190 | +#add_executable(${PROJECT_NAME}_node src/datacollection_neu_node.cpp) |
| 191 | +add_executable (acquisition_node src/acquisition_node.cpp) |
| 192 | + |
| 193 | + |
| 194 | +#target_link_libraries (multiAcq_node acquilib ${LIBS} ) |
| 195 | +#target_link_libraries (acquisition_mt_node acquilib ${LIBS} ${catkin_LIBRARIES}) |
| 196 | +#target_link_libraries (conversion_node acquilib ${LIBS} ) |
| 197 | +target_link_libraries (acquisition_node acquilib ${LIBS} ${catkin_LIBRARIES}) |
| 198 | +add_dependencies(acquisition_node spinnaker_camera_driver_generate_messages_cpp) |
| 199 | +#add_dependencies(acquisition_mt_node datacollection_neu_generate_messages_cpp) |
| 200 | + |
| 201 | +## Rename C++ executable without prefix |
| 202 | +## The above recommended prefix causes long target names, the following renames the |
| 203 | +## target back to the shorter version for ease of user use |
| 204 | +## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" |
| 205 | +# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") |
| 206 | + |
| 207 | +## Add cmake target dependencies of the executable |
| 208 | +## same as for the library above |
| 209 | +# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) |
| 210 | +add_dependencies(acquisition_node ${catkin_EXPORTED_TARGETS}) |
| 211 | +#add_dependencies(acquisition_mt_node ${catkin_EXPORTED_TARGETS}) |
| 212 | + |
| 213 | +## Specify libraries to link a library or executable target against |
| 214 | +# target_link_libraries(${PROJECT_NAME}_node |
| 215 | +# ${catkin_LIBRARIES} |
| 216 | +# ) |
| 217 | + |
| 218 | +############# |
| 219 | +## Install ## |
| 220 | +############# |
| 221 | + |
| 222 | +# all install targets should use catkin DESTINATION variables |
| 223 | +# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html |
| 224 | + |
| 225 | +## Mark executable scripts (Python etc.) for installation |
| 226 | +## in contrast to setup.py, you can choose the destination |
| 227 | +# install(PROGRAMS |
| 228 | +# scripts/my_python_script |
| 229 | +# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
| 230 | +# ) |
| 231 | + |
| 232 | +## Mark executables and/or libraries for installation |
| 233 | +# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node |
| 234 | +# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 235 | +# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 236 | +# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
| 237 | +# ) |
| 238 | + |
| 239 | +## Mark cpp header files for installation |
| 240 | +# install(DIRECTORY include/${PROJECT_NAME}/ |
| 241 | +# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
| 242 | +# FILES_MATCHING PATTERN "*.h" |
| 243 | +# PATTERN ".svn" EXCLUDE |
| 244 | +# ) |
| 245 | + |
| 246 | +## Mark other files for installation (e.g. launch and bag files, etc.) |
| 247 | +# install(FILES |
| 248 | +# # myfile1 |
| 249 | +# # myfile2 |
| 250 | +# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
| 251 | +# ) |
| 252 | + |
| 253 | +############# |
| 254 | +## Testing ## |
| 255 | +############# |
| 256 | + |
| 257 | +## Add gtest based cpp test target and link libraries |
| 258 | +# catkin_add_gtest(${PROJECT_NAME}-test test/test_datacollection_neu.cpp) |
| 259 | +# if(TARGET ${PROJECT_NAME}-test) |
| 260 | +# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) |
| 261 | +# endif() |
| 262 | + |
| 263 | +## Add folders to be run by python nosetests |
| 264 | +# catkin_add_nosetests(test) |
0 commit comments