-
-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial pass of adding .NET 6 support for sustaining #586
Conversation
Ready for review. Noteworthy Changes
Changelog Entries
|
Have you verified the name gen works? |
Yup, works flawlessly. |
Also, I'll fix CI in this PR as well. Currently delayed by a unexpected VS update, so it'll be tomorrow now. |
- name: Install Workloads | ||
# TODO: This is slow. Maybe we can make a docker container with this already done? | ||
run: dotnet workload install android android-aot ios maccatalyst maui |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not want to matrix this and have separate CI for core, new Android, old Android, new IOS and old IOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're multitargeting we need all of them in any case. We'd need to do lots of build hacking to get each buildable separately and it also would just massively complicate the workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it turns out it's not that slow, it only takes 2 minutes. The runners clearly have very good internet connection.
|
||
There are more advanced build actions you can do too, such as FullBuild, Pack, FullPack, among others which you can view by doing `nuke --plan`. | ||
|
||
Some projects may not build properly without being configured to use Desktop MSBuild (i.e. the MSBuild shipped with Visual Studio). As a result, you will ideally need to be on Windows and have Visual Studio 2019 Community (or greater) installed with .NET Core and Xamarin workloads. If you don't have this (i.e. because you're on Linux or Mac), you can still develop Silk.NET in a limited capacity but you will not be able to work on mobile workloads. | ||
The older Xamarin projects will not build properly without being configured to use Desktop MSBuild (i.e. the MSBuild shipped with Visual Studio). As a result, you will ideally need to be on Windows and have Visual Studio 2019 Community (v16.10 or greater) installed with .NET Core and Xamarin workloads. If you don't have this (i.e. because you're on Linux or Mac), you won't be able to build the older Xamarin packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there actually a Rider configuration that allows to build one project with MSBuild v16 and another with v17? .NET 6 needs MSBuild v17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rider can use desktop MSBuild if you configure it to. Why'd you ask?
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
|
||
namespace Silk.NET.SilkTouch | ||
{ | ||
public interface INativeContextOverride | ||
{ | ||
TypeDeclarationSyntax Type(string name, string lib, EntryPoint[] entrypoints); | ||
TypeDeclarationSyntax Type(string name, string lib, EntryPoint[] entrypoints, Compilation comp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't seem right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to take a new context structure.
|
||
namespace Silk.NET.SilkTouch.NativeContextOverrides | ||
{ | ||
public sealed class PInvokeNativeContextOverride : INativeContextOverride | ||
{ | ||
/// <inheritdoc /> | ||
public TypeDeclarationSyntax Type(string name, string lib, EntryPoint[] entrypoints) | ||
public TypeDeclarationSyntax Type(string name, string lib, EntryPoint[] entrypoints, Compilation comp) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we only pass the compilation to get this bool, why not just pass the bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use a new context structure which does not have a compilation within it.
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true"> | ||
</application> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0-android' And '$(TargetFramework)' != 'net6.0-ios' And '$(TargetFramework)' != 'net6.0-maccatalyst' And '$(TargetFramework)' != 'net6.0'"> | ||
<ProjectReference Include="..\Silk.NET.Windowing.Glfw\Silk.NET.Windowing.Glfw.csproj" /> | ||
<ProjectReference Include="..\Silk.NET.Windowing.Sdl\Silk.NET.Windowing.Sdl.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android' Or '$(TargetFramework)' == 'net6.0-ios' Or '$(TargetFramework)' == 'net6.0-maccatalyst'"> | ||
<ProjectReference Include="..\Silk.NET.Windowing.Sdl\Silk.NET.Windowing.Sdl.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'"> | ||
<ProjectReference Include="..\Silk.NET.Windowing.Glfw\Silk.NET.Windowing.Glfw.csproj" /> | ||
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, what? Why? Why not just include both GLFW and SDL everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we have no reason to. GLFW is priority one for desktop and there's zero reason to use SDL over GLFW on desktop - if for whatever reason you do want to use SDL you can go reference it yourself, but I don't think we should mandate that our users ship two extra (very large) DLLs (one for backend, and one for bindings) for a backend that they just don't need on their platform.
The SDL backend was only written to get us to platforms where GLFW doesn't work, so let's only use it on those platforms?
This is ready for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed on my phone, so it's possible I missed something. Looks good.
public static FunctionPointerTypeSyntax GetFuncPtrType | ||
( | ||
this IEnumerable<FunctionPointerParameterSyntax> parameters, | ||
CallingConvention? unmanagedCallingConvention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be non-null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null is treated as managed i.e. there is no unmanaged calling convention.
public static FunctionPointerTypeSyntax GetFuncPtrType | ||
( | ||
this IEnumerable<ITypeSymbol> loadTypes, | ||
CallingConvention? unmanagedCallingConvention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be non-null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
* Initial pass of adding .NET 6 support for sustaining * Get packaging working properly (afiak) * lol * SilkTouch: Stop making managed conv assumptions (.NET 5+), short names * Triangle on .NET 6 on Android now works * Fix old android lab app for fullscreen * Fix bad ifdef * CI fix? * Review fixes
Draft for now as I want to lookover it myself.Adds support for .NET 6 on 2.X for sustaining. Should work exactly as with Xamarin,
but yet to be tested. Will strive to do this before we go any futher.