windows: improve feature detection consistency between CMake and non-CMake builds

main
Cameron Gutman 2021-10-31 18:27:51 -05:00 committed by Sam Lantinga
parent 839ca0ea64
commit 2371b247ff
3 changed files with 16 additions and 17 deletions

View File

@ -245,6 +245,7 @@
#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
#cmakedefine HAVE_WINDOWS_GAMING_INPUT_H @HAVE_WINDOWS_GAMING_INPUT_H@
#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@

View File

@ -25,6 +25,12 @@
#include "SDL_platform.h"
/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK.
* Define NO_WINSDKVER_H if your SDK version doesn't provide this, or use CMake which can detect it automatically. */
#ifndef NO_WINSDKVER_H
#include <winsdkver.h>
#endif
/* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
@ -82,6 +88,12 @@ typedef unsigned int uintptr_t;
#define HAVE_DSOUND_H 1
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0601 /* Windows 7 SDK */
#define HAVE_D3D11_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_SENSORSAPI_H 1
@ -201,20 +213,6 @@ typedef unsigned int uintptr_t;
#define HAVE_STDDEF_H 1
#endif
/* Check to see if we have Windows 10 build environment */
#if defined(_MSC_VER) && (_MSC_VER >= 1911) /* Visual Studio 15.3 */
#include <sdkddkver.h>
#if _WIN32_WINNT >= 0x0601 /* Windows 7 */
#define SDL_WINDOWS7_SDK
#endif
#if _WIN32_WINNT >= 0x0602 /* Windows 8 */
#define SDL_WINDOWS8_SDK
#endif
#if _WIN32_WINNT >= 0x0A00 /* Windows 10 */
#define SDL_WINDOWS10_SDK
#endif
#endif /* _MSC_VER >= 1911 */
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_DSOUND 1
@ -229,7 +227,7 @@ typedef unsigned int uintptr_t;
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef SDL_WINDOWS10_SDK
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
@ -256,7 +254,7 @@ typedef unsigned int uintptr_t;
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
#ifdef SDL_WINDOWS7_SDK
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif

View File

@ -47,7 +47,7 @@
#ifdef HAVE_XINPUT_H
#define SDL_JOYSTICK_RAWINPUT_XINPUT
#endif
#ifdef SDL_WINDOWS10_SDK
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_RAWINPUT_WGI
#endif