More qurt support

The current approach of distributing submodule inclusion logic makes
evert parent dir need to know about all build targets.

This approach goes back to the previous way of centralizing the build
dirs in a single file.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois 2015-09-08 07:47:09 -07:00
parent 14cafa0143
commit 0de5868ee2
3 changed files with 81 additions and 6 deletions

View File

@ -236,7 +236,7 @@ endfunction()
#
# Usage:
# px4_os_prebuild_targets(
# OUT <out-list_of_targets>
# OUT_MODULES <module-subdir-list>
# BOARD <in-string>
# )
#
@ -244,16 +244,16 @@ endfunction()
# BOARD : board
#
# Output:
# MODULE_LIST : the updated module list
# OUT_MODULES : the updated module list
#
# Example:
# px4_qurt_add_modules(MODULE_LIST module_list BOARD hil)
# px4_qurt_add_modules(module_list "hil")
#
function(px4_qurt_add_modules out_modules BOARD)
function(px4_qurt_add_modules OUT_MODULES BOARD)
include(config-qurt-${BOARD})
set(config_modules)
px4_set_config_modules(config_modules)
set(${out_modules} ${out_modules} ${config_modules} PARENT_SCOPE)
set(${OUT_MODULES} ${${OUT_MODULES}} ${config_modules} PARENT_SCOPE)
endfunction()
# vim: set noet fenc=utf-8 ff=unix nowrap:

View File

@ -77,7 +77,7 @@ function(px4_set_config_modules out_module_list)
#
# sources for muorb over fastrpc
#
modules/muorb/adsp/
modules/muorb/adsp
)
message(STATUS "modules: ${config_module_list}")
set(${out_module_list} ${config_module_list} PARENT_SCOPE)

View File

@ -1,3 +1,6 @@
#=============================================================================
# module subdirectories, need to include first
#
add_subdirectory(./lib)
add_subdirectory(./drivers)
add_subdirectory(./platforms)
@ -5,5 +8,77 @@ add_subdirectory(./systemcmds)
add_subdirectory(./examples)
add_subdirectory(./modules)
add_subdirectory(./firmware)
#=============================================================================
# executable
#
if (${OS} STREQUAL "nuttx")
# a list of modules that will be linked to main
set(module_list)
if (${LABEL} STREQUAL "simple")
list(APPEND module_list
drivers__led
drivers__device
platforms__common
modules__systemlib
modules__uORB
examples__px4_simple_app
lib__mathlib__math__filter
lib__conversion
)
endif()
if (${LABEL} STREQUAL "simple")
list(APPEND module_list ${module_list_simple})
endif()
list(APPEND module_list
platforms__nuttx
platforms__nuttx__px4_layer
drivers__boards__px4fmu-v2
drivers__stm32
)
px4_nuttx_generate_builtin_commands(
OUT builtin_commands.c
MODULE_LIST ${module_list})
px4_nuttx_generate_romfs(OUT romfs.o
ROOT ROMFS/px4fmu_common)
# add executable
add_executable(main builtin_commands.c romfs.o)
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)
set(main_link_flags
"-T${nuttx_export_dir}/build/ld.script"
"-Wl,-Map=${CMAKE_BINARY_DIR}/main.map"
)
px4_join(OUT main_link_flags LIST ${main_link_flags} GLUE " ")
set_target_properties(main PROPERTIES LINK_FLAGS ${main_link_flags})
target_link_libraries(main
-Wl,--start-group
${module_list}
apps nuttx nosys m gcc
-Wl,--end-group)
px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4
EXE ${CMAKE_CURRENT_BINARY_DIR}/main)
px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD}
BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4)
elseif(${OS} STREQUAL "qurt")
set(module_list)
px4_qurt_add_modules(module_list ${BOARD})
message(STATUS "module list: ${module_list}")
foreach(directory ${module_list})
message(STATUS "directory: ${directory}")
add_subdirectory(${directory} EXCLUDE_FROM_ALL)
endforeach()
endif()
# vim: set noet ft=cmake fenc=utf-8 ff=unix :