mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
cmake: Fix SIM_TOOLCHAIN using CMake on macOS.
Fix an issue where `SIM_TOOLCHAIN_GCC` was incorrectly set when configuring `sim:nsh` using CMake on macOS. Ensure that `nuttx_sethost()` is called before `nuttx_olddefconfig()`. Signed-off-by: Shoji Tokunaga <toku@mac.com>
This commit is contained in:
parent
cdd10a604b
commit
08a2de27cf
3 changed files with 35 additions and 6 deletions
|
|
@ -355,6 +355,10 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL
|
|||
|
||||
set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config.compressed)
|
||||
|
||||
# Define host before the first olddefconfig so host-dependent defaults, such
|
||||
# as the sim toolchain choice on macOS, resolve the same way as configure.sh.
|
||||
nuttx_sethost(CONFIG_FILE ${CMAKE_BINARY_DIR}/.config.compressed)
|
||||
|
||||
# Do olddefconfig step to expand the abbreviated defconfig into normal config
|
||||
nuttx_olddefconfig()
|
||||
|
||||
|
|
@ -379,9 +383,6 @@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL
|
|||
configure_file(${CMAKE_BINARY_DIR}/.config ${CMAKE_BINARY_DIR}/.config.orig
|
||||
COPYONLY)
|
||||
|
||||
# We define host
|
||||
nuttx_sethost()
|
||||
|
||||
set(NUTTX_DEFCONFIG_SAVED
|
||||
${NUTTX_DEFCONFIG}
|
||||
CACHE INTERNAL "Saved defconfig path" FORCE)
|
||||
|
|
|
|||
|
|
@ -231,9 +231,25 @@ function(nuttx_olddefconfig)
|
|||
endfunction()
|
||||
|
||||
function(nuttx_setconfig)
|
||||
set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config)
|
||||
cmake_parse_arguments(SETCONFIG "" "CONFIG_FILE" "SETTINGS" ${ARGN})
|
||||
|
||||
if(SETCONFIG_UNPARSED_ARGUMENTS)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"nuttx_setconfig: unknown arguments: ${SETCONFIG_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
if(NOT SETCONFIG_SETTINGS)
|
||||
message(FATAL_ERROR "nuttx_setconfig: SETTINGS is required")
|
||||
endif()
|
||||
|
||||
if(NOT SETCONFIG_CONFIG_FILE)
|
||||
set(SETCONFIG_CONFIG_FILE ${CMAKE_BINARY_DIR}/.config)
|
||||
endif()
|
||||
|
||||
set(ENV{KCONFIG_CONFIG} ${SETCONFIG_CONFIG_FILE})
|
||||
execute_process(
|
||||
COMMAND setconfig ${ARGN} --kconfig ${NUTTX_DIR}/Kconfig
|
||||
COMMAND setconfig ${SETCONFIG_SETTINGS} --kconfig ${NUTTX_DIR}/Kconfig
|
||||
ERROR_VARIABLE KCONFIG_ERROR
|
||||
OUTPUT_VARIABLE KCONFIG_OUTPUT
|
||||
RESULT_VARIABLE KCONFIG_STATUS
|
||||
|
|
|
|||
|
|
@ -23,6 +23,18 @@
|
|||
include(nuttx_kconfig)
|
||||
|
||||
function(nuttx_sethost)
|
||||
set(config_file ${CMAKE_BINARY_DIR}/.config)
|
||||
cmake_parse_arguments(SETHOST "" "CONFIG_FILE" "" ${ARGN})
|
||||
|
||||
if(SETHOST_UNPARSED_ARGUMENTS)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"nuttx_sethost: unknown arguments: ${SETHOST_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
if(SETHOST_CONFIG_FILE)
|
||||
set(config_file ${SETHOST_CONFIG_FILE})
|
||||
endif()
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
# https://learn.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details
|
||||
|
|
@ -104,5 +116,5 @@ function(nuttx_sethost)
|
|||
endif()
|
||||
endif()
|
||||
# message(" nuttx_setconfig: ${NUTTX_SYSTEM_SETHOST}")
|
||||
nuttx_setconfig("${NUTTX_SYSTEM_SETHOST}")
|
||||
nuttx_setconfig(CONFIG_FILE ${config_file} SETTINGS ${NUTTX_SYSTEM_SETHOST})
|
||||
endfunction()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue