Platform-specific guides » iOS

Building, testing and deploying apps for Apple iOS platforms.

With Apple decision to focus on Metal, iOS OpenGL ES support is stuck on version 3.0 (i.e., a version before compute shaders are available). Moreover, OpenGL ES is deprecated since iOS 12.

See also Platform::Sdl2Application for more information, majority of the macOS platform-specific info applies here as well.

Bundle creation

Unlike on macOS, where applications can also run directly from a compiled executable, on iOS you are required to create a bundle. The bundle setup is similar to macOS, see the macOS platform guide for details. Compared to macOS, the *.plist file controls many more options (such as HiDPI/Retina support, supported display orientation, icons, splash screen...). CMake uses its own template that can be configured using various MACOSX_BUNDLE_* variables, but the builtin file is tailored for macOS and you are much better off rolling your own template and passing abosolute path to it to CMake using the MACOSX_BUNDLE_INFO_PLIST property:

    set_target_properties(my-application PROPERTIES

Below are contents of the *.plist file as is used in the SDL2 bootstrap application, requesting OpenGL ES 2.0 and advertising Retina support:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  <string>My Application</string>



CMake can't find a compiler

Right after installing Xcode for the first time, CMake might fail with a message saying

No CMAKE_CXX_COMPILER could be found.

In order to fix this, you need to run this command:

sudo xcode-select -s /Applications/

Deploying iOS apps

Application signing

Apps have to be signed in order to run on iPhone. After generating the CMake project, you'll have no code signing set up. In the Xcode go to the General properties for given app target and enable automatic signing. First time you do this for an account, you'll need to set up a certificate. Also note that in case of free developer accounts, you have only a low limit of different bundle IDs to install & launch in a day (usually just 10). Once you reach the limit (for example when running a lot of test executables), you'll be prevented from using new ones. A possible workaround is to reuse a bundle ID from an existing app.

Certificate trusting

When deploying with a developer account for given device for a first time, you'll be prompted to verify your Developer Account. In the iPhone Settings, go to General -> Profiles & Device Management and trust your certificate there.

Deplyoyment target

Generated Xcode projects by default require the iOS version to be matching the iPhone SDK version. If you need to make the app running on older devices, set the CMAKE_OSX_DEPLOYMENT_TARGET to desired version:

cmake . -DCMAKE_OSX_DEPLOYMENT_TARGET=10.1 # iOS 10.1 at least

Best practices

Official Apple documentation:


  • GLSL texelFetch() returns zero results if you have a texture with integer type and the filtering is not SamplerFilter::Nearest. Yes, it shouldn't matter, but it does.