TGUI requires a compiler that supports c++11. This means that you need at least the VC++10 compiler (Visual Studio 2010).
Next select your compiler. I am using the Visual Studio 2008 in this example.
Just keep the “Use default native compilers” option checked and ignore the other three options.
It is possible that CMake will not be able to find sfml and will give you an error.
You will then have to tell CMake where it needs to search for sfml. Change the SFML_ROOT (not SFMLDIR like in older versions) to the correct path. This will be the root path of sfml, which contains the include and lib folders.
When you compiled sfml yourself then you will have to watch out for three things:
Now you can also change the other options. At the end of this CMake part, you can find the explanation of some of the options. Once you are done, you need to press Configure again.
After you pressed configure, you should have reached the message “Configuring done” at the bottom.
All you have to do now is press Generate.
Some last notes about CMake:
You are not done yet.
CMake made a Visual Studio project in the build directory that has to be build first.
Simply open the tgui.sln file, set the configuration to Debug or Release and then hit “Build Solution”.
When this is done you should find the tgui(-d).lib and tgui(-d).dll inside the lib folder.
If you chose to build statically then you will of course only find a tgui-s(-d).lib file.
To make it easier to use tgui in your project, you should copy the libraries to the same folder.
I would advice to make a lib folder in the tgui root directory and place the libraries there.
Open the Project Properties.
In both debug and release mode, add the include and library directories.
In both debug and release mode (this time seperately), you must add the library to link with.
When linking statically it will of course become tgui-s.lib and tgui-s-d.lib.
The order of linking is also important: first sfml, then tgui.
When linking dynamically, don’t forget to copy the needed dlls to the directory where your compiled executable is.
You should now be able to use TGUI.