Browse Source

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>
pull/15891/head
Marti Bolivar 6 years ago committed by Anas Nashif
parent
commit
3a486a85bc
  1. 10
      scripts/west_commands/build.py

10
scripts/west_commands/build.py

@ -18,7 +18,8 @@ _ARG_SEPARATOR = '--' @@ -18,7 +18,8 @@ _ARG_SEPARATOR = '--'
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 @@ class Build(Forceable): @@ -143,6 +144,10 @@ class Build(Forceable):
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 @@ class Build(Forceable): @@ -432,5 +437,8 @@ class Build(Forceable):
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)

Loading…
Cancel
Save