Building from Source
This guide provides step-by-step instructions on how to build lsfg-vk from source code.
Prerequisites
Before you begin, ensure you have the required packages installed on your system.
You will need the following dependencies:
- Common build tools, such as git, curl, etc.
- A C++ compiler that supports the C++20 standard or later
- CMake (version 3.10 or higher)
- Ninja build system (other build systems may work, but Ninja is recommended)
- Vulkan SDK
- Qt6 and Qt6Quick (only needed when building lsfg-vk-ui)
The list of required packages may vary depending on your operating system. Below are the installation commands for some common Linux distributions.
Arch Linux
Install the required packages using pacman:
sudo pacman -S --needed \
git curl \
llvm clang \
cmake ninja \
vulkan-headers vulkan-icd-loader \
qt6-base qt6-declarativeUbuntu / Debian
Install the required packages using apt:
sudo apt install -y \
git curl \
llvm clang clang-tools clang-tidy \
cmake ninja-build pkg-config \
libvulkan-dev \
mesa-common-dev \
qt6-base-dev qt6-base-dev-tools \
qt6-tools-dev qt6-tools-dev-tools \
qt6-declarative-dev qt6-declarative-dev-toolsBuilding and Installing lsfg-vk
- Clone the Repository
Clone the lsfg-vk repository from git.lsfg-vk.dev:
git clone https://git.lsfg-vk.dev/lsfg-vk.git
cd lsfg-vkOptionally, you can checkout a specific release tag:
git ls-remote --tags # List all available tags
git checkout tags/<desired-tag>- Configure the Build With CMake
The recommended way to configure lsfg-vk is:
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_CXX_COMPILER=clang++ \
-DLSFGVK_BUILD_UI=ONHowever, lsfg-vk provides several CMake options to customize the build process:
CMAKE_BUILD_TYPE: Set toReleasefor optimized builds orDebugto build for debugging.CMAKE_INTERPROCEDURAL_OPTIMIZATION: Set toONto enable link-time optimization (LTO) for slightly better performance.CMAKE_INSTALL_PREFIX: Specify the installation directory (default is/usr/local).LSFGVK_BUILD_LAYER: Set toONto build the Vulkan layer (default isON).LSFGVK_BUILD_UI: Set toONto build the user interface (default isOFF).LSFGVK_BUILD_CLI: Set toONto build the command-line interface (default isON).LSFGVK_INSTALL_LIBRARIES: Set toONto install the development libraries (default isOFF).LSFGVK_LAYER_LIBRARY_PATH: Override the path to the Vulkan layer library (by default, Vulkan will search the systems library path).LSFGVK_LAYER_MULTILIB_X86: When compiling the 32-bit layer in a multilib environment, set toONto append_x86to the Vulkan layer name and.x86to the library and manifest files.LSFGVK_MANAGED: Set toONto make lsfg-vk skip checking missing files and assume a package manager is managing the installation. Please enable when packaging lsfg-vk for your distribution.
Please keep in mind that installing to non-system paths will require LSFGVK_LAYER_LIBRARY_PATH to be set accordingly (e.g. ../../../lib/liblsfg-vk-layer.so).
- Build the Project
Build the project using Ninja:
cmake --build build- Install the Project
Install the built files to the specified installation prefix:
sudo cmake --install buildKeep track of installed files in case you wish to uninstall them later.