mirror of https://github.com/ppy/SDL3-CS.git
Add desktop tests project
The primary purpose of this is to split out the handling of the native libs. This is a consequence of using ProjectReference, and resolves the following issues: 1. When compiling for iOS, it really doesn't like multiple files being included in the same output path. Example: all Windows SDL.dll files placed as SDL.dll in the output path. 2. Even if (1) was somehow resolved, the iOS build also doesn't like the linux-specific .so files being included. 3. As a consequence of (1), it's likely that the project already doesn't work on some configurations. For example, because win-x86 is specified as the last item, it will likely take precedence over all other versions. 4. It looks like `RuntimeIdentifier` is not project-transitive, against my expectations. I really want the project to both select the correct single native lib for the current platform, and also support compiling with a RID (`dotnet build -r ...`). So now we only copy the correct lib to the output path, and don't do it while packaging (not required).
This commit is contained in:
parent
a16389d76c
commit
59cb0158ba
|
|
@ -0,0 +1,7 @@
|
|||
internal class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
SDL.Tests.Program.Main();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>SDL3.Tests.Desktop</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(RuntimeIdentifier)' == '' ">
|
||||
<SDLArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</SDLArch>
|
||||
|
||||
<!-- If RID is specified -->
|
||||
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('win')) ">$(RuntimeIdentifier)\SDL3.dll</SDLNativeLib>
|
||||
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('linux')) ">$(RuntimeIdentifier)\libSDL3.so</SDLNativeLib>
|
||||
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('osx')) ">$(RuntimeIdentifier)\libSDL3.dylib</SDLNativeLib>
|
||||
|
||||
<!-- If RID is not specified -->
|
||||
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(Windows))' ">win-$(SDLArch.ToLower())\SDL3.dll</SDLNativeLib>
|
||||
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(Linux))' ">linux-$(SDLArch.ToLower())\libSDL3.so</SDLNativeLib>
|
||||
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(OSX))' ">osx-$(SDLArch.ToLower())\libSDL3.dylib</SDLNativeLib>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(SDLNativeLib)' != '' ">
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\$(SDLNativeLib)">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>SDL.Tests</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Android", "SDL3-CS.
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Android", "SDL3-CS.Tests.Android\SDL3-CS.Tests.Android.csproj", "{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Desktop", "SDL3-CS.Tests.Desktop\SDL3-CS.Tests.Desktop.csproj", "{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -49,6 +51,10 @@ Global
|
|||
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -29,46 +29,38 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3.dll">
|
||||
<PackagePath>runtimes/win-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3.dll">
|
||||
<PackagePath>runtimes/win-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3.dll">
|
||||
<PackagePath>runtimes/win-x86/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3.dylib">
|
||||
<PackagePath>runtimes/osx-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3.dylib">
|
||||
<PackagePath>runtimes/osx-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3.so">
|
||||
<PackagePath>runtimes/linux-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3.so">
|
||||
<PackagePath>runtimes/linux-x86/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\native\ios\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\native\ios\**\*">
|
||||
<PackagePath>runtimes/ios/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue