make WASAPI configurable in autofoo and cmake (default is on.)
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 01 Jul 2018 17:01:04 +0300
changeset 12054e604fe493d45
parent 12046 8963fea8c431
child 12055 bf70bfa02215
make WASAPI configurable in autofoo and cmake (default is on.)

closes bug #3798.
CMakeLists.txt
configure
configure.in
     1.1 --- a/CMakeLists.txt	Sat Jun 30 20:55:51 2018 +0300
     1.2 +++ b/CMakeLists.txt	Sun Jul 01 17:01:04 2018 +0300
     1.3 @@ -328,6 +328,7 @@
     1.4  endforeach()
     1.5  set_option(VIDEO_COCOA         "Use Cocoa video driver" ${APPLE})
     1.6  set_option(DIRECTX             "Use DirectX for Windows audio/video" ${WINDOWS})
     1.7 +dep_option(WASAPI              "Use the Windows WASAPI audio driver" ON "DIRECTX" OFF)
     1.8  set_option(RENDER_D3D          "Enable the Direct3D render driver" ${WINDOWS})
     1.9  set_option(VIDEO_VIVANTE       "Use Vivante EGL video driver" ${UNIX_SYS})
    1.10  dep_option(VIDEO_VULKAN        "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
    1.11 @@ -1209,7 +1210,7 @@
    1.12        set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
    1.13      endif()
    1.14  
    1.15 -    if(HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
    1.16 +    if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
    1.17        set(SDL_AUDIO_DRIVER_WASAPI 1)
    1.18        file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
    1.19        set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES})
     2.1 --- a/configure	Sat Jun 30 20:55:51 2018 +0300
     2.2 +++ b/configure	Sun Jul 01 17:01:04 2018 +0300
     2.3 @@ -866,6 +866,7 @@
     2.4  enable_pthreads
     2.5  enable_pthread_sem
     2.6  enable_directx
     2.7 +enable_audio_wasapi
     2.8  enable_sdl_dlopen
     2.9  enable_clock_gettime
    2.10  enable_rpath
    2.11 @@ -1620,6 +1621,7 @@
    2.12                            [[default=yes]]
    2.13    --enable-pthread-sem    use pthread semaphores [[default=yes]]
    2.14    --enable-directx        use DirectX for Windows audio/video [[default=yes]]
    2.15 +  --enable-audio-wasapi   use the Windows WASAPI audio driver [[default=yes]]
    2.16    --enable-sdl-dlopen     use dlopen for shared object loading [[default=yes]]
    2.17    --enable-clock_gettime  use clock_gettime() instead of gettimeofday() on
    2.18                            UNIX [[default=yes]]
    2.19 @@ -23231,6 +23233,14 @@
    2.20          SUMMARY_video="${SUMMARY_video} directx"
    2.21          SUMMARY_audio="${SUMMARY_audio} directx"
    2.22  
    2.23 +        # Check whether --enable-audio-wasapi was given.
    2.24 +if test "${enable_audio_wasapi+set}" = set; then :
    2.25 +  enableval=$enable_audio_wasapi;
    2.26 +else
    2.27 +  enable_audio_wasapi=yes
    2.28 +fi
    2.29 +
    2.30 +
    2.31          # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
    2.32          # FIXME:  ...so force it off for now.
    2.33          case "$host" in
    2.34 @@ -24134,10 +24144,11 @@
    2.35  
    2.36                  SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
    2.37              fi
    2.38 -            if test x$have_wasapi = xyes; then
    2.39 +            if test x$have_wasapi = xyes -a x$enable_audio_wasapi = xyes; then
    2.40  
    2.41  $as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h
    2.42  
    2.43 +                SUMMARY_audio="${SUMMARY_audio} wasapi"
    2.44                  SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
    2.45              fi
    2.46              have_audio=yes
     3.1 --- a/configure.in	Sat Jun 30 20:55:51 2018 +0300
     3.2 +++ b/configure.in	Sun Jul 01 17:01:04 2018 +0300
     3.3 @@ -3079,6 +3079,10 @@
     3.4          SUMMARY_video="${SUMMARY_video} directx"
     3.5          SUMMARY_audio="${SUMMARY_audio} directx"
     3.6  
     3.7 +        AC_ARG_ENABLE(audio-wasapi,
     3.8 +AC_HELP_STRING([--enable-audio-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
     3.9 +                                , enable_audio_wasapi=yes)
    3.10 +
    3.11          # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
    3.12          # FIXME:  ...so force it off for now.
    3.13          case "$host" in
    3.14 @@ -3547,8 +3551,9 @@
    3.15                  AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
    3.16                  SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
    3.17              fi
    3.18 -            if test x$have_wasapi = xyes; then
    3.19 +            if test x$have_wasapi = xyes -a x$enable_audio_wasapi = xyes; then
    3.20                  AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
    3.21 +                SUMMARY_audio="${SUMMARY_audio} wasapi"
    3.22                  SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
    3.23              fi
    3.24              have_audio=yes