This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
142 lines (116 loc) · 3.04 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
cmake_minimum_required(VERSION 3.5)
set(PROJECT_NAME crazyflie_platform)
project(${PROJECT_NAME})
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
#########################
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclpy REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(as2_core REQUIRED)
find_package(as2_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(Eigen3 REQUIRED)
#download the crazyflie_cpp from github
set(USE_CRAZYFLIE_COMPLETE_LIB OFF)
find_package(crazyflie_cpp QUIET)
if (${crazyflie_cpp_FOUND})
MESSAGE(STATUS "crazyflie_cpp found at ${crazyflie_cpp_DIR}")
find_package(crazyflie_cpp REQUIRED)
set(USE_CRAZYFLIE_COMPLETE_LIB ON)
else (${crazyflie_cpp_FOUND})
MESSAGE(STATUS "crazyflie_cpp not found")
include(FetchContent)
FetchContent_Declare(
crazyflie_cpp
GIT_REPOSITORY https://github.com/miferco97/crazyflie_cpp.git
# GIT_TAG 8b8391bc8e1899b4704723d22b5e4fa43ddef763
GIT_TAG master
)
FetchContent_MakeAvailable(crazyflie_cpp)
endif(${crazyflie_cpp_FOUND})
set(HEADER_HPP_FILES
include/crazyflie_platform.hpp
)
include_directories(
include/${PROJECT_NAME}
${EIGEN3_INCLUDE_DIRS}
)
add_executable(${PROJECT_NAME}_node src/crazyflie_node.cpp src/crazyflie_platform.cpp)
ament_target_dependencies(${PROJECT_NAME}_node
rclcpp
sensor_msgs
std_msgs
std_srvs
nav_msgs
as2_core
as2_msgs
geometry_msgs
Eigen3
)
if (${USE_CRAZYFLIE_COMPLETE_LIB})
# message("Yes!! COMPLETE")
target_link_libraries(${PROJECT_NAME}_node
crazyflie_cpp::crazyflie_cpp
)
else (${USE_CRAZYFLIE_COMPLETE_LIB})
target_link_libraries(${PROJECT_NAME}_node
crazyflie_cpp
)
endif()
add_executable(${PROJECT_NAME}_swarm_node src/crazyflie_swarm_nodes.cpp src/crazyflie_platform.cpp)
ament_target_dependencies(${PROJECT_NAME}_swarm_node
rclcpp
sensor_msgs
std_msgs
std_srvs
nav_msgs
as2_core
as2_msgs
geometry_msgs
Eigen3
)
if (${USE_CRAZYFLIE_COMPLETE_LIB})
# message("Yes!! COMPLETE")
target_link_libraries(${PROJECT_NAME}_swarm_node
crazyflie_cpp::crazyflie_cpp
)
else (${USE_CRAZYFLIE_COMPLETE_LIB})
target_link_libraries(${PROJECT_NAME}_swarm_node
crazyflie_cpp
)
endif()
if(BUILD_TESTING)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_clang_format REQUIRED)
ament_cppcheck(src/ include/ tests/)
ament_clang_format(src/ include/ tests/ --config ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format)
endif()
install(
DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY
config
DESTINATION share/${PROJECT_NAME}
)
install(TARGETS
${PROJECT_NAME}_node
${PROJECT_NAME}_swarm_node
DESTINATION lib/${PROJECT_NAME})
# Install Python modules
ament_python_install_package(${PROJECT_NAME})
# Install Python executables
install(PROGRAMS
scripts/aideck_node.py
DESTINATION lib/${PROJECT_NAME}
)
ament_package()