Skip to content
Permalink
Browse files

scripts: add --cmake-only to west build

This forces CMake to run, but skips running any build system target
afterwards.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
  • Loading branch information...
mbolivar authored and nashif committed May 1, 2019
1 parent 81e005f commit 1f5e6d897f01ba132a1f9be4223bf9a69f6b86c4
Showing with 14 additions and 4 deletions.
  1. +14 −4 scripts/west_commands/build.py
@@ -15,6 +15,12 @@

_ARG_SEPARATOR = '--'

BUILD_USAGE = '''\
west build [-h] [-b BOARD] [-d BUILD_DIR]
[-t TARGET] [-p {auto, always, never}] [-c] [--cmake-only]
[-f] [source_dir] -- [cmake_opt [cmake_opt ...]]
'''

BUILD_DESCRIPTION = '''\
Convenience wrapper for building Zephyr applications.
@@ -104,9 +110,7 @@ def do_add_parser(self, parser_adder):
help=self.help,
formatter_class=argparse.RawDescriptionHelpFormatter,
description=self.description,
usage='''west build [-h] [-b BOARD] [-d BUILD_DIR]
[-t TARGET] [-p {auto, always, never}] [-c] [-f] [source_dir]
-- [cmake_opt [cmake_opt ...]]''')
usage=BUILD_USAGE)

# Remember to update scripts/west-completion.bash if you add or remove
# flags
@@ -133,6 +137,8 @@ def do_add_parser(self, parser_adder):
application.''')
parser.add_argument('-c', '--cmake', action='store_true',
help='Force CMake to run')
parser.add_argument('--cmake-only', action='store_true',
help="Just run CMake; don't build. Implies -c.")
self.add_force_arg(parser)
return parser

@@ -173,7 +179,8 @@ def do_run(self, args, remainder):
self.run_cmake = True
else:
self._update_cache()
if self.args.cmake or self.args.cmake_opts:
if (self.args.cmake or self.args.cmake_opts or
self.args.cmake_only):
self.run_cmake = True
else:
self.run_cmake = True
@@ -182,6 +189,9 @@ def do_run(self, args, remainder):

board, origin = self._find_board()
self._run_cmake(board, origin, self.args.cmake_opts)
if args.cmake_only:
return

self._sanity_check()
self._update_cache()

0 comments on commit 1f5e6d8

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