summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/clang.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-11-30 18:05:05 +0100
committerArthur LAURENT <[email protected]>2022-11-30 18:05:05 +0100
commit6bcfad861ab7c499681e3a48ecdfd9262ef3d683 (patch)
treef2f94ceba4bac7e9c8ebe12d2147182dd926b63f /xmake/rules/c++/modules/modules_support/clang.lua
parent0a41257cd7d84d2def20cbed5886cb6027727d7b (diff)
Generate dependencies of preprocessed modules to avoid importing #ifdef import
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/clang.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index e67bacef1..160c08b25 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -150,7 +150,12 @@ function generate_dependencies(target, sourcebatch, opt)
-- no support of p1689 atm
local jsonfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".json"))
- common.fallback_generate_dependencies(target, jsonfile, sourcefile)
+ common.fallback_generate_dependencies(target, jsonfile, sourcefile, function(file)
+ local compinst = target:compiler("cxx")
+ local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i"))
+ os.vrunv(compinst:program(), {"-E", "-x", "c++", file, "-o", ifile})
+ return io.readfile(ifile)
+ end)
changed = true
local dependinfo = io.readfile(jsonfile)