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

CMake: add support for iOS and tvOS #3404

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

CMake: add support for iOS and tvOS #3404

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: Other, iPhone/iPod touch

Comments on the original bug report:

On 2019-09-23 18:29:33 +0000, David Ludwig wrote:

Created attachment 3973
two hg commits, "hg export"'ed from a rebase on top of hg changeset 13082:f77988be3607

The current crop of CMake scripts for SDL2 does not handle CMake-native support for iOS and tvOS. Attached is a patch that adds support for both OSes.

When using a recent version of CMake (3.14+), the patch should make it possible to:

  • build SDL for iOS, both static and dynamic
  • build SDL test apps (as iOS/tvOS .app bundles)
  • generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)

To use, set the following CMake variables when running CMake's configuration stage:

  • CMAKE_SYSTEM_NAME= (either "iOS" or "tvOS")
  • CMAKE_OSX_SYSROOT= (examples: iphoneos, iphonesimulator, iphoneos12.4, /full/path/to/iPhoneOS.sdk,
    appletvos, appletvsimulator, appletvos12.4, /full/path/to/AppleTVOS.sdk, etc.)
  • CMAKE_OSX_ARCHITECTURES= (example: "arm64;armv7s;x86_64")

Examples:

  • for iOS Simulator, using the latest, installed SDK:
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64

  • for iOS Device, using the latest, installed SDK, 64-bit only
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64

  • for iOS Device, using the latest, installed SDK, mixed 32/64 bit
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"

  • for iOS Device, using a specific SDK revision (iOS 12.4, in this example):
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64

  • for iOS Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
    cmake path/to/SDL -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64

On 2019-09-23 18:33:31 +0000, Ryan C. Gordon wrote:

This patch looks good to me, go ahead and push it, please!

--ryan.

On 2019-09-23 18:33:42 +0000, Sam Lantinga wrote:

This looks good to me. Can you add the documentation for using this to the appropriate README file?

On 2019-09-23 18:35:47 +0000, David Ludwig wrote:

I'll modify the documentation within the next day or so, then I'll push it out. Thanks!

On 2019-09-23 21:11:11 +0000, David Ludwig wrote:

Looks like I'll also need to do a few, hopefully-minor modifications in order to help support iOS 13.

More to come...

On 2019-09-23 22:32:12 +0000, David Ludwig wrote:

This is now pushed to hg.libsdl.org/SDL. I'll monitor buildbot, and if nothing new+bad comes up, I'll close this case.

On 2019-09-23 22:39:50 +0000, David Ludwig wrote:

Buildbot is passing, although it does look like the iOS and macOS test machine(s) are currently offline. :-(

If any problems come up with this, I'm happy to try re-investigating. Otherwise, I'm going to go ahead and mark this case as RESOLVED.

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

No branches or pull requests

1 participant