diff options
| author | ruki <[email protected]> | 2022-08-04 22:37:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-08-04 22:37:59 +0800 |
| commit | 0e52b4967cd20677c1dcc7656e2016c076ed2647 (patch) | |
| tree | 67d13c3ee93e036a3429c269b9578a3ddaab625b /xmake/rules/c++/modules/modules_support/msvc.lua | |
| parent | cc8ee163098a464937769641377fd98c33bdfca2 (diff) | |
improve load modules
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index c7a6f6c15..98d244626 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -14,7 +14,7 @@ -- -- Copyright (C) 2015-present, TBOOX Open Source Group. -- --- @author ruki +-- @author ruki, Arthapz -- @file msvc.lua -- @@ -26,18 +26,8 @@ import("utils.progress") import("private.action.build.object", {alias = "objectbuilder"}) import("common") --- load parent target with modules files -function load_parent(target, opt) - local ifcsearchdirflag = get_ifcsearchdirflag(target) - - for _, dep in ipairs(target:orderdeps()) do - cachedir = common.modules_cachedir(dep) - target:add("cxxflags", {ifcsearchdirflag, cachedir}, {force = true, expand = false}) - end -end - --- check C++20 module support -function check_module_support(target) +-- load module support for the current target +function load(target) local compinst = target:compiler("cxx") local cachedir = common.modules_cachedir(target) local stlcachedir = common.stlmodules_cachedir(target) @@ -65,6 +55,14 @@ function check_module_support(target) break end end + + -- add module cachedirs of all dependent targets with modules + -- this target maybe does not contain module files + local ifcsearchdirflag = get_ifcsearchdirflag(target) + for _, dep in ipairs(target:orderdeps()) do + cachedir = common.modules_cachedir(dep) + target:add("cxxflags", {ifcsearchdirflag, cachedir}, {force = true, expand = false}) + end end -- provide toolchain include dir for stl headerunit when p1689 is not supported |
