-
Notifications
You must be signed in to change notification settings - Fork 87
Conversation
are you sure that's correct? https://irc.minetest.net/minetest-dev/2023-12-18#i_6140291 |
Does it work on MSVC? Also, you don’t need |
I don't know if it is correct and doesn't break other platforms, but it does fix building with SDL2 enabled on Windows for me. I have not tested how it works with MSVC, only MSYS2. And I tested building on Linux (native) with SDL2main not linked and that works there. It would be great if CI could test building Minetest on all platforms when IrrlichtMt is changed, but as long as it's still split like this that's not gonna be possible. |
I don't know what's special about MSYS2 but at least with our MinGW toolchain this change isn't needed. (Didn't check if it breaks anything.) |
I fixed this by including SDL.h in Minetest's main.c file, this appears to be what SDL2 recommends to fix it. Closing this PR, will open another one in Minetest. |
Apparently including SDL headers in Minetest is a bad idea so I reopened this PR. The only platforms we would reasonably support that use SDL2main for initialisation is Windows and Haiku. Windows appears to not require it as it works fine not being wrapped, but no idea about Haiku. (Also SDL3 does not have this "SDLmain" wrapper library that it links against anymore, as they've moved the init stuff into headers) |
Two Linux SDL builds are failing in CI; they're fine on master. Why is that? |
No idea, they were fine in the previous commit before I resolved merge conflicts. Has anything changed in IrrlichtMt regarding finding SDL2 during the time this PR was opened? |
Yes, something like 8482cc3 might be related. |
Note: before merging this I'd like to check that it doesn't break building MT with our current MinGW setup. |
result: working. |
This PR replaces
${SDL2_LIBRARIES}
with justSDL2::SDL2
, so that it doesn't link against SDL2main. When building Minetest on Windows (MSYS2) it fails during linking the executable with the following message:Removing the link against SDL2main fixes this and it builds and runs successfully. I'm unsure if there's any side effects to removing it on some platform, but it doesn't seem to be necessary on Windows and Linux at the very least.