Skip to content

Commit

Permalink
python
Browse files Browse the repository at this point in the history
  • Loading branch information
simbit18 committed Sep 30, 2024
1 parent eef86af commit cccd13a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 17 deletions.
33 changes: 17 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 30 additions & 1 deletion cmake/nuttx_kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cccd13a

Please sign in to comment.