| OLD | NEW |
| 1 Building with Skia Tutorial | 1 Building with Skia Tutorial |
| 2 =========================== | 2 =========================== |
| 3 | 3 |
| 4 dsinclair@chromium.org | 4 dsinclair@chromium.org |
| 5 | 5 |
| 6 | 6 |
| 7 This document describes the steps used to create an application that uses Skia.
The assumptions are that you're using: | 7 This document describes the steps used to create an application that uses Skia.
The assumptions are that you're using: |
| 8 | 8 |
| 9 * [git](http://git-scm.com) | 9 * [git](http://git-scm.com) |
| 10 * [gclient](https://code.google.com/p/gclient/) | 10 * [gclient](https://code.google.com/p/gclient/) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 Create a src/DEPS file with the following: | 70 Create a src/DEPS file with the following: |
| 71 | 71 |
| 72 ~~~~ | 72 ~~~~ |
| 73 | 73 |
| 74 vars = { | 74 vars = { |
| 75 "skia_revision": "a6a8f00a3977e71dbce9da50a32c5e9a51c49285", | 75 "skia_revision": "a6a8f00a3977e71dbce9da50a32c5e9a51c49285", |
| 76 } | 76 } |
| 77 | 77 |
| 78 deps = { | 78 deps = { |
| 79 "src/third_party/skia/": | 79 "src/third_party/skia/": |
| 80 "http://skia.googlecode.com/skia.git@" + Var("skia_revision"), | 80 "http://skia.googlesource.com/skia.git@" + Var("skia_revision"), |
| 81 } | 81 } |
| 82 | 82 |
| 83 ~~~~ | 83 ~~~~ |
| 84 | 84 |
| 85 There are two sections to the `DEPS` file at the moment, `vars` and `deps`. | 85 There are two sections to the `DEPS` file at the moment, `vars` and `deps`. |
| 86 The `vars` sections defines variables we can use later in the file with the | 86 The `vars` sections defines variables we can use later in the file with the |
| 87 `Var()` accessor. In this case, we define our root directory, a shorter name | 87 `Var()` accessor. In this case, we define our root directory, a shorter name |
| 88 for any googlecode repositories and a specific revision of Skia that we're | 88 for any googlesource repositories and a specific revision of Skia that we're |
| 89 going to use. I've pinned to a specific version to insulate the application | 89 going to use. I've pinned to a specific version to insulate the application |
| 90 from changes in the Skia tree. This lets us know that when someone checks out | 90 from changes in the Skia tree. This lets us know that when someone checks out |
| 91 the repo they'll be using the same version of Skia that we've built and tested | 91 the repo they'll be using the same version of Skia that we've built and tested |
| 92 against. | 92 against. |
| 93 | 93 |
| 94 The `deps` section defines our dependencies. Currently we have one dependency | 94 The `deps` section defines our dependencies. Currently we have one dependency |
| 95 which we're going to checkout into the `src/third_party/skia` directory. | 95 which we're going to checkout into the `src/third_party/skia` directory. |
| 96 | 96 |
| 97 Once the deps file is created, commit and push it to the remote repository. | 97 Once the deps file is created, commit and push it to the remote repository. |
| 98 Once done, we can use gclient to checkout our dependencies. | 98 Once done, we can use gclient to checkout our dependencies. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 solutions = [ | 116 solutions = [ |
| 117 { "name" : "src", | 117 { "name" : "src", |
| 118 "url" : "https://bitbucket.org/dj2/usingskia.git", | 118 "url" : "https://bitbucket.org/dj2/usingskia.git", |
| 119 "deps_file" : "DEPS", | 119 "deps_file" : "DEPS", |
| 120 "managed" : True, | 120 "managed" : True, |
| 121 "custom_deps" : { | 121 "custom_deps" : { |
| 122 }, | 122 }, |
| 123 "safesync_url": "", | 123 "safesync_url": "", |
| 124 }, | 124 }, |
| 125 { "name" : "src/third_party/skia", | 125 { "name" : "src/third_party/skia", |
| 126 "url" : "http://skia.googlecode.com/skia.git@a6a8f00a3977e71dbce
9da50a32c5e9a51c49285", | 126 "url" : "http://skia.googlesource.com/skia.git@a6a8f00a3977e71db
ce9da50a32c5e9a51c49285", |
| 127 "deps_file" : "DEPS", | 127 "deps_file" : "DEPS", |
| 128 "managed" : True, | 128 "managed" : True, |
| 129 "custom_deps" : { | 129 "custom_deps" : { |
| 130 }, | 130 }, |
| 131 "safesync_url": "", | 131 "safesync_url": "", |
| 132 }, | 132 }, |
| 133 ] | 133 ] |
| 134 cache_dir = None | 134 cache_dir = None |
| 135 | 135 |
| 136 This is a little annoying at the moment since I've duplicated the repository | 136 This is a little annoying at the moment since I've duplicated the repository |
| 137 revision number in the `.gclient` file. I'm hoping to find a way to do this | 137 revision number in the `.gclient` file. I'm hoping to find a way to do this |
| 138 through the `DEPS` file, but until then, this seems to work. | 138 through the `DEPS` file, but until then, this seems to work. |
| 139 | 139 |
| 140 With that done, re-run `gclient sync` and you should see a whole lot more | 140 With that done, re-run `gclient sync` and you should see a whole lot more |
| 141 repositories being checked out. The | 141 repositories being checked out. The |
| 142 `src/third_party/skia/third_party/externals` directory should now be | 142 `src/third_party/skia/third_party/externals` directory should now be |
| 143 populated. | 143 populated. |
| 144 | 144 |
| 145 GYP | 145 GYP |
| 146 --- | 146 --- |
| 147 | 147 |
| 148 The final piece of infrastructure we need to set up is GYP. GYP is a build | 148 The final piece of infrastructure we need to set up is GYP. GYP is a build |
| 149 system generator, in this project we're going to have it build ninja | 149 system generator, in this project we're going to have it build ninja |
| 150 configuration files. | 150 configuration files. |
| 151 | 151 |
| 152 First, we need to add GYP to our project. We'll do that by adding a new entry | 152 First, we need to add GYP to our project. We'll do that by adding a new entry |
| 153 to the deps section of the `DEPS` file. | 153 to the deps section of the `DEPS` file. |
| 154 | 154 |
| 155 "src/tools/gyp": | 155 "src/tools/gyp": |
| 156 (Var("googlecode_url") % "gyp") + "/trunk@1700", | 156 (Var("googlesource_url") % "gyp") + "/trunk@1700", |
| 157 | 157 |
| 158 As you can see, I'm going to put the library into `src/tools/gyp` and checkout | 158 As you can see, I'm going to put the library into `src/tools/gyp` and checkout |
| 159 revision 1700 (note, the revision used here, 1700, was the head revision at | 159 revision 1700 (note, the revision used here, 1700, was the head revision at |
| 160 the time the `DEPS` file was written. You're probably safe to use the | 160 the time the `DEPS` file was written. You're probably safe to use the |
| 161 tip-of-tree revision in your `DEPS` file). A quick `gclient sync` and we | 161 tip-of-tree revision in your `DEPS` file). A quick `gclient sync` and we |
| 162 should have everything checked out. | 162 should have everything checked out. |
| 163 | 163 |
| 164 In order to run GYP we'll create a wrapper script. I've called this | 164 In order to run GYP we'll create a wrapper script. I've called this |
| 165 `src/build/gyp_using_skia`. | 165 `src/build/gyp_using_skia`. |
| 166 | 166 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 Now, we can run: | 274 Now, we can run: |
| 275 | 275 |
| 276 $ ./build/gyp_using_skia | 276 $ ./build/gyp_using_skia |
| 277 | 277 |
| 278 And, we get an error. Turns out, Skia is looking for a `find\_mac\_sdk.py` file
in | 278 And, we get an error. Turns out, Skia is looking for a `find\_mac\_sdk.py` file
in |
| 279 a relative tools directory which doesn't exist. Luckily, that's easy to fix | 279 a relative tools directory which doesn't exist. Luckily, that's easy to fix |
| 280 with another entry in our DEPS file. | 280 with another entry in our DEPS file. |
| 281 | 281 |
| 282 "src/tools/": | 282 "src/tools/": |
| 283 File((Var("googlecode_url") % "skia") + "/trunk/tools/find_mac_sdk.py@"
+ | 283 File((Var("googlesource_url") % "skia") + "/trunk/tools/find_mac_sdk.py@
" + |
| 284 Var("skia_revision")), | 284 Var("skia_revision")), |
| 285 | 285 |
| 286 Here we using the `File()` function of `gclient` to specify that we're checking | 286 Here we using the `File()` function of `gclient` to specify that we're checking |
| 287 out an individual file. Running `gclient sync` should pull the necessary file | 287 out an individual file. Running `gclient sync` should pull the necessary file |
| 288 into `src/tools`. | 288 into `src/tools`. |
| 289 | 289 |
| 290 With that, running `build/gyp\_using\_skia` should complete successfully. You | 290 With that, running `build/gyp\_using\_skia` should complete successfully. You |
| 291 should now have an `out/` directory with a `Debug/` and `Release/` directory ins
ide. | 291 should now have an `out/` directory with a `Debug/` and `Release/` directory ins
ide. |
| 292 These correspond to the configurations we specified in `using\_skia.gyp`. | 292 These correspond to the configurations we specified in `using\_skia.gyp`. |
| 293 | 293 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 310 { | 310 { |
| 311 # A change to a .gyp, .gypi or to GYP itself should run the generator. | 311 # A change to a .gyp, .gypi or to GYP itself should run the generator. |
| 312 "name": "gyp", | 312 "name": "gyp", |
| 313 "pattern": ".", | 313 "pattern": ".", |
| 314 "action": ["python", "src/build/gyp_using_skia"] | 314 "action": ["python", "src/build/gyp_using_skia"] |
| 315 } | 315 } |
| 316 ] | 316 ] |
| 317 | 317 |
| 318 Adding the above to the end of DEPS and running gclient sync should show the | 318 Adding the above to the end of DEPS and running gclient sync should show the |
| 319 GYP files being updated at the end of the sync procedure. | 319 GYP files being updated at the end of the sync procedure. |
| OLD | NEW |