Skip to content

Install ​

You build gameboy from its source code. The build produces two programs: gameboy (the window) and gb_run_rom (the headless runner used for tests).

Good to know

The repository's build pipeline can attach prebuilt archives and Linux packages to a release, but no release has been published. Check the releases page; if it is empty, build from source as described here.

What you need ​

  • CMake 3.16 or newer
  • A C++20 compiler (GCC, Clang or MSVC)
  • The SDL2 development files
  • Git, to download the source

Build on Linux ​

  1. Install the tools. On Debian or Ubuntu:

    bash
    sudo apt install build-essential cmake git libsdl2-dev

    On other distributions, install the equivalent compiler, CMake and SDL2 development packages.

  2. Download the source:

    bash
    git clone https://github.com/Dhiva-Labs/gameboy.git
    cd gameboy
  3. Configure and build:

    bash
    cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
    cmake --build build -j
  4. Check the result. Run the program with no arguments:

    bash
    ./build/gameboy

    It prints its usage text, including the key list, and exits. That means the build worked.

The programs are build/gameboy and build/gb_run_rom. You can run them from there; nothing needs to be installed system-wide.

Build on Windows ​

Use MSVC (Visual Studio 2022) and install SDL2 with vcpkg. Run these in a Developer Command Prompt:

bat
vcpkg install sdl2:x64-windows
cmake -S . -B build -A x64 ^
  -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake ^
  -DVCPKG_TARGET_TRIPLET=x64-windows
cmake --build build --config Release

For Windows on ARM64, use sdl2:arm64-windows, -A ARM64 and -DVCPKG_TARGET_TRIPLET=arm64-windows.

The programs and SDL2.dll end up in build\Release\.

Next steps ​