events: pass relative paths plus base path to source parser script (#22551)
* events: pass relative paths plus base path to source parser script to work around maximum Makefile command lenght limits. * events: correct cmake comment typo Co-authored-by: Beat Küng <beat-kueng@gmx.net> --------- Co-authored-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
parent
f38fe24a98
commit
6ffc5a9eae
|
@ -148,6 +148,7 @@ define_property(GLOBAL PROPERTY PX4_MODULE_PATHS
|
|||
BRIEF_DOCS "PX4 module paths"
|
||||
FULL_DOCS "List of paths to all PX4 modules"
|
||||
)
|
||||
|
||||
define_property(GLOBAL PROPERTY PX4_SRC_FILES
|
||||
BRIEF_DOCS "src files from all PX4 modules & libs"
|
||||
FULL_DOCS "SRC files from px4_add_{module,library}"
|
||||
|
|
|
@ -55,6 +55,10 @@ def main():
|
|||
metavar="PATH",
|
||||
nargs='*',
|
||||
help="one or more paths/files to source files to scan for events")
|
||||
parser.add_argument("-b", "--base-path",
|
||||
default=[""],
|
||||
metavar="PATH",
|
||||
help="path prefix for everything passed with --src-path")
|
||||
parser.add_argument("-j", "--json",
|
||||
nargs='?',
|
||||
const="events.json",
|
||||
|
@ -84,7 +88,7 @@ def main():
|
|||
# canonicalize + remove duplicates
|
||||
src_paths = set()
|
||||
for path in args.src_path:
|
||||
src_paths.add(os.path.realpath(path))
|
||||
src_paths.add(os.path.realpath(os.path.join(args.base_path, path)))
|
||||
|
||||
if not scanner.ScanDir(src_paths, parser):
|
||||
sys.exit(1)
|
||||
|
|
|
@ -35,13 +35,21 @@ px4_add_git_submodule(TARGET git_libevents PATH "libevents")
|
|||
|
||||
get_property(all_px4_src_files GLOBAL PROPERTY PX4_SRC_FILES)
|
||||
|
||||
# Use relative path list to work around Makefile command character limit
|
||||
set(all_px4_src_files_relative "")
|
||||
foreach(f ${all_px4_src_files})
|
||||
file(RELATIVE_PATH relative_path ${PX4_SOURCE_DIR}/src ${f})
|
||||
list(APPEND all_px4_src_files_relative "${relative_path}")
|
||||
endforeach(f)
|
||||
|
||||
set(generated_events_dir ${PX4_BINARY_DIR}/events)
|
||||
set(generated_events_px4_file ${generated_events_dir}/px4.json)
|
||||
set(generated_events_common_enums_file ${generated_events_dir}/common_with_enums.json)
|
||||
add_custom_command(OUTPUT ${generated_events_px4_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${generated_events_dir}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_process_events.py
|
||||
--src-path ${all_px4_src_files}
|
||||
--base-path ${PX4_SOURCE_DIR}/src
|
||||
--src-path ${all_px4_src_files_relative}
|
||||
--json ${generated_events_px4_file} #--verbose
|
||||
DEPENDS
|
||||
${all_px4_src_files}
|
||||
|
|
Loading…
Reference in New Issue