| # Copyright 2015 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Toolchain-related configuration that may be needed outside the context of the |
| # toolchain() rules themselves. |
| |
| declare_args() { |
| # Enable Link Time Optimization in optimized builds (output programs run |
| # faster, but linking is up to 5-20x slower). |
| # |
| # TODO(pcc): Remove this flag if/when LTO is enabled in official builds. |
| allow_posix_link_time_opt = false |
| |
| # Set to true to use lld, the LLVM linker. This flag may be used on Windows |
| # with the shipped LLVM toolchain, or on Linux with a self-built top-of-tree |
| # LLVM toolchain (see llvm_force_head_revision in |
| # build/config/compiler/BUILD.gn). |
| use_lld = false |
| |
| if (is_clang) { |
| # Clang compiler version. Clang files are placed at version-dependent paths. |
| clang_version = "3.9.0" |
| } |
| } |
| |
| # Subdirectory within root_out_dir for shared library files. |
| # TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work |
| # in GN until support for loadable_module() is added. |
| # See: https://codereview.chromium.org/1236503002/ |
| shlib_subdir = "." |
| |
| # Root out dir for shared library files. |
| root_shlib_dir = root_out_dir |
| if (shlib_subdir != ".") { |
| root_shlib_dir += "/$shlib_subdir" |
| } |
| |
| # Extension for shared library files (including leading dot). |
| if (is_mac || is_ios) { |
| shlib_extension = ".dylib" |
| } else if (is_android && is_component_build) { |
| # By appending .cr, we prevent name collisions with libraries already |
| # loaded by the Android zygote. |
| shlib_extension = ".cr.so" |
| } else if (is_posix) { |
| shlib_extension = ".so" |
| } else if (is_win) { |
| shlib_extension = ".dll" |
| } else { |
| assert(false, "Platform not supported") |
| } |
| |
| # Prefix for shared library files. |
| if (is_posix) { |
| shlib_prefix = "lib" |
| } else { |
| shlib_prefix = "" |
| } |
| |
| # While other "tool"s in a toolchain are specific to the target of that |
| # toolchain, the "stamp" and "copy" tools are really generic to the host; |
| # but each toolchain must define them separately. GN doesn't allow a |
| # template instantiation inside a toolchain definition, so some boilerplate |
| # has to be repeated in each toolchain to define these two tools. These |
| # four variables reduce the duplication in that boilerplate. |
| stamp_description = "STAMP {{output}}" |
| copy_description = "COPY {{source}} {{output}}" |
| if (host_os == "win") { |
| stamp_command = "$python_path gyp-win-tool stamp {{output}}" |
| copy_command = |
| "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}" |
| } else { |
| stamp_command = "touch {{output}}" |
| copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" |
| } |