summaryrefslogtreecommitdiff
path: root/xmake/rules/c++
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2023-01-07 19:18:18 +0100
committerArthur LAURENT <[email protected]>2023-01-07 19:50:23 +0100
commitd20bf041ae327176e2105ceca24b0089798477a1 (patch)
treeebc703f594d888c4b6a7e457ca5cb841a5e51323 /xmake/rules/c++
parent3755a6f67399b8e42df9f39ec7c506918dbb433a (diff)
fix on macos
fix on macos
Diffstat (limited to 'xmake/rules/c++')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua24
1 files changed, 14 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index 7a63c027d..129221e5d 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -66,13 +66,16 @@ end
-- load module support for the current target
function load(target)
- local modulesflag = get_modulesflag(target)
+ local modulesflag, modulestsflag = get_modulesflag(target)
local builtinmodulemapflag = get_builtinmodulemapflag(target)
local implicitmodulesflag = get_implicitmodulesflag(target)
local noimplicitmodulemapsflag = get_noimplicitmodulemapsflag(target)
-- add module flags
target:add("cxxflags", modulesflag)
+ if not modulesflag or is_host("macos") then
+ target:add("cxxflags", modulestsflag)
+ end
if not target:values("c++.clang.modules.strict") then
target:add("cxxflags", builtinmodulemapflag, {force = true})
@@ -583,20 +586,20 @@ end
function get_modulesflag(target)
local modulesflag = _g.modulesflag
- if modulesflag == nil then
+ local modulestsflag = _g.modulestsflag
+ if modulesflag == nil and modulestsflag == nil then
local compinst = target:compiler("cxx")
if compinst:has_flags("-fmodules", "cxxflags", {flagskey = "clang_modules"}) then
modulesflag = "-fmodules"
end
- if not modulesflag then
- if compinst:has_flags("-fmodules-ts", "cxxflags", {flagskey = "clang_modules_ts"}) then
- modulesflag = "-fmodules-ts"
- end
+ if compinst:has_flags("-fmodules-ts", "cxxflags", {flagskey = "clang_modules_ts"}) then
+ modulestsflag = "-fmodules-ts"
end
- assert(modulesflag, "compiler(clang): does not support c++ module!")
+ assert(modulesflag or modulestsflag, "compiler(clang): does not support c++ module!")
_g.modulesflag = modulesflag or false
+ _g.modulestsflag = modulestsflag or false
end
- return modulesflag or nil
+ return modulesflag or nil, modulestsflag or nil
end
function get_builtinmodulemapflag(target)
@@ -698,8 +701,9 @@ function has_headerunitsupport(target)
local support_headerunits = _g.support_headerunits
if support_headerunits == nil then
local compinst = target:compiler("cxx")
- if compinst:has_flags(get_modulesflag(target) .. " -std=c++20 -x c++-user-header", "cxxflags", {flagskey = "clang_user_header_unit_support", tryrun = true}) and
- compinst:has_flags(get_modulesflag(target) .. " -std=c++20 -x c++-system-header", "cxxflags", {flagskey = "clang_system_header_unit_support", tryrun = true}) then
+ local modulesflag, modulestsflag = get_modulesflag(target)
+ if compinst:has_flags(modulesflag or moduletsflag .. " -std=c++20 -x c++-user-header", "cxxflags", {flagskey = "clang_user_header_unit_support", tryrun = true}) and
+ compinst:has_flags(modulesflag or moduletsflag .. " -std=c++20 -x c++-system-header", "cxxflags", {flagskey = "clang_system_header_unit_support", tryrun = true}) then
support_headerunits = true
end
_g.support_headerunits = support_headerunits or false