cmake: update common Zephyr build settings to use zephyr_get()
Fixes: #40389 This commit aligns the use of the following Zephyr build variables: - CONF_FILE - DTC_OVERLAY_FILE - OVERLAY_CONFIG - WEST_DIR - ZEPHYR_BOARD_ALIASES - ZEPHYR_EXTRA_MODULES - ZEPHYR_MODULES so that they can be set in same manner and with same order of preference. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
6d1f6c2d4e
commit
44a05e4439
|
@ -128,10 +128,7 @@ if(RUNNERS)
|
||||||
create_runners_yaml(${RUNNERS})
|
create_runners_yaml(${RUNNERS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED ENV{WEST_DIR} AND NOT WEST_DIR)
|
zephyr_get(WEST_DIR)
|
||||||
set(WEST_DIR $ENV{WEST_DIR})
|
|
||||||
endif(DEFINED ENV{WEST_DIR} AND NOT WEST_DIR)
|
|
||||||
|
|
||||||
if(WEST_DIR)
|
if(WEST_DIR)
|
||||||
set(WEST "PYTHONPATH=${WEST_DIR}/src" "${PYTHON_EXECUTABLE};${WEST_DIR}/src/west/app/main.py;--zephyr-base=${ZEPHYR_BASE} ")
|
set(WEST "PYTHONPATH=${WEST_DIR}/src" "${PYTHON_EXECUTABLE};${WEST_DIR}/src/west/app/main.py;--zephyr-base=${ZEPHYR_BASE} ")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -64,8 +64,9 @@ if(NOT (REVISION_SEPARATOR_INDEX EQUAL -1))
|
||||||
string(SUBSTRING ${BOARD} 0 ${REVISION_SEPARATOR_INDEX} BOARD)
|
string(SUBSTRING ${BOARD} 0 ${REVISION_SEPARATOR_INDEX} BOARD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED ENV{ZEPHYR_BOARD_ALIASES})
|
zephyr_get(ZEPHYR_BOARD_ALIASES)
|
||||||
include($ENV{ZEPHYR_BOARD_ALIASES})
|
if(DEFINED ZEPHYR_BOARD_ALIASES)
|
||||||
|
include(${ZEPHYR_BOARD_ALIASES})
|
||||||
if(${BOARD}_BOARD_ALIAS)
|
if(${BOARD}_BOARD_ALIAS)
|
||||||
set(BOARD_ALIAS ${BOARD} CACHE STRING "Board alias, provided by user")
|
set(BOARD_ALIAS ${BOARD} CACHE STRING "Board alias, provided by user")
|
||||||
set(BOARD ${${BOARD}_BOARD_ALIAS})
|
set(BOARD ${${BOARD}_BOARD_ALIAS})
|
||||||
|
|
|
@ -35,6 +35,7 @@ else()
|
||||||
set(APPLICATION_CONFIG_DIR ${APPLICATION_SOURCE_DIR})
|
set(APPLICATION_CONFIG_DIR ${APPLICATION_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
zephyr_get(CONF_FILE)
|
||||||
if(DEFINED CONF_FILE)
|
if(DEFINED CONF_FILE)
|
||||||
# This ensures that CACHE{CONF_FILE} will be set correctly to current scope
|
# This ensures that CACHE{CONF_FILE} will be set correctly to current scope
|
||||||
# variable CONF_FILE. An already current scope variable will stay the same.
|
# variable CONF_FILE. An already current scope variable will stay the same.
|
||||||
|
@ -62,9 +63,6 @@ elseif(CACHED_CONF_FILE)
|
||||||
# That value has precedence over anything else than a new
|
# That value has precedence over anything else than a new
|
||||||
# `cmake -DCONF_FILE=<file>` invocation.
|
# `cmake -DCONF_FILE=<file>` invocation.
|
||||||
set(CONF_FILE ${CACHED_CONF_FILE})
|
set(CONF_FILE ${CACHED_CONF_FILE})
|
||||||
elseif(DEFINED ENV{CONF_FILE})
|
|
||||||
set(CONF_FILE $ENV{CONF_FILE})
|
|
||||||
|
|
||||||
elseif(EXISTS ${APPLICATION_CONFIG_DIR}/prj_${BOARD}.conf)
|
elseif(EXISTS ${APPLICATION_CONFIG_DIR}/prj_${BOARD}.conf)
|
||||||
set(CONF_FILE ${APPLICATION_CONFIG_DIR}/prj_${BOARD}.conf)
|
set(CONF_FILE ${APPLICATION_CONFIG_DIR}/prj_${BOARD}.conf)
|
||||||
|
|
||||||
|
@ -91,6 +89,7 @@ zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards DTS APP_BOARD_DTS)
|
||||||
# The CONF_FILE variable is now set to its final value.
|
# The CONF_FILE variable is now set to its final value.
|
||||||
zephyr_boilerplate_watch(CONF_FILE)
|
zephyr_boilerplate_watch(CONF_FILE)
|
||||||
|
|
||||||
|
zephyr_get(DTC_OVERLAY_FILE)
|
||||||
if(DTC_OVERLAY_FILE)
|
if(DTC_OVERLAY_FILE)
|
||||||
# DTC_OVERLAY_FILE has either been specified on the cmake CLI or is already
|
# DTC_OVERLAY_FILE has either been specified on the cmake CLI or is already
|
||||||
# in the CMakeCache.txt.
|
# in the CMakeCache.txt.
|
||||||
|
|
|
@ -72,6 +72,7 @@ if(CONF_FILE)
|
||||||
string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE}")
|
string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
zephyr_get(OVERLAY_CONFIG)
|
||||||
if(OVERLAY_CONFIG)
|
if(OVERLAY_CONFIG)
|
||||||
string(REPLACE " " ";" OVERLAY_CONFIG_AS_LIST "${OVERLAY_CONFIG}")
|
string(REPLACE " " ";" OVERLAY_CONFIG_AS_LIST "${OVERLAY_CONFIG}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -31,18 +31,12 @@ include(python)
|
||||||
# Settings used by Zephyr module but where systems may define an alternative value.
|
# Settings used by Zephyr module but where systems may define an alternative value.
|
||||||
set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig)
|
set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig)
|
||||||
|
|
||||||
if(ZEPHYR_EXTRA_MODULES)
|
zephyr_get(ZEPHYR_MODULES)
|
||||||
# ZEPHYR_EXTRA_MODULES has either been specified on the cmake CLI or is
|
|
||||||
# already in the CMakeCache.txt. This has precedence over the environment
|
|
||||||
# variable ZEPHYR_EXTRA_MODULES
|
|
||||||
elseif(DEFINED ENV{ZEPHYR_EXTRA_MODULES})
|
|
||||||
set(ZEPHYR_EXTRA_MODULES $ENV{ZEPHYR_EXTRA_MODULES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ZEPHYR_MODULES)
|
if(ZEPHYR_MODULES)
|
||||||
set(ZEPHYR_MODULES_ARG "--modules" ${ZEPHYR_MODULES})
|
set(ZEPHYR_MODULES_ARG "--modules" ${ZEPHYR_MODULES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
zephyr_get(ZEPHYR_EXTRA_MODULES)
|
||||||
if(ZEPHYR_EXTRA_MODULES)
|
if(ZEPHYR_EXTRA_MODULES)
|
||||||
set(ZEPHYR_EXTRA_MODULES_ARG "--extra-modules" ${ZEPHYR_EXTRA_MODULES})
|
set(ZEPHYR_EXTRA_MODULES_ARG "--extra-modules" ${ZEPHYR_EXTRA_MODULES})
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue