Get Started

Hob2D's dependencies are fetched and linked automatically through vcpkg and CMake. Set up the toolchain for your platform, then configure, build, and run.

Requirements

  • vcpkg and CMake (used to fetch and link dependencies).
  • A C/C++ compiler with C++20 support — MSVC, GCC, or Clang.

Windows

vcpkg

Clone vcpkg and run its bootstrap script:

git clone https://github.com/microsoft/vcpkg.git vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat

Set the VCPKG_ROOT environment variable and add it to PATH:

$env:VCPKG_ROOT = "C:\path\to\vcpkg"
$env:PATH = "$env:VCPKG_ROOT;$env:PATH"
Setting environment variables this way only affects the current terminal session. To make them permanent, set them through the Windows System Environment Variables panel.

Open a new terminal and verify:

vcpkg --version

CMake

Download the x86-x64 Windows installer from cmake.org. The CMake environment variable is configured automatically.

Linux

Install the prerequisites:

sudo apt update
sudo apt install build-essential cmake ninja-build pkgconf curl zip unzip tar

SDL3 is built from source and needs additional desktop-stack dependencies:

sudo apt install python3 python3-venv python3-pip
sudo apt install autoconf autoconf-archive automake libtool
sudo apt install libibus-1.0-dev
sudo apt install libx11-dev libxext-dev libxrandr-dev libxinerama-dev libxcursor-dev \
    libxi-dev libxfixes-dev libxrender-dev libxss-dev libxxf86vm-dev libxtst-dev
sudo apt install libwayland-dev wayland-protocols libxkbcommon-dev libegl1-mesa-dev libdecor-0-dev
sudo apt install libasound2-dev libpulse-dev libpipewire-0.3-dev libjack-jackd2-dev

Clone and bootstrap vcpkg, then set VCPKG_ROOT:

git clone https://github.com/microsoft/vcpkg.git ~/.vcpkg
cd ~/.vcpkg
./bootstrap-vcpkg.sh

echo 'export VCPKG_ROOT="$HOME/.vcpkg"' >> ~/.bashrc
echo 'export PATH="$PATH:$VCPKG_ROOT"' >> ~/.bashrc
source ~/.bashrc
vcpkg --version

macOS

Install the prerequisites:

xcode-select --install
brew install cmake ninja pkgconf

Clone and bootstrap vcpkg, then set VCPKG_ROOT:

git clone https://github.com/microsoft/vcpkg.git ~/.vcpkg
cd ~/.vcpkg
./bootstrap-vcpkg.sh

echo 'export VCPKG_ROOT="$HOME/.vcpkg"' >> ~/.zshrc
echo 'export PATH="$PATH:$VCPKG_ROOT"' >> ~/.zshrc
source ~/.zshrc
vcpkg --version

Build & Run

Configure with the preset for your toolchain, build, then run the executable:

# Configure (pick one preset)
cmake --preset debug-msvc      # Windows / MSVC
cmake --preset debug-gcc       # Linux / GCC
cmake --preset debug-clang     # macOS / Clang

# Build
cmake --build --preset windows-debug-msvc-x64

# Run
./build/debug/windows-msvc/Debug/hob2d.exe
Looking for the latest setup details? See the README on GitHub.