Fix "_out64" -> "build" references accidentally removed
[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  AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
97                                    [Disable XvMC support [[default=yes]]]),
98 ```
99 - Build and install xserver-xorg-video-intel
100 ```
101 quilt refresh
102 debian/rules clean
103 debuild -us -uc
104 sudo dpkg -i ../xserver-xorg-video-intel_2.99.917-1~exp1ubuntu2.2_amd64.deb
105 ```
106 - Prevent updates from replacing this version of the package.
107 ```
108 sudo bash -c 'echo xserver-xorg-video-intel hold | dpkg --set-selections'
109 ```
110 - save your work then restart the X server with the next command.
111 ```
112 sudo service lightdm restart
113 ```
114 - After logging in again, check for success with this command and look for DRI3.
115 ```
116 xdpyinfo | grep DRI
117 ```
118
119 ## Clone the repository
120
121 To create your local git repository:
122 ```
123 mkdir YOUR_DEV_DIRECTORY  # it's called GL-Next on Github, but the name doesn't matter
124 cd YOUR_DEV_DIRECTORY
125 git clone -o khronos git@gitlab.khronos.org:vulkan/LoaderAndTools.git .
126 # Or substitute the URL from your forked repo for git@gitlab.khronos.org:vulkan/LoaderAndTools.git above.
127 ```
128
129 ## Linux Build
130
131 The sample driver uses cmake and should work with the usual cmake options and utilities.
132 The standard build process builds the icd, the icd loader and all the tests.
133
134 Example debug build:
135 ```
136 cd YOUR_DEV_DIRECTORY  # cd to the root of the vk git repository
137 export KHRONOS_ACCOUNT_NAME= <subversion login name for svn checkout of BIL>
138 ./update_external_sources.sh  # fetches and builds glslang, llvm, LunarGLASS, and BIL
139 cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
140 cd dbuild
141 make
142 ```
143
144 To run VK programs you must tell the icd loader where to find the libraries.
145 This is described in a specification in the Khronos documentation Git
146 repository.  See the file:
147 https://gitlab.khronos.org/vulkan/vulkan/blob/master/ecosystem/LinuxICDs.txt
148
149 This specification describes both how ICDs and layers should be properly
150 packaged, and how developers can point to ICDs and layers within their builds.
151
152
153 ## Linux Test
154
155 The test executibles can be found in the dbuild/tests directory. The tests use the Google
156 gtest infrastructure. Tests available so far:
157 - vkbase: Test basic entry points
158 - vk_blit_tests: Test VK Blits (copy, clear, and resolve)
159 - vk_image_tests: Test VK image related calls needed by render_test
160 - vk_render_tests: Render a single triangle with VK. Triangle will be in a .ppm in
161 the current directory at the end of the test.
162 - vk_layer_validation_tests: Test Vulkan layers.
163
164 There are also a few shell and Python scripts that run test collections (eg,
165 `run_all_tests.sh`).
166
167 ## Linux Demos
168
169 The demos executables can be found in the dbuild/demos directory. The demos use DRI 3
170 to render directly onto window surfaces.
171 - vulkaninfo: report GPU properties
172 - tri: a textured triangle
173 - cube: a textured spinning cube
174
175 ## Linux Render Nodes
176
177 The render tests depend on access to DRM render nodes.
178 To make that available, a couple of config files need to be created to set a module option
179 and make accessible device files.
180 The system will need to be rebooted with these files in place to complete initialization.
181 These commands will create the config files.
182
183 ```
184 sudo tee /etc/modprobe.d/drm.conf << EOF
185 # Enable render nodes
186 options drm rnodes=1
187 EOF
188 # this will add the rnodes=1 option into the boot environment
189 sudo update-initramfs -k all -u
190 ```
191 ```
192 sudo tee /etc/udev/rules.d/drm.rules << EOF
193 # Add permissions to render nodes
194 SUBSYSTEM=="drm", ACTION=="add", DEVPATH=="/devices/*/renderD*", MODE="020666"
195 EOF
196 ```
197
198 ## Windows System Requirements
199
200 Windows 7+ with additional required software packages:
201
202 - Microsoft Visual Studio 2013 Professional.  Note: it is possible that lesser/older versions may work, but that has not been tested.
203 - CMake (from http://www.cmake.org/download/).  Notes:
204   - In order to build the VkTrace tools, you need at least version 3.0.
205   - Tell the installer to "Add CMake to the system PATH" environment variable.
206 - Python 3 (from https://www.python.org/downloads).  Notes:
207   - Select to install the optional sub-package to add Python to the system PATH environment variable.
208   - 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
209 - Git (from http://git-scm.com/download/win).
210   - 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.
211   - Tell the installer to allow it to be used for "Developer Prompt" as well as "Git Bash".
212   - Tell the installer to treat line endings "as is" (i.e. both DOS and Unix-style line endings).
213 - Image Magick is used by the tests to compare images (from http://www.imagemagick.org/script/binary-releases.php)
214   - Be sure to check box to "Install development headers and libraries"
215 - glslang is required for demos and tests.
216   - You can download and configure it (in a peer directory) here: https://github.com/KhronosGroup/glslang/blob/master/README.md
217   - 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:
218     - update_external_sources.bat --build-glslang
219
220 Optional software packages:
221
222 - Cygwin (from https://www.cygwin.com/).  Notes:
223   - Cygwin provides some Linux-like tools, which are valuable for obtaining the source code, and running CMake.
224     Especially valuable are the BASH shell and git packages.
225   - If you don't want to use Cygwin, there are other shells and environments that can be used.
226     You can also use a Git package that doesn't come from Cygwin.
227
228 ## Windows Build
229
230 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.
231
232 Example debug build (e.g. in a "Developer Command Prompt for VS2013" window):
233 ```
234 cd LoaderAndTools  # cd to the root of the Vulkan git repository
235 update_external_sources.bat --build-glslang
236 mkdir build
237 cd build
238 cmake -G "Visual Studio 12 Win64" ..
239 ```
240
241 At this point, you can use Windows Explorer to launch Visual Studio by double-clicking on the "VULKAN.sln" file in the \build 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 "build" folder.
242
243 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.
244
245 To run VK programs you must tell the icd loader where to find the libraries.
246 This is described in a specification in the Khronos documentation Git
247 repository.  See the file:
248 https://gitlab.khronos.org/vulkan/vulkan/blob/master/ecosystem/WindowsICDs.txt
249
250 This specification describes both how ICDs and layers should be properly
251 packaged, and how developers can point to ICDs and layers within their builds.