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_CONAN_PROFILE

To adjust the conan profile, use -DINEXOR_CONAN_PROFILE=<name>.

default

INEXOR_USE_VMA_RECORDING

Enables or disables Vulkan Memory Allocator’s recording feature.

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 2019 project map for Debug mode including docs, tests, and benchmarks:

cmake -G "Visual Studio 16 2019" -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 2019 project map for Release mode but without docs, tests, and benchmarks:

cmake -G "Visual Studio 16 2019" -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 -DINEXOR_CONAN_PROFILE=default -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 16 2019" -A x64 -B./cmake-build-debug-vs/ -DCMAKE_BUILD_TYPE=Debug ./
# Build all targets
\> cmake --build ./cmake-build-debug/

Note

If you use CMake GUI add CMAKE_BUILD_TYPE with value Debug or Release. #228.

  • Choose any IDE that CMake can generate a project map for. If in doubt use Visual Studio 2019.

  • 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 16 2019). Click “Finish”.

  • CMake will now set up dependencies automatically for you using conan package manager. 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 master 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:1

# 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 \
    conan

Gentoo

# emerge \
   dev-util/cmake \
   dev-util/conan \
   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:1

# 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 \
    conan

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

Footnotes

1(1,2)

Make sure that $PATH includes the directory which contains conan (normally $HOME/.local/bin). Bash includes this directory by default, zsh does not.