Skip to content

Commit

Permalink
Merge pull request #4875 from xmake-io/clang
Browse files Browse the repository at this point in the history
Improve clang colors output
  • Loading branch information
waruqi authored Mar 25, 2024
2 parents 0116620 + af5330f commit bef5a46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xmake/modules/core/tools/clang_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions xmake/modules/core/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bef5a46

Please sign in to comment.