Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDL2] cmake: ios/tvos support #10534

Merged
merged 5 commits into from
Aug 14, 2024
Merged

Conversation

madebr
Copy link
Contributor

@madebr madebr commented Aug 12, 2024

This backports SDL3 CMake changes to support building SDL2 for ios/tvos.

testgles.c, testgles2.c and testgles2_sdf.c fail to build.
I hope an Apple person takes care of those.

Description

Existing Issue(s)

Fixes #10526

@yorickreum
Copy link

Build seems to fail because Apple deprecated OpenGLES, best way forward might just be to define GLES_SILENCE_DEPRECATION.

@madebr
Copy link
Contributor Author

madebr commented Aug 13, 2024

Build seems to fail because Apple deprecated OpenGLES, best way forward might just be to define GLES_SILENCE_DEPRECATION.

How does SDL3 handle this? I cannot find find GLES_SILENCE_DEPRECATION in the main branch.

@yorickreum
Copy link

Build seems to fail because Apple deprecated OpenGLES, best way forward might just be to define GLES_SILENCE_DEPRECATION.

How does SDL3 handle this? I cannot find find GLES_SILENCE_DEPRECATION in the main branch.

That is an excellent question ... I do not know but would be very curious, @slouken do you maybe know how SDL is dealing with Apples deprecation of OpenGL?

@yorickreum
Copy link

yorickreum commented Aug 13, 2024

So, I checked https://github.com/libsdl-org/SDL/pull/9465/files/7aed78b825d193b55de36b500d146e991d2cc59d and see that check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) was explicitly added for macOS only, to turn those errors into warnings only and make testgles work ... this might explain why it's compiling.

I still do feel like add_compile_definitions(GLES_SILENCE_DEPRECATION) for iOS is the way cleaner solution, since we are explicitly silencing the GLES deprecation, not neglecting just all deprecation warnings...

@madebr madebr force-pushed the sdl2-ios-backport branch from f25ef78 to 8ebec7f Compare August 14, 2024 07:43
@madebr madebr force-pushed the sdl2-ios-backport branch from 8ebec7f to be44685 Compare August 14, 2024 07:52
@madebr
Copy link
Contributor Author

madebr commented Aug 14, 2024

Thanks @yorickreum , I applied your suggestion (GLES_SILENCE_DEPRECATION).

Can you explain why linking the tests fails (and provide a fix) on ios/tvos?

Undefined symbols for architecture arm64:
  "_main", referenced from:
      <initial-undefines>
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@yorickreum
Copy link

Thanks! Just from the error message, I‘d assume it’s trying to link something that was compiled for the wrong architecture (e.g. just macOS not iOS).
I can maybe dig deeper later.

@madebr madebr merged commit 764c44d into libsdl-org:SDL2 Aug 14, 2024
40 checks passed
@madebr madebr deleted the sdl2-ios-backport branch August 14, 2024 10:35
@madebr
Copy link
Contributor Author

madebr commented Aug 14, 2024

Thanks! Just from the error message, I‘d assume it’s trying to link something that was compiled for the wrong architecture (e.g. just macOS not iOS). I can maybe dig deeper later.

I forgot about SDL2main :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants