summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-11-04 23:05:57 +0800
committerruki <[email protected]>2022-11-04 23:05:57 +0800
commite72b3d194ec9398f52f4bcef14e2e1478b3a5956 (patch)
treeccfe358bd681f4eb097080243059c306409fc0c5
parentd0fc528d4bfa6a526055dad72bdc9942333a2d9c (diff)
improve symbols for clang
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index e0a7b0228..0727cb6d5 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -75,11 +75,22 @@ function load(target)
target:add("cxxflags", builtinmodulemapflag, {force = true})
target:add("cxxflags", implicitmodulesflag, {force = true})
- -- TODO fix default visibility for functions and variables [-fvisibility] differs in PCH file vs. current file
+ -- fix default visibility for functions and variables [-fvisibility] differs in PCH file vs. current file
-- module.pcm cannot be loaded due to a configuration mismatch with the current compilation.
--
-- it will happen in binary target depend ont shared target with modules, and enable release mode at same time.
- target:set("symbols", "none")
+ local dep_symbols
+ local has_shared_deps = false
+ for _, dep in ipairs(target:orderdeps()) do
+ if dep:is_shared() then
+ dep_symbols = dep:get("symbols")
+ has_shared_deps = true
+ break
+ end
+ end
+ if has_shared_deps then
+ target:set("symbols", dep_symbols and dep_symbols or "none")
+ end
-- if use libc++, we need install libc++ and libc++abi
--