-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
194 lines (175 loc) · 3.91 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
cmake_minimum_required(VERSION 3.5)
project(etherbotix)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(PythonLibs REQUIRED)
find_package(Boost REQUIRED python system thread)
find_package(ament_cmake REQUIRED)
find_package(angles REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(nmea_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(robot_controllers_interface REQUIRED)
find_package(sensor_msgs REQUIRED)
ament_python_install_package(${PROJECT_NAME})
include_directories(
include
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_PATH}
)
add_library(etherbotix SHARED
src/dynamixel_servo.cpp
src/etherbotix.cpp
src/etherbotix_motor.cpp
src/etherbotix_ros.cpp
)
target_link_libraries(etherbotix ${Boost_LIBRARIES})
ament_target_dependencies(etherbotix
diagnostic_msgs
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
rclcpp_components_register_node(etherbotix
PLUGIN "etherbotix::EtherbotixROS"
EXECUTABLE etherbotix_driver
)
add_library(etherbotix_py SHARED
src/etherbotix.cpp
src/etherbotix_motor.cpp
src/python.cpp
)
set_target_properties(etherbotix_py PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
PREFIX "")
target_link_libraries(etherbotix_py
${Boost_LIBRARIES}
${PYTHON_LIBRARIES}
)
ament_target_dependencies(etherbotix_py
rclcpp
robot_controllers_interface
)
add_library(gps_publisher SHARED
src/gps_publisher.cpp
)
target_link_libraries(gps_publisher
etherbotix
${Boost_LIBRARIES}
)
ament_target_dependencies(gps_publisher
nmea_msgs
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
rclcpp_components_register_node(gps_publisher
PLUGIN "etherbotix::GpsPublisher"
EXECUTABLE gps_publisher_node
)
add_library(ld06_publisher SHARED
src/ld06_publisher.cpp
)
target_link_libraries(ld06_publisher
etherbotix
${Boost_LIBRARIES}
)
ament_target_dependencies(ld06_publisher
angles
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
rclcpp_components_register_node(ld06_publisher
PLUGIN "etherbotix::LD06Publisher"
EXECUTABLE ld06_publisher_node
)
add_executable(read_etherbotix src/read_etherbotix.cpp)
target_link_libraries(read_etherbotix
etherbotix
${Boost_LIBRARIES}
)
ament_target_dependencies(read_etherbotix
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
add_executable(read_unique_id src/read_unique_id.cpp)
target_link_libraries(read_unique_id
etherbotix
${Boost_LIBRARIES}
)
ament_target_dependencies(read_unique_id
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
add_executable(reboot src/reboot.cpp)
target_link_libraries(reboot
etherbotix
${Boost_LIBRARIES}
)
ament_target_dependencies(reboot
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS
etherbotix
gps_publisher
ld06_publisher
read_etherbotix
read_unique_id
reboot
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
install(
TARGETS etherbotix_py
DESTINATION "${PYTHON_INSTALL_DIR}/${PROJECT_NAME}"
)
install(
PROGRAMS
scripts/get_trace
scripts/monitor
scripts/read_servo
scripts/upload
DESTINATION lib/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_cmake_cpplint)
ament_cpplint(FILTERS "-whitespace/braces" "-whitespace/newline")
endif()
ament_export_include_directories(include)
ament_export_libraries(etherbotix)
ament_export_dependencies(
diagnostic_msgs
rclcpp
rclcpp_components
robot_controllers_interface
sensor_msgs
)
ament_package()