summaryrefslogtreecommitdiff
path: root/xmake/rules/c++
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-11-26 15:44:09 +0100
committerArthur LAURENT <[email protected]>2025-11-26 15:44:09 +0100
commit2efb74bb263ef964aae1f50a7f7ab4e7a4f13a60 (patch)
treeb526a1c3500666e41245d094287c443785425dfb /xmake/rules/c++
parentfee49894d216c926cd789ccf7883e220971c20ef (diff)
(modules) fix get_stdmodules with cross toolchain
Diffstat (limited to 'xmake/rules/c++')
-rw-r--r--xmake/rules/c++/modules/clang/support.lua3
-rw-r--r--xmake/rules/c++/modules/gcc/support.lua3
-rw-r--r--xmake/rules/c++/modules/msvc/support.lua3
-rw-r--r--xmake/rules/c++/modules/scanner.lua2
-rw-r--r--xmake/rules/c++/modules/support.lua6
5 files changed, 7 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/clang/support.lua b/xmake/rules/c++/modules/clang/support.lua
index 9dec0a1e7..ad8d008aa 100644
--- a/xmake/rules/c++/modules/clang/support.lua
+++ b/xmake/rules/c++/modules/clang/support.lua
@@ -245,9 +245,6 @@ end
function get_stdmodules(target)
- if not target:policy("build.c++.modules.std") then
- return
- end
local cpplib = get_cpplibrary_name(target)
if cpplib then
if cpplib == "c++" then
diff --git a/xmake/rules/c++/modules/gcc/support.lua b/xmake/rules/c++/modules/gcc/support.lua
index df0478c46..112272893 100644
--- a/xmake/rules/c++/modules/gcc/support.lua
+++ b/xmake/rules/c++/modules/gcc/support.lua
@@ -168,9 +168,6 @@ function _get_std_module_manifest_path(target)
end
function get_stdmodules(target)
- if not target:policy("build.c++.modules.std") then
- return
- end
local modules_json_path = _get_std_module_manifest_path(target)
if modules_json_path then
local modules_json = json.loadfile(modules_json_path)
diff --git a/xmake/rules/c++/modules/msvc/support.lua b/xmake/rules/c++/modules/msvc/support.lua
index ab2f35ab5..1f066de43 100644
--- a/xmake/rules/c++/modules/msvc/support.lua
+++ b/xmake/rules/c++/modules/msvc/support.lua
@@ -123,9 +123,6 @@ end
-- build c++23 standard modules if needed
function get_stdmodules(target, opt)
opt = opt or {}
- if not target:policy("build.c++.modules.std") then
- return
- end
local msvc
if opt.toolchain then
msvc = toolchain.load("msvc", {plat = opt.toolchain:plat(), arch = opt.toolchain:arch()})
diff --git a/xmake/rules/c++/modules/scanner.lua b/xmake/rules/c++/modules/scanner.lua
index 6d8c9d9bf..8d5fd057d 100644
--- a/xmake/rules/c++/modules/scanner.lua
+++ b/xmake/rules/c++/modules/scanner.lua
@@ -274,7 +274,7 @@ function _get_targetdeps_modules(target)
if sourcebatch.sourcefiles then
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
modules = modules or {}
- if support.is_public(dep, sourcefile) or stdmodules_set:has(sourcefile) then
+ if support.is_public(dep, sourcefile) or (stdmodules_set and stdmodules_set:has(sourcefile)) then
local _fileconfig = dep:fileconfig(sourcefile)
local fileconfig = {}
if _fileconfig then
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua
index 700426e2c..43600c44e 100644
--- a/xmake/rules/c++/modules/support.lua
+++ b/xmake/rules/c++/modules/support.lua
@@ -315,7 +315,13 @@ end
-- get stdmodules
function get_stdmodules(target)
+ if not target:policy("build.c++.modules.std") then
+ return
+ end
local cpplib = get_cpplibrary_name(target)
+ if not cpplib then
+ return
+ end
local stdmodules = memcache():get2(cpplib, "c++.modules.stdmodules")
local stdmodules_set = memcache():get2(cpplib, "c++.modules.stdmodules_set")
if not stdmodules or not stdmodules_set then