mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-01 13:38:38 -04:00
Tools: create build_examples.py, a replacement for build_examples.sh
This commit is contained in:
parent
cb16d0b6c6
commit
8cf49d4e3e
@ -64,25 +64,45 @@ def deltree(path):
|
||||
def relwaf():
|
||||
return "./modules/waf/waf-light"
|
||||
|
||||
def build_SIL(build_target, j=None, debug=False):
|
||||
'''build desktop SIL'''
|
||||
|
||||
# first configure
|
||||
cmd_configure = [relwaf(), "configure", "--board", 'sitl']
|
||||
def waf_configure(board, j=None, debug=False):
|
||||
cmd_configure = [relwaf(), "configure", "--board", board]
|
||||
if debug:
|
||||
cmd_configure.append('--debug')
|
||||
if j is not None:
|
||||
cmd_configure.extend(['-j', str(j)])
|
||||
run_cmd(cmd_configure, dir=topdir(), checkfail=True)
|
||||
|
||||
# then clean
|
||||
def waf_clean():
|
||||
run_cmd([relwaf(), "clean"], dir=topdir(), checkfail=True)
|
||||
|
||||
def build_SIL(build_target, j=None, debug=False, board='sitl'):
|
||||
'''build desktop SIL'''
|
||||
|
||||
# first configure
|
||||
waf_configure(board, j=j, debug=debug)
|
||||
|
||||
# then clean
|
||||
waf_clean()
|
||||
|
||||
# then build
|
||||
cmd_make = [relwaf(), "build", "--target", build_target]
|
||||
run_cmd(cmd_make, dir=topdir(), checkfail=True, show=True)
|
||||
return True
|
||||
|
||||
def build_examples(board, j=None, debug=False, clean=False):
|
||||
# first configure
|
||||
waf_configure(board, j=j, debug=debug)
|
||||
|
||||
# then clean
|
||||
if clean:
|
||||
waf_clean()
|
||||
|
||||
# then build
|
||||
cmd_make = [relwaf(), "examples"]
|
||||
run_cmd(cmd_make, dir=topdir(), checkfail=True, show=True)
|
||||
return True
|
||||
|
||||
|
||||
# list of pexpect children to close on exit
|
||||
close_list = []
|
||||
|
||||
|
34
Tools/scripts/build_examples.py
Executable file
34
Tools/scripts/build_examples.py
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# useful script to test the build of all example code
|
||||
# This helps when doing large merges
|
||||
# Peter Barker, June 2016
|
||||
# based on build_examples.sh, Andrew Tridgell, November 2012
|
||||
|
||||
import os
|
||||
import sys
|
||||
import optparse
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../autotest/pysim'))
|
||||
|
||||
import util
|
||||
|
||||
class BuildExamples():
|
||||
def __init__(self, targets=[], clean=False):
|
||||
print("init")
|
||||
self.targets = targets
|
||||
self.clean = clean
|
||||
|
||||
def run(self):
|
||||
for target in self.targets:
|
||||
util.build_examples(target, clean=self.clean)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
parser = optparse.OptionParser("build_examples.py")
|
||||
parser.add_option("--target", type='string', default=['navio','px4-v2'], help='list of targets for which to build examples', action='append')
|
||||
parser.add_option("--clean", action='store_true', default=False, help='clean build')
|
||||
opts, args = parser.parse_args()
|
||||
|
||||
buildexamples = BuildExamples(targets=opts.target, clean=opts.clean)
|
||||
buildexamples.run()
|
Loading…
Reference in New Issue
Block a user