BUILD.md: changed "_out64" to "build"
[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 VkTrace trace/replay tools.
4 Support for Android is TBD.
5
6 ## Git the Bits
7
8 Make sure you have access to the Khronos GitLab repository at gitlab.khronos.org.  Once you do, the
9 preferred work flow is to clone the repo, create a branch, push branch to gitlab and then
10 issue a merge request to integrate that work back into the repo.
11
12 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).
13
14 ## Linux System Requirements
15 Ubuntu 14.10 and 15.04 have been used with the sample driver.
16
17 These packages are used for building and running the samples.
18 ```
19 sudo apt-get install git subversion cmake libgl1-mesa-dev freeglut3-dev libglm-dev libmagickwand-dev qt5-default libpciaccess-dev libpthread-stubs0-dev libudev-dev
20 sudo apt-get build-dep mesa
21 ```
22
23 The sample driver uses DRI3 for its window system interface.
24 That requires extra configuration of Ubuntu systems.
25
26 ### Ubuntu 14.10 support of DRI 3
27
28 Warning: Recent versions of 14.10 have **REMOVED** DRI 3.
29 Version: 2:2.99.914-1~exp1ubuntu4.1 is known to work.
30 To see status of this package:
31 ```
32 dpkg -s xserver-xorg-video-intel
33 ```
34
35 Note:
36 Version 2:2.99.914-1~exp1ubuntu4.2 does not work anymore.
37 To install the working driver from launchpadlibrarian.net:
38 - Remove the current driver:
39 ```
40 sudo apt-get purge xserver-xorg-video-intel
41 ```
42 - Download the old driver:
43 ```
44 wget http://launchpadlibrarian.net/189418339/xserver-xorg-video-intel_2.99.914-1%7Eexp1ubuntu4.1_amd64.deb
45 ```
46 - Install the driver:
47 ```
48 sudo dpkg -i xserver-xorg-video-intel_2.99.914-1~exp1ubuntu4.1_amd64.deb
49 ```
50 - Pin the package to prevent updates
51 ```
52 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"
53 ```
54
55 - Either restart Ubuntu or just X11.
56
57
58 ### Ubuntu 15.04 support of DRI 3
59
60 Ubuntu 15.04 has never shipped a xserver-xorg-video-intel package with supported DRI 3 on intel graphics.
61 The xserver-xorg-video-intel package can be built from source with DRI 3 enabled.
62 Use the following commands to enable DRI3 on ubuntu 15.04.
63
64 - Install packages used to build:
65 ```
66 sudo apt-get update
67 sudo apt-get dist-upgrade
68 sudo apt-get install devscripts
69 sudo apt-get build-dep xserver-xorg-video-intel
70 ```
71
72 - Get the source code for xserver-xorg-video-intel
73 ```
74 mkdir xserver-xorg-video-intel_source
75 cd xserver-xorg-video-intel_source
76 apt-get source xserver-xorg-video-intel
77 cd xserver-xorg-video-intel-2.99.917
78 debian/rules patch
79 quilt new 'enable-DRI3'
80 quilt edit configure.ac
81 ```
82
83 - Use the editor to make these changes.
84 ```
85 --- a/configure.ac
86 +++ b/configure.ac
87 @@ -340,9 +340,9 @@
88               [DRI2=yes])
89  AC_ARG_ENABLE(dri3,
90               AS_HELP_STRING([--enable-dri3],
91 -                            [Enable DRI3 support [[default=no]]]),
92 +                            [Enable DRI3 support [[default=yes]]]),
93               [DRI3=$enableval],
94 -             [DRI3=no])
95 +             [DRI3=yes])
96
97  AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
98                                    [Disable XvMC support [[default=yes]]]),
99 ```
100 - Build and install xserver-xorg-video-intel
101 ```
102 quilt refresh
103 debian/rules clean
104 debuild -us -uc
105 sudo dpkg -i ../xserver-xorg-video-intel_2.99.917-1~exp1ubuntu2.2_amd64.deb
106 ```
107 - Prevent updates from replacing this version of the package.
108 ```
109 sudo bash -c 'echo xserver-xorg-video-intel hold | dpkg --set-selections'
110 ```
111 - save your work then restart the X server with the next command.
112 ```
113 sudo service lightdm restart
114 ```
115 - After logging in again, check for success with this command and look for DRI3.
116 ```
117 xdpyinfo | grep DRI
118 ```
119
120 ## Clone the repository
121
122 To create your local git repository:
123 ```
124 mkdir YOUR_DEV_DIRECTORY  # it's called GL-Next on Github, but the name doesn't matter
125 cd YOUR_DEV_DIRECTORY
126 git clone -o khronos git@gitlab.khronos.org:vulkan/LoaderAndTools.git .
127 # Or substitute the URL from your forked repo for git@gitlab.khronos.org:vulkan/LoaderAndTools.git above.
128 ```
129
130 ## Linux Build
131
132 The sample driver uses cmake and should work with the usual cmake options and utilities.
133 The standard build process builds the icd, the icd loader and all the tests.
134
135 Example debug build:
136 ```
137 cd YOUR_DEV_DIRECTORY  # cd to the root of the vk git repository
138 export KHRONOS_ACCOUNT_NAME= <subversion login name for svn checkout of BIL>
139 ./update_external_sources.sh  # fetches and builds glslang, llvm, LunarGLASS, and BIL
140 cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
141 cd dbuild
142 make
143 ```
144
145 To run VK programs you must tell the icd loader where to find the libraries.
146 This is described in a specification in the Khronos documentation Git
147 repository.  See the file:
148 https://gitlab.khronos.org/vulkan/vulkan/blob/master/ecosystem/LinuxICDs.txt
149
150 This specification describes both how ICDs and layers should be properly
151 packaged, and how developers can point to ICDs and layers within their builds.
152
153
154 ## Linux Test
155
156 The test executibles can be found in the dbuild/tests directory. The tests use the Google
157 gtest infrastructure. Tests available so far:
158 - vkbase: Test basic entry points
159 - vk_blit_tests: Test VK Blits (copy, clear, and resolve)
160 - vk_image_tests: Test VK image related calls needed by render_test
161 - vk_render_tests: Render a single triangle with VK. Triangle will be in a .ppm in
162 the current directory at the end of the test.
163 - vk_layer_validation_tests: Test Vulkan layers.
164
165 There are also a few shell and Python scripts that run test collections (eg,
166 `run_all_tests.sh`).
167
168 ## Linux Demos
169
170 The demos executables can be found in the dbuild/demos directory. The demos use DRI 3
171 to render directly onto window surfaces.
172 - vulkaninfo: report GPU properties
173 - tri: a textured triangle
174 - cube: a textured spinning cube
175
176 ## Linux Render Nodes
177
178 The render tests depend on access to DRM render nodes.
179 To make that available, a couple of config files need to be created to set a module option
180 and make accessible device files.
181 The system will need to be rebooted with these files in place to complete initialization.
182 These commands will create the config files.
183
184 ```
185 sudo tee /etc/modprobe.d/drm.conf << EOF
186 # Enable render nodes
187 options drm rnodes=1
188 EOF
189 # this will add the rnodes=1 option into the boot environment
190 sudo update-initramfs -k all -u
191 ```
192 ```
193 sudo tee /etc/udev/rules.d/drm.rules << EOF
194 # Add permissions to render nodes
195 SUBSYSTEM=="drm", ACTION=="add", DEVPATH=="/devices/*/renderD*", MODE="020666"
196 EOF
197 ```
198
199 ## Windows System Requirements
200
201 Windows 7+ with additional required software packages:
202
203 - Microsoft Visual Studio 2013 Professional.  Note: it is possible that lesser/older versions may work, but that has not been tested.
204 - CMake (from http://www.cmake.org/download/).  Notes:
205   - In order to build the VkTrace tools, you need at least version 3.0.
206   - Tell the installer to "Add CMake to the system PATH" environment variable.
207 - Python 3 (from https://www.python.org/downloads).  Notes:
208   - Select to install the optional sub-package to add Python to the system PATH environment variable.
209   - Need python3.3 or later to get the Windows py.exe launcher that is used to get python3 rather than python2 if both are installed on Windows
210 - Git (from http://git-scm.com/download/win).
211   - 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.
212   - Tell the installer to allow it to be used for "Developer Prompt" as well as "Git Bash".
213   - Tell the installer to treat line endings "as is" (i.e. both DOS and Unix-style line endings).
214 - Image Magick is used by the tests to compare images (from http://www.imagemagick.org/script/binary-releases.php)
215   - Be sure to check box to "Install development headers and libraries"
216 - glslang is required for demos and tests.
217   - You can download and configure it (in a peer directory) here: https://github.com/KhronosGroup/glslang/blob/master/README.md
218   - 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:
219     - update_external_sources.bat --build-glslang
220
221 Optional software packages:
222
223 - Cygwin (from https://www.cygwin.com/).  Notes:
224   - Cygwin provides some Linux-like tools, which are valuable for obtaining the source code, and running CMake.
225     Especially valuable are the BASH shell and git packages.
226   - If you don't want to use Cygwin, there are other shells and environments that can be used.
227     You can also use a Git package that doesn't come from Cygwin.
228
229 ## Windows Build
230
231 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.
232
233 Example debug build (e.g. in a "Developer Command Prompt for VS2013" window):
234 ```
235 cd LoaderAndTools  # cd to the root of the Vulkan git repository
236 update_external_sources.bat --build-glslang
237 mkdir build
238 cd build
239 cmake -G "Visual Studio 12 Win64" ..
240 ```
241
242 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.
243
244 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.
245
246 To run VK programs you must tell the icd loader where to find the libraries.
247 This is described in a specification in the Khronos documentation Git
248 repository.  See the file:
249 https://gitlab.khronos.org/vulkan/vulkan/blob/master/ecosystem/WindowsICDs.txt
250
251 This specification describes both how ICDs and layers should be properly
252 packaged, and how developers can point to ICDs and layers within their builds.