7) Configure SFML
CMake will be doing a bunch of stuff. Once it finishes it should give you a list of options, such as:
Most of these can be left as the defaults, however we want to change some of them:
BUILD_SHARED_LIBS should be unchecked
SFML_USE_STATIC_STD_LIBS should be checked
SFML_BUILD_DOC should be checked
--- BUT ONLY IF YOU HAVE DOXYGEN INSTALLED. If you skipped that, leave this unchecked.
This configures SFML so you do not have to worry about as many dll problems.
Once those options are configured... click the "Configure" button again.
The options should all turn white except for maybe a new one "DOXYGEN_HHC_PROGRAM" which might say something about a file not being found. Don't worry about that.
8) Build SFML
Click "Generate" in the CMake window. It'll do its thing. When it says "Generating done" in the status box, you can close CMake.
Then go to the <root>/projects folder. You should see a SFML.sln file. Open that in Visual Studio.
Do a build. You might get a bunch of warnings, but it should not give you any errors. At the end it should say "9 succeeded, 0 failed, 0 up-to-date, 1 skipped"
Switch the build configuration from Debug to Release. If you do not know how to do this, there should be a drop box on the toolbar that says "Debug". Just click and and switch it to "Release". If that drop box is not there, go to View -> Toolbars -> Standard.
Do another build now that you're in Release. Again, you might get warnings but no errors.
8.5) Make an "auto-link" header so you don't have to worry about linking to .libs every time you make a new project
. This step is not necessary, but I recommend it because it saves a lot of hassle.
I put a paste on pastebin here: http://pastebin.com/0Kn67xjB
Copy that into a file... save it in the <root>/include directory as "sfml.h".
EDIT: I've also pasted the code further in this thread in case the pastebin link is broken. You can find it here:
9) Configure Visual Studio
This is the most annoying step, IMO. This used to be much, much simpler in VS but they "deprecated" the intuitive way to do it, now you're forced to do this roundabout BS:
Make a new project in Visual Studio. Be sure to select "Empty project". You don't want any of that stdafx crap. The name of this project does not matter.
Assuming you have VS2012, go to View -> Other Windows -> Property Manager.
I *think* it's the same in older versions of VS but I can't say for certain.
The property manager window should have a single item in it named "<whatever you named your project>", with a little drop arrow on the left. Click the drop arrow to expand it.
Once expanded you should see Debug and Release directories. Expand the Debug directory.
Right click on the "Microsoft.Cpp.Win32.user" item and select "Properties" from the popup menu.
On the new window, select the "VC++ Directories" entry from the list on the left.
On the right-half of the screen, click on "Include Directories". A drop arrow will appear on the very right-hand side. Click it and select "Edit" from the menu.
Another new window will pop up. It should have a "new folder" looking icon in the top-right. Click it. It will add a new line to the list below it, and it should have an elipsis (...) button on the right. Click that button.
Navigate to the <root>/include directory, then hit "Select Folder"
Click "OK" to get out of the "Include Directories" window.
Then click on the "Library Directories" item and do all the same thing, only instead of adding the include directory... add the "<root>/projects/lib/Debug" and "<root>/projects/lib/Release" directories.
Keep hitting ok until you close all the damn windows.
10) You're done!
You can now start using SFML in any program. Just
and you're good to go (ignore any tutorials that tell you to
or any of those other headers... we're using the wrapper header to simplify it).
You will probably still get linker errors unless you statically link to the Std Runtime libs. If this happens... do the following:
- right click on your project from the solution explorer
- expand the C/C++ item on the left
- Select the "Code Generation" item on the left
- Look for the "Runtime Library" option on the right. It should be set to:
"Multi-threaded Debug (/MTd)" for Debug configurations
"Multi-threaded (/MT)" for Release configurations
I'm happy to answer Qs if you still have problems with it.