include/SDL_platform.h
changeset 8478 337b5dc0797b
parent 8477 ad08f0d710f3
child 8535 e8ee0708ef5c
     1.1 --- a/include/SDL_platform.h	Mon Aug 12 22:29:55 2013 -0400
     1.2 +++ b/include/SDL_platform.h	Tue Aug 13 20:09:52 2013 -0400
     1.3 @@ -120,10 +120,27 @@
     1.4  #undef __SOLARIS__
     1.5  #define __SOLARIS__ 1
     1.6  #endif
     1.7 -#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
     1.8 -#undef __WIN32__
     1.9 -#define __WIN32__   1
    1.10 -#endif
    1.11 +
    1.12 +#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
    1.13 +/* Try to find out what version of Windows we are compiling for */
    1.14 +#if defined(_MSC_VER) && (_MSC_VER >= 1700)	/* _MSC_VER==1700 for MSVC 2012 */
    1.15 +#include <winapifamily.h>
    1.16 +#endif
    1.17 +/* Default to classic, Win32 / Desktop compilation either if:
    1.18 +     1. the version of Windows is explicity set to a 'Desktop' (non-Metro) app
    1.19 +     2. the version of Windows cannot be determined via winapifamily.h
    1.20 +   If neither is true, see if we're compiling for WinRT.
    1.21 + */
    1.22 +#if ! defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
    1.23 +#undef __WIN32__
    1.24 +#define __WIN32__   1
    1.25 +/* See if we're compiling for WinRT: */
    1.26 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
    1.27 +#undef __WINRT__
    1.28 +#define __WINRT__ 1
    1.29 +#endif /* ! defined(WINAPI_FAMILY_PARTITION) */
    1.30 +#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
    1.31 +
    1.32  #if defined(__PSP__)
    1.33  #undef __PSP__
    1.34  #define __PSP__ 1