OLD | NEW |
1 # GN Language and Operation | 1 # GN Language and Operation |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Introduction | 5 ## Introduction |
6 | 6 |
7 This page describes many of the language details and behaviors. | 7 This page describes many of the language details and behaviors. |
8 | 8 |
9 ### Use the built-in help! | 9 ### Use the built-in help! |
10 | 10 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 # the default toolchain. Pick the right one according to the current CPU | 510 # the default toolchain. Pick the right one according to the current CPU |
511 # architecture. | 511 # architecture. |
512 if (target_cpu == "x64") { | 512 if (target_cpu == "x64") { |
513 set_default_toolchain("//toolchains:64") | 513 set_default_toolchain("//toolchains:64") |
514 } else if (target_cpu == "x86") { | 514 } else if (target_cpu == "x86") { |
515 set_default_toolchain("//toolchains:32") | 515 set_default_toolchain("//toolchains:32") |
516 } | 516 } |
517 ``` | 517 ``` |
518 | 518 |
519 If a 64-bit target wants to depend on a 32-bit binary, it would specify | 519 If a 64-bit target wants to depend on a 32-bit binary, it would specify |
520 a dependency using `datadeps` (data deps are like deps that are only | 520 a dependency using `data_deps` (data deps are like deps that are only |
521 needed at runtime and aren't linked, since you can't link a 32-bit and a | 521 needed at runtime and aren't linked, since you can't link a 32-bit and a |
522 64-bit library). | 522 64-bit library). |
523 | 523 |
524 ``` | 524 ``` |
525 executable("my_program") { | 525 executable("my_program") { |
526 ... | 526 ... |
527 if (target_cpu == "x64") { | 527 if (target_cpu == "x64") { |
528 # The 64-bit build needs this 32-bit helper. | 528 # The 64-bit build needs this 32-bit helper. |
529 datadeps = [ ":helper(//toolchains:32)" ] | 529 data_deps = [ ":helper(//toolchains:32)" ] |
530 } | 530 } |
531 } | 531 } |
532 | 532 |
533 if (target_cpu == "x86") { | 533 if (target_cpu == "x86") { |
534 # Our helper library is only compiled in 32-bits. | 534 # Our helper library is only compiled in 32-bits. |
535 shared_library("helper") { | 535 shared_library("helper") { |
536 ... | 536 ... |
537 } | 537 } |
538 } | 538 } |
539 ``` | 539 ``` |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 settings which work a bit differently in Blaze. This is partially to | 725 settings which work a bit differently in Blaze. This is partially to |
726 make conversion from the existing GYP code easier, and the GYP | 726 make conversion from the existing GYP code easier, and the GYP |
727 constructs generally offer more fine-grained control (which is either | 727 constructs generally offer more fine-grained control (which is either |
728 good or bad, depending on the situation). | 728 good or bad, depending on the situation). |
729 | 729 |
730 GN also uses GYP names like "sources" instead of "srcs" since | 730 GN also uses GYP names like "sources" instead of "srcs" since |
731 abbreviating this seems needlessly obscure, although it uses Blaze's | 731 abbreviating this seems needlessly obscure, although it uses Blaze's |
732 "deps" since "dependencies" is so hard to type. Chromium also compiles | 732 "deps" since "dependencies" is so hard to type. Chromium also compiles |
733 multiple languages in one target so specifying the language type on the | 733 multiple languages in one target so specifying the language type on the |
734 target name prefix was dropped (e.g. from `cc_library`). | 734 target name prefix was dropped (e.g. from `cc_library`). |
OLD | NEW |