OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 # Toolchain-related configuration that may be needed outside the context of the | 5 # Toolchain-related configuration that may be needed outside the context of the |
6 # toolchain() rules themselves. | 6 # toolchain() rules themselves. |
7 | 7 |
8 import("//build_overrides/build.gni") | 8 import("//build_overrides/build.gni") |
9 import("//build/config/chrome_build.gni") | 9 import("//build/config/chrome_build.gni") |
10 | 10 |
11 declare_args() { | 11 declare_args() { |
12 # Enable Link Time Optimization in optimized builds (output programs run | 12 # Enable Link Time Optimization in optimized builds (output programs run |
13 # faster, but linking is up to 5-20x slower). | 13 # faster, but linking is up to 5-20x slower). |
14 # Note: use target_os == "linux" rather than is_linux so that it does not | 14 # Note: use target_os == "linux" rather than is_linux so that it does not |
15 # apply to host_toolchain when target_os="android". | 15 # apply to host_toolchain when target_os="android". |
16 allow_posix_link_time_opt = target_os == "linux" && !is_chromeos && | 16 allow_posix_link_time_opt = target_os == "linux" && !is_chromeos && |
17 target_cpu == "x64" && is_official_build | 17 target_cpu == "x64" && is_official_build |
18 | 18 |
| 19 # Set to true to use lld, the LLVM linker. This flag may be used on Windows |
| 20 # with the shipped LLVM toolchain, or on Linux with a self-built top-of-tree |
| 21 # LLVM toolchain (see llvm_force_head_revision in |
| 22 # build/config/compiler/BUILD.gn). |
| 23 use_lld = is_win && host_os != "win" |
| 24 |
| 25 # If used with allow_posix_link_time_opt, it enables the experimental support |
| 26 # of ThinLTO that links 3x-10x faster but (as of now) does not have all the |
| 27 # important optimizations such us devirtualization implemented. See also |
| 28 # http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html |
| 29 use_thin_lto = false |
| 30 |
19 # If this is set to true, or if LLVM_FORCE_HEAD_REVISION is set to 1 | 31 # If this is set to true, or if LLVM_FORCE_HEAD_REVISION is set to 1 |
20 # in the environment, we use the revision in the llvm repo to determine | 32 # in the environment, we use the revision in the llvm repo to determine |
21 # the CLANG_REVISION to use, instead of the version hard-coded into | 33 # the CLANG_REVISION to use, instead of the version hard-coded into |
22 # //tools/clang/scripts/update.py. This should only be used in | 34 # //tools/clang/scripts/update.py. This should only be used in |
23 # conjunction with setting LLVM_FORCE_HEAD_REVISION in the | 35 # conjunction with setting LLVM_FORCE_HEAD_REVISION in the |
24 # environment when `gclient runhooks` is run as well. | 36 # environment when `gclient runhooks` is run as well. |
25 llvm_force_head_revision = false | 37 llvm_force_head_revision = false |
26 | 38 |
27 # Compile with Xcode version of clang instead of hermetic version shipped | 39 # Compile with Xcode version of clang instead of hermetic version shipped |
28 # with the build. Used on iOS to ship official builds (as they are built | 40 # with the build. Used on iOS to ship official builds (as they are built |
29 # with the version of clang shipped with Xcode). | 41 # with the version of clang shipped with Xcode). |
30 use_xcode_clang = is_ios && is_official_build | 42 use_xcode_clang = is_ios && is_official_build |
31 } | 43 } |
32 | 44 |
33 # The path to the hermetic install of Xcode. Only relevant when | 45 # The path to the hermetic install of Xcode. Only relevant when |
34 # use_system_xcode = false. | 46 # use_system_xcode = false. |
35 hermetic_xcode_path = | 47 hermetic_xcode_path = |
36 rebase_path("//build/${target_os}_files/Xcode.app", "", root_build_dir) | 48 rebase_path("//build/${target_os}_files/Xcode.app", "", root_build_dir) |
37 | 49 |
38 declare_args() { | 50 declare_args() { |
39 if (is_clang) { | 51 if (is_clang) { |
40 # Clang compiler version. Clang files are placed at version-dependent paths. | 52 # Clang compiler version. Clang files are placed at version-dependent paths. |
41 clang_version = "5.0.0" | 53 clang_version = "5.0.0" |
42 } | 54 } |
43 | |
44 # Set to true to use lld, the LLVM linker. This flag may be used on Windows | |
45 # or Linux. | |
46 use_lld = (is_win && host_os != "win") || | |
47 (allow_posix_link_time_opt && target_os == "linux" && | |
48 !is_chromeos && target_cpu == "x64") | |
49 | |
50 # If used with allow_posix_link_time_opt, it enables the support of ThinLTO | |
51 # that links 3x-10x faster. See also | |
52 # http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html | |
53 use_thin_lto = allow_posix_link_time_opt && target_os == "linux" && | |
54 !is_chromeos && target_cpu == "x64" | |
55 } | 55 } |
56 | 56 |
57 # Check target_os here instead of is_ios as this file is loaded for secondary | 57 # Check target_os here instead of is_ios as this file is loaded for secondary |
58 # toolchain (host toolchain in particular) but the argument is the same for | 58 # toolchain (host toolchain in particular) but the argument is the same for |
59 # all toolchains. | 59 # all toolchains. |
60 assert(!use_xcode_clang || target_os == "ios", | 60 assert(!use_xcode_clang || target_os == "ios", |
61 "Using Xcode's clang is only supported in iOS builds") | 61 "Using Xcode's clang is only supported in iOS builds") |
62 | 62 |
63 # Subdirectory within root_out_dir for shared library files. | 63 # Subdirectory within root_out_dir for shared library files. |
64 # TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work | 64 # TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 _tool_wrapper_path = | 106 _tool_wrapper_path = |
107 rebase_path("//build/toolchain/win/tool_wrapper.py", root_build_dir) | 107 rebase_path("//build/toolchain/win/tool_wrapper.py", root_build_dir) |
108 | 108 |
109 stamp_command = "$python_path $_tool_wrapper_path stamp {{output}}" | 109 stamp_command = "$python_path $_tool_wrapper_path stamp {{output}}" |
110 copy_command = | 110 copy_command = |
111 "$python_path $_tool_wrapper_path recursive-mirror {{source}} {{output}}" | 111 "$python_path $_tool_wrapper_path recursive-mirror {{source}} {{output}}" |
112 } else { | 112 } else { |
113 stamp_command = "touch {{output}}" | 113 stamp_command = "touch {{output}}" |
114 copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}}
&& cp -af {{source}} {{output}})" | 114 copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}}
&& cp -af {{source}} {{output}})" |
115 } | 115 } |
OLD | NEW |