Cmake: Improved setconfig support for setting multiple parameters

Improved setconfig support for setting multiple parameters for the .config

Added Cmake and Ninja version info

Modified savedefconfig now behaves with the same logic as the tools/refresh.sh script used for the update stage (make build) on GitHub.
This commit is contained in:
simbit18
2024-10-03 12:15:59 +02:00
committed by Xiang Xiao
parent 69f58de304
commit 7db9b47465
4 changed files with 120 additions and 86 deletions

View File

@@ -204,9 +204,7 @@ set(ENV{HOST_BSD} n)
set(ENV{HOST_WINDOWS} n)
set(ENV{HOST_OTHER} n)
# We define host
include(nuttx_sethost)
nuttx_sethost()
include(nuttx_parse_function_args)
include(nuttx_add_subdirectory)
@@ -321,12 +319,7 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL
set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config.compressed)
# Do olddefconfig step to expand the abbreviated defconfig into normal config
execute_process(
COMMAND olddefconfig
ERROR_VARIABLE KCONFIG_ERROR
OUTPUT_VARIABLE KCONFIG_OUTPUT
RESULT_VARIABLE KCONFIG_STATUS
WORKING_DIRECTORY ${NUTTX_DIR})
nuttx_olddefconfig()
file(RENAME ${CMAKE_BINARY_DIR}/.config.compressed
${CMAKE_BINARY_DIR}/.config)
@@ -335,22 +328,23 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL
# store original expanded .config
configure_file(${CMAKE_BINARY_DIR}/.config ${CMAKE_BINARY_DIR}/.config.orig
COPYONLY)
if(KCONFIG_ERROR)
message(WARNING "Kconfig Configuration Error: ${KCONFIG_ERROR}")
endif()
if(KCONFIG_STATUS AND NOT KCONFIG_STATUS EQUAL 0)
message(
FATAL_ERROR
"Failed to initialize Kconfig configuration: ${KCONFIG_OUTPUT}")
endif()
# We define host
nuttx_sethost()
set(NUTTX_DEFCONFIG_SAVED
${NUTTX_DEFCONFIG}
CACHE INTERNAL "Saved defconfig path" FORCE)
# Print configuration choices
message(STATUS " CMake ${CMAKE_VERSION}")
if(CMAKE_GENERATOR MATCHES "Ninja")
execute_process(
COMMAND ninja --version
OUTPUT_VARIABLE ninja_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS " Ninja ${ninja_version}")
endif()
message(STATUS " Board: ${NUTTX_BOARD}")
message(STATUS " Config: ${NUTTX_CONFIG}")
message(STATUS " Appdir: ${NUTTX_APPS_DIR}")