Building SFML 2.X for MSYS

Post date: Sep 15, 2012 5:3:41 PM

I found a site with video instructions for building SFML 2.0 in MinGW. I modified the instructions slightly for MSYS.

CMake is required.

You can use curl to directly download the latest source, or follow the github link and save to $HOME.

If you have a previous version of SFML, uninstall it. rm worked for me:

  • rm /usr/local/lib/libsfml*

  • rm -rfi /usr/local/include/SFML

Copy the latest source from github (TODO: install curl):

  • curl -LOJ https://github.com/SFML/SFML/tarball/master

Extract the source (filename changes with git commit ID):

  • tar xvfz SFML-SFML-2.4.0-19-g746bb9c.tar.gz

You can ignore the failure status, there's an empty link for an OSX resources file. Change to the directory:

  • cd SFML-SFML-*

Create makefiles with CMake (Note that there are no spaces between command line switch and argument):

  • cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release \

  • -DBUILD_SHARED_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local .

Build the library and install to /usr/local:

  • make

  • make install

Without specifying CMAKE_INSTALL_PREFIX, default install location is %PROGRAMFILES%/SFML. Installing there requires running your MSYS terminal as Administrator.

Now, you can follow the rest of SFML Coder's tutorials.

The official SFML site also has tutorials.