Skip to content

Commit

Permalink
fix gcc modules
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Nov 26, 2024
1 parent 3276686 commit bf016ac
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ function load(target)
-- @see https://github.com/xmake-io/xmake/issues/2716#issuecomment-1225057760
-- https://github.com/xmake-io/xmake/issues/3855

-- libstdc++ std modules cannot compile with -D_GLIBCXX_USE_CXX11_ABI=0
if target:policy("build.c++.modules.std") or target:policy("build.c++.gcc.modules.cxx11abi") then
if target:policy("build.c++.gcc.modules.cxx11abi") then
target:add("cxxflags", "-D_GLIBCXX_USE_CXX11_ABI=1")
else
target:add("cxxflags", "-D_GLIBCXX_USE_CXX11_ABI=0")
Expand Down Expand Up @@ -158,12 +157,12 @@ end

function get_stdmodules(target)
if not target:policy("build.c++.modules.std") then
return nil
return
end

local modules_json_path = _get_std_module_manifest_path(target)
if not modules_json_path then
return nil
return
end

local modules_json = json.loadfile(modules_json_path)
Expand Down Expand Up @@ -198,6 +197,7 @@ function get_modulesflag(target)
modulesflag = "-fmodules-ts"
end
elseif compinst:has_flags("-fmodules-ts", "cxxflags", {flagskey = "gcc_modules_ts"}) then
if compinst:has_flags("-fmodules-ts", "cxxflags", {flagskey = "gcc_modules_ts"}) then
modulesflag = "-fmodules-ts"
end
assert(modulesflag, "compiler(gcc): does not support c++ module!")
Expand Down

0 comments on commit bf016ac

Please sign in to comment.