Skip to content

Graphics Building Guide

aidandenlinger edited this page May 4, 2022 · 3 revisions

Overview

Graphics codes use two building tools:

  • Conan, which is a package manager to install libraries.
  • CMake, which is a build generator that can generate build files depending on the system.

The general steps are

mkdir build
cd build
conan install .. -s build_type=Release --build missing
cmake ..

For those unfamiliar with CMake, it does not build the project, but generates a profile to build the project. On Windows, it will generate a Visual Studio solution by default. On Linux, it will generate a Makefile by default.

Windows + Visual Studio

After above steps, you should get something like this in your build folder: Build Folder Click the GRAPHICS.sln and you will have the project open in Visual Studio.

In Visual Studio, you will need to select Client as the startup project. Startup Project

Finally, on the top menu, select compile options to Release and x64.

Worth noting that although Visual Studio can do both Release and Debug build, the dependencies we installed from Conan would just be one of them. So, there might be some linking issues if only select Debug in Visual Studio.

To fix that, regenerate the project and reload in Visual Studio every time to switch the build type.

# debug build
conan install .. -s build_type=Debug --build missing
cmake ..

# release build
conan install .. -s build_type=Release --build missing
cmake ..

Linux + Makefile

After above steps, you should have the Makefile lying in your build folder. Simply call make or make Client to build the project. You may also call make clean to clean everything.

To run the binary, you need to call it from the project root folder. This is because it finds and compiles the shader at the start.

Worth noting that Makefile can only generate either a Release build or a Debug build. So, to switch between these two options, you could use following commands:

# debug build
conan install .. -s build_type=Debug --build missing
cmake .. -DCMAKE_BUILD_TYPE=Debug

# release build
conan install .. -s build_type=Release --build missing
cmake .. -DCMAKE_BUILD_TYPE=Release
Clone this wiki locally