A template project for Vulkan-based applications with cross-platform support, designed to be compiled and built using various tools.
Ensure you have the following software installed depending on your operating system:
- Git: Install Git for version control and to fetch dependencies.
- CMake: Install CMake to configure the project.
- Vulkan SDK: Download the Vulkan SDK from LunarG and set up environment variables.
-
Visual Studio 2022+
- Download and install Visual Studio 2022.
- Ensure that you install the Desktop development with C++ workload, which includes the MSVC compiler, CMake, and Windows SDK.
- Git: You will also need Git to manage repositories and dependencies.
-
MSYS2/MinGW (if you choose to use MinGW or a different build toolchain)
- Download and install MSYS2.
- Update package database:
pacman -Sy
- Install necessary build tools (e.g.,
gcc
,make
, etc.):pacman -S base-devel mingw-w64-x86_64-toolchain
-
Xcode Command Line Tools
- Install Xcode Command Line Tools with the following command:
xcode-select --install
- This will install essential tools like
clang
,git
, andmake
.
- Install Xcode Command Line Tools with the following command:
-
Homebrew
- Install Homebrew, a package manager for macOS:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Then install dependencies such as
git
,cmake
, andninja
using:brew install cmake git ninja
- Install Homebrew, a package manager for macOS:
-
Package Manager
- Update your package list and install dependencies:
sudo apt update sudo apt install build-essential cmake git ninja-build libvulkan-dev
- You might also need to install
clang
orgcc
depending on your system.
- Update your package list and install dependencies:
-
Vulkan SDK
- Download the Vulkan SDK from LunarG.
- Follow the setup instructions specific to your distribution (typically extracting the SDK and setting environment variables).
-
Open x64 Native Tools Command Prompt (VS).
- You can open it by searching for "x64 Native Tools Command Prompt for VS 2022" in the Start menu.
-
Run the following commands:
cmake -B build -G "Visual Studio 17 2022" -A x64 cmake --build build --config Release
The binary will be located at:
build\Release\VulkanApp.exe
-
Open MSYS2 shell and install the necessary dependencies:
pacman -Sy pacman -S base-devel mingw-w64-x86_64-toolchain
-
Run CMake to configure and build the project:
cmake -B build -G "MinGW Makefiles" cmake --build build --config Release
🍎 macOS
📦 Install Dependencies:
Install Homebrew if not already installed
Run:
brew install cmake git
Download and install Vulkan SDK
🛠 Set up Environment Variables:
Open Terminal and run:
export VULKAN_SDK=$HOME/VulkanSDK/1.4.309.0/macOS export DYLD_LIBRARY_PATH=$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH export PATH=$VULKAN_SDK/bin:$PATH
🧠 To make these permanent:
👉 If using Zsh (macOS default):
touch ~/.zshrc open -a TextEdit ~/.zshrc
👉 If using Bash:
touch ~/.bash_profile open -a TextEdit ~/.bash_profile
Then add this to the opened file:
export VULKAN_SDK=$HOME/VulkanSDK/1.4.309.0/macOS export DYLD_LIBRARY_PATH=$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH export PATH=$VULKAN_SDK/bin:$PATH
Save, close, and apply changes:
source ~/.zshrc # or ~/.bash_profile
cd VulkanAppTemplate cmake -B build -G Ninja cmake --build build --config Release ./build/VulkanApp
✅ VSCode (macOS)
Install VSCode and required extensions:
CMake Tools
C++
Open the project folder
Use status bar or Command Palette to configure and build
-
Install Dependencies:
sudo apt update sudo apt install build-essential cmake git ninja-build libvulkan-dev
-
Build Project:
cmake -B build -G "Unix Makefiles" cmake --build build --config Release
After building, the executable will be in the build/Release/
folder. You can run it with:
./VulkanApp
- If you run into any issues, ensure that all dependencies are installed correctly and that your environment variables are properly set.