CMakeLists.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. cmake_minimum_required(VERSION 2.8.7)
  2. project(integrated_viewer)
  3. find_package(autoware_build_flags REQUIRED)
  4. find_package(catkin REQUIRED COMPONENTS
  5. autoware_msgs
  6. cv_bridge
  7. image_transport
  8. roscpp
  9. rviz
  10. sensor_msgs
  11. std_msgs
  12. )
  13. set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
  14. catkin_package(
  15. DEPENDS rviz
  16. )
  17. if(rviz_QT_VERSION VERSION_LESS "5")
  18. find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
  19. include(${QT_USE_FILE})
  20. # Qt's user-interface compiler.
  21. qt4_wrap_ui(UI_HEADERS
  22. node/traffic_light_plugin/form.ui
  23. node/image_viewer_plugin/image_viewer_form.ui
  24. node/data_rate_checker_plugin/data_rate_checker_form.ui
  25. )
  26. # Here we specify which header files need to be run through "moc",
  27. # Qt's meta-object compiler.
  28. qt4_wrap_cpp(MOC_FILES
  29. node/traffic_light_plugin/traffic_light_plugin.h
  30. node/image_viewer_plugin/image_viewer_plugin.h
  31. node/data_rate_checker_plugin/data_rate_checker_plugin.h
  32. )
  33. else()
  34. find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets Quick)
  35. set(QT_LIBRARIES Qt5::Widgets)
  36. # Qt's user-interface compiler.
  37. qt5_wrap_ui(UI_HEADERS
  38. node/traffic_light_plugin/form.ui
  39. node/image_viewer_plugin/image_viewer_form.ui
  40. node/data_rate_checker_plugin/data_rate_checker_form.ui
  41. )
  42. # Here we specify which header files need to be run through "moc",
  43. # Qt's meta-object compiler.
  44. qt5_wrap_cpp(MOC_FILES
  45. node/traffic_light_plugin/traffic_light_plugin.h
  46. node/image_viewer_plugin/image_viewer_plugin.h
  47. node/data_rate_checker_plugin/data_rate_checker_plugin.h
  48. )
  49. endif()
  50. include_directories(
  51. ${CMAKE_CURRENT_BINARY_DIR}
  52. ${CMAKE_CURRENT_SOURCE_DIR}
  53. ${catkin_INCLUDE_DIRS}
  54. include
  55. lib/
  56. )
  57. link_directories(${catkin_LIBRARY_DIRS})
  58. # I prefer the Qt signals and slots to avoid defining "emit", "slots",
  59. # etc because they can conflict with boost signals, so define QT_NO_KEYWORDS here.
  60. add_definitions(-DQT_NO_KEYWORDS)
  61. # Here we specify the list of source files, including the output of
  62. # the previous command which is stored in ``${MOC_FILES}`` and ``${UI_HEADERS}``.
  63. set(SOURCE_FILES
  64. lib/convert_image.h
  65. node/traffic_light_plugin/traffic_light_plugin.cpp
  66. node/image_viewer_plugin/image_viewer_plugin.cpp
  67. node/image_viewer_plugin/draw_rects.cpp
  68. node/image_viewer_plugin/draw_points.cpp
  69. node/image_viewer_plugin/draw_lane.cpp
  70. node/data_rate_checker_plugin/data_rate_checker_plugin.cpp
  71. ${MOC_FILES}
  72. ${UI_HEADERS}
  73. )
  74. # An rviz plugin is just a shared library, so here we declare the
  75. # library to be called ``${PROJECT_NAME}`` (which is
  76. # "rviz_plugin_tutorials", or whatever your version of this project
  77. # is called) and specify the list of source files we collected above
  78. # in ``${SOURCE_FILES}``.
  79. #
  80. add_library(${PROJECT_NAME}
  81. ${SOURCE_FILES}
  82. )
  83. set_target_properties(${PROJECT_NAME}
  84. PROPERTIES
  85. COMPILE_FLAGS
  86. "-DIMAGE_VIEWER_DEFAULT_PATH=${CMAKE_CURRENT_SOURCE_DIR}/node/image_viewer_plugin/"
  87. )
  88. ## Specify libraries to link a library or executable target against
  89. target_link_libraries(${PROJECT_NAME}
  90. ${QT_LIBRARIES}
  91. ${catkin_LIBRARIES}
  92. )
  93. add_dependencies(${PROJECT_NAME}
  94. ${catkin_EXPORTED_TARGETS}
  95. )
  96. install(TARGETS ${PROJECT_NAME}
  97. ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  98. LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  99. )
  100. install(FILES rviz_plugin_description.xml
  101. DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
  102. )
  103. install(
  104. FILES
  105. node/image_viewer_plugin/autoware_logo.png
  106. node/image_viewer_plugin/car.png
  107. node/image_viewer_plugin/pedestrian.png
  108. DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/node/image_viewer_plugin/
  109. )