xtensa-build-zephyr.py: downgrade --cmake-args restriction to a warning

--cmake-args is actually safe, just a bit slower. See explanation in
https://github.com/zephyrproject-rtos/zephyr/pull/56671

Fixes unnecessary restriction added by commit 9fb7a607eb
("xtensa-build-zephyr.py: fix -C option so it can support whitespace")

Also warn for overlays because they act the same.

Log the `west config` due to the suggestion to use build.cmake-args and
the recent rimage changes in Zephyr PR 54700

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2023-04-12 22:17:02 +00:00 committed by Kai Vehmanen
parent 7e19dfb5fa
commit 192700181c
1 changed files with 14 additions and 8 deletions

View File

@ -620,15 +620,21 @@ def build_platforms():
overlays = ";".join(overlays)
build_cmd.append(f"-DOVERLAY_CONFIG={overlays}")
# https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
# https://github.com/zephyrproject-rtos/zephyr/pull/40431#issuecomment-975992951
abs_build_dir = pathlib.Path(west_top, platform_build_dir_name)
if (pathlib.Path(abs_build_dir, "build.ninja").is_file()
or pathlib.Path(abs_build_dir, "Makefile").is_file()):
if args.cmake_args and not args.pristine:
print(args.cmake_args)
raise RuntimeError("Some CMake arguments are ignored in incremental builds, "
+ f"you must delete {abs_build_dir} first")
# Longer story in https://github.com/zephyrproject-rtos/zephyr/pull/56671
if not args.pristine and (
pathlib.Path(abs_build_dir, "build.ninja").is_file()
or pathlib.Path(abs_build_dir, "Makefile").is_file()
):
if args.cmake_args or overlays:
warnings.warn("""CMake args slow down incremental builds.
Passing CMake parameters and overlays on the command line slows down incremental builds
see https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
Try "west config build.cmake-args -- ..." instead.""")
# Make sure the build logs don't leave anything hidden
execute_command(['west', 'config', '-l'], cwd=west_top)
# Build
try: