Getting Started with C++
This section describes how to build and run the bg2 engine native (C++) API. The engine uses CMake as its build system and relies on platform-specific toolchains.
You can get the source code for the C++ API from the official repository:
git clone https://github.com/ferserc1/bg2e-nativePrerequisites
Section titled “Prerequisites”The engine depends on:
- SDL2
- Vulkan SDK
- GLM
Dependency installation differs per platform.
Requirements
Section titled “Requirements”- Xcode (version 15 or higher)
- CMake ≥ 3.18
- Vulkan SDK (including SDL2, GLM, Vulkan Memory Allocator)
cd bg2e-nativecmake -S . -B build -G Xcodecmake --build buildOn macOS, Xcode is the only supported generator. Other generators will build the project but will not correctly support native file dialogs.
Windows
Section titled “Windows”Requirements
Section titled “Requirements”- Visual Studio 2022 (Desktop C++ development)
- CMake ≥ 3.18
- Vulkan SDK (including SDL2, GLM, Vulkan Memory Allocator)
cd bg2e-nativecmake -S . -B build -G "Visual Studio 17 2022"cmake --build buildOn Windows, Visual Studio 17 is the only supported generator.
Requirements
Section titled “Requirements”Install dependencies using your package manager:
sudo apt updatesudo apt install build-essential cmake libsdl2-dev libgtk-3-dev libglm-dev ninja-buildInstall Vulkan SDK manually and register environment variables:
source ~/vulkan_sdk/1.x.xxx/setup-env.shcd bg2e-nativecmake -S . -B build -G Ninjacmake --build buildOn Linux, Ninja is the recommended generator.
Vulkan SDK Configuration
Section titled “Vulkan SDK Configuration”The build system requires the VULKAN_SDK path.
- Normally, this is automatically provided by the environment
- If not, pass it manually to CMake:
cmake -S . -B build -G Ninja -DVULKAN_SDK=/path/to/vulkan/sdkCreation Tools
Section titled “Creation Tools”The bg2 engine CMake project includes not only the core engine libraries but also a set of creation tools.
These tools are built as part of the same CMake project and can be compiled directly alongside the engine without any additional setup.
They are intended for:
- Asset generation and processing
- Scene and material authoring
- Preparing data for runtime usage in both C++ and TypeScript APIs
To build the tools, simply compile the project as described above for your platform. The corresponding executables will be generated as part of the build output.