configury, cmake: make wasapi option independent of directx.

This commit is contained in:
Ozkan Sezer 2018-09-28 11:30:50 +03:00
parent 9aa8a75d26
commit cf7460e477
3 changed files with 33 additions and 31 deletions

View File

@ -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)

44
configure vendored
View File

@ -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()

View File

@ -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