Revert of kiosk: Fix bailout shortcut not working. (patchset #1 id:1 of https://coder...
[chromium-blink-merge.git] / third_party / cld_2 / BUILD.gn
blob485f4acebc05b7cfc0f59904ff923728dc0acbb6
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   configs -= [ "//build/config/compiler:chromium_code" ]
50   configs += [ "//build/config/compiler:no_chromium_code" ]
53 # As in the corresponding gyp file, this just builds the core interfaces for
54 # CLD2. You must still declare a dependency on a specific data set, either
55 # cld2_dynamic or cld2_static.
56 source_set("cld_2") {
57   sources = gypi_values.cld2_core_sources
58   include_dirs = [
59     "src/internal",
60     "src/public",
61   ]
63   configs -= [ "//build/config/compiler:chromium_code" ]
64   configs += [ "//build/config/compiler:no_chromium_code" ]
67 source_set("cld2_platform_impl") {
68   deps = []
69   if (cld2_platform_support == "static") {
70     deps += [ ":cld2_static" ]
71   } else if (cld2_platform_support == "dynamic") {
72     deps += [ ":cld2_dynamic" ]
73   }
76 static_library("cld2_static") {
77   sources = gypi_values.cld2_core_impl_sources
78   include_dirs = [
79     "src/internal",
80     "src/public",
81   ]
83   deps = [
84     ":cld_2",
85     ":cld2_data",
86   ]
87   configs -= [ "//build/config/compiler:chromium_code" ]
88   configs += [ "//build/config/compiler:no_chromium_code" ]
91 config("cld2_dynamic_mode_config") {
92   defines = [ "CLD2_DYNAMIC_MODE" ]
95 static_library("cld2_dynamic") {
96   sources = gypi_values.cld2_core_sources + gypi_values.cld2_core_impl_sources +
97             gypi_values.cld2_dynamic_data_loader_sources
98   include_dirs = [
99     "src/internal",
100     "src/public",
101   ]
103   configs -= [ "//build/config/compiler:chromium_code" ]
104   configs += [
105     ":cld2_dynamic_mode_config",
106     "//build/config/compiler:no_chromium_code",
107   ]
110 # Does not build on Windows.
111 if (!is_win) {
112   executable("cld_2_dynamic_data_tool") {
113     sources = [
114       "src/internal/cld2_dynamic_data_extractor.cc",
115       "src/internal/cld2_dynamic_data_extractor.h",
116       "src/internal/cld2_dynamic_data_tool.cc",
117     ]
119     include_dirs = [
120       "src/internal",
121       "src/public",
122     ]
124     deps = [
125       ":cld2_data",
126       ":cld2_dynamic",
127     ]
129     configs -= [ "//build/config/compiler:chromium_code" ]
130     configs += [
131       ":cld2_dynamic_mode_config",
132       "//build/config/compiler:no_chromium_code",
133     ]
134   }