diff options
author | thakis <thakis@chromium.org> | 2015-06-19 16:43:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-19 23:44:00 +0000 |
commit | 59fc7718fefd2c93e1acd94c4d5a405949a0cf10 (patch) | |
tree | 433191d535462e0d5897ce0749742fdbdbc9ff9d /build | |
parent | 563ccdb7e2c0764ffc0b739cc983d0fbea91df82 (diff) | |
download | chromium_src-59fc7718fefd2c93e1acd94c4d5a405949a0cf10.zip chromium_src-59fc7718fefd2c93e1acd94c4d5a405949a0cf10.tar.gz chromium_src-59fc7718fefd2c93e1acd94c4d5a405949a0cf10.tar.bz2 |
clang/win: Make diagnostics colored if ansicon is around at runhooks time.
BUG=82385
TEST=Run gyp or gn with ansicon active, build. Diagnostics should be colored
in cmd.exe.
Review URL: https://codereview.chromium.org/1194823004
Cr-Commit-Position: refs/heads/master@{#335394}
Diffstat (limited to 'build')
-rw-r--r-- | build/common.gypi | 11 | ||||
-rw-r--r-- | build/config/compiler/BUILD.gn | 8 | ||||
-rwxr-xr-x | build/win/use_ansi_codes.py | 10 |
3 files changed, 29 insertions, 0 deletions
diff --git a/build/common.gypi b/build/common.gypi index d1c09dd..c853a69 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -5760,6 +5760,17 @@ ], }, }], + ['clang==1 and "<!(python <(DEPTH)/build/win/use_ansi_codes.py)"=="True"', { + 'VCCLCompilerTool': { + 'AdditionalOptions': [ + # cmd.exe doesn't understand ANSI escape codes by default, + # so only enable them if something emulating them is around. + '-fansi-escape-codes', + # Also see http://crbug.com/110262 + '-fcolor-diagnostics', + ], + }, + }], ], }, }, diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 05ac023..7a22b99 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -130,6 +130,14 @@ config("compiler") { } else { cflags += [ "-m64" ] } + if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") == + "True") { + cflags += [ + # cmd.exe doesn't understand ANSI escape codes by default, + # so only enable them if something emulating them is around. + "-fansi-escape-codes", + ] + } } } else { # Common GCC compiler flags setup. diff --git a/build/win/use_ansi_codes.py b/build/win/use_ansi_codes.py new file mode 100755 index 0000000..cff5f43 --- /dev/null +++ b/build/win/use_ansi_codes.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# Copyright (c) 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Prints if the the terminal is likely to understand ANSI codes.""" + +import os + +# Add more terminals here as needed. +print 'ANSICON' in os.environ |