Skip to content

Commit bd22935

Browse files
committed
(C++ modules support) fix clang-cl (disable build.c++.modules.two_phases)
1 parent 89fc551 commit bd22935

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

xmake/rules/c++/modules/clang/builder.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ function _compile(target, flags, module, opt)
106106

107107
opt = opt or {}
108108
local sourcefile = module.sourcefile
109+
if not opt.bmi and opt.objectfile then
110+
sourcefile = module.bmifile
111+
end
109112
local outputfile = ((opt.bmi and not opt.objectfile) or opt.headerunit) and module.bmifile or module.objectfile
110113
local dryrun = option.get("dry-run")
111114
local compinst = target:compiler("cxx")
@@ -182,7 +185,6 @@ function _get_requiresflags(target, module)
182185
end
183186
end
184187
requiresflags = table.unique(requiresflags)
185-
-- table.sort(requiresflags)
186188
support.memcache():set2(cachekey, "requiresflags", requiresflags)
187189
support.memcache():set2(cachekey, "oldrequires", requires)
188190
end

xmake/rules/c++/modules/config.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ function main(target)
6767
wprint("build.c++.modules.tryreuse.discriminate_on_defines is deprecated, please use build.c++.modules.reuse.strict")
6868
end
6969

70+
if target:has_tool("cxx", "clang_cl") then
71+
target:set("policy", "build.c++.modules.two_phases", false)
72+
end
73+
7074
-- if containes modules, enable objectfiles output of c++.build.modules.builder
7175
local rule = target:rule("c++.build.modules.builder")
7276
rule = rule:clone()

0 commit comments

Comments
 (0)