-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
139 lines (103 loc) · 4.45 KB
/
Copy pathCMakeLists.txt
File metadata and controls
139 lines (103 loc) · 4.45 KB
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
cmake_minimum_required(VERSION 3.5)
project(subjugator_gazebo)
# Find required packages
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(mil_msgs REQUIRED)
find_package(OpenCV REQUIRED)
find_package(subjugator_description REQUIRED)
find_package(mil_msgs REQUIRED)
find_package(gz-cmake3 REQUIRED)
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
find_package(gz-common5 REQUIRED COMPONENTS profiler)
set(GZ_COMMON_VER ${gz-common5_VERSION_MAJOR})
if("$ENV{GZ_VERSION}" STREQUAL "harmonic")
find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})
message(STATUS "Compiling against Gazebo Harmonic")
else()
find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
message(STATUS "Compiling against Gazebo Garden")
endif()
# Include directories
include_directories(include ${OpenCV_INCLUDE_DIRS} ${rclcpp_INCLUDE_DIRS})
#
# Add Plugins Here
#
# Plugin 0: Example Plugin
add_library(ExamplePlugin SHARED src/ExamplePlugin.cc)
# Plugin 1: Underwater Camera
add_library(UnderwaterCamera SHARED src/UnderwaterCamera.cc)
# Plugin 2: DVL Bridge
add_library(DVLBridge SHARED src/DVLBridge.cc)
# Plugin 3: DepthSensor
add_library(DepthSensor SHARED src/DepthSensor.cc)
# Plugin 4: Hydrophone
add_library(Hydrophone SHARED src/Hydrophone.cc)
# Plugin 5: True Position Plugin
add_library(TruePosition SHARED src/TruePosition.cc)
# Ensures plugin can see include directory to access its header files
target_include_directories(ExamplePlugin PRIVATE include)
target_include_directories(UnderwaterCamera PRIVATE include)
target_include_directories(DVLBridge PRIVATE include)
target_include_directories(DepthSensor PRIVATE include)
target_include_directories(Hydrophone PRIVATE include)
target_include_directories(TruePosition PRIVATE include)
# Add additional needed libraries
target_link_libraries(
ExamplePlugin gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER} # Links gazebo
# simulator version to
# your plugin.
)
# Link Libraries for Underwater Camera plugin
target_link_libraries(UnderwaterCamera gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
${OpenCV_LIBS})
# Link libraries for DVL Bridge plugin
target_link_libraries(DVLBridge gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER})
# Link libraries for Hydrophone plugin
target_link_libraries(Hydrophone gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER})
# Link libraries for DepthSensor plugin
target_link_libraries(DepthSensor gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER})
# Link libraries for TruePosition plugin
target_link_libraries(TruePosition gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER})
# Specify dependencies using ament_target_dependencies
ament_target_dependencies(
ExamplePlugin
#
# Here is where you would place any dependencies for your plugin
#
)
ament_target_dependencies(UnderwaterCamera rclcpp sensor_msgs)
ament_target_dependencies(DVLBridge nav_msgs rclcpp geometry_msgs std_msgs)
ament_target_dependencies(DepthSensor rclcpp mil_msgs sensor_msgs)
ament_target_dependencies(Hydrophone rclcpp geometry_msgs mil_msgs)
ament_target_dependencies(TruePosition rclcpp mil_msgs)
# Install the plugins
install(TARGETS UnderwaterCamera ExamplePlugin DVLBridge Hydrophone DepthSensor
TruePosition LIBRARY DESTINATION lib/${PROJECT_NAME})
# Install headers
install(DIRECTORY include/ DESTINATION include)
# Following 'install' directive ensures that the 'worlds' subfolder will be
# copied to the 'share/subjugator_gazebo/worlds' subfolder of the installation
# directory.
install(DIRECTORY worlds/ DESTINATION share/${PROJECT_NAME}/worlds)
# Following directives are used when testing.
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
# Following hooks are used to ensure that the correct environment variables will
# be set by executing 'sourece install/setup.bash' after compilation.
ament_environment_hooks(
"${CMAKE_CURRENT_SOURCE_DIR}/hooks/${PROJECT_NAME}.dsv.in")
ament_environment_hooks(
"${CMAKE_CURRENT_SOURCE_DIR}/hooks/${PROJECT_NAME}.sh.in")
# Following directive configures ament based on the previous directives, and
# should typically be the last directive in the CMakeLists.txt file.
ament_package()