cmake/sdlchecks.cmake: make it diff smaller against SDL2

This commit is contained in:
Ozkan Sezer 2022-12-02 03:01:02 +03:00
parent 378b1c286a
commit bb8adf74e0

View File

@ -165,35 +165,6 @@ macro(CheckPulseAudio)
endif()
endmacro()
# Requires:
# - PkgCheckModules
# Optional:
# - SDL_SNDIO_SHARED opt
# - HAVE_SDL_LOADSO opt
macro(CheckSNDIO)
if(SDL_SNDIO)
pkg_check_modules(PKG_SNDIO sndio)
if(PKG_SNDIO_FOUND)
set(HAVE_SNDIO TRUE)
file(GLOB SNDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sndio/*.c)
list(APPEND SOURCE_FILES ${SNDIO_SOURCES})
set(SDL_AUDIO_DRIVER_SNDIO 1)
list(APPEND EXTRA_CFLAGS ${PKG_SNDIO_CFLAGS})
if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
endif()
FindLibraryAndSONAME("sndio" LIBDIRS ${PKG_SNDIO_LIBRARY_DIRS})
if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
set(HAVE_SNDIO_SHARED TRUE)
else()
list(APPEND EXTRA_LIBS ${PKG_SNDIO_LDFLAGS})
endif()
set(HAVE_SDL_AUDIO TRUE)
endif()
endif()
endmacro()
# Requires:
# - PkgCheckModules
# Optional:
@ -223,6 +194,35 @@ macro(CheckJACK)
endif()
endmacro()
# Requires:
# - PkgCheckModules
# Optional:
# - SDL_SNDIO_SHARED opt
# - HAVE_SDL_LOADSO opt
macro(CheckSNDIO)
if(SDL_SNDIO)
pkg_check_modules(PKG_SNDIO sndio)
if(PKG_SNDIO_FOUND)
set(HAVE_SNDIO TRUE)
file(GLOB SNDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sndio/*.c)
list(APPEND SOURCE_FILES ${SNDIO_SOURCES})
set(SDL_AUDIO_DRIVER_SNDIO 1)
list(APPEND EXTRA_CFLAGS ${PKG_SNDIO_CFLAGS})
if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
endif()
FindLibraryAndSONAME("sndio" LIBDIRS ${PKG_SNDIO_LIBRARY_DIRS})
if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
set(HAVE_SNDIO_SHARED TRUE)
else()
list(APPEND EXTRA_LIBS ${PKG_SNDIO_LDFLAGS})
endif()
set(HAVE_SDL_AUDIO TRUE)
endif()
endif()
endmacro()
# Requires:
# - SDL_LIBSAMPLERATE
# Optional: