| 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 30 matching lines...) Expand all Loading... |
| 272 # generally too different despite being based on the Linux kernel). | 276 # generally too different despite being based on the Linux kernel). |
| 273 # | 277 # |
| 274 # Do not add more is_* variants here for random lesser-used Unix systems like | 278 # Do not add more is_* variants here for random lesser-used Unix systems like |
| 275 # aix or one of the BSDs. If you need to check these, just check the | 279 # aix or one of the BSDs. If you need to check these, just check the |
| 276 # current_os value directly. | 280 # current_os value directly. |
| 277 | 281 |
| 278 if (current_os == "win" || current_os == "winrt_81" || | 282 if (current_os == "win" || current_os == "winrt_81" || |
| 279 current_os == "winrt_81_phone" || current_os == "winrt_10") { | 283 current_os == "winrt_81_phone" || current_os == "winrt_10") { |
| 280 is_android = false | 284 is_android = false |
| 281 is_chromeos = false | 285 is_chromeos = false |
| 286 is_fuchsia = false |
| 282 is_ios = false | 287 is_ios = false |
| 283 is_linux = false | 288 is_linux = false |
| 284 is_mac = false | 289 is_mac = false |
| 285 is_nacl = false | 290 is_nacl = false |
| 286 is_posix = false | 291 is_posix = false |
| 287 is_win = true | 292 is_win = true |
| 288 } else if (current_os == "mac") { | 293 } else if (current_os == "mac") { |
| 289 is_android = false | 294 is_android = false |
| 290 is_chromeos = false | 295 is_chromeos = false |
| 296 is_fuchsia = false |
| 291 is_ios = false | 297 is_ios = false |
| 292 is_linux = false | 298 is_linux = false |
| 293 is_mac = true | 299 is_mac = true |
| 294 is_nacl = false | 300 is_nacl = false |
| 295 is_posix = true | 301 is_posix = true |
| 296 is_win = false | 302 is_win = false |
| 297 } else if (current_os == "android") { | 303 } else if (current_os == "android") { |
| 298 is_android = true | 304 is_android = true |
| 299 is_chromeos = false | 305 is_chromeos = false |
| 306 is_fuchsia = false |
| 300 is_ios = false | 307 is_ios = false |
| 301 is_linux = false | 308 is_linux = false |
| 302 is_mac = false | 309 is_mac = false |
| 303 is_nacl = false | 310 is_nacl = false |
| 304 is_posix = true | 311 is_posix = true |
| 305 is_win = false | 312 is_win = false |
| 306 } else if (current_os == "chromeos") { | 313 } else if (current_os == "chromeos") { |
| 307 is_android = false | 314 is_android = false |
| 308 is_chromeos = true | 315 is_chromeos = true |
| 316 is_fuchsia = false |
| 309 is_ios = false | 317 is_ios = false |
| 310 is_linux = true | 318 is_linux = true |
| 311 is_mac = false | 319 is_mac = false |
| 312 is_nacl = false | 320 is_nacl = false |
| 313 is_posix = true | 321 is_posix = true |
| 314 is_win = false | 322 is_win = false |
| 315 } else if (current_os == "nacl") { | 323 } else if (current_os == "nacl") { |
| 316 # current_os == "nacl" will be passed by the nacl toolchain definition. | 324 # current_os == "nacl" will be passed by the nacl toolchain definition. |
| 317 # It is not set by default or on the command line. We treat is as a | 325 # It is not set by default or on the command line. We treat is as a |
| 318 # Posix variant. | 326 # Posix variant. |
| 319 is_android = false | 327 is_android = false |
| 320 is_chromeos = false | 328 is_chromeos = false |
| 329 is_fuchsia = false |
| 321 is_ios = false | 330 is_ios = false |
| 322 is_linux = false | 331 is_linux = false |
| 323 is_mac = false | 332 is_mac = false |
| 324 is_nacl = true | 333 is_nacl = true |
| 325 is_posix = true | 334 is_posix = true |
| 326 is_win = false | 335 is_win = false |
| 336 } else if (current_os == "fuchsia") { |
| 337 is_android = false |
| 338 is_chromeos = false |
| 339 is_fuchsia = true |
| 340 is_ios = false |
| 341 is_linux = false |
| 342 is_mac = false |
| 343 is_nacl = false |
| 344 is_posix = true |
| 345 is_win = false |
| 327 } else if (current_os == "ios") { | 346 } else if (current_os == "ios") { |
| 328 is_android = false | 347 is_android = false |
| 329 is_chromeos = false | 348 is_chromeos = false |
| 349 is_fuchsia = false |
| 330 is_ios = true | 350 is_ios = true |
| 331 is_linux = false | 351 is_linux = false |
| 332 is_mac = false | 352 is_mac = false |
| 333 is_nacl = false | 353 is_nacl = false |
| 334 is_posix = true | 354 is_posix = true |
| 335 is_win = false | 355 is_win = false |
| 336 } else if (current_os == "linux") { | 356 } else if (current_os == "linux") { |
| 337 is_android = false | 357 is_android = false |
| 338 is_chromeos = false | 358 is_chromeos = false |
| 359 is_fuchsia = false |
| 339 is_ios = false | 360 is_ios = false |
| 340 is_linux = true | 361 is_linux = true |
| 341 is_mac = false | 362 is_mac = false |
| 342 is_nacl = false | 363 is_nacl = false |
| 343 is_posix = true | 364 is_posix = true |
| 344 is_win = false | 365 is_win = false |
| 345 } | 366 } |
| 346 | 367 |
| 347 # ============================================================================= | 368 # ============================================================================= |
| 348 # SOURCES FILTERS | 369 # SOURCES FILTERS |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 set_defaults("component") { | 672 set_defaults("component") { |
| 652 if (is_component_build) { | 673 if (is_component_build) { |
| 653 configs = default_shared_library_configs | 674 configs = default_shared_library_configs |
| 654 if (is_android) { | 675 if (is_android) { |
| 655 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] | 676 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] |
| 656 } | 677 } |
| 657 } else { | 678 } else { |
| 658 configs = default_compiler_configs | 679 configs = default_compiler_configs |
| 659 } | 680 } |
| 660 } | 681 } |
| OLD | NEW |