Android NTP: Add UMA for the time to click a most visited tile
[chromium-blink-merge.git] / third_party / cld_2 / BUILD.gn
blob303dcbf53a8d2427da61e03450e1265f23ad1040
1 # Copyright 2014 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.
5 import("//build/config/features.gni")
7 gypi_values = exec_script("//build/gypi_to_gn.py",
8                           [ rebase_path("cld_2.gyp") ],
9                           "scope",
10                           [ "cld_2.gyp" ])
12 # This variable controls which dependency is resolved by the pass-through
13 # target 'cld2_platform_impl', and allows the embedder to choose which
14 # kind of CLD2 support is required at build time:
16 # - If the value is 'static', then the cld2_platform_impl target will depend
17 #   upon the cld2_static target
18 # - If the value is 'dynamic', then the cld2_platform_impl target will
19 #   depend upon the cld2_dynamic target.
21 # High-level targets for Chromium unit tests hard-code a dependency upon
22 # cld2_static because doing so makes sense for use cases that aren't
23 # affected by the loading of language detection data; however, most other
24 # targets (e.g. the final executables and interactive UI tests) should be
25 # linked against whatever the embedder needs.
27 # Maintainers:
28 # This value may be reasonably tweaked on a per-platform basis.
29 # Don't forget to update this file as well to match:
30 #   components/translate/content/browser/browser_cld_utils.cc
31 #   components/translate/content/renderer/renderer_cld_utils.cc
32 cld2_platform_support = "static"
34 cld2_table_size = 2
36 source_set("cld2_data") {
37   sources = gypi_values.cld2_data_sources
38   if (cld2_table_size == 0) {
39     sources += gypi_values.cld2_data_smallest_sources
40   } else if (cld2_table_size == 2) {
41     sources += gypi_values.cld2_data_largest_sources
42   }
44   include_dirs = [
45     "src/internal",
46     "src/public",
47   ]
49   config("cld2_data_warnings") {
50     if (is_clang) {
51       # The generated files don't have braces around subobject initializers.
52       cflags = [ "-Wno-missing-braces" ]
53     }
54   }
55   configs -= [ "//build/config/compiler:chromium_code" ]
56   configs += [ "//build/config/compiler:no_chromium_code" ]
57   configs += [ ":cld2_data_warnings" ]
60 # As in the corresponding gyp file, this just builds the core interfaces for
61 # CLD2. You must still declare a dependency on a specific data set, either
62 # cld2_dynamic or cld2_static.
63 source_set("cld_2") {
64   sources = gypi_values.cld2_core_sources
65   include_dirs = [
66     "src/internal",
67     "src/public",
68   ]
70   configs -= [ "//build/config/compiler:chromium_code" ]
71   configs += [ "//build/config/compiler:no_chromium_code" ]
74 source_set("cld2_platform_impl") {
75   deps = []
76   if (cld2_platform_support == "static") {
77     deps += [ ":cld2_static" ]
78   } else if (cld2_platform_support == "dynamic") {
79     deps += [ ":cld2_dynamic" ]
80   }
83 config("cld2_warnings") {
84   if (is_clang) {
85     cflags = [
86       # cld_2 contains unused private fields.
87       # https://code.google.com/p/cld2/issues/detail?id=37
88       "-Wno-unused-private-field",
89     ]
90   }
93 static_library("cld2_static") {
94   sources = gypi_values.cld2_core_impl_sources
95   include_dirs = [
96     "src/internal",
97     "src/public",
98   ]
100   deps = [
101     ":cld_2",
102     ":cld2_data",
103   ]
104   configs -= [ "//build/config/compiler:chromium_code" ]
105   configs += [
106     "//build/config/compiler:no_chromium_code",
107     ":cld2_warnings",
108   ]
111 config("cld2_dynamic_mode_config") {
112   defines = [ "CLD2_DYNAMIC_MODE" ]
115 static_library("cld2_dynamic") {
116   sources = gypi_values.cld2_core_sources + gypi_values.cld2_core_impl_sources +
117             gypi_values.cld2_dynamic_data_loader_sources
118   include_dirs = [
119     "src/internal",
120     "src/public",
121   ]
123   configs -= [ "//build/config/compiler:chromium_code" ]
124   configs += [
125     ":cld2_dynamic_mode_config",
126     "//build/config/compiler:no_chromium_code",
127     ":cld2_warnings",
128   ]
131 # Does not build on Windows.
132 if (!is_win) {
133   executable("cld_2_dynamic_data_tool") {
134     sources = [
135       "src/internal/cld2_dynamic_data_extractor.cc",
136       "src/internal/cld2_dynamic_data_extractor.h",
137       "src/internal/cld2_dynamic_data_tool.cc",
138     ]
140     include_dirs = [
141       "src/internal",
142       "src/public",
143     ]
145     deps = [
146       ":cld2_data",
147       ":cld2_dynamic",
148     ]
150     configs -= [ "//build/config/compiler:chromium_code" ]
151     configs += [
152       ":cld2_dynamic_mode_config",
153       "//build/config/compiler:no_chromium_code",
154     ]
155   }