summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-10-06 09:18:05 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-10-06 09:30:46 +0200
commit182d6d6f4273f79a7b379f69d33249df5b74e670 (patch)
treedd1b34cc58c87f2b03cc65da53b9e015f7863dbc /platform
parent9b4399a50991de84c65b0b5f02d3ebb66c80b970 (diff)
SCons: Add windows_subsystem=default, restores original behavior
We want debug builds to have a console and easy stdout redirection by default. Windows makes reading the stdout/stderr stream from gui applications too cumbersome (and most users don't know about it, and just wonder why they don't see a thing).
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/detect.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 6b503c1561..63f31307e7 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -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"),
EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
- EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("console", "gui")),
+ EnumVariable("windows_subsystem", "Windows subsystem", "default", ("default", "console", "gui")),
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. Only used on Windows.", False),
@@ -178,8 +178,15 @@ def configure_msvc(env, manual_msvc_config):
"""Configure env to work with MSVC"""
# 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)
@@ -311,6 +318,12 @@ def configure_mingw(env):
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"])