OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Toolchain-related configuration that may be needed outside the context of the |
| 6 # toolchain() rules themselves. |
| 7 |
| 8 import("//build/config/chrome_build.gni") |
| 9 |
| 10 declare_args() { |
| 11 # Enable Link Time Optimization in optimized builds (output programs run |
| 12 # faster, but linking is up to 5-20x slower). |
| 13 # Note: use target_os == "linux" rather than is_linux so that it does not |
| 14 # apply to host_toolchain when target_os="android". |
| 15 allow_posix_link_time_opt = |
| 16 target_os == "linux" && !is_chromeos && target_cpu == "x64" && |
| 17 is_chrome_branded && is_official_build |
| 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 = false |
| 24 |
| 25 if (is_clang) { |
| 26 # Clang compiler version. Clang files are placed at version-dependent paths. |
| 27 clang_version = "3.9.0" |
| 28 } |
| 29 } |
| 30 |
| 31 # Subdirectory within root_out_dir for shared library files. |
| 32 # TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work |
| 33 # in GN until support for loadable_module() is added. |
| 34 # See: https://codereview.chromium.org/1236503002/ |
| 35 shlib_subdir = "." |
| 36 |
| 37 # Root out dir for shared library files. |
| 38 root_shlib_dir = root_out_dir |
| 39 if (shlib_subdir != ".") { |
| 40 root_shlib_dir += "/$shlib_subdir" |
| 41 } |
| 42 |
| 43 # Extension for shared library files (including leading dot). |
| 44 if (is_mac || is_ios) { |
| 45 shlib_extension = ".dylib" |
| 46 } else if (is_android && is_component_build) { |
| 47 # By appending .cr, we prevent name collisions with libraries already |
| 48 # loaded by the Android zygote. |
| 49 shlib_extension = ".cr.so" |
| 50 } else if (is_posix) { |
| 51 shlib_extension = ".so" |
| 52 } else if (is_win) { |
| 53 shlib_extension = ".dll" |
| 54 } else { |
| 55 assert(false, "Platform not supported") |
| 56 } |
| 57 |
| 58 # Prefix for shared library files. |
| 59 if (is_posix) { |
| 60 shlib_prefix = "lib" |
| 61 } else { |
| 62 shlib_prefix = "" |
| 63 } |
| 64 |
| 65 # While other "tool"s in a toolchain are specific to the target of that |
| 66 # toolchain, the "stamp" and "copy" tools are really generic to the host; |
| 67 # but each toolchain must define them separately. GN doesn't allow a |
| 68 # template instantiation inside a toolchain definition, so some boilerplate |
| 69 # has to be repeated in each toolchain to define these two tools. These |
| 70 # four variables reduce the duplication in that boilerplate. |
| 71 stamp_description = "STAMP {{output}}" |
| 72 copy_description = "COPY {{source}} {{output}}" |
| 73 if (host_os == "win") { |
| 74 stamp_command = "$python_path gyp-win-tool stamp {{output}}" |
| 75 copy_command = |
| 76 "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}" |
| 77 } else { |
| 78 stamp_command = "touch {{output}}" |
| 79 copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}}
&& cp -af {{source}} {{output}})" |
| 80 } |
OLD | NEW |