SFML shared libraries now use ELF visibility on Unixes with gcc >= 4
This commit is contained in:
parent
512a7c63cb
commit
eed112d9ea
@ -133,6 +133,14 @@ macro(sfml_add_library target)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# on Unix systems with gcc 4.x, we must hide public symbols by default
|
||||
# (exported ones are explicitely marked)
|
||||
if((LINUX OR MACOSX) AND COMPILER_GCC)
|
||||
if(${GCC_VERSION} MATCHES "4\\..*")
|
||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# link the target to its SFML dependencies
|
||||
if(THIS_DEPENDS)
|
||||
target_link_libraries(${target} ${THIS_DEPENDS})
|
||||
|
@ -97,7 +97,9 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define portable import / export macros
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(SFML_SYSTEM_WINDOWS) && !defined(SFML_STATIC)
|
||||
#if !defined(SFML_STATIC)
|
||||
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
|
||||
#ifdef SFML_EXPORTS
|
||||
|
||||
@ -120,9 +122,25 @@
|
||||
|
||||
#endif
|
||||
|
||||
#else // Linux, FreeBSD, Mac OS X
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
|
||||
// gcc 4 has special keywords for showing/hidding symbols
|
||||
#define SFML_API __attribute__ ((visibility ("default")))
|
||||
|
||||
#else
|
||||
|
||||
// gcc < 4 has no mechanism to explicitely hide symbols, everything's exported
|
||||
#define SFML_API
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// Other platforms and static build don't need these export macros
|
||||
// Static build doesn't need these export macros
|
||||
#define SFML_API
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user