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 # Detect host byteorder | |
73 # ppc64 can be either BE or LE | |
74 if (host_cpu == "ppc64") { | |
75 if (current_os == "aix") { | |
76 host_byteorder = "big" | |
77 } else { | |
78 # Only use the script when absolutely necessary | |
79 host_byteorder = exec_script("//build/get_byteorder.py", [], "trim string") | |
Dirk Pranke
2017/04/14 01:32:38
Maybe we should make host_byteorder a built in var
Dirk Pranke
2017/04/18 20:31:31
I've changed my mind. To repeat my latest comment
rayb
2017/04/25 00:41:03
using host_byteorder.gni now.
| |
80 } | |
81 } else if (host_cpu == "ppc" || host_cpu == "s390" || host_cpu == "s390x" || | |
82 host_cpu == "mips" || host_cpu == "mips64") { | |
83 host_byteorder = "big" | |
84 } else { | |
85 host_byteorder = "little" | |
86 } | |
87 | |
72 # ============================================================================= | 88 # ============================================================================= |
73 # BUILD FLAGS | 89 # BUILD FLAGS |
74 # ============================================================================= | 90 # ============================================================================= |
75 # | 91 # |
76 # This block lists input arguments to the build, along with their default | 92 # This block lists input arguments to the build, along with their default |
77 # values. | 93 # values. |
78 # | 94 # |
79 # If a value is specified on the command line, it will overwrite the defaults | 95 # 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. | 96 # given in a declare_args block, otherwise the default will be used. |
81 # | 97 # |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 # (debug, release, official) but for historical reasons there are two | 145 # (debug, release, official) but for historical reasons there are two |
130 # separate flags. | 146 # separate flags. |
131 is_official_build = false | 147 is_official_build = false |
132 | 148 |
133 # Whether we're a traditional desktop unix. | 149 # Whether we're a traditional desktop unix. |
134 is_desktop_linux = current_os == "linux" | 150 is_desktop_linux = current_os == "linux" |
135 | 151 |
136 # Set to true when compiling with the Clang compiler. Typically this is used | 152 # Set to true when compiling with the Clang compiler. Typically this is used |
137 # to configure warnings. | 153 # to configure warnings. |
138 is_clang = current_os == "mac" || current_os == "ios" || | 154 is_clang = current_os == "mac" || current_os == "ios" || |
139 current_os == "linux" || current_os == "chromeos" | 155 (current_os == "linux" && |
156 (current_cpu != "s390x" && current_cpu != "s390" && | |
157 current_cpu != "ppc64" && current_cpu != "ppc")) || | |
158 current_os == "chromeos" | |
Michael Achenbach
2017/04/18 13:46:03
nit: Maybe move the chromeos clause before the lin
rayb
2017/04/25 00:41:03
Done.
| |
140 | 159 |
141 # Allows the path to a custom target toolchain to be injected as a single | 160 # Allows the path to a custom target toolchain to be injected as a single |
142 # argument, and set as the default toolchain. | 161 # argument, and set as the default toolchain. |
143 custom_toolchain = "" | 162 custom_toolchain = "" |
144 | 163 |
145 # This should not normally be set as a build argument. It's here so that | 164 # 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(). | 165 # every toolchain can pass through the "global" value via toolchain_args(). |
147 host_toolchain = "" | 166 host_toolchain = "" |
148 | 167 |
149 # DON'T ADD MORE FLAGS HERE. Read the comment above. | 168 # 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") { | 219 } else if (host_os == "mac") { |
201 host_toolchain = "//build/toolchain/mac:clang_$host_cpu" | 220 host_toolchain = "//build/toolchain/mac:clang_$host_cpu" |
202 } else if (host_os == "win") { | 221 } else if (host_os == "win") { |
203 # On Windows always use the target CPU for host builds. On the | 222 # 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. | 223 # configurations we support this will always work and it saves build steps. |
205 if (is_clang) { | 224 if (is_clang) { |
206 host_toolchain = "//build/toolchain/win:clang_$target_cpu" | 225 host_toolchain = "//build/toolchain/win:clang_$target_cpu" |
207 } else { | 226 } else { |
208 host_toolchain = "//build/toolchain/win:$target_cpu" | 227 host_toolchain = "//build/toolchain/win:$target_cpu" |
209 } | 228 } |
229 } else if (host_os == "aix") { | |
230 host_toolchain = "//build/toolchain/aix:$host_cpu" | |
210 } else { | 231 } else { |
211 assert(false, "Unsupported host_os: $host_os") | 232 assert(false, "Unsupported host_os: $host_os") |
212 } | 233 } |
213 } | 234 } |
214 | 235 |
215 _default_toolchain = "" | 236 _default_toolchain = "" |
216 | 237 |
217 if (target_os == "android") { | 238 if (target_os == "android") { |
218 assert(host_os == "linux" || host_os == "mac", | 239 assert(host_os == "linux" || host_os == "mac", |
219 "Android builds are only supported on Linux and Mac hosts.") | 240 "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.") | 256 assert(host_os == "mac", "Mac cross-compiles are unsupported.") |
236 _default_toolchain = host_toolchain | 257 _default_toolchain = host_toolchain |
237 } else if (target_os == "win") { | 258 } else if (target_os == "win") { |
238 # On Windows we use the same toolchain for host and target by default. | 259 # 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.") | 260 assert(target_os == host_os, "Win cross-compiles only work on win hosts.") |
240 if (is_clang) { | 261 if (is_clang) { |
241 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" | 262 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" |
242 } else { | 263 } else { |
243 _default_toolchain = "//build/toolchain/win:$target_cpu" | 264 _default_toolchain = "//build/toolchain/win:$target_cpu" |
244 } | 265 } |
266 } else if (target_os == "aix") { | |
267 _default_toolchain = "//build/toolchain/aix:$target_cpu" | |
245 } else if (target_os == "winrt_81" || target_os == "winrt_81_phone" || | 268 } else if (target_os == "winrt_81" || target_os == "winrt_81_phone" || |
246 target_os == "winrt_10") { | 269 target_os == "winrt_10") { |
247 _default_toolchain = "//build/toolchain/win:winrt_$target_cpu" | 270 _default_toolchain = "//build/toolchain/win:winrt_$target_cpu" |
248 } else { | 271 } else { |
249 assert(false, "Unsupported target_os: $target_os") | 272 assert(false, "Unsupported target_os: $target_os") |
250 } | 273 } |
251 | 274 |
252 # If a custom toolchain has been set in the args, set it as default. Otherwise, | 275 # 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). | 276 # set the default toolchain for the platform (if any). |
254 if (custom_toolchain != "") { | 277 if (custom_toolchain != "") { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 is_win = false | 358 is_win = false |
336 } else if (current_os == "linux") { | 359 } else if (current_os == "linux") { |
337 is_android = false | 360 is_android = false |
338 is_chromeos = false | 361 is_chromeos = false |
339 is_ios = false | 362 is_ios = false |
340 is_linux = true | 363 is_linux = true |
341 is_mac = false | 364 is_mac = false |
342 is_nacl = false | 365 is_nacl = false |
343 is_posix = true | 366 is_posix = true |
344 is_win = false | 367 is_win = false |
368 } else if (current_os == "aix") { | |
369 is_android = false | |
370 is_chromeos = false | |
371 is_ios = false | |
372 is_linux = false | |
373 is_mac = false | |
374 is_nacl = false | |
375 is_posix = true | |
376 is_win = false | |
345 } | 377 } |
346 | 378 |
347 # ============================================================================= | 379 # ============================================================================= |
348 # SOURCES FILTERS | 380 # SOURCES FILTERS |
349 # ============================================================================= | 381 # ============================================================================= |
350 # | 382 # |
351 # These patterns filter out platform-specific files when assigning to the | 383 # These patterns filter out platform-specific files when assigning to the |
352 # sources variable. The magic variable |sources_assignment_filter| is applied | 384 # sources variable. The magic variable |sources_assignment_filter| is applied |
353 # to each assignment or appending to the sources variable and matches are | 385 # to each assignment or appending to the sources variable and matches are |
354 # automatically removed. | 386 # automatically removed. |
355 # | 387 # |
356 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path | 388 # 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 | 389 # 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 | 390 # must match the pattern (so you need "*.cc" to match all .cc files, for |
359 # example). | 391 # example). |
360 | 392 |
361 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call | 393 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call |
362 # below. | 394 # below. |
363 sources_assignment_filter = [] | 395 sources_assignment_filter = [] |
364 if (!is_posix) { | 396 if (!is_posix) { |
365 sources_assignment_filter += [ | 397 sources_assignment_filter += [ |
366 "*_posix.h", | 398 "*_posix.h", |
367 "*_posix.cc", | 399 "*_posix.cc", |
368 "*_posix_unittest.h", | 400 "*_posix_unittest.h", |
369 "*_posix_unittest.cc", | 401 "*_posix_unittest.cc", |
370 "*\bposix/*", | 402 "*\bposix/*", |
371 ] | 403 ] |
372 } | 404 } |
405 | |
373 if (!is_win) { | 406 if (!is_win) { |
374 sources_assignment_filter += [ | 407 sources_assignment_filter += [ |
375 "*_win.cc", | 408 "*_win.cc", |
376 "*_win.h", | 409 "*_win.h", |
377 "*_win_unittest.cc", | 410 "*_win_unittest.cc", |
378 "*\bwin/*", | 411 "*\bwin/*", |
379 "*.def", | 412 "*.def", |
380 "*.rc", | 413 "*.rc", |
381 ] | 414 ] |
382 } | 415 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 "//build/config/win:nominmax", | 524 "//build/config/win:nominmax", |
492 "//build/config/win:unicode", | 525 "//build/config/win:unicode", |
493 "//build/config/win:winver", | 526 "//build/config/win:winver", |
494 "//build/config/win:vs_code_analysis", | 527 "//build/config/win:vs_code_analysis", |
495 ] | 528 ] |
496 } | 529 } |
497 if (current_os == "winrt_81" || current_os == "winrt_81_phone" || | 530 if (current_os == "winrt_81" || current_os == "winrt_81_phone" || |
498 current_os == "winrt_10") { | 531 current_os == "winrt_10") { |
499 default_compiler_configs += [ "//build/config/win:target_winrt" ] | 532 default_compiler_configs += [ "//build/config/win:target_winrt" ] |
500 } | 533 } |
534 | |
501 if (is_posix) { | 535 if (is_posix) { |
502 default_compiler_configs += [ | 536 default_compiler_configs += [ "//build/config/gcc:no_exceptions" ] |
503 "//build/config/gcc:no_exceptions", | 537 if (current_os != "aix") { |
504 "//build/config/gcc:symbol_visibility_hidden", | 538 default_compiler_configs += |
505 ] | 539 [ "//build/config/gcc:symbol_visibility_hidden" ] |
540 } | |
506 } | 541 } |
507 | 542 |
508 if (is_android) { | 543 if (is_android) { |
509 default_compiler_configs += | 544 default_compiler_configs += |
510 [ "//build/config/android:default_cygprofile_instrumentation" ] | 545 [ "//build/config/android:default_cygprofile_instrumentation" ] |
511 } | 546 } |
512 | 547 |
513 if (is_clang && !is_nacl) { | 548 if (is_clang && !is_nacl) { |
514 default_compiler_configs += [ | 549 default_compiler_configs += [ |
515 "//build/config/clang:find_bad_constructs", | 550 "//build/config/clang:find_bad_constructs", |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 set_defaults("component") { | 686 set_defaults("component") { |
652 if (is_component_build) { | 687 if (is_component_build) { |
653 configs = default_shared_library_configs | 688 configs = default_shared_library_configs |
654 if (is_android) { | 689 if (is_android) { |
655 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] | 690 configs -= [ "//build/config/android:hide_all_but_jni_onload" ] |
656 } | 691 } |
657 } else { | 692 } else { |
658 configs = default_compiler_configs | 693 configs = default_compiler_configs |
659 } | 694 } |
660 } | 695 } |
OLD | NEW |