WinRT: made SDL_platform.h auto-detect WinRT
authorDavid Ludwig <dludwig@pobox.com>
Thu, 22 Nov 2012 13:11:05 -0500
changeset 8352deef25f5fce1
parent 8351 021d5b7dae39
child 8353 82447809a27e
WinRT: made SDL_platform.h auto-detect WinRT
VisualC/SDL/SDL_VS2012_WinRT.vcxproj
VisualC/tests/loopwave/WinRT/loopwave_VS2012_WinRT.vcxproj
include/SDL_platform.h
     1.1 --- a/VisualC/SDL/SDL_VS2012_WinRT.vcxproj	Thu Nov 22 12:37:31 2012 -0500
     1.2 +++ b/VisualC/SDL/SDL_VS2012_WinRT.vcxproj	Thu Nov 22 13:11:05 2012 -0500
     1.3 @@ -378,7 +378,7 @@
     1.4        <PrecompiledHeader>NotUsing</PrecompiledHeader>
     1.5        <CompileAsWinRT>false</CompileAsWinRT>
     1.6        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     1.7 -      <PreprocessorDefinitions>_WINDLL;__WINRT__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     1.8 +      <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     1.9      </ClCompile>
    1.10      <Link>
    1.11        <SubSystem>Console</SubSystem>
    1.12 @@ -392,7 +392,7 @@
    1.13        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.14        <CompileAsWinRT>false</CompileAsWinRT>
    1.15        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    1.16 -      <PreprocessorDefinitions>_WINDLL;__WINRT__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.17 +      <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.18      </ClCompile>
    1.19      <Link>
    1.20        <SubSystem>Console</SubSystem>
    1.21 @@ -406,7 +406,7 @@
    1.22        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.23        <CompileAsWinRT>false</CompileAsWinRT>
    1.24        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    1.25 -      <PreprocessorDefinitions>_WINDLL;__WINRT__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.26 +      <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.27      </ClCompile>
    1.28      <Link>
    1.29        <SubSystem>Console</SubSystem>
    1.30 @@ -420,7 +420,7 @@
    1.31        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.32        <CompileAsWinRT>false</CompileAsWinRT>
    1.33        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    1.34 -      <PreprocessorDefinitions>_WINDLL;__WINRT__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.35 +      <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.36      </ClCompile>
    1.37      <Link>
    1.38        <SubSystem>Console</SubSystem>
    1.39 @@ -434,7 +434,7 @@
    1.40        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.41        <CompileAsWinRT>false</CompileAsWinRT>
    1.42        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    1.43 -      <PreprocessorDefinitions>_WINDLL;__WINRT__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.44 +      <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.45      </ClCompile>
    1.46      <Link>
    1.47        <SubSystem>Console</SubSystem>
    1.48 @@ -448,7 +448,7 @@
    1.49        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.50        <CompileAsWinRT>false</CompileAsWinRT>
    1.51        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    1.52 -      <PreprocessorDefinitions>_WINDLL;__WINRT__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.53 +      <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.54      </ClCompile>
    1.55      <Link>
    1.56        <SubSystem>Console</SubSystem>
     2.1 --- a/VisualC/tests/loopwave/WinRT/loopwave_VS2012_WinRT.vcxproj	Thu Nov 22 12:37:31 2012 -0500
     2.2 +++ b/VisualC/tests/loopwave/WinRT/loopwave_VS2012_WinRT.vcxproj	Thu Nov 22 13:11:05 2012 -0500
     2.3 @@ -105,7 +105,7 @@
     2.4    </ItemDefinitionGroup>
     2.5    <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
     2.6      <ClCompile>
     2.7 -      <PreprocessorDefinitions>NDEBUG;__WINRT__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     2.8 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     2.9        <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
    2.10        <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
    2.11        <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
    2.12 @@ -113,7 +113,7 @@
    2.13    </ItemDefinitionGroup>
    2.14    <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
    2.15      <ClCompile>
    2.16 -      <PreprocessorDefinitions>_DEBUG;__WINRT__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.17 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.18        <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
    2.19        <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
    2.20        <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
     3.1 --- a/include/SDL_platform.h	Thu Nov 22 12:37:31 2012 -0500
     3.2 +++ b/include/SDL_platform.h	Thu Nov 22 13:11:05 2012 -0500
     3.3 @@ -114,12 +114,44 @@
     3.4  #undef __SOLARIS__
     3.5  #define __SOLARIS__	1
     3.6  #endif
     3.7 +
     3.8  #if defined(WIN32) || defined(_WIN32)
     3.9 -#if ! defined(__WINRT__)
    3.10 +/* Try to find out what version of Windows we are compiling for */
    3.11 +#if defined(_MSC_VER) && (_MSC_VER >= 1700)	/* _MSC_VER==1700 for MSVC 2012 */
    3.12 +#include <winapifamily.h>
    3.13 +#endif
    3.14 +/* Default to classic, Win32 / Desktop compilation if the version of Windows
    3.15 +   cannot be determined via winapifamily.h. */
    3.16 +#if ! defined(WINAPI_FAMILY_PARTITION)
    3.17 +#undef __WIN32__
    3.18 +#define __WIN32__ 1
    3.19 +#else
    3.20 +/* Include Win32 / Desktop App APIs in SDL, if available: */
    3.21 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
    3.22 +#undef __WIN32__
    3.23 +#define __WIN32__ 1
    3.24 +#endif
    3.25 +/* Include WinRT / Windows Store APIs in SDL, if available: */
    3.26 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
    3.27 +#undef __WINRT__
    3.28 +#define __WINRT__ 1
    3.29 +#endif
    3.30 +#endif
    3.31 +#endif
    3.32 +
    3.33 +/*
    3.34 +#if ! defined(WINAPI_FAMILY_PARTITION) || ! WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
    3.35  #undef __WIN32__
    3.36  #define __WIN32__	1
    3.37 +#error win32_defined
    3.38  #endif
    3.39  #endif
    3.40 +#if defined(WINAPI_FAMILY_PARTITION) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
    3.41 +#undef __WINRT__
    3.42 +#define __WINRT__	1
    3.43 +#error winrt_defined
    3.44 +#endif
    3.45 +*/
    3.46  
    3.47  #if defined(__NDS__)
    3.48  #undef __NINTENDODS__