diff options
author | Chris Robinson <[email protected]> | 2023-04-10 12:37:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-04-10 15:52:26 -0700 |
commit | 31f33369135c80cfceec9765b73fa6556641cd2e (patch) | |
tree | dcec2d30a57719db9c4d32b8154118c2661c2d07 /CMakeLists.txt | |
parent | 3853e31feb6662fa592b7f88ed5f09fee99db12e (diff) |
Add a version script for non-Windows/macOS systems
To more aggressively control library exports. Despite the -fvisibility=hidden
flag that should hide everything by default, GNU's libstdc++ forces default
visibility for generated std namespace symbols (from template functions that
don't inline, for example), adding some standard C++ symbols to the exported
symbol list. This can cause ABI problems if an app links to OpenAL and uses one
of those symbols, as a future internal change can cause the function to not be
generated and make the symbol no longer available. There seems to be no way to
prevent this, aside from this version script.
This has the added advantage of ensuring future extension functions don't
accidentally get exported due to the ALC_API or AL_API macros making them
visible.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 03a24828..1fd3f0fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -751,7 +751,7 @@ set(OPENAL_OBJS al/effects/dedicated.cpp al/effects/distortion.cpp al/effects/echo.cpp - al/effects/effects.cpp + al/effects/effects.cpp al/effects/effects.h al/effects/equalizer.cpp al/effects/fshifter.cpp @@ -801,7 +801,7 @@ set(ALC_OBJS alc/inprogext.h alc/panning.cpp) -if (ALSOFT_EAX) +if(ALSOFT_EAX) set(OPENAL_OBJS ${OPENAL_OBJS} al/eax/api.cpp @@ -820,8 +820,8 @@ if (ALSOFT_EAX) al/eax/utils.cpp al/eax/utils.h al/eax/x_ram.h -) -endif () + ) +endif() # Include SIMD mixers set(CPU_EXTS "Default") @@ -1373,6 +1373,7 @@ else() # the project set(TARGET_PUBLIC_HEADERS include/AL/al.h include/AL/alc.h include/AL/alext.h include/AL/efx.h include/AL/efx-presets.h) + add_library(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS} ${CORE_OBJS} ${RC_CONFIG} ${TARGET_PUBLIC_HEADERS}) if(WIN32) @@ -1380,6 +1381,13 @@ else() endif() target_link_libraries(${IMPL_TARGET} PRIVATE common ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB}) + if(NOT WIN32 AND NOT APPLE) + # FIXME: This doesn't put a dependency on the version script. Changing + # the version script will not cause a relink as it should. + set_property(TARGET ${IMPL_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,--version-script=${OpenAL_SOURCE_DIR}/libopenal.version") + endif() + if(APPLE AND ALSOFT_OSX_FRAMEWORK) # Sets framework name to soft_oal to avoid ambiguity with the system OpenAL.framework set(LIBNAME "soft_oal") |