| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # ============================================================================= | 5 # ============================================================================= |
| 6 # WHAT IS THIS FILE? | 6 # WHAT IS THIS FILE? |
| 7 # ============================================================================= | 7 # ============================================================================= |
| 8 # | 8 # |
| 9 # This is the master GN build configuration. This file is loaded after the | 9 # This is the master GN build configuration. This file is loaded after the |
| 10 # build args (args.gn) for the build directory and after the toplevel ".gn" | 10 # build args (args.gn) for the build directory and after the toplevel ".gn" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 # release (!is_debug). This might be better expressed as a tri-state | 128 # release (!is_debug). This might be better expressed as a tri-state |
| 129 # (debug, release, official) but for historical reasons there are two | 129 # (debug, release, official) but for historical reasons there are two |
| 130 # separate flags. | 130 # separate flags. |
| 131 is_official_build = false | 131 is_official_build = false |
| 132 | 132 |
| 133 # Whether we're a traditional desktop unix. | 133 # Whether we're a traditional desktop unix. |
| 134 is_desktop_linux = current_os == "linux" | 134 is_desktop_linux = current_os == "linux" |
| 135 | 135 |
| 136 # Set to true when compiling with the Clang compiler. Typically this is used | 136 # Set to true when compiling with the Clang compiler. Typically this is used |
| 137 # to configure warnings. | 137 # to configure warnings. |
| 138 is_clang = current_os == "mac" || current_os == "ios" || | 138 is_clang = |
| 139 current_os == "linux" || current_os == "chromeos" | 139 current_os == "mac" || current_os == "ios" || current_os == "linux" || |
| 140 current_os == "chromeos" || current_os == "fuchsia" |
| 140 | 141 |
| 141 # Allows the path to a custom target toolchain to be injected as a single | 142 # Allows the path to a custom target toolchain to be injected as a single |
| 142 # argument, and set as the default toolchain. | 143 # argument, and set as the default toolchain. |
| 143 custom_toolchain = "" | 144 custom_toolchain = "" |
| 144 | 145 |
| 145 # This should not normally be set as a build argument. It's here so that | 146 # This should not normally be set as a build argument. It's here so that |
| 146 # every toolchain can pass through the "global" value via toolchain_args(). | 147 # every toolchain can pass through the "global" value via toolchain_args(). |
| 147 host_toolchain = "" | 148 host_toolchain = "" |
| 148 | 149 |
| 149 # DON'T ADD MORE FLAGS HERE. Read the comment above. | 150 # DON'T ADD MORE FLAGS HERE. Read the comment above. |
| 150 } | 151 } |
| 151 | 152 |
| 152 declare_args() { | 153 declare_args() { |
| 153 # Debug build. Enabling official builds automatically sets is_debug to false. | 154 # Debug build. Enabling official builds automatically sets is_debug to false. |
| 154 is_debug = !is_official_build | 155 is_debug = !is_official_build |
| 155 } | 156 } |
| 156 | 157 |
| 157 declare_args() { | 158 declare_args() { |
| 158 # Component build. Setting to true compiles targets declared as "components" | 159 # Component build. Setting to true compiles targets declared as "components" |
| 159 # as shared libraries loaded dynamically. This speeds up development time. | 160 # as shared libraries loaded dynamically. This speeds up development time. |
| 160 # When false, components will be linked statically. | 161 # When false, components will be linked statically. |
| 161 # | 162 # |
| 162 # For more information see | 163 # For more information see |
| 163 # https://chromium.googlesource.com/chromium/src/+/master/docs/component_build
.md | 164 # https://chromium.googlesource.com/chromium/src/+/master/docs/component_build
.md |
| 164 is_component_build = is_debug && current_os != "ios" | 165 is_component_build = |
| 166 is_debug && current_os != "ios" && current_os != "fuchsia" |
| 165 } | 167 } |
| 166 | 168 |
| 167 assert(!(is_debug && is_official_build), "Can't do official debug builds") | 169 assert(!(is_debug && is_official_build), "Can't do official debug builds") |
| 168 | 170 |
| 169 # ============================================================================== | 171 # ============================================================================== |
| 170 # TOOLCHAIN SETUP | 172 # TOOLCHAIN SETUP |
| 171 # ============================================================================== | 173 # ============================================================================== |
| 172 # | 174 # |
| 173 # Here we set the default toolchain, as well as the variable host_toolchain | 175 # Here we set the default toolchain, as well as the variable host_toolchain |
| 174 # which will identify the toolchain corresponding to the local system when | 176 # which will identify the toolchain corresponding to the local system when |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } else { | 224 } else { |
| 223 _default_toolchain = "//build/toolchain/android:android_$target_cpu" | 225 _default_toolchain = "//build/toolchain/android:android_$target_cpu" |
| 224 } | 226 } |
| 225 } else if (target_os == "chromeos" || target_os == "linux") { | 227 } else if (target_os == "chromeos" || target_os == "linux") { |
| 226 # See comments in build/toolchain/cros/BUILD.gn about board compiles. | 228 # See comments in build/toolchain/cros/BUILD.gn about board compiles. |
| 227 if (is_clang) { | 229 if (is_clang) { |
| 228 _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" | 230 _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" |
| 229 } else { | 231 } else { |
| 230 _default_toolchain = "//build/toolchain/linux:$target_cpu" | 232 _default_toolchain = "//build/toolchain/linux:$target_cpu" |
| 231 } | 233 } |
| 234 } else if (target_os == "fuchsia") { |
| 235 _default_toolchain = "//build/toolchain/fuchsia:$target_cpu" |
| 232 } else if (target_os == "ios") { | 236 } else if (target_os == "ios") { |
| 233 _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" | 237 _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" |
| 234 } else if (target_os == "mac") { | 238 } else if (target_os == "mac") { |
| 235 assert(host_os == "mac", "Mac cross-compiles are unsupported.") | 239 assert(host_os == "mac", "Mac cross-compiles are unsupported.") |
| 236 _default_toolchain = host_toolchain | 240 _default_toolchain = host_toolchain |
| 237 } else if (target_os == "win") { | 241 } else if (target_os == "win") { |
| 238 # On Windows we use the same toolchain for host and target by default. | 242 # On Windows we use the same toolchain for host and target by default. |
| 239 assert(target_os == host_os, "Win cross-compiles only work on win hosts.") | 243 assert(target_os == host_os, "Win cross-compiles only work on win hosts.") |
| 240 if (is_clang) { | 244 if (is_clang) { |
| 241 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" | 245 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 # It is not set by default or on the command line. We treat is as a | 321 # It is not set by default or on the command line. We treat is as a |
| 318 # Posix variant. | 322 # Posix variant. |
| 319 is_android = false | 323 is_android = false |
| 320 is_chromeos = false | 324 is_chromeos = false |
| 321 is_ios = false | 325 is_ios = false |
| 322 is_linux = false | 326 is_linux = false |
| 323 is_mac = false | 327 is_mac = false |
| 324 is_nacl = true | 328 is_nacl = true |
| 325 is_posix = true | 329 is_posix = true |
| 326 is_win = false | 330 is_win = false |
| 331 } else if (current_os == "fuchsia") { |
| 332 is_android = false |
| 333 is_chromeos = false |
| 334 is_ios = false |
| 335 is_linux = false |
| 336 is_mac = false |
| 337 is_nacl = false |
| 338 is_posix = false |
| 339 is_win = false |
| 327 } else if (current_os == "ios") { | 340 } else if (current_os == "ios") { |
| 328 is_android = false | 341 is_android = false |
| 329 is_chromeos = false | 342 is_chromeos = false |
| 330 is_ios = true | 343 is_ios = true |
| 331 is_linux = false | 344 is_linux = false |
| 332 is_mac = false | 345 is_mac = false |
| 333 is_nacl = false | 346 is_nacl = false |
| 334 is_posix = true | 347 is_posix = true |
| 335 is_win = false | 348 is_win = false |
| 336 } else if (current_os == "linux") { | 349 } else if (current_os == "linux") { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 set_defaults("component") { | 664 set_defaults("component") { |
| 652 if (is_component_build) { | 665 if (is_component_build) { |
| 653 configs = default_shared_library_configs | 666 configs = default_shared_library_configs |
| 654 if (is_android) { | 667 if (is_android) { |
| 655 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] | 668 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] |
| 656 } | 669 } |
| 657 } else { | 670 } else { |
| 658 configs = default_compiler_configs | 671 configs = default_compiler_configs |
| 659 } | 672 } |
| 660 } | 673 } |
| OLD | NEW |