Building RGBDS from source

Foreword: building RGBDS is largely dependent on your system, so the instructions provided here are somewhat generic. Windows works largely differently from everything else, so some expertise is expected if attempting this on Windows.

RGBDS does not require more than a regular environment, except RGBGFX that relies on libpng; if you wish to use RGBGFX, you should install libpng.

1. Get sources

You first need to get the sources to be compiled, using one of the methods below.

Using Git

First, clone the repository. Then, run git checkout <version> (e.g. git checkout v0.4.1), and you’re set.

Downloading source snapshots

Go to your desired release’s release page. Near the bottom of the page is a list of assets; grab either of the last three (rgbds-<version>.tar.gz, “Source code (zip)”, or “Source code (tar.gz)”), and extract it.

2. Build

The following are required to build RGBDS; it’s possible that some are already installed on your system.

Two build systems are supported: plain old make, and cmake. Both can be used on most systems, but Windows users will almost certainly be unable to use make.

Make sure to run all of the following commands from the root directory!

make

Simply run the following two commands:

make
sudo make install

The second command is optional if you don’t want to install RGBDS system-wide.

The following variables can be defined to control installation, like so: make Q=, sudo make install PREFIX=~/.local/bin

cmake

First, run CMake on the project.

cmake 3.13 and later:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

cmake 3.12.4 and earlier:

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cd ..

Then, build RGBDS.

cmake --build build

Finally, you may install RGBDS. You are not required to, you can do whatever with the four binaries in build/src at this point.

cmake 3.15 and later:

sudo cmake --install build

cmake 3.14 and earlier:

cd build
sudo make install