cmake/sdlchecks.cmake
changeset 7367 d6eabafa8776
parent 7266 6caad66a4966
child 7400 243dad4e5f29
     1.1 --- a/cmake/sdlchecks.cmake	Sun Jul 07 02:04:19 2013 -0400
     1.2 +++ b/cmake/sdlchecks.cmake	Sun Jul 07 02:03:07 2013 -0400
     1.3 @@ -226,6 +226,37 @@
     1.4  endmacro(CheckNAS)
     1.5  
     1.6  # Requires:
     1.7 +# - n/a
     1.8 +# Optional:
     1.9 +# - SNDIO_SHARED opt
    1.10 +# - HAVE_DLOPEN opt
    1.11 +macro(CheckSNDIO)
    1.12 +  if(SNDIO)
    1.13 +    # TODO: set include paths properly, so the sndio headers are found
    1.14 +    check_include_file(sndio.h HAVE_SNDIO_H)
    1.15 +    find_library(D_SNDIO_LIB audio)
    1.16 +    if(HAVE_SNDIO_H AND D_SNDIO_LIB)
    1.17 +      set(HAVE_SNDIO TRUE)
    1.18 +      file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
    1.19 +      set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
    1.20 +      set(SDL_AUDIO_DRIVER_SNDIO 1)
    1.21 +      if(SNDIO_SHARED)
    1.22 +        if(NOT HAVE_DLOPEN)
    1.23 +          message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
    1.24 +        else()
    1.25 +          get_filename_component(F_SNDIO_LIB ${D_SNDIO_LIB} NAME)
    1.26 +          set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${F_SNDIO_LIB}\"")
    1.27 +          set(HAVE_SNDIO_SHARED TRUE)
    1.28 +        endif(NOT HAVE_DLOPEN)
    1.29 +      else(SNDIO_SHARED)
    1.30 +        list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
    1.31 +      endif(SNDIO_SHARED)
    1.32 +      set(HAVE_SDL_AUDIO TRUE)
    1.33 +    endif(HAVE_SNDIO_H AND D_SNDIO_LIB)
    1.34 +  endif(SNDIO)
    1.35 +endmacro(CheckSNDIO)
    1.36 +
    1.37 +# Requires:
    1.38  # - PkgCheckModules
    1.39  # Optional:
    1.40  # - FUSIONSOUND_SHARED opt