mirror of https://github.com/ArduPilot/ardupilot
waf: mavgen: use output_dir instead of target
The option target for the waf task generator is meant for actual files that are going to be build. Since our target files are dynamic, let's change the code to use a new parameter output_dir instead.
This commit is contained in:
parent
282c254897
commit
46449ee032
|
@ -13,7 +13,7 @@ import os
|
|||
class mavgen(Task.Task):
|
||||
"""generate mavlink header files"""
|
||||
color = 'GREEN'
|
||||
run_str = '${PYTHON} ${MAVGEN} --lang=C --wire-protocol=1.0 --output ${TGT} ${SRC}'
|
||||
run_str = '${PYTHON} ${MAVGEN} --lang=C --wire-protocol=1.0 --output ${OUTPUT_DIR} ${SRC}'
|
||||
before = 'cxx c'
|
||||
|
||||
def post_run(self):
|
||||
|
@ -27,18 +27,19 @@ def options(opt):
|
|||
@feature('mavgen')
|
||||
@before_method('process_source')
|
||||
def process_mavgen(self):
|
||||
if not hasattr(self, 'output_dir'):
|
||||
self.bld.fatal('mavgen: missing option output_dir')
|
||||
|
||||
inputs = self.to_nodes(self.source)
|
||||
outputs = []
|
||||
|
||||
self.target = Utils.to_list(getattr(self, 'target', []))
|
||||
for t in self.target:
|
||||
if not isinstance(t, Node.Node):
|
||||
t = self.bld.bldnode.find_or_declare(t)
|
||||
outputs.append(t)
|
||||
|
||||
self.source = []
|
||||
|
||||
if not isinstance(self.output_dir, Node.Node):
|
||||
self.output_dir = self.bld.bldnode.find_or_declare(self.output_dir)
|
||||
|
||||
task = self.create_task('mavgen', inputs, outputs)
|
||||
task.env['OUTPUT_DIR'] = self.output_dir.abspath()
|
||||
|
||||
task.env.env = dict(os.environ)
|
||||
task.env.env['PYTHONPATH'] = task.env.MAVLINK_DIR
|
||||
|
|
2
wscript
2
wscript
|
@ -122,7 +122,7 @@ def build(bld):
|
|||
bld(
|
||||
features='mavgen',
|
||||
source='modules/mavlink/message_definitions/v1.0/ardupilotmega.xml',
|
||||
target='libraries/GCS_MAVLink/include/mavlink/v1.0/',
|
||||
output_dir='libraries/GCS_MAVLink/include/mavlink/v1.0/',
|
||||
name='mavlink',
|
||||
# this below is not ideal, mavgen tool should set this, but that's not
|
||||
# currently possible
|
||||
|
|
Loading…
Reference in New Issue