Tip: The sfml example comes with a resourcePath() function which you have to put before the paths to load resources. You can use tgui::setResourcePath(resourcePath()) at the beginning of your program so that everything tgui loads starts with that folder.
If you use homebrew then you can install the unofficial TGUI formula by executing:
When doing this you can skip the building steps below and go directly to the Using TGUI (dylib) section.
Set the location of the TGUI directory, set the build directory (usually a new empty folder) and press "Configure".
Next select your generator, you probably want "Unix Makefiles". Just keep the "Use default native compilers" option checked and ignore the other three options.
You can now configure the settings. But watch out for which SFML version was found: if you are planning on using the SFML frameworks in your project, then don't let CMake find the SFML dylibs (or vice versa) because your program will simply not work. Normally you only need to change the TGUI_BUILD_FRAMEWORK option, check it to build frameworks (recommended) or uncheck it to build dylibs.
After setting the options like you want them 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.
You are not done yet. CMake created a Makefile in the build directory that will build the library (if you used the Unix Makefiles generator). Open the terminal, go to the directory were the Makefile is and type "make -j2" (or a bigger number than 2 if you have more cores). When this is done, type "sudo make install" and enter your password.
If you chose to build a framework in cmake then the make install command from the previous step installed the framework to /Library/Frameworks. All you need to do to use it is dragging the TGUI framework into your project.
A screen like below will appear where you normally don't need to change anything, just hit "Finish". The "Copy items if needed" can remain unchecked, but it doesn't matter if it is checked.
If you chose to build a dylib in cmake then you have to add the dylib to your linker settings. First, go to the 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”.