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