| OLD | NEW |
| 1 # How GN handles cross-compiling | 1 # How GN handles cross-compiling |
| 2 | 2 |
| 3 ## As a GN user | 3 ## As a GN user |
| 4 | 4 |
| 5 GN has robust support for doing cross compiles and building things for | 5 GN has robust support for doing cross compiles and building things for |
| 6 multiple architectures in a single build (e.g., to build some things to | 6 multiple architectures in a single build (e.g., to build some things to |
| 7 run locally and some things to run on an embedded device). In fact, | 7 run locally and some things to run on an embedded device). In fact, |
| 8 there is no limit on the number of different architectures you can build | 8 there is no limit on the number of different architectures you can build |
| 9 at once; the Chromium build uses at least four in some configurations. | 9 at once; the Chromium build uses at least four in some configurations. |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 You can also refer to the `target_cpu` and `target_os` variables. This | 70 You can also refer to the `target_cpu` and `target_os` variables. This |
| 71 is useful if you need to do something different on the host depending on | 71 is useful if you need to do something different on the host depending on |
| 72 which target\_arch is requested; the values are constant across all | 72 which target\_arch is requested; the values are constant across all |
| 73 toolchains. You can do similar things for the `host_cpu` and `host_os` | 73 toolchains. You can do similar things for the `host_cpu` and `host_os` |
| 74 variables, but should generally never need to. | 74 variables, but should generally never need to. |
| 75 | 75 |
| 76 By default, dependencies listed in the `deps` variable of a rule use the | 76 By default, dependencies listed in the `deps` variable of a rule use the |
| 77 same (currently active) toolchain. You may specify a different toolchain | 77 same (currently active) toolchain. You may specify a different toolchain |
| 78 using the `foo(bar)` label notation as described in | 78 using the `foo(bar)` label notation as described in |
| 79 [GNLanguage#Labels](GNLanguage#Labels.md). | 79 [GNLanguage#Labels](language.md#Labels). |
| 80 | 80 |
| 81 ## As a //build/config or //build/toolchain author | 81 ## As a //build/config or //build/toolchain author |
| 82 | 82 |
| 83 As described in | 83 As described in |
| 84 [GNLanguage#Overall\_build\_flow](GNLanguage#Overall_build_flow.md), the | 84 [GNLanguage#Overall-build-flow](language.md#Overall-build-flow), the |
| 85 `default_toolchain` is declared in the //build/config/BUILDCONFIG.gn | 85 `default_toolchain` is declared in the `//build/config/BUILDCONFIG.gn` |
| 86 file. Usually the default\_toolchain should be the toolchain for the | 86 file. Usually the `default_toolchain` should be the toolchain for the |
| 87 target\_os and target\_cpu. The `current_toolchain` reflects the | 87 `target_os` and `target_cpu`. The `current_toolchain` reflects the |
| 88 toolchain that is currently in effect for a rule. | 88 toolchain that is currently in effect for a rule. |
| 89 | 89 |
| 90 Be sure you understand the differences between `host_cpu`, `target_cpu`, | 90 Be sure you understand the differences between `host_cpu`, `target_cpu`, |
| 91 `current_cpu`, and `toolchain_cpu` (and the os equivalents). The first | 91 `current_cpu`, and `toolchain_cpu` (and the os equivalents). The first |
| 92 two are set as described above. You are responsible for making sure that | 92 two are set as described above. You are responsible for making sure that |
| 93 `current_cpu` is set appropriately in your toolchain definitions; if you | 93 `current_cpu` is set appropriately in your toolchain definitions; if you |
| 94 are using the stock templates like `gcc_toolchain` and `msvc_toolchain`, | 94 are using the stock templates like `gcc_toolchain` and `msvc_toolchain`, |
| 95 that means you are responsible for making sure that `toolchain_cpu` and | 95 that means you are responsible for making sure that `toolchain_cpu` and |
| 96 `toolchain_os` are set as appropriate in the template invocations. | 96 `toolchain_os` are set as appropriate in the template invocations. |
| OLD | NEW |