kconfig: Move Kconfig.modules to the root build directory

Currently, the Kconfig.modules file is placed in the build directory
relative to the CMake "project". But technically, the file is not
project-specific, but global, or build-directory specific.

So we move it up one level to the CMAKE_BINARY_DIR instead. Currently,
there is only one project, so this change has no effect, but this
enables us to have multiple projects in the future, which again
enables multi-image builds.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2019-03-01 12:57:11 +01:00 committed by Anas Nashif
commit 7061c035cd
4 changed files with 8 additions and 7 deletions

View file

@ -7,7 +7,7 @@
# SPDX-License-Identifier: Apache-2.0
#
source "$(PROJECT_BINARY_DIR)/Kconfig.modules"
source "$(CMAKE_BINARY_DIR)/Kconfig.modules"
# Include these first so that any properties (e.g. defaults) below can be
# overriden in *.defconfig files (by defining symbols in multiple locations).

View file

@ -34,7 +34,7 @@ set(ENV{PYTHON_EXECUTABLE} ${PYTHON_EXECUTABLE})
set(ENV{ARCH} ${ARCH})
set(ENV{BOARD_DIR} ${BOARD_DIR})
set(ENV{SOC_DIR} ${SOC_DIR})
set(ENV{PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR})
set(ENV{CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR})
set(ENV{ARCH_DIR} ${ARCH_DIR})
set(ENV{GENERATED_DTS_BOARD_CONF} ${GENERATED_DTS_BOARD_CONF})
@ -65,7 +65,7 @@ foreach(kconfig_target
ARCH=$ENV{ARCH}
BOARD_DIR=$ENV{BOARD_DIR}
SOC_DIR=$ENV{SOC_DIR}
PROJECT_BINARY_DIR=$ENV{PROJECT_BINARY_DIR}
CMAKE_BINARY_DIR=$ENV{CMAKE_BINARY_DIR}
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
ARCH_DIR=$ENV{ARCH_DIR}
GENERATED_DTS_BOARD_CONF=${GENERATED_DTS_BOARD_CONF}

View file

@ -37,7 +37,8 @@ endif()
# Clear the Kconfig.modules generated file in case modules has been removed.
# The Kconfig.modules contains a list of additional Kconfig files to be sourced
# based upon <module>/zephyr/module.yml files.
file(WRITE ${PROJECT_BINARY_DIR}/Kconfig.modules
set(KCONFIG_MODULES_FILE ${CMAKE_BINARY_DIR}/Kconfig.modules)
file(WRITE ${KCONFIG_MODULES_FILE}
"# NOTE: THIS FILE IS AUTOGENERATED BY CMAKE\n"
)
# For each west managed project, determine if the project is a zephyr module.
@ -78,13 +79,13 @@ foreach(module ${west_project_list})
list(APPEND ZEPHYR_MODULES_NAME ${module_name})
list(APPEND ZEPHYR_MODULES_DIR ${module}/${cmake_subdir})
file(APPEND ${PROJECT_BINARY_DIR}/Kconfig.modules ${kconfig_osource})
file(APPEND ${KCONFIG_MODULES_FILE} ${kconfig_osource})
elseif(EXISTS "${module}/${cmake_subdir}/CMakeLists.txt")
set(kconfig_osource "osource \"${module}/zephyr/Kconfig\"\n")
get_filename_component(module_name ${module} NAME)
list(APPEND ZEPHYR_MODULES_NAME ${module_name})
list(APPEND ZEPHYR_MODULES_DIR ${module}/${cmake_subdir})
file(APPEND ${PROJECT_BINARY_DIR}/Kconfig.modules ${kconfig_osource})
file(APPEND ${KCONFIG_MODULES_FILE} ${kconfig_osource})
else()
# Not a Zephyr module, ignore.
endif()

View file

@ -181,7 +181,7 @@ add_custom_target(
ARCH_DIR=arch/
SOC_DIR=soc/
SRCARCH=x86
PROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
KCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE}
KCONFIG_DOC_MODE=1
${PYTHON_EXECUTABLE} scripts/genrest.py Kconfig ${RST_OUT}/doc/reference/kconfig/