[Windows] Improve console handling and execute/create_process.

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 `create_process`).
Add `open_console` argument to the `execute` and `create_process` to open a new console window.
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 15:00:55 +02:00
parent b0e93711b3
commit ea5bb8b47d
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
29 changed files with 118 additions and 260 deletions

View file

@ -65,7 +65,7 @@ def get_opts():
# Vista support dropped after EOL due to GH-10243
("target_win_version", "Targeted Windows version, >= 0x0601 (Windows 7)", "0x0601"),
BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True),
EnumVariable("windows_subsystem", "Windows subsystem", "default", ("default", "console", "gui")),
EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("gui", "console")),
BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
("msvc_version", "MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.", None),
BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed.", False),
@ -178,15 +178,6 @@ def configure_msvc(env, manual_msvc_config):
# Build type
if env["tests"]:
env["windows_subsystem"] = "console"
elif env["windows_subsystem"] == "default":
# Default means we use console for debug, gui for release.
if "debug" in env["target"]:
env["windows_subsystem"] = "console"
else:
env["windows_subsystem"] = "gui"
if env["target"] == "release":
if env["optimize"] == "speed": # optimize for speed (default)
env.Append(CCFLAGS=["/O2"])
@ -326,15 +317,6 @@ def configure_mingw(env):
## Build type
if env["tests"]:
env["windows_subsystem"] = "console"
elif env["windows_subsystem"] == "default":
# Default means we use console for debug, gui for release.
if "debug" in env["target"]:
env["windows_subsystem"] = "console"
else:
env["windows_subsystem"] = "gui"
if env["target"] == "release":
env.Append(CCFLAGS=["-msse2"])