Skip to content

Commit 69f46e7

Browse files
authored
Merge pull request #7067 from Arthapz/fix-cross-modules
(modules) fix get_stdmodules with cross toolchain
2 parents 361e63e + 2efb74b commit 69f46e7

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ end
245245

246246
function get_stdmodules(target)
247247

248-
if not target:policy("build.c++.modules.std") then
249-
return
250-
end
251248
local cpplib = get_cpplibrary_name(target)
252249
if cpplib then
253250
if cpplib == "c++" then

xmake/rules/c++/modules/gcc/support.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ function _get_std_module_manifest_path(target)
168168
end
169169

170170
function get_stdmodules(target)
171-
if not target:policy("build.c++.modules.std") then
172-
return
173-
end
174171
local modules_json_path = _get_std_module_manifest_path(target)
175172
if modules_json_path then
176173
local modules_json = json.loadfile(modules_json_path)

xmake/rules/c++/modules/msvc/support.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ end
123123
-- build c++23 standard modules if needed
124124
function get_stdmodules(target, opt)
125125
opt = opt or {}
126-
if not target:policy("build.c++.modules.std") then
127-
return
128-
end
129126
local msvc
130127
if opt.toolchain then
131128
msvc = toolchain.load("msvc", {plat = opt.toolchain:plat(), arch = opt.toolchain:arch()})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function _get_targetdeps_modules(target)
274274
if sourcebatch.sourcefiles then
275275
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
276276
modules = modules or {}
277-
if support.is_public(dep, sourcefile) or stdmodules_set:has(sourcefile) then
277+
if support.is_public(dep, sourcefile) or (stdmodules_set and stdmodules_set:has(sourcefile)) then
278278
local _fileconfig = dep:fileconfig(sourcefile)
279279
local fileconfig = {}
280280
if _fileconfig then

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,13 @@ end
315315

316316
-- get stdmodules
317317
function get_stdmodules(target)
318+
if not target:policy("build.c++.modules.std") then
319+
return
320+
end
318321
local cpplib = get_cpplibrary_name(target)
322+
if not cpplib then
323+
return
324+
end
319325
local stdmodules = memcache():get2(cpplib, "c++.modules.stdmodules")
320326
local stdmodules_set = memcache():get2(cpplib, "c++.modules.stdmodules_set")
321327
if not stdmodules or not stdmodules_set then

0 commit comments

Comments
 (0)