diff --git a/CMakeLists.txt b/CMakeLists.txt index 510c94de4d..c11d61bef6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/Makefile b/Makefile index cda0743d21..edcdcc07d0 100644 --- a/Makefile +++ b/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 diff --git a/src/modules/systemlib/param/CMakeLists.txt b/src/modules/systemlib/param/CMakeLists.txt index e05e979c3c..f223694058 100644 --- a/src/modules/systemlib/param/CMakeLists.txt +++ b/src/modules/systemlib/param/CMakeLists.txt @@ -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 : diff --git a/Tools/parameters_injected.xml b/src/modules/systemlib/param/parameters_injected.xml similarity index 100% rename from Tools/parameters_injected.xml rename to src/modules/systemlib/param/parameters_injected.xml diff --git a/Tools/px4params/README.md b/src/modules/systemlib/param/px4params/README.md similarity index 100% rename from Tools/px4params/README.md rename to src/modules/systemlib/param/px4params/README.md diff --git a/Tools/px4params/__init__.py b/src/modules/systemlib/param/px4params/__init__.py similarity index 100% rename from Tools/px4params/__init__.py rename to src/modules/systemlib/param/px4params/__init__.py diff --git a/Tools/px4params/dokuwikiout.py b/src/modules/systemlib/param/px4params/dokuwikiout.py similarity index 100% rename from Tools/px4params/dokuwikiout.py rename to src/modules/systemlib/param/px4params/dokuwikiout.py diff --git a/Tools/px4params/dokuwikirpc.py b/src/modules/systemlib/param/px4params/dokuwikirpc.py similarity index 100% rename from Tools/px4params/dokuwikirpc.py rename to src/modules/systemlib/param/px4params/dokuwikirpc.py diff --git a/Tools/px4params/markdownout.py b/src/modules/systemlib/param/px4params/markdownout.py similarity index 100% rename from Tools/px4params/markdownout.py rename to src/modules/systemlib/param/px4params/markdownout.py diff --git a/Tools/px4params/scope.py b/src/modules/systemlib/param/px4params/scope.py similarity index 100% rename from Tools/px4params/scope.py rename to src/modules/systemlib/param/px4params/scope.py diff --git a/Tools/px4params/srcparser.py b/src/modules/systemlib/param/px4params/srcparser.py similarity index 100% rename from Tools/px4params/srcparser.py rename to src/modules/systemlib/param/px4params/srcparser.py diff --git a/Tools/px4params/srcscanner.py b/src/modules/systemlib/param/px4params/srcscanner.py similarity index 100% rename from Tools/px4params/srcscanner.py rename to src/modules/systemlib/param/px4params/srcscanner.py diff --git a/Tools/px4params/xmlout.py b/src/modules/systemlib/param/px4params/xmlout.py similarity index 100% rename from Tools/px4params/xmlout.py rename to src/modules/systemlib/param/px4params/xmlout.py diff --git a/Tools/px_process_params.py b/src/modules/systemlib/param/px_process_params.py similarity index 100% rename from Tools/px_process_params.py rename to src/modules/systemlib/param/px_process_params.py