We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5481

Summary: iOS-specific main sources not used for CMake build.
Product: SDL Reporter: Aaron Barany <akb825>
Component: mainAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 2.0.14   
Hardware: iPhone/iPod touch   
OS: iOS 11   
Attachments: sdl-ios-fix.patch

Description Aaron Barany 2021-01-19 03:58:32 UTC
The CMake build for SDL doesn't set SDLMAIN_SOURCES on iOS to the sources in src/main/ios. As a result, SDL fails to initialize since it falls back to the dummy main. Adding the line file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) fixes the issue.
Comment 1 Sam Lantinga 2021-01-23 17:39:23 UTC
Can you provide a tested patch?

Thanks!
Comment 2 Aaron Barany 2021-01-25 02:19:34 UTC
Created attachment 4703 [details]
sdl-ios-fix.patch

I've attached the patch I'm using to fix the iOS build. The fix for the main library was integrated into a separate patch for fixing the misc sources that was posted on another bug.
Comment 3 Sam Lantinga 2021-01-26 04:43:49 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/399606b401c9