1
DotNet / Re: Has anyone had any luck getting SFML.NET on .NET Core running on MacOS?
« on: February 21, 2020, 01:40:36 pm »
I came across this thread when googling feverishly, unable to get SFML.Net to run on MacOS after building with dotnet.
I managed to get it to work by doing the following;
1. Build your application with dotnet publish.
2. In the resulting folder with the executable binary, create a new hierarchy of directories like so: runtimes/osx/native
3. Download CSFML's Mac version from the SFML site: https://www.sfml-dev.org/download/csfml/
4. Put the *.dylib files from the lib folder of CSFML in the runtimes/osx/native folder.
5. Download SFML's Mac version from the SFML site: https://www.sfml-dev.org/download/sfml/2.5.1/
6. Copy the Frameworks folder to the same folder as your program binary, so it sits next to the runtimes folder.
7. Copy the contents of the extlibs folder to that new Frameworks folder.
8. Open a terminal window in the same directory as your program binary and write:
install_name_tool -add_rpath @executable_path/Frameworks YourProgramNameHere
And that should do it! I did a lot of mucking around with the otool -l tool to find out where it was trying to load the CSFML/SFML bindings from. This should also give you what you need to fully publish your Mac build in a .App folder/container.
It seems that the CSFML .nuget package doesn't contain anything for Mac at the moment, also. That might need fixing sometime!
I managed to get it to work by doing the following;
1. Build your application with dotnet publish.
2. In the resulting folder with the executable binary, create a new hierarchy of directories like so: runtimes/osx/native
3. Download CSFML's Mac version from the SFML site: https://www.sfml-dev.org/download/csfml/
4. Put the *.dylib files from the lib folder of CSFML in the runtimes/osx/native folder.
5. Download SFML's Mac version from the SFML site: https://www.sfml-dev.org/download/sfml/2.5.1/
6. Copy the Frameworks folder to the same folder as your program binary, so it sits next to the runtimes folder.
7. Copy the contents of the extlibs folder to that new Frameworks folder.
8. Open a terminal window in the same directory as your program binary and write:
install_name_tool -add_rpath @executable_path/Frameworks YourProgramNameHere
And that should do it! I did a lot of mucking around with the otool -l tool to find out where it was trying to load the CSFML/SFML bindings from. This should also give you what you need to fully publish your Mac build in a .App folder/container.
It seems that the CSFML .nuget package doesn't contain anything for Mac at the moment, also. That might need fixing sometime!