-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathCMakeLists.txt
216 lines (178 loc) · 6.25 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
cmake_minimum_required(VERSION 3.8)
project(rviz_plugin_zed_od)
## Generate symbols for IDE indexer
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
################################################
# Check the ROS2 version
set(ROS2_FOUND FALSE)
if(DEFINED ENV{ROS_DISTRO})
set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO})
set(ROS2_FOUND TRUE)
#message("* Found ROS2 ${FOUND_ROS2_DISTRO}")
else()
message("* ROS2 distro variable not set. Trying to figure it out...")
set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling")
set(ROS2_FOUND FALSE)
foreach(distro ${ROS2_DISTROS})
if(NOT ROS2_FOUND)
find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp)
if(RCLCPP_H)
message("* Found ROS2 ${distro}")
set(FOUND_ROS2_DISTRO ${distro})
set(ROS2_FOUND TRUE)
endif()
endif()
endforeach()
endif()
if(ROS2_FOUND)
if(${FOUND_ROS2_DISTRO} STREQUAL "foxy")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_FOXY)
elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_HUMBLE)
elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_IRON)
else()
message("*** WARNING *** ROS2 ${FOUND_ROS2_DISTRO} is not officially supported by the package '${PROJECT_NAME}'. Correct operation is not guaranteed.")
endif()
else()
message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.")
endif()
################################################
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
# Remove FindOpenGL warning
cmake_policy(SET CMP0072 NEW)
# Tests currently only run on OS X @ OSRF jenkins
# Enable on Linux by providing a display, enable on Windows via EnableDisplayTests=True
option(EnableDisplayTests "EnableDisplayTests")
set(DisplayTests "False" CACHE STRING "DisplayTestsVariable")
if(DEFINED ENV{DISPLAY})
set(DISPLAYPRESENT TRUE)
endif()
if(APPLE OR DISPLAYPRESENT OR EnableDisplayTests STREQUAL "True")
message(STATUS "Enabling tests requiring a display")
else()
set(SKIP_DISPLAY_TESTS "SKIP_TEST")
endif()
# options and directories for visual tests (see visual_testing_framework documentation)
option(EnableVisualTests "decides whether or not to enable the tests")
# Run visual tests only if "EnableVisualTests=True"
if(EnableVisualTests STREQUAL "True")
message(STATUS "Enabling visual tests")
else()
set(SKIP_VISUAL_TESTS "SKIP_TEST")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(rviz_common REQUIRED)
find_package(rviz_rendering REQUIRED)
find_package(rviz_ogre_vendor REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets Test)
find_package(zed_msgs REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
###############################################################################
#Add all files in subdirectories of the project in
# a dummy_target so qtcreator have access to all files
file(GLOB_RECURSE all_files ${CMAKE_SOURCE_DIR}/*)
add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files})
###############################################################################
# INCLUDES and LIBS
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/include
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/include
)
###############################################################################
# SOURCES
set(PLUGIN_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/src/zed_od_display.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/src/zed_od_info.cpp
)
set(PLUGIN_INC
${CMAKE_CURRENT_SOURCE_DIR}/src/include/visibility_control.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/include/zed_body_parts.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/include/zed_od_display.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/include/zed_od_info.hpp
)
###############################################################################
# BIN & INSTALLATION
add_library(rviz_plugin_zed_od SHARED
${PLUGIN_INC}
${PLUGIN_SRC}
)
target_include_directories(rviz_plugin_zed_od PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${rviz_rendering_INCLUDE_DIRS}
${rviz_common_INCLUDE_DIRS}
${zed_msgs_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${resource_retriever_INCLUDE_DIRS}
${TinyXML_INCLUDE_DIRS}
)
#target_link_libraries(rviz_plugin_zed_od
# resource_retriever::resource_retriever
# rviz_common::rviz_common
#)
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(rviz_plugin_zed_od PRIVATE "ZED_OD_PLUGIN_BUILDING_DLL")
# prevent pluginlib from using boost
target_compile_definitions(rviz_plugin_zed_od PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)
ament_target_dependencies(rviz_plugin_zed_od
PUBLIC
zed_msgs
rclcpp
rviz_common
)
ament_export_include_directories(include)
if($ENV{ROS_DISTRO} STREQUAL "eloquent")
ament_export_interfaces(rviz_plugin_zed_od HAS_LIBRARY_TARGET)
else()
ament_export_targets(rviz_plugin_zed_od HAS_LIBRARY_TARGET)
endif()
ament_export_dependencies(
Qt5
rviz_common
rclcpp
zed_msgs
rviz_rendering
)
install(
TARGETS rviz_plugin_zed_od
EXPORT rviz_plugin_zed_od
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/src/include/
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/include/
DESTINATION include/${PROJECT_NAME}/
)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/icons"
DESTINATION "share/${PROJECT_NAME}"
)
ament_package()