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


# Remember to update scripts/west-completion.bash if you add or remove # Remember to update scripts/west-completion.bash if you add or remove
# flags # flags
@@ -133,6 +137,8 @@ def do_add_parser(self, parser_adder):
application.''') application.''')
parser.add_argument('-c', '--cmake', action='store_true', parser.add_argument('-c', '--cmake', action='store_true',
help='Force CMake to run') 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) self.add_force_arg(parser)
return parser return parser


@@ -173,7 +179,8 @@ def do_run(self, args, remainder):
self.run_cmake = True self.run_cmake = True
else: else:
self._update_cache() 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 self.run_cmake = True
else: else:
self.run_cmake = True self.run_cmake = True
@@ -182,6 +189,9 @@ def do_run(self, args, remainder):


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

self._sanity_check() self._sanity_check()
self._update_cache() self._update_cache()


0 comments on commit 1f5e6d8

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