shvulkan pre-release
by mrsinho.
Loading...
Searching...
No Matches
Build shvulkan

Clone and Build

Open the terminal and run the following commands:

Windows

Be sure to have installed the official VulkanĀ® SDK from LunarG, then run the following commands:

git clone --recursive https://github.com/mrsinho/shvulkan.git
cd shvulkan
mkdir build
cd build
cmake -DSH_VULKAN_BUILD_EXAMPLES=ON ..
cmake --build .
cd bin/examples
start shvulkan-clear-color
start shvulkan-scene
start shvulkan-compute-power-numbers

Debian

On Debian and similar distribution before building the project you first need to install some packages:

sudo add-apt-repository -y ppa:oibaf/graphics-drivers
sudo apt update -y
sudo apt install -yy libvulkan-dev libvulkan1 vulkan-utils mesa-vulkan-drivers
sudo apt install -yy libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev

Now run these commands to build:

git clone --recursive https://github.com/mrsinho/shvulkan.git
cd shvulkan
mkdir build
cd build
cmake -DSH_VULKAN_BUILD_EXAMPLES=ON ..
cmake --build .
cd bin/examples
./shvulkan-clear-color & ./shvulkan-scene & ./shvulkan-compute-power-numbers

NixOS

Tested on X11 and Wayland graphics servers. The Nix flake lets the system choose the default windowing system.

Warning
While testing with Wayland revealed no issues, there are some resizing issues when using X11.
git clone --recursive https://github.com/mrsinho/shvulkan.git
cd shvulkan
nix build
nix develop
cd result/examples/bin
./shvulkan-clear-color & ./shvulkan-scene & ./shvulkan-compute-power-numbers

NixOS Wayland


CMake targets and variables

CMake Target Type Configure Flags
shvulkan library /
shvulkan-docs Doxygen outputs SH_VULKAN_BUILD_DOCS=ON
shvulkan-clear-color executable SH_VULKAN_BUILD_EXAMPLES=ON
shvulkan-scene executable SH_VULKAN_BUILD_EXAMPLES=ON
shvulkan-compute-example executable SH_VULKAN_BUILD_EXAMPLES=ON

If the cmake option SH_VULKAN_BUILD_EXAMPLES is enabled, the additional glfw target will be generated as a static library.

CMake Variable About
SH_VULKAN_VERSION Version of the shvulkan library
SH_VULKAN_ROOT_DIR Absolute path to the root of the repository directory
SH_VULKAN_BINARIES_DIR Absolute path to the output binaries directory

Embed shvulkan with your C/C++ projects

To link to the shvulkan library with CMake:

if (NOT TARGET shvulkan)
set(SH_VULKAN_ROOT_DIR path/to/shvulkan/root/directory)
set(SH_VULKAN_BINARIES_DIR path/your/binaries/directory)
include(${SH_VULKAN_ROOT_DIR}/shvulkan/shvulkan.cmake)
build_shvulkan()
endif()
# [...]
target_link_libraries(app PUBLIC shvulkan)

Then, include the shVulkan.h header file: