forked from Archive/PX4-Autopilot
simplify param scoping and centralize dependencies
This commit is contained in:
parent
e5cc1237e3
commit
fc80846825
|
@ -397,33 +397,22 @@ execute_process(COMMAND cmake -E make_directory ${ep_base}/Install/include)
|
|||
#=============================================================================
|
||||
# external modules
|
||||
#
|
||||
set(external_module_paths)
|
||||
if (NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
|
||||
message(STATUS "External modules: ${EXTERNAL_MODULES_LOCATION}")
|
||||
add_subdirectory("${EXTERNAL_MODULES_LOCATION}/src" external_modules_src)
|
||||
add_subdirectory("${EXTERNAL_MODULES_LOCATION}/src" external_modules)
|
||||
|
||||
set(config_module_list_external_expanded)
|
||||
foreach(external_module ${config_module_list_external})
|
||||
list(APPEND config_module_list_external_expanded
|
||||
${EXTERNAL_MODULES_LOCATION}/src/${external_module})
|
||||
add_subdirectory(${EXTERNAL_MODULES_LOCATION}/src/${external_module} external_modules/${external_module})
|
||||
list(APPEND external_module_paths ${EXTERNAL_MODULES_LOCATION}/src/${external_module})
|
||||
endforeach()
|
||||
set(config_module_list
|
||||
${config_module_list}
|
||||
${config_module_list_external_expanded}
|
||||
)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# subdirectories
|
||||
#
|
||||
foreach(module ${config_module_list})
|
||||
string(REGEX MATCH "^[./]" external_module ${module})
|
||||
if (external_module)
|
||||
STRING(REGEX REPLACE "//" "/" EXT_MODULE ${module})
|
||||
STRING(REGEX REPLACE "/" "__" EXT_MODULE_PREFIX ${EXT_MODULE})
|
||||
add_subdirectory(${module} ${PX4_BINARY_DIR}/${EXT_MODULE_PREFIX})
|
||||
else()
|
||||
add_subdirectory(src/${module})
|
||||
endif()
|
||||
add_subdirectory(src/${module})
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(src/firmware/${OS})
|
||||
|
|
4
Makefile
4
Makefile
|
@ -244,8 +244,8 @@ coverity_scan: posix_sitl_default
|
|||
.PHONY: parameters_metadata airframe_metadata module_documentation px4_metadata
|
||||
|
||||
parameters_metadata:
|
||||
@python $(SRC_DIR)/Tools/px_process_params.py -s `find $(SRC_DIR)/src -maxdepth 3 -type d` --inject-xml $(SRC_DIR)/Tools/parameters_injected.xml --markdown
|
||||
@python $(SRC_DIR)/Tools/px_process_params.py -s `find $(SRC_DIR)/src -maxdepth 3 -type d` --inject-xml $(SRC_DIR)/Tools/parameters_injected.xml --xml
|
||||
@python $(SRC_DIR)/src/modules/systemlib/param/px_process_params.py -s `find $(SRC_DIR)/src -maxdepth 3 -type d` --inject-xml $(SRC_DIR)/src/modules/systemlib/param/parameters_injected.xml --markdown
|
||||
@python $(SRC_DIR)/src/modules/systemlib/param/px_process_params.py -s `find $(SRC_DIR)/src -maxdepth 3 -type d` --inject-xml $(SRC_DIR)/src/modules/systemlib/param/parameters_injected.xml --xml
|
||||
|
||||
airframe_metadata:
|
||||
@python $(SRC_DIR)/Tools/px_process_airframes.py -v -a $(SRC_DIR)/ROMFS/px4fmu_common/init.d --markdown
|
||||
|
|
|
@ -51,7 +51,10 @@ endif()
|
|||
set(module_list)
|
||||
if (DISABLE_PARAMS_MODULE_SCOPING)
|
||||
# search all directories with .c files (potentially containing parameters)
|
||||
file(GLOB_RECURSE new_list ${PX4_SOURCE_DIR}/src/*.c)
|
||||
file(GLOB_RECURSE new_list
|
||||
${PX4_SOURCE_DIR}/src/*.c
|
||||
${external_module_paths}
|
||||
)
|
||||
foreach(file_path ${new_list})
|
||||
get_filename_component(dir_path ${file_path} PATH)
|
||||
list(APPEND module_list "${dir_path}")
|
||||
|
@ -61,17 +64,21 @@ else()
|
|||
foreach(module ${config_module_list})
|
||||
list(APPEND module_list ${PX4_SOURCE_DIR}/src/${module})
|
||||
endforeach()
|
||||
list(APPEND module_list
|
||||
${external_module_paths}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(parameters_xml ${PX4_BINARY_DIR}/parameters.xml)
|
||||
file(GLOB_RECURSE param_src_files ${PX4_SOURCE_DIR}/src/*params.c)
|
||||
add_custom_command(OUTPUT ${parameters_xml}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_process_params.py
|
||||
-s ${module_list} ${EXTERNAL_MODULES_LOCATION}
|
||||
--board CONFIG_ARCH_${BOARD} --xml --inject-xml
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/px_process_params.py
|
||||
--src-path ${module_list}
|
||||
--xml ${parameters_xml}
|
||||
--inject-xml ${CMAKE_CURRENT_SOURCE_DIR}/parameters_injected.xml
|
||||
--overrides ${PARAM_DEFAULT_OVERRIDES}
|
||||
DEPENDS ${param_src_files} ${PX4_SOURCE_DIR}/Tools/px_process_params.py
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
||||
#--verbose
|
||||
DEPENDS ${param_src_files} px_process_params.py parameters_injected.xml
|
||||
COMMENT "Generating parameters.xml"
|
||||
)
|
||||
add_custom_target(parameters_xml DEPENDS ${parameters_xml})
|
||||
|
@ -82,12 +89,10 @@ add_custom_command(OUTPUT px4_parameters.c px4_parameters.h
|
|||
--xml ${parameters_xml} --dest ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS
|
||||
${PX4_BINARY_DIR}/parameters.xml
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/px_generate_params.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/templates/px4_parameters.c.jinja
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/templates/px4_parameters.h.jinja
|
||||
px_generate_params.py
|
||||
templates/px4_parameters.c.jinja
|
||||
templates/px4_parameters.h.jinja
|
||||
)
|
||||
set_source_files_properties(px4_parameters.c PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(px4_parameters.h PROPERTIES GENERATED TRUE)
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__systemlib__param
|
||||
|
@ -102,4 +107,3 @@ px4_add_module(
|
|||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
|
Loading…
Reference in New Issue