cmake: scripts: add 'winpty' support when available

Some Python scripts need to access to the underlying OS, like
using redirections. These interactions go through TTY interface.
On MinGW, these interactions/interfaces are called 'winpty'.
=> use them when available (harmless on platform *NIX platforms)

Signed-off-by: Cedric Lescop <cedric.lescop@se.com>
This commit is contained in:
Cedric Lescop 2024-12-05 13:36:53 +01:00 committed by Benjamin Cabé
commit af9ae5b894
2 changed files with 7 additions and 0 deletions

View file

@ -65,6 +65,12 @@ find_program(BOSSAC bossac)
# in the mcuboot repository if that's present in some cases)
find_program(IMGTOOL imgtool)
# winpty is an optional dependency
find_program(PTY_INTERFACE winpty)
if("${PTY_INTERFACE}" STREQUAL "PTY_INTERFACE-NOTFOUND")
set(PTY_INTERFACE "")
endif()
# Default to the host system's toolchain if we are targeting a host based target
if((${BOARD_DIR} MATCHES "boards\/native") OR ("${ARCH}" STREQUAL "posix")
OR ("${BOARD}" STREQUAL "unit_testing"))

View file

@ -226,6 +226,7 @@ foreach(kconfig_target
"SHIELD_AS_LIST=${SHIELD_AS_LIST_ESCAPED}"
DTS_POST_CPP=${DTS_POST_CPP}
DTS_ROOT_BINDINGS=${DTS_ROOT_BINDINGS}
${PTY_INTERFACE}
${PYTHON_EXECUTABLE}
${EXTRA_KCONFIG_TARGET_COMMAND_FOR_${kconfig_target}}
${KCONFIG_ROOT}