[Scons] Added the ability to change the visibility of symbols

(cherry picked from commit f5e4f95cde)
pull/1491/head
DmitriySalnikov 2023-11-20 12:35:41 +03:00 committed by David Snopek
parent 32becf6a13
commit 5f864cd8de
2 changed files with 17 additions and 0 deletions

View File

@ -39,6 +39,14 @@ def generate(env):
elif env.get("is_msvc", False):
env.Append(CXXFLAGS=["/EHsc"])
if not env.get("is_msvc", False):
if env["symbols_visibility"] == "visible":
env.Append(CCFLAGS=["-fvisibility=default"])
env.Append(LINKFLAGS=["-fvisibility=default"])
elif env["symbols_visibility"] == "hidden":
env.Append(CCFLAGS=["-fvisibility=hidden"])
env.Append(LINKFLAGS=["-fvisibility=hidden"])
# Set optimize and debug_symbols flags.
# "custom" means do nothing and let users set their own optimization flags.
if env.get("is_msvc", False):

View File

@ -291,6 +291,15 @@ def options(opts, env):
)
)
opts.Add(
EnumVariable(
key="symbols_visibility",
help="Symbols visibility on GNU platforms. Use 'auto' to apply the default value.",
default=env.get("symbols_visibility", "hidden"),
allowed_values=["auto", "visible", "hidden"],
)
)
opts.Add(
EnumVariable(
"optimize",