-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
98 lines (87 loc) · 2.4 KB
/
CMakeLists.txt
File metadata and controls
98 lines (87 loc) · 2.4 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
cmake_minimum_required(VERSION 3.16)
project(waveshare_servos)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# Set the same behavior for Windows as it is on Linux
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Find dependencies
set(THIS_PACKAGE_INCLUDE_DEPENDS
hardware_interface
pluginlib
rclcpp
rclcpp_lifecycle
)
find_package(ament_cmake REQUIRED)
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
find_package(${Dependency} REQUIRED)
endforeach()
# Compile
add_library(
waveshare_servos
SHARED
src/waveshare_servos.cpp
src/SCSCL.cpp
src/SCS.cpp
src/SCSerial.cpp
src/SMSBL.cpp
src/SMSCL.cpp
src/SMS_STS.cpp
)
target_compile_features(waveshare_servos PUBLIC cxx_std_17)
target_include_directories(waveshare_servos PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/waveshare_servos>
)
ament_target_dependencies(
waveshare_servos PUBLIC
${THIS_PACKAGE_INCLUDE_DEPENDS}
)
# Add the SetId node
add_executable(set_id src/set_id.cpp)
target_include_directories(set_id PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(set_id waveshare_servos)
ament_target_dependencies(set_id rclcpp)
# Add the CalibMid node
add_executable(calibrate_midpoint src/calibrate_midpoint.cpp)
target_include_directories(calibrate_midpoint PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(calibrate_midpoint waveshare_servos)
ament_target_dependencies(calibrate_midpoint rclcpp)
# Export hardware plugins
pluginlib_export_plugin_description_file(hardware_interface waveshare_servos.xml)
# Install
install(
DIRECTORY include/
DESTINATION include/waveshare_servos
)
install(
DIRECTORY
description/ros2_control
description/urdf
DESTINATION share/${PROJECT_NAME}/description
FILES_MATCHING PATTERN "*.xacro"
)
install(
DIRECTORY bringup/launch bringup/config
DESTINATION share/waveshare_servos
)
install(TARGETS waveshare_servos
EXPORT export_waveshare_servos
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
TARGETS set_id calibrate_midpoint
DESTINATION lib/${PROJECT_NAME}
)
# Exports
ament_export_targets(export_waveshare_servos HAS_LIBRARY_TARGET)
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
ament_package()