-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
208 lines (187 loc) · 5.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
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
# Copyright (C) 2023 Thies Lennart Alff
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA
cmake_minimum_required(VERSION 3.5)
project(gantry)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CXX_FLAGS -Wall -Wextra -Wpedantic -Wshadow -std=c++17 -O2 -fPIC)
add_compile_options(${CXX_FLAGS})
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(ament_index_cpp)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(std_srvs REQUIRED)
find_package(gantry_msgs REQUIRED)
find_package(hippo_common REQUIRED)
find_package(path_planning REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(Eigen3 REQUIRED)
################################################################################
# gantry_motor library
################################################################################
set(lib_name gantry_motor)
add_library(${lib_name}
STATIC
src/motor/motor_interface.cpp
src/motor/mcbl2805.cpp
src/motor/mcbl3006.cpp
)
target_include_directories(${lib_name}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/esc_serial/include>
$<INSTALL_INTERFACE:include>
)
ament_target_dependencies(${lib_name}
rclcpp
)
ament_export_libraries(${lib_name}_export HAS_LIBRARY_TARGET)
install(TARGETS ${lib_name}
EXPORT ${lib_name}_export
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
)
################################################################################
# motor component
################################################################################
add_library(motor_component SHARED
src/motor_component/motor_component.cpp
src/motor_component/motor_component_params.cpp
)
target_link_libraries(motor_component gantry_motor)
target_include_directories(motor_component
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
ament_target_dependencies(motor_component
rclcpp
rclcpp_components
hippo_common
gantry_msgs
std_srvs
)
rclcpp_components_register_node(
motor_component
PLUGIN "gantry::MotorNode"
EXECUTABLE motor_node
)
install(
TARGETS motor_component
EXPORT export_motor_component
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
################################################################################
# path_follower component
################################################################################
add_library(path_follower_component SHARED
src/path_follower_component/path_follower_component.cpp
src/path_follower_component/path_follower_component_params.cpp
)
ament_target_dependencies(path_follower_component
rclcpp
rclcpp_components
ament_index_cpp
hippo_common
gantry_msgs
path_planning
std_srvs
Eigen3
visualization_msgs
)
rclcpp_components_register_nodes(path_follower_component PLUGIN "gantry::PathFollowerNode")
install(
TARGETS path_follower_component
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
################################################################################
# single_motor node
################################################################################
set(exec_name single_motor)
add_executable(${exec_name}
src/single_motor.cpp
)
target_link_libraries(${exec_name} motor_component)
ament_target_dependencies(${exec_name}
rclcpp
)
install(TARGETS ${exec_name}
DESTINATION lib/${PROJECT_NAME}
)
include_directories(
include
)
################################################################################
# xyz_motors container node
################################################################################
set(exec_name xyz_motors)
add_executable(${exec_name}
src/xyz_motors.cpp
)
target_link_libraries(${exec_name} motor_component)
ament_target_dependencies(${exec_name}
rclcpp
ament_index_cpp
)
install(TARGETS ${exec_name}
DESTINATION lib/${PROJECT_NAME}
)
include_directories(
include
)
################################################################################
# path_follower node
################################################################################
set(exec_name path_follower)
add_executable(${exec_name}
src/path_follower.cpp
)
target_link_libraries(${exec_name} path_follower_component)
ament_target_dependencies(${exec_name}
rclcpp
)
install(TARGETS ${exec_name}
DESTINATION lib/${PROJECT_NAME}
)
################################################################################
# install Python Stuff
################################################################################
# Install Python modules
# ament_python_install_package(${PROJECT_NAME})
# Install Python executables
install(PROGRAMS
nodes/grid_position_control.py
DESTINATION lib/${PROJECT_NAME}
)
################################################################################
# install shared resources
################################################################################
install(
DIRECTORY launch config
DESTINATION share/${PROJECT_NAME}
)
ament_package()