forked from Archive/PX4-Autopilot
Simplified config handling.
This commit is contained in:
parent
3d52582dd7
commit
ec209f13f0
|
@ -73,8 +73,8 @@
|
|||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# * Never set global variables in an included cmake file,
|
||||
# you may only define functions. This excludes Toolchain files. This
|
||||
# makes it clear to the user when variables are being set or targets
|
||||
# you may only define functions. This excludes config and Toolchain files.
|
||||
# This makes it clear to the user when variables are being set or targets
|
||||
# are being created.
|
||||
#
|
||||
# * Setting a global variable in a CMakeLists.txt file is ok, because
|
||||
|
@ -133,7 +133,7 @@ set(px4_required_config
|
|||
)
|
||||
foreach(conf ${px4_required_config})
|
||||
if(NOT DEFINED ${conf})
|
||||
message(FATAL_ERROR "${config_module} must define ${conf}")
|
||||
message(FATAL_ERROR "cmake/${config_module} must define ${conf}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
function(px4_get_config)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_set_config_modules
|
||||
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
|
||||
ARGN ${ARGN})
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
|
||||
set(config_module_list
|
||||
|
||||
|
@ -122,30 +117,14 @@ function(px4_get_config)
|
|||
examples/hwtest
|
||||
)
|
||||
|
||||
set(firmware_options
|
||||
set(config_firmware_options
|
||||
PARAM_XML # generate param xml
|
||||
)
|
||||
|
||||
set(extra_cmds serdis_main sercon_main)
|
||||
|
||||
# output
|
||||
if(OUT_MODULES)
|
||||
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (OUT_FW_OPTS)
|
||||
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
function(px4_add_extra_builtin_cmds)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_extra_builtin_cmds
|
||||
ONE_VALUE OUT
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
set(config_extra_builtin_cmds
|
||||
serdis_main
|
||||
sercon_main
|
||||
)
|
||||
|
||||
add_custom_target(sercon)
|
||||
set_target_properties(sercon PROPERTIES
|
||||
|
@ -154,7 +133,3 @@ function(px4_add_extra_builtin_cmds)
|
|||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
|
||||
set(${OUT} sercon serdis PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
|
|
@ -2,12 +2,7 @@ include(nuttx/px4_impl_nuttx)
|
|||
|
||||
message(WARNING "this is a work in progress and doesn't build yet")
|
||||
|
||||
function(px4_get_config)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_set_config_modules
|
||||
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
|
||||
ARGN ${ARGN})
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
|
||||
|
||||
set(config_module_list
|
||||
platforms/nuttx
|
||||
|
@ -22,7 +17,20 @@ function(px4_get_config)
|
|||
lib/conversion
|
||||
)
|
||||
|
||||
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
|
||||
set(config_firmware_options
|
||||
PARAM_XML # generate param xml
|
||||
)
|
||||
|
||||
endfunction()
|
||||
set(config_extra_builtin_cmds
|
||||
serdis_main
|
||||
sercon_main
|
||||
)
|
||||
|
||||
add_custom_target(sercon)
|
||||
set_target_properties(sercon PROPERTIES
|
||||
MAIN "sercon" STACK "2048")
|
||||
|
||||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
include(posix/px4_impl_posix)
|
||||
set(USE_TOOLCHAIN Toolchain-native)
|
||||
|
||||
function(px4_get_config)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_set_config_modules
|
||||
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
|
||||
ARGN ${ARGN})
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/led
|
||||
|
@ -60,30 +54,15 @@ function(px4_get_config)
|
|||
lib/launchdetection
|
||||
)
|
||||
|
||||
set(firmware_options
|
||||
|
||||
set(config_firmware_options
|
||||
PARAM_XML # generate param xml
|
||||
)
|
||||
|
||||
set(extra_cmds serdis_main sercon_main)
|
||||
|
||||
# output
|
||||
if(OUT_MODULES)
|
||||
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (OUT_FW_OPTS)
|
||||
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
function(px4_add_extra_builtin_cmds)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_extra_builtin_cmds
|
||||
ONE_VALUE OUT
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
set(config_extra_builtin_cmds
|
||||
serdis_main
|
||||
sercon_main
|
||||
)
|
||||
|
||||
add_custom_target(sercon)
|
||||
set_target_properties(sercon PROPERTIES
|
||||
|
@ -92,7 +71,3 @@ function(px4_add_extra_builtin_cmds)
|
|||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
|
||||
set(${OUT} sercon serdis PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
|
Loading…
Reference in New Issue