forked from ANYbotics/grid_map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
159 lines (138 loc) · 3.83 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
cmake_minimum_required(VERSION 3.5.1)
project(grid_map_rviz_plugin)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
add_compile_options(-Wall -Wextra -Wpedantic)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(catkin REQUIRED
COMPONENTS
rviz
grid_map_ros
grid_map_msgs
)
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}
CATKIN_DEPENDS
rviz
grid_map_ros
grid_map_msgs
)
include_directories(
include
SYSTEM
${catkin_INCLUDE_DIRS}
)
link_directories(${catkin_LIBRARY_DIRS})
## This setting causes Qt's "MOC" generation to happen automatically.
set(CMAKE_AUTOMOC ON)
set(INCLUDE_FILES_QT
include/grid_map_rviz_plugin/GridMapDisplay.hpp
include/grid_map_rviz_plugin/modified/message_filter_display.h
include/grid_map_rviz_plugin/modified/frame_manager.h
)
## This plugin includes Qt widgets, so we must include Qt.
## We'll use the version that rviz used so they are compatible.
if(rviz_QT_VERSION VERSION_LESS "5")
message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
## pull in all required include dirs, define QT_LIBRARIES, etc.
include(${QT_USE_FILE})
qt4_wrap_cpp(MOC_FILES
${INCLUDE_FILES_QT}
)
else()
message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
set(QT_LIBRARIES Qt5::Widgets)
QT5_WRAP_CPP(MOC_FILES
${INCLUDE_FILES_QT}
)
endif()
## Avoid Qt signals and slots defining "emit", "slots", etc.
add_definitions(-DQT_NO_KEYWORDS)
## The list of source files.
## The generated MOC files are included automatically as headers.
set(SOURCE_FILES
src/GridMapDisplay.cpp
src/GridMapVisual.cpp
)
## An rviz plugin is just a shared library, so here we declare the
## library to be called ${PROJECT_NAME} and specify the list of
## source files we collected above in ${SOURCE_FILES}.
add_library(${PROJECT_NAME}
${SOURCE_FILES}
${MOC_FILES}
)
## Link the executable with whatever Qt libraries have been defined by
## the find_package(Qt4 ...) line above, or by the
## set(QT_LIBRARIES Qt5::Widgets), and with whatever libraries
## catkin has included.
target_link_libraries(${PROJECT_NAME}
${QT_LIBRARIES}
${catkin_LIBRARIES}
)
## Install rules
install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(
FILES plugin_description.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(
DIRECTORY icons
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/icons
)
install(
DIRECTORY doc
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
#############
## Testing ##
#############
if (CATKIN_ENABLE_TESTING)
catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_rviz_plugin.cpp
test/empty_test.cpp
)
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
${catkin_LIBRARIES}
)
###################
## Code_coverage ##
###################
find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
${PROJECT_NAME}-test
)
endif()
endif()
#################
## Clang_tools ##
#################
find_package(cmake_clang_tools QUIET)
if(cmake_clang_tools_FOUND)
add_default_clang_tooling(
DISABLE_CLANG_FORMAT
)
endif(cmake_clang_tools_FOUND)