SFML / SFML.Net

Official binding of SFML for .Net languages

Home Page:https://www.sfml-dev.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support building on MacOS

lsieben97 opened this issue · comments

According to this forum thread it is currently possible to build and run an app using SFML.Net on MacOS, however, it requires a bunch if manual copy and paste work to get it working.

Is it possible to better support MacOS by including the correct libraries for MacOS? If I pull this package from Nuget in Visual Studio on Windows I can run and debug any project without any issues. I've tried looking at how the package declares the dependencies and includes the libraries for windows but I wasn't able to find out how that works...

To be clear, I'm talking about running and debugging a crossplatform .net app that depends on SFML.Net, not packaging for MacOS.

Any explanation on wether it's possible to provide the above is much appreciated!

Yes, the missing step was actually CSFML. For CSFML 2.5.* and SFML.Net 2.5* I've spent quite a bit of time to understand the issue and have since fixed it.

I've successfully used SFML.Net on macOS without any additional modifications. I used JetBrain's Rider, but it should work with anything else that can handle NuGet packages.

Hmmm, interesting, I'm using VS code with the C# dev kit extension. I saw the extension refreshing the nuget packages and the project builds successfully. It doesn's seem to copy the dynlib files properly as I get a runtime exception: Unable to load shared library 'csfml-audio' or one of its dependencies. It says it tried to search in the directory of the executable for the file but it's not found which is correct, the dynlib file is not csfml-audio.dynlib file is not there.

I'm guessing this is a build problem and not so much a SFML.Net issue...

What SFML version are you using and what target framework are you using?

Target framework is net8.0 and SFML version is 2.5.1

I just tested it again with:

  • VSCode
  • C# Dev Kit extension by Microsoft
  • SFML.Net 2.5.1 (using CSFML 2.5.2)
  • net8.0

It builds fine and runs correctly for me.

using SFML.Graphics;
using SFML.Window;

var window = new RenderWindow(new VideoMode(800, 600), "SFML Test!");
window.SetFramerateLimit(144);
window.Closed += (_, _) => { window.Close(); };

while (window.IsOpen)
{
    window.DispatchEvents();

    window.Clear();
    window.Display();
}

image

I suggest if you need any help with setting up SFML.Net to post on the forum or join our Discord.

As I'm unable to reproduce the issue and macOS is supported, I'll close this issue.