You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
3.2 KiB
151 lines
3.2 KiB
8 years ago
|
include (common/px4_upload)
|
||
|
|
||
10 years ago
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||
|
|
||
8 years ago
|
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
||
|
|
||
10 years ago
|
px4_posix_generate_builtin_commands(
|
||
8 years ago
|
OUT apps
|
||
10 years ago
|
MODULE_LIST ${module_libraries})
|
||
10 years ago
|
|
||
8 years ago
|
# Define build target
|
||
|
set(APP_NAME px4)
|
||
|
set(MAIN_SRC ${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp)
|
||
|
set(UPLOAD_NAME upload)
|
||
9 years ago
|
|
||
8 years ago
|
if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior"))
|
||
|
include(fastrpc)
|
||
|
include(linux_app)
|
||
9 years ago
|
|
||
8 years ago
|
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
|
||
10 years ago
|
|
||
8 years ago
|
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
|
||
8 years ago
|
${MAIN_SRC}
|
||
8 years ago
|
apps.cpp
|
||
8 years ago
|
LINK_LIBS
|
||
9 years ago
|
-Wl,--start-group
|
||
|
${module_libraries}
|
||
|
${df_driver_libs}
|
||
8 years ago
|
${FASTRPC_ARM_LIBS}
|
||
9 years ago
|
pthread m rt
|
||
|
-Wl,--end-group
|
||
8 years ago
|
)
|
||
9 years ago
|
|
||
8 years ago
|
px4_add_adb_push(OUT ${UPLOAD_NAME}
|
||
|
OS ${OS}
|
||
|
BOARD ${BOARD}
|
||
7 years ago
|
FILES $<TARGET_FILE:${APP_NAME}>
|
||
8 years ago
|
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config
|
||
|
DEPENDS ${APP_NAME}
|
||
|
DEST /home/linaro)
|
||
9 years ago
|
|
||
8 years ago
|
elseif ("${BOARD}" STREQUAL "rpi")
|
||
9 years ago
|
|
||
8 years ago
|
px4_add_executable(${APP_NAME}
|
||
|
${MAIN_SRC}
|
||
|
apps.cpp
|
||
|
)
|
||
9 years ago
|
|
||
8 years ago
|
target_link_libraries(${APP_NAME}
|
||
|
-Wl,--start-group
|
||
|
${module_libraries}
|
||
|
df_driver_framework
|
||
|
${df_driver_libs}
|
||
|
pthread m rt
|
||
|
-Wl,--end-group
|
||
|
)
|
||
9 years ago
|
|
||
8 years ago
|
file(GLOB RPI_CONFIG_FILES ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config)
|
||
|
px4_add_scp_push(OUT ${UPLOAD_NAME}
|
||
|
OS ${OS}
|
||
|
BOARD ${BOARD}
|
||
7 years ago
|
FILES $<TARGET_FILE:${APP_NAME}>
|
||
8 years ago
|
${RPI_CONFIG_FILES}
|
||
|
${PX4_SOURCE_DIR}/ROMFS
|
||
|
DEPENDS ${APP_NAME}
|
||
|
DEST /home/pi)
|
||
9 years ago
|
|
||
8 years ago
|
elseif ("${BOARD}" STREQUAL "bebop")
|
||
9 years ago
|
|
||
8 years ago
|
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
|
||
|
)
|
||
8 years ago
|
|
||
8 years ago
|
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
|
||
|
)
|
||
8 years ago
|
endif()
|
||
8 years ago
|
|
||
8 years ago
|
px4_add_adb_push_to_bebop(OUT ${UPLOAD_NAME}
|
||
|
OS ${OS}
|
||
|
BOARD ${BOARD}
|
||
8 years ago
|
FILES $<TARGET_FILE:px4>.stripped
|
||
7 years ago
|
DEPENDS px4
|
||
8 years ago
|
DEST /usr/bin)
|
||
9 years ago
|
|
||
8 years ago
|
elseif ("${BOARD}" STREQUAL "sitl")
|
||
|
|
||
7 years ago
|
include(sitl_target)
|
||
7 years ago
|
if(BUILD_TESTING)
|
||
7 years ago
|
include(sitl_tests)
|
||
7 years ago
|
endif()
|
||
8 years ago
|
|
||
|
else()
|
||
9 years ago
|
|
||
8 years ago
|
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()
|
||
9 years ago
|
|
||
9 years ago
|
#=============================================================================
|
||
|
# install
|
||
|
#
|
||
|
|
||
9 years ago
|
install(TARGETS px4 DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||
9 years ago
|
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})
|
||
|
|
||
8 years ago
|
add_custom_command(OUTPUT ${APP_NAME}.stripped
|
||
8 years ago
|
COMMAND ${STRIP_TOOL} -R .comment -R .gnu.version -o $<TARGET_FILE:px4>.stripped $<TARGET_FILE:px4>
|
||
8 years ago
|
DEPENDS px4
|
||
|
)
|
||
7 years ago
|
add_custom_target(strip DEPENDS "${APP_NAME}.stripped")
|