waf: setup to use new canard dsdl generator

This commit is contained in:
bugobliterator 2021-09-30 00:05:18 +05:30 committed by Andrew Tridgell
parent d1d3dee7f1
commit e26f429557
1 changed files with 19 additions and 1 deletions

20
wscript
View File

@ -452,6 +452,24 @@ def configure(cfg):
'SKETCHBOOK="' + cfg.srcnode.abspath() + '"', 'SKETCHBOOK="' + cfg.srcnode.abspath() + '"',
]) ])
if cfg.env.AP_PERIPH:
src = cfg.srcnode.ant_glob('modules/pyuavcan/uavcan/dsdl_files/* libraries/AP_UAVCAN/dsdl/*', dir=True, src=False)
src = ' '.join([s.abspath() for s in src])
cmd = '{} {} -O {} {}'.format(cfg.env.get_flat('PYTHON'),
cfg.srcnode.make_node('Tools/canard_dsdlc/canard_dsdlc.py').abspath(),
cfg.bldnode.make_node(cfg.variant + '/modules/libcanard/dsdlc_generated').abspath(),
src)
cfg.start_msg('Generating DSDL C bindings')
ret = subprocess.run(cmd, shell=True, capture_output=True)
if ret.returncode != 0:
cfg.end_msg('failed', color='RED')
print('Failed to run: ', cmd)
print(ret.stdout.decode('utf-8'))
print(ret.stderr.decode('utf-8'))
raise RuntimeError('Failed to generate DSDL C bindings')
else:
cfg.end_msg('OK')
# Always use system extensions # Always use system extensions
cfg.define('_GNU_SOURCE', 1) cfg.define('_GNU_SOURCE', 1)
@ -550,7 +568,7 @@ def _build_dynamic_sources(bld):
], ],
) )
if bld.get_board().with_can or bld.env.HAL_NUM_CAN_IFACES: if (bld.get_board().with_can or bld.env.HAL_NUM_CAN_IFACES) and not bld.env.AP_PERIPH:
bld( bld(
features='uavcangen', features='uavcangen',
source=bld.srcnode.ant_glob('modules/uavcan/dsdl/* libraries/AP_UAVCAN/dsdl/*', dir=True, src=False), source=bld.srcnode.ant_glob('modules/uavcan/dsdl/* libraries/AP_UAVCAN/dsdl/*', dir=True, src=False),