build: Simplify library name

We want the library to come out as libSDL3.so.0 on Unix, or something
similar on other platforms. There's no need to have libSDL3-3.0.so.0,
because next time we intentionally break the API it should become libSDL4
anyway.

Partially implements #5626.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-11-23 16:33:38 +00:00 committed by Sam Lantinga
parent 4574c16178
commit 7ef38beb7e
4 changed files with 7 additions and 21 deletions

View File

@ -88,7 +88,7 @@ jobs:
ctest -VV --test-dir build/ ctest -VV --test-dir build/
if test "${{ runner.os }}" = "Linux"; then if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION # This should show us the SDL_REVISION
strings build/libSDL3-3.0.so.0 | grep SDL- strings build/libSDL3.so.0 | grep SDL-
fi fi
- name: Install (CMake) - name: Install (CMake)
if: "! matrix.platform.autotools" if: "! matrix.platform.autotools"
@ -147,7 +147,7 @@ jobs:
make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs" make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
if test "${{ runner.os }}" = "Linux"; then if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION # This should show us the SDL_REVISION
strings "${curdir}/build-autotools/build/.libs/libSDL3-3.0.so.0" | grep SDL- strings "${curdir}/build-autotools/build/.libs/libSDL3.so.0" | grep SDL-
fi fi
- name: Install (Autotools) - name: Install (Autotools)
if: matrix.platform.autotools if: matrix.platform.autotools

View File

@ -113,11 +113,6 @@ set(LT_MAJOR "0")
math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}")
math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}") math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}")
set(LT_REVISION "${SDL_INTERFACE_AGE}") set(LT_REVISION "${SDL_INTERFACE_AGE}")
# For historical reasons, the library name redundantly includes the major
# version twice: libSDL3-3.0.so.0.
# TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3, which will simplify
# it to libSDL3.so.0
set(LT_RELEASE "3.0")
set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}")
# The following should match the versions in the Xcode project file. # The following should match the versions in the Xcode project file.
@ -133,7 +128,7 @@ set(DYLIB_COMPATIBILITY_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.0.0")
# To avoid generating them twice, these are added to a dummy target on which all sdl targets depend. # To avoid generating them twice, these are added to a dummy target on which all sdl targets depend.
set(SDL_GENERATED_HEADERS) set(SDL_GENERATED_HEADERS)
#message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}") #message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT}")
check_cpu_architecture(x86 SDL_CPU_X86) check_cpu_architecture(x86 SDL_CPU_X86)
check_cpu_architecture(x64 SDL_CPU_X64) check_cpu_architecture(x64 SDL_CPU_X64)
@ -3259,13 +3254,11 @@ if(SDL_SHARED)
# FIXME: Remove SOVERSION in SDL3 # FIXME: Remove SOVERSION in SDL3
set_target_properties(SDL3 PROPERTIES set_target_properties(SDL3 PROPERTIES
MACOSX_RPATH 1 MACOSX_RPATH 1
SOVERSION 0 SOVERSION 0)
OUTPUT_NAME "SDL3-${LT_RELEASE}")
elseif(UNIX AND NOT ANDROID) elseif(UNIX AND NOT ANDROID)
set_target_properties(SDL3 PROPERTIES set_target_properties(SDL3 PROPERTIES
VERSION ${LT_VERSION} VERSION ${LT_VERSION}
SOVERSION ${LT_MAJOR} SOVERSION ${LT_MAJOR})
OUTPUT_NAME "SDL3-${LT_RELEASE}")
else() else()
if(WINDOWS OR CYGWIN) if(WINDOWS OR CYGWIN)
set_target_properties(SDL3 PROPERTIES set_target_properties(SDL3 PROPERTIES
@ -3273,8 +3266,7 @@ if(SDL_SHARED)
endif() endif()
set_target_properties(SDL3 PROPERTIES set_target_properties(SDL3 PROPERTIES
VERSION ${SDL_VERSION} VERSION ${SDL_VERSION}
SOVERSION ${LT_REVISION} SOVERSION ${LT_REVISION})
OUTPUT_NAME "SDL3")
endif() endif()
# Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB.
if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")

View File

@ -135,9 +135,8 @@ SDLTEST_HDRS = $(shell ls $(srcdir)/include | $(FGREP) SDL_test)
LT_AGE = @LT_AGE@ LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@ LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@ LT_REVISION = @LT_REVISION@
LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) LT_LDFLAGS = -no-undefined -rpath $(libdir) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)

View File

@ -36,10 +36,6 @@ AC_SUBST(SDL_VERSION)
LT_INIT([win32-dll]) LT_INIT([win32-dll])
LT_LANG([Windows Resource]) LT_LANG([Windows Resource])
# For historical reasons, the library name redundantly includes the major
# version twice: libSDL3-3.0.so.0.
# TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0
LT_RELEASE=3.0
# Increment this if there is an incompatible change - but if that happens, # Increment this if there is an incompatible change - but if that happens,
# we should rename the library from SDL2 to SDL3, at which point this would # we should rename the library from SDL2 to SDL3, at which point this would
# reset to 0 anyway. # reset to 0 anyway.
@ -49,7 +45,6 @@ LT_CURRENT=`expr $LT_MAJOR + $LT_AGE`
LT_REVISION=$SDL_INTERFACE_AGE LT_REVISION=$SDL_INTERFACE_AGE
m4_pattern_allow([^LT_]) m4_pattern_allow([^LT_])
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT) AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION) AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE) AC_SUBST(LT_AGE)