[Windows] Improve console handling and execute.

Always build with the GUI subsystem.
Redirect stdout and stderr output to the parent process console.
Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with non-blocking calls).
Add `open_console` argument to the `execute` to open a new console window (for both blocking and non-blocking calls).
Remove `interface/editor/hide_console_window` editor setting.
Remove `Toggle System Console` menu option.
Remove `set_console_visible` and `is_console_visible` functions.
This commit is contained in:
bruvzg 2021-12-16 13:08:09 +02:00
parent e937963007
commit 59085d5051
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
19 changed files with 87 additions and 173 deletions

View file

@ -183,9 +183,6 @@ def configure_msvc(env, manual_msvc_config):
env.Append(CCFLAGS=["/O1"])
env.Append(LINKFLAGS=["/OPT:REF"])
env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
elif env["target"] == "release_debug":
if env["optimize"] == "speed": # optimize for speed (default)
env.Append(CCFLAGS=["/O2"])
@ -193,15 +190,16 @@ def configure_msvc(env, manual_msvc_config):
elif env["optimize"] == "size": # optimize for size
env.Append(CCFLAGS=["/O1"])
env.Append(LINKFLAGS=["/OPT:REF"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
elif env["target"] == "debug":
env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
# Allow big objects. Only needed for debug, see MinGW branch for rationale.
env.AppendUnique(CCFLAGS=["/bigobj"])
env.Append(LINKFLAGS=["/DEBUG"])
env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
if env["debug_symbols"]:
env.AppendUnique(CCFLAGS=["/Zi", "/FS"])
env.AppendUnique(LINKFLAGS=["/DEBUG"])
@ -316,8 +314,6 @@ def configure_mingw(env):
env.Append(CCFLAGS=["-O2"])
else: # optimize for size
env.Prepend(CCFLAGS=["-Os"])
env.Append(LINKFLAGS=["-Wl,--subsystem,windows"])
if env["debug_symbols"]:
env.Prepend(CCFLAGS=["-g2"])
@ -337,6 +333,8 @@ def configure_mingw(env):
# and are the only ones with too big objects).
env.Append(CCFLAGS=["-Wa,-mbig-obj"])
env.Append(LINKFLAGS=["-Wl,--subsystem,windows"])
## Compiler configuration
if os.name == "nt":