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
This commit is contained in:
Andrew Tridgell 2021-08-01 07:45:36 +10:00
parent 67876e94e0
commit 8674409986
1 changed files with 11 additions and 0 deletions

View File

@ -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: