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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 if (current_cpu == "") { | 65 if (current_cpu == "") { |
66 current_cpu = target_cpu | 66 current_cpu = target_cpu |
67 } | 67 } |
68 if (current_os == "") { | 68 if (current_os == "") { |
69 current_os = target_os | 69 current_os = target_os |
70 } | 70 } |
71 | 71 |
| 72 # Checks whether we are running on a Power or z System. |
| 73 # This is used many times in multiple files and the four parts |
| 74 # of the clause almost always go together. |
| 75 # Creating a helper variable vastly improves readability. |
| 76 is_power_or_z = current_cpu == "s390x" || current_cpu == "s390" || |
| 77 current_cpu == "ppc64" || current_cpu == "ppc" |
| 78 |
72 # ============================================================================= | 79 # ============================================================================= |
73 # BUILD FLAGS | 80 # BUILD FLAGS |
74 # ============================================================================= | 81 # ============================================================================= |
75 # | 82 # |
76 # This block lists input arguments to the build, along with their default | 83 # This block lists input arguments to the build, along with their default |
77 # values. | 84 # values. |
78 # | 85 # |
79 # If a value is specified on the command line, it will overwrite the defaults | 86 # If a value is specified on the command line, it will overwrite the defaults |
80 # given in a declare_args block, otherwise the default will be used. | 87 # given in a declare_args block, otherwise the default will be used. |
81 # | 88 # |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 # release (!is_debug). This might be better expressed as a tri-state | 135 # release (!is_debug). This might be better expressed as a tri-state |
129 # (debug, release, official) but for historical reasons there are two | 136 # (debug, release, official) but for historical reasons there are two |
130 # separate flags. | 137 # separate flags. |
131 is_official_build = false | 138 is_official_build = false |
132 | 139 |
133 # Whether we're a traditional desktop unix. | 140 # Whether we're a traditional desktop unix. |
134 is_desktop_linux = current_os == "linux" | 141 is_desktop_linux = current_os == "linux" |
135 | 142 |
136 # Set to true when compiling with the Clang compiler. Typically this is used | 143 # Set to true when compiling with the Clang compiler. Typically this is used |
137 # to configure warnings. | 144 # to configure warnings. |
138 is_clang = current_os == "mac" || current_os == "ios" || | 145 is_clang = |
139 current_os == "linux" || current_os == "chromeos" | 146 current_os == "mac" || current_os == "ios" || current_os == "chromeos" || |
| 147 (current_os == "linux" && !is_power_or_z) |
140 | 148 |
141 # Allows the path to a custom target toolchain to be injected as a single | 149 # Allows the path to a custom target toolchain to be injected as a single |
142 # argument, and set as the default toolchain. | 150 # argument, and set as the default toolchain. |
143 custom_toolchain = "" | 151 custom_toolchain = "" |
144 | 152 |
145 # This should not normally be set as a build argument. It's here so that | 153 # 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(). | 154 # every toolchain can pass through the "global" value via toolchain_args(). |
147 host_toolchain = "" | 155 host_toolchain = "" |
148 | 156 |
149 # DON'T ADD MORE FLAGS HERE. Read the comment above. | 157 # DON'T ADD MORE FLAGS HERE. Read the comment above. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } else if (host_os == "mac") { | 208 } else if (host_os == "mac") { |
201 host_toolchain = "//build/toolchain/mac:clang_$host_cpu" | 209 host_toolchain = "//build/toolchain/mac:clang_$host_cpu" |
202 } else if (host_os == "win") { | 210 } else if (host_os == "win") { |
203 # On Windows always use the target CPU for host builds. On the | 211 # On Windows always use the target CPU for host builds. On the |
204 # configurations we support this will always work and it saves build steps. | 212 # configurations we support this will always work and it saves build steps. |
205 if (is_clang) { | 213 if (is_clang) { |
206 host_toolchain = "//build/toolchain/win:clang_$target_cpu" | 214 host_toolchain = "//build/toolchain/win:clang_$target_cpu" |
207 } else { | 215 } else { |
208 host_toolchain = "//build/toolchain/win:$target_cpu" | 216 host_toolchain = "//build/toolchain/win:$target_cpu" |
209 } | 217 } |
| 218 } else if (host_os == "aix") { |
| 219 host_toolchain = "//build/toolchain/aix:$host_cpu" |
210 } else { | 220 } else { |
211 assert(false, "Unsupported host_os: $host_os") | 221 assert(false, "Unsupported host_os: $host_os") |
212 } | 222 } |
213 } | 223 } |
214 | 224 |
215 _default_toolchain = "" | 225 _default_toolchain = "" |
216 | 226 |
217 if (target_os == "android") { | 227 if (target_os == "android") { |
218 assert(host_os == "linux" || host_os == "mac", | 228 assert(host_os == "linux" || host_os == "mac", |
219 "Android builds are only supported on Linux and Mac hosts.") | 229 "Android builds are only supported on Linux and Mac hosts.") |
(...skipping 15 matching lines...) Expand all Loading... |
235 assert(host_os == "mac", "Mac cross-compiles are unsupported.") | 245 assert(host_os == "mac", "Mac cross-compiles are unsupported.") |
236 _default_toolchain = host_toolchain | 246 _default_toolchain = host_toolchain |
237 } else if (target_os == "win") { | 247 } else if (target_os == "win") { |
238 # On Windows we use the same toolchain for host and target by default. | 248 # 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.") | 249 assert(target_os == host_os, "Win cross-compiles only work on win hosts.") |
240 if (is_clang) { | 250 if (is_clang) { |
241 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" | 251 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" |
242 } else { | 252 } else { |
243 _default_toolchain = "//build/toolchain/win:$target_cpu" | 253 _default_toolchain = "//build/toolchain/win:$target_cpu" |
244 } | 254 } |
| 255 } else if (target_os == "aix") { |
| 256 _default_toolchain = "//build/toolchain/aix:$target_cpu" |
245 } else if (target_os == "winrt_81" || target_os == "winrt_81_phone" || | 257 } else if (target_os == "winrt_81" || target_os == "winrt_81_phone" || |
246 target_os == "winrt_10") { | 258 target_os == "winrt_10") { |
247 _default_toolchain = "//build/toolchain/win:winrt_$target_cpu" | 259 _default_toolchain = "//build/toolchain/win:winrt_$target_cpu" |
248 } else { | 260 } else { |
249 assert(false, "Unsupported target_os: $target_os") | 261 assert(false, "Unsupported target_os: $target_os") |
250 } | 262 } |
251 | 263 |
252 # If a custom toolchain has been set in the args, set it as default. Otherwise, | 264 # If a custom toolchain has been set in the args, set it as default. Otherwise, |
253 # set the default toolchain for the platform (if any). | 265 # set the default toolchain for the platform (if any). |
254 if (custom_toolchain != "") { | 266 if (custom_toolchain != "") { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 is_win = false | 347 is_win = false |
336 } else if (current_os == "linux") { | 348 } else if (current_os == "linux") { |
337 is_android = false | 349 is_android = false |
338 is_chromeos = false | 350 is_chromeos = false |
339 is_ios = false | 351 is_ios = false |
340 is_linux = true | 352 is_linux = true |
341 is_mac = false | 353 is_mac = false |
342 is_nacl = false | 354 is_nacl = false |
343 is_posix = true | 355 is_posix = true |
344 is_win = false | 356 is_win = false |
| 357 } else if (current_os == "aix") { |
| 358 is_android = false |
| 359 is_chromeos = false |
| 360 is_ios = false |
| 361 is_linux = false |
| 362 is_mac = false |
| 363 is_nacl = false |
| 364 is_posix = true |
| 365 is_win = false |
345 } | 366 } |
346 | 367 |
347 # ============================================================================= | 368 # ============================================================================= |
348 # SOURCES FILTERS | 369 # SOURCES FILTERS |
349 # ============================================================================= | 370 # ============================================================================= |
350 # | 371 # |
351 # These patterns filter out platform-specific files when assigning to the | 372 # These patterns filter out platform-specific files when assigning to the |
352 # sources variable. The magic variable |sources_assignment_filter| is applied | 373 # sources variable. The magic variable |sources_assignment_filter| is applied |
353 # to each assignment or appending to the sources variable and matches are | 374 # to each assignment or appending to the sources variable and matches are |
354 # automatically removed. | 375 # automatically removed. |
355 # | 376 # |
356 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path | 377 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path |
357 # boundary = end of string or slash) are supported, and the entire string | 378 # boundary = end of string or slash) are supported, and the entire string |
358 # must match the pattern (so you need "*.cc" to match all .cc files, for | 379 # must match the pattern (so you need "*.cc" to match all .cc files, for |
359 # example). | 380 # example). |
360 | 381 |
361 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call | 382 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call |
362 # below. | 383 # below. |
363 sources_assignment_filter = [] | 384 sources_assignment_filter = [] |
364 if (!is_posix) { | 385 if (!is_posix) { |
365 sources_assignment_filter += [ | 386 sources_assignment_filter += [ |
366 "*_posix.h", | 387 "*_posix.h", |
367 "*_posix.cc", | 388 "*_posix.cc", |
368 "*_posix_unittest.h", | 389 "*_posix_unittest.h", |
369 "*_posix_unittest.cc", | 390 "*_posix_unittest.cc", |
370 "*\bposix/*", | 391 "*\bposix/*", |
371 ] | 392 ] |
372 } | 393 } |
| 394 |
373 if (!is_win) { | 395 if (!is_win) { |
374 sources_assignment_filter += [ | 396 sources_assignment_filter += [ |
375 "*_win.cc", | 397 "*_win.cc", |
376 "*_win.h", | 398 "*_win.h", |
377 "*_win_unittest.cc", | 399 "*_win_unittest.cc", |
378 "*\bwin/*", | 400 "*\bwin/*", |
379 "*.def", | 401 "*.def", |
380 "*.rc", | 402 "*.rc", |
381 ] | 403 ] |
382 } | 404 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 "//build/config/win:nominmax", | 513 "//build/config/win:nominmax", |
492 "//build/config/win:unicode", | 514 "//build/config/win:unicode", |
493 "//build/config/win:winver", | 515 "//build/config/win:winver", |
494 "//build/config/win:vs_code_analysis", | 516 "//build/config/win:vs_code_analysis", |
495 ] | 517 ] |
496 } | 518 } |
497 if (current_os == "winrt_81" || current_os == "winrt_81_phone" || | 519 if (current_os == "winrt_81" || current_os == "winrt_81_phone" || |
498 current_os == "winrt_10") { | 520 current_os == "winrt_10") { |
499 default_compiler_configs += [ "//build/config/win:target_winrt" ] | 521 default_compiler_configs += [ "//build/config/win:target_winrt" ] |
500 } | 522 } |
| 523 |
501 if (is_posix) { | 524 if (is_posix) { |
502 default_compiler_configs += [ | 525 default_compiler_configs += [ "//build/config/gcc:no_exceptions" ] |
503 "//build/config/gcc:no_exceptions", | 526 if (current_os != "aix") { |
504 "//build/config/gcc:symbol_visibility_hidden", | 527 default_compiler_configs += |
505 ] | 528 [ "//build/config/gcc:symbol_visibility_hidden" ] |
| 529 } |
506 } | 530 } |
507 | 531 |
508 if (is_android) { | 532 if (is_android) { |
509 default_compiler_configs += | 533 default_compiler_configs += |
510 [ "//build/config/android:default_cygprofile_instrumentation" ] | 534 [ "//build/config/android:default_cygprofile_instrumentation" ] |
511 } | 535 } |
512 | 536 |
513 if (is_clang && !is_nacl) { | 537 if (is_clang && !is_nacl) { |
514 default_compiler_configs += [ | 538 default_compiler_configs += [ |
515 "//build/config/clang:find_bad_constructs", | 539 "//build/config/clang:find_bad_constructs", |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 set_defaults("component") { | 675 set_defaults("component") { |
652 if (is_component_build) { | 676 if (is_component_build) { |
653 configs = default_shared_library_configs | 677 configs = default_shared_library_configs |
654 if (is_android) { | 678 if (is_android) { |
655 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] | 679 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] |
656 } | 680 } |
657 } else { | 681 } else { |
658 configs = default_compiler_configs | 682 configs = default_compiler_configs |
659 } | 683 } |
660 } | 684 } |
OLD | NEW |