OLD | NEW |
1 # GN Quick Start guide | 1 # GN Quick Start guide |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Running GN | 5 ## Running GN |
6 | 6 |
7 You just run `gn` from the command line. There is a script in | 7 You just run `gn` from the command line. There is a script in |
8 depot\_tools (which is presumably on your path) with this name. The | 8 depot\_tools (which is presumably on your path) with this name. The |
9 script will find the binary in the source tree containing the current | 9 script will find the binary in the source tree containing the current |
10 directory and run it. | 10 directory and run it. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 target_cpu = "arm" | 66 target_cpu = "arm" |
67 target_cpu = "x86" | 67 target_cpu = "x86" |
68 target_cpu = "x64" | 68 target_cpu = "x64" |
69 ``` | 69 ``` |
70 | 70 |
71 See [GNCrossCompiles](cross_compiles.md) for more info. | 71 See [GNCrossCompiles](cross_compiles.md) for more info. |
72 | 72 |
73 ## Configuring goma | 73 ## Configuring goma |
74 | 74 |
75 | |
76 Run `gn args out/Default` (substituting your build directory as needed). | 75 Run `gn args out/Default` (substituting your build directory as needed). |
77 Add: | 76 Add: |
78 | 77 |
79 ``` | 78 ``` |
80 use_goma = true | 79 use_goma = true |
81 goma_dir = "~/foo/bar/goma" | 80 goma_dir = "~/foo/bar/goma" |
82 ``` | 81 ``` |
83 | 82 |
84 If your goma is in the default location (`~/goma`) then you can omit the | 83 If your goma is in the default location (`~/goma`) then you can omit the |
85 `goma_dir` line. | 84 `goma_dir` line. |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 274 |
276 ``` | 275 ``` |
277 > ninja -C out/Default say_hello | 276 > ninja -C out/Default say_hello |
278 ninja: Entering directory 'out/Default' | 277 ninja: Entering directory 'out/Default' |
279 [1/1] Regenerating ninja files | 278 [1/1] Regenerating ninja files |
280 [4/4] LINK say_hello | 279 [4/4] LINK say_hello |
281 > out/Default/say_hello | 280 > out/Default/say_hello |
282 Hello, Bill and Joy. | 281 Hello, Bill and Joy. |
283 ``` | 282 ``` |
284 | 283 |
| 284 ## Add a new build argument |
| 285 |
| 286 You declare which arguments you accept and specify default values via |
| 287 `declare_args`. |
| 288 |
| 289 ``` |
| 290 declare_args() { |
| 291 enable_teleporter = true |
| 292 enable_doom_melon = false |
| 293 } |
| 294 ``` |
| 295 |
| 296 See `gn help buildargs` for an overview of how this works. |
| 297 See `gn help declare_args` for specifics on declaring them. |
| 298 |
| 299 It is an error to declare a given argument more than once in a given scope, so |
| 300 care should be used in scoping and naming arguments. |
| 301 |
285 ## Don't know what's going on? | 302 ## Don't know what's going on? |
286 | 303 |
287 You can run GN in verbose mode to see lots of messages about what it's | 304 You can run GN in verbose mode to see lots of messages about what it's |
288 doing. Use `-v` for this. | 305 doing. Use `-v` for this. |
289 | 306 |
290 ### Print debugging | 307 ### Print debugging |
291 | 308 |
292 There is a `print` command which just writes to stdout: | 309 There is a `print` command which just writes to stdout: |
293 | 310 |
294 ``` | 311 ``` |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 line flag. This will output a summary of timings for various things. | 357 line flag. This will output a summary of timings for various things. |
341 | 358 |
342 You can also make a trace of how the build files were executed: | 359 You can also make a trace of how the build files were executed: |
343 | 360 |
344 ``` | 361 ``` |
345 gn --tracelog=mylog.trace | 362 gn --tracelog=mylog.trace |
346 ``` | 363 ``` |
347 | 364 |
348 and you can load the resulting file in Chrome's `about:tracing` page to | 365 and you can load the resulting file in Chrome's `about:tracing` page to |
349 look at everything. | 366 look at everything. |
OLD | NEW |