forked from Archive/PX4-Autopilot
NuttX cmake build wrapper thorough dependencies
This commit is contained in:
parent
99aae8b891
commit
2af262ed1d
|
@ -155,7 +155,7 @@ foreach(board_rc_file ${OPTIONAL_BOARD_RC})
|
|||
OUTPUT
|
||||
${romfs_gen_root_dir}/init.d/${board_rc_file}
|
||||
${board_rc_file}.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PX4_BOARD_DIR}/init/${board_rc_file} ${romfs_gen_root_dir}/init.d/${board_rc_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PX4_BOARD_DIR}/init/${board_rc_file} ${romfs_gen_root_dir}/init.d/${board_rc_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${board_rc_file}.stamp
|
||||
DEPENDS
|
||||
${PX4_BOARD_DIR}/init/${board_rc_file}
|
||||
|
@ -196,7 +196,7 @@ if("${CONFIG_FS_CROMFS}" STREQUAL "y")
|
|||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/gencromfs
|
||||
COMMAND make --no-print-directory --silent -f Makefile.host gencromfs
|
||||
COMMAND ${CMAKE_COMMAND} -E copy gencromfs ${CMAKE_BINARY_DIR}/gencromfs
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different gencromfs ${CMAKE_BINARY_DIR}/gencromfs
|
||||
DEPENDS ${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/nuttx/tools/gencromfs.c
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}/tools
|
||||
)
|
||||
|
|
|
@ -31,36 +31,37 @@
|
|||
#
|
||||
############################################################################
|
||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||
add_library(drivers_board
|
||||
bootloader_main.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
bootloader
|
||||
)
|
||||
add_library(drivers_board
|
||||
bootloader_main.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
bootloader
|
||||
)
|
||||
target_include_directories(drivers_board PRIVATE ${PX4_SOURCE_DIR}/platforms/nuttx/src/bootloader)
|
||||
|
||||
else()
|
||||
add_library(drivers_board
|
||||
can.c
|
||||
init.c
|
||||
led.c
|
||||
manifest.c
|
||||
sdio.c
|
||||
spi.cpp
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
add_dependencies(drivers_board arch_board_hw_info)
|
||||
add_library(drivers_board
|
||||
can.c
|
||||
init.c
|
||||
led.c
|
||||
manifest.c
|
||||
sdio.c
|
||||
spi.cpp
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
add_dependencies(drivers_board arch_board_hw_info)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
arch_board_hw_info
|
||||
drivers__led # drv_led_start
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
px4_layer
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
arch_board_hw_info
|
||||
drivers__led # drv_led_start
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
px4_layer
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -131,9 +131,9 @@ function(px4_add_common_flags)
|
|||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fcheck-new>)
|
||||
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
message(FATAL_ERROR "Intel compiler not yet supported")
|
||||
message(FATAL_ERROR "Intel compiler not yet supported")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
message(FATAL_ERROR "MS compiler not yet supported")
|
||||
message(FATAL_ERROR "MS compiler not yet supported")
|
||||
endif()
|
||||
|
||||
# C only flags
|
||||
|
@ -171,9 +171,6 @@ function(px4_add_common_flags)
|
|||
${PX4_BINARY_DIR}
|
||||
${PX4_BINARY_DIR}/src/lib
|
||||
|
||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/bootloader
|
||||
endif()
|
||||
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/${PX4_CHIP_MANUFACTURER}/${PX4_CHIP}/include
|
||||
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/common/include
|
||||
${PX4_SOURCE_DIR}/platforms/common/include
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
if(POLICY CMP0079)
|
||||
cmake_policy(SET CMP0079 NEW)
|
||||
endif()
|
||||
|
||||
include(cygwin_cygpath)
|
||||
|
||||
set(NUTTX_DIR ${PX4_BINARY_DIR}/NuttX/nuttx)
|
||||
|
@ -47,14 +51,14 @@ get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
|
|||
add_subdirectory(NuttX ${PX4_BINARY_DIR}/NuttX)
|
||||
|
||||
set(nuttx_libs)
|
||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||
set(SCRIPT_PREFIX ${PX4_BOARD_LABEL}_)
|
||||
add_subdirectory(src/bootloader)
|
||||
list(APPEND nuttx_libs
|
||||
bootloader
|
||||
bootloader_lib
|
||||
drivers_board
|
||||
)
|
||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||
set(SCRIPT_PREFIX ${PX4_BOARD_LABEL}_)
|
||||
add_subdirectory(src/bootloader)
|
||||
list(APPEND nuttx_libs
|
||||
bootloader
|
||||
bootloader_lib
|
||||
drivers_board
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND nuttx_libs
|
||||
|
@ -81,10 +85,6 @@ file(RELATIVE_PATH PX4_BINARY_DIR_REL ${CMAKE_CURRENT_BINARY_DIR} ${PX4_BINARY_D
|
|||
# because even relative linker script paths are different for linux, mac and windows
|
||||
CYGPATH(PX4_BINARY_DIR PX4_BINARY_DIR_CYG)
|
||||
|
||||
if(POLICY CMP0079)
|
||||
cmake_policy(SET CMP0079 NEW)
|
||||
endif()
|
||||
|
||||
target_link_libraries(nuttx_arch
|
||||
INTERFACE
|
||||
drivers_board
|
||||
|
|
|
@ -33,17 +33,17 @@
|
|||
|
||||
if (CMAKE_HOST_APPLE OR CMAKE_HOST_WIN32)
|
||||
# copy with rsync and create file dependencies
|
||||
set(cp_cmd "rsync")
|
||||
set(cp_opts)
|
||||
list(APPEND cp_opts
|
||||
set(NUTTX_COPY_CMD "rsync")
|
||||
set(NUTTX_COPY_CMD_OPTS)
|
||||
list(APPEND NUTTX_COPY_CMD_OPTS
|
||||
-rp
|
||||
--inplace
|
||||
)
|
||||
else()
|
||||
# copy with hard links
|
||||
# archive, recursive, force, link (hardlinks)
|
||||
set(cp_cmd "cp")
|
||||
set(cp_opts "-aRfl")
|
||||
set(NUTTX_COPY_CMD "cp")
|
||||
set(NUTTX_COPY_CMD_OPTS "-aRfl")
|
||||
endif()
|
||||
|
||||
set(NUTTX_CONFIG_DIR ${PX4_BOARD_DIR}/nuttx-config)
|
||||
|
@ -56,24 +56,13 @@ file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
|
|||
|
||||
# setup custom command to copy changes later
|
||||
file(GLOB_RECURSE copy_nuttx_files LIST_DIRECTORIES false ${NUTTX_SRC_DIR}/nuttx/*)
|
||||
|
||||
|
||||
# For any dependencies of commands on files we need to create a target.
|
||||
# Otherwise, if "Unix Makefiles" are used as the generator the commands are run in
|
||||
# parallel on the different files which often can lead to races or redundancies
|
||||
# in our build.
|
||||
# A nice write-up can be found here:
|
||||
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/#custom-commands-and-parallel-make
|
||||
|
||||
add_custom_target(copy_nuttx_files_target
|
||||
DEPENDS ${copy_nuttx_files}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
|
||||
COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST}
|
||||
COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
|
||||
DEPENDS copy_nuttx_files_target ${copy_nuttx_files} git_nuttx
|
||||
DEPENDS
|
||||
git_nuttx
|
||||
${copy_nuttx_files}
|
||||
COMMENT "Copying NuttX/nuttx to ${CP_DST}"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
@ -86,132 +75,98 @@ file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
|
|||
|
||||
# setup custom command to copy changes later
|
||||
file(GLOB_RECURSE copy_apps_files LIST_DIRECTORIES false ${NUTTX_SRC_DIR}/apps/*)
|
||||
|
||||
add_custom_target(copy_apps_files_target
|
||||
DEPENDS ${copy_apps_files}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
|
||||
COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST}
|
||||
COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
|
||||
DEPENDS copy_apps_files_target ${copy_apps_files} git_nuttx_apps
|
||||
DEPENDS
|
||||
git_nuttx_apps
|
||||
${copy_apps_files}
|
||||
COMMENT "Copying NuttX/apps to ${CP_DST}"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
set(APPS_DIR ${CMAKE_CURRENT_BINARY_DIR}/apps)
|
||||
|
||||
|
||||
# For any dependencies of commands on files we need to create a target.
|
||||
# Otherwise, if "Unix Makefiles" are used as the generator the commands are run in
|
||||
# parallel on the different files which often can lead to races or redundancies
|
||||
# in our build.
|
||||
# A nice write-up can be found here:
|
||||
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/#custom-commands-and-parallel-make
|
||||
add_custom_target(nuttx_copy_and_apps_target
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
|
||||
)
|
||||
|
||||
|
||||
# If the board provides a Kconfig Use it or create an empty one
|
||||
if(EXISTS ${NUTTX_CONFIG_DIR}/Kconfig)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${NUTTX_DIR}/boards/dummy/Kconfig
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/boards/dummy/Kconfig
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/boards/dummy/Kconfig
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
DEPENDS
|
||||
nuttx_copy_and_apps_target
|
||||
nuttx_copy_and_apps_target ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${NUTTX_DIR}/boards/dummy/Kconfig
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${NUTTX_DIR}/boards/dummy/Kconfig
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
DEPENDS
|
||||
nuttx_copy_and_apps_target
|
||||
nuttx_copy_and_apps_target ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_target(nuttx_config_kconfig_target
|
||||
DEPENDS
|
||||
${NUTTX_DIR}/boards/dummy/Kconfig
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
)
|
||||
add_custom_target(nuttx_config_kconfig_target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp)
|
||||
|
||||
###############################################################################
|
||||
# NuttX configure
|
||||
###############################################################################
|
||||
|
||||
# copy NuttX config directory
|
||||
file(RELATIVE_PATH CP_SRC ${NUTTX_DIR} ${PX4_BOARD_DIR}/nuttx-config)
|
||||
file(RELATIVE_PATH CP_DST ${NUTTX_DIR} ${PX4_BINARY_DIR}/NuttX)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${PX4_BINARY_DIR}/NuttX/nuttx-config/include/board.h
|
||||
${PX4_BINARY_DIR}/NuttX/nuttx-config/include/nsh_romfsimg.h
|
||||
${PX4_BINARY_DIR}/NuttX/nuttx-config/scripts/script.ld
|
||||
${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers/Kconfig
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy_config_dir.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${NUTTX_DIR}/include/nuttx/config.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CONFIG_DIR}/ ${PX4_BINARY_DIR}/NuttX/nuttx-config
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy_config_dir.stamp
|
||||
COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers/Kconfig
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/src
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/nsh_romfsimg.h ${PX4_BINARY_DIR}/NuttX/nuttx-config/include/nsh_romfsimg.h
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy_config_dir.stamp
|
||||
DEPENDS
|
||||
${NUTTX_SRC_DIR}/nsh_romfsimg.h
|
||||
${NUTTX_CONFIG_DIR}/include/board.h
|
||||
${NUTTX_CONFIG_DIR}/scripts/script.ld
|
||||
nuttx_copy_and_apps_target
|
||||
${NUTTX_SRC_DIR}/nsh_romfsimg.h
|
||||
nuttx_config_kconfig_target ${CMAKE_CURRENT_BINARY_DIR}/nuttx_config_kconfig.stamp
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Copying NuttX config ${NUTTX_CONFIG}"
|
||||
)
|
||||
|
||||
add_custom_target(nuttx_copy_config_dir_target
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy_config_dir.stamp
|
||||
)
|
||||
add_custom_target(nuttx_copy_config_dir_target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy_config_dir.stamp)
|
||||
|
||||
|
||||
# NuttX defconfig
|
||||
# cmake should trigger reconfigure if defconfig changes
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${NUTTX_DEFCONFIG})
|
||||
file(STRINGS ${NUTTX_DEFCONFIG} config_expanded REGEX "# Automatically generated file; DO NOT EDIT.")
|
||||
|
||||
add_custom_target(nuttx_defconfig_target
|
||||
# copy compressed PX4 defconfig into nuttx and inflate
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${NUTTX_DIR}/.config
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nuttx_olddefconfig.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/px4_nuttx_make_olddefconfig.sh ${NUTTX_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/nuttx_olddefconfig.stamp
|
||||
DEPENDS
|
||||
${NUTTX_DEFCONFIG}
|
||||
${NUTTX_DEFCONFIG}
|
||||
nuttx_copy_config_dir_target ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy_config_dir.stamp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/px4_nuttx_make_olddefconfig.sh
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Copying NuttX compressed config ${NUTTX_CONFIG} and inflating"
|
||||
)
|
||||
|
||||
if (NOT config_expanded)
|
||||
# copy compressed PX4 defconfig into nuttx and inflate
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${NUTTX_DIR}/.config
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/px4_nuttx_make_olddefconfig.sh ${NUTTX_DIR}
|
||||
DEPENDS
|
||||
nuttx_defconfig_target
|
||||
${NUTTX_DEFCONFIG}
|
||||
nuttx_copy_config_dir_target
|
||||
nuttx_config_kconfig_target
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Copying NuttX compressed config ${NUTTX_CONFIG} and inflating"
|
||||
)
|
||||
else()
|
||||
# copy uncompressed PX4 defconfig into nuttx
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${NUTTX_DIR}/.config
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config
|
||||
DEPENDS
|
||||
nuttx_defconfig_target
|
||||
${NUTTX_DEFCONFIG}
|
||||
nuttx_copy_config_dir_target
|
||||
nuttx_config_kconfig_target
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Copying NuttX uncompressed config ${NUTTX_CONFIG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_target(nuttx_config_target DEPENDS ${NUTTX_DIR}/.config)
|
||||
add_custom_target(nuttx_config_target DEPENDS ${NUTTX_DIR}/.config ${CMAKE_CURRENT_BINARY_DIR}/nuttx_olddefconfig.stamp)
|
||||
|
||||
###############################################################################
|
||||
# NuttX build
|
||||
|
@ -222,12 +177,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Make.defs.in ${NUTTX_DIR}/Make.defs)
|
|||
# verbose build settings (V=1 or VERBOSE=1)
|
||||
option(PX4_NUTTX_VERBOSE "PX4 NuttX verbose build" off)
|
||||
|
||||
if (($ENV{V} MATCHES "1") OR ($ENV{VERBOSE} MATCHES "1"))
|
||||
if(($ENV{V} MATCHES "1") OR ($ENV{VERBOSE} MATCHES "1"))
|
||||
message(STATUS "NuttX verbose build enabled")
|
||||
set(PX4_NUTTX_VERBOSE on)
|
||||
endif()
|
||||
|
||||
if (PX4_NUTTX_VERBOSE)
|
||||
if(PX4_NUTTX_VERBOSE)
|
||||
set(nuttx_build_options)
|
||||
set(nuttx_build_output)
|
||||
set(nuttx_build_uses_terminal "USES_TERMINAL")
|
||||
|
@ -238,26 +193,27 @@ else()
|
|||
endif()
|
||||
|
||||
# context
|
||||
add_custom_command(OUTPUT ${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
||||
COMMAND make ${nuttx_build_options} --no-print-directory CONFIG_ARCH_BOARD_CUSTOM=y context > nuttx_context.log
|
||||
DEPENDS nuttx_config_target
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${NUTTX_DIR}/include/nuttx/config.h
|
||||
${NUTTX_DIR}/include/nuttx/version.h
|
||||
COMMAND
|
||||
make ${nuttx_build_options} --no-print-directory CONFIG_ARCH_BOARD_CUSTOM=y context > nuttx_context.log
|
||||
DEPENDS
|
||||
nuttx_config_target ${NUTTX_DIR}/.config ${CMAKE_CURRENT_BINARY_DIR}/nuttx_olddefconfig.stamp
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
${nuttx_build_uses_terminal}
|
||||
)
|
||||
|
||||
add_custom_target(nuttx_context DEPENDS ${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h)
|
||||
)
|
||||
add_custom_target(nuttx_context DEPENDS ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h)
|
||||
|
||||
# library of NuttX libraries
|
||||
add_library(nuttx_build INTERFACE)
|
||||
add_dependencies(nuttx_build nuttx_context)
|
||||
|
||||
add_custom_target(px4_config_file_target
|
||||
DEPENDS ${PX4_CONFIG_FILE}
|
||||
)
|
||||
add_custom_target(px4_config_file_target DEPENDS ${PX4_CONFIG_FILE})
|
||||
|
||||
# builtins
|
||||
set(nuttx_builtin_list)
|
||||
if (CONFIG_NSH_LIBRARY)
|
||||
if(CONFIG_NSH_LIBRARY)
|
||||
# force builtins regeneration and apps rebuild if nuttx or px4 configuration have changed
|
||||
add_custom_command(OUTPUT builtins_clean.stamp
|
||||
COMMAND find ${APPS_DIR}/builtin/registry -name px4_\*.bdat -delete
|
||||
|
@ -265,17 +221,12 @@ if (CONFIG_NSH_LIBRARY)
|
|||
COMMAND rm -f ${APPS_DIR}/builtin/builtin_list.h
|
||||
COMMAND ${CMAKE_COMMAND} -E touch builtins_clean.stamp
|
||||
DEPENDS
|
||||
nuttx_config_target
|
||||
nuttx_context
|
||||
${NUTTX_DIR}/include/nuttx/version.h
|
||||
${NUTTX_DIR}/include/nuttx/config.h
|
||||
nuttx_context ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h
|
||||
px4_config_file_target ${PX4_CONFIG_FILE}
|
||||
)
|
||||
|
||||
add_custom_target(builtins_clean_target
|
||||
DEPENDS builtins_clean.stamp
|
||||
)
|
||||
|
||||
add_custom_target(builtins_clean_target DEPENDS builtins_clean.stamp)
|
||||
|
||||
foreach(module ${module_libraries})
|
||||
get_target_property(MAIN ${module} MAIN)
|
||||
get_target_property(STACK_MAIN ${module} STACK_MAIN)
|
||||
|
@ -286,9 +237,8 @@ if (CONFIG_NSH_LIBRARY)
|
|||
COMMAND echo "{ \"${MAIN}\", ${PRIORITY}, ${STACK_MAIN}, ${MAIN}_main }," > ${APPS_DIR}/builtin/registry/px4_${MAIN}_main.bdat
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${APPS_DIR}/builtin/registry/.updated
|
||||
DEPENDS
|
||||
builtins_clean_target
|
||||
nuttx_context
|
||||
${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
||||
builtins_clean_target builtins_clean.stamp
|
||||
nuttx_context ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h
|
||||
VERBATIM
|
||||
)
|
||||
list(APPEND nuttx_builtin_list ${APPS_DIR}/builtin/registry/px4_${MAIN}_main.bdat)
|
||||
|
@ -297,9 +247,8 @@ if (CONFIG_NSH_LIBRARY)
|
|||
COMMAND echo "int ${MAIN}_main(int argc, char *argv[]);" > ${APPS_DIR}/builtin/registry/px4_${MAIN}_main.pdat
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${APPS_DIR}/builtin/registry/.updated
|
||||
DEPENDS
|
||||
builtins_clean_target
|
||||
nuttx_context
|
||||
${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
||||
builtins_clean_target builtins_clean.stamp
|
||||
nuttx_context ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h
|
||||
VERBATIM
|
||||
)
|
||||
list(APPEND nuttx_builtin_list ${APPS_DIR}/builtin/registry/px4_${MAIN}_main.pdat)
|
||||
|
@ -308,9 +257,7 @@ if (CONFIG_NSH_LIBRARY)
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
add_custom_target(nuttx_builtin_list_target
|
||||
DEPENDS ${nuttx_builtin_list}
|
||||
)
|
||||
add_custom_target(nuttx_builtin_list_target DEPENDS ${nuttx_builtin_list})
|
||||
|
||||
# APPS
|
||||
|
||||
|
@ -320,11 +267,10 @@ add_custom_command(OUTPUT ${APPS_DIR}/libapps.a ${APPS_DIR}/platform/.built
|
|||
COMMAND make ${nuttx_build_options} --no-print-directory TOPDIR="${NUTTX_DIR}" ../apps/libapps.a > nuttx_apps.log
|
||||
DEPENDS
|
||||
nuttx_builtin_list_target ${nuttx_builtin_list}
|
||||
nuttx_context
|
||||
${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
||||
nuttx_context ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
${nuttx_build_uses_terminal}
|
||||
)
|
||||
)
|
||||
add_custom_target(nuttx_apps_build DEPENDS ${APPS_DIR}/libapps.a)
|
||||
add_library(nuttx_apps STATIC IMPORTED GLOBAL)
|
||||
set_property(TARGET nuttx_apps PROPERTY IMPORTED_LOCATION ${APPS_DIR}/libapps.a)
|
||||
|
@ -342,11 +288,10 @@ function(add_nuttx_dir nuttx_lib nuttx_lib_dir kernel extra)
|
|||
COMMAND make -C ${nuttx_lib_dir} ${nuttx_build_options} --no-print-directory all TOPDIR=${NUTTX_DIR} KERNEL=${kernel} EXTRADEFINES=${extra} ${nuttx_build_output}
|
||||
DEPENDS
|
||||
${nuttx_lib_files}
|
||||
nuttx_context
|
||||
${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
||||
nuttx_context ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
${nuttx_build_uses_terminal}
|
||||
)
|
||||
)
|
||||
add_custom_target(nuttx_${nuttx_lib}_build DEPENDS ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a)
|
||||
add_library(nuttx_${nuttx_lib} STATIC IMPORTED GLOBAL)
|
||||
set_property(TARGET nuttx_${nuttx_lib} PROPERTY IMPORTED_LOCATION ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a)
|
||||
|
@ -365,7 +310,7 @@ add_nuttx_dir(c libs/libc n "")
|
|||
add_nuttx_dir(xx libs/libxx n "")
|
||||
add_nuttx_dir(mm mm n "")
|
||||
|
||||
if (CONFIG_NET)
|
||||
if(CONFIG_NET)
|
||||
add_nuttx_dir(net net y -D__KERNEL__)
|
||||
endif()
|
||||
|
||||
|
@ -390,15 +335,6 @@ add_custom_target(oldconfig
|
|||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# NuttX oldconfig + copy uncompressed back to PX4
|
||||
add_custom_target(oldconfig_uncompressed
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_DIR}/.config ${NUTTX_DEFCONFIG}
|
||||
DEPENDS oldconfig_nuttx
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Running make oldconfig then saving uncompressed defconfig for ${NUTTX_CONFIG}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# NuttX olddefconfig
|
||||
add_custom_target(olddefconfig_nuttx
|
||||
|
@ -420,15 +356,6 @@ add_custom_target(olddefconfig
|
|||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# NuttX oldconfig + copy uncompressed back to PX4
|
||||
add_custom_target(olddefconfig_uncompressed
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_DIR}/.config ${NUTTX_DEFCONFIG}
|
||||
DEPENDS olddefconfig_nuttx
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Running make olddefconfig then saving uncompressed defconfig for ${NUTTX_CONFIG}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# NuttX menuconfig
|
||||
add_custom_target(menuconfig_nuttx
|
||||
|
@ -450,15 +377,6 @@ add_custom_target(menuconfig
|
|||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# NuttX menuconfig + copy uncompressed back to PX4
|
||||
add_custom_target(menuconfig_uncompressed
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_DIR}/.config ${NUTTX_DEFCONFIG}
|
||||
DEPENDS menuconfig_nuttx
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Running make nuttx_menuconfig then saving uncompressed defconfig for ${NUTTX_CONFIG}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# NuttX qconfig
|
||||
add_custom_target(qconfig_nuttx
|
||||
|
@ -479,12 +397,3 @@ add_custom_target(qconfig
|
|||
COMMENT "Running make qconfig then savedefconfig for ${NUTTX_CONFIG}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# NuttX qconfig + copy uncompressed back to PX4
|
||||
add_custom_target(qconfig_uncompressed
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_DIR}/.config ${NUTTX_DEFCONFIG}
|
||||
DEPENDS nuttx_config_target qconfig_nuttx
|
||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||
COMMENT "Running make qconfig then saving uncompressed defconfig for ${NUTTX_CONFIG}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
|
|
@ -52,19 +52,19 @@ set(NUTTX_APPS_DIR ${PX4_BINARY_DIR}/NuttX/apps CACHE FILEPATH "NuttX apps direc
|
|||
px4_add_git_submodule(TARGET git_nuttx PATH "${NUTTX_SRC_DIR}/nuttx")
|
||||
px4_add_git_submodule(TARGET git_nuttx_apps PATH "${NUTTX_SRC_DIR}/apps")
|
||||
|
||||
if (CMAKE_HOST_APPLE OR CMAKE_HOST_WIN32)
|
||||
if(CMAKE_HOST_APPLE OR CMAKE_HOST_WIN32)
|
||||
# copy with rsync and create file dependencies
|
||||
set(cp_cmd "rsync")
|
||||
set(cp_opts)
|
||||
list(APPEND cp_opts
|
||||
set(NUTTX_COPY_CMD "rsync")
|
||||
set(NUTTX_COPY_CMD_OPTS)
|
||||
list(APPEND NUTTX_COPY_CMD_OPTS
|
||||
-rp
|
||||
--inplace
|
||||
)
|
||||
else()
|
||||
# copy with hard links
|
||||
# archive, recursive, force, link (hardlinks)
|
||||
set(cp_cmd "cp")
|
||||
set(cp_opts "-aRfl")
|
||||
set(NUTTX_COPY_CMD "cp")
|
||||
set(NUTTX_COPY_CMD_OPTS "-aRfl")
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
|
@ -73,9 +73,12 @@ endif()
|
|||
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/nuttx)
|
||||
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
|
||||
|
||||
# copy during cmake configure
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${NUTTX_DIR})
|
||||
execute_process(COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
# copy nuttx during cmake configure
|
||||
if(NOT EXISTS ${NUTTX_DIR}/nuttx_copy.stamp)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${NUTTX_DIR})
|
||||
execute_process(COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx_copy.stamp)
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# NuttX apps: copy to build directory
|
||||
|
@ -83,47 +86,48 @@ execute_process(COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST} WORKING_DIRECTO
|
|||
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/apps)
|
||||
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
|
||||
|
||||
# copy during cmake configure
|
||||
execute_process(COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
|
||||
###############################################################################
|
||||
# nuttx-config: copy to build directory
|
||||
###############################################################################
|
||||
|
||||
set(NUTTX_DEFCONFIG ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig CACHE FILEPATH "path to defconfig" FORCE)
|
||||
|
||||
###############################################################################
|
||||
# Create a temporary Toplevel Make.defs for the oldconfig step
|
||||
###############################################################################
|
||||
configure_file(${NUTTX_SRC_DIR}/Make.defs.in ${NUTTX_DIR}/Make.defs)
|
||||
|
||||
# If the board provides a Kconfig Use it or create an empty one
|
||||
if(EXISTS ${NUTTX_CONFIG_DIR}/Kconfig)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/boards/dummy/Kconfig)
|
||||
else()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${NUTTX_DIR}/boards/dummy/Kconfig)
|
||||
# copy apps during cmake configure
|
||||
if(NOT EXISTS ${NUTTX_DIR}/apps_copy.stamp)
|
||||
execute_process(COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/apps_copy.stamp)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/src
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CONFIG_DIR}/ ${PX4_BINARY_DIR}/NuttX/nuttx-config
|
||||
)
|
||||
###############################################################################
|
||||
# board nuttx-config
|
||||
###############################################################################
|
||||
|
||||
# NuttX extra files
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/nsh_romfsimg.h ${PX4_BINARY_DIR}/NuttX/nuttx-config/include/nsh_romfsimg.h)
|
||||
# If the board provides a Kconfig Use it or create an empty one
|
||||
if(NOT EXISTS ${NUTTX_DIR}/nuttx_config_kconfig.stamp)
|
||||
if(EXISTS ${NUTTX_CONFIG_DIR}/Kconfig)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/boards/dummy/Kconfig)
|
||||
else()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${NUTTX_DIR}/boards/dummy/Kconfig)
|
||||
endif()
|
||||
|
||||
# copy defconfig
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx_config_kconfig.stamp)
|
||||
endif()
|
||||
|
||||
# create empty drivers/Kconfig
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers/Kconfig
|
||||
)
|
||||
if(NOT EXISTS ${NUTTX_DIR}/nuttx_copy_config_dir.stamp)
|
||||
|
||||
# copy PX4 board config into nuttx
|
||||
file(STRINGS ${NUTTX_DEFCONFIG} config_expanded REGEX "# Automatically generated file; DO NOT EDIT.")
|
||||
if (NOT config_expanded)
|
||||
# copy board's nuttx-config to NuttX/nuttx-config
|
||||
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${PX4_BOARD_DIR}/nuttx-config)
|
||||
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
|
||||
execute_process(COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx-config/drivers/Kconfig)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/src)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/nsh_romfsimg.h ${PX4_BINARY_DIR}/NuttX/nuttx-config/include/nsh_romfsimg.h)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx_copy_config_dir.stamp)
|
||||
|
||||
endif()
|
||||
|
||||
# make olddefconfig (inflate defconfig to full .config)
|
||||
if(NOT EXISTS ${NUTTX_DIR}/.config)
|
||||
set(NUTTX_DEFCONFIG ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig CACHE FILEPATH "path to defconfig" FORCE)
|
||||
configure_file(${NUTTX_SRC_DIR}/Make.defs.in ${NUTTX_DIR}/Make.defs) # Create a temporary Toplevel Make.defs for the oldconfig step
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config)
|
||||
set(ENV{PATH} "${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/tools:$ENV{PATH}")
|
||||
execute_process(
|
||||
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD_CUSTOM=y olddefconfig
|
||||
|
@ -135,9 +139,11 @@ if (NOT config_expanded)
|
|||
if(NOT ret EQUAL "0")
|
||||
# Show the log here as it will be deleted due to the incomplete configure step
|
||||
file(READ ${NUTTX_DIR}/nuttx_olddefconfig.log DEFCONFIG_LOG)
|
||||
message( STATUS "${DEFCONFIG_LOG}")
|
||||
message( FATAL_ERROR "NuttX olddefconfig target failed. \
|
||||
Possible cause: the board (${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}) has the wrong directory structure (i.e. missing files).")
|
||||
message(STATUS "${DEFCONFIG_LOG}")
|
||||
message(FATAL_ERROR "NuttX olddefconfig target failed. \
|
||||
Possible cause: the board (${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}) has the wrong directory structure (i.e. missing files).")
|
||||
else()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx_olddefconfig.stamp)
|
||||
endif()
|
||||
# remove Toplevel Make.defs
|
||||
file(REMOVE ${NUTTX_DIR}/Make.defs)
|
||||
|
|
|
@ -52,9 +52,8 @@ 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/include/cxx
|
||||
${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/include/cxx # custom new
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -63,7 +62,7 @@ function(px4_os_add_flags)
|
|||
${PX4_BINARY_DIR}/NuttX/nuttx/arch/${CONFIG_ARCH}/src/common
|
||||
|
||||
${PX4_BINARY_DIR}/NuttX/apps/include
|
||||
)
|
||||
)
|
||||
|
||||
# prevent using the toolchain's std c++ library
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>)
|
||||
|
@ -160,6 +159,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_context uorb_headers)
|
||||
add_dependencies(prebuild_targets DEPENDS nuttx_build uorb_headers)
|
||||
|
||||
endfunction()
|
||||
|
|
|
@ -36,5 +36,6 @@ add_library(bootloader
|
|||
${PX4_CHIP}/main.c
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_subdirectory(lib)
|
||||
add_dependencies(bootloader prebuild_targets)
|
||||
add_dependencies(bootloader prebuild_targets)
|
||||
|
|
|
@ -38,4 +38,4 @@ add_library(bootloader_lib
|
|||
flash_cache.c
|
||||
)
|
||||
|
||||
add_dependencies(bootloader_lib prebuild_targets)
|
||||
add_dependencies(bootloader_lib prebuild_targets)
|
||||
|
|
Loading…
Reference in New Issue