summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/common.lua
diff options
context:
space:
mode:
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)