summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/common.gypi11
-rw-r--r--build/config/compiler/BUILD.gn8
-rwxr-xr-xbuild/win/use_ansi_codes.py10
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