Xcode

CMake

  • You will need to use CMake in order to build TGUI. You can download the latest version here.
  • In order to use CMake, you will need to install the Command Line Tools in Xcode.
    Go to Preferences > Downloads and click on the Install button next to the Command Line Tools.
    If I remember correctly then you will be asked to register first (free).
  • Also make sure that you already have sfml on your computer. It would be even better to make sure you have sfml working before trying to use TGUI. If something goes wrong afterwards, you can be sure that the problem does not lie with sfml.

  1. Set the pathname to the TGUI folder that you downloaded.
  2. Set a folder to build TGUI in, usually a new empty folder in the same directory as (1).
  3. Press this button to start configuring.

CMake Build Directory

Next select your compiler.
Just keep the “Use default native compilers” option checked and ignore the other three options.

CMake Select Compiler

It is possible that CMake will give you an error, it might looks for sfml in the wrong folder. As you can see on the screenshot it looks in the /Library/Frameworks/SFML.framework folder, while my headers are in “/usr/local/include”. So if you have this error then change the SFML_INCLUDE_DIR to the correct folder.

CMake SFML not found

After you changed the SFML_INCLUDE_DIR (if it was necessary), and the other options that you would like to change, you need to press Configure again. Now you should have reached the message “Configuring done” at the bottom. All you have to do now is press Generate.

CMake Generate

Some last notes about CMake:

  • We are making dylibs, so leave the TGUI_SHARED_LIBS checked. If you uncheck it then you will eventually end up with .a files.
  • The CMAKE_BUILD_TYPE can be Release or Debug.
  • Frameworks are NOT YET SUPPORTED in tgui.

Make

You are not done yet.
CMake made a Makefile in the build directory that will build the library.
Open the terminal, go to the directory were the Makefile is and type “make”.
When this is done, type “sudo make install” and enter your password.

Using TGUI

Go to the Build Settings.

XCode Build Settings

Under “Linking” in “Other Linker Flags”, add “-ltgui” or “-ltgui-d”.
If you don’t see the “Linking” section, then you might need to select “All” instead of “Basic”.

XCode Linker Flags

Under “Search Paths” in “Header Search Paths”, add the include directory of tgui.

XCode Header Search Path

Under “Search Paths” in “Library Search Paths”, add “/usr/local/lib” if not already there.

XCode Library Search Path

You should now be able to use TGUI.
To test if it is working, simply take a working example code from sfml, include “TGUI\TGUI.hpp” and change sf::RenderWindow to tgui::Window.