Skip to content

Pacheco95/khronos-vulkan-tutorial-cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux ❘ Development environment

Summary here.

Requirements

  • C++17 compiler. I used the Ubuntu clang version 17.0.5 (++20231114093837+98bfdac5ce82-1~exp1~20231114093938.66) but 16 should work fine.
  • CMake 3.22 or higher. I used 3.26.4.
  • A build system. I'm using Ninja, but you can use Unix Makefiles if you want.

Setup

The original tutorial installs dependencies using development library packages. This is a quick start, but you lose control over your dependency versions. I decided to manage the dependencies explicitly, but automatically, using CMake.

To set up your development environment, follow these steps:

  1. Download and extract the Vulkan SDK. I used version 1.3.268.0.
  2. Follow the SDK installation steps.
  3. git clone https://github.com/Pacheco95/khronos-vulkan-tutorial-cpp
  4. cd khronos-vulkan-tutorial-cpp
  5. (Optional) bun install or npm, pnpm, yarn, etc. This will configure git hooks to automatically format the source code before commits.
  6. Build the project:
# Generate build files
mkdir build && cd build

# This will download all dependencies to build/_deps directory
cmake -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_CXX_COMPILER=clang++-17 -G "Ninja Multi-Config" -S .. -B .

# Build
cmake --build . --target KhronosVulkanTutorialHpp --config Debug -j 4 # Replace 4 with your CPU core count

# Run
./Debug/KhronosVulkanTutorialHpp

If you did set up the SDK correctly, you'll see a message:

VULKAN_SDK found at <your install location>

Adjustments

  • Moved GLM_FORCE_RADIANS and GLM_FORCE_DEPTH_ZERO_TO_ONE includes to

    add_compile_definitions(

  • Deleted #define GLFW_INCLUDE_VULKAN since it imports the vulkan.h and we are now using vulkan.hpp

Navigation

🌐 Original tutorial

⏭ Drawing a triangle / Setup / Base Code