2017-06-01 09:47:33 -03:00
|
|
|
include (common/px4_upload)
|
|
|
|
|
2015-09-08 21:50:18 -03:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2017-08-29 18:22:05 -03:00
|
|
|
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
|
|
|
|
2015-09-08 19:39:13 -03:00
|
|
|
px4_posix_generate_builtin_commands(
|
2016-10-21 10:54:48 -03:00
|
|
|
OUT apps
|
2015-09-10 00:00:58 -03:00
|
|
|
MODULE_LIST ${module_libraries})
|
2015-09-08 19:39:13 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
# Define build target
|
|
|
|
set(APP_NAME px4)
|
|
|
|
set(MAIN_SRC ${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp)
|
|
|
|
set(UPLOAD_NAME upload)
|
2016-04-15 18:42:47 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior"))
|
|
|
|
include(fastrpc)
|
|
|
|
include(linux_app)
|
2016-04-15 18:42:47 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
|
2015-09-08 21:50:18 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
|
|
|
|
LINUX_APP(
|
|
|
|
APP_NAME ${APP_NAME}
|
|
|
|
IDL_NAME px4muorb
|
|
|
|
APPS_DEST "/home/linaro"
|
|
|
|
SOURCES
|
|
|
|
px4muorb_stub.c
|
2016-12-08 00:41:46 -04:00
|
|
|
${MAIN_SRC}
|
2016-10-21 10:54:48 -03:00
|
|
|
apps.cpp
|
2016-12-13 07:20:39 -04:00
|
|
|
LINK_LIBS
|
2016-05-03 05:03:28 -03:00
|
|
|
-Wl,--start-group
|
|
|
|
${module_libraries}
|
|
|
|
${df_driver_libs}
|
2016-12-13 07:20:39 -04:00
|
|
|
${FASTRPC_ARM_LIBS}
|
2016-05-03 05:03:28 -03:00
|
|
|
pthread m rt
|
|
|
|
-Wl,--end-group
|
2016-12-13 07:20:39 -04:00
|
|
|
)
|
2016-04-29 01:09:23 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
px4_add_adb_push(OUT ${UPLOAD_NAME}
|
|
|
|
OS ${OS}
|
|
|
|
BOARD ${BOARD}
|
2017-10-05 16:03:32 -03:00
|
|
|
FILES $<TARGET_FILE:${APP_NAME}>
|
2016-12-13 07:20:39 -04:00
|
|
|
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config
|
|
|
|
DEPENDS ${APP_NAME}
|
|
|
|
DEST /home/linaro)
|
2016-04-01 06:36:27 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
elseif ("${BOARD}" STREQUAL "rpi")
|
2016-05-31 08:04:22 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
px4_add_executable(${APP_NAME}
|
|
|
|
${MAIN_SRC}
|
|
|
|
apps.cpp
|
|
|
|
)
|
2016-05-31 08:04:22 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
target_link_libraries(${APP_NAME}
|
|
|
|
-Wl,--start-group
|
|
|
|
${module_libraries}
|
|
|
|
df_driver_framework
|
|
|
|
${df_driver_libs}
|
|
|
|
pthread m rt
|
|
|
|
-Wl,--end-group
|
|
|
|
)
|
2016-05-31 08:04:22 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
file(GLOB RPI_CONFIG_FILES ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config)
|
|
|
|
px4_add_scp_push(OUT ${UPLOAD_NAME}
|
|
|
|
OS ${OS}
|
|
|
|
BOARD ${BOARD}
|
2017-10-05 16:03:32 -03:00
|
|
|
FILES $<TARGET_FILE:${APP_NAME}>
|
2016-12-13 07:20:39 -04:00
|
|
|
${RPI_CONFIG_FILES}
|
|
|
|
${PX4_SOURCE_DIR}/ROMFS
|
|
|
|
DEPENDS ${APP_NAME}
|
|
|
|
DEST /home/pi)
|
2016-07-29 06:15:10 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
elseif ("${BOARD}" STREQUAL "bebop")
|
2016-05-31 08:04:22 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
|
|
|
|
|
|
|
px4_add_executable(${APP_NAME}
|
|
|
|
${MAIN_SRC}
|
|
|
|
apps.cpp
|
|
|
|
)
|
2016-12-12 17:32:34 -04:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
if (NOT APPLE)
|
|
|
|
target_link_libraries(${APP_NAME}
|
|
|
|
-Wl,--start-group
|
|
|
|
${module_libraries}
|
|
|
|
${df_driver_libs}
|
|
|
|
pthread m rt
|
|
|
|
-Wl,--end-group
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${APP_NAME}
|
|
|
|
${module_libraries}
|
|
|
|
${df_driver_libs}
|
|
|
|
pthread m
|
|
|
|
)
|
2016-12-08 00:41:46 -04:00
|
|
|
endif()
|
2016-12-12 17:32:34 -04:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
px4_add_adb_push_to_bebop(OUT ${UPLOAD_NAME}
|
|
|
|
OS ${OS}
|
|
|
|
BOARD ${BOARD}
|
2017-06-07 15:27:38 -03:00
|
|
|
FILES $<TARGET_FILE:px4>.stripped
|
2017-10-05 16:03:32 -03:00
|
|
|
DEPENDS px4
|
2016-12-13 07:20:39 -04:00
|
|
|
DEST /usr/bin)
|
2016-09-01 20:12:05 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
elseif ("${BOARD}" STREQUAL "sitl")
|
|
|
|
|
|
|
|
include(./sitl_target.cmake)
|
2017-01-04 23:19:08 -04:00
|
|
|
include(./sitl_tests.cmake)
|
2016-12-13 07:20:39 -04:00
|
|
|
|
|
|
|
else()
|
2016-08-25 16:47:45 -03:00
|
|
|
|
2016-12-13 07:20:39 -04:00
|
|
|
px4_add_executable(${APP_NAME}
|
|
|
|
${MAIN_SRC}
|
|
|
|
apps.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
if (NOT APPLE)
|
|
|
|
target_link_libraries(${APP_NAME}
|
|
|
|
-Wl,--start-group
|
|
|
|
${module_libraries}
|
|
|
|
${df_driver_libs}
|
|
|
|
pthread m rt
|
|
|
|
-Wl,--end-group
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${APP_NAME}
|
|
|
|
${module_libraries}
|
|
|
|
${df_driver_libs}
|
|
|
|
pthread m
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
2016-09-02 19:45:15 -03:00
|
|
|
|
2016-07-24 14:07:14 -03:00
|
|
|
#=============================================================================
|
|
|
|
# install
|
|
|
|
#
|
|
|
|
|
2016-08-25 16:47:45 -03:00
|
|
|
install(TARGETS px4 DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2016-07-24 14:07:14 -03:00
|
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/ROMFS DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
|
|
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/posix-configs DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
|
|
|
|
|
2017-08-29 18:22:05 -03:00
|
|
|
add_custom_command(OUTPUT ${APP_NAME}.stripped
|
2017-06-07 15:27:38 -03:00
|
|
|
COMMAND ${STRIP_TOOL} -R .comment -R .gnu.version -o $<TARGET_FILE:px4>.stripped $<TARGET_FILE:px4>
|
2017-08-29 18:22:05 -03:00
|
|
|
DEPENDS px4
|
|
|
|
)
|
2017-10-05 16:03:32 -03:00
|
|
|
add_custom_target(strip DEPENDS "${APP_NAME}.stripped")
|