1 Linux 2 ===== 3 4 Quickstart 5 ---------- 6 7 1. Install depot tools. 8 9 <!--?prettify lang=sh?--> 10 11 git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' 12 export PATH="${PWD}/depot_tools:${PATH}" 13 14 2. Get Skia. 15 16 <!--?prettify lang=sh?--> 17 18 git clone 'https://skia.googlesource.com/skia' 19 cd skia 20 21 3. Install Dependencies (may require sudo). 22 23 <!--?prettify lang=sh?--> 24 25 tools/install_dependencies.sh 26 27 4. Build. 28 29 <!--?prettify lang=sh?--> 30 31 bin/sync-and-gyp && ninja -C out/Debug 32 33 5. Run DM (the Skia test app) and SampleApp. 34 35 <!--?prettify lang=sh?--> 36 37 out/Debug/dm 38 out/Debug/SampleApp 39 40 Prerequisites 41 ------------- 42 43 On a Ubuntu 12.04 (Precise) or Ubuntu 14.04 (Trusty) system, you can run 44 `tools/install_dependencies.sh`, which will install the needed packages. On 45 Ubuntu 12.04, you will need to install the`ninja` build tool separately, which 46 comes with Chromium's `depot_tools`. 47 48 To contribute changes back to Skia, you will need `git-cl`, which comes with Chromium's `depot_tools`. 49 50 (If you use another Linux distribution, please consider contributing back 51 instructions for installing the required packages we can then incorporate 52 that knowledge into the `tools/install_dependencies.sh` tool.) 53 54 Make sure the following have been installed: 55 56 * Chromium depot_tools: http://www.chromium.org/developers/how-tos/depottools 57 * A C++ compiler (typically gcc) 58 * python 2.7.x 59 * suggested Ubuntu packages: python2.7, python2.7-dev 60 * The FreeType and Fontconfig font engines 61 * suggested Ubuntu packages: libfreetype6, libfreetype6-dev , libfontconfig , libfontconfig-dev e.g., `sudo apt-get install libfreetype6 libfreetype6-dev libfontconfig libfontconfig-dev` 62 * libpng 63 * suggested Ubuntu packages: libpng12-0, libpng12-dev e.g., `sudo apt-get install libpng12-0 libpng12-dev` 64 * libgif 65 * suggested Ubuntu package: libgif-dev e.g., `sudo apt-get install libgif-dev` 66 * `$ sudo apt-get install libgif4:i386` 67 * `$ sudo ln -s /usr/lib/i386-linux-gnu/libgif.so.4 /usr/lib/i386-linux-gnu/libgif.so` 68 * libglu1-mesa-dev 69 * mesa-common-dev 70 * GL 71 * such as freeglut3-dev 72 73 Check out the source code 74 ------------------------- 75 76 Follow the instructions [here](../download) for downloading the Skia source. 77 78 79 Generate build files 80 -------------------- 81 82 We use the open-source gyp tool to generate ninja files (and analogous build 83 scripts on other platforms) from our multiplatform "gyp" files. 84 85 Generate the build files by running the following in your Skia home directory: 86 87 ./gyp_skia 88 89 Or, you can just rely on it being run automatically by using `make` instead of 90 `ninja` in examples shown below. 91 92 If you want to use Eclipse, see Creating an Eclipse Project after you have generated the makefiles. 93 94 On 32-bit Linux (when `uname -m` is *not* `x86_64`), you will have to 95 explicitly specify the architecture: 96 97 GYP_DEFINES='skia_arch_width=32' ./gyp_skia 98 99 Build and run tests from the command line 100 ----------------------------------------- 101 102 ninja -C out/Debug dm 103 out/Debug/dm 104 105 The usual mode you want for testing is Debug mode (`SK_DEBUG` is defined, and 106 debug symbols are included in the binary). If you would like to build the 107 108 Release version instead 109 ----------------------- 110 111 ninja -C out/Release dm 112 out/Release/dm 113 114 Build and run nanobench (performance tests) 115 ------------------------------------------- 116 117 In this case, we will build with the "Release" configuration, since we are 118 running performance tests. 119 120 ninja -C out/Release nanobench 121 out/Release/nanobench [ --skps path/to/*.skp ] 122 123 Build and run SampleApp 124 ----------------------- 125 126 This time we will add the `-j` flag to fire up multiple threads during the 127 build. (This can be used with the other targets too.) 128 129 make -j SampleApp 130 out/Debug/SampleApp 131 132 When this launches, you should see a window with various graphical examples. 133 To move through the sample app, use the following keypresses: 134 135 * right-arrow key: cycle through different test pages 136 * left-arrow key: cycle through rendering methods for each test page 137 * other keys are defined in SampleApp.cpps SampleWindow::onHandleKey() and SampleWindow::onHandleChar() methods 138 139 Build and run gm ("golden master") tests 140 ---------------------------------------- 141 142 This will display the return value (0 = success) after running the tests... 143 144 make -j gm 145 out/Debug/gm -r gm/base-linux ; echo $? 146 147 You can also adjust the type used to represent SkScalar. By default, we use a 148 float. To change that, run it as follows: 149 150 GYP_DEFINES="skia_scalar=fixed" make -j gm 151 out/Debug/gm -r gm/base-linux-fixed ; echo $? 152 153 Build and run bench (performance testbench) 154 ------------------------------------------- 155 156 Since bench tests performance, it usually makes more sense to run it in 157 Release mode... 158 159 make -j bench BUILDTYPE=Release 160 out/Release/bench 161 162 Build tools 163 ----------- 164 165 make -j tools 166 out/Debug/skdiff 167 168 Clean up all generated files 169 ---------------------------- 170 171 make clean 172