From cccd13a5f02c33c885b420c40fb4515baebc9d40 Mon Sep 17 00:00:00 2001 From: simbit18 <101105604+simbit18@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:52:29 +0200 Subject: [PATCH] python --- CMakeLists.txt | 33 +++++++++++++++++---------------- cmake/nuttx_kconfig.cmake | 31 ++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65debab5ff32a..969ea8dc589e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,22 +319,23 @@ 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}) - - 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() + # execute_process( + # COMMAND olddefconfig + # ERROR_VARIABLE KCONFIG_ERROR + # OUTPUT_VARIABLE KCONFIG_OUTPUT + # RESULT_VARIABLE KCONFIG_STATUS + # WORKING_DIRECTORY ${NUTTX_DIR}) + + # 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() + nuttx_olddefconfig() file(RENAME ${CMAKE_BINARY_DIR}/.config.compressed ${CMAKE_BINARY_DIR}/.config) diff --git a/cmake/nuttx_kconfig.cmake b/cmake/nuttx_kconfig.cmake index 8837a42a3ab5f..895673622ec01 100644 --- a/cmake/nuttx_kconfig.cmake +++ b/cmake/nuttx_kconfig.cmake @@ -160,10 +160,39 @@ function(nuttx_generate_kconfig) endfunction() +function(nuttx_olddefconfig) + if(${Python3_FOUND}) + set(Python_EXECUTABLE ${Python3_EXECUTABLE}) + set(Python_EST ".py") + endif() + + execute_process( + COMMAND ${Python3_EXECUTABLE} olddefconfig${Python_EST} + ERROR_VARIABLE KCONFIG_ERROR + OUTPUT_VARIABLE KCONFIG_OUTPUT + RESULT_VARIABLE KCONFIG_STATUS + WORKING_DIRECTORY ${NUTTX_DIR}) + + if(KCONFIG_ERROR) + message(WARNING "Kconfig Configuration Error: ${KCONFIG_ERROR}") + endif() + + if(KCONFIG_STATUS AND NOT KCONFIG_STATUS EQUAL 0) + message( + FATAL_ERROR + "nuttx_setconfig: Failed to initialize Kconfig configuration: ${KCONFIG_OUTPUT}") + endif() +endfunction() + function(nuttx_setconfig) + if(${Python3_FOUND}) + set(Python_EXECUTABLE ${Python3_EXECUTABLE}) + set(Python_EST ".py") + endif() + set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config) execute_process( - COMMAND setconfig ${ARGN} + COMMAND ${Python3_EXECUTABLE} setconfig${Python_EST} ${ARGN} --kconfig ${NUTTX_DIR}/Kconfig ERROR_VARIABLE KCONFIG_ERROR OUTPUT_VARIABLE KCONFIG_OUTPUT