My favorites | Sign in
Project Home Wiki Issues Source
Search
for
GettingStartedOnLinux  
How to check out and build Skia on Linux
Updated Jul 21, 2011 by epoger@google.com

How to check out and build Skia on Linux

originally written by epoger@google.com on 27 May 2011

status: updated by epoger on 29 June 2011

Prerequisites

Make sure the following have been installed:

Check out the source code

To anonymously check out a read-only copy of the Skia source code, run the following commands:

SKIA_INSTALLDIR=/home/$USER/src/skia    # or wherever you want to install it
mkdir -p $SKIA_INSTALLDIR
cd $SKIA_INSTALLDIR
svn checkout http://skia.googlecode.com/svn/trunk
cd trunk

If you plan to make changes, see instructions for downloading a writable copy within http://code.google.com/p/skia/wiki/DownloadingSkiaCode .

Generate makefiles

We use the open-source gyp tool to generate Unix makefiles (and analogous build scripts on other platforms) from our multiplatform "gyp" files.

You can generate the Unix makefiles by running ./gyp_skia (or ./gyp_skia -Dskia_scalar-fixed) within the trunk/ directory. Or, you can just rely on it being run automatically by the makefile examples shown below.

Build and run tests

(Like all steps shown on this page, this will automatically run the gyp_skia script to generate the platform-specific build files, and then run the build. Also, it must be run from within the trunk/ directory.)

make tests
out/Debug/tests

By default, the target is built in Debug mode (SK_DEBUG is defined, and debug symbols are included in the binary). If you would like to build the Release version instead:

make tests BUILDTYPE=Release
out/Release/tests

Build and run SampleApp

This time we will add the "-j" flag to fire up multiple threads during the build. (This can be used with the other targets too.)

make -j SampleApp
out/Debug/SampleApp

When this launches, you should see a window with various graphical examples. To move through the sample app, use the following keypresses:

  • right-arrow key: cycle through different test pages
  • left-arrow key: cycle through rendering methods for each test page
  • other keys are defined in SampleApp.cpp’s SampleWindow::onHandleKey() and SampleWindow::onHandleChar() methods

Build and run gm ("golden master") tests

This will display the return value (0 = success) after running the tests...

make -j gm
out/Debug/gm -r gm/base-linux ; echo $?

You can also adjust the type used to represent SkScalar. By default, we use a float. To change that, run it as follows:

GYP_DEFINES="skia_scalar=fixed" make -j gm
out/Debug/gm -r gm/base-linux-fixed ; echo $?

Build and run bench (performance testbench)

Since bench tests performance, it usually makes more sense to run it in Release mode...

make -j bench BUILDTYPE=Release
out/Release/bench -repeat 2

Build tools

make -j tools
out/Debug/skdiff

Clean up all generated files

make clean
Powered by Google Project Hosting