Windows: Update "Windows System Requirements" for glslang and tests.
[platform/upstream/Vulkan-LoaderAndValidationLayers.git] / BUILD.md
1 # Build Instructions
2 This project fully supports Linux today.
3 Support for Windows is for the loader, layers, and the Glave debugger (additional info below).  Additional Windows support will be coming in Q1'15.
4 Support for Android is TBD.
5
6 ## Git the Bits
7
8 Make sure you have access to the Khronos Github repository. If not, send an email to
9 jens@lunarg.com or courtney@lunarg.com and we can add you if you have a Khronos account.
10 Also need to be sure that your Github account name is in your Khronos profile or the
11 system will disable Github access. Once you have access to the Khronos Github repository,
12 the preferred work flow is to fork that repo, commit work on to your fork and then issue a
13 pull request to integrate that work into the Khronos repo. If that's too much, it's okay
14 to clone the Khronos repository directly.
15
16 Note: If you are doing ICD (driver) development, please make sure to look at documentation in the [ICD Loader](loader/README.md) and the [Sample Driver](icd).
17
18 ## Linux System Requirements
19 Ubuntu 14.10 needed for DRI 3
20
21 ```
22 sudo apt-get install git subversion cmake libgl1-mesa-dev freeglut3-dev libglm-dev libpng12-dev libmagickwand-dev qt5-default libpciaccess-dev libpthread-stubs0-dev
23 sudo apt-get build-dep mesa
24 ```
25 Warning: Recent versions of 14.10 have **REMOVED** DRI 3.  
26 Version: 2:2.99.914-1~exp1ubuntu4.1 is known to work.  
27 To see status of this package:
28 ```
29 dpkg -s xserver-xorg-video-intel
30 ```
31
32 Note:  
33 Version 2:2.99.914-1~exp1ubuntu4.2 does not work anymore.  
34 To install the working driver from launchpadlibrarian.net:  
35 - Remove the current driver:  
36 ```
37 sudo apt-get purge xserver-xorg-video-intel
38 ```
39 - Download the old driver:  
40 ```
41 wget http://launchpadlibrarian.net/189418339/xserver-xorg-video-intel_2.99.914-1%7Eexp1ubuntu4.1_amd64.deb
42 ```
43 - Install the driver:
44 ```
45 sudo dpkg -i xserver-xorg-video-intel_2.99.914-1~exp1ubuntu4.1_amd64.deb
46 ```
47 - Pin the package to prevent updates
48 ```
49 sudo bash -c "echo $'Package: xserver-xorg-video-intel\nPin: version 2:2.99.914-1~exp1ubuntu4.1\nPin-Priority: 1001' > /etc/apt/preferences.d/xserver-xorg-video-intel"
50 ```
51
52 - Either restart Ubuntu or just X11.  
53   
54 ## Clone the repository
55
56 To create your local git repository:
57 ```
58 mkdir YOUR_DEV_DIRECTORY  # it's called GL-Next on Github, but the name doesn't matter
59 cd YOUR_DEV_DIRECTORY
60 git clone -o khronos git@github.com:KhronosGroup/GL-Next.git .
61 # Or substitute the URL from your forked repo for git@github.com:KhronosGroup above.
62 ```
63
64 ## Linux Build
65
66 The sample driver uses cmake and should work with the usual cmake options and utilities.
67 The standard build process builds the icd, the icd loader and all the tests.
68
69 Example debug build:
70 ```
71 cd YOUR_DEV_DIRECTORY  # cd to the root of the vk git repository
72 export KHRONOS_ACCOUNT_NAME= <subversion login name for svn checkout of BIL>
73 ./update_external_sources.sh  # fetches and builds glslang, llvm, LunarGLASS, and BIL
74 cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
75 cd dbuild
76 make
77 ```
78
79 To run VK programs you must tell the icd loader where to find the libraries. Set the
80 environment variable LIBVK_DRIVERS_PATH to the driver path. For example:
81 ```
82 export LIBVK_DRIVERS_PATH=$PWD/icd/intel
83 ```
84
85 To enable debug and validation layers with your VK programs you must tell the icd loader
86 where to find the layer libraries. Set the environment variable LIBVK_LAYERS_PATH to
87 the layer folder and indicate the layers you want loaded via LIBVK_LAYER_NAMES.
88 For example, to enable the APIDump and DrawState layers, do:
89 ```
90 export LIBVK_LAYERS_PATH=$PWD/layers
91 export LIBVK_LAYER_NAMES=APIDump:DrawState
92 ```
93
94 ## Linux Test
95
96 The test executibles can be found in the dbuild/tests directory. The tests use the Google
97 gtest infrastructure. Tests available so far:
98 - vkinfo: Report GPU properties
99 - vkbase: Test basic entry points
100 - vk_blit_tests: Test VK Blits (copy, clear, and resolve)
101 - vk_image_tests: Test VK image related calls needed by render_test
102 - vk_render_tests: Render a single triangle with VK. Triangle will be in a .ppm in
103 the current directory at the end of the test.
104
105 ## Linux Demos
106
107 The demos executables can be found in the dbuild/demos directory. The demos use DRI 3
108 to render directly onto window surfaces.
109 - tri: a textured triangle
110 - cube: a textured spinning cube
111
112 ## Linux Render Nodes
113
114 The render tests depend on access to DRM render nodes.
115 To make that available, a couple of config files need to be created to set a module option
116 and make accessible device files.
117 The system will need to be rebooted with these files in place to complete initialization.
118 These commands will create the config files.
119
120 ```
121 sudo tee /etc/modprobe.d/drm.conf << EOF
122 # Enable render nodes
123 options drm rnodes=1
124 EOF
125 # this will add the rnodes=1 option into the boot environment
126 sudo update-initramfs -k all -u
127 ```
128 ```
129 sudo tee /etc/udev/rules.d/drm.rules << EOF
130 # Add permissions to render nodes
131 SUBSYSTEM=="drm", ACTION=="add", DEVPATH=="/devices/*/renderD*", MODE="020666"
132 EOF
133 ```
134
135 ## Windows System Requirements
136
137 Windows 7+ with additional, software:
138
139 - Microsoft Visual Studio 2013 Professional.  Note: it is possible that lesser/older versions may work, but that has not been tested.
140 - CMake (from http://www.cmake.org/download/).  Notes:
141   - In order to build the Glave debugger, you need at least version 3.0.
142   - Tell the installer to "Add CMake to the system PATH" environment variable.
143 - Python 3 (from https://www.python.org/downloads).  Notes:
144   - Select to install the optional sub-package to add Python to the system PATH environment variable.
145   - Need python3.3 or later to get the Windows py.exe launcher that is used to get pyhton3 rather than python2 if both are installed on Windows
146 - Git (from http://git-scm.com/download/win).
147   - Note: If you use Cygwin, you can normally use Cygwin's "git.exe".  However, in order to use the "update_external_sources.bat" script, you must have this version.
148   - Tell the installer to allow it to be used for "Developer Prompt" as well as "Git Bash".
149   - Tell the installer to treat line endings "as is" (i.e. both DOS and Unix-style line endings).
150 - Image Magick is used by the tests to compare images (from http://www.imagemagick.org/script/binary-releases.php)
151   - Be sure to check box to "Install development headers and libraries"
152 - glslang is required for demos and tests.
153   - You can download and configure it (in a peer directory) here: https://github.com/KhronosGroup/glslang/blob/master/README.md
154   - A windows batch file has been included that will pull and build the correct version.  Run it from Developer Command Prompt for VS2013 like so:
155     - update_external_sources.bat --build-glslang
156
157 - Optional Packages:
158   - Qt 5.3 (from http://www.qt.io/download/).  Notes:
159     - Qt 5.3 is required in order to build the Glave debugger (GUI).  The Glave trace and replay tools can be built without Qt, but the debugger/GUI is built on top of Qt 5.3.  Various dependencies, from the Qt package are copied to the directory where the Glave debugger and its libraries are built.  In order to copy and run the debugger in another directory, these libraries must also be copied.  Other notes:
160     - While there are commercial licenses, you can also use the "Community" (free) license.
161     - By default, the installer will select the latest version (e.g. Qt 5.4) as well as some other components.  You must select "Qt 5.3"!  You can have multiple versions installed (e.g. Qt 5.2.1, 5.3, and 5.4).
162     - Installing Qt takes a long time.
163   - Cygwin (from https://www.cygwin.com/).  Notes:
164     - Cygwin provides some Linux-like tools, which are valuable for obtaining the source code, and running CMake.
165       Especially valuable are the BASH shell and git packages.
166     - If you don't want to use Cygwin, there are other shells and environments that can be used.
167       You can also use a Git package that doesn't come from Cygwin.
168
169 ## Windows Build
170
171 Cygwin is used in order to obtain a local copy of the Git repository, and to run the CMake command that creates Visual Studio files.  Visual Studio is used to build the software, and will re-run CMake as appropriate.
172
173 Example debug build:
174 ```
175 cd GL-Next  # cd to the root of the vk git repository
176 mkdir _out64
177 cd _out64
178 cmake -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug ..
179 ```
180
181 At this point, you can use Windows Explorer to launch Visual Studio by double-clicking on the "VULKAN.sln" file in the \_out64 folder.  Once Visual Studio comes up, you can select "Debug" or "Release" from a drop-down list.  You can start a build with either the menu (Build->Build Solution), or a keyboard shortcut (Ctrl+Shift+B).  As part of the build process, Python scripts will create additional Visual Studio files and projects, along with additional source files.  All of these auto-generated files are under the "_out64" folder.
182
183 VK programs must be able to find and use the VK.dll libary. Make sure it is either installed in the C:\Windows\System32 folder, or the PATH enviroment variable includes the folder that it is located in.
184
185 To run VK programs you must have an appropriate ICD (installable client driver) that is either installed in the C:\Windows\System32 folder, or pointed to by the registry and/or an environment variable:
186
187 - Registry:
188   - Root Key: HKEY_LOCAL_MACHINE
189   - Key: "SOFTWARE\Vulcan"
190   - Value: "VK_DRIVERS_PATH" (semi-colon-delimited set of folders to look for ICDs)
191 - Environment Variable: "VK_DRIVERS_PATH" (semi-colon-delimited set of folders to look for ICDs)
192
193 Note: If both the registry value and environment variable are used, they are concatenated into a new semi-colon-delimited list of folders.
194
195 Note: Environment variables on Windows cannot be set with Cygwin, but must be set via the Windows Control Panel, and generally require a system restart in order to take effect.  Here is how to set this environment variable on a Windows 7 system:
196
197 - Launch Control Panel (e.g. Start->Control Panel)
198 - Within the search box, type "environment variable" and click on "Edit the system environment variables" (or navigate there via "System and Security->System->Advanced system settings").
199 - This will launch a window with several tabs, one of which is "Advanced".  Click on the "Environment Variables..." button.
200 - For either "User variables" or "System variables" click "New...".
201 - Enter "VK_DRIVERS_PATH" as the variable name, and an appropriate Windows path to where your driver DLL is (e.g. C:\Users\username\GL-Next\_out64\icd\drivername\Debug).
202
203 It is possible to specify multiple icd folders.  Simply use a semi-colon (i.e. ";") to separate folders in the environment variable.
204
205 The icd loader searches in all of the folders for files that are named "VK_*.dll" (e.g. "VK_foo.dll").  It attempts to dynamically load these files, and look for appropriate functions.
206
207 To enable debug and validation layers with your VK programs you must tell the icd loader
208 where to find the layer libraries, and which ones you desire to use.  The default folder for layers is C:\Windows\System32. Again, this can be pointed to by the registry and/or an environment variable:
209
210 - Registry:
211   - Root Key: HKEY_LOCAL_MACHINE
212   - Key: "SOFTWARE\Vulcan"
213   - Value: "VK_LAYERS_PATH" (semi-colon-delimited set of folders to look for layers)
214   - Value: "VK_LAYER_NAMES" (semi-colon-delimited list of layer names)
215 - Environment Variables:
216   - "VK_LAYERS_PATH" (semi-colon-delimited set of folders to look for layers)
217   - "VK_LAYER_NAMES" (semi-colon-delimited list of layer names)
218
219 Note: If both the registry value and environment variable are used, they are concatenated into a new semi-colon-delimited list.
220
221 The icd loader searches in all of the folders for files that are named "VKLayer*.dll" (e.g. "VKLayerParamChecker.dll").  It attempts to dynamically load these files, and look for appropriate functions.