Skip to content

Commit 6439bfe

Browse files
committed
[nrf fromlist] west: update build extension command to use APP_DIR
`west build` can be invoked without specifying the source directory when being invoked from the source directory itself. When using `west build` for incremental builds, then the build command will examine the CMake cache to determine the application dir by using the value of CMAKE_HOME_DIRECTORY. With sysbuild, this leads to the wrong assumption that the sysbuild itself is the application to build. Instead, have west build look for APP_DIR which points to the correct source dir when sysbuild is used. Use APPLICATION_SOURCE_DIR when APP_DIR is not set, as this indicates a no-sysbuild build. Keep CMAKE_HOME_DIRECTORY behavior as last fallback mechanism. Upstream PR: zephyrproject-rtos/zephyr#74230 Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 2385766 commit 6439bfe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/west_commands/build.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,14 @@ def _find_source_dir(self):
429429
if self.args.source_dir:
430430
source_dir = self.args.source_dir
431431
elif self.cmake_cache:
432-
source_dir = self.cmake_cache.get('CMAKE_HOME_DIRECTORY')
432+
source_dir = self.cmake_cache.get('APP_DIR')
433+
434+
if not source_dir:
435+
source_dir = self.cmake_cache.get('APPLICATION_SOURCE_DIR')
436+
437+
if not source_dir:
438+
source_dir = self.cmake_cache.get('CMAKE_HOME_DIRECTORY')
439+
433440
if not source_dir:
434441
# This really ought to be there. The build directory
435442
# must be corrupted somehow. Let's see what we can do.

0 commit comments

Comments
 (0)