Build SFML and CSFML on Linux


Install dependencies

Ubuntu

sudo apt-get install build-essential cmake git \
libx11-dev freeglut3-dev libxcb-image0-dev libudev-dev libjpeg8-dev libopenal-dev libsndfile1-dev libfreetype6-dev

Arch Linux

Consult the PKGBUILD of sfml-git.

Other

Try to find similar packages.

Download

The result of this section should be a folder which contains 2 folders: SFML and CSFML.

Git

git clone https://github.com/SFML/SFML
cd SFML
# Checkout the latest release
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
cd ..
git clone https://github.com/SFML/CSFML
cd CSFML
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
cd ..

Tarball

Alternatively, download latest SFML and CSFML, and extract them to the same folder.

Remove the version number from the folders so you can follow the next instructions:

mv SFML-* SFML
mv CSFML-* CSFML

Build

SFML

cd SFML
cmake .
make
sudo make install  # Only if you want to install the library globally
cd ..

CSFML

cd CSFML
# Get the absolute path to SFML
SFML="$(realpath ../SFML)"
  • If you installed SFML globally:
cmake -DCMAKE_MODULE_PATH="$SFML/cmake/Modules" .
make
  • Otherwise:
cmake -DSFML_ROOT="$SFML" -DSFML_INCLUDE_DIR="$SFML/include" -DCMAKE_MODULE_PATH="$SFML/cmake/Modules" .
LD_LIBRARY_PATH="$SFML/lib"
make
sudo make install  # Only if you want to install the library globally
cd ..
Created (last updated )
Comments powered by Disqus