• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Mac OS X
2========
3
4Quickstart
5----------
6
7First, install [XCode](https://developer.apple.com/xcode/).
8
9<!--?prettify lang=sh?-->
10
11    # Install depot tools.
12    git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
13    export PATH="${PWD}/depot_tools:${PATH}"
14
15    # Get Skia.
16    git clone 'https://skia.googlesource.com/skia'
17    cd skia
18
19    # Build.
20    bin/sync-and-gyp
21    ninja -C out/Debug
22
23    # Run DM (the Skia test app) and SampleApp.
24    out/Debug/dm
25    out/Debug/SampleApp
26
27Prerequisites
28-------------
29
30Make sure the following have been installed:
31
32  * XCode (Apple's development environment): required
33    * publicly available at http://developer.apple.com/xcode/
34    * add the optional Unix Tools to the install so you get the make command line tool.
35  * Chromium depot_tools: required to download the source and dependencies
36    * http://www.chromium.org/developers/how-tos/depottools
37
38Check out the source code
39-------------------------
40
41Follow the instructions [here](../download) for downloading the Skia source.
42
43Generate XCode projects
44-----------------------
45
46We use the open-source gyp tool to generate XCode projects (and analogous
47build scripts on other platforms) from our multiplatform "gyp" files.
48
49Two Gyp generators are used on Mac OS:
50
51*   `ninja` - Run ninja yourself, without XCode project files,
52
53*   `xcode` - Generate a XCode project
54
55To choose which ones to use, set the `GYP_GENERATORS` environment
56variable to a comma-delimited list of generators before running
57sync-and-gyp. The default value for `GYP_GENERATORS` is
58`ninja,xcode`.  For example to enable
59
60
61
62Before building, make sure that gyp knows to create an XCode project or ninja
63build files. If you leave GYP_GENERATORS undefined it will assume the
64following default:
65
66    GYP_GENERATORS="ninja,xcode"
67
68Or you can set it to `ninja` or `xcode` alone, if you like.
69
70You can then generate the Xcode projects and ninja build files by running:
71
72    python bin/sync-and-gyp
73
74Build and run tests from the command line
75-----------------------------------------
76
77    ninja -C out/Debug dm
78    out/Debug/dm
79
80
81Build and run SampleApp in the XCode IDE
82----------------------------------------
83
84  * Run `sync-and-gyp` as described above.
85  * In the Finder, navigate to `$SKIA_INSTALLDIR/trunk/out/gyp`
86  * Double-click SampleApp.xcodeproj ; this will launch XCode and open the SampleApp project
87  * Click the “Build and Run” button in the top toolbar
88  * Once the build is complete, you should see a window with lots of shaded text examples. To move through the sample app, use the following keypresses:
89    * right- and left-arrow keys: cycle through different test pages
90    * 'D' key: cycle through rendering methods for each test page
91    * other keys are defined in SampleApp.cpp’s SampleWindow::onHandleKey() and SampleWindow::onHandleChar() methods
92