Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Silence redundant MSVC output #87154

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def get_opts():
BoolVariable("use_asan", "Use address sanitizer (ASAN)", False),
BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False),
BoolVariable("incremental_link", "Use MSVC incremental linking. May increase or decrease build times.", False),
BoolVariable("silence_msvc", "Silence MSVC's stdout. Decreases output log bloat by roughly half.", True),
("angle_libs", "Path to the ANGLE static libraries", ""),
# Direct3D 12 support.
("mesa_libs", "Path to the MESA/NIR static libraries (required for D3D12)", ""),
Expand Down Expand Up @@ -358,6 +359,20 @@ def configure_msvc(env, vcvars_msvc_config):

## Compile/link flags

env["MAXLINELENGTH"] = 8192 # Windows Vista and beyond, so always applicable.

if env["silence_msvc"]:
env.Prepend(CCFLAGS=[">", "NUL"])
env.Prepend(LINKFLAGS=[">", "NUL"])

# "> NUL" fails if using a tempfile, circumvent by removing the argument altogether.
old_esc_func = env["TEMPFILEARGESCFUNC"]

def trim_nul(arg):
return "" if arg in [">", "NUL"] else old_esc_func(arg)

env["TEMPFILEARGESCFUNC"] = trim_nul

if env["debug_crt"]:
# Always use dynamic runtime, static debug CRT breaks thread_local.
env.AppendUnique(CCFLAGS=["/MDd"])
Expand Down
Loading