summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/common.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-08-03 03:28:35 +0200
committerArthur LAURENT <[email protected]>2022-08-03 03:28:35 +0200
commitda5627858bd40e911a8d5514a80613e35f5716e1 (patch)
tree7293244f6d9bfb876e8882118fb8a0d82294b2de /xmake/rules/c++/modules/modules_support/common.lua
parentfd7340759c71bd253da2d2ccaeede55fb57dfa24 (diff)
[C++20 Modules] Use a helper function to get module_builder
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/common.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/common.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua
index 0bfcc7211..7df0b3d34 100644
--- a/xmake/rules/c++/modules/modules_support/common.lua
+++ b/xmake/rules/c++/modules/modules_support/common.lua
@@ -148,6 +148,21 @@ function get_bmi_ext(target)
assert(false)
end
+function modules_support(target)
+ local module_builder
+ if target:has_tool("cxx", "clang", "clangxx") then
+ module_builder = import("clang", {anonymous = true})
+ elseif target:has_tool("cxx", "gcc", "gxx") then
+ module_builder = import("gcc", {anonymous = true})
+ elseif target:has_tool("cxx", "cl") then
+ module_builder = import("msvc", {anonymous = true})
+ else
+ local _, toolname = target:tool("cxx")
+ raise("compiler(%s): does not support c++ module!", toolname)
+ end
+ return module_builder
+end
+
function load(target, sourcebatch, opt)
local cachedir = get_cache_dir(target)