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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 # the default toolchain. Pick the right one according to the current CPU | 511 # the default toolchain. Pick the right one according to the current CPU |
512 # architecture. | 512 # architecture. |
513 if (target_cpu == "x64") { | 513 if (target_cpu == "x64") { |
514 set_default_toolchain("//toolchains:64") | 514 set_default_toolchain("//toolchains:64") |
515 } else if (target_cpu == "x86") { | 515 } else if (target_cpu == "x86") { |
516 set_default_toolchain("//toolchains:32") | 516 set_default_toolchain("//toolchains:32") |
517 } | 517 } |
518 ``` | 518 ``` |
519 | 519 |
520 If a 64-bit target wants to depend on a 32-bit binary, it would specify | 520 If a 64-bit target wants to depend on a 32-bit binary, it would specify |
521 a dependency using `datadeps` (data deps are like deps that are only | 521 a dependency using `data_deps` (data deps are like deps that are only |
522 needed at runtime and aren't linked, since you can't link a 32-bit and a | 522 needed at runtime and aren't linked, since you can't link a 32-bit and a |
523 64-bit library). | 523 64-bit library). |
524 | 524 |
525 ``` | 525 ``` |
526 executable("my_program") { | 526 executable("my_program") { |
527 ... | 527 ... |
528 if (target_cpu == "x64") { | 528 if (target_cpu == "x64") { |
529 # The 64-bit build needs this 32-bit helper. | 529 # The 64-bit build needs this 32-bit helper. |
530 datadeps = [ ":helper(//toolchains:32)" ] | 530 data_deps = [ ":helper(//toolchains:32)" ] |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 if (target_cpu == "x86") { | 534 if (target_cpu == "x86") { |
535 # Our helper library is only compiled in 32-bits. | 535 # Our helper library is only compiled in 32-bits. |
536 shared_library("helper") { | 536 shared_library("helper") { |
537 ... | 537 ... |
538 } | 538 } |
539 } | 539 } |
540 ``` | 540 ``` |
(...skipping 184 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 |