summaryrefslogtreecommitdiff
path: root/include/SDL_platform.h
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2017-08-19 02:23:50 -0700
committerSam Lantinga <slouken@libsdl.org>2017-08-19 02:23:50 -0700
commit2a32c7aac2462a775ec0f72f6651966f49611d0a (patch)
treef84065f3fd84added7d9f9be22f9f828540c7c14 /include/SDL_platform.h
parent61d9da7e97311270d6b70c57cddb755e0640710d (diff)
downloadsdl-2a32c7aac2462a775ec0f72f6651966f49611d0a.tar.gz
Fixed building with Visual Studio 2017 and the Windows XP toolset if _USING_V110_SDK71_ accidentally gets undefined
Diffstat (limited to 'include/SDL_platform.h')
-rw-r--r--include/SDL_platform.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/include/SDL_platform.h b/include/SDL_platform.h
index f041ae78e..75224a0d6 100644
--- a/include/SDL_platform.h
+++ b/include/SDL_platform.h
@@ -120,21 +120,29 @@
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
-/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */
+#if defined(_MSC_VER) && _MSC_VER >= 1910 /* _MSC_VER == 1910 for Visual Studio 2017 */
+#define HAVE_WINAPIFAMILY_H __has_include(<winapifamily.h>)
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#undef __WINDOWS__
-#define __WINDOWS__ 1
-/* See if we're compiling for WinRT: */
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
-#endif
#else
#undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif /* _MSC_VER < 1700 */
+#define __WINDOWS__ 1
+#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#if defined(__WINDOWS__)