Skip to content
Permalink
Browse files

configury, cmake: make wasapi option independent of directx.

  • Loading branch information
sezero committed Sep 28, 2018
1 parent 9aa8a75 commit cf7460e477dffa3c4addd8e9513b9b84b9cfe000
Showing with 33 additions and 31 deletions.
  1. +5 −3 CMakeLists.txt
  2. +22 −22 configure
  3. +6 −6 configure.in
@@ -334,7 +334,7 @@ foreach(_SUB ${SDL_X11_OPTIONS})
endforeach()
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
dep_option(WASAPI "Use the Windows WASAPI audio driver" ON "DIRECTX" OFF)
set_option(WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS})
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
@@ -1200,8 +1200,6 @@ elseif(WINDOWS)
check_include_file(ddraw.h HAVE_DDRAW_H)
check_include_file(dsound.h HAVE_DSOUND_H)
check_include_file(dinput.h HAVE_DINPUT_H)
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
check_include_file(dxgi.h HAVE_DXGI_H)
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
set(HAVE_DIRECTX TRUE)
@@ -1226,6 +1224,10 @@ elseif(WINDOWS)
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
endif()

# headers needed for WASAPI support:
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)

if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
set(SDL_AUDIO_DRIVER_WASAPI 1)
file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
fi


ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
have_wasapi=yes
fi


ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default"
if test "x$ac_cv_header_audioclient_h" = xyes; then :

else
have_wasapi=no
fi


cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

SUMMARY_video="${SUMMARY_video} directx"
SUMMARY_audio="${SUMMARY_audio} directx"

# Check whether --enable-wasapi was given.
if test "${enable_wasapi+set}" = set; then :
enableval=$enable_wasapi;
else
enable_wasapi=yes
fi


# FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
# FIXME: ...so force it off for now.
case "$host" in
;;
esac
fi

ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
have_wasapi=yes
fi


ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default"
if test "x$ac_cv_header_audioclient_h" = xyes; then :

else
have_wasapi=no
fi


# Check whether --enable-wasapi was given.
if test "${enable_wasapi+set}" = set; then :
enableval=$enable_wasapi;
else
enable_wasapi=yes
fi

}

CheckDLOPEN()
@@ -3052,8 +3052,6 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul
AC_CHECK_HEADER(dinput.h, have_dinput=yes)
AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
AC_TRY_COMPILE([
#include <windows.h>
#include <xinput.h>
@@ -3090,10 +3088,6 @@ XINPUT_STATE_EX s1;
SUMMARY_video="${SUMMARY_video} directx"
SUMMARY_audio="${SUMMARY_audio} directx"

AC_ARG_ENABLE(wasapi,
AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
, enable_wasapi=yes)

# FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
# FIXME: ...so force it off for now.
case "$host" in
@@ -3102,6 +3096,12 @@ AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default
;;
esac
fi

AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
AC_ARG_ENABLE(wasapi,
AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
, enable_wasapi=yes)
}

dnl Check for the dlfcn.h interface for dynamically loading objects

0 comments on commit cf7460e

Please sign in to comment.