OLD | NEW |
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 October 2014 release, there are some options for | 5 # MAINTAINERS: |
6 # building: | 6 # See the BUILD.gn file for more extensive comments and documentation. This |
7 # Pick one quadgram file (cld2_generated_quadchrome*.cc): | 7 # .gyp file exists only for compatibility with gyp. The variables defined below |
8 # _16 = 160K entries, smallest size, lowest accuracy (set cld2_table_size=0) | 8 # are used in equivalent targets in BUILD.GN. |
9 # _2 = 256K entries, largest size, highest accuracy (set cld2_table_size=2) | |
10 # | |
11 # For the CJK bigram file (cld_generated_cjk_delta_bi*.cc), always use | |
12 # cld_generated_cjk_delta_bi_4.cc, as this is intended for use with Chromium. | |
13 # The _32 variant of the file is intended for applications that use the full | |
14 # 175-language version of CLD2. | |
15 | 9 |
16 { | 10 { |
17 'target_defaults': { | |
18 'conditions': [ | |
19 ['OS=="win"', { | |
20 'msvs_disabled_warnings': [4267], | |
21 }], | |
22 ], | |
23 }, | |
24 'variables': { | 11 'variables': { |
25 # This variable controls which dependency is resolved by the pass-through | |
26 # target 'cld2_platform_impl', and allows the embedder to choose which | |
27 # kind of CLD2 support is required at build time: | |
28 # | |
29 # - If the value is 'static', then the cld2_platform_impl target will depend | |
30 # upon the cld2_static target | |
31 # - If the value is 'dynamic', then the cld2_platform_impl target will | |
32 # depend upon the cld2_dynamic target. | |
33 # | |
34 # High-level targets for Chromium unit tests hard-code a dependency upon | |
35 # cld2_static because doing so makes sense for use cases that aren't | |
36 # affected by the loading of language detection data; however, most other | |
37 # targets (e.g. the final executables and interactive UI tests) should be | |
38 # linked against whatever the embedder needs. | |
39 # | |
40 # Maintainers: | |
41 # This value may be reasonably tweaked in a 'conditions' block below on a | |
42 # per-platform basis. Don't forget to update the expectations in | |
43 # components/translate/content/browser/browser_cld_utils.cc as well, to | |
44 # match whatever is done here. | |
45 'cld2_platform_support%': 'static', | 12 'cld2_platform_support%': 'static', |
46 | 13 |
47 # These sources need to be included in both static and dynamic builds as | 14 # These sources need to be included in both static and dynamic builds as |
48 # well as the dynamic data tool. | 15 # well as the dynamic data tool. |
49 'cld2_core_sources': [ | 16 'cld2_core_sources': [ |
50 'src/internal/cld2tablesummary.h', | 17 'src/internal/cld2tablesummary.h', |
51 'src/internal/cldutil.h', | 18 'src/internal/cldutil.h', |
52 'src/internal/cldutil_shared.h', | 19 'src/internal/cldutil_shared.h', |
53 'src/internal/compact_lang_det_hint_code.h', | 20 'src/internal/compact_lang_det_hint_code.h', |
54 'src/internal/compact_lang_det_impl.h', | 21 'src/internal/compact_lang_det_impl.h', |
(...skipping 10 matching lines...) Expand all Loading... |
65 'src/internal/scoreonescriptspan.h', | 32 'src/internal/scoreonescriptspan.h', |
66 'src/internal/stringpiece.h', | 33 'src/internal/stringpiece.h', |
67 'src/internal/tote.h', | 34 'src/internal/tote.h', |
68 'src/internal/utf8prop_lettermarkscriptnum.h', | 35 'src/internal/utf8prop_lettermarkscriptnum.h', |
69 'src/internal/utf8repl_lettermarklower.h', | 36 'src/internal/utf8repl_lettermarklower.h', |
70 'src/internal/utf8scannot_lettermarkspecial.h', | 37 'src/internal/utf8scannot_lettermarkspecial.h', |
71 'src/internal/utf8statetable.h', | 38 'src/internal/utf8statetable.h', |
72 'src/public/compact_lang_det.h', | 39 'src/public/compact_lang_det.h', |
73 'src/public/encodings.h', | 40 'src/public/encodings.h', |
74 ], | 41 ], |
| 42 |
| 43 # These sources may have different compilation results based on flags. |
75 'cld2_core_impl_sources': [ | 44 'cld2_core_impl_sources': [ |
76 # Compilation is dependent upon flags. | |
77 'src/internal/cldutil.cc', | 45 'src/internal/cldutil.cc', |
78 'src/internal/cldutil_shared.cc', | 46 'src/internal/cldutil_shared.cc', |
79 'src/internal/compact_lang_det.cc', | 47 'src/internal/compact_lang_det.cc', |
80 'src/internal/compact_lang_det_hint_code.cc', | 48 'src/internal/compact_lang_det_hint_code.cc', |
81 'src/internal/compact_lang_det_impl.cc', | 49 'src/internal/compact_lang_det_impl.cc', |
82 'src/internal/debug_empty.cc', | 50 'src/internal/debug_empty.cc', |
83 'src/internal/fixunicodevalue.cc', | 51 'src/internal/fixunicodevalue.cc', |
84 'src/internal/generated_distinct_bi_0.cc', | |
85 'src/internal/generated_entities.cc', | 52 'src/internal/generated_entities.cc', |
86 'src/internal/generated_language.cc', | 53 'src/internal/generated_language.cc', |
87 'src/internal/generated_ulscript.cc', | 54 'src/internal/generated_ulscript.cc', |
88 'src/internal/getonescriptspan.cc', | 55 'src/internal/getonescriptspan.cc', |
89 'src/internal/lang_script.cc', | 56 'src/internal/lang_script.cc', |
90 'src/internal/offsetmap.cc', | 57 'src/internal/offsetmap.cc', |
91 'src/internal/scoreonescriptspan.cc', | 58 'src/internal/scoreonescriptspan.cc', |
92 'src/internal/tote.cc', | 59 'src/internal/tote.cc', |
93 'src/internal/utf8statetable.cc', | 60 'src/internal/utf8statetable.cc', |
94 ], | 61 ], |
| 62 |
| 63 # These sources are needed for a dynamic build to load data at runtime. |
95 'cld2_dynamic_data_loader_sources': [ | 64 'cld2_dynamic_data_loader_sources': [ |
96 'src/internal/cld2_dynamic_data.h', | 65 'src/internal/cld2_dynamic_data.h', |
97 'src/internal/cld2_dynamic_data.cc', | 66 'src/internal/cld2_dynamic_data.cc', |
98 'src/internal/cld2_dynamic_data_loader.h', | 67 'src/internal/cld2_dynamic_data_loader.h', |
99 'src/internal/cld2_dynamic_data_loader.cc', | 68 'src/internal/cld2_dynamic_data_loader.cc', |
100 ], | 69 ], |
| 70 |
| 71 # These sources are for both small-table and large-table data sets. |
101 'cld2_data_sources': [ | 72 'cld2_data_sources': [ |
102 'src/internal/cld2_generated_cjk_compatible.cc', | 73 'src/internal/cld2_generated_cjk_compatible.cc', |
103 'src/internal/cld2_generated_deltaoctachrome.cc', | 74 'src/internal/cld2_generated_deltaoctachrome.cc', |
104 'src/internal/cld2_generated_distinctoctachrome.cc', | 75 'src/internal/cld2_generated_distinctoctachrome.cc', |
105 'src/internal/cld_generated_cjk_delta_bi_4.cc', | 76 'src/internal/cld_generated_cjk_delta_bi_4.cc', |
106 'src/internal/cld_generated_cjk_uni_prop_80.cc', | 77 'src/internal/cld_generated_cjk_uni_prop_80.cc', |
107 'src/internal/cld_generated_score_quad_octa_2.cc', | 78 'src/internal/cld_generated_score_quad_octa_2.cc', |
108 'src/internal/generated_distinct_bi_0.cc', | 79 'src/internal/generated_distinct_bi_0.cc', |
109 ], | 80 ], |
110 'conditions': [ | 81 |
111 ['cld2_table_size==0', { | 82 # Used when cld2_table_size == 0 (small tables) |
112 'cld2_data_sources+': ['src/internal/cld2_generated_quadchrome_16.cc'] | 83 # See 'cld2_table_size' in build/common.gypi for more information. |
113 }], | 84 'cld2_data_smallest_sources': [ |
114 ['cld2_table_size==2', { | 85 'src/internal/cld2_generated_quadchrome_16.cc' |
115 'cld2_data_sources+': ['src/internal/cld2_generated_quadchrome_2.cc'] | 86 ], |
116 }], | 87 |
| 88 # Used when cld2_table_size == 2 (large tables) |
| 89 # See 'cld2_table_size' in build/common.gypi for more information. |
| 90 'cld2_data_largest_sources': [ |
| 91 'src/internal/cld2_generated_quadchrome_2.cc' |
117 ], | 92 ], |
118 }, | 93 }, |
119 | 94 |
120 'targets': [ | 95 'targets': [ |
121 { | 96 { |
122 # GN version: //third_party/cld_2 | 97 # GN version: //third_party/cld_2:cld_2_dynamic_data_tool |
123 'target_name': 'cld_2_dynamic_data_tool', | 98 'target_name': 'cld_2_dynamic_data_tool', |
124 'type': 'executable', | 99 'type': 'executable', |
125 'include_dirs': [ | 100 'include_dirs': [ |
126 'src/internal', | 101 'src/internal', |
127 'src/public', | 102 'src/public', |
128 ], | 103 ], |
| 104 |
129 'sources': [ | 105 'sources': [ |
130 # Note: sources list duplicated in GN build. | 106 # Note: sources list duplicated in GN build. |
131 '<@(cld2_core_sources)', | 107 '<@(cld2_core_sources)', |
132 '<@(cld2_core_impl_sources)', | 108 '<@(cld2_core_impl_sources)', |
133 '<@(cld2_data_sources)', | 109 '<@(cld2_data_sources)', |
134 '<@(cld2_dynamic_data_loader_sources)', | 110 '<@(cld2_dynamic_data_loader_sources)', |
135 'src/internal/cld2_dynamic_data_extractor.h', | 111 'src/internal/cld2_dynamic_data_extractor.h', |
136 'src/internal/cld2_dynamic_data_extractor.cc', | 112 'src/internal/cld2_dynamic_data_extractor.cc', |
137 'src/internal/cld2_dynamic_data_tool.cc', | 113 'src/internal/cld2_dynamic_data_tool.cc', |
138 ], | 114 ], |
| 115 'conditions': [ |
| 116 ['OS=="win"', { |
| 117 'msvs_disabled_warnings': [4267], # size_t -> int conversion. |
| 118 }], |
| 119 ['cld2_table_size==0', { |
| 120 'sources+': ['<@(cld2_data_smallest_sources)'] |
| 121 }], |
| 122 ['cld2_table_size==2', { |
| 123 'sources+': ['<@(cld2_data_largest_sources)'] |
| 124 }], |
| 125 ], |
139 'defines': ['CLD2_DYNAMIC_MODE'], | 126 'defines': ['CLD2_DYNAMIC_MODE'], |
140 }, | 127 }, |
141 | 128 |
142 { | 129 { |
143 # GN version: //third_party/cld_2 | 130 # GN version: //third_party/cld_2 |
144 # Depending upon cld_2 will provide core headers and function definitions, | |
145 # but no data. You must also depend on one of the following two targets: | |
146 # cld2_static - for a statically-linked data set built into the executable | |
147 # cld2_dynamic - for a dynamic data set loaded at runtime | |
148 'target_name': 'cld_2', | 131 'target_name': 'cld_2', |
149 'type': 'static_library', | 132 'type': 'static_library', |
150 'sources': ['<@(cld2_core_sources)'], | 133 'sources': ['<@(cld2_core_sources)'], |
151 'dependencies': [], | 134 'dependencies': [], |
152 }, | 135 }, |
153 | 136 |
154 # As described above in the comments for cld2_platform_support, this is a | 137 # As described above in the comments for cld2_platform_support, this is a |
155 # passthrough target that allows high-level targets to depend upon the same | 138 # passthrough target that allows high-level targets to depend upon the same |
156 # CLD support as desired by the embedder. | 139 # CLD support as desired by the embedder. |
157 { | 140 { |
| 141 # GN version: //third_party/cld_2:cld2_platform_impl |
158 'target_name': 'cld2_platform_impl', | 142 'target_name': 'cld2_platform_impl', |
159 'type': 'none', | 143 'type': 'none', |
160 'dependencies': ['cld2_<(cld2_platform_support)'], | 144 'dependencies': ['cld2_<(cld2_platform_support)'], |
161 }, | 145 }, |
162 | 146 |
163 { | 147 { |
164 # GN version: //third_party/cld_2 | 148 # GN version: //third_party/cld_2:cld2_static |
165 'target_name': 'cld2_static', | 149 'target_name': 'cld2_static', |
166 'type': 'static_library', | 150 'type': 'static_library', |
167 'include_dirs': [ | 151 'include_dirs': [ |
168 'src/internal', | 152 'src/internal', |
169 'src/public', | 153 'src/public', |
170 ], | 154 ], |
171 'sources': [ | 155 'sources': [ |
172 '<@(cld2_core_sources)', | 156 '<@(cld2_core_sources)', |
173 '<@(cld2_core_impl_sources)', | 157 '<@(cld2_core_impl_sources)', |
174 '<@(cld2_data_sources)', | 158 '<@(cld2_data_sources)', |
175 ], | 159 ], |
| 160 'conditions': [ |
| 161 ['OS=="win"', { |
| 162 'msvs_disabled_warnings': [4267], # size_t -> int conversion. |
| 163 }], |
| 164 ['cld2_table_size==0', { |
| 165 'sources+': ['<@(cld2_data_smallest_sources)'] |
| 166 }], |
| 167 ['cld2_table_size==2', { |
| 168 'sources+': ['<@(cld2_data_largest_sources)'] |
| 169 }], |
| 170 ], |
176 }, | 171 }, |
177 | 172 |
178 { | 173 { |
179 # GN version: //third_party/cld_2 | 174 # GN version: //third_party/cld_2:cld2_dynamic |
180 'target_name': 'cld2_dynamic', | 175 'target_name': 'cld2_dynamic', |
181 'type': 'static_library', | 176 'type': 'static_library', |
| 177 'conditions': [ |
| 178 ['OS=="win"', { |
| 179 'msvs_disabled_warnings': [4267], # size_t -> int conversion. |
| 180 }], |
| 181 ], |
182 'include_dirs': [ | 182 'include_dirs': [ |
183 'src/internal', | 183 'src/internal', |
184 'src/public', | 184 'src/public', |
185 ], | 185 ], |
186 'sources': [ | 186 'sources': [ |
187 '<@(cld2_core_sources)', | 187 '<@(cld2_core_sources)', |
188 '<@(cld2_core_impl_sources)', | 188 '<@(cld2_core_impl_sources)', |
189 '<@(cld2_dynamic_data_loader_sources)', | 189 '<@(cld2_dynamic_data_loader_sources)', |
190 ], | 190 ], |
191 'defines': ['CLD2_DYNAMIC_MODE'], | 191 'defines': ['CLD2_DYNAMIC_MODE'], |
192 }, | 192 }, |
193 ], | 193 ], |
194 } | 194 } |
OLD | NEW |