Cmake: add defconfig preprocess capability in Cmake build environment(recursively expand #include)

Add:
    cmake/nuttx_process_config.cmake
    tools/process_config.py

    Update nuttx/CMakeLists.txt to call process_config defined ini
    nuttx_process_config.cmake to process defconfig before actually using it
This commit is contained in:
wangchengdong
2025-08-25 12:03:17 +08:00
committed by Xiang Xiao
parent e87c43b798
commit be36d42da5
3 changed files with 169 additions and 0 deletions

View File

@@ -158,6 +158,22 @@ if(NOT EXISTS "${NUTTX_DEFCONFIG}")
message(FATAL_ERROR "No config file found at ${NUTTX_DEFCONFIG}")
endif()
# Process initial defconfig ###################################################
# Process initial defconfig to recursively expand #include in it
include(nuttx_process_config)
get_filename_component(NUTTX_DEFCONFIG_DIR "${NUTTX_DEFCONFIG}" DIRECTORY)
process_config(
${CMAKE_BINARY_DIR}/.defconfig.processed
${NUTTX_DEFCONFIG}
INCLUDE_PATHS
${NUTTX_DEFCONFIG_DIR}/../../common/configs
${NUTTX_DEFCONFIG_DIR}/../common
${NUTTX_DEFCONFIG_DIR}
${NUTTX_DIR}/../apps
${NUTTX_DIR}/../nuttx-apps)
set(NUTTX_DEFCONFIG ${CMAKE_BINARY_DIR}/.defconfig.processed)
# Generate initial .config ###################################################
# This is needed right before any other configure step so that we can source
# Kconfig variables into CMake variables