Skip to content
Permalink
Browse files

scripts: add --build-opt option to west build

This allows passing arguments to the underlying build tool (ninja,
make, etc.).

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
  • Loading branch information...
mbolivar authored and nashif committed May 4, 2019
1 parent 8465cf2 commit 3a486a85bcc33c6485264962a2f140b7da74817c
Showing with 9 additions and 1 deletion.
  1. +9 −1 scripts/west_commands/build.py
@@ -18,7 +18,8 @@
BUILD_USAGE = '''\
west build [-h] [-b BOARD] [-d BUILD_DIR]
[-t TARGET] [-p {auto, always, never}] [-c] [--cmake-only]
[-n] [-f] [source_dir] -- [cmake_opt [cmake_opt ...]]
[-n] [-o BUILD_OPT] [-f]
[source_dir] -- [cmake_opt [cmake_opt ...]]
'''

BUILD_DESCRIPTION = '''\
@@ -143,6 +144,10 @@ def do_add_parser(self, parser_adder):
dest='dry_run', action='store_true',
help='''Just print the build commands which would
have run, without actually running them.''')
parser.add_argument('-o', '--build-opt', default=[], action='append',
help='''Options to pass to the build tool.
May be given more than once to append multiple
values.''')
self.add_force_arg(parser)
return parser

@@ -432,5 +437,8 @@ def _run_pristine(self):

def _run_build(self, target):
extra_args = ['--target', target] if target else []
if self.args.build_opt:
extra_args.append('--')
extra_args.extend(self.args.build_opt)
run_build(self.build_dir, extra_args=extra_args,
dry_run=self.args.dry_run)

0 comments on commit 3a486a8

Please sign in to comment.
You can’t perform that action at this time.