NuttX build in place

- cmake NuttX build wrapper compile in place instead of copying source tree to build directory
    - slightly faster skipping necessary copying (depending on system)
    - allows debugging in place
    - easier to work directly in NuttX following official documentation
    - simplifies overall build which should make it easier to resolve any remaining NuttX dependency issues in the build system
 - the downside is switching back and forth between different builds always require rebuilding NuttX, but I think this is worth the improved developer experience
 - also no longer builds px4io and bootloader in every single build, for most users these rarely change and we're wasting a lot of build time
This commit is contained in:
Daniel Agar
2021-11-15 18:47:38 -05:00
committed by GitHub
parent 7b7b7acd36
commit f5d9b01f5c
164 changed files with 351 additions and 751 deletions

View File

@@ -51,17 +51,17 @@
function(px4_os_add_flags)
include_directories(BEFORE SYSTEM
${PX4_BINARY_DIR}/NuttX/nuttx/include
${PX4_BINARY_DIR}/NuttX/nuttx/include/cxx
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/nuttx/include
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/nuttx/include/cxx
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/include/cxx # custom new
)
include_directories(
${PX4_BINARY_DIR}/NuttX/nuttx/arch/${CONFIG_ARCH}/src/${CONFIG_ARCH_FAMILY}
${PX4_BINARY_DIR}/NuttX/nuttx/arch/${CONFIG_ARCH}/src/chip
${PX4_BINARY_DIR}/NuttX/nuttx/arch/${CONFIG_ARCH}/src/common
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/nuttx/arch/${CONFIG_ARCH}/src/${CONFIG_ARCH_FAMILY}
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/nuttx/arch/${CONFIG_ARCH}/src/chip
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/nuttx/arch/${CONFIG_ARCH}/src/common
${PX4_BINARY_DIR}/NuttX/apps/include
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/apps/include
)
# prevent using the toolchain's std c++ library
@@ -178,6 +178,6 @@ function(px4_os_prebuild_targets)
add_library(prebuild_targets INTERFACE)
target_link_libraries(prebuild_targets INTERFACE nuttx_xx nuttx_c nuttx_fs nuttx_mm nuttx_sched m gcc)
add_dependencies(prebuild_targets DEPENDS nuttx_build uorb_headers)
add_dependencies(prebuild_targets DEPENDS nuttx_context uorb_headers)
endfunction()