FosterFramework / Foster

A small C# game framework
MIT License
422 stars 37 forks source link

Correct SDL2 cmake for non-ubuntu platforms #63

Closed Mimoja closed 6 months ago

Mimoja commented 6 months ago

The Foster nuget is currently incompatible with debian 11 as well as alpine as it is compiled on ubuntu against a GLIBC >= 2.33.0.

When building Foster from source I noticed that the static linking was not working leading to undefined symbol SDL_RenderSetClipRect_REAL and similiar errors. CMake had build sdl and used its headers but had linked dynamically with the resulting binary using the outdated system libsdl which didn't offer the required symbols.

This changeset solves 2 challenges:

It was tested on a Debian 11 with an outdated libsdl and on an ArchLinux with SDL 2.30.0.

NoelFB commented 6 months ago

This makes sense to me, thank you!

NoelFB commented 6 months ago

hmm something happened with the build when I merged that in. I don't have time today to look into it so I've reverted for now, but your changes in theory look good so I'd like to get them working soon. https://github.com/FosterFramework/Foster/actions/runs/7820728672/job/21336075579

Mimoja commented 6 months ago

Looks like the shared library is build regardless: in the configure step:

-- Build Shared Library: ON -- Build Static Library: ON -- Build Static Library with Position Independent Code: OFF

Previously it was off on arm64 and amd64 https://github.com/FosterFramework/Foster/actions/runs/7792886332/job/21251700091 https://github.com/FosterFramework/Foster/actions/runs/7792886332/job/21251700209 -- Build Shared Library: OFF -- Build Static Library: ON -- Build Static Library with Position Independent Code: OFF

Maybe an issue with how CMake passes the parameters