From 7061c035cdbc365c3e98a3be607fdac05f92c371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 1 Mar 2019 12:57:11 +0100 Subject: [PATCH] kconfig: Move Kconfig.modules to the root build directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Håkon Øye Amundsen --- Kconfig.zephyr | 2 +- cmake/kconfig.cmake | 4 ++-- cmake/zephyr_module.cmake | 7 ++++--- doc/CMakeLists.txt | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 985e053fd5e..99502c9d80d 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -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). diff --git a/cmake/kconfig.cmake b/cmake/kconfig.cmake index fb8adb1aa0c..f78979716ff 100644 --- a/cmake/kconfig.cmake +++ b/cmake/kconfig.cmake @@ -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} diff --git a/cmake/zephyr_module.cmake b/cmake/zephyr_module.cmake index 3fb583a0908..c38cfa3964e 100644 --- a/cmake/zephyr_module.cmake +++ b/cmake/zephyr_module.cmake @@ -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 /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() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 141c36f0f50..0996e48655d 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -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/