libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.79k stars 1.82k forks source link

Is version 2.0.18 supposed to be buildable with VS2015? #5062

Closed KerstinKeller closed 2 years ago

KerstinKeller commented 2 years ago

I am trying to build the 2.0.18 release with VS2015 and CMake, no special options are given to the build. Is it supposed to be buildable? CMake outputs

20:55:08  -- SDL2 was configured with the following options:
20:55:08  -- 
20:55:08  -- Platform: Windows-10.0.19042
20:55:08  -- 64-bit:   FALSE
20:55:08  -- Compiler: C:/VisualStudio2015/VC/bin/cl.exe
20:55:08  -- Revision: 

But then

[2021-12-03T19:55:39.185Z] D:\src\joystick\windows\SDL_windows_gaming_input.c(40): error C2061: syntax error: identifier '__x_ABI_CWindows_CGaming_CInput_CIRawGameController' [D:\tmp\Debug\SDL2-static.vcxproj]

followed by a long list of other compile errors.

So my question is: Is it supposed to compile? I was able to build an older version just fine (2.0.8). I can also build 2.0.18 with VS2019 v140, no problem. I guess they do target different versions of Windows SDK?

Is there anything I can additionally pass to CMake?

(I know it's a C library, so in practice it doesn't matter with which compiler I build the project on Windows.)

slouken commented 2 years ago

You can disable SDL_JOYSTICK_WGI, which was added since 2.0.8

slouken commented 2 years ago

If you have VS2019 though, there's no reason not to use that.

KerstinKeller commented 2 years ago

Thanks for your help. I guess we need to make a smooth transition by first updating the SDL version, and later migrating to VS2019. However, how can I disable SDL_JOYSTICK_WGI?

It's automatically set based on https://github.com/libsdl-org/SDL/blob/b7a0200aab8088e04800d33cc88fee384df0d78c/CMakeLists.txt#L1750-L1751

with https://github.com/libsdl-org/SDL/blob/b7a0200aab8088e04800d33cc88fee384df0d78c/CMakeLists.txt#L1571

So it seems that I have no chance to disable SDL_JOYSTICK_WGI unless I patch the CMake sources?

We are using the joystick component, so I cannot disable the whole joystick component.

KerstinKeller commented 2 years ago

I guess it's somehow related to https://github.com/libsdl-org/SDL/commit/7e8469d1961f7c51176fca6f1a4d1c89ad7bf035 .

To me the differents really seems the version of the Windows SDK being targeted. And for VS2015, it seems to be an older version.

Why the check still seems to pass, I am not quite sure.

slouken commented 2 years ago

Yeah, I think we need to check SDK version rather than just whether the header exists.

cgutman commented 2 years ago

@KerstinKeller 83583dc49d5684645d93287aeeecc9ab472dd60c should solve the issue. Give that a try and see if it builds now under VS2015 now.

KerstinKeller commented 2 years ago

It compiles just fine now with VS2015 👍 Thanks for the support! I will close the issue.