-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
152 lines (125 loc) · 3.45 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
cmake_minimum_required(VERSION 3.5)
project(natnet_ros2)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(ament_cmake_auto REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclpy REQUIRED)
ament_auto_find_build_dependencies()
set(dependencies
rclcpp
rclcpp_lifecycle
tf2
tf2_ros
geometry_msgs
sensor_msgs
std_msgs
)
rosidl_generate_interfaces(${PROJECT_NAME}
"srv/MarkerPoses.srv"
DEPENDENCIES std_msgs
)
execute_process(
COMMAND chmod "+x" "${CMAKE_CURRENT_SOURCE_DIR}/install_sdk.sh"
COMMAND chmod "+x" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/helper_node_r2.py"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process(
COMMAND bash "-c" "${CMAKE_CURRENT_SOURCE_DIR}/install_sdk.sh"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set(NATNET_SDK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/NatNetSDK/)
set(NATNET_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/NatNetSDK/lib/libNatNet.so)
if(NOT EXISTS ${NATNET_SDK_DIR} OR NOT EXISTS ${NATNET_LIBRARY_DIR})
message(FATAL_ERROR "NatNet SDK not found. Please run the install_sdk.sh script.")
endif()
set(my_include_directories
include
${CMAKE_CURRENT_BINARY_DIR}/include
${NATNET_SDK_DIR}/include
)
include_directories(
include
${my_include_directories}
)
add_executable(natnet_ros2_node
src/natnet_ros2.cpp src/nn_filter.cpp
)
ament_target_dependencies(natnet_ros2_node ${dependencies} rosidl_default_runtime)
target_link_libraries(natnet_ros2_node
${NATNET_LIBRARY_DIR}
)
#ament_export_dependencies(rosidl_default_runtime)
add_executable(marker_poses_server src/marker_poses_server.cpp)
ament_target_dependencies(marker_poses_server ${dependencies})
rosidl_target_interfaces(
marker_poses_server
${PROJECT_NAME} "rosidl_typesupport_cpp")
target_link_libraries(marker_poses_server ${NATNET_LIBRARY_DIR})
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION include
)
install(DIRECTORY
launch
config
ui
DESTINATION share/${PROJECT_NAME}
)
install(TARGETS
natnet_ros2_node
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
install(TARGETS
natnet_ros2_node
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(TARGETS
marker_poses_server
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
install(TARGETS
marker_poses_server
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
ament_python_install_package(${PROJECT_NAME}_py)
install(PROGRAMS
scripts/helper_node_r2.py
DESTINATION lib/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)
find_package(ament_cmake_uncrustify REQUIRED)
file(GLOB_RECURSE EXCLUDE_FILES NatNetSDK/*)
ament_copyright(EXCLUDE ${EXCLUDE_FILES})
ament_cppcheck(
EXCLUDE ${EXCLUDE_FILES}
LANGUAGE c++
)
ament_cpplint(EXCLUDE ${EXCLUDE_FILES})
ament_lint_cmake()
ament_uncrustify(
EXCLUDE ${EXCLUDE_FILES}
LANGUAGE c++
)
find_package(ament_cmake_gtest REQUIRED)
endif()
ament_auto_package()
#ament_package()