xtensa-build-zephyr: fix incremental build, pass CMAKE_ARGS only once

As documented in
https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
and accidentally found when testing rimage cleanup
https://github.com/zephyrproject-rtos/zephyr/pull/40431

Fixes commit 88327f618c ("xtensa-build-zephyr: support passing through
CMake arguments"); ccache is too good and hid this regression from me.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2021-11-18 01:13:09 +00:00 committed by Liam Girdwood
parent d4b8a01f20
commit b9fcc4156e
1 changed files with 13 additions and 2 deletions

View File

@ -241,10 +241,21 @@ build_platforms()
# west can get lost in symbolic links and then
# show a confusing error.
/bin/pwd
set -x
west build --build-dir "$bdir" --board "$PLAT_CONFIG" \
if test -d "$bdir"; then
test -z "${CMAKE_ARGS+defined}" ||
die 'Cannot re-define CMAKE_ARGS, you must delete %s first\n' \
"$(pwd)/$bdir"
# --board is cached and not required again either but unlike
# CMAKE_ARGS this _not_ does force CMake to re-run and passing
# a different board by mistake is very nicely caught by west.
set -x
west build --build-dir "$bdir" --board "$PLAT_CONFIG"
else
set -x
west build --build-dir "$bdir" --board "$PLAT_CONFIG" \
zephyr/samples/subsys/audio/sof \
-- "${CMAKE_ARGS[@]}"
fi
# This should ideally be part of
# sof/zephyr/CMakeLists.txt but due to the way