iOS (SDL_RENDERER backend)

Requirements

You must have already build SDL2 and SDL2_ttf for iOS and verified that you can run your SDL2 app on your device or emulator. Only then should you proceed with installing TGUI.

You will need to use CMake in order to build TGUI. You can download the latest version here. After installing the GUI app, you will need to run the following from a terminal to make cmake usable from the terminal:

sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install

The TGUI source code can be downloaded from the download page.

CMake

For information about cross-compiling options for iOS with CMake that aren’t specific to TGUI, see CMake’s toolchains manual.

Execute something similar to the following in a terminal from within the TGUI folder:

cmake -S . -B build-ios
  -GXcode \
  -DCMAKE_SYSTEM_NAME=iOS \
  -DCMAKE_OSX_ARCHITECTURES=arm64 \
  -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
  -DCMAKE_INSTALL_PREFIX=`pwd`/install-ios \
  -DTGUI_SHARED_LIBS=FALSE \
  -DTGUI_SKIP_SDL_CONFIG=TRUE \
  -DTGUI_BACKEND=SDL_RENDERER \
  -DSDL2_LIBRARY=/Path/to/libSDL2.a \
  -DSDL2_INCLUDE_DIR=/Path/to/SDL/include/ \
  -DSDL2_TTF_LIBRARY=/Path/to/libSDL2_ttf.a \
  -DSDL2_TTF_INCLUDE_DIR=/Path/to/SDL_ttf/

Here is an explanation of each option:

Building the library

The previous step will have created an Xcode project for building TGUI (if -GXcode was used). You can build it from the terminal with the following command:

cmake --build build-ios --config Release --target install

If all goes well, the newly created install-ios folder will contain a lib folder with the static tgui library in it (inside a Debug or Release subfolder if you used Xcode).

Using TGUI

Note that using TGUI in an iOS app has never actually been tested.

You should be able to just drag the tgui-s.a (or tgui-s-d.a) file into your project.