summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-21 22:12:18 +0800
committerruki <[email protected]>2020-03-21 22:12:18 +0800
commit9c4129312ae14de2725230c2c1caf38fa849dfa8 (patch)
tree46bdef24268212d0840a735e17f8cbaf268b7241
parent1429067bf099b4880c000421e8b53d3c3341f66d (diff)
improve clang-cl
-rw-r--r--xmake/modules/core/tools/cl.lua6
-rw-r--r--xmake/modules/core/tools/clang_cl.lua27
-rw-r--r--xmake/themes/default/xmake.lua2
3 files changed, 12 insertions, 23 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 4080bb056..e0b271d88 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -354,6 +354,9 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
{
function (errors)
+ -- try removing the old object file for forcing to rebuild this source file
+ os.tryrm(objectfile)
+
-- use cl/stdout as errors first from vstool.iorunv()
if type(errors) == "table" then
local errs = errors.stdout or ""
@@ -363,9 +366,6 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
errors = errs
end
- -- try removing the old object file for forcing to rebuild this source file
- os.tryrm(objectfile)
-
-- filter includes notes: "Note: including file: xxx.h", @note maybe not english language
local results = ""
for _, line in ipairs(tostring(errors):split("\n", {plain = true})) do
diff --git a/xmake/modules/core/tools/clang_cl.lua b/xmake/modules/core/tools/clang_cl.lua
index b5825be11..98dd736fb 100644
--- a/xmake/modules/core/tools/clang_cl.lua
+++ b/xmake/modules/core/tools/clang_cl.lua
@@ -58,20 +58,14 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
os.mkdir(path.directory(objectfile, path.sep()))
-- compile it
- local depfile = dependinfo and os.tmpfile() or nil
- try
+ local outdata = try
{
function ()
- -- support `-MMD -MF depfile.d`? some old gcc does not support it at same time
- if depfile and _g._HAS_MMD_MF == nil then
- _g._HAS_MMD_MF = self:has_flags({"-MMD", "-MF", os.nuldev()}, "cxflags", { flagskey = "-MMD -MF" }) or false
- end
-
-- generate includes file
local compflags = flags
- if depfile and _g._HAS_MMD_MF then
- compflags = table.join(compflags, "-MMD", "-MF", depfile)
+ if dependinfo then
+ compflags = table.join(flags, "-showIncludes")
end
-- has color diagnostics? enable it
@@ -124,18 +118,13 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
cprint("${color.warning}%s", warnings)
end
end
-
- -- generate the dependent includes
- if depfile and os.isfile(depfile) then
- if dependinfo then
- dependinfo.depfiles_gcc = io.readfile(depfile, {continuation = "\\"})
- end
-
- -- remove the temporary dependent file
- os.tryrm(depfile)
- end
end
}
}
+
+ -- generate the dependent includes
+ if dependinfo and outdata then
+ dependinfo.depfiles_cl = outdata
+ end
end
diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua
index 3b926b421..010fa6760 100644
--- a/xmake/themes/default/xmake.lua
+++ b/xmake/themes/default/xmake.lua
@@ -39,7 +39,7 @@ theme("default")
-- the warning info
set_text("warning", "$warning")
- set_color("warning", "yellow")
+ set_color("warning", "yellow bright")
-- the building progress
set_text("build.progress_format", "[%3d%%]")