summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-06 00:36:52 +0800
committerruki <[email protected]>2022-08-06 00:36:52 +0800
commit442ed69e3344e762a61698105154b9134d1d4496 (patch)
tree0e04898b55c09708bfbdf246b365f2e90e45040d /xmake/rules/c++/modules
parent765b7041868da4a3aa08b97b8a1d73c48dbd9dbd (diff)
support for compile_commands
Diffstat (limited to 'xmake/rules/c++/modules')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua2
-rw-r--r--xmake/rules/c++/modules/modules_support/common.lua2
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc.lua5
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc.lua1
-rw-r--r--xmake/rules/c++/modules/xmake.lua2
5 files changed, 3 insertions, 9 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index 4cefed14d..19b42b135 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -249,13 +249,11 @@ function build_modules(target, batchcmds, objectfiles, modules, opt)
end
local bmifile = provide.bmi
-
local args = { emitmoduleinterfaceflag, "-c", "-x", "c++-module", "--precompile", provide.sourcefile, "-o", bmifile }
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.module.bmi %s", name)
batchcmds:mkdir(path.directory(objectfile))
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args))
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, {bmifile}, {"-c", "-o", objectfile}))
-
batchcmds:add_depfiles(provide.sourcefile)
local bmiflags = modulefileflag .. bmifile
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua
index 9c15cffbe..8805d51de 100644
--- a/xmake/rules/c++/modules/modules_support/common.lua
+++ b/xmake/rules/c++/modules/modules_support/common.lua
@@ -62,7 +62,6 @@ function get_headerunits(target, sourcebatch)
for name, r in pairs(m.requires) do
if r.method ~= "by-name" then
local unittype = r.method == "include-angle" and ":angle" or ":quote"
-
if stl_headers.is_stl_header(name) then
stl_headerunits = stl_headerunits or {}
if not table.find_if(stl_headerunits, function(i, v) return v.name == name end) then
@@ -405,3 +404,4 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile)
local jsondata = json.encode(output)
io.writefile(jsonfile, jsondata)
end
+
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua
index 449c901fd..00406787e 100644
--- a/xmake/rules/c++/modules/modules_support/gcc.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc.lua
@@ -214,7 +214,6 @@ function generate_user_headerunits(target, batchcmds, headerunits, opt)
if _add_module_to_mapper(mapper_file, headerunit_path, path.absolute(bmifile, projectdir)) then
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.headerunit.bmi %s", headerunit.name)
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args))
-
batchcmds:add_depfiles(headerunit.path)
end
depmtime = math.max(depmtime, os.mtime(bmifile))
@@ -252,14 +251,12 @@ function build_modules(target, batchcmds, objectfiles, modules, opt)
local bmifile = provide.bmi
if _add_module_to_mapper(mapper_file, name, path.absolute(bmifile, projectdir)) then
local args = {"-o", objectfile, "-c", provide.sourcefile}
-
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.module.bmi %s", name)
batchcmds:mkdir(path.directory(objectfile))
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args))
-
batchcmds:add_depfiles(provide.sourcefile)
- target:add("objectfiles", objectfile)
+ target:add("objectfiles", objectfile)
depmtime = math.max(depmtime, os.mtime(bmifile))
end
end
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua
index 96997b5b9..7f9282de7 100644
--- a/xmake/rules/c++/modules/modules_support/msvc.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc.lua
@@ -245,7 +245,6 @@ function build_modules(target, batchcmds, objectfiles, modules, opt)
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.module.bmi %s", name)
batchcmds:mkdir(path.directory(objectfile))
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args, bmi_args), {envs = vcvars})
-
batchcmds:add_depfiles(provide.sourcefile)
local bmiflags = {referenceflag, name .. "=" .. path.filename(bmifile)}
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 4eae5f522..64f98bcab 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -51,7 +51,7 @@ rule("c++.build.modules")
-- build dependencies
rule("c++.build.modules.dependencies")
- before_build(function(target, opt)
+ before_buildcmd(function(target, batchcmds, opt)
if not target:data("cxx.has_modules") then
return
end