OLD | NEW |
1 # GYP->GN Conversion Cookbook | 1 # GYP->GN Conversion Cookbook |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Targets | 5 ## Targets |
6 | 6 |
7 | *GYP* | *GN*
| | 7 | *GYP* | *GN*
| |
8 |:-------------------------------------------------|:---------------------------
------------------------| | 8 |:-------------------------------------------------|:---------------------------
------------------------| |
9 | `'type': 'static_library', 'name': 'foo',` | `static_library("foo") {` o
r `source_set("foo") {` | | 9 | `'type': 'static_library', 'name': 'foo',` | `static_library("foo") {` o
r `source_set("foo") {` | |
10 | `'type': 'shared_library', 'name': 'foo',` | `shared_library("foo") {`
| | 10 | `'type': 'shared_library', 'name': 'foo',` | `shared_library("foo") {`
| |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 'defines': [ | 431 'defines': [ |
432 'FOO', | 432 'FOO', |
433 ], | 433 ], |
434 }, | 434 }, |
435 ``` | 435 ``` |
436 | 436 |
437 Note that many of the includes are trying to add the root "src" | 437 Note that many of the includes are trying to add the root "src" |
438 directory to the include path. This is always present in GN so you can | 438 directory to the include path. This is always present in GN so you can |
439 remove these. | 439 remove these. |
440 | 440 |
441 GYP also requires you do duplicate these settings, once for the target | 441 GYP also requires you to duplicate these settings, once for the target |
442 itself, and once for the direct/all dependent settings. In GN, | 442 itself, and once for the direct/all dependent settings. In GN, |
443 public/all dependent configs also apply to the current target so you | 443 public/all dependent configs also apply to the current target so you |
444 only need to specify it once. | 444 only need to specify it once. |
445 | 445 |
446 In GN, put the settings in a config (declared above your target), and | 446 In GN, put the settings in a config (declared above your target), and |
447 then reference that as a public config in your target: | 447 then reference that as a public config in your target: |
448 | 448 |
449 ``` | 449 ``` |
450 config("foo_config") { | 450 config("foo_config") { |
451 include_dirs = [ "." ] | 451 include_dirs = [ "." ] |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 | 642 |
643 ``` | 643 ``` |
644 import("//mojo/public/tools/bindings/mojom.gni") | 644 import("//mojo/public/tools/bindings/mojom.gni") |
645 | 645 |
646 mojom("mojo_bindings") { | 646 mojom("mojo_bindings") { |
647 sources = [ | 647 sources = [ |
648 "foo.mojom", | 648 "foo.mojom", |
649 ] | 649 ] |
650 } | 650 } |
651 ``` | 651 ``` |
OLD | NEW |