NuttX improve apps builtins dependencies

This commit is contained in:
Daniel Agar 2017-10-02 12:54:09 -04:00 committed by David Sidrane
parent ed9e798f86
commit 8d07c647f7
3 changed files with 15 additions and 22 deletions

View File

@ -107,17 +107,6 @@ else
BUILD_DIR_SUFFIX :=
endif
# NuttX verbose output
ifdef VN
export PX4_NUTTX_BUILD_VERBOSE=1
export V=1
endif
# NuttX verbose patches output
ifdef VNP
export PX4_NUTTX_PATCHES_VERBOSE=1
endif
# additional config parameters passed to cmake
CMAKE_ARGS := -Wno-deprecated

View File

@ -53,7 +53,7 @@ add_custom_command(OUTPUT apps_copy.stamp
DEPENDS ${copy_apps_files}
COMMENT "Copying NuttX/apps to ${CMAKE_CURRENT_BINARY_DIR}"
)
set(APPS_DIR ${CMAKE_CURRENT_BINARY_DIR}/apps)
set(APPS_DIR ${PX4_BINARY_DIR}/NuttX/apps)
# copy PX4 board config into nuttx
file(GLOB_RECURSE board_config_files ${NUTTX_CONFIG_DIR}/${BOARD})
@ -74,7 +74,8 @@ add_custom_command(OUTPUT
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs
${board_config_files}
nuttx_copy.stamp apps_copy.stamp
nuttx_copy.stamp
apps_copy.stamp
WORKING_DIRECTORY ${NUTTX_DIR}/tools
COMMENT "Copying NuttX config ${BOARD} and configuring"
)
@ -109,12 +110,11 @@ add_custom_target(nuttx_context DEPENDS ${NUTTX_DIR}/include/nuttx/version.h)
# library of NuttX libraries
add_library(nuttx_build INTERFACE)
add_dependencies(nuttx_build nuttx_context)
# builtins
set(nuttx_builtin_list)
if ("${BOARD}" MATCHES "px4io")
# no apps for px4io
else()
add_custom_target(nuttx_builtins)
if (CONFIG_NSH_LIBRARY)
# add additional commands to nuttx builtins
set(builtin_registry ${APPS_DIR}/builtin/registry)
foreach(module ${module_libraries})
@ -125,26 +125,30 @@ else()
if(MAIN)
add_custom_command(OUTPUT ${builtin_registry}/${MAIN}_main.bdat
COMMAND echo "{ \"${MAIN}\", ${PRIORITY}, ${STACK_MAIN}, ${MAIN}_main }," > ${builtin_registry}/${MAIN}_main.bdat
DEPENDS nuttx_context
VERBATIM
)
list(APPEND nuttx_builtin_list ${builtin_registry}/${MAIN}_main.bdat)
add_custom_command(OUTPUT ${builtin_registry}/${MAIN}_main.pdat
COMMAND echo "int ${MAIN}_main(int argc, char *argv[]);" > ${builtin_registry}/${MAIN}_main.pdat
DEPENDS nuttx_context
VERBATIM
)
list(APPEND nuttx_builtin_list ${builtin_registry}/${MAIN}_main.pdat)
add_custom_target(nuttx_builtins_${MAIN} DEPENDS ${builtin_registry}/${MAIN}_main.bdat ${builtin_registry}/${MAIN}_main.pdat)
add_dependencies(nuttx_builtins nuttx_builtins_${MAIN})
endif()
endforeach()
endif()
add_dependencies(nuttx_build nuttx_builtins)
# APPS
# libapps.a
add_custom_command(OUTPUT ${APPS_DIR}/libapps.a ${APPS_DIR}/platform/.built
COMMAND find ${APPS_DIR} -name \*.o -o -name \*.built -delete
COMMAND find ${APPS_DIR} -name \*.o -delete
COMMAND make ${nuttx_build_options} --no-print-directory -C ../apps TOPDIR="${NUTTX_DIR}" libapps.a ${nuttx_build_output}
DEPENDS nuttx_context ${nuttx_builtin_list}
DEPENDS nuttx_context nuttx_builtins
WORKING_DIRECTORY ${NUTTX_DIR}
${nuttx_build_uses_terminal}
)

View File

@ -3,7 +3,7 @@ include(common/px4_upload)
# add executable
set(fw_name ${CONFIG}.elf)
add_executable(${fw_name} ${PX4_SOURCE_DIR}/src/platforms/empty.c)
add_dependencies(${fw_name} git_nuttx)
add_dependencies(${fw_name} git_nuttx nuttx_build)
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)