px4-firmware/platforms/posix/CMakeLists.txt

168 lines
3.5 KiB
CMake
Raw Normal View History

add_subdirectory(src)
2015-09-08 21:50:18 -03:00
include_directories(${CMAKE_CURRENT_BINARY_DIR})
get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
px4_posix_generate_builtin_commands(
OUT apps
2015-09-10 00:00:58 -03:00
MODULE_LIST ${module_libraries})
if (("${BOARD}" STREQUAL "eagle") OR ("${BOARD}" STREQUAL "excelsior"))
include(fastrpc)
include(linux_app)
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
2015-09-08 21:50:18 -03:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
LINUX_APP(
APP_NAME px4
IDL_NAME px4muorb
APPS_DEST "/home/linaro"
SOURCES
px4muorb_stub.c
src/main.cpp
apps.cpp
LINK_LIBS
-Wl,--start-group
${module_libraries}
${df_driver_libs}
${FASTRPC_ARM_LIBS}
pthread m rt
-Wl,--end-group
)
2016-04-29 01:09:23 -03:00
add_custom_target(upload
COMMAND ${PX4_SOURCE_DIR}/Tools/adb_upload.sh $<TARGET_FILE:px4> ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config /home/linaro
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)
else()
px4_add_executable(px4
src/main.cpp
apps.cpp
)
target_link_libraries(px4
PRIVATE
${module_libraries}
df_driver_framework
${df_driver_libs}
pthread m
)
if (NOT APPLE)
target_link_libraries(px4 PRIVATE rt)
endif()
target_link_libraries(px4 PRIVATE modules__uORB)
endif()
if ("${BOARD}" STREQUAL "rpi")
add_custom_target(upload
COMMAND scp -r $<TARGET_FILE:px4> ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_SOURCE_DIR}/ROMFS pi@navio:/home/pi
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)
elseif ("${BOARD}" STREQUAL "bebop")
add_custom_target(upload
COMMAND ${CMAKE_STRIP} -R .comment -R .gnu.version -o $<TARGET_FILE:px4>.stripped $<TARGET_FILE:px4>
COMMAND ${PX4_SOURCE_DIR}/Tools/adb_upload_to_bebop.sh $<TARGET_FILE:px4>.stripped /usr/bin
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)
Target specific optimization control. This allows one to set a semi-colon separated list of regular expressions in the environment variable PX4_NO_OPTIMIZATION to control which (cmake generated) targets should be compiled without optimization. Suppressing optimization can be necessary for debugging in a debugger, especially when trying to step through the code or needing to print variables that otherwise are optimized out. EXAMPLE export PX4_NO_OPTIMIZATION="px4;^modules__uORB;^modules__systemlib$" will result in the following messages during cmake configuration: [...] -- Disabling optimization for target 'platforms__posix__px4_layer' because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'modules__systemlib' because it matches the regexp '^modules__systemlib$' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'modules__uORB' because it matches the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'examples__px4_simple_app' because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'modules__uORB__uORB_tests' because it matches the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'px4' because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION Note that a list of all (currently used) target names can be printed with the following command line from within the required build directory: find . -wholename '*/CMakeFiles/*.dir/flags.make' | xargs dirname | xargs basename -a | sort -u | sed -e 's/.dir$//'
2016-09-01 20:12:05 -03:00
elseif ("${BOARD}" STREQUAL "sitl")
2018-01-04 23:12:03 -04:00
include(sitl_target)
2017-11-21 21:22:48 -04:00
if(BUILD_TESTING)
2018-01-04 23:12:03 -04:00
include(sitl_tests)
2017-11-21 21:22:48 -04:00
endif()
endif()
#=============================================================================
# install
#
# px4 app
install(
TARGETS
px4
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
# px4 dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/integrationtests
${PROJECT_SOURCE_DIR}/launch
${PROJECT_SOURCE_DIR}/posix-configs
${PROJECT_SOURCE_DIR}/ROMFS
${PROJECT_SOURCE_DIR}/test
DESTINATION
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
)
# px4 files
install(
FILES
${PROJECT_SOURCE_DIR}/CMakeLists.txt
${PROJECT_SOURCE_DIR}/package.xml
DESTINATION
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
)
# px4 Tools dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/Tools/ecl_ekf
DESTINATION
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/Tools
)
# px4 Tools files
install(
FILES
${PROJECT_SOURCE_DIR}/Tools/setup_gazebo.bash
${PROJECT_SOURCE_DIR}/Tools/upload_log.py
DESTINATION
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/Tools
)
# sitl_gazebo built plugins
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/build/posix_sitl_default/build_gazebo
DESTINATION
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/build/posix_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
${CMAKE_INSTALL_DATADIR}/${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
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/Tools/sitl_gazebo
)