Install dependencies
Cmake
sudo dnf install cmake
Vulkan
link
The most important components you’ll need for developing Vulkan applications on Linux are the Vulkan loader, validation layers, and a couple of command-line utilities to test whether your machine is Vulkan-capable:
sudo apt install vulkan-tools
orsudo dnf install vulkan-tools
: Command-line utilities, most importantlyvulkaninfo
andvkcube
. Run these to confirm your machine supports Vulkan.sudo apt install libvulkan-dev
orsudo dnf install vulkan-loader-devel
: Installs Vulkan loader. The loader looks up the functions in the driver at runtime, similarly to GLEW for OpenGL - if you’re familiar with that.sudo apt install vulkan-validationlayers-dev spirv-tools
orsudo dnf install mesa-vulkan-devel vulkan-validation-layers-devel
: Installs the standard validation layers and required SPIR-V tools. These are crucial when debugging Vulkan applications, and we’ll discuss them in the upcoming chapter.
On Arch Linux, you can run sudo pacman -S vulkan-devel
to install all the required tools above.
If installation was successful, you should be all set with the Vulkan portion. Remember to run vkcube
and ensure you see the following pop up in a window:
Validation error
official document suggest: sudo dnf install mesa-vulkan-devel vulkan-validation-layers-devel
, but the first one will not work, also we missing another one, so the final command we should use is :
sudo dnf install vulkan-validation-layers vulkan-validation-layers-devel
GLFW
sudo dnf install glfw-devel
GLM
sudo dnf install glm-devel
GLSL
sudo dnf install glslc
switch between DEBUG mode and RELEASE mode
- First check the which compiler is using
c++ --version
currently I am using GCC - Go to the project directory, set to Release or Debug mode ->
cmake -B build -DCMAKE_BUILD_TYPE=Release
- Check if you are really in that mode:
- in the build folder, when compiling, use verbose:
make VERBOSE=1
- if the outcome contains:
/usr/bin/c++ -g
-g means debug mode
- if the outcome contains:
- use
cat CMakeCache.txt | grep CMAKE_BUILD_TYPE
- the output :
CMAKE_BUILD_TYPE:STRING=Release
means in the Release mode
- the output :
- in the build folder, when compiling, use verbose:
- Compile:
- go to build file,
make
- in the project directory (outside build folder),
cmake --build build
- go to build file,