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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 import("//build/config/chromecast_build.gni") | 7 import("//build/config/chromecast_build.gni") |
8 import("//build/config/compiler/compiler.gni") | 8 import("//build/config/compiler/compiler.gni") |
9 import("//build/toolchain/cc_wrapper.gni") | 9 import("//build/toolchain/cc_wrapper.gni") |
10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 if ((!is_android && linux_use_bundled_binutils) || | 414 if ((!is_android && linux_use_bundled_binutils) || |
415 !(current_cpu == "x86" || current_cpu == "x64")) { | 415 !(current_cpu == "x86" || current_cpu == "x64")) { |
416 ldflags += [ "-Wl,--icf=all" ] | 416 ldflags += [ "-Wl,--icf=all" ] |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 if (linux_use_bundled_binutils) { | 420 if (linux_use_bundled_binutils) { |
421 cflags += [ "-B$binutils_path" ] | 421 cflags += [ "-B$binutils_path" ] |
422 } | 422 } |
423 | 423 |
424 if (is_linux) { | |
425 cflags += [ "-pthread" ] | |
426 # Do not use the -pthread ldflag here since it becomes a no-op | |
427 # when using -nodefaultlibs, which would cause an unused argument | |
428 # error. "-lpthread" is added in //build/config:default_libs. | |
429 } | |
430 | |
424 # Clang-specific compiler flags setup. | 431 # Clang-specific compiler flags setup. |
425 # ------------------------------------ | 432 # ------------------------------------ |
426 if (is_clang) { | 433 if (is_clang) { |
427 cflags += [ "-fcolor-diagnostics" ] | 434 cflags += [ "-fcolor-diagnostics" ] |
428 } | 435 } |
429 | 436 |
430 # Print absolute paths in diagnostics. There is no precedent for doing this | 437 # Print absolute paths in diagnostics. There is no precedent for doing this |
431 # on Linux/Mac (GCC doesn't support it), but MSVC does this with /FC and | 438 # on Linux/Mac (GCC doesn't support it), but MSVC does this with /FC and |
432 # Windows developers rely on it (crbug.com/636109) so only do this on Windows. | 439 # Windows developers rely on it (crbug.com/636109) so only do this on Windows. |
433 if (is_clang && is_win) { | 440 if (is_clang && is_win) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 | 545 |
539 # Assign any flags set for the C compiler to asmflags so that they are sent | 546 # Assign any flags set for the C compiler to asmflags so that they are sent |
540 # to the assembler. The Windows assembler takes different types of flags | 547 # to the assembler. The Windows assembler takes different types of flags |
541 # so only do so for posix platforms. | 548 # so only do so for posix platforms. |
542 if (is_posix) { | 549 if (is_posix) { |
543 asmflags += cflags | 550 asmflags += cflags |
544 asmflags += cflags_c | 551 asmflags += cflags_c |
545 } | 552 } |
546 } | 553 } |
547 | 554 |
548 # This is separate from :compiler (and not even a sub-config there) | |
549 # so that some targets can remove it from the list with: | |
550 # configs -= [ "//build/config/compiler:pthread" ] | |
Nico
2017/06/02 01:48:12
Huh, I'm surprised nobody seems to do this.
| |
551 config("pthread") { | |
552 if (is_linux) { | |
553 cflags = [ "-pthread" ] | |
554 ldflags = [ "-pthread" ] | |
555 } | |
556 } | |
557 | |
558 # This provides the basic options to select the target CPU and ABI. | 555 # This provides the basic options to select the target CPU and ABI. |
559 # It is factored out of "compiler" so that special cases can use this | 556 # It is factored out of "compiler" so that special cases can use this |
560 # without using everything that "compiler" brings in. Options that | 557 # without using everything that "compiler" brings in. Options that |
561 # tweak code generation for a particular CPU do not belong here! | 558 # tweak code generation for a particular CPU do not belong here! |
562 # See "compiler_codegen", below. | 559 # See "compiler_codegen", below. |
563 config("compiler_cpu_abi") { | 560 config("compiler_cpu_abi") { |
564 cflags = [] | 561 cflags = [] |
565 ldflags = [] | 562 ldflags = [] |
566 | 563 |
567 if (is_posix && !(is_mac || is_ios)) { | 564 if (is_posix && !(is_mac || is_ios)) { |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1810 | 1807 |
1811 if (is_ios || is_mac) { | 1808 if (is_ios || is_mac) { |
1812 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1809 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1813 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1810 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1814 config("enable_arc") { | 1811 config("enable_arc") { |
1815 common_flags = [ "-fobjc-arc" ] | 1812 common_flags = [ "-fobjc-arc" ] |
1816 cflags_objc = common_flags | 1813 cflags_objc = common_flags |
1817 cflags_objcc = common_flags | 1814 cflags_objcc = common_flags |
1818 } | 1815 } |
1819 } | 1816 } |
OLD | NEW |