mirror of https://github.com/encounter/SDL.git
cmake: fix a bunch of things to properly link without LOADSO enabled.
The wrong logic, copy/pasted to a bunch of places, would correctly disable the dynamic loading but fail to specify the libraries that SDL would now need to explicitly link against.
This commit is contained in:
parent
abba181118
commit
fff421f4b8
|
@ -101,14 +101,13 @@ macro(CheckALSA)
|
|||
file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_ALSA 1)
|
||||
if(ALSA_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(ALSA_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
|
||||
else()
|
||||
endif()
|
||||
if(ALSA_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("asound")
|
||||
set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
|
||||
set(HAVE_ALSA_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LIBS asound)
|
||||
endif()
|
||||
|
@ -131,14 +130,13 @@ macro(CheckPipewire)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${PIPEWIRE_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_PIPEWIRE 1)
|
||||
list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS})
|
||||
if(PIPEWIRE_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading")
|
||||
else()
|
||||
endif()
|
||||
if(PIPEWIRE_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("pipewire-0.3")
|
||||
set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
|
||||
set(HAVE_PIPEWIRE_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${PKG_PIPEWIRE_LDFLAGS})
|
||||
endif()
|
||||
|
@ -162,14 +160,13 @@ macro(CheckPulseAudio)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${PULSEAUDIO_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_PULSEAUDIO 1)
|
||||
list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS})
|
||||
if(PULSEAUDIO_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
|
||||
else()
|
||||
endif()
|
||||
if(PULSEAUDIO_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("pulse-simple")
|
||||
set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
|
||||
set(HAVE_PULSEAUDIO_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS})
|
||||
endif()
|
||||
|
@ -192,14 +189,13 @@ macro(CheckJACK)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_JACK 1)
|
||||
list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS})
|
||||
if(JACK_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(JACK_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading")
|
||||
else()
|
||||
endif()
|
||||
if(JACK_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("jack")
|
||||
set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"")
|
||||
set(HAVE_JACK_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${PKG_JACK_LDFLAGS})
|
||||
endif()
|
||||
|
@ -222,14 +218,13 @@ macro(CheckESD)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${ESD_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_ESD 1)
|
||||
list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS})
|
||||
if(ESD_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(ESD_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic ESD loading")
|
||||
else()
|
||||
endif()
|
||||
if(ESD_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME(esd)
|
||||
set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"")
|
||||
set(HAVE_ESD_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS})
|
||||
endif()
|
||||
|
@ -256,15 +251,14 @@ macro(CheckARTS)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${ARTS_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_ARTS 1)
|
||||
set(HAVE_ARTS TRUE)
|
||||
if(ARTS_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(ARTS_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading")
|
||||
else()
|
||||
endif()
|
||||
if(ARTS_SHARED AND HAVE_SDL_LOADSO)
|
||||
# TODO
|
||||
FindLibraryAndSONAME(artsc)
|
||||
set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"")
|
||||
set(HAVE_ARTS_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS})
|
||||
endif()
|
||||
|
@ -288,14 +282,13 @@ macro(CheckNAS)
|
|||
file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${NAS_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_NAS 1)
|
||||
if(NAS_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(NAS_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic NAS loading")
|
||||
else()
|
||||
endif()
|
||||
if(NAS_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("audio")
|
||||
set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"")
|
||||
set(HAVE_NAS_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LIBS ${D_NAS_LIB})
|
||||
endif()
|
||||
|
@ -319,14 +312,13 @@ macro(CheckSNDIO)
|
|||
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_SNDIO 1)
|
||||
if(SNDIO_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
|
||||
else()
|
||||
endif()
|
||||
if(SNDIO_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("sndio")
|
||||
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
|
||||
set(HAVE_SNDIO_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
|
||||
endif()
|
||||
|
@ -349,14 +341,13 @@ macro(CheckFusionSound)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${FUSIONSOUND_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_FUSIONSOUND 1)
|
||||
list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS})
|
||||
if(FUSIONSOUND_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading")
|
||||
else()
|
||||
endif()
|
||||
if(FUSIONSOUND_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("fusionsound")
|
||||
set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"")
|
||||
set(HAVE_FUSIONSOUND_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS})
|
||||
endif()
|
||||
|
@ -375,14 +366,13 @@ macro(CheckLibSampleRate)
|
|||
check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H)
|
||||
if(HAVE_LIBSAMPLERATE_H)
|
||||
set(HAVE_LIBSAMPLERATE TRUE)
|
||||
if(LIBSAMPLERATE_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading")
|
||||
else()
|
||||
endif()
|
||||
if(LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("samplerate")
|
||||
set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"")
|
||||
set(HAVE_LIBSAMPLERATE_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS -lsamplerate)
|
||||
endif()
|
||||
|
@ -668,10 +658,10 @@ macro(CheckWayland)
|
|||
set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
|
||||
endif()
|
||||
|
||||
if(WAYLAND_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading")
|
||||
else()
|
||||
endif()
|
||||
if(WAYLAND_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME(wayland-client)
|
||||
FindLibraryAndSONAME(wayland-egl)
|
||||
FindLibraryAndSONAME(wayland-cursor)
|
||||
|
@ -681,7 +671,6 @@ macro(CheckWayland)
|
|||
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"")
|
||||
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
|
||||
set(HAVE_WAYLAND_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS})
|
||||
endif()
|
||||
|
@ -693,14 +682,13 @@ macro(CheckWayland)
|
|||
set(HAVE_LIBDECOR_H 1)
|
||||
link_directories(${LIBDECOR_LIBRARY_DIRS})
|
||||
include_directories(${LIBDECOR_INCLUDE_DIRS})
|
||||
if(LIBDECOR_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
|
||||
else()
|
||||
endif()
|
||||
if(LIBDECOR_SHARED AND HAVE_SDL_LOADSO)
|
||||
set(HAVE_LIBDECOR_SHARED TRUE)
|
||||
FindLibraryAndSONAME(decor-0)
|
||||
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"")
|
||||
endif()
|
||||
else()
|
||||
set(EXTRA_LIBS ${LIBDECOR_LIBRARIES} ${EXTRA_LIBS})
|
||||
endif()
|
||||
|
@ -745,14 +733,13 @@ macro(CheckDirectFB)
|
|||
set(SDL_VIDEO_DRIVER_DIRECTFB 1)
|
||||
set(SDL_VIDEO_RENDER_DIRECTFB 1)
|
||||
list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS})
|
||||
if(DIRECTFB_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
|
||||
else()
|
||||
endif()
|
||||
if(DIRECTFB_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME("directfb")
|
||||
set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"")
|
||||
set(HAVE_DIRECTFB_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS})
|
||||
endif()
|
||||
|
@ -1242,16 +1229,15 @@ macro(CheckKMSDRM)
|
|||
|
||||
set(SDL_VIDEO_DRIVER_KMSDRM 1)
|
||||
|
||||
if(KMSDRM_SHARED)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
if(KMSDRM_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading")
|
||||
else()
|
||||
endif()
|
||||
if(KMSDRM_SHARED AND HAVE_SDL_LOADSO)
|
||||
FindLibraryAndSONAME(drm)
|
||||
FindLibraryAndSONAME(gbm)
|
||||
set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"")
|
||||
set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"")
|
||||
set(HAVE_KMSDRM_SHARED TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS})
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue