Skip to content
Permalink
Browse files

scripts: add build.generator config option for west build

This can be used to override the default CMake generator
permanently. Its values are the same as those acceptable to cmake's -G
option.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
  • Loading branch information...
mbolivar authored and nashif committed May 1, 2019
1 parent 1f5e6d8 commit bbe890ab30b8222cf028f9140245f4f188c74e47
Showing with 11 additions and 1 deletion.
  1. +9 −0 doc/guides/west/build-flash-debug.rst
  2. +2 −1 scripts/west_commands/build.py
@@ -109,6 +109,8 @@ To let west decide for you if a pristine build is needed, use ``-p auto``::
You can run ``west config build.pristine auto`` to make this setting
permanent.

.. _west-building-generator:

To add additional arguments to the CMake invocation performed by ``west
build``, pass them after a ``--`` at the end of the command line.

@@ -160,6 +162,10 @@ You can :ref:`configure <west-config-cmd>` ``west build`` using these options.
* - ``build.board_warn``
- Boolean, default ``true``. If ``false``, disables warnings when
``west build`` can't figure out the target board.
* - ``build.generator``
- String, default ``Ninja``. The `CMake Generator`_ to use to create a
build system. (To set a generator for a single build, see the
:ref:`above example <west-building-generator>`)
* - ``build.pristine``
- String. Controls the way in which ``west build`` may clean the build
folder before building. Can take the following values:
@@ -443,3 +449,6 @@ commands do it).

.. _CMAKE_VERBOSE_MAKEFILE:
https://cmake.org/cmake/help/latest/variable/CMAKE_VERBOSE_MAKEFILE.html

.. _CMake Generator:
https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html
@@ -403,7 +403,8 @@ def _run_cmake(self, board, origin, cmake_opts):
# west build -- -DOVERLAY_CONFIG=relative-path.conf
final_cmake_args = ['-B{}'.format(self.build_dir),
'-S{}'.format(self.source_dir),
'-G{}'.format(DEFAULT_CMAKE_GENERATOR)]
'-G{}'.format(config_get('generator',
DEFAULT_CMAKE_GENERATOR))]
if cmake_opts:
final_cmake_args.extend(cmake_opts)
run_cmake(final_cmake_args)

0 comments on commit bbe890a

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