Hey all, just wanted to provide an update here.
Having had no prior Xcode or iOS experience, I've learned A TON since first posting this thread a month ago. My goal was to simplify and perhaps improve the "getting started" experience with SDL2, SDL2_image, SDL2_mixer, and SDL2_ttf on both iOS and tvOS, and I think I've been able to do just that.
First thing to note is that working with the SDL projects independently is pretty straightforward, but things get complicated when using them all together. I made an early attempt to use the standard
./configure && make && make install approach in a build script, but cross compilation and config issues made it so frustratingly difficult, I abandoned that route.
I then turned to the Xcode-iOS projects included in each SDL repo, which are all in pretty good condition — some outdated build settings, but nothing critical. Biggest benefit here is that all the proper source files have been added to the project (@David_Ludwig is actually working on a patch to be able to compile the entire
src/ directory, so we don't have to worry about omitting the right sources for each platform), and the right preprocessor configs are present. Here's the build script I was able to write to make static libraries of SDL2, SDL2_image, SDL2_mixer, and SDL2_ttf for all iOS and tvOS architectures, and create a universal
SDL2.framework (with image, mixer, and ttf packed in) for a more natural app development experience. Check out resulting iOS and tvOS libraries and frameworks (might be worth considering adding these to the
Some caveats to note with SDL2_mixer:
- MODPlug failed to compile in the Xcode-iOS project, so I omitted
MODPLUG_HEADER="<modplug.h>" from the Preprocessor Macros currently in the project's build settings, which can be done by providing our own
GCC_PREPROCESSOR_DEFINITIONS when calling
xcodebuild from the command line (see the build script for details).
- SMPEG2 isn't already in the Xcode-iOS project, and so mixer is built without MP3 support. Not sure if SMPEG2 actually has iOS support or not anyways. Or maybe we should suggest people use whatever the platform SDKs natively support. Either way, something to investigate.
Other than that, everything works quite well. I'm particularly excited about the
SDL2.framework, because it means all you have to do to get started is:
- Create a new Xcode project for iOS or tvOS, a "Single View Application"
- Remove the generated sources and headers, add your own
- Add the following "Linked Frameworks and Libraries", including the new SDL2 framework: AudioToolbox, AVFoundation, CoreGraphics, CoreMotion, Foundation, GameController, ImageIO, MobileCoreServices, OpenGLES, QuartzCore, UIKit
- Hit run!
Clearly a ton of prior work was put into the SDL projects to get all this running so smoothly on iOS and tvOS, so I'm deeply grateful to all who worked on it.
If y'all have any feedback, let me know! Hope you enjoy!