File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,15 @@ def options(opts, env):
189189 )
190190 )
191191
192+ opts .Add (
193+ EnumVariable (
194+ key = "symbols_visibility" ,
195+ help = "Symbols visibility on GNU platforms. Use 'auto' to apply the default value." ,
196+ default = env .get ("symbols_visibility" , "hidden" ),
197+ allowed_values = ["auto" , "visible" , "hidden" ],
198+ )
199+ )
200+
192201 # Add platform options
193202 for pl in platforms :
194203 tool = Tool (pl , toolpath = ["tools" ])
@@ -269,6 +278,14 @@ def generate(env):
269278 elif env .get ("is_msvc" , False ):
270279 env .Append (CXXFLAGS = ["/EHsc" ])
271280
281+ if not env .get ("is_msvc" , False ):
282+ if env ["symbols_visibility" ] == "visible" :
283+ env .Append (CCFLAGS = ["-fvisibility=default" ])
284+ env .Append (LINKFLAGS = ["-fvisibility=default" ])
285+ elif env ["symbols_visibility" ] == "hidden" :
286+ env .Append (CCFLAGS = ["-fvisibility=hidden" ])
287+ env .Append (LINKFLAGS = ["-fvisibility=hidden" ])
288+
272289 # Require C++17
273290 if env .get ("is_msvc" , False ):
274291 env .Append (CXXFLAGS = ["/std:c++17" ])
You can’t perform that action at this time.
0 commit comments