From 59cb0158bacca27c6b9dec5e8dca84b2d876ba35 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 20 Apr 2024 19:11:28 +0900 Subject: [PATCH 1/8] 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). --- SDL3-CS.Tests.Desktop/Program.cs | 7 ++++ .../SDL3-CS.Tests.Desktop.csproj | 35 ++++++++++++++++ SDL3-CS.Tests/SDL3-CS.Tests.csproj | 2 +- SDL3-CS.sln | 6 +++ SDL3-CS/SDL3-CS.csproj | 40 ++++++++----------- 5 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 SDL3-CS.Tests.Desktop/Program.cs create mode 100644 SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj diff --git a/SDL3-CS.Tests.Desktop/Program.cs b/SDL3-CS.Tests.Desktop/Program.cs new file mode 100644 index 0000000..96f04a3 --- /dev/null +++ b/SDL3-CS.Tests.Desktop/Program.cs @@ -0,0 +1,7 @@ +internal class Program +{ + public static void Main(string[] args) + { + SDL.Tests.Program.Main(); + } +} diff --git a/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj b/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj new file mode 100644 index 0000000..e1854f9 --- /dev/null +++ b/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj @@ -0,0 +1,35 @@ + + + + Exe + net8.0 + SDL3.Tests.Desktop + enable + enable + + + + + + + + $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) + + + $(RuntimeIdentifier)\SDL3.dll + $(RuntimeIdentifier)\libSDL3.so + $(RuntimeIdentifier)\libSDL3.dylib + + + win-$(SDLArch.ToLower())\SDL3.dll + linux-$(SDLArch.ToLower())\libSDL3.so + osx-$(SDLArch.ToLower())\libSDL3.dylib + + + + + PreserveNewest + + + + diff --git a/SDL3-CS.Tests/SDL3-CS.Tests.csproj b/SDL3-CS.Tests/SDL3-CS.Tests.csproj index 129e3d4..a789eb7 100644 --- a/SDL3-CS.Tests/SDL3-CS.Tests.csproj +++ b/SDL3-CS.Tests/SDL3-CS.Tests.csproj @@ -1,7 +1,7 @@  - Exe + Library net8.0 SDL.Tests enable diff --git a/SDL3-CS.sln b/SDL3-CS.sln index 6d94d0b..c686aa6 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -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 diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj index 99238b6..29c8286 100644 --- a/SDL3-CS/SDL3-CS.csproj +++ b/SDL3-CS/SDL3-CS.csproj @@ -29,46 +29,38 @@ - - PreserveNewest + runtimes/win-x64/native true - - - PreserveNewest + + runtimes/win-arm64/native true - - - PreserveNewest + + runtimes/win-x86/native true - - - PreserveNewest + + runtimes/osx-x64/native true - - - PreserveNewest + + runtimes/osx-arm64/native true - - - PreserveNewest + + runtimes/linux-x64/native true - - - PreserveNewest + + runtimes/linux-x86/native true - - - PreserveNewest + + runtimes/ios/native true - + From badeebcf63bbee7fd4b8b55d558075ecd57b455a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 20 Apr 2024 19:11:48 +0900 Subject: [PATCH 2/8] Remove unnecessary reference (it's transitive) --- SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj b/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj index fe721f3..4ce67fa 100644 --- a/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj +++ b/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj @@ -12,7 +12,6 @@ - From 7bff9f51f3fdf6e1772589d92df82bf189a6ed75 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 20 Apr 2024 19:12:37 +0900 Subject: [PATCH 3/8] Adjust run configs --- .idea/.idea.SDL3-CS.Android/.idea/.name | 1 + .idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml | 8 ++++++++ .../.idea/projectSettingsUpdater.xml | 6 ++++++ .run/Android.run.xml | 11 +++++++++++ .run/{SDL3-CS.Tests.run.xml => Desktop.run.xml} | 8 ++++---- .run/iOS.run.xml | 9 +++++++++ 6 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 .idea/.idea.SDL3-CS.Android/.idea/.name create mode 100644 .idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml create mode 100644 .idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml create mode 100644 .run/Android.run.xml rename .run/{SDL3-CS.Tests.run.xml => Desktop.run.xml} (72%) create mode 100644 .run/iOS.run.xml diff --git a/.idea/.idea.SDL3-CS.Android/.idea/.name b/.idea/.idea.SDL3-CS.Android/.idea/.name new file mode 100644 index 0000000..104344e --- /dev/null +++ b/.idea/.idea.SDL3-CS.Android/.idea/.name @@ -0,0 +1 @@ +SDL3-CS.Android \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml b/.idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.SDL3-CS.Android/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml b/.idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..4bb9f4d --- /dev/null +++ b/.idea/.idea.SDL3-CS.Android/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.run/Android.run.xml b/.run/Android.run.xml new file mode 100644 index 0000000..05d66da --- /dev/null +++ b/.run/Android.run.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/.run/SDL3-CS.Tests.run.xml b/.run/Desktop.run.xml similarity index 72% rename from .run/SDL3-CS.Tests.run.xml rename to .run/Desktop.run.xml index ea7aa8f..3c74768 100644 --- a/.run/SDL3-CS.Tests.run.xml +++ b/.run/Desktop.run.xml @@ -1,13 +1,13 @@ - -