NOTE: Python is needed for working on generated code, and helping grab dependencies. While it‘s not technically required, it’s practically required for most users.
The following will be enough for most people, for more detailed instructions, see below.
git clone https://github.com/KhronosGroup/Vulkan-ValidationLayers.git cd Vulkan-ValidationLayers cmake -S . -B build -D UPDATE_DEPS=ON -D BUILD_WERROR=ON -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug cmake --build build --config Debug # CMake 3.21+ cmake -S . -B build --preset dev cmake --build build --config Debug
This repository contains generated source code in the layers/vulkan/generated
directory which is not intended to be modified directly.
Please see the Generated Code documentation for more information
This repository does not contain a Vulkan-capable driver. You will need to obtain and install a Vulkan driver from your graphics hardware vendor or from some other suitable source if you intend to run Vulkan applications.
There is a Python utility script, scripts/update_deps.py
, that you can use to gather and build the dependent repositories mentioned above. This script uses information stored in the scripts/known_good.json
file to check out dependent repository revisions that are known to be compatible with the revision of this repository that you currently have checked out.
The script will produce a helper.cmake
file that can be consumed by the cmake
run ‘./scripts/update_deps.py --help’ for more information
When cross compiling, you may want to pass arguments to the CMake build
update_deps.py ... --cmake_var CMAKE_TOOLCHAIN_FILE=/home/.../arm64.cmake
This repository attempts to resolve some of its dependencies by using components found from the following places, in this order:
VULKAN_SDK
environment variableDependencies that cannot be resolved by the SDK or installed packages must be resolved with the “install directory” override and are listed below. The “install directory” override can also be used to force the use of a specific version of that dependency.
Note: All test will be downloaded, built, and installed with
update_deps.py
install
targetinstall
targetinstall
targetstd::unordered_map
and std::unordered_set
which provides substantial performance improvements on all platforms.install
targetinstall
targetFor running the tests:
install
targetA common convention is to place the build directory in the top directory of the repository with a name of build
and place the install directory as a child of the build directory with the name install
. The remainder of these instructions follow this convention, although you can use any name for these directories and place them in any location (see option --dir
in the notes).
update_deps.py
script fetches and builds the dependent repositories in the current directory when it is invoked. In this case, they are built in the build
directory.build
directory is also being used to build this (Vulkan-ValidationLayers) repository. But there shouldn't be any conflicts inside the build
directory between the dependent repositories and the build files for this repository.--dir
option for update_deps.py
can be used to relocate the dependent repositories to another arbitrary directory using an absolute or relative path.update_deps.py
script generates a file named helper.cmake
and places it in the same directory as the dependent repositories (build
in this case). This file contains CMake commands to set the CMake *_INSTALL_DIR
variables that are used to point to the install artifacts of the dependent repositories. You can use this file with the cmake -C
option to set these variables when you generate your build files with CMake. This lets you avoid entering several *_INSTALL_DIR
variable settings on the CMake command line.winpty update_deps.py
in order to avoid buffering all of the script's “print” output until the end and to retain the ability to interrupt script execution.update_deps.py --help
to list additional options and read the internal documentation in update_deps.py
for further information.VVL_CPP_STANDARD
option at cmake generation time. Current code is written to compile under C++17.By default BUILD_WERROR
is OFF
The idiom for open source projects is to NOT enable warnings as errors.
System package managers, and language package managers have to build on multiple different platforms and compilers.
By defaulting to ON
we cause issues for package managers since there is no standard way to disable warnings until CMake 3.24
Add -D BUILD_WERROR=ON
to your workflow. Or use the dev
preset shown below which will also enabling warnings as errors.
CMakePresets.json can save developer time by specifying common build flags.
# Enables tests, enable werror, etc. cmake -S . -B build/ --preset dev
Note: Anything less than Visual Studio 2019
is not guaranteed to compile/work.
Run CMake to generate Visual Studio project files.
# NOTE: By default CMake picks the latest version of Visual Studio as the default generator. cmake -S . -B build --preset dev # Open the Visual Studio solution cmake --open build
Check the official CMake documentation for further information on Visual Studio generators.
This repository is regularly built and tested on the two most recent Ubuntu LTS versions.
CMake 3.17.2 is recommended.
sudo apt-get install git build-essential python3 # Linux WSI system libraries sudo apt-get install libwayland-dev xorg-dev
By default, the repository components are built with support for the Vulkan-defined WSI display servers: Xcb, Xlib, and Wayland. It is recommended to build the repository components with support for these display servers to maximize their usability across Linux platforms. If it is necessary to build these modules without support for one of the display servers, the appropriate CMake option of the form BUILD_WSI_xxx_SUPPORT
can be set to OFF
.
Usage of this repository's contents in 32-bit Linux environments is not officially supported. However, since this repository is supported on 32-bit Windows, these modules should generally work on 32-bit Linux.
Here are some notes for building 32-bit targets on a 64-bit Ubuntu “reference” platform:
# 32-bit libs # your PKG_CONFIG configuration may be different, depending on your distribution sudo apt-get install gcc-multilib g++-multilib libx11-dev:i386
Set up your environment for building 32-bit targets:
export ASFLAGS=--32 export CFLAGS=-m32 export CXXFLAGS=-m32 export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu
Welcome to Android Studio
splash screen, add the following components using Configure > SDK Manager:For each of the below, you may need to specify a different build-tools version, as Android Studio will roll it forward fairly regularly.
On Linux:
export ANDROID_SDK_HOME=$HOME/Android/sdk export ANDROID_NDK_HOME=$HOME/Android/sdk/ndk-bundle export PATH=$ANDROID_SDK_HOME:$PATH export PATH=$ANDROID_NDK_HOME:$PATH # Where X.Y.Z is the most recent version number inside the build-tools directory. export PATH=$ANDROID_SDK_HOME/build-tools/X.Y.Z:$PATH
On Windows:
set ANDROID_SDK_HOME=%LOCALAPPDATA%\Android\sdk set ANDROID_NDK_HOME=%LOCALAPPDATA%\Android\sdk\ndk-bundle set PATH=%LOCALAPPDATA%\Android\sdk\ndk-bundle;%PATH%
On OSX:
export ANDROID_SDK_HOME=$HOME/Library/Android/sdk export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk-bundle export PATH=$ANDROID_NDK_HOME:$PATH # Where X.Y.Z is the most recent version number inside the build-tools directory. export PATH=$ANDROID_SDK_HOME/build-tools/X.Y.Z:$PATH
Note: If apksigner
gives a java: not found
error you do not have Java in your path.
A common way to install on the system:
sudo apt install default-jre
Setup Homebrew and components
export PATH=/usr/local/bin:$PATH
Add packages with the following:
brew install python
There are two options for building the Android layers. Either using the SPIRV tools provided as part of the Android NDK, or using upstream sources. To build with SPIRV tools from the NDK, remove the build-android/third_party directory created by running update_external_sources_android.sh, (or avoid running update_external_sources_android.sh). Use the following script to build everything in the repository for Android, including validation layers, tests, demos, and APK packaging: This script does retrieve and use the upstream SPRIV tools.
cd build-android ./build_all.sh
NOTE: To allow manual installation of Android layer libraries on development devices,
build_all.sh
will use the static version of the c++ library (libc++_static.so). For testing purposes and general usage including installation via APK the c++ shared library should be used (libc++_shared.so). See comments in build_all.sh for details.
NOTE: By default, the
build_all.sh
script will build for all Android ABI variations. To speed up the build time if you know your target(s), setAPP_ABI
in both build-android/jni/Application.mk and build-android/jni/shaderc/Application.mk to the desired Android ABI
Resulting validation layer binaries will be in build-android/libs. Test and demo APKs can be installed on production devices with:
./install_all.sh [-s <serial number>]
Note that there are no equivalent scripts on Windows yet, that work needs to be completed. The following per platform commands can be used for layer only builds:
Follow the setup steps for Linux or OSX above, then from your terminal:
cd build-android ./update_external_sources_android.sh --no-build ndk-build -j4
Follow the setup steps for Windows above, then from the Developer Command Prompt:
cd build-android update_external_sources_android.bat ndk-build
CMake 3.17.2 is recommended.
Setup Homebrew and components
export PATH=/usr/local/bin:$PATH
Add packages with the following (may need refinement)
brew install python python3 git
To create and open an Xcode project:
cmake -G Xcode -C ../external/helper.cmake -DCMAKE_BUILD_TYPE=Debug .. cmake --open .
Within Xcode, you can select Debug or Release builds in the Build Settings of the project.
The installation depends on the target platform
For UNIX operating systems:
/lib
: The Vulkan validation layer library/share/vulkan/explicit_layer.d
: The VkLayer_khronos_validation.json manifestFor WIN32/MINGW:
/bin
: The Vulkan validation layer library/bin
: The VkLayer_khronos_validation.json manifestAfter you have built your project you can install using CMake's install functionality.
CMake Docs:
# EX: Installs Release artifacts into `build/install` directory. # NOTE: --config is only needed for multi-config generators (Visual Studio, Xcode, etc) cmake --install build/ --config Release --prefix build/install