cmake: Automatically pull in winpty for menuconfig, monitor if needed

This commit is contained in:
Angus Gratton 2018-05-01 16:05:27 +10:00 committed by Angus Gratton
parent c42b791aaa
commit c7307de63e
2 changed files with 5 additions and 0 deletions

View file

@ -13,6 +13,7 @@ endmacro()
if(CMAKE_HOST_WIN32)
# Prefer a prebuilt mconf on Windows
find_program(WINPTY winpty)
find_program(MCONF mconf)
if(NOT MCONF)
@ -23,6 +24,8 @@ if(CMAKE_HOST_WIN32)
"on the PATH, or an MSYS2 version of gcc on the PATH to build mconf. "
"Consult the setup docs for ESP-IDF on Windows.")
endif()
elseif(WINPTY)
set(MCONF "${WINPTY}" "${MCONF}")
endif()
endif()

View file

@ -267,6 +267,8 @@ def monitor(action, args):
monitor_args += [ "-p", args.port ]
monitor_args += [ "-b", project_desc["monitor_baud"] ]
monitor_args += [ elf_file ]
if "MSYSTEM" is os.environ:
monitor_args = [ "winpty" ] + monitor_args
_run_tool("idf_monitor", monitor_args, args.build_dir)