From 1376ae48575e87b6140cc82dbc6bb9f329897d3a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 1 Aug 2021 07:45:36 +1000 Subject: [PATCH] waf: add files from ROMFS_custom to ROMFS this allows for lua scripts in the root of the source tree as ROMFS_custom/scripts/*.lua it also allows for any other custom data files that may be needed. This is cleaner for custom scripts than having the files in AP_HAL_ChibiOS/hwdef/BOARD/scripts, and allows for the same scripts working in SITL, Linux and ChibiOS --- Tools/ardupilotwaf/boards.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index d252d188f2..309a313031 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -347,6 +347,17 @@ class Board: if cfg.options.ekf_single: env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=0'] + # add files from ROMFS_custom + custom_dir = 'ROMFS_custom' + if os.path.exists(custom_dir): + for root, subdirs, files in os.walk(custom_dir): + for f in files: + if fnmatch.fnmatch(f,"*~"): + # exclude emacs tmp files + continue + fname = root[len(custom_dir)+1:]+"/"+f + env.ROMFS_FILES += [(fname,root+"/"+f)] + def pre_build(self, bld): '''pre-build hook that gets called before dynamic sources''' if bld.env.ROMFS_FILES: