Index: third_party/cld_2/cld_2.gyp |
diff --git a/third_party/cld_2/cld_2.gyp b/third_party/cld_2/cld_2.gyp |
index a27f7a40e9aaaa4884b4b42468cc76bd30ddb3de..43ab1ebb779368e862d263f68ba8dcf64be957fd 100644 |
--- a/third_party/cld_2/cld_2.gyp |
+++ b/third_party/cld_2/cld_2.gyp |
@@ -2,46 +2,13 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-# Note to maintainers: In the October 2014 release, there are some options for |
-# building: |
-# Pick one quadgram file (cld2_generated_quadchrome*.cc): |
-# _16 = 160K entries, smallest size, lowest accuracy (set cld2_table_size=0) |
-# _2 = 256K entries, largest size, highest accuracy (set cld2_table_size=2) |
-# |
-# For the CJK bigram file (cld_generated_cjk_delta_bi*.cc), always use |
-# cld_generated_cjk_delta_bi_4.cc, as this is intended for use with Chromium. |
-# The _32 variant of the file is intended for applications that use the full |
-# 175-language version of CLD2. |
+# MAINTAINERS: |
+# See the BUILD.gn file for more extensive comments and documentation. This |
+# .gyp file exists only for compatibility with gyp. The variables defined below |
+# are used in equivalent targets in BUILD.GN. |
{ |
- 'target_defaults': { |
- 'conditions': [ |
- ['OS=="win"', { |
- 'msvs_disabled_warnings': [4267], |
- }], |
- ], |
- }, |
'variables': { |
- # This variable controls which dependency is resolved by the pass-through |
- # target 'cld2_platform_impl', and allows the embedder to choose which |
- # kind of CLD2 support is required at build time: |
- # |
- # - If the value is 'static', then the cld2_platform_impl target will depend |
- # upon the cld2_static target |
- # - If the value is 'dynamic', then the cld2_platform_impl target will |
- # depend upon the cld2_dynamic target. |
- # |
- # High-level targets for Chromium unit tests hard-code a dependency upon |
- # cld2_static because doing so makes sense for use cases that aren't |
- # affected by the loading of language detection data; however, most other |
- # targets (e.g. the final executables and interactive UI tests) should be |
- # linked against whatever the embedder needs. |
- # |
- # Maintainers: |
- # This value may be reasonably tweaked in a 'conditions' block below on a |
- # per-platform basis. Don't forget to update the expectations in |
- # components/translate/content/browser/browser_cld_utils.cc as well, to |
- # match whatever is done here. |
'cld2_platform_support%': 'static', |
# These sources need to be included in both static and dynamic builds as |
@@ -72,8 +39,9 @@ |
'src/public/compact_lang_det.h', |
'src/public/encodings.h', |
], |
+ |
+ # These sources may have different compilation results based on flags. |
'cld2_core_impl_sources': [ |
- # Compilation is dependent upon flags. |
'src/internal/cldutil.cc', |
'src/internal/cldutil_shared.cc', |
'src/internal/compact_lang_det.cc', |
@@ -81,7 +49,6 @@ |
'src/internal/compact_lang_det_impl.cc', |
'src/internal/debug_empty.cc', |
'src/internal/fixunicodevalue.cc', |
- 'src/internal/generated_distinct_bi_0.cc', |
'src/internal/generated_entities.cc', |
'src/internal/generated_language.cc', |
'src/internal/generated_ulscript.cc', |
@@ -92,12 +59,16 @@ |
'src/internal/tote.cc', |
'src/internal/utf8statetable.cc', |
], |
+ |
+ # These sources are needed for a dynamic build to load data at runtime. |
'cld2_dynamic_data_loader_sources': [ |
'src/internal/cld2_dynamic_data.h', |
'src/internal/cld2_dynamic_data.cc', |
'src/internal/cld2_dynamic_data_loader.h', |
'src/internal/cld2_dynamic_data_loader.cc', |
], |
+ |
+ # These sources are for both small-table and large-table data sets. |
'cld2_data_sources': [ |
'src/internal/cld2_generated_cjk_compatible.cc', |
'src/internal/cld2_generated_deltaoctachrome.cc', |
@@ -107,25 +78,30 @@ |
'src/internal/cld_generated_score_quad_octa_2.cc', |
'src/internal/generated_distinct_bi_0.cc', |
], |
- 'conditions': [ |
- ['cld2_table_size==0', { |
- 'cld2_data_sources+': ['src/internal/cld2_generated_quadchrome_16.cc'] |
- }], |
- ['cld2_table_size==2', { |
- 'cld2_data_sources+': ['src/internal/cld2_generated_quadchrome_2.cc'] |
- }], |
+ |
+ # Used when cld2_table_size == 0 (small tables) |
+ # See 'cld2_table_size' in build/common.gypi for more information. |
+ 'cld2_data_smallest_sources': [ |
+ 'src/internal/cld2_generated_quadchrome_16.cc' |
+ ], |
+ |
+ # Used when cld2_table_size == 2 (large tables) |
+ # See 'cld2_table_size' in build/common.gypi for more information. |
+ 'cld2_data_largest_sources': [ |
+ 'src/internal/cld2_generated_quadchrome_2.cc' |
], |
}, |
'targets': [ |
{ |
- # GN version: //third_party/cld_2 |
+ # GN version: //third_party/cld_2:cld_2_dynamic_data_tool |
'target_name': 'cld_2_dynamic_data_tool', |
'type': 'executable', |
'include_dirs': [ |
'src/internal', |
'src/public', |
], |
+ |
'sources': [ |
# Note: sources list duplicated in GN build. |
'<@(cld2_core_sources)', |
@@ -136,15 +112,22 @@ |
'src/internal/cld2_dynamic_data_extractor.cc', |
'src/internal/cld2_dynamic_data_tool.cc', |
], |
+ 'conditions': [ |
+ ['OS=="win"', { |
+ 'msvs_disabled_warnings': [4267], # size_t -> int conversion. |
+ }], |
+ ['cld2_table_size==0', { |
+ 'sources+': ['<@(cld2_data_smallest_sources)'] |
+ }], |
+ ['cld2_table_size==2', { |
+ 'sources+': ['<@(cld2_data_largest_sources)'] |
+ }], |
+ ], |
'defines': ['CLD2_DYNAMIC_MODE'], |
}, |
{ |
# GN version: //third_party/cld_2 |
- # Depending upon cld_2 will provide core headers and function definitions, |
- # but no data. You must also depend on one of the following two targets: |
- # cld2_static - for a statically-linked data set built into the executable |
- # cld2_dynamic - for a dynamic data set loaded at runtime |
'target_name': 'cld_2', |
'type': 'static_library', |
'sources': ['<@(cld2_core_sources)'], |
@@ -155,13 +138,14 @@ |
# passthrough target that allows high-level targets to depend upon the same |
# CLD support as desired by the embedder. |
{ |
+ # GN version: //third_party/cld_2:cld2_platform_impl |
'target_name': 'cld2_platform_impl', |
'type': 'none', |
'dependencies': ['cld2_<(cld2_platform_support)'], |
}, |
{ |
- # GN version: //third_party/cld_2 |
+ # GN version: //third_party/cld_2:cld2_static |
'target_name': 'cld2_static', |
'type': 'static_library', |
'include_dirs': [ |
@@ -173,12 +157,28 @@ |
'<@(cld2_core_impl_sources)', |
'<@(cld2_data_sources)', |
], |
+ 'conditions': [ |
+ ['OS=="win"', { |
+ 'msvs_disabled_warnings': [4267], # size_t -> int conversion. |
+ }], |
+ ['cld2_table_size==0', { |
+ 'sources+': ['<@(cld2_data_smallest_sources)'] |
+ }], |
+ ['cld2_table_size==2', { |
+ 'sources+': ['<@(cld2_data_largest_sources)'] |
+ }], |
+ ], |
}, |
{ |
- # GN version: //third_party/cld_2 |
+ # GN version: //third_party/cld_2:cld2_dynamic |
'target_name': 'cld2_dynamic', |
'type': 'static_library', |
+ 'conditions': [ |
+ ['OS=="win"', { |
+ 'msvs_disabled_warnings': [4267], # size_t -> int conversion. |
+ }], |
+ ], |
'include_dirs': [ |
'src/internal', |
'src/public', |