Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/cld_2/cld_2.gyp

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error in chrome/browser/BUILD.gn Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Note to maintainers: In the January 2014 release (*_0122*), there are some 5 # Note to maintainers: In the January 2014 release (*_0122*), there are some
6 # options for building: 6 # options for building:
7 # Pick one quadgram file (cld2_generated_quadchrome*.cc): 7 # Pick one quadgram file (cld2_generated_quadchrome*.cc):
8 # 0122_16 = 160K entries, smallest size, lowest accuracy (set cld2_table_size= 0) 8 # 0122_16 = 160K entries, smallest size, lowest accuracy (set cld2_table_size= 0)
9 # 0122_19 = 192K entries, medium size, medium accuracy (set cld2_table_size=1) 9 # 0122_19 = 192K entries, medium size, medium accuracy (set cld2_table_size=1)
10 # 0122_2 = 256K entries, largest size, highest accuracy (set cld2_table_size= 2) 10 # 0122_2 = 256K entries, largest size, highest accuracy (set cld2_table_size= 2)
11 # 11 #
12 # For the CJK bigram file (cld_generated_cjk_delta_bi*.cc), always use 12 # For the CJK bigram file (cld_generated_cjk_delta_bi*.cc), always use
13 # cld_generated_cjk_delta_bi_4.cc, as this is intended for use with Chromium. 13 # cld_generated_cjk_delta_bi_4.cc, as this is intended for use with Chromium.
14 # The _32 variant of the file is intended for applications that use the full 14 # The _32 variant of the file is intended for applications that use the full
15 # 175-language version of CLD2. 15 # 175-language version of CLD2.
16 16
17 { 17 {
18 'target_defaults': { 18 'target_defaults': {
19 'conditions': [ 19 'conditions': [
20 ['OS=="win"', { 20 ['OS=="win"', {
21 'msvs_disabled_warnings': [4267], 21 'msvs_disabled_warnings': [4267],
22 }], 22 }],
23 ], 23 ],
24 }, 24 },
25 'variables': { 25 'variables': {
26 # This variable controls which dependency is resolved by the pass-through
27 # target 'cld2_platform_impl', and allows the embedder to choose which
28 # kind of CLD2 support is required at build time:
29 #
30 # - If the value is 'static', then the cld2_platform_impl target will depend
31 # upon the cld2_static target
32 # - If the value is 'dynamic', then the cld2_platform_impl target will
33 # depend upon the cld2_dynamic target.
34 #
35 # High-level targets for Chromium unit tests hard-code a dependency upon
36 # cld2_static because doing so makes sense for use cases that aren't
37 # affected by the loading of language detection data; however, most other
38 # targets (e.g. the final executables and interactive UI tests) should be
39 # linked against whatever the embedder needs.
40 #
41 # Maintainers:
42 # This value may be reasonably tweaked in a 'conditions' block below on a
43 # per-platform basis. Don't forget to update the expectations in
44 # components/translate/content/browser/browser_cld_utils.cc as well, to
45 # match whatever is done here.
46 'cld2_platform_support%': 'static',
47
26 # These sources need to be included in both static and dynamic builds as 48 # These sources need to be included in both static and dynamic builds as
27 # well as the dynamic data tool. 49 # well as the dynamic data tool.
28 'cld2_core_sources': [ 50 'cld2_core_sources': [
29 'src/internal/cld2tablesummary.h', 51 'src/internal/cld2tablesummary.h',
30 'src/internal/cldutil.cc',
31 'src/internal/cldutil.h', 52 'src/internal/cldutil.h',
32 'src/internal/cldutil_shared.cc',
33 'src/internal/cldutil_shared.h', 53 'src/internal/cldutil_shared.h',
34 'src/internal/compact_lang_det.cc',
35 'src/internal/compact_lang_det_hint_code.cc',
36 'src/internal/compact_lang_det_hint_code.h', 54 'src/internal/compact_lang_det_hint_code.h',
37 'src/internal/compact_lang_det_impl.cc',
38 'src/internal/compact_lang_det_impl.h', 55 'src/internal/compact_lang_det_impl.h',
39 'src/internal/debug.h', 56 'src/internal/debug.h',
40 'src/internal/debug_empty.cc',
41 'src/internal/fixunicodevalue.cc',
42 'src/internal/fixunicodevalue.h', 57 'src/internal/fixunicodevalue.h',
43 'src/internal/generated_distinct_bi_0.cc',
44 'src/internal/generated_entities.cc',
45 'src/internal/generated_language.cc',
46 'src/internal/generated_language.h', 58 'src/internal/generated_language.h',
47 'src/internal/generated_ulscript.cc',
48 'src/internal/generated_ulscript.h', 59 'src/internal/generated_ulscript.h',
49 'src/internal/getonescriptspan.cc',
50 'src/internal/getonescriptspan.h', 60 'src/internal/getonescriptspan.h',
51 'src/internal/integral_types.h', 61 'src/internal/integral_types.h',
52 'src/internal/lang_script.cc',
53 'src/internal/lang_script.h', 62 'src/internal/lang_script.h',
54 'src/internal/langspan.h', 63 'src/internal/langspan.h',
55 'src/internal/offsetmap.cc',
56 'src/internal/offsetmap.h', 64 'src/internal/offsetmap.h',
57 'src/internal/port.h', 65 'src/internal/port.h',
58 'src/internal/scoreonescriptspan.cc',
59 'src/internal/scoreonescriptspan.h', 66 'src/internal/scoreonescriptspan.h',
60 'src/internal/stringpiece.h', 67 'src/internal/stringpiece.h',
61 'src/internal/tote.cc',
62 'src/internal/tote.h', 68 'src/internal/tote.h',
63 'src/internal/utf8prop_lettermarkscriptnum.h', 69 'src/internal/utf8prop_lettermarkscriptnum.h',
64 'src/internal/utf8repl_lettermarklower.h', 70 'src/internal/utf8repl_lettermarklower.h',
65 'src/internal/utf8scannot_lettermarkspecial.h', 71 'src/internal/utf8scannot_lettermarkspecial.h',
66 'src/internal/utf8statetable.cc',
67 'src/internal/utf8statetable.h', 72 'src/internal/utf8statetable.h',
68 'src/public/compact_lang_det.h', 73 'src/public/compact_lang_det.h',
69 'src/public/encodings.h', 74 'src/public/encodings.h',
70 ], 75 ],
76 'cld2_core_impl_sources': [
77 # Compilation is dependent upon flags.
78 'src/internal/cldutil.cc',
79 'src/internal/cldutil_shared.cc',
80 'src/internal/compact_lang_det.cc',
81 'src/internal/compact_lang_det_hint_code.cc',
82 'src/internal/compact_lang_det_impl.cc',
83 'src/internal/debug_empty.cc',
84 'src/internal/fixunicodevalue.cc',
85 'src/internal/generated_distinct_bi_0.cc',
86 'src/internal/generated_entities.cc',
87 'src/internal/generated_language.cc',
88 'src/internal/generated_ulscript.cc',
89 'src/internal/getonescriptspan.cc',
90 'src/internal/lang_script.cc',
91 'src/internal/offsetmap.cc',
92 'src/internal/scoreonescriptspan.cc',
93 'src/internal/tote.cc',
94 'src/internal/utf8statetable.cc',
95 ],
71 'cld2_dynamic_data_loader_sources': [ 96 'cld2_dynamic_data_loader_sources': [
72 'src/internal/cld2_dynamic_data.h', 97 'src/internal/cld2_dynamic_data.h',
73 'src/internal/cld2_dynamic_data.cc', 98 'src/internal/cld2_dynamic_data.cc',
74 'src/internal/cld2_dynamic_data_loader.h', 99 'src/internal/cld2_dynamic_data_loader.h',
75 'src/internal/cld2_dynamic_data_loader.cc', 100 'src/internal/cld2_dynamic_data_loader.cc',
76 ], 101 ],
77 'cld2_data_sources': [ 102 'cld2_data_sources': [
78 'src/internal/cld2_generated_cjk_compatible.cc', 103 'src/internal/cld2_generated_cjk_compatible.cc',
79 'src/internal/cld2_generated_deltaoctachrome0122.cc', 104 'src/internal/cld2_generated_deltaoctachrome0122.cc',
80 'src/internal/cld2_generated_distinctoctachrome0122.cc', 105 'src/internal/cld2_generated_distinctoctachrome0122.cc',
(...skipping 20 matching lines...) Expand all
101 # GN version: //third_party/cld_2 126 # GN version: //third_party/cld_2
102 'target_name': 'cld_2_dynamic_data_tool', 127 'target_name': 'cld_2_dynamic_data_tool',
103 'type': 'executable', 128 'type': 'executable',
104 'include_dirs': [ 129 'include_dirs': [
105 'src/internal', 130 'src/internal',
106 'src/public', 131 'src/public',
107 ], 132 ],
108 'sources': [ 133 'sources': [
109 # Note: sources list duplicated in GN build. 134 # Note: sources list duplicated in GN build.
110 '<@(cld2_core_sources)', 135 '<@(cld2_core_sources)',
136 '<@(cld2_core_impl_sources)',
111 '<@(cld2_data_sources)', 137 '<@(cld2_data_sources)',
112 '<@(cld2_dynamic_data_loader_sources)', 138 '<@(cld2_dynamic_data_loader_sources)',
113 'src/internal/cld2_dynamic_data_extractor.h', 139 'src/internal/cld2_dynamic_data_extractor.h',
114 'src/internal/cld2_dynamic_data_extractor.cc', 140 'src/internal/cld2_dynamic_data_extractor.cc',
115 'src/internal/cld2_dynamic_data_tool.cc', 141 'src/internal/cld2_dynamic_data_tool.cc',
116 ], 142 ],
143 'defines': ['CLD2_DYNAMIC_MODE'],
117 }, 144 },
118 145
119 { 146 {
120 # GN version: //third_party/cld_2 147 # GN version: //third_party/cld_2
148 # Depending upon cld_2 will provide core headers and function definitions,
149 # but no data. You must also depend on one of the following two targets:
150 # cld2_static - for a statically-linked data set built into the executable
151 # cld2_dynamic - for a dynamic data set loaded at runtime
121 'target_name': 'cld_2', 152 'target_name': 'cld_2',
122 'type': 'static_library', 153 'type': 'static_library',
123 'sources': [], 154 'sources': ['<@(cld2_core_sources)'],
124 'dependencies': [], 155 'dependencies': [],
125 'conditions': [ 156 },
126 ['cld2_data_source=="static"', 157
127 {'dependencies': ['cld2_static']}, 158 # As described above in the comments for cld2_platform_support, this is a
128 {'dependencies': ['cld2_dynamic']} 159 # passthrough target that allows high-level targets to depend upon the same
129 ], 160 # CLD support as desired by the embedder.
130 ], 161 {
162 'target_name': 'cld2_platform_impl',
163 'type': 'none',
164 'dependencies': ['cld2_<(cld2_platform_support)'],
131 }, 165 },
132 166
133 { 167 {
134 # GN version: //third_party/cld_2 168 # GN version: //third_party/cld_2
135 'target_name': 'cld2_static', 169 'target_name': 'cld2_static',
136 'type': 'static_library', 170 'type': 'static_library',
137 'include_dirs': [ 171 'include_dirs': [
138 'src/internal', 172 'src/internal',
139 'src/public', 173 'src/public',
140 ], 174 ],
141 'sources': [ 175 'sources': [
142 '<@(cld2_core_sources)', 176 '<@(cld2_core_sources)',
177 '<@(cld2_core_impl_sources)',
143 '<@(cld2_data_sources)', 178 '<@(cld2_data_sources)',
144 ], 179 ],
145 }, 180 },
146 181
147 { 182 {
148 # GN version: //third_party/cld_2 183 # GN version: //third_party/cld_2
149 'target_name': 'cld2_dynamic', 184 'target_name': 'cld2_dynamic',
150 'type': 'static_library', 185 'type': 'static_library',
151 'include_dirs': [ 186 'include_dirs': [
152 'src/internal', 187 'src/internal',
153 'src/public', 188 'src/public',
154 ], 189 ],
155 'sources': [ 190 'sources': [
156 '<@(cld2_core_sources)', 191 '<@(cld2_core_sources)',
192 '<@(cld2_core_impl_sources)',
157 '<@(cld2_dynamic_data_loader_sources)', 193 '<@(cld2_dynamic_data_loader_sources)',
158 ], 194 ],
159 'defines': ['CLD2_DYNAMIC_MODE'], 195 'defines': ['CLD2_DYNAMIC_MODE'],
160 'all_dependent_settings': {
161 'defines': ['CLD2_DYNAMIC_MODE'],
162 },
163 }, 196 },
164 ], 197 ],
165 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698