Adding Nuttx Build infrastructure

This commit is contained in:
David Sidrane
2016-12-21 08:34:20 +01:00
committed by Lorenz Meier
parent cb9517486d
commit d6098c8226
7 changed files with 360 additions and 96 deletions
+42 -4
View File
@@ -101,9 +101,14 @@ include(CMakeParseArguments)
function(px4_parse_function_args)
cmake_parse_arguments(IN "" "NAME" "OPTIONS;ONE_VALUE;MULTI_VALUE;REQUIRED;ARGN" "${ARGN}")
cmake_parse_arguments(OUT "${IN_OPTIONS}" "${IN_ONE_VALUE}" "${IN_MULTI_VALUE}" "${IN_ARGN}")
if (OUT_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${IN_NAME}: unparsed ${OUT_UNPARSED_ARGUMENTS}")
endif()
foreach(arg ${IN_REQUIRED})
if (NOT OUT_${arg})
message(FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}")
if (NOT "${OUT_${arg}}" STREQUAL "0")
message(FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}")
endif()
endif()
endforeach()
foreach(arg ${IN_OPTIONS} ${IN_ONE_VALUE} ${IN_MULTI_VALUE})
@@ -143,6 +148,9 @@ function(px4_add_git_submodule)
)
add_custom_target(${TARGET}
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
# todo:Not have 2 list of submodues one (see the end of Tools/check_submodules.sh and Firmware/CMakeLists.txt)
# using the list of submodules from the CMake file to drive the test
# COMMAND Tools/check_submodules.sh ${PATH}
DEPENDS ${PX4_BINARY_DIR}/git_init_${NAME}.stamp
)
endfunction()
@@ -240,7 +248,7 @@ endfunction()
# STACK : deprecated use stack main instead
# STACK_MAIN : size of stack for main function
# STACK_MAX : maximum stack size of any frame
# COMPILE_FLAGS : compile flags
# COMPILE_FLAGS : compile flags
# LINK_FLAGS : link flags
# SRCS : source files
# INCLUDES : include directories
@@ -375,6 +383,8 @@ function(px4_generate_messages)
MULTI_VALUE MSG_FILES DEPENDS INCLUDES
REQUIRED MSG_FILES OS TARGET
ARGN ${ARGN})
if("${config_nuttx_config}" STREQUAL "bootloader")
else()
set(QUIET)
if(NOT VERBOSE)
set(QUIET "-q")
@@ -463,7 +473,7 @@ function(px4_generate_messages)
${msg_multi_files_out}
${msg_files_out}
)
endif()
endfunction()
#=============================================================================
@@ -1043,7 +1053,7 @@ function(px4_generate_airframes_xml)
set(process_airframes ${PX4_SOURCE_DIR}/Tools/px_process_airframes.py)
add_custom_command(OUTPUT ${OUT}
COMMAND ${PYTHON_EXECUTABLE} ${process_airframes}
-a ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d
-a ${PX4_SOURCE_DIR}/ROMFS/${config_romfs_root}/init.d
--board CONFIG_ARCH_BOARD_${BOARD} --xml
)
set(${OUT} ${${OUT}} PARENT_SCOPE)
@@ -1098,6 +1108,34 @@ function(px4_copy_tracked)
set(${OUT} ${_files_out} PARENT_SCOPE)
endfunction()
#=============================================================================
#
# px4_share_subdirectory
#
# This function simplifes sharing a sub directory
#
# Usage:
# px4_share_subdirectory(RELDIR <relative path> ARGS <args>)
#
# Input:
# RELDIR : The relitive path to share.
# ARGS : Any optional arguments to pass to add_subdirectory
#
# Output:
# : None
#
# Example:
# px4_share_subdirectory(RELDIR ../uavcan/libuavcan ARGS EXCLUDE_FROM_ALL)
#
function(px4_share_subdirectory)
px4_parse_function_args(
NAME px4_share_subdirectory
ONE_VALUE OUT RELDIR
MULTI_VALUE ARGS
REQUIRED RELDIR
ARGN ${ARGN})
add_subdirectory(${RELDIR} ${RELDIR}/${RELDIR} ${ARGS})
endfunction()
#=============================================================================
#
# px4_strip_optimization