diff options
| author | ruki <[email protected]> | 2024-03-25 17:26:38 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-25 17:26:38 +0800 |
| commit | bef5a46b62937a48bf7f50170584e7dd648420d5 (patch) | |
| tree | 0bc797a3d1998385da067cc6fdfa83a19cc503e7 | |
| parent | 01166202facb2d90e4056003c0c80c4c02837c53 (diff) | |
| parent | af5330f7005cadd031f74e7e13da48ba517aed87 (diff) | |
Merge pull request #4875 from xmake-io/clang
Improve clang colors output
| -rw-r--r-- | xmake/modules/core/tools/clang_cl.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/clang_cl.lua b/xmake/modules/core/tools/clang_cl.lua index cf35af067..27afb1d26 100644 --- a/xmake/modules/core/tools/clang_cl.lua +++ b/xmake/modules/core/tools/clang_cl.lua @@ -83,6 +83,12 @@ function _has_color_diagnostics(self) elseif self:has_flags("-fdiagnostics-color=always", "cxflags") then colors_diagnostics = "-fdiagnostics-color=always" end + + -- enable color output for windows, @see https://github.com/xmake-io/xmake-vscode/discussions/260 + if colors_diagnostics and + self:has_flags("-fansi-escape-codes", "cxflags") then + colors_diagnostics = table.join(colors_diagnostics, "-fansi-escape-codes") + end end end colors_diagnostics = colors_diagnostics or false diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 216898f97..e3fa97a27 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -576,6 +576,12 @@ function _has_color_diagnostics(self) elseif self:has_flags("-fcolor-diagnostics", "cxflags") then colors_diagnostics = "-fcolor-diagnostics" end + + -- enable color output for windows, @see https://github.com/xmake-io/xmake-vscode/discussions/260 + if colors_diagnostics and self:name() == "clang" and is_host("windows") and + self:has_flags("-fansi-escape-codes", "cxflags") then + colors_diagnostics = table.join(colors_diagnostics, "-fansi-escape-codes") + end end end colors_diagnostics = colors_diagnostics or false |
