|
GettingStartedOnMac
How to check out and build Skia on Mac OS X
How to check out and build Skia on Mac OS Xoriginally written by epoger@google.com on 25 May 2011 status: updated by epoger on 29 June 2011 PrerequisitesMake sure the following have been installed:
tar xzf libpng-1.5.1.tar.gz cd libpng-1.5.1 ./configure make check sudo make install Check out the source codeTo anonymously check out a read-only copy of the Skia source code, open a Terminal window and run the following commands: SKIA_INSTALLDIR=/Users/$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 XCode projectsWe use the open-source gyp tool to generate XCode projects (and analogous build scripts on other platforms) from our multiplatform "gyp" files. You would think that gyp would be able to create Makefiles that work on the Mac... but you'd be wrong. For now, you have to use gyp's XCode output to build on a Mac. You can generate the XCode projects 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 make examples shown below. Build and run tests from the command line(Like all "make" 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 in the XCode IDE
Build and run gm ("golden master") tests from the command lineThis will display the return value (0 = success) after running the tests... make gm out/Debug/gm -r gm/base ; 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 gm out/Debug/gm -r gm/base-MacPro-fixed ; echo $? Build and run bench (performance testbench) from the command lineIn this case, we will build with the "Release" configuration, since we are running performance tests... make bench BUILDTYPE=Release out/Release/bench -repeat 2 Build toolsNote that the tools don't get automatically copied into out/Debug by our "make" wrapper yet, so you have to go find the binary where XCode wrote it... make tools xcodebuild/Debug/skdiff.app/Contents/MacOS/skdiff Clean up all generated filesmake clean |