summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-24 22:37:40 +0800
committerruki <[email protected]>2022-08-24 22:37:40 +0800
commite94c67aea65b7b64246a79b7f125c11f3268371d (patch)
tree2d4c39d9517cc49fadee76a69e47331d3e951db0
parent0864717f9b9afae5c3fa1a983605b7df2abba8fd (diff)
fix modules for gcc
-rw-r--r--xmake/rules/c++/modules/modules_support/common.lua7
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc.lua2
2 files changed, 7 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua
index 580d52dd9..734a2d070 100644
--- a/xmake/rules/c++/modules/modules_support/common.lua
+++ b/xmake/rules/c++/modules/modules_support/common.lua
@@ -390,17 +390,20 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile)
if not module_name then
module_name = line:match("export%s+module%s+(.+)%s*;")
end
+ if not module_name then
+ module_name = line:match("module%s+(.+)%s*;")
+ end
local module_depname = line:match("import%s+(.+)%s*;")
-- we need parse module interface dep in cxx/impl_unit.cpp, e.g. hello.mpp and hello_impl.cpp
-- @see https://github.com/xmake-io/xmake/pull/2664#issuecomment-1213167314
if not module_depname and not has_module_extension(sourcefile) then
- module_depname = line:match("module%s+(.+)%s*;")
+ module_depname = module_name
end
if module_depname then
local module_dep = {}
-- partition? import :xxx;
if module_depname:startswith(":") then
- module_depname = module_name .. module_depname
+ module_depname = (module_name or "") .. module_depname
elseif module_depname:startswith("\"") then
module_depname = module_depname:sub(2, -2)
module_dep["lookup-method"] = "include-quote"
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua
index 9660466bd..20a8437aa 100644
--- a/xmake/rules/c++/modules/modules_support/gcc.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc.lua
@@ -63,6 +63,8 @@ function load(target)
os.rm(_get_module_mapper())
end
target:add("cxxflags", modulemapperflag .. _get_module_mapper(), {force = true, expand = false})
+ -- fix cxxabi issue, @see https://github.com/xmake-io/xmake/issues/2716#issuecomment-1225057760
+ target:add("cxxflags", "-D_GLIBCXX_USE_CXX11_ABI=0")
end
-- get includedirs for stl headers