CMakeLists.txt 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(wj_716_lidar)
  3. ## Compile as C++11, supported in ROS Kinetic and newer
  4. add_compile_options(-std=c++11)
  5. find_package(PCL REQUIRED)
  6. find_package(Boost REQUIRED)
  7. find_package(Eigen3 REQUIRED)
  8. find_package(Glog REQUIRED)
  9. find_package(GFlags REQUIRED)
  10. FIND_PACKAGE(Protobuf REQUIRED)
  11. find_package(OpenCV REQUIRED)
  12. ###################################
  13. ## catkin specific configuration ##
  14. ###################################
  15. ## The catkin_package macro generates cmake config files for your package
  16. ## Declare things to be passed to dependent projects
  17. ## INCLUDE_DIRS: uncomment this if your package contains header files
  18. ## LIBRARIES: libraries you create in this project that dependent projects also need
  19. ## CATKIN_DEPENDS: catkin_packages dependent projects also need
  20. ## DEPENDS: system dependencies of this project that dependent projects also need
  21. ###########
  22. ## Build ##
  23. ###########
  24. ## Specify additional locations of header files
  25. ## Your package locations should be listed before other locations
  26. include_directories(
  27. ${EIGEN3_INCLUDE_DIRS}
  28. ${Boost_INCLUDE_DIRS}
  29. ${PCL_INCLUDE_DIRS}
  30. ${OpenCV_INLCUDE_DIRS}
  31. /usr/local/include
  32. /usr/local/include/snap7
  33. ./src
  34. )
  35. aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/wj_lidar WJ_LIDAR_TOTAL_SRC)
  36. # aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/test WJ_TEST_SRC)
  37. aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/error_code ERROR_CODE_SRC)
  38. aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/tool TOOL_SRC)
  39. aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/task TASK_SRC)
  40. # MESSAGE(WARNING ${WJ_LIDAR_TOTAL_SRC})
  41. set(WJ_LIDAR_SRC ${CMAKE_CURRENT_LIST_DIR}/src/wj_lidar/async_client.cpp
  42. ${CMAKE_CURRENT_LIST_DIR}/src/wj_lidar/wj_716_lidar_protocol.cpp
  43. ${CMAKE_CURRENT_LIST_DIR}/src/wj_lidar/wj_lidar_conf.pb.cc
  44. ${CMAKE_CURRENT_LIST_DIR}/src/wj_lidar/wj_lidar_encapsulation.cpp)
  45. add_executable(wj_716_lidar ${CMAKE_CURRENT_LIST_DIR}/src/test/wj_lidar_test.cpp ${ERROR_CODE_SRC} ${WJ_LIDAR_SRC})
  46. target_link_libraries(wj_716_lidar ${PCL_LIBRARIES} ${Boost_LIBRARIES} ${PROTOBUF_LIBRARIES} glog gflags)
  47. add_executable(wj_fence_controller ${CMAKE_CURRENT_LIST_DIR}/src/test/wj_manager_test.cpp ${ERROR_CODE_SRC} ${WJ_LIDAR_TOTAL_SRC} ${TOOL_SRC} ${TASK_SRC})
  48. target_link_libraries(wj_fence_controller ${PCL_LIBRARIES} ${Boost_LIBRARIES} ${PROTOBUF_LIBRARIES} ${OpenCV_LIBS} glog gflags snap7 nanomsg nnxx)
  49. #add_dependencies(wj_716_lidar ${PROJECT_NAME}_gencfg)
  50. ## Declare a C++ library
  51. # add_library(${PROJECT_NAME}
  52. # src/${PROJECT_NAME}/wj_716_lidar.cpp
  53. # )
  54. ## Add cmake target dependencies of the library
  55. ## as an example, code may need to be generated before libraries
  56. ## either from message generation or dynamic reconfigure
  57. # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  58. ## Declare a C++ executable
  59. ## With catkin_make all packages are built within a single CMake context
  60. ## The recommended prefix ensures that target names across packages don't collide
  61. # add_executable(${PROJECT_NAME}_node src/wj_716_lidar_node.cpp)
  62. ## Rename C++ executable without prefix
  63. ## The above recommended prefix causes long target names, the following renames the
  64. ## target back to the shorter version for ease of user use
  65. ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
  66. # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
  67. ## Add cmake target dependencies of the executable
  68. ## same as for the library above
  69. # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  70. ## Specify libraries to link a library or executable target against
  71. # target_link_libraries(${PROJECT_NAME}_node
  72. # ${catkin_LIBRARIES}
  73. # )
  74. #############
  75. ## Install ##
  76. #############
  77. # all install targets should use catkin DESTINATION variables
  78. # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
  79. ## Mark executable scripts (Python etc.) for installation
  80. ## in contrast to setup.py, you can choose the destination
  81. # install(PROGRAMS
  82. # scripts/my_python_script
  83. # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  84. # )
  85. ## Mark executables and/or libraries for installation
  86. # install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
  87. # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  88. # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  89. # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  90. # )
  91. ## Mark cpp header files for installation
  92. # install(DIRECTORY include/${PROJECT_NAME}/
  93. # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  94. # FILES_MATCHING PATTERN "*.h"
  95. # PATTERN ".svn" EXCLUDE
  96. # )
  97. ## Mark other files for installation (e.g. launch and bag files, etc.)
  98. # install(FILES
  99. # # myfile1
  100. # # myfile2
  101. # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
  102. # )
  103. #############
  104. ## Testing ##
  105. #############
  106. ## Add gtest based cpp test target and link libraries
  107. # catkin_add_gtest(${PROJECT_NAME}-test test/test_wj_716_lidar.cpp)
  108. # if(TARGET ${PROJECT_NAME}-test)
  109. # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
  110. # endif()
  111. ## Add folders to be run by python nosetests
  112. # catkin_add_nosetests(test)