0d5e6c13e9
Remove the boards and shields lists from the 'usage' target output. That might have been readable at some point long ago in Zephyr's history, when only a few boards were available, but right now it's obscuring the high level targets we really want 'usage' to print. Instead, add 'boards' and 'shields' targets which the user can run to get those lists, and reference them from the 'usage' output. This makes 'usage' squintable again. We use the new list_boards.py script from the 'boards' target. Reference the 'help' target from 'usage' as well, and drop the recommendation that people run '--target help' from the 'west build --help' output for the 'west build --target' option. The canonical place to look is 'usage' now. Use the new list_boards.py code from 'west boards' as well, which allows us to add the board's directory as a format string key, in addition to its name and architecture. Keep west-completion.bash up to date. While doing that, I noticed that a bunch of references to this file refer to a stale location, so fix those too. Finally, the 'usage' output is what we print for a failed board or shield lookup, so that needs to be updated also. Handle that by invoking boards.cmake and a new shields.cmake in CMake script mode to print the relevant output. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
41 lines
1.2 KiB
CMake
41 lines
1.2 KiB
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
set(arch_root_args)
|
|
foreach(root ${ARCH_ROOT})
|
|
list(APPEND arch_root_args "--arch-root=${root}")
|
|
endforeach()
|
|
|
|
set(board_root_args)
|
|
foreach(root ${BOARD_ROOT})
|
|
list(APPEND board_root_args "--board-root=${root}")
|
|
endforeach()
|
|
|
|
set(list_boards_commands
|
|
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/list_boards.py
|
|
${arch_root_args} ${board_root_args}
|
|
)
|
|
|
|
if(CMAKE_SCRIPT_MODE_FILE AND NOT CMAKE_PARENT_LIST_FILE)
|
|
# If this file is invoked as a script directly with -P:
|
|
# cmake [options] -P board.cmake
|
|
# Note that CMAKE_PARENT_LIST_FILE not being set ensures that this present
|
|
# file is being invoked directly with -P, and not via an include directive from
|
|
# some other script
|
|
|
|
# The options available are:
|
|
# ARCH_ROOT: Semi-colon separated arch roots
|
|
# BOARD_ROOT: Semi-colon separated board roots
|
|
# FILE_OUT: Set to a file path to save the boards to a file. If not defined the
|
|
# the contents will be printed to stdout
|
|
cmake_minimum_required(VERSION 3.13.1)
|
|
|
|
set(NO_BOILERPLATE TRUE)
|
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
|
|
|
if (FILE_OUT)
|
|
list(APPEND list_boards_commands OUTPUT_FILE "${FILE_OUT}")
|
|
endif()
|
|
|
|
execute_process(${list_boards_commands})
|
|
endif()
|