Skip to content
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

[Build] Native libraries get copied to runtimes/RID/native folder #1428

Merged

Conversation

azeno
Copy link
Collaborator

@azeno azeno commented May 12, 2022

Description

  • In user project nuget will take care of copying required native libs to final output folder depending on used RuntimeIdentifier
  • Native libraries can be registered as dependencies for a later lookup (used by Stride.NuGetLoader to register native dependencies from global nuget package cache)
  • Fixes library not found exceptions on platforms other than windows
  • Fixes generated Android project

It seems to work fine for Windows and Linux. Android worked so far that I was able to build and run in debug on a Fairphone 3. However it didn't feel stable - for example on the second attempt it started up in the wrong resolution (was only rendering on half of the screen) and after a hide/show it crashed with depth buffer having different size than render target. In release build I had to set the RID to android-arm64 or otherwise the asset compiler would get invoked multiple times tripping over itself with file in use exceptions. But these crashes seem unrelated to the changes I'm proposing here.

MacOS and iOS I couldn't test yet because of lack of Apple hardware.

Related Issue

#1061 (I tested with Linux and not OSX)

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

azeno added 3 commits May 12, 2022 21:03
- In user project nuget will take care of copying required native libs to final output folder depending on used RuntimeIdentifier
- Native libraries can be registered as dependencies for a later lookup (used by Stride.NuGetLoader to register native dependencies from global nuget package cache)
- Fixes library not found exceptions on platforms other than windows
Source builds fine, but when testing with Android Simulator I'm getting an early crash inside of SDL/Silk. Getting same crach when running the Silk example itself. So probably unrelated.
- Tested by creating game for Android through game studio. Debug build started up (after a very long shader compile time) and I saw the Sphere getting rendered.
- A release build doesn't work though. First of all the the asset compiler gets invoked four times (for each android CPU) and crashes because of files being used by other process exceptions. Why does that not happen in the debug build? Setting the RID in the project to android-arm64 fixes the asset compiler crash (because it's only invoked once now), I saw the Stide Game Engine logo but after a short black screen the app stops running.
- The Android Simulator doesn't work at all. We get an early crash in Silk.NET by the used mono runtime (https://github.com/mono/mono/blob/main/mono/mini/mini-amd64.c#L765)
- Had to update Silk.NET (dotnet/Silk.NET#686)
@azeno azeno marked this pull request as ready for review May 16, 2022 15:09
Copy link
Member

@manio143 manio143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really nice to see us getting more in line with what NuGet offers 👍

@xen2
Copy link
Member

xen2 commented May 17, 2022

A very appreciated change!
Since we're now .NET 6.0 only (vs 5 different TFM until recently), it's great we can simplify all those custom stuff we had and replace them with standard/default approach.

@azeno
Copy link
Collaborator Author

azeno commented May 17, 2022

Some stuff will need to stay because there's no system yet which deals with native dependency consumption in project to project references. There are a couple of issues on dotnet regarding this, for example dotnet/sdk#10575

@azeno
Copy link
Collaborator Author

azeno commented Jul 25, 2022

Now that 4.1 is released, and to my understanding the build agent has been updated - can we give this one another spin?

@manio143
Copy link
Member

I think I was happy with those changes. @xen2 is it fine to try and merge it?

@azeno
Copy link
Collaborator Author

azeno commented Feb 4, 2023

Seeing people struggling with building for Android (#1601, #1456), I wonder what is the hold up here? If I remember correctly I had the example game running on Android.

@manio143 manio143 merged commit dd8ca47 into stride3d:master Mar 14, 2023
This was referenced Mar 14, 2023
joreg pushed a commit to vvvv/stride that referenced this pull request May 10, 2023
…eality package as well as used Silk version

This broke with the merge of PR stride3d#1428 because these lines of code where added after stride3d#1428 was created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants