summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/support.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-04-24 16:35:23 +0200
committerArthur LAURENT <[email protected]>2025-04-24 16:35:23 +0200
commit58854bf7b3018a7d52dbaea096cdd4d2307dc27d (patch)
tree66dcda01a8a8648e82877a1b1da2a32530e81841 /xmake/rules/c++/modules/support.lua
parent175b91c0dbd964499e1049db5c70991deb87123c (diff)
(C++ modules support) factorize implementation getter
Diffstat (limited to 'xmake/rules/c++/modules/support.lua')
-rw-r--r--xmake/rules/c++/modules/support.lua21
1 files changed, 13 insertions, 8 deletions
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua
index e1e244c08..3d9f108ab 100644
--- a/xmake/rules/c++/modules/support.lua
+++ b/xmake/rules/c++/modules/support.lua
@@ -26,22 +26,27 @@ import("core.project.project")
import("core.project.config")
function _support(target)
+ return import_implementation_of(target, "support")
+end
+
+function import_implementation_of(target, name)
+
local cachekey = tostring(target)
- local support = memcache():get2("support", cachekey)
- if support == nil then
+ local implementation = memcache():get2(name, cachekey)
+ if implementation == nil then
if target:has_tool("cxx", "clang", "clangxx", "clang_cl") then
- support = import("clang.support", {anonymous = true})
+ implementation = import("clang." .. name, {anonymous = true})
elseif target:has_tool("cxx", "gcc", "gxx") then
- support = import("gcc.support", {anonymous = true})
+ implementation = import("gcc." .. name, {anonymous = true})
elseif target:has_tool("cxx", "cl") then
- support = import("msvc.support", {anonymous = true})
+ implementation = import("msvc." .. name, {anonymous = true})
else
local _, toolname = target:tool("cxx")
- raise("compiler(%s): does not support c++ module!", toolname)
+ raise("compiler(%s): does not implementation c++ module!", toolname)
end
- memcache():set2("support", cachekey, support)
+ memcache():set2(name, cachekey, implementation)
end
- return support
+ return implementation
end
-- load module support for the current target