Make WinRT's SDL_main header-only
As the implementation requires C++, the user will have to include SDL_main.h in a C++ source file (that needs to be compiled with /ZW). It's ok to keep the standard main() implementation in plain C and use an otherwise empty C++ source file for the SDL_main implementation part, if both source files #include <SDL3/SDL_main.h> Including SDL_main.h in a C source file will print a message at compilation (when building for WinRT or possibly other not yet implemented platforms that require C++ for main), to remind the user of also including it in a .cpp source file. This message/warning can be disabled with #define SDL_MAIN_NOIMPL before including SDL_main.h in the C file. When including it in a .cpp file, there will be a compiler error with helpful message if it's not compiled with /ZW For this I renamend _SDL_MAIN_NOIMPL to SDL_MAIN_NOIMPL, because now it's not for internal use only anymore, but also useful for users (that want their main() function in a different file than the SDL_main implementation) Add a project for the testdraw2.c test to the WinRT solution to at least get some minimal testing on WinRT. I won't add all tests because it's a lot of manual clicking per test, but this should be better than nothing :)
@ -1,10 +1,12 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3-UWP", "SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestDraw2", "TestDraw2\TestDraw2.vcxproj", "{95943BBE-F378-4068-A3FD-DAE1B8309B6E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
@ -33,8 +35,35 @@ Global
|
||||
{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64
|
||||
{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32
|
||||
{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.Build.0 = Release|Win32
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x64.Build.0 = Debug|x64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x86.Deploy.0 = Debug|Win32
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM.Build.0 = Release|ARM
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x64.ActiveCfg = Release|x64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x64.Build.0 = Release|x64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x64.Deploy.0 = Release|x64
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x86.Build.0 = Release|Win32
|
||||
{95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x86.Deploy.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {30680F51-7BB9-41D0-A0D6-BC44A1557D87}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -62,6 +62,7 @@
|
||||
<ClInclude Include="..\include\SDL3\SDL_locale.h" />
|
||||
<ClInclude Include="..\include\SDL3\SDL_log.h" />
|
||||
<ClInclude Include="..\include\SDL3\SDL_main.h" />
|
||||
<ClInclude Include="..\include\SDL3\SDL_main_impl.h" />
|
||||
<ClInclude Include="..\include\SDL3\SDL_misc.h" />
|
||||
<ClInclude Include="..\include\SDL3\SDL_mouse.h" />
|
||||
<ClInclude Include="..\include\SDL3\SDL_mutex.h" />
|
||||
|
@ -822,6 +822,9 @@
|
||||
<ClInclude Include="..\src\joystick\controller_type.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\SDL3\SDL_main_impl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\joystick\windows\SDL_windows_gaming_input.c">
|
||||
|
BIN
VisualC-WinRT/TestDraw2/Assets/LockScreenLogo.scale-200.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
VisualC-WinRT/TestDraw2/Assets/SplashScreen.scale-200.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
VisualC-WinRT/TestDraw2/Assets/Square150x150Logo.scale-200.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
VisualC-WinRT/TestDraw2/Assets/Square44x44Logo.scale-200.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
BIN
VisualC-WinRT/TestDraw2/Assets/StoreLogo.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
VisualC-WinRT/TestDraw2/Assets/Wide310x150Logo.scale-200.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
49
VisualC-WinRT/TestDraw2/Package.appxmanifest
Normal file
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="a430d85b-5cf1-4705-9fe1-7da520f91d4b"
|
||||
Publisher="CN=Daniel"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="a430d85b-5cf1-4705-9fe1-7da520f91d4b" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>TestDraw2</DisplayName>
|
||||
<PublisherDisplayName>Daniel</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="TestDraw2.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="TestDraw2"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="TestDraw2"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
336
VisualC-WinRT/TestDraw2/TestDraw2.vcxproj
Normal file
@ -0,0 +1,336 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{95943bbe-f378-4068-a3fd-dae1b8309b6e}</ProjectGuid>
|
||||
<Keyword>DirectXApp</Keyword>
|
||||
<RootNamespace>TestDraw2</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.props" />
|
||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.props" />
|
||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);..\..\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Image Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Image Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Image Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Image Include="Assets\StoreLogo.png" />
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL-UWP.vcxproj">
|
||||
<Project>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_common.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_compare.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_crc32.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_font.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_fuzzer.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_harness.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_log.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_md5.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_memory.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_random.c" />
|
||||
<ClCompile Include="..\..\test\main.cpp">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\test\testdraw2.c">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\src\main\winrt\SDL3-WinRTResource_BlankCursor.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\main\winrt\SDL3-WinRTResources.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
|
||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
|
||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
103
VisualC-WinRT/TestDraw2/TestDraw2.vcxproj.filters
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>95943bbe-f378-4068-a3fd-dae1b8309b6e</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Assets">
|
||||
<UniqueIdentifier>dad3d573-ab33-428d-ae70-6098066c27e7</UniqueIdentifier>
|
||||
<Extensions>bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Content">
|
||||
<UniqueIdentifier>e4caa635-e149-44c2-8915-48ffa6ac48f7</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Image Include="Assets\LockScreenLogo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\SplashScreen.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square150x150Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square44x44Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\StoreLogo.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\test\main.cpp">
|
||||
<Filter>Content</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\test\testdraw2.c">
|
||||
<Filter>Content</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_assert.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_common.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_compare.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_crc32.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_font.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_fuzzer.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_harness.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_log.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_md5.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_memory.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_random.c">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\src\main\winrt\SDL3-WinRTResource_BlankCursor.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\main\winrt\SDL3-WinRTResources.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -71,10 +71,9 @@ Here is a rough list of what works, and what doesn't:
|
||||
well as many keys with documented hardware scancodes. Converting
|
||||
SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs
|
||||
(MapVirtualKey()) in Microsoft's Windows Store / UWP APIs.
|
||||
* SDL_main. WinRT uses a different signature for each app's main() function.
|
||||
SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
|
||||
(in `SDL\src\main\winrt\`) directly in order for their C-style main()
|
||||
functions to be called.
|
||||
* SDL_main. WinRT uses a different signature for each app's main() function
|
||||
and requires it to be implemented in C++, so SDL_main.h must be #include'd
|
||||
in a C++ source file, that also must be compiled with /ZW.
|
||||
|
||||
* What doesn't work:
|
||||
* compilation with anything other than Visual C++
|
||||
@ -240,7 +239,9 @@ To change these settings:
|
||||
2. choose "Properties"
|
||||
3. in the drop-down box next to "Configuration", choose, "All Configurations"
|
||||
4. in the drop-down box next to "Platform", choose, "All Platforms"
|
||||
5. in the left-hand list, expand the "C/C++" section
|
||||
5. in the left-hand list, expand the "C/C++" section
|
||||
**Note:** If you don't see this section, you may have to add a .c or .cpp
|
||||
Source file to the Project first.
|
||||
6. select "General"
|
||||
7. edit the "Additional Include Directories" setting, and add a path to SDL's
|
||||
"include" directory
|
||||
@ -271,16 +272,21 @@ To include these files for C/C++ projects:
|
||||
navigate to "Add", then choose "Existing Item...".
|
||||
2. navigate to the directory containing SDL's source code, then into its
|
||||
subdirectory, 'src/main/winrt/'. Select, then add, the following files:
|
||||
- `SDL_winrt_main_NonXAML.cpp`
|
||||
- `SDL3-WinRTResources.rc`
|
||||
- `SDL3-WinRTResource_BlankCursor.cur`
|
||||
3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your
|
||||
project), then click on "Properties...".
|
||||
4. in the drop-down box next to "Configuration", choose, "All Configurations"
|
||||
5. in the drop-down box next to "Platform", choose, "All Platforms"
|
||||
6. in the left-hand list, click on "C/C++"
|
||||
7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
|
||||
8. click the OK button. This will close the dialog.
|
||||
3. For the next step you need a C++ source file.
|
||||
- If your standard main() function is implemented in a **C++** source file,
|
||||
use that file.
|
||||
- If your standard main() function is implemented in a **plain C** source file,
|
||||
create an empty .cpp source file (e.g. `main.cpp`) that only contains the line
|
||||
`#include <SDL3/SDL_main.h>` and use that file instead.
|
||||
4. Right click on the C++ source file from step 3 (as listed in your project),
|
||||
then click on "Properties...".
|
||||
5. in the drop-down box next to "Configuration", choose, "All Configurations"
|
||||
6. in the drop-down box next to "Platform", choose, "All Platforms"
|
||||
7. in the left-hand list, click on "C/C++"
|
||||
8. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
|
||||
9. click the OK button. This will close the dialog.
|
||||
|
||||
**NOTE: C++/CX compilation is currently required in at least one file of your
|
||||
app's project. This is to make sure that Visual C++'s linker builds a 'Windows
|
||||
@ -322,7 +328,8 @@ your project, and open the file in Visual C++'s text editor.
|
||||
7. Copy and paste the following code into the new file, then save it.
|
||||
|
||||
```c
|
||||
#include <SDL.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -284,11 +284,25 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
|
||||
|
||||
#include <SDL3/close_code.h>
|
||||
|
||||
#if !defined(SDL_MAIN_HANDLED) && !defined(_SDL_MAIN_NOIMPL)
|
||||
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
|
||||
/* include header-only SDL_main implementations */
|
||||
#if defined(__WIN32__) || defined(__GDK__) || defined(__IOS__) || defined(__TVOS__) /* TODO: other platforms */
|
||||
#include <SDL3/SDL_main_impl.h>
|
||||
#endif
|
||||
#elif defined(__WINRT__) /* TODO: other C++ platforms */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <SDL3/SDL_main_impl.h>
|
||||
#else
|
||||
/* Note: to get rid of the following warning, you can #define SDL_MAIN_NOIMPL before including SDL_main.h
|
||||
* in your C sourcefile that contains the standard main. Do *not* use SDL_MAIN_HANDLED for that, then SDL_main won't find your main()!
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Note: Your platform needs the SDL_main implementation in a C++ source file. You can keep your main() in plain C (then continue including SDL_main.h there!) and create a fresh .cpp file that only contains #include <SDL3/SDL_main.h>")
|
||||
#elif defined(__GNUC__) /* gcc, clang, mingw and compatible are matched by this and have #warning */
|
||||
#warning "Note: Your platform needs the SDL_main implementation in a C++ source file. You can keep your main() in plain C and create a fresh .cpp file that only contains #include <SDL3/SDL_main.h>"
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __WINRT__ etc */
|
||||
|
||||
#endif /* SDL_MAIN_HANDLED */
|
||||
|
||||
|
@ -28,9 +28,12 @@
|
||||
|
||||
/* if someone wants to include SDL_main.h but doesn't want the main handing magic,
|
||||
(maybe to call SDL_RegisterApp()) they can #define SDL_MAIN_HANDLED first
|
||||
_SDL_MAIN_NOIMPL is for SDL-internal usage (only affects implementation,
|
||||
not definition of SDL_MAIN_AVAILABLE etc in SDL_main.h) */
|
||||
#if !defined(SDL_MAIN_HANDLED) && !defined(_SDL_MAIN_NOIMPL)
|
||||
SDL_MAIN_NOIMPL is for SDL-internal usage (only affects implementation,
|
||||
not definition of SDL_MAIN_AVAILABLE etc in SDL_main.h) and if the user wants
|
||||
to have the SDL_main implementation (from this header) in another source file
|
||||
than their main() function, for example if SDL_main requires C++
|
||||
and main() is implemented in plain C */
|
||||
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
|
||||
|
||||
#if defined(__WIN32__) || defined(__GDK__)
|
||||
|
||||
@ -103,6 +106,61 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||
#define main SDL_main
|
||||
|
||||
/* end of __WIN32__ and __GDK__ impls */
|
||||
#elif defined(__WINRT__)
|
||||
|
||||
/* WinRT main based on SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 */
|
||||
|
||||
#include <wrl.h>
|
||||
|
||||
/* At least one file in any SDL/WinRT app appears to require compilation
|
||||
with C++/CX, otherwise a Windows Metadata file won't get created, and
|
||||
an APPX0702 build error can appear shortly after linking.
|
||||
|
||||
The following set of preprocessor code forces this file to be compiled
|
||||
as C++/CX, which appears to cause Visual C++ 2012's build tools to
|
||||
create this .winmd file, and will help allow builds of SDL/WinRT apps
|
||||
to proceed without error.
|
||||
|
||||
If other files in an app's project enable C++/CX compilation, then it might
|
||||
be possible for the .cpp file including SDL_main.h to be compiled without /ZW,
|
||||
for Visual C++'s build tools to create a winmd file, and for the app to
|
||||
build without APPX0702 errors. In this case, if
|
||||
SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
|
||||
the #error (to force C++/CX compilation) will be disabled.
|
||||
|
||||
Please note that /ZW can be specified on a file-by-file basis. To do this,
|
||||
right click on the file in Visual C++, click Properties, then change the
|
||||
setting through the dialog that comes up.
|
||||
*/
|
||||
#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
|
||||
#if !defined(__cplusplus) || !defined(__cplusplus_winrt)
|
||||
#error The C++ file that includes SDL_main.h must be compiled as C++ code with /ZW, otherwise build errors due to missing .winmd files can occur.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Prevent MSVC++ from warning about threading models when defining our
|
||||
custom WinMain. The threading model will instead be set via a direct
|
||||
call to Windows::Foundation::Initialize (rather than via an attributed
|
||||
function).
|
||||
|
||||
To note, this warning (C4447) does not seem to come up unless this file
|
||||
is compiled with C++/CX enabled (via the /ZW compiler flag).
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4447)
|
||||
#endif
|
||||
|
||||
/* Make sure the function to initialize the Windows Runtime gets linked in. */
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "runtimeobject.lib")
|
||||
#endif
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
return SDL_WinRTRunApp(SDL_main, NULL);
|
||||
}
|
||||
|
||||
/* end of WinRT impl */
|
||||
#elif defined(__IOS__) || defined(__TVOS__)
|
||||
|
||||
#ifdef main
|
||||
|
@ -181,7 +181,7 @@
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#define _SDL_MAIN_NOIMPL /* don't drag in header-only implementation of SDL_main */
|
||||
#define SDL_MAIN_NOIMPL /* don't drag in header-only implementation of SDL_main */
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
/* The internal implementations of these functions have up to nanosecond precision.
|
||||
|
@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#define _SDL_MAIN_NOIMPL /* don't drag in header-only implementation of SDL_main */
|
||||
#define SDL_MAIN_NOIMPL /* don't drag in header-only implementation of SDL_main */
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14
|
||||
*/
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h> /* until this SDL_main impl is converted to header-only.. */
|
||||
|
||||
#include <wrl.h>
|
||||
|
||||
/* At least one file in any SDL/WinRT app appears to require compilation
|
||||
with C++/CX, otherwise a Windows Metadata file won't get created, and
|
||||
an APPX0702 build error can appear shortly after linking.
|
||||
|
||||
The following set of preprocessor code forces this file to be compiled
|
||||
as C++/CX, which appears to cause Visual C++ 2012's build tools to
|
||||
create this .winmd file, and will help allow builds of SDL/WinRT apps
|
||||
to proceed without error.
|
||||
|
||||
If other files in an app's project enable C++/CX compilation, then it might
|
||||
be possible for SDL_winrt_main_NonXAML.cpp to be compiled without /ZW,
|
||||
for Visual C++'s build tools to create a winmd file, and for the app to
|
||||
build without APPX0702 errors. In this case, if
|
||||
SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
|
||||
the #error (to force C++/CX compilation) will be disabled.
|
||||
|
||||
Please note that /ZW can be specified on a file-by-file basis. To do this,
|
||||
right click on the file in Visual C++, click Properties, then change the
|
||||
setting through the dialog that comes up.
|
||||
*/
|
||||
#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
|
||||
#ifndef __cplusplus_winrt
|
||||
#error SDL_winrt_main_NonXAML.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Prevent MSVC++ from warning about threading models when defining our
|
||||
custom WinMain. The threading model will instead be set via a direct
|
||||
call to Windows::Foundation::Initialize (rather than via an attributed
|
||||
function).
|
||||
|
||||
To note, this warning (C4447) does not seem to come up unless this file
|
||||
is compiled with C++/CX enabled (via the /ZW compiler flag).
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4447)
|
||||
#endif
|
||||
|
||||
/* Make sure the function to initialize the Windows Runtime gets linked in. */
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "runtimeobject.lib")
|
||||
#endif
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
return SDL_WinRTRunApp(SDL_main, NULL);
|
||||
}
|
11
test/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is supposed to be used to build tests on platforms that require
|
||||
* the main function to be implemented in C++, which means that SDL_main's
|
||||
* implementation needs C++ and thus can't be included in test*.c
|
||||
*
|
||||
* Placed in the public domain by Daniel Gibson, 2022-12-12
|
||||
*/
|
||||
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
// that's all, folks!
|