Fixed dylib generation on macOS

We just build libSDL3.dylib instead of libSDL3.0.0.0.dylib with symlinks

Fixed the compatiblity vs current version, e.g.

SDL 3.20.87
    @rpath/libSDL3.0.dylib (compatibility version 2001.0.0, current version 2001.87.0)

SDL 3.21.5
    @rpath/libSDL3.dylib (compatibility version 2106.0.0, current version 2106.0.0)
This commit is contained in:
Sam Lantinga 2022-11-29 11:57:19 -08:00
parent 6f20d990ad
commit 71d5f510c6
1 changed files with 10 additions and 12 deletions

View File

@ -98,18 +98,18 @@ set(SDL_SO_VERSION_MICRO "${SDL_MICRO_VERSION}")
set(SDL_SO_VERSION "${SDL_SO_VERSION_MAJOR}.${SDL_SO_VERSION_MINOR}.${SDL_SO_VERSION_MICRO}")
if(SDL_MINOR_VERSION MATCHES "[02468]$")
math(EXPR SDL_DYLIB_CURRENT_VERSION_MAJOR "100 * ${SDL_MINOR_VERSION} + 1")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "0")
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "${SDL_DYLIB_CURRENT_VERSION_MAJOR}")
set(SDL_DYLIB_COMPAT_VERSION_MINOR "${SDL_MICRO_VERSION}")
else()
math(EXPR SDL_DYLIB_CURRENT_VERSION_MAJOR "100 * ${SDL_MINOR_VERSION} + ${SDL_MICRO_VERSION} + 1")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "0")
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "${SDL_DYLIB_CURRENT_VERSION_MAJOR}")
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "100 * ${SDL_MINOR_VERSION} + 1")
set(SDL_DYLIB_COMPAT_VERSION_MINOR "0")
math(EXPR SDL_DYLIB_CURRENT_VERSION_MAJOR "${SDL_DYLIB_COMPAT_VERSION_MAJOR}")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "${SDL_MICRO_VERSION}")
else()
math(EXPR SDL_DYLIB_COMPAT_VERSION_MAJOR "100 * ${SDL_MINOR_VERSION} + ${SDL_MICRO_VERSION} + 1")
set(SDL_DYLIB_COMPAT_VERSION_MINOR "0")
math(EXPR SDL_DYLIB_CURRENT_VERSION_MAJOR "${SDL_DYLIB_COMPAT_VERSION_MAJOR}")
set(SDL_DYLIB_CURRENT_VERSION_MINOR "0")
endif()
set(SDL_DYLIB_CURRENT_VERSION_MICRO "0")
set(SDL_DYLIB_COMPAT_VERSION_MICRO "0")
set(SDL_DYLIB_CURRENT_VERSION_MICRO "0")
set(SDL_DYLIB_CURRENT_VERSION "${SDL_DYLIB_CURRENT_VERSION_MAJOR}.${SDL_DYLIB_CURRENT_VERSION_MINOR}.${SDL_DYLIB_CURRENT_VERSION_MICRO}")
set(SDL_DYLIB_COMPAT_VERSION "${SDL_DYLIB_COMPAT_VERSION_MAJOR}.${SDL_DYLIB_COMPAT_VERSION_MINOR}.${SDL_DYLIB_COMPAT_VERSION_MICRO}")
@ -3190,10 +3190,8 @@ if(SDL_SHARED)
endif()
endif()
if(APPLE)
# FIXME: Remove SOVERSION in SDL3
set_target_properties(SDL3 PROPERTIES
MACOSX_RPATH 1
SOVERSION "0")
MACOSX_RPATH 1)
elseif(UNIX AND NOT ANDROID)
set_target_properties(SDL3 PROPERTIES
VERSION "${SDL_SO_VERSION}"