summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-08 23:31:35 +0800
committerruki <[email protected]>2022-08-08 23:31:35 +0800
commitad67a37fe4981f68c52ae1e7497090a60a30edab (patch)
treeeb07345f116359a3f0810753277bb1f797ecda3e /xmake/rules/c++/modules/xmake.lua
parentd0e4316018f9d75742b26b3abf75860d129c31c8 (diff)
fix module dpes
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
-rw-r--r--xmake/rules/c++/modules/xmake.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 7048ec49b..3c69600bd 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -50,6 +50,7 @@ rule("c++.build.modules")
-- build modules
rule("c++.build.modules.builder")
+ set_sourcekinds("cxx")
set_extensions(".mpp", ".mxx", ".cppm", ".ixx")
-- parallel build support to accelerate `xmake build` to build headerunits
@@ -75,27 +76,28 @@ rule("c++.build.modules.builder")
import("modules_support.common")
local modules = common.get_module_dependencies(target, sourcebatch, opt)
common.build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt)
+ else
+ sourcebatch.objectfiles = {}
end
end, {batch = true})
-- serial compilation only, usually used to support project generator
before_buildcmd_files(function(target, batchcmds, sourcebatch, opt)
- if not target:data("cxx.has_modules") then
- return
- end
-
- -- patch sourcebatch
- import("modules_support.common")
- common.patch_sourcebatch(target, sourcebatch, opt)
+ if target:data("cxx.has_modules") then
+ import("modules_support.common")
- -- get module dependencies
- local modules = common.get_module_dependencies(target, sourcebatch, opt)
+ -- patch sourcebatch
+ common.patch_sourcebatch(target, sourcebatch, opt)
- -- generate headerunits
- common.generate_headerunits_for_batchcmds(target, batchcmds, sourcebatch, modules, opt)
+ -- generate headerunits
+ local modules = common.get_module_dependencies(target, sourcebatch, opt)
+ common.generate_headerunits_for_batchcmds(target, batchcmds, sourcebatch, modules, opt)
- -- build modules
- common.build_modules_for_batchcmds(target, batchcmds, sourcebatch, modules, opt)
+ -- build modules
+ common.build_modules_for_batchcmds(target, batchcmds, sourcebatch, modules, opt)
+ else
+ sourcebatch.objectfiles = {}
+ end
end)
before_link(function(target)