blob: ac5deb1dbf17e61e99737584a006e83f6719b201 [file] [log] [blame] [view]
JensOwen95c62272014-11-01 13:05:43 -06001# Build Instructions
Ian Elliott40e7dd92015-02-05 12:22:51 -07002This project fully supports Linux today.
Ian Elliott40fb02f2015-03-06 11:37:07 -07003Support for Windows is for the loader, layers, and the Glave debugger (additional info below). Additional Windows support will be coming in Q1'15.
JensOwen95c62272014-11-01 13:05:43 -06004Support for Android is TBD.
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -06005
Courtney Goeltzenleuchter47469d92015-02-13 09:30:42 -07006##Git the Bits
7
8Make sure you have access to the Khronos Github repository. If not, send an email to
9jens@lunarg.com or courtney@lunarg.com and we can add you if you have a Khronos account.
10Also need to be sure that your Github account name is in your Khronos profile or the
11system will disable Github access. Once you have access to the Khronos Github repository,
12the preferred work flow is to fork that repo, commit work on to your fork and then issue a
13pull request to integrate that work into the Khronos repo. If that's too much, it's okay
14to clone the Khronos repository directly.
15
Ian Elliotta3d55012015-02-13 10:57:55 -070016Note: 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
Ian Elliott40e7dd92015-02-05 12:22:51 -070018##Linux System Requirements
Courtney Goeltzenleuchterfc82da62015-02-05 17:02:39 -070019Ubuntu 14.10 needed for DRI 3
Mike Stroyana768fc12014-10-30 15:59:54 -060020
JensOwenef271142014-11-01 13:11:50 -060021```
Chia-I Wub6263152015-02-25 11:52:31 -070022sudo apt-get install git subversion cmake libgl1-mesa-dev freeglut3-dev libglm-dev libpng12-dev libmagickwand-dev qt5-default libpciaccess-dev libpthread-stubs0-dev
Mike Stroyana768fc12014-10-30 15:59:54 -060023sudo apt-get build-dep mesa
JensOwenef271142014-11-01 13:11:50 -060024```
Courtney Goeltzenleuchterfc82da62015-02-05 17:02:39 -070025Warning: Recent versions of 14.10 have **REMOVED** DRI 3.
26Version: 2:2.99.914-1~exp1ubuntu4.1 is known to work.
27To see status of this package:
28```
29dpkg -s xserver-xorg-video-intel
30```
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060031
Norbert Nopper455f25d2015-02-06 20:57:52 +010032Note:
33Version 2:2.99.914-1~exp1ubuntu4.2 does not work anymore.
34To install the working driver from launchpadlibrarian.net:
Norbert Nopper36ccff72015-02-06 21:06:58 +010035- Remove the current driver:
36```
37sudo apt-get purge xserver-xorg-video-intel
38```
39- Download the old driver:
40```
41wget http://launchpadlibrarian.net/189418339/xserver-xorg-video-intel_2.99.914-1%7Eexp1ubuntu4.1_amd64.deb
42```
43- Install the driver:
44```
45sudo dpkg -i xserver-xorg-video-intel_2.99.914-1~exp1ubuntu4.1_amd64.deb
46```
Mike Stroyancd2ab472015-03-23 17:36:54 -060047- Pin the package to prevent updates
48```
49sudo 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
Norbert Nopper36ccff72015-02-06 21:06:58 +010052- Either restart Ubuntu or just X11.
Norbert Nopper455f25d2015-02-06 20:57:52 +010053
Courtney Goeltzenleuchter47469d92015-02-13 09:30:42 -070054## Clone the repository
55
56To create your local git repository:
57```
58mkdir YOUR_DEV_DIRECTORY # it's called GL-Next on Github, but the name doesn't matter
59cd YOUR_DEV_DIRECTORY
60git 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
Ian Elliott40e7dd92015-02-05 12:22:51 -070064##Linux Build
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060065
Mike Stroyana768fc12014-10-30 15:59:54 -060066The sample driver uses cmake and should work with the usual cmake options and utilities.
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060067The standard build process builds the icd, the icd loader and all the tests.
68
69Example debug build:
JensOwenef271142014-11-01 13:11:50 -060070```
Courtney Goeltzenleuchter47469d92015-02-13 09:30:42 -070071cd YOUR_DEV_DIRECTORY # cd to the root of the xgl git repository
Mike Stroyana768fc12014-10-30 15:59:54 -060072export KHRONOS_ACCOUNT_NAME= <subversion login name for svn checkout of BIL>
73./update_external_sources.sh # fetches and builds glslang, llvm, LunarGLASS, and BIL
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060074cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
75cd dbuild
76make
JensOwenef271142014-11-01 13:11:50 -060077```
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060078
79To run XGL programs you must tell the icd loader where to find the libraries. Set the
80environment variable LIBXGL_DRIVERS_PATH to the driver path. For example:
JensOwenef271142014-11-01 13:11:50 -060081```
Mike Stroyana768fc12014-10-30 15:59:54 -060082export LIBXGL_DRIVERS_PATH=$PWD/icd/intel
JensOwenef271142014-11-01 13:11:50 -060083```
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060084
Courtney Goeltzenleuchter39af8ef2015-01-06 17:32:22 -070085To enable debug and validation layers with your XGL programs you must tell the icd loader
86where to find the layer libraries. Set the environment variable LIBXGL_LAYERS_PATH to
87the layer folder and indicate the layers you want loaded via LIBXGL_LAYER_NAMES.
88For example, to enable the APIDump and DrawState layers, do:
89```
90export LIBXGL_LAYERS_PATH=$PWD/layers
91export LIBXGL_LAYER_NAMES=APIDump:DrawState
92```
93
Ian Elliott40e7dd92015-02-05 12:22:51 -070094##Linux Test
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060095
Mike Stroyana768fc12014-10-30 15:59:54 -060096The test executibles can be found in the dbuild/tests directory. The tests use the Google
Norbert Nopper9652dfd2015-01-22 20:52:34 +010097gtest infrastructure. Tests available so far:
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -060098- xglinfo: Report GPU properties
99- xglbase: Test basic entry points
Mike Stroyana768fc12014-10-30 15:59:54 -0600100- xgl_blit_tests: Test XGL Blits (copy, clear, and resolve)
Courtney Goeltzenleuchterb5fdda22014-09-01 18:05:45 -0600101- xgl_image_tests: Test XGL image related calls needed by render_test
102- xgl_render_tests: Render a single triangle with XGL. Triangle will be in a .ppm in
103the current directory at the end of the test.
Mike Stroyana768fc12014-10-30 15:59:54 -0600104
Ian Elliott40e7dd92015-02-05 12:22:51 -0700105##Linux Demos
Mike Stroyana768fc12014-10-30 15:59:54 -0600106
JensOwen95c62272014-11-01 13:05:43 -0600107The demos executables can be found in the dbuild/demos directory. The demos use DRI 3
Mike Stroyana768fc12014-10-30 15:59:54 -0600108to render directly onto window surfaces.
109- tri: a textured triangle
110- cube: a textured spinning cube
111
Ian Elliott40e7dd92015-02-05 12:22:51 -0700112##Linux Render Nodes
Mike Stroyana768fc12014-10-30 15:59:54 -0600113
114The render tests depend on access to DRM render nodes.
115To make that available, a couple of config files need to be created to set a module option
116and make accessible device files.
117The system will need to be rebooted with these files in place to complete initialization.
118These commands will create the config files.
119
JensOwenef271142014-11-01 13:11:50 -0600120```
Mike Stroyana768fc12014-10-30 15:59:54 -0600121sudo tee /etc/modprobe.d/drm.conf << EOF
JensOwenef271142014-11-01 13:11:50 -0600122# Enable render nodes
Mike Stroyana768fc12014-10-30 15:59:54 -0600123options drm rnodes=1
124EOF
Courtney Goeltzenleuchtera1099442015-01-07 17:46:53 -0700125# this will add the rnodes=1 option into the boot environment
126sudo update-initramfs -k all -u
JensOwen3ceb4752014-11-01 13:18:21 -0600127```
128```
Mike Stroyana768fc12014-10-30 15:59:54 -0600129sudo tee /etc/udev/rules.d/drm.rules << EOF
JensOwenef271142014-11-01 13:11:50 -0600130# Add permissions to render nodes
Mike Stroyana768fc12014-10-30 15:59:54 -0600131SUBSYSTEM=="drm", ACTION=="add", DEVPATH=="/devices/*/renderD*", MODE="020666"
132EOF
JensOwenef271142014-11-01 13:11:50 -0600133```
Ian Elliott40e7dd92015-02-05 12:22:51 -0700134
135##Windows System Requirements
136
137Windows 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.
Ian Elliott40fb02f2015-03-06 11:37:07 -0700140- 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.
Jon Ashburna7a2d972015-03-18 12:01:19 -0600145 - 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
Ian Elliott40fb02f2015-03-06 11:37:07 -0700146- Optional Packages:
147 - Qt 5.3 (from http://www.qt.io/download/). Notes:
148 - 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:
149 - While there are commercial licenses, you can also use the "Community" (free) license.
150 - 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).
151 - Installing Qt takes a long time.
152 - Cygwin (from https://www.cygwin.com/). Notes:
153 - Cygwin provides some Linux-like tools, which are valuable for obtaining the source code, and running CMake.
154 Especially valuable are the BASH shell and git packages.
155 - If you don't want to use Cygwin, there are other shells and environments that can be used.
156 You can also use a Git package that doesn't come from Cygwin.
157 - Git (from http://git-scm.com/download/win).
Ian Elliott40e7dd92015-02-05 12:22:51 -0700158
159##Windows Build
160
161Cygwin 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.
162
163Example debug build:
164```
165cd GL-Next # cd to the root of the xgl git repository
166mkdir _out64
167cd _out64
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700168cmake -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug ..
Ian Elliott40e7dd92015-02-05 12:22:51 -0700169```
170
171At 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.
172
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700173XGL programs must be able to find and use the XGL.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.
174
Ian Elliott40fb02f2015-03-06 11:37:07 -0700175To 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 registry and/or an environment variable:
Ian Elliott225188f2015-02-17 10:33:47 -0700176
177- Registry:
178 - Root Key: HKEY_LOCAL_MACHINE
Jon Ashburna7a2d972015-03-18 12:01:19 -0600179 - Key: "SOFTWARE\XGL"
Ian Elliott225188f2015-02-17 10:33:47 -0700180 - Value: "XGL_DRIVERS_PATH" (semi-colon-delimited set of folders to look for ICDs)
181- Environment Variable: "XGL_DRIVERS_PATH" (semi-colon-delimited set of folders to look for ICDs)
182
183Note: If both the registry value and environment variable are used, they are concatenated into a new semi-colon-delimited list of folders.
184
185Note: 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:
Ian Elliott40e7dd92015-02-05 12:22:51 -0700186
187- Launch Control Panel (e.g. Start->Control Panel)
188- 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").
189- This will launch a window with several tabs, one of which is "Advanced". Click on the "Environment Variables..." button.
190- For either "User variables" or "System variables" click "New...".
Ian Elliott225188f2015-02-17 10:33:47 -0700191- Enter "XGL_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).
Ian Elliott40e7dd92015-02-05 12:22:51 -0700192
193It is possible to specify multiple icd folders. Simply use a semi-colon (i.e. ";") to separate folders in the environment variable.
194
195The 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.
196
197To enable debug and validation layers with your XGL programs you must tell the icd loader
Ian Elliott225188f2015-02-17 10:33:47 -0700198where 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:
Ian Elliott40e7dd92015-02-05 12:22:51 -0700199
Ian Elliott225188f2015-02-17 10:33:47 -0700200- Registry:
201 - Root Key: HKEY_LOCAL_MACHINE
202 - Key: "System\XGL"
203 - Value: "XGL_LAYERS_PATH" (semi-colon-delimited set of folders to look for layers)
204 - Value: "XGL_LAYER_NAMES" (semi-colon-delimited list of layer names)
205- Environment Variables:
206 - "XGL_LAYERS_PATH" (semi-colon-delimited set of folders to look for layers)
207 - "XGL_LAYER_NAMES" (semi-colon-delimited list of layer names)
Ian Elliott40e7dd92015-02-05 12:22:51 -0700208
Ian Elliott225188f2015-02-17 10:33:47 -0700209Note: If both the registry value and environment variable are used, they are concatenated into a new semi-colon-delimited list.
Ian Elliott40e7dd92015-02-05 12:22:51 -0700210
211The 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.