mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
waf: regenerate canard dsdl sources after clean
This commit is contained in:
parent
2223698c47
commit
0b7a913b30
49
wscript
49
wscript
@ -453,22 +453,7 @@ def configure(cfg):
|
|||||||
])
|
])
|
||||||
|
|
||||||
if cfg.env.AP_PERIPH:
|
if cfg.env.AP_PERIPH:
|
||||||
src = cfg.srcnode.ant_glob('modules/pyuavcan/uavcan/dsdl_files/* libraries/AP_UAVCAN/dsdl/*', dir=True, src=False)
|
generate_canard_dsdlc(cfg)
|
||||||
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)
|
||||||
@ -480,6 +465,32 @@ def configure(cfg):
|
|||||||
|
|
||||||
_collect_autoconfig_files(cfg)
|
_collect_autoconfig_files(cfg)
|
||||||
|
|
||||||
|
def generate_canard_dsdlc(cfg, in_configure=True):
|
||||||
|
if in_configure:
|
||||||
|
dsdlc_gen_path = cfg.bldnode.make_node(os.path.join(cfg.variant, 'modules/libcanard/dsdlc_generated')).abspath()
|
||||||
|
else:
|
||||||
|
dsdlc_gen_path = cfg.bldnode.make_node('modules/libcanard/dsdlc_generated').abspath()
|
||||||
|
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(),
|
||||||
|
dsdlc_gen_path,
|
||||||
|
src)
|
||||||
|
if in_configure:
|
||||||
|
cfg.start_msg('Generating DSDL C bindings')
|
||||||
|
else:
|
||||||
|
print("Generating DSDLC for CANARD: " + cmd)
|
||||||
|
ret = subprocess.run(cmd, shell=True, capture_output=True)
|
||||||
|
if ret.returncode != 0:
|
||||||
|
if in_configure:
|
||||||
|
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')
|
||||||
|
elif in_configure:
|
||||||
|
cfg.end_msg('OK')
|
||||||
|
|
||||||
def collect_dirs_to_recurse(bld, globs, **kw):
|
def collect_dirs_to_recurse(bld, globs, **kw):
|
||||||
dirs = []
|
dirs = []
|
||||||
globs = Utils.to_list(globs)
|
globs = Utils.to_list(globs)
|
||||||
@ -684,6 +695,12 @@ def _load_pre_build(bld):
|
|||||||
if bld.cmd == 'clean':
|
if bld.cmd == 'clean':
|
||||||
return
|
return
|
||||||
brd = bld.get_board()
|
brd = bld.get_board()
|
||||||
|
if bld.env.AP_PERIPH:
|
||||||
|
dsdlc_gen_path = bld.bldnode.make_node('modules/libcanard/dsdlc_generated/include').abspath()
|
||||||
|
#check if canard dsdlc directory empty
|
||||||
|
# check if directory exists
|
||||||
|
if not os.path.exists(dsdlc_gen_path) or not os.listdir(dsdlc_gen_path):
|
||||||
|
generate_canard_dsdlc(bld, False)
|
||||||
if getattr(brd, 'pre_build', None):
|
if getattr(brd, 'pre_build', None):
|
||||||
brd.pre_build(bld)
|
brd.pre_build(bld)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user