Building vulkan-renderer

Also see Getting started.

If you have any trouble please open a ticket or join our Discord server.

This project uses out of source builds using either gcc, clang or Microsoft Visual Studio compiler.

Generating the documentation will create two subfolders in doc which will be ignored by git.

The following CMake targets and options are available:

List of CMake build targets.

build target

description

comment

inexor-vulkan-renderer

The main executable.

inexor-vulkan-renderer-tests

Tests the renderer using Google Test.

There are no tests available yet.

inexor-vulkan-renderer-benchmark

Benchmarking of the renderer using Google Benchmark.

There are no benchmarks available yet.

inexor-vulkan-renderer-documentation

Builds the documentation with Sphinx. Enable target creation with -DINEXOR_BUILD_DOC=ON.

inexor-vulkan-renderer-documentation-linkcheck

Use sphinx’s linkcheck feature to search for broken links.

List of CMake options.

option

description

default value

INEXOR_BUILD_EXAMPLE

Builds inexor-renderer-example.

ON

INEXOR_BUILD_TESTS

Builds inexor-renderer-tests.

OFF

INEXOR_BUILD_BENCHMARKS

Builds inexor-renderer-benchmarks.

OFF

INEXOR_BUILD_DOC

Builds the documentation with Sphinx.

OFF

INEXOR_BUILD_DOCUMENTATION_USE_VENV

Generate and use a Python virtual environment for the documentation dependencies.

ON

Windows

Example: Create Visual Studio 2022 project map for Debug mode including docs, tests, and benchmarks:

cmake -G "Visual Studio 17 2022" -A x64 -B./cmake-build-debug-vs/ -DCMAKE_BUILD_TYPE=Debug -DINEXOR_BUILD_DOC=ON -DINEXOR_BUILD_TESTS=ON -DINEXOR_BUILD_BENCHMARKS=ON ./

Example: Create Visual Studio 2022 project map for Release mode but without docs, tests, and benchmarks:

cmake -G "Visual Studio 17 2022" -A x64 -B./cmake-build-release-vs/ -DCMAKE_BUILD_TYPE=Release ./

If you have Ninja build system installed, you can use it like this:

# executing from project root assumed
# Ninja generator and Debug type
\> cmake -G Ninja -B./cmake-build-debug/ -DCMAKE_BUILD_TYPE=Debug ./
# Ninja generator and Release type
\> cmake -G Ninja -B./cmake-build-release/ -DCMAKE_BUILD_TYPE=Release ./
# Create Visual Studio Solution
\> cmake -G "Visual Studio 17 2022" -A x64 -B./cmake-build-debug-vs/ -DCMAKE_BUILD_TYPE=Debug ./
# Build all targets
\> cmake --build ./cmake-build-debug/
  • Choose any IDE that CMake can generate a project map for. If in doubt use Visual Studio 2022.

  • Clone the source code. Free and good tools are GitHub Desktop or GitKraken Git GUI.

  • Open CMake and select the root folder which contains CMakeLists.txt (not just src folder!).

  • You can choose any location for the build folder.

  • Click “Configure” and select your IDE (in doubt Visual Studio 17 2022). Click “Finish”.

  • CMake will now set up dependencies automatically for you. This might take a while. If this fails, you really should open a ticket!

  • Click “Generate”. You can now open the Visual Studio project file in your build folder.

  • For debugging, please check that the root directory of the repository is set as working directory in Visual Studio. Usually, CMake should take care of this already.

  • You are now ready to start debugging! Our main branch must be stable at all cost.

Linux

Install dependencies and tools:

Ubuntu

Follow the Install the SDK-instructions on the vulkan-sdk page.

Install the required packages:

# apt install -y \
    pkg-config \
    libglm-dev \
    libxcb-dri3-0 \
    libxcb-present0 \
    libpciaccess0 \
    libpng-dev \
    libxcb-keysyms1-dev \
    libxcb-dri3-dev \
    libx11-dev  \
    libmirclient-dev \
    libwayland-dev \
    libxrandr-dev \
    libxcb-ewmh-dev
# apt install -y \
    cmake \
    ninja-build \
    clang-tidy \
    vulkan-sdk \
    python3 \
    python3-pip
$ pip3 install \
    wheel \
    setuptools \

Gentoo

# emerge \
   dev-util/cmake \
   dev-util/vulkan-headers \
   dev-util/vulkan-tools \
   dev-vcs/git \
   media-libs/vulkan-layers \
   media-libs/vulkan-loader

Install ninja build tool (optional):

# emerge dev-util/ninja

Debian

Follow the Install the SDK-instructions on the vulkan-sdk page.

Install the required packages:

# apt install -y \
    libvulkan-dev \
    glslang-dev \
    glslang-tools \
    vulkan-tools \
    vulkan-validationlayers-dev \
    spirv-tools \
    pkg-config \
    libglm-dev \
    libxcb-dri3-0 \
    libxcb-present0 \
    libpciaccess0 \
    libpng-dev \
    libxcb-keysyms1-dev \
    libxcb-dri3-dev \
    libx11-dev \
    libmirclient-dev \
    libwayland-dev \
    libxrandr-dev \
    libxcb-ewmh-dev
# apt install -y \
    cmake \
    ninja-build \
    clang-tidy \
    vulkan-sdk \
    python3 \
    python3-pip
$ pip3 install \
    wheel \
    setuptools \

Arch

Follow the Install the SDK-instructions on the vulkan-sdk page.

Install the required packages:

# pacman -S --noconfirm \
    pkg-config \
    glslang \
    spirv-tools \
    glm \
    libice \
    libpciaccess \
    libpng \
    libx11 \
    libxres \
    xkeyboard-config \
    libxrandr \
    libxcb \
    libxaw \
    xcb-util \
    xtrans \
    libxvmc
# pacman -S --noconfirm \
    cmake \
    ninja \
    vulkan-headers \
    vulkan-tools \
    vulkan-validation-layers \
    python3 \
    python-pip
$ pip3 install \
    wheel \
    setuptools \

Fedora

Install the required packages:

# dnf install -y \
    git \
    cmake \
    gcc \
    gcc-c++ \
    ninja-build \
    vulkan \
    libvkd3d \
    vulkan-loader-devel \
    python3-pip \
    libglvnd-devel \
    libfontenc-devel \
    libXaw-devel \
    libXcomposite-devel \
    libXcursor-devel \
    libXdmcp-devel \
    libXtst-devel \
    libXinerama-devel \
    libxkbfile-devel \
    libXrandr-devel \
    libXres-devel \
    libXScrnSaver-devel \
    libXvMC-devel \
    xorg-x11-xtrans-devel \
    xcb-util-wm-devel \
    xcb-util-image-devel \
    xcb-util-keysyms-devel \
    xcb-util-renderutil-devel \
    libXdamage-devel \
    libXxf86vm-devel \
    libXv-devel \
    xcb-util-devel \
    libuuid-devel \
    xkeyboard-config-devel \
    glslang-devel

Other

Planned. We would love to see a pull request on this file if you get it running on other distributions.

Clone the repository:

$ git clone https://github.com/inexorgame/vulkan-renderer
$ cd vulkan-renderer

Configure cmake:

Note

Only pass -GNinja if the ninja build tool is installed.

$ cmake . \
   -Bbuild \
   -DCMAKE_BUILD_TYPE=Debug \
   -GNinja

Build and run:

If you have any trouble please open a ticket or join our Discord server.

$ cmake --build build --target inexor-vulkan-renderer-example
$ ./build/bin/inexor-vulkan-renderer-example