Added multiple toolchain and MCU declarations for options -t and -m respectively. Names must be divided by comma.

pull/338/head
Przemek Wirkus 2014-05-30 14:49:19 +01:00
parent 97199bb372
commit 348c71f7f9
1 changed files with 23 additions and 19 deletions

View File

@ -33,10 +33,10 @@ from workspace_tools.build_api import build_mbed_libs, build_lib
if __name__ == '__main__': if __name__ == '__main__':
start = time() start = time()
# Parse Options # Parse Options
parser = get_default_options_parser() parser = get_default_options_parser()
# Extra libraries # Extra libraries
parser.add_option("-r", "--rtos", action="store_true", dest="rtos", parser.add_option("-r", "--rtos", action="store_true", dest="rtos",
default=False, help="Compile the rtos") default=False, help="Compile the rtos")
@ -55,28 +55,32 @@ if __name__ == '__main__':
parser.add_option("-D", "", action="append", dest="macros", parser.add_option("-D", "", action="append", dest="macros",
help="Add a macro definition") help="Add a macro definition")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
# Get target list # Get target list
if options.mcu: if options.mcu:
if options.mcu not in TARGET_NAMES: mcu_list = (options.mcu).split(",")
print "Given MCU '%s' not into the supported list:\n%s" % (options.mcu, TARGET_NAMES) for mcu in mcu_list:
sys.exit(1) if mcu not in TARGET_NAMES:
targets = [options.mcu] print "Given MCU '%s' not into the supported list:\n%s" % (mcu, TARGET_NAMES)
sys.exit(1)
targets = mcu_list
else: else:
targets = TARGET_NAMES targets = TARGET_NAMES
# Get toolchains list # Get toolchains list
if options.tool: if options.tool:
if options.tool not in TOOLCHAINS: toolchain_list = (options.tool).split(",")
print "Given toolchain '%s' not into the supported list:\n%s" % (options.tool, TOOLCHAINS) for tc in toolchain_list:
sys.exit(1) if tc not in TOOLCHAINS:
toolchains = [options.tool] print "Given toolchain '%s' not into the supported list:\n%s" % (tc, TOOLCHAINS)
sys.exit(1)
toolchains = toolchain_list
else: else:
toolchains = TOOLCHAINS toolchains = TOOLCHAINS
# Get libraries list # Get libraries list
libraries = [] libraries = []
# Additional Libraries # Additional Libraries
if options.rtos: if options.rtos:
libraries.extend(["rtx", "rtos"]) libraries.extend(["rtx", "rtos"])
@ -90,7 +94,7 @@ if __name__ == '__main__':
libraries.extend(["cmsis_dsp", "dsp"]) libraries.extend(["cmsis_dsp", "dsp"])
if options.ublox: if options.ublox:
libraries.extend(["rtx", "rtos", "usb_host", "ublox"]) libraries.extend(["rtx", "rtos", "usb_host", "ublox"])
# Build # Build
failures = [] failures = []
successes = [] successes = []
@ -112,17 +116,17 @@ if __name__ == '__main__':
import sys, traceback import sys, traceback
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
sys.exit(1) sys.exit(1)
failures.append(id) failures.append(id)
print e print e
# Write summary of the builds # Write summary of the builds
print "\n\nCompleted in: (%.2f)s" % (time() - start) print "\n\nCompleted in: (%.2f)s" % (time() - start)
if successes: if successes:
print "\n\nBuild successes:" print "\n\nBuild successes:"
print "\n".join([" * %s" % s for s in successes]) print "\n".join([" * %s" % s for s in successes])
if failures: if failures:
print "\n\nBuild failures:" print "\n\nBuild failures:"
print "\n".join([" * %s" % f for f in failures]) print "\n".join([" * %s" % f for f in failures])