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/clang.lua | |
| parent | cc8ee163098a464937769641377fd98c33bdfca2 (diff) | |
improve load modules
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/clang.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang.lua | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua index e1e136c97..04ea0ab6e 100644 --- a/xmake/rules/c++/modules/modules_support/clang.lua +++ b/xmake/rules/c++/modules/modules_support/clang.lua @@ -27,20 +27,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 cachedir = common.modules_cachedir(target) - - local prebuiltmodulepathflag = get_prebuiltmodulepathflag(target) - - for _, dep in ipairs(target:orderdeps()) do - cachedir = common.modules_cachedir(dep) - target:add("cxxflags", prebuiltmodulepathflag .. cachedir, {force = true}) - end -end - --- check C++20 module support -function check_module_support(target) +-- load module support for the current target +function load(target) local compinst = compiler.load("cxx", {target = target}) local cachedir = common.modules_cachedir(target) local stlcachedir = common.stlmodules_cachedir(target) @@ -57,8 +45,14 @@ function check_module_support(target) -- add the module cache directory target:add("cxxflags", implicitmodulesflag, {force = true}) target:add("cxxflags", implicitmodulemapsflag, {force = true}) - target:add("cxxflags", prebuiltmodulepathflag .. cachedir, prebuiltmodulepathflag .. stlcachedir, {force = true}) + + -- add module cachedirs of all dependent targets with modules + -- this target maybe does not contain module files + for _, dep in ipairs(target:orderdeps()) do + cachedir = common.modules_cachedir(dep) + target:add("cxxflags", prebuiltmodulepathflag .. cachedir, {force = true}) + end end function toolchain_include_directories(target) |
