cmake: kconfig cmake file environment cleanup
This commit is a cleanup of the cmake/kconfig.cmake file. It removes `set(ENV{<name>} <value>)` and instead creates a shared list that can be used for execute_process() and add_custom_target() when running Kconfig during CMake configure time or menuconfig and related build targets. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
eca8842b67
commit
c8295b19aa
1 changed files with 21 additions and 26 deletions
|
@ -48,20 +48,23 @@ endif()
|
||||||
# separated list instead.
|
# separated list instead.
|
||||||
string(REPLACE ";" "?" DTS_ROOT_BINDINGS "${DTS_ROOT_BINDINGS}")
|
string(REPLACE ";" "?" DTS_ROOT_BINDINGS "${DTS_ROOT_BINDINGS}")
|
||||||
|
|
||||||
set(ENV{srctree} ${ZEPHYR_BASE})
|
# A list of common environment settings used when invoking Kconfig during CMake
|
||||||
set(ENV{KERNELVERSION} ${KERNELVERSION})
|
# configure time or menuconfig and related build target.
|
||||||
set(ENV{KCONFIG_CONFIG} ${DOTCONFIG})
|
set(COMMON_KCONFIG_ENV_SETTINGS
|
||||||
set(ENV{PYTHON_EXECUTABLE} ${PYTHON_EXECUTABLE})
|
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
|
||||||
|
srctree=${ZEPHYR_BASE}
|
||||||
# Set environment variables so that Kconfig can prune Kconfig source
|
KERNELVERSION=${KERNELVERSION}
|
||||||
# files for other architectures
|
KCONFIG_CONFIG=${DOTCONFIG}
|
||||||
set(ENV{ARCH} ${ARCH})
|
# Set environment variables so that Kconfig can prune Kconfig source
|
||||||
set(ENV{BOARD_DIR} ${BOARD_DIR})
|
# files for other architectures
|
||||||
set(ENV{SHIELD_AS_LIST} "${SHIELD_AS_LIST}")
|
ARCH=${ARCH}
|
||||||
set(ENV{KCONFIG_BINARY_DIR} ${KCONFIG_BINARY_DIR})
|
ARCH_DIR=${ARCH_DIR}
|
||||||
set(ENV{ARCH_DIR} ${ARCH_DIR})
|
BOARD_DIR=${BOARD_DIR}
|
||||||
set(ENV{TOOLCHAIN_KCONFIG_DIR} "${TOOLCHAIN_KCONFIG_DIR}")
|
SHIELD_AS_LIST=${SHIELD_AS_LIST}
|
||||||
set(ENV{EDT_PICKLE} ${EDT_PICKLE})
|
KCONFIG_BINARY_DIR=${KCONFIG_BINARY_DIR}
|
||||||
|
TOOLCHAIN_KCONFIG_DIR=${TOOLCHAIN_KCONFIG_DIR}
|
||||||
|
EDT_PICKLE=${EDT_PICKLE}
|
||||||
|
)
|
||||||
|
|
||||||
# Allow out-of-tree users to add their own Kconfig python frontend
|
# Allow out-of-tree users to add their own Kconfig python frontend
|
||||||
# targets by appending targets to the CMake list
|
# targets by appending targets to the CMake list
|
||||||
|
@ -93,27 +96,18 @@ foreach(kconfig_target
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${kconfig_target}
|
${kconfig_target}
|
||||||
${CMAKE_COMMAND} -E env
|
${CMAKE_COMMAND} -E env
|
||||||
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
|
|
||||||
srctree=${ZEPHYR_BASE}
|
|
||||||
KERNELVERSION=${KERNELVERSION}
|
|
||||||
ZEPHYR_BASE=${ZEPHYR_BASE}
|
ZEPHYR_BASE=${ZEPHYR_BASE}
|
||||||
KCONFIG_CONFIG=${DOTCONFIG}
|
|
||||||
ARCH=$ENV{ARCH}
|
|
||||||
BOARD_DIR=$ENV{BOARD_DIR}
|
|
||||||
SHIELD_AS_LIST=$ENV{SHIELD_AS_LIST}
|
|
||||||
KCONFIG_BINARY_DIR=$ENV{KCONFIG_BINARY_DIR}
|
|
||||||
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
|
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
|
||||||
TOOLCHAIN_KCONFIG_DIR=${TOOLCHAIN_KCONFIG_DIR}
|
${COMMON_KCONFIG_ENV_SETTINGS}
|
||||||
ARCH_DIR=$ENV{ARCH_DIR}
|
|
||||||
EXTRA_DTC_FLAGS=${EXTRA_DTC_FLAGS}
|
EXTRA_DTC_FLAGS=${EXTRA_DTC_FLAGS}
|
||||||
DTS_POST_CPP=${DTS_POST_CPP}
|
DTS_POST_CPP=${DTS_POST_CPP}
|
||||||
DTS_ROOT_BINDINGS=${DTS_ROOT_BINDINGS}
|
DTS_ROOT_BINDINGS=${DTS_ROOT_BINDINGS}
|
||||||
EDT_PICKLE=${EDT_PICKLE}
|
|
||||||
${PYTHON_EXECUTABLE}
|
${PYTHON_EXECUTABLE}
|
||||||
${EXTRA_KCONFIG_TARGET_COMMAND_FOR_${kconfig_target}}
|
${EXTRA_KCONFIG_TARGET_COMMAND_FOR_${kconfig_target}}
|
||||||
${KCONFIG_ROOT}
|
${KCONFIG_ROOT}
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
|
COMMAND_EXPAND_LISTS
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
@ -211,7 +205,8 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
|
${COMMON_KCONFIG_ENV_SETTINGS}
|
||||||
${PYTHON_EXECUTABLE}
|
${PYTHON_EXECUTABLE}
|
||||||
${ZEPHYR_BASE}/scripts/kconfig/kconfig.py
|
${ZEPHYR_BASE}/scripts/kconfig/kconfig.py
|
||||||
--zephyr-base=${ZEPHYR_BASE}
|
--zephyr-base=${ZEPHYR_BASE}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue