Files
AnyPS5/cmake/Opus.cmake
T
p3nicillinandClaude Opus 5.5 a6e9733c17 fix(opus): hide libopus symbols and package its notice as a license
Build the bundled libopus with hidden visibility and an empty OPUS_EXPORT,
so its symbols stay internal without relying on --exclude-libs (which
Apple's linker lacks). Turn off OPUS_STACK_PROTECTOR and
OPUS_FORTIFY_SOURCE so MinGW builds do not import libssp-0.dll, as in
27c0acabe2 from #9764. Ship the notice through the licenses list as
libs/licenses/opus.txt, like vgmstream.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 23:09:24 +01:00

20 lines
730 B
CMake

function(add_bundled_opus)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_TESTING OFF)
set(OPUS_BUILD_SHARED_LIBRARY OFF)
set(OPUS_BUILD_TESTING OFF)
set(OPUS_BUILD_PROGRAMS OFF)
set(OPUS_INSTALL_PKG_CONFIG_MODULE OFF)
set(OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF)
set(OPUS_STACK_PROTECTOR OFF)
set(OPUS_FORTIFY_SOURCE OFF)
add_subdirectory(3rdparty/opus EXCLUDE_FROM_ALL)
set_target_properties(opus PROPERTIES POSITION_INDEPENDENT_CODE ON C_VISIBILITY_PRESET hidden)
target_compile_definitions(opus PRIVATE OPUS_EXPORT=)
if(MINGW OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_options(opus INTERFACE LINKER:--exclude-libs,libopus.a)
endif()
endfunction()
add_bundled_opus()