[M120 Migration][Gamepad]Add gamepad event latency Test code
[platform/framework/web/chromium-efl.git] / build / toolchain / toolchain.gni
1 # Copyright 2015 The Chromium Authors
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 import("//build/config/chromecast_build.gni")
10 import("//build_overrides/build.gni")
11
12 declare_args() {
13   # If this is set to true, we use the revision in the llvm repo to determine
14   # the CLANG_REVISION to use, instead of the version hard-coded into
15   # //tools/clang/scripts/update.py. This should only be used in
16   # conjunction with setting the llvm_force_head_revision DEPS variable when
17   # `gclient runhooks` is run as well.
18   llvm_force_head_revision = false
19
20   # Cronet is shipped in AOSP, where it is built using the Android Mainline
21   # Clang. Please refer to go/cronet-builders-with-mainline-clang-design for
22   # more information.
23   # If this arg is set to true, we use the Android Mainline LLVM.
24   llvm_android_mainline = false
25
26   # Used for binary size analysis.
27   generate_linker_map = is_android && is_official_build
28
29   # Whether this toolchain is to be used for building host tools that are
30   # consumed during the build process. That includes proc macros and Cargo build
31   # scripts.
32   toolchain_for_rust_host_build_tools = false
33 }
34
35 if (generate_linker_map) {
36   assert(is_official_build || is_castos || is_cast_android,
37          "Linker map files should only be generated when is_official_build = " +
38              "true or is_castos = true or is_cast_android = true")
39   assert(current_os == "android" || current_os == "linux" ||
40              target_os == "android" || target_os == "linux" ||
41              target_os == "chromeos",
42          "Linker map files should only be generated for Android, Linux, " +
43              "or ChromeOS.")
44 }
45
46 declare_args() {
47   if (llvm_android_mainline) {  # https://crbug.com/1481060
48     clang_version = "17"
49   } else {
50     clang_version = "18"
51   }
52 }
53
54 # Extension for shared library files (including leading dot).
55 if (is_apple) {
56   shlib_extension = ".dylib"
57 } else if (is_android && is_component_build) {
58   # By appending .cr, we prevent name collisions with libraries already
59   # loaded by the Android zygote.
60   shlib_extension = ".cr.so"
61 } else if (is_posix || is_fuchsia) {
62   shlib_extension = ".so"
63 } else if (is_win) {
64   shlib_extension = ".dll"
65 } else {
66   assert(false, "Platform not supported")
67 }
68
69 # Same extension but for the host platform. We have significantly fewer host
70 # platforms.
71 if (host_os == "mac") {
72   host_shlib_extension = ".dylib"
73 } else if (host_os == "win") {
74   host_shlib_extension = ".dll"
75 } else if (host_os == "linux" || host_os == "aix") {
76   host_shlib_extension = ".so"
77 } else {
78   assert(false, "Host platform not supported")
79 }
80
81 # Prefix for shared library files.
82 if (is_posix || is_fuchsia) {
83   shlib_prefix = "lib"
84 } else {
85   shlib_prefix = ""
86 }
87
88 # Directory for shared library files.
89 if (is_fuchsia) {
90   shlib_subdir = "/lib"
91 } else {
92   shlib_subdir = ""
93 }
94
95 # While other "tool"s in a toolchain are specific to the target of that
96 # toolchain, the "stamp" and "copy" tools are really generic to the host;
97 # but each toolchain must define them separately.  GN doesn't allow a
98 # template instantiation inside a toolchain definition, so some boilerplate
99 # has to be repeated in each toolchain to define these two tools.  These
100 # four variables reduce the duplication in that boilerplate.
101 stamp_description = "STAMP {{output}}"
102 copy_description = "COPY {{source}} {{output}}"
103 if (host_os == "win") {
104   _tool_wrapper_path =
105       rebase_path("//build/toolchain/win/tool_wrapper.py", root_build_dir)
106
107   stamp_command = "cmd /c type nul > \"{{output}}\""
108   copy_command = "\"$python_path\" $_tool_wrapper_path recursive-mirror {{source}} {{output}}"
109 } else {
110   stamp_command = "touch {{output}}"
111   copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
112 }
113
114 # This variable is true if the current toolchain is one of the target
115 # toolchains, i.e. a toolchain which is being used to build the main Chrome
116 # binary. This generally means "not the host toolchain", but in the case where
117 # we're targeting the host it's true then as well. We do require current_os to
118 # match target_os so that for example we avoid considering Android as a target
119 # toolchain when targeting CrOS.
120 is_a_target_toolchain =
121     (current_toolchain != host_toolchain ||
122      default_toolchain == host_toolchain) && current_os == target_os