2014-11-01 19:05:43 +00:00
# Build Instructions
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
Instructions for building this repository on Linux, Windows, and MacOS.
2014-09-02 00:05:45 +00:00
2018-02-27 17:47:00 +00:00
## Index
2018-04-04 00:28:03 +00:00
1. [Contributing ](#contributing-to-the-repository )
2. [Repository Set-Up ](#repository-set-up )
3. [Windows Build ](#building-on-windows )
4. [Linux Build ](#building-on-linux )
2018-05-11 17:42:38 +00:00
5. [MacOS build ](#building-on-macos )
2016-05-05 21:14:59 +00:00
2018-02-19 23:31:41 +00:00
## Contributing to the Repository
2018-02-27 17:47:00 +00:00
If you intend to contribute, the preferred work flow is for you to develop
your contribution in a fork of this repository in your GitHub account and
then submit a pull request.
2018-02-19 23:31:41 +00:00
Please see the [CONTRIBUTING.md ](CONTRIBUTING.md ) file in this repository for more details.
## Repository Set-Up
### Display Drivers
2018-02-27 17:47:00 +00:00
This repository does not contain a Vulkan-capable driver.
Before proceeding, it is strongly recommended that you obtain a Vulkan driver from your
graphics hardware vendor and install it properly.
2018-02-19 23:31:41 +00:00
### Download the Repository
2016-02-26 15:11:59 +00:00
2015-02-13 16:30:42 +00:00
To create your local git repository:
2018-05-11 17:42:38 +00:00
git clone --recurse-submodules https://github.com/KhronosGroup/Vulkan-Loader
The `--recurse-submodules` option is required because this repository contains
submodules.
If you forget to specify this option, you can later run:
git submodule update --init --recursive
2018-02-27 17:47:00 +00:00
2018-02-19 23:31:41 +00:00
## Building On Windows
2016-02-22 16:15:45 +00:00
2018-02-19 23:31:41 +00:00
### Windows Build Requirements
Windows 7+ with the following software packages:
- Microsoft Visual Studio 2013 Update 4 Professional, VS2015 (any version), or VS2017 (any version).
2018-06-01 21:48:52 +00:00
- [Vulkan-Headers ](https://github.com/KhronosGroup/Vulkan-Headers )
- Vulkan headers should be built with the "install" target. Generally, you will want to use the
`CMAKE_INSTALL_PREFIX` and remember where you set this to.
2018-02-19 23:31:41 +00:00
- [CMake ](http://www.cmake.org/download/ )
- Tell the installer to "Add CMake to the system PATH" environment variable.
- [Python 3 ](https://www.python.org/downloads )
2018-02-27 17:47:00 +00:00
- Select to install the optional sub-package to add Python to the system PATH
environment variable.
2018-02-19 23:31:41 +00:00
- Ensure the `pip` module is installed (it should be by default)
2018-02-27 17:47:00 +00:00
- Python3.3 or later is necessary for the Windows py.exe launcher that is used to select python3
2018-05-11 17:42:38 +00:00
rather than python2 if both are installed
2018-02-19 23:31:41 +00:00
- [Git ](http://git-scm.com/download/win )
- Tell the installer to allow it to be used for "Developer Prompt" as well as "Git Bash".
- Tell the installer to treat line endings "as is" (i.e. both DOS and Unix-style line endings).
2018-02-27 17:47:00 +00:00
- Install both the 32-bit and 64-bit versions, as the 64-bit installer does not install the
32-bit libraries and tools.
2018-02-19 23:31:41 +00:00
### Windows Build - Microsoft Visual Studio
2018-05-11 17:42:38 +00:00
The general approach is to run `cmake` to generate the VS project files.
Then either run `cmake` again to build from the command line or use the
Visual Studio IDE to open the generated solution and work with the solution
interactively.
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
It should be possible to perform these `cmake` invocations from any one of the Windows
"terminal programs", including the standard Windows Command Prompt, MSBuild Command Prompt,
PowerShell, MINGW, CygWin, etc.
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
#### Use `cmake` to create the VS project files
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
Switch to the top of the cloned repository directory,
2018-06-01 21:48:52 +00:00
create a build directory and generate the VS project files.
When generating the project files, the location to a Vulkan-Headers install
directory must be provided. This can be done by setting the environment variable
`VULKAN_HEADERS_INSTALL_DIR` or by setting it as a CMake flag.
In either case, the variable should point to the installation directory of the
Vulkan-Headers repo:
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
cd Vulkan-Loader
mkdir build
cd build
2018-06-01 21:48:52 +00:00
cmake -DVULKAN_HEADERS_INSTALL_DIR=C:\SampleDir ..
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
As it starts generating the project files, `cmake` responds with something like:
-- Building for: Visual Studio 14 2015
which is a 32-bit generator.
If this is not what you want, you can supply one of the
[specific generators ](#cmake-visual-studio-generators ).
For example:
2018-02-19 23:31:41 +00:00
2018-06-01 21:48:52 +00:00
cmake -DVULKAN_HEADERS_INSTALL_DIR=C:\SampleDir -G "Visual Studio 14 2015 Win64" ..
2018-02-19 23:31:41 +00:00
2018-05-25 19:46:58 +00:00
This creates a Windows 64-bit solution file named `Vulkan-Loader.sln`
2018-05-11 17:42:38 +00:00
in the build directory for Visual Studio 2015.
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
At this point, you can build the solution from the command line or open the
generated solution with Visual Studio.
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
#### Build the solution from the command line
While still in the build directory:
cmake --build .
to build the Debug configuration (the default), or:
cmake --build . --config Release
to make a Release build.
#### Build the solution with Visual Studio
2018-05-25 19:46:58 +00:00
Launch Visual Studio and open the "Vulkan-Loader.sln" solution file in the build folder.
2018-05-11 17:42:38 +00:00
You may select "Debug" or "Release" from the Solution Configurations drop-down list.
Start a build by selecting the Build->Build Solution menu item.
2018-05-25 19:46:58 +00:00
#### Windows Install Target
The CMake project also generates an "install" target that you can use to
copy the primary build artifacts to a specific location using a
"bin, include, lib" style directory structure.
This may be useful for collecting the artifacts and providing them to
another project that is dependent on them.
The default location is `$CMAKE_BINARY_DIR\install` , but can be changed
with the `CMAKE_INSTALL_PREFIX` variable.
You can build the install target with:
cmake --build . --config Release --target install
or build the `INSTALL` target from the Visual Studio solution explorer.
2018-05-11 17:42:38 +00:00
### Windows Tests
The Vulkan-Loader repository contains some simple unit tests for the loader
but no other test clients.
To run the loader test script, open a Powershell Console,
change to the `build\tests` directory, and run:
2018-02-19 23:31:41 +00:00
For Release builds:
2018-02-27 17:47:00 +00:00
.\run_all_tests.ps1
2018-02-19 23:31:41 +00:00
For Debug builds:
2018-02-27 17:47:00 +00:00
.\run_all_tests.ps1 -Debug
2018-02-19 23:31:41 +00:00
This script will run the following tests:
2018-02-27 17:47:00 +00:00
- `vk_loader_validation_tests` :
Vulkan loader handle wrapping, allocation callback, and loader/layer interface tests
2018-02-07 23:33:33 +00:00
2018-05-11 17:42:38 +00:00
You can also change to either `build\tests\Debug` or `build\tests\Release`
(depending on which one you built) and run the executable tests (`*.exe`) files
from there.
2016-02-22 16:15:45 +00:00
2018-02-19 23:31:41 +00:00
### Windows Notes
2018-02-27 17:47:00 +00:00
#### CMake Visual Studio Generators
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
The chosen generator should match one of the Visual Studio versions that you have installed.
Appropriate Visual Studio generators include:
2018-02-19 23:31:41 +00:00
| Build Platform | 64-bit Generator | 32-bit Generator |
|------------------------------|-------------------------------|-------------------------|
| Microsoft Visual Studio 2013 | "Visual Studio 12 2013 Win64" | "Visual Studio 12 2013" |
| Microsoft Visual Studio 2015 | "Visual Studio 14 2015 Win64" | "Visual Studio 14 2015" |
| Microsoft Visual Studio 2017 | "Visual Studio 15 2017 Win64" | "Visual Studio 15 2017" |
2018-02-27 17:47:00 +00:00
#### The Vulkan Loader Library
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
Vulkan programs must be able to find and use the Vulkan loader (`vulkan-1.dll`)
library as well as any other libraries the program requires.
One convenient way to do this is to copy the required libraries into the same
directory as the program.
The projects in this solution copy the Vulkan loader library and the "googletest"
libraries to the `build\tests\Debug` or the `build\tests\Release` directory,
which is where the `vk_loader_validation_test.exe` executable is found, depending
on what configuration you built.
(The loader validation tests use the "googletest" testing framework.)
Other techniques include placing the library in a system folder (C:\Windows\System32) or in a
directory that appears in the `PATH` environment variable.
See the `LoaderAndLayerInterface` document in the `loader` folder in this repository
for more information on how the loader finds driver libraries and layer libraries.
The document also describes both how ICDs and layers should be packaged,
and how developers can point to ICDs and layers within their builds.
2018-02-19 23:31:41 +00:00
## Building On Linux
### Linux Build Requirements
This repository has been built and tested on the two most recent Ubuntu LTS versions.
Currently, the oldest supported version is Ubuntu 14.04, meaning that the minimum supported compiler versions are GCC 4.8.2 and Clang 3.4, although earlier versions may work.
It should be straightforward to adapt this repository to other Linux distributions.
**Required Package List:**
2018-02-27 17:47:00 +00:00
sudo apt-get install git cmake build-essential libx11-xcb-dev libxkbcommon-dev libmirclient-dev libwayland-dev libxrandr-dev
2014-09-02 00:05:45 +00:00
2018-06-01 21:48:52 +00:00
In addition to this, the [Vulkan-Headers ](https://github.com/KhronosGroup/Vulkan-Headers ) repo should be
built and installed to the directory of your choosing. This can be done by setting `CMAKE_INSTALL_PREFIX`
and running the "install" target from within the Vulkan-Headers repository.
2018-02-19 23:31:41 +00:00
### Linux Build
Example debug build (Note that the update\_external\_sources script used below builds external tools into predefined locations.
See **Loader and Validation Layer Dependencies** for more information and other options):
2018-05-11 17:42:38 +00:00
Switch to the top of the cloned repository directory,
2018-06-01 21:48:52 +00:00
create a build directory and generate the make files.
When generating the project files, the location to a Vulkan-Headers install
directory must be provided. This can be done by setting the environment variable
`VULKAN_HEADERS_INSTALL_DIR` or by setting it as a CMake flag.
In either case, the variable should point to the installation directory of the
Vulkan-Headers repo:
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
cd Vulkan-Loader
mkdir build
cd build
2018-06-01 21:48:52 +00:00
cmake -DVULKAN_HEADERS_INSTALL_DIR=/sample/dir -DCMAKE_BUILD_TYPE=Debug ..
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
Run `make -j8` to begin the build.
2014-09-02 00:05:45 +00:00
2018-02-27 17:47:00 +00:00
If your build system supports ccache, you can enable that via CMake option `-DUSE_CCACHE=On`
2018-05-11 17:42:38 +00:00
#### Using the new loader
2014-09-02 00:05:45 +00:00
2018-05-11 17:42:38 +00:00
If you want to test a Vulkan application with the loader you just built, you can
direct the application to load it from your build directory:
2018-02-27 17:47:00 +00:00
export LD_LIBRARY_PATH=< path to your repository root > /build/loader
2016-03-10 16:13:00 +00:00
2018-02-27 17:47:00 +00:00
The `LoaderAndLayerInterface` document in the `loader` folder in this repository
is a specification that describes both how ICDs and layers should be properly packaged,
and how developers can point to ICDs and layers within their builds.
2015-01-07 00:32:22 +00:00
2016-12-07 19:12:45 +00:00
### WSI Support Build Options
2018-02-19 23:31:41 +00:00
2018-05-11 17:42:38 +00:00
By default, the Vulkan Loader is built with support for all 4 Vulkan-defined WSI display servers: Xcb, Xlib, Wayland, and Mir.
2018-02-19 23:31:41 +00:00
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` .
See the top-level CMakeLists.txt file for more info.
2016-12-07 19:12:45 +00:00
2016-09-30 19:32:16 +00:00
### Linux Install to System Directories
2018-02-19 23:31:41 +00:00
Installing the files resulting from your build to the systems directories is optional since environment variables can usually be used instead to locate the binaries.
2016-09-30 19:32:16 +00:00
There are also risks with interfering with binaries installed by packages.
2018-02-19 23:31:41 +00:00
If you are certain that you would like to install your binaries to system directories, you can proceed with these instructions.
2016-09-30 19:32:16 +00:00
2018-02-19 23:31:41 +00:00
Assuming that you've built the code as described above and the current directory is still `build` , you can execute:
2016-09-30 19:32:16 +00:00
2018-02-27 17:47:00 +00:00
sudo make install
2016-09-30 19:32:16 +00:00
This command installs files to:
2018-02-27 17:47:00 +00:00
- `/usr/local/include/vulkan` : Vulkan include files
2018-05-11 17:42:38 +00:00
- `/usr/local/lib` : Vulkan loader library and package config files
2016-09-30 19:32:16 +00:00
You may need to run `ldconfig` in order to refresh the system loader search cache on some Linux systems.
2018-02-19 23:31:41 +00:00
You can further customize the installation location by setting additional CMake variables to override their defaults.
For example, if you would like to install to `/tmp/build` instead of `/usr/local` , on your CMake command line specify:
2016-10-31 21:58:21 +00:00
2018-02-27 17:47:00 +00:00
-DCMAKE_INSTALL_PREFIX=/tmp/build
-DDEST_DIR=/tmp/build
2016-10-31 21:58:21 +00:00
2018-02-19 23:31:41 +00:00
Then run `make install` as before. The install step places the files in `/tmp/build` .
2018-05-25 19:46:58 +00:00
This may be useful for collecting the artifacts and providing them to
another project that is dependent on them.
2016-10-31 21:58:21 +00:00
2018-02-27 17:47:00 +00:00
Using the `CMAKE_INSTALL_PREFIX` to customize the install location also modifies
the loader search paths to include searching for layers in the specified install location.
In this example, setting `CMAKE_INSTALL_PREFIX` to `/tmp/build` causes the loader to search
`/tmp/build/etc/vulkan/explicit_layer.d` and `/tmp/build/share/vulkan/explicit_layer.d`
for the layer JSON files.
The loader also searches the "standard" system locations of `/etc/vulkan/explicit_layer.d` and
`/usr/share/vulkan/explicit_layer.d` after searching the two locations under `/tmp/build` .
2016-10-31 21:58:21 +00:00
2018-02-27 17:47:00 +00:00
You can further customize the installation directories by using the CMake variables
`CMAKE_INSTALL_SYSCONFDIR` to rename the `etc` directory and `CMAKE_INSTALL_DATADIR`
to rename the `share` directory.
2016-10-31 21:58:21 +00:00
2018-02-27 17:47:00 +00:00
See the CMake documentation for more details on using these variables
to further customize your installation.
2016-11-19 17:24:47 +00:00
2018-02-27 17:47:00 +00:00
Also see the `LoaderAndLayerInterface` document in the `loader` folder in this
repository for more information about loader operation.
2016-11-19 17:24:47 +00:00
2018-05-11 17:42:38 +00:00
Note that some executables in this repository (e.g., `vk_loader_validation_tests` )
use the "rpath" linker directive to
2018-02-27 17:47:00 +00:00
load the Vulkan loader from the build directory, `build` in this example.
This means that even after installing the loader to the system directories, these executables still
use the loader from the build directory.
2016-11-19 17:24:47 +00:00
2018-02-19 23:31:41 +00:00
### Linux Uninstall
2016-11-19 17:24:47 +00:00
2018-02-19 23:31:41 +00:00
To uninstall the files from the system directories, you can execute:
2016-11-19 17:24:47 +00:00
2018-02-27 17:47:00 +00:00
sudo make uninstall
2016-11-19 17:24:47 +00:00
2018-05-11 17:42:38 +00:00
### Linux Tests
2016-11-19 17:24:47 +00:00
2018-05-11 17:42:38 +00:00
The Vulkan-Loader repository contains some simple unit tests for the loader
but no other test clients.
2014-09-02 00:05:45 +00:00
2018-05-11 17:42:38 +00:00
To run the loader test script,
change to the `build/tests` directory, and run:
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
./run_all_tests.sh
2015-08-05 19:17:06 +00:00
2018-02-19 23:31:41 +00:00
This script will run the following tests:
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
- `vk_loader_validation_tests` :
Vulkan loader handle wrapping, allocation callback, and loader/layer interface tests
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
### Linux Notes
2014-10-30 21:59:54 +00:00
2018-05-11 17:42:38 +00:00
#### RPATH
2018-02-27 17:47:00 +00:00
2018-05-11 17:42:38 +00:00
The `vk_loader_validation_tests` executable is linked with an `RPATH` setting to allow
it to find the Vulkan loader library in the repository's build directory.
This allows the test executable to run and find this Vulkan loader library
without installing the loader library to a directory searched by the system
loader or in the `LD_LIBRARY_PATH` .
2015-02-05 19:22:51 +00:00
2018-02-19 23:31:41 +00:00
#### Linux 32-bit support
2015-02-05 19:22:51 +00:00
2018-02-19 23:31:41 +00:00
Usage of this repository's contents in 32-bit Linux environments is not officially supported.
2018-02-27 17:47:00 +00:00
However, since this repository is supported on 32-bit Windows,
these modules should generally work on 32-bit Linux.
2015-07-08 20:33:52 +00:00
2018-02-19 23:31:41 +00:00
Here are some notes for building 32-bit targets on a 64-bit Ubuntu "reference" platform:
2015-07-08 21:43:03 +00:00
2018-02-19 23:31:41 +00:00
If not already installed, install the following 32-bit development libraries:
2016-05-05 19:52:37 +00:00
2018-02-19 23:31:41 +00:00
`gcc-multilib g++-multilib libx11-dev:i386`
2015-02-05 19:22:51 +00:00
2018-02-19 23:31:41 +00:00
This list may vary depending on your distribution and which windowing systems you are building for.
2015-02-05 19:22:51 +00:00
2018-02-19 23:31:41 +00:00
Set up your environment for building 32-bit targets:
2015-02-10 22:02:08 +00:00
2018-02-27 17:47:00 +00:00
export ASFLAGS=--32
export CFLAGS=-m32
export CXXFLAGS=-m32
export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu
2016-01-15 19:35:39 +00:00
2018-02-19 23:31:41 +00:00
Again, your PKG_CONFIG configuration may be different, depending on your distribution.
2017-08-26 12:20:51 +00:00
2018-02-19 23:31:41 +00:00
Finally, rebuild the repository using `cmake` and `make` , as explained above.
2017-08-26 12:20:51 +00:00
2017-12-12 15:33:01 +00:00
## Building on MacOS
### MacOS Build Requirements
Tested on OSX version 10.12.6
Setup Homebrew and components
- Follow instructions on [brew.sh ](http://brew.sh ) to get Homebrew installed.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Ensure Homebrew is at the beginning of your PATH:
export PATH=/usr/local/bin:$PATH
- Add packages with the following (may need refinement)
brew install cmake python python3 git
2018-06-01 21:48:52 +00:00
In addition to this, the [Vulkan-Headers ](https://github.com/KhronosGroup/Vulkan-Headers ) repo should be
built and installed to the directory of your choosing. This can be done by setting `CMAKE_INSTALL_PREFIX`
and running the "install" target from within the Vulkan-Headers repository.
2017-12-12 15:33:01 +00:00
### MacOS build
#### CMake Generators
This repository uses CMake to generate build or project files that are
then used to build the repository.
The CMake generators explicitly supported in this repository are:
- Unix Makefiles
- Xcode
#### Building with the Unix Makefiles Generator
2018-06-01 21:48:52 +00:00
This generator is the default generator.
However, when generating the project files, the location to a Vulkan-Headers install
directory must be provided. This can be done by setting the environment variable
`VULKAN_HEADERS_INSTALL_DIR` or by setting it as a CMake flag.
In either case, the variable should point to the installation directory of the
Vulkan-Headers repo:
2017-12-12 15:33:01 +00:00
mkdir build
cd build
2018-06-01 21:48:52 +00:00
cmake -DVULKAN_HEADERS_INSTALL_DIR=/sample/dir -DCMAKE_BUILD_TYPE=Debug ..
2017-12-12 15:33:01 +00:00
make
To speed up the build on a multi-core machine, use the `-j` option for `make`
to specify the number of cores to use for the build.
For example:
make -j4
2018-05-15 16:27:44 +00:00
#### Building with the Xcode Generator
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
To create and open an Xcode project:
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
mkdir build-xcode
cd build-xcode
cmake -GXcode ..
open Vulkan-Loader.xcodeproj
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
Within Xcode, you can select Debug or Release builds in the project's Build Settings.
2017-12-12 15:33:01 +00:00
2018-05-25 19:46:58 +00:00
### Using the new macOS loader
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
If you want to test a Vulkan application with the loader you just built, you can direct the application to load it from your build directory:
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
export DYLD_LIBRARY_PATH=< path to your repository > /build/loader
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
### MacOS Tests
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
The Vulkan-Loader repository contains some simple unit tests for the loader but no other test clients.
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
Before you run these tests, you will need to clone and build the [MoltenVK ](https://github.com/KhronosGroup/MoltenVK ) repository.
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
You will also need to direct your new loader to the MoltenVK ICD:
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
export VK_ICD_FILENAMES=< path to MoltenVK repository > /Package/Latest/MoltenVK/macOS/MoltenVK_icd.json
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
To run the loader test script, change to the `build/tests` directory in your Vulkan-Loader repository, and run:
2017-12-12 15:33:01 +00:00
2018-05-15 16:27:44 +00:00
./vk_loader_validation_tests
2017-12-12 15:33:01 +00:00
2016-04-18 17:04:36 +00:00
## Ninja Builds - All Platforms
2018-02-27 17:47:00 +00:00
The [Qt Creator IDE ](https://qt.io/download-open-source/#section-2 ) can open a root CMakeList.txt
as a project directly, and it provides tools within Creator to configure and generate Vulkan SDK
build files for one to many targets concurrently.
2017-12-12 15:33:01 +00:00
Alternatively, when invoking CMake, use the `-G "Codeblocks - Ninja"` option to generate Ninja build
2018-02-27 17:47:00 +00:00
files to be used as project files for QtCreator
- Follow the steps defined elsewhere for the OS using the update\_external\_sources script or as
shown in **Loader and Validation Layer Dependencies** below
- Open, configure, and build the glslang CMakeList.txt files. Note that building the glslang
project will provide access to spirv-tools and spirv-headers
2018-02-19 23:31:41 +00:00
- Then do the same with the Vulkan-LoaderAndValidationLayers CMakeList.txt file
2018-02-27 17:47:00 +00:00
- In order to debug with QtCreator, a
[Microsoft WDK: eg WDK 10 ](http://go.microsoft.com/fwlink/p/?LinkId=526733 ) is required.
2017-12-12 15:33:01 +00:00
Note that installing the WDK breaks the MSVC vcvarsall.bat build scripts provided by MSVC,
requiring that the LIB, INCLUDE, and PATHenv variables be set to the WDK paths by some other means
2018-02-19 23:31:41 +00:00
2018-02-27 17:47:00 +00:00
## Optional software packages
2016-04-18 17:04:36 +00:00
2018-02-19 23:31:41 +00:00
- [Cygwin for windows ](https://www.cygwin.com/ )
2018-02-27 17:47:00 +00:00
- Cygwin provides some Linux-like tools, which can be valuable for working with the repository,
such as the BASH shell and git packages
2018-02-19 23:31:41 +00:00
- With appropriate adjustments, it is possible to use other shells and environments as well
2016-12-01 21:49:27 +00:00
2018-02-19 23:31:41 +00:00
- [Ninja on all platforms ](https://github.com/ninja-build/ninja/releases )
- [The Ninja-build project ](https://ninja-build.org )
- [Ninja Users Manual ](https://ninja-build.org/manual.html )
2016-04-18 17:04:36 +00:00
- [QtCreator as IDE for CMake builds on all platforms ](https://qt.io/download-open-source/#section-2 )
2018-05-18 15:52:22 +00:00
## Build Options
When generating native platform build files through CMake, several options can be specified to customize the build.
Some of the options are binary on/off options, while others take a string as input.
The following is a table of all on/off options currently supported by this repository:
| Option | Platform | Default | Description |
| ------ | -------- | ------- | ----------- |
| BUILD_LOADER | All | `ON` | Controls whether or not the loader is built. Setting this to `OFF` will allow building the tests against a loader that is installed to the system. |
| BUILD_TESTS | All | `ON` | Controls whether or not the loader tests are built. |
| BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the loader with the XCB entry points enabled. Without this, the XCB headers should not be needed, but the extension `VK_KHR_xcb_surface` won't be available. |
| BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the loader with the Xlib entry points enabled. Without this, the X11 headers should not be needed, but the extension `VK_KHR_xlib_surface` won't be available. |
| BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the loader with the Wayland entry points enabled. Without this, the Wayland headers should not be needed, but the extension `VK_KHR_wayland_surface` won't be available. |
| BUILD_WSI_MIR_SUPPORT | Linux | `OFF` | Build the loader with the Mir entry points enabled. Without this, the Mir headers should not be needed, but the extension `VK_KHR_mir_surface` won't be available. |
| ENABLE_STATIC_LOADER | Windows | `OFF` | By default, the loader is built as a dynamic library. This allows it to be built as a static library, instead. |
| ENABLE_WIN10_ONECORE | Windows | `OFF` | Link the loader to the [OneCore ](https://msdn.microsoft.com/en-us/library/windows/desktop/mt654039.aspx ) umbrella library, instead of the standard Win32 ones. |
| USE_CCACHE | Linux | `OFF` | Enable caching with the CCache program. |
The following is a table of all string options currently supported by this repsitory:
| Option | Platform | Default | Description |
| ------ | -------- | ------- | ----------- |
| CMAKE_OSX_DEPLOYMENT_TARGET | MacOS | `10.12` | The minimum version of MacOS for loader deployment. |
| FALLBACK_CONFIG_DIRS | Linux/MacOS | `/etc/xdg` | Configuration path(s) to use instead of `XDG_CONFIG_DIRS` if that environment variable is unavailable. The default setting is freedesktop compliant. |
| FALLBACK_DATA_DIRS | Linux/MacOS | `/usr/local/share:/usr/share` | Configuration path(s) to use instead of `XDG_DATA_DIRS` if that environment variable is unavailable. The default setting is freedesktop compliant. |
These environment variables should be set using the `-D` flag when invoking CMake to generate the native platform files.
For example, to generate a Linux makefile with the tests disabled and a custom configuration directory, one would run:
2018-05-25 19:46:58 +00:00
```shell
2018-05-18 15:52:22 +00:00
cmake .. -DBUILD_TESTS=OFF -DFALLBACK_CONFIG_DIRS=/my/custom/location
```
The directory can then be built as usual, which on Linux would simply be the `make` command.