Gamedev Framework (gf)  0.11.0
A C++14 framework for 2D games
Build and install gf

Table of Contents

In this document, you will learn how to build and install gf so that you are ready for your first project with gf. It is assumed you already have a compiler installed (gcc or clang for Linux; MSVC included in Visual Studio for Windows).

gf needs a conformant C++14 compiler. The minimum version of supported compilers are given in the following table.

Compiler Version Reference
GCC 5 C++14 Support in GCC
Clang 3.4 C++14 implementation status
MSVC VS 2017 Visual C++ Language Conformance

Dependencies

gf needs some external libraries and tools that you must install before compiling gf. Here are some information about these libraries, especially the required minimum version.

Libraries:

Name Version License
SDL2 2.0.2 zlib/libpng
Boost Filesystem 1.55 Boost
Boost String Algorithms 1.55 Boost
Boost Heap 1.55 Boost
Freetype 2.5.2 Freetype
zlib 1.2.8 zlib/libpng

Tools:

Name Version
CMake 3.0.2

Getting started with Linux

This section assumes you have a working compiler, either gcc or clang, and git.

Dependencies for Linux

The recommanded way for handling dependencies on Linux is to use your favorite distribution's package manager. Here are the packages needed to build gf for various widespread distributions.

For Debian/Ubuntu:

apt-get install libsdl2-dev libboost-filesystem-dev libboost-dev libfreetype6-dev zlib1g-dev cmake

For Archlinux:

pacman -S sdl2 boost freetype2 zlib cmake

For Fedora/Red Hat/CentOS:

dnf install SDL2-devel boost-devel freetype-devel zlib-devel cmake

Build and install

First, build:

git clone https://github.com/GamedevFramework/gf.git
cd gf
git submodule update --init
mkdir build
cd build
cmake ../ -DGF_BUILD_GAMES=ON -DGF_BUILD_TOOLS=ON
make

Then install:

make install # may require root permissions

Getting started with Windows

This section assumes you are using at least Visual Studio Community 2017. You also need git for Windows and CMake 3.8 or newer. Finally, the working directory where everything will be installed is set to C:\Local\. You can choose whatever directory you want.

Dependencies for Windows

For Windows, vcpkg can handle the dependencies.

First, you have to install vcpkg from its git repository. From a command line, in the working directory:

C:\Local> git clone https://github.com/Microsoft/vcpkg.git
C:\Local> cd vcpkg

Then, you have to follow the instructions from the vcpkg documentation. Normally, during the installation process, it will detect the installed CMake.

C:\Local\vcpkg> .\bootstrap-vcpkg.bat
C:\Local\vcpkg> .\vcpkg integrate install

Then, you can install the dependencies:

C:\Local\vcpkg> .\vcpkg install sdl2 freetype boost zlib

Build and install

Back in the working directory, you can prepare the build of gf. Everything will be installed in the vcpkg hierarchy.

C:\Local> git clone https://github.com/GamedevFramework/gf.git
C:\Local> cd gf
C:\Local\gf> git submodule update --init
C:\Local\gf> mkdir build
C:\Local\gf> cd build
C:\Local\gf\build> cmake ../ -DCMAKE_TOOLCHAIN_FILE=C:\Local\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=C:\Local\vcpkg\installed\x86-windows -DGF_BUILD_GAMES=ON -DGF_BUILD_TOOLS=ON

Finally, open Visual Studio. Then, open the gf solution located at C:\Local\gf\build\GF.sln. Then, choose "Release" and build the solution (F7). Finally, build the "INSTALL" project. gf is installed as well as its tools and games.