cmake: modules: boards: Add normalised variables

Adds a new variable NORMALIZED_BOARD_QUALIFIERS which contains
the board qualifiers in file-name format, this allows for
constructing strings in applications (e.g. for folder names) prior
to Zephyr being found for things like APPLICATION_CONFIG_DIR. Also
adds NORMALIZED_BOARD_TARGET.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2024-04-15 09:23:00 +01:00 committed by Henrik Brix Andersen
parent 7fd0a7a5eb
commit a2ed8162c8

View file

@ -21,13 +21,18 @@
# Outcome: # Outcome:
# The following variables will be defined when this CMake module completes: # The following variables will be defined when this CMake module completes:
# #
# - BOARD: Board, without revision field. # - BOARD: Board, without revision field.
# - BOARD_REVISION: Board revision # - BOARD_REVISION: Board revision
# - BOARD_DIR: Board directory with the implementation for selected board # - BOARD_QUALIFIERS: Board qualifiers
# - ARCH_DIR: Arch dir for extracted from selected board # - NORMALIZED_BOARD_QUALIFIERS: Board qualifiers in lower-case format where slashes have been
# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended # replaced with underscores
# - BOARD_EXTENSION_DIRS: List of board extension directories (If # - NORMALIZED_BOARD_TARGET: Board target in lower-case format where slashes have been
# BOARD_EXTENSIONS is not explicitly disabled) # replaced with underscores
# - BOARD_DIR: Board directory with the implementation for selected board
# - ARCH_DIR: Arch dir for extracted from selected board
# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended
# - BOARD_EXTENSION_DIRS: List of board extension directories (If
# BOARD_EXTENSIONS is not explicitly disabled)
# #
# The following targets will be defined when this CMake module completes: # The following targets will be defined when this CMake module completes:
# - board: when invoked, a list of valid boards will be printed # - board: when invoked, a list of valid boards will be printed
@ -336,8 +341,13 @@ endif()
if(DEFINED BOARD_QUALIFIERS) if(DEFINED BOARD_QUALIFIERS)
string(REGEX REPLACE "^/" "qualifiers: " board_message_qualifiers "${BOARD_QUALIFIERS}") string(REGEX REPLACE "^/" "qualifiers: " board_message_qualifiers "${BOARD_QUALIFIERS}")
set(board_message "${board_message}, ${board_message_qualifiers}") set(board_message "${board_message}, ${board_message_qualifiers}")
string(REPLACE "/" "_" NORMALIZED_BOARD_QUALIFIERS "${BOARD_QUALIFIERS}")
endif() endif()
set(NORMALIZED_BOARD_TARGET "${BOARD}${BOARD_QUALIFIERS}")
string(REPLACE "/" "_" NORMALIZED_BOARD_TARGET "${NORMALIZED_BOARD_TARGET}")
message(STATUS "${board_message}") message(STATUS "${board_message}")
add_custom_target(boards ${list_boards_commands} USES_TERMINAL) add_custom_target(boards ${list_boards_commands} USES_TERMINAL)