raylib icon indicating copy to clipboard operation
raylib copied to clipboard

[rcore] Small issues on MacOS with SDL2

Open atticus5 opened this issue 1 year ago • 4 comments

Issue description

When building raylib with SDL2 as backend I faced 2 issues:

  1. The InitPlatform() method calls SDL_Init(SDL_INIT_EVERYTHING) which results in some SDL2 fatal exceptions, which I cannot reproduce now, but I found that SDL_Init(SDL_INIT_VIDEO) works fine. I found something on the internet that the SDL_INIT_AUDIO is the issue, a subsystem which is included by SDL_INIT_EVERYTHING, but not actually needed for raylib.
  2. Another error I caught was Failed creating OpenGL context at version requested because on Apple if you are using OpenGL 3.3 the SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE) is not called, even though for OpenGL 4.3 it is.
  3. There is no automatic way of building with SDL2? The PLATFORM variable only supports Desktop which defaults to GLFW.

Environment

MacOS Sonoma 14.1.1 M1, OpenGL 3.3

atticus5 avatar Jan 30 '24 20:01 atticus5

  1. Is certainly a bug, in GLFW implementation, rcore_desktop.c, the call is not missing.

atticus5 avatar Jan 30 '24 20:01 atticus5

@atticus5 Thanks for reporting! It has been reviewed 1. and 2. but about 3., Makefile supports PLATFORM=PLATFORM_DESKTOP_SDL.

raysan5 avatar Jan 31 '24 23:01 raysan5

@raysan5 thank you, but I'm using CMake and GLFW is hardcoded:

https://github.com/raysan5/raylib/blob/7ec43022c177cbf00b27c9e9ab067bd6889957a4/cmake/LibraryConfigurations.cmake#L11

atticus5 avatar Feb 01 '24 20:02 atticus5

@atticus5 Oh, I'm afraid I'm not the user neither maintainer of CMake build system. It was contributed by the community and I kept it for convenience but any expert on CMake should review and maintain it.

raysan5 avatar Feb 01 '24 20:02 raysan5