CMakeLists.txt
4.55 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
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
208
209
210
211
212
213
214
include_directories(${CMAKE_CURRENT_BINARY_DIR})
get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
# When building with catkin, do not change CMAKE_RUNTIME_OUTPUT_DIR from
# CMAKE_CURRENT_BINARY_DIR ''./platforms/posix' to './bin'
if (NOT CATKIN_DEVEL_PREFIX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
endif()
set(PX4_SHELL_COMMAND_PREFIX "px4-")
add_definitions("-DPX4_SHELL_COMMAND_PREFIX=\"${PX4_SHELL_COMMAND_PREFIX}\"")
px4_posix_generate_builtin_commands(
OUT apps
MODULE_LIST ${module_libraries})
px4_posix_generate_alias(
OUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/px4-alias.sh
MODULE_LIST ${module_libraries}
PREFIX ${PX4_SHELL_COMMAND_PREFIX}
)
if (("${PX4_BOARD}" MATCHES "atlflight_eagle") OR ("${PX4_BOARD}" MATCHES "atlflight_excelsior"))
include(fastrpc)
include(linux_app)
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
LINUX_APP(
APP_NAME px4
IDL_NAME px4muorb
APPS_DEST "/home/linaro"
SOURCES
px4muorb_stub.c
src/px4/common/main.cpp
apps.cpp
LINK_LIBS
-Wl,--start-group
px4_layer
parameters
${module_libraries}
${FASTRPC_ARM_LIBS}
pthread m rt
-Wl,--end-group
)
else()
add_executable(px4
src/px4/common/main.cpp
apps.cpp
)
target_link_libraries(px4
PRIVATE
${module_libraries}
pthread m
# horrible circular dependencies that need to be teased apart
px4_layer px4_platform
work_queue
parameters
)
if(NOT APPLE)
target_link_libraries(px4 PRIVATE rt)
endif()
target_link_libraries(px4 PRIVATE uORB)
#=============================================================================
# install
#
# TODO: extend to snapdragon
# px4 dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/posix-configs
${PROJECT_SOURCE_DIR}/test
${CMAKE_BINARY_DIR}/etc
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
DESTINATION
${PROJECT_NAME}
USE_SOURCE_PERMISSIONS
)
endif()
# Module Symlinks
px4_posix_generate_symlinks(
MODULE_LIST ${module_libraries}
PREFIX ${PX4_SHELL_COMMAND_PREFIX}
TARGET px4
)
if (config_romfs_root)
add_subdirectory(${PX4_SOURCE_DIR}/ROMFS ${PX4_BINARY_DIR}/ROMFS)
add_dependencies(px4 romfs_gen_files_target)
endif()
# board defined upload helper
if(EXISTS "${PX4_BOARD_DIR}/cmake/upload.cmake")
include(${PX4_BOARD_DIR}/cmake/upload.cmake)
endif()
if("${PX4_BOARD}" MATCHES "beaglebone_blue")
target_link_libraries(px4 PRIVATE robotics_cape)
elseif("${PX4_BOARD}" MATCHES "emlid_navio2")
target_link_libraries(px4 PRIVATE atomic)
# vscode launch.json
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_rpi.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY)
elseif("${PX4_BOARD}" MATCHES "sitl")
# vscode launch.json
if(${PX4_BOARD_LABEL} MATCHES "replay")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_replay.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_sim.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY)
endif()
include(sitl_target)
if(BUILD_TESTING)
include(sitl_tests)
endif()
# install
# px4 dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/integrationtests
${PROJECT_SOURCE_DIR}/launch
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
DESTINATION
${PROJECT_NAME}
USE_SOURCE_PERMISSIONS
)
# px4 files
install(
FILES
${PROJECT_SOURCE_DIR}/CMakeLists.txt
${PROJECT_SOURCE_DIR}/package.xml
DESTINATION
${PROJECT_NAME}
)
# px4 Tools dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/Tools/ecl_ekf
DESTINATION
${PROJECT_NAME}/Tools
USE_SOURCE_PERMISSIONS
)
# px4 Tools files
install(
PROGRAMS
${PROJECT_SOURCE_DIR}/Tools/setup_gazebo.bash
${PROJECT_SOURCE_DIR}/Tools/upload_log.py
DESTINATION
${PROJECT_NAME}/Tools
)
# ROMFS files
install(
DIRECTORY
${PX4_BINARY_DIR}/etc
DESTINATION
${PROJECT_NAME}/build/px4_sitl_default
)
# sitl_gazebo built plugins
install(
DIRECTORY
${PX4_BINARY_DIR}/build_gazebo
DESTINATION
${PROJECT_NAME}/build/px4_sitl_default
FILES_MATCHING
PATTERN "CMakeFiles" EXCLUDE
PATTERN "*.so"
)
# sitl_gazebo dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/Tools/sitl_gazebo/models
${PROJECT_SOURCE_DIR}/Tools/sitl_gazebo/worlds
DESTINATION
${PROJECT_NAME}/Tools/sitl_gazebo
)
# sitl_gazebo files
install(
FILES
${PROJECT_SOURCE_DIR}/Tools/sitl_gazebo/CMakeLists.txt
${PROJECT_SOURCE_DIR}/Tools/sitl_gazebo/package.xml
DESTINATION
${PROJECT_NAME}/Tools/sitl_gazebo
)
endif()