`west` is an optional tool.
Although `west` is optional, a developer might be working with both west
and non-west based projects, like
- vanilla Zephyr (using west)
- downstream project (not using west)
and thus have west installed, but not always in use.
In the downstream project scenario not using west, then running CMake
will print the following error:
```
FATAL ERROR: no west workspace found from "<path>/zephyr";
"west topdir" requires one.
Things to try:
- Change directory to somewhere inside a west workspace and retry.
- Set ZEPHYR_BASE to a zephyr repository path in a west workspace.
- Run "west init" to set up a workspace here.
- Run "west init -h" for additional information.
```
This commit sets `WEST` CMake variable to `WEST-NOTFOUND` when west is
found but Zephyr is not in a west workspace (`west topdir` fails)
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Commit 79b1f89f7d causes the WEST
variable to no longer cached in the CMakeCache. However,
the Eclipse plugin needs this WEST variable so that it can
invoke west properly. So tell CMake to put it in the cache.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Starting with west 0.8, we will have a stable way to run west as a
python module. In west 0.7, we have an undocumented way.
Handle these two cases to override the WEST variable used by the build
system to run west inside the same python interpreter as the rest of
the build system. This makes it intuitive to shell out to west from
elsewhere in the build, without making people reimplement existing
commands in the west API when it is not necessary.
Do so for the 'west topdir' invocation in west.cmake as an example.
The check that looks for whether PYTHON_EXECUTABLE and WEST_PYTHON
match is also not working properly when symbolic links are in use.
Fix it by using REALPATH instead of ABSOLUTE in the
get_filename_component() calls.
Finally, print the error on a failed import that we expect to work.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The `WEST_PYTHON` reported by west (python) may use a different path
style (casing and separator) than the path style in CMake
find_package(Python3).
This may result in following additional error text when west version is
not meeting the minimum required version:
The Python version used by west is: c:\python37\python.exe
The Python version used by CMake is: C:/Python37/python.exe
This might be correct, but please verify your installation.
Using `get_filename_component` will return the path in same style as
CMake find_package(Python3).
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #25215
This commit introduces the possibility of defining ROOTs in a Zephyr
module and have it automatically appended to list of other ROOTs.
Supported with this commit:
- BOARD_ROOT
- SOC_ROOT
- DTS_ROOT
- ARCH_ROOT
In order to support this in Zephyr module files, the detection of west
has been moved to dedicated west.cmake file and included immediately
after python.cmake.
Also the inclusion of zephyr_modules.cmake has moved before first use
of BOARD_ROOT.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>