stride icon indicating copy to clipboard operation
stride copied to clipboard

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

Open azeno opened this issue 3 years ago • 4 comments

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
  • [x] 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 avatar May 12 '22 19:05 azeno

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.

xen2 avatar May 17 '22 10:05 xen2

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 https://github.com/dotnet/sdk/issues/10575

azeno avatar May 17 '22 12:05 azeno

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

azeno avatar Jul 25 '22 11:07 azeno

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

manio143 avatar Jul 26 '22 08:07 manio143

Seeing people struggling with building for Android (https://github.com/stride3d/stride/discussions/1601, https://github.com/stride3d/stride/pull/1456), I wonder what is the hold up here? If I remember correctly I had the example game running on Android.

azeno avatar Feb 04 '23 14:02 azeno