Improved note layout.
[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 and layers (additional info below).  Additional Windows support will be coming in Q1'15.
4 Support for Android is TBD.
5
6 ##Linux System Requirements
7 Ubuntu 14.10 needed for DRI 3
8
9 ```
10 sudo apt-get install git subversion cmake libgl1-mesa-dev freeglut3-dev libglm-dev libpng12-dev libmagickwand-dev qt5-default
11 sudo apt-get build-dep mesa
12 ```
13 Warning: Recent versions of 14.10 have **REMOVED** DRI 3.  
14 Version: 2:2.99.914-1~exp1ubuntu4.1 is known to work.  
15 To see status of this package:
16 ```
17 dpkg -s xserver-xorg-video-intel
18 ```
19
20 Note:  
21 Version 2:2.99.914-1~exp1ubuntu4.2 does not work anymore.  
22 To install the working driver from launchpadlibrarian.net:  
23 1. Type in console (removes current driver):  
24 sudo apt-get purge xserver-xorg-video-intel  
25 2. Open in Firefox and allow file to open with software center (installs above driver):  
26 http://launchpadlibrarian.net/189418339/xserver-xorg-video-intel_2.99.914-1%7Eexp1ubuntu4.1_amd64.deb  
27 3. Either restart Ubuntu or just X11.  
28   
29 ##Linux Build
30
31 The sample driver uses cmake and should work with the usual cmake options and utilities.
32 The standard build process builds the icd, the icd loader and all the tests.
33
34 Example debug build:
35 ```
36 cd xgl  # cd to the root of the xgl git repository
37 export KHRONOS_ACCOUNT_NAME= <subversion login name for svn checkout of BIL>
38 ./update_external_sources.sh  # fetches and builds glslang, llvm, LunarGLASS, and BIL
39 cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
40 cd dbuild
41 make
42 ```
43
44 To run XGL programs you must tell the icd loader where to find the libraries. Set the
45 environment variable LIBXGL_DRIVERS_PATH to the driver path. For example:
46 ```
47 export LIBXGL_DRIVERS_PATH=$PWD/icd/intel
48 ```
49
50 To enable debug and validation layers with your XGL programs you must tell the icd loader
51 where to find the layer libraries. Set the environment variable LIBXGL_LAYERS_PATH to
52 the layer folder and indicate the layers you want loaded via LIBXGL_LAYER_NAMES.
53 For example, to enable the APIDump and DrawState layers, do:
54 ```
55 export LIBXGL_LAYERS_PATH=$PWD/layers
56 export LIBXGL_LAYER_NAMES=APIDump:DrawState
57 ```
58
59 ##Linux Test
60
61 The test executibles can be found in the dbuild/tests directory. The tests use the Google
62 gtest infrastructure. Tests available so far:
63 - xglinfo: Report GPU properties
64 - xglbase: Test basic entry points
65 - xgl_blit_tests: Test XGL Blits (copy, clear, and resolve)
66 - xgl_image_tests: Test XGL image related calls needed by render_test
67 - xgl_render_tests: Render a single triangle with XGL. Triangle will be in a .ppm in
68 the current directory at the end of the test.
69
70 ##Linux Demos
71
72 The demos executables can be found in the dbuild/demos directory. The demos use DRI 3
73 to render directly onto window surfaces.
74 - tri: a textured triangle
75 - cube: a textured spinning cube
76
77 ##Linux Render Nodes
78
79 The render tests depend on access to DRM render nodes.
80 To make that available, a couple of config files need to be created to set a module option
81 and make accessible device files.
82 The system will need to be rebooted with these files in place to complete initialization.
83 These commands will create the config files.
84
85 ```
86 sudo tee /etc/modprobe.d/drm.conf << EOF
87 # Enable render nodes
88 options drm rnodes=1
89 EOF
90 # this will add the rnodes=1 option into the boot environment
91 sudo update-initramfs -k all -u
92 ```
93 ```
94 sudo tee /etc/udev/rules.d/drm.rules << EOF
95 # Add permissions to render nodes
96 SUBSYSTEM=="drm", ACTION=="add", DEVPATH=="/devices/*/renderD*", MODE="020666"
97 EOF
98 ```
99
100 ##Windows System Requirements
101
102 Windows 7+ with additional, software:
103
104 - Microsoft Visual Studio 2013 Professional.  Note: it is possible that lesser/older versions may work, but that has not been tested.
105 - CMake (from https://www.python.org/downloads).  Note: Configure to add itself to the system PATH environment variable.
106 - Python 3 (from https://www.python.org/downloads).  Note: Configure to add itself to the system PATH environment variable.
107 - Cygwin (especially a BASH shell and git packages--from https://www.cygwin.com/).
108
109 ##Windows Build
110
111 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.
112
113 Example debug build:
114 ```
115 cd GL-Next  # cd to the root of the xgl git repository
116 mkdir _out64
117 cd _out64
118 cmake -G "Visual Studio 12 Win64" ..
119 ```
120
121 At this point, you can use Windows Explorer to launch Visual Studio by double-clicking on the "XGL.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.
122
123 To run XGL 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
124 environment variable LIBXGL_DRIVERS_PATH.  This environment variable cannot be set with Cygwin, but must be set via Windows, and may require a system restart in order for it to take effect.  Here is how to set this environment variable on a Windows 7 system:
125
126 - Launch Control Panel (e.g. Start->Control Panel)
127 - 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").
128 - This will launch a window with several tabs, one of which is "Advanced".  Click on the "Environment Variables..." button.
129 - For either "User variables" or "System variables" click "New...".
130 - Enter "LIBXGL_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).
131
132 It is possible to specify multiple icd folders.  Simply use a semi-colon (i.e. ";") to separate folders in the environment variable.
133
134 The icd loader searches in all of the folders for files that are named "XGL_*.dll" (e.g. "XGL_foo.dll").  It attempts to dynamically load these files, and look for appropriate functions.
135
136 To enable debug and validation layers with your XGL programs you must tell the icd loader
137 where to find the layer libraries, and which ones you desire to use.  The default folder for layers is C:\Windows\System32.  However, you can use the following environment variables to specify alternate locations, and to specify which layers to use:
138
139 - LIBXGL_LAYERS_PATH (semi-colon-delimited set of folders to look for layers)
140 - LIBXGL_LAYER_NAMES (color-delimited list of layer names)
141
142 For example, to enable the APIDump and DrawState layers, set:
143
144 - "LIBXGL_LAYERS_PATH" to "C:\Users\username\GL-Next\_out64\layers\Debug"
145 - "LIBXGL_LAYER_NAMES to "APIDump:DrawState"
146
147 The icd loader searches in all of the folders for files that are named "XGLLayer*.dll" (e.g. "XGLLayerParamChecker.dll").  It attempts to dynamically load these files, and look for appropriate functions.