configury, cmake: make wasapi option independent of directx.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 376f27f..886e1a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/configure b/configure
index c5d3e85..1d7ec14 100755
--- a/configure
+++ b/configure
@@ -23165,20 +23165,6 @@ if test "x$ac_cv_header_xinput_h" = xyes; then :
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. */
@@ -23257,14 +23243,6 @@ $as_echo "#define HAVE_XINPUT_STATE_EX 1" >>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
@@ -23273,6 +23251,28 @@ fi
;;
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()
diff --git a/configure.in b/configure.in
index 66a00c4..177a7bd 100644
--- a/configure.in
+++ b/configure.in
@@ -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