| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 libraries is linked. In GN, there is a meta-target | 310 libraries is linked. In GN, there is a meta-target |
| 311 `//crypto:platform` that will "do the right thing" according to the | 311 `//crypto:platform` that will "do the right thing" according to the |
| 312 current build platform and flags. Generally its safe to replace any | 312 current build platform and flags. Generally its safe to replace any |
| 313 conditional reference to a SSL library with this one. | 313 conditional reference to a SSL library with this one. |
| 314 | 314 |
| 315 ## Visibility and header file issues | 315 ## Visibility and header file issues |
| 316 | 316 |
| 317 GN is much more strict about header file checking. You may encounter | 317 GN is much more strict about header file checking. You may encounter |
| 318 errors that your target doesn't depend on the target containing a | 318 errors that your target doesn't depend on the target containing a |
| 319 certain header file. The most common example is including | 319 certain header file. The most common example is including |
| 320 `base/basictypes.h` without having `//base` in your project's dependency | 320 `base/macros.h` without having `//base` in your project's dependency |
| 321 list. The solution is to just add the missing dependency. | 321 list. The solution is to just add the missing dependency. |
| 322 | 322 |
| 323 The dependency tree must be a DAG. Some components might share headers | 323 The dependency tree must be a DAG. Some components might share headers |
| 324 between a number of internal targets that makes adding the "proper" | 324 between a number of internal targets that makes adding the "proper" |
| 325 dependencies impossible. In this case, you can separate out a | 325 dependencies impossible. In this case, you can separate out a |
| 326 `source_set` type target containing just the header(s) in question, and | 326 `source_set` type target containing just the header(s) in question, and |
| 327 make the targets that use that header depend on that source set to break | 327 make the targets that use that header depend on that source set to break |
| 328 the cycle. | 328 the cycle. |
| 329 | 329 |
| 330 ## Other stuff | 330 ## Other stuff |
| (...skipping 311 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 |