diff --git a/tools/project.py b/tools/project.py index faf28b9fcc..4fb905fbe1 100644 --- a/tools/project.py +++ b/tools/project.py @@ -39,7 +39,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None): if source_dir: # --source is used to generate IDE files to toolchain directly # in the source tree and doesn't generate zip file - project_dir = join(source_dir[0],'projectfiles',ide+"_"+target) + project_dir = source_dir[0] if program: project_name = TESTS[program] else: @@ -63,7 +63,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None): def export(target, ide, build=None, src=None, macros=None, project_id=None, - clean=False, zip_proj=False): + clean=False, zip_proj=False, options=None): """Do an export of a project. Positional arguments: @@ -84,7 +84,7 @@ def export(target, ide, build=None, src=None, macros=None, project_id=None, zip_name = name+".zip" if zip_proj else None export_project(src, project_dir, target, ide, clean=clean, name=name, - macros=macros, libraries_paths=lib, zip_proj=zip_name) + macros=macros, libraries_paths=lib, zip_proj=zip_name, options=options) def main(): @@ -100,8 +100,7 @@ def main(): parser.add_argument("-m", "--mcu", metavar="MCU", default='LPC1768', - type=argparse_many( - argparse_force_uppercase_type(targetnames, "MCU")), + type=argparse_force_uppercase_type(targetnames, "MCU"), help="generate project for the given MCU ({})".format( ', '.join(targetnames))) @@ -165,6 +164,12 @@ def main(): dest="macros", help="Add a macro definition") + parser.add_argument("-o", + type=argparse_many(str), + dest="opts", + default=["debug-info"], + help="Toolchain options") + options = parser.parse_args() # Print available tests in order and exit @@ -212,10 +217,10 @@ def main(): if (options.program is None) and (not options.source_dir): args_error(parser, "one of -p, -n, or --source is required") # Export to selected toolchain - for mcu in options.mcu: - export(mcu, options.ide, build=options.build, src=options.source_dir, - macros=options.macros, project_id=options.program, - clean=options.clean, zip_proj=zip_proj) + export(options.mcu, options.ide, build=options.build, + src=options.source_dir, macros=options.macros, + project_id=options.program, clean=options.clean, + zip_proj=zip_proj, options=options.opts) if __name__ == "__main__":