Skip to content

Commit c984c5d

Browse files
SebastianBoenashif
authored andcommitted
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 <[email protected]> Signed-off-by: Håkon Øye Amundsen <[email protected]>
1 parent 6e861e1 commit c984c5d

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

Kconfig.zephyr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# SPDX-License-Identifier: Apache-2.0
88
#
99

10-
source "$(PROJECT_BINARY_DIR)/Kconfig.modules"
10+
source "$(CMAKE_BINARY_DIR)/Kconfig.modules"
1111

1212
# Include these first so that any properties (e.g. defaults) below can be
1313
# overriden in *.defconfig files (by defining symbols in multiple locations).

cmake/kconfig.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set(ENV{PYTHON_EXECUTABLE} ${PYTHON_EXECUTABLE})
3434
set(ENV{ARCH} ${ARCH})
3535
set(ENV{BOARD_DIR} ${BOARD_DIR})
3636
set(ENV{SOC_DIR} ${SOC_DIR})
37-
set(ENV{PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR})
37+
set(ENV{CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR})
3838
set(ENV{ARCH_DIR} ${ARCH_DIR})
3939
set(ENV{GENERATED_DTS_BOARD_CONF} ${GENERATED_DTS_BOARD_CONF})
4040

@@ -65,7 +65,7 @@ foreach(kconfig_target
6565
ARCH=$ENV{ARCH}
6666
BOARD_DIR=$ENV{BOARD_DIR}
6767
SOC_DIR=$ENV{SOC_DIR}
68-
PROJECT_BINARY_DIR=$ENV{PROJECT_BINARY_DIR}
68+
CMAKE_BINARY_DIR=$ENV{CMAKE_BINARY_DIR}
6969
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
7070
ARCH_DIR=$ENV{ARCH_DIR}
7171
GENERATED_DTS_BOARD_CONF=${GENERATED_DTS_BOARD_CONF}

cmake/zephyr_module.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ endif()
3737
# Clear the Kconfig.modules generated file in case modules has been removed.
3838
# The Kconfig.modules contains a list of additional Kconfig files to be sourced
3939
# based upon <module>/zephyr/module.yml files.
40-
file(WRITE ${PROJECT_BINARY_DIR}/Kconfig.modules
40+
set(KCONFIG_MODULES_FILE ${CMAKE_BINARY_DIR}/Kconfig.modules)
41+
file(WRITE ${KCONFIG_MODULES_FILE}
4142
"# NOTE: THIS FILE IS AUTOGENERATED BY CMAKE\n"
4243
)
4344
# For each west managed project, determine if the project is a zephyr module.
@@ -78,13 +79,13 @@ foreach(module ${west_project_list})
7879

7980
list(APPEND ZEPHYR_MODULES_NAME ${module_name})
8081
list(APPEND ZEPHYR_MODULES_DIR ${module}/${cmake_subdir})
81-
file(APPEND ${PROJECT_BINARY_DIR}/Kconfig.modules ${kconfig_osource})
82+
file(APPEND ${KCONFIG_MODULES_FILE} ${kconfig_osource})
8283
elseif(EXISTS "${module}/${cmake_subdir}/CMakeLists.txt")
8384
set(kconfig_osource "osource \"${module}/zephyr/Kconfig\"\n")
8485
get_filename_component(module_name ${module} NAME)
8586
list(APPEND ZEPHYR_MODULES_NAME ${module_name})
8687
list(APPEND ZEPHYR_MODULES_DIR ${module}/${cmake_subdir})
87-
file(APPEND ${PROJECT_BINARY_DIR}/Kconfig.modules ${kconfig_osource})
88+
file(APPEND ${KCONFIG_MODULES_FILE} ${kconfig_osource})
8889
else()
8990
# Not a Zephyr module, ignore.
9091
endif()

doc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ add_custom_target(
181181
ARCH_DIR=arch/
182182
SOC_DIR=soc/
183183
SRCARCH=x86
184-
PROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
184+
CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
185185
KCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE}
186186
KCONFIG_DOC_MODE=1
187187
${PYTHON_EXECUTABLE} scripts/genrest.py Kconfig ${RST_OUT}/doc/reference/kconfig/

0 commit comments

Comments
 (0)