| Index: third_party/cld_2/BUILD.gn
|
| diff --git a/third_party/cld_2/BUILD.gn b/third_party/cld_2/BUILD.gn
|
| index 268eced897ad6995b50e8d542b412f1d55eaaf76..917e1d036c483bfc7635d3232221fcc10ef6186a 100644
|
| --- a/third_party/cld_2/BUILD.gn
|
| +++ b/third_party/cld_2/BUILD.gn
|
| @@ -4,76 +4,43 @@
|
|
|
| import("//build/config/features.gni")
|
|
|
| -# May need to make this a build arg, keep the name for now to match gyp
|
| -cld2_table_size = 2
|
| +gypi_values = exec_script(
|
| + "//build/gypi_to_gn.py",
|
| + [ rebase_path("cld_2.gyp") ],
|
| + "scope",
|
| + [ "cld_2.gyp" ])
|
| +
|
| +# 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 on a per-platform basis.
|
| +# Don't forget to update this file as well to match:
|
| +# components/translate/content/browser/browser_cld_utils.cc
|
| +# components/translate/content/renderer/renderer_cld_utils.cc
|
| +cld2_platform_support = "static"
|
| +
|
|
|
| -core_files = [
|
| - "src/internal/cld2tablesummary.h",
|
| - "src/internal/cldutil.h",
|
| - "src/internal/cldutil_shared.h",
|
| - "src/internal/compact_lang_det_hint_code.h",
|
| - "src/internal/compact_lang_det_impl.h",
|
| - "src/internal/debug.h",
|
| - "src/internal/fixunicodevalue.h",
|
| - "src/internal/generated_language.h",
|
| - "src/internal/generated_ulscript.h",
|
| - "src/internal/getonescriptspan.h",
|
| - "src/internal/integral_types.h",
|
| - "src/internal/lang_script.h",
|
| - "src/internal/langspan.h",
|
| - "src/internal/offsetmap.h",
|
| - "src/internal/port.h",
|
| - "src/internal/scoreonescriptspan.h",
|
| - "src/internal/stringpiece.h",
|
| - "src/internal/tote.h",
|
| - "src/internal/utf8prop_lettermarkscriptnum.h",
|
| - "src/internal/utf8repl_lettermarklower.h",
|
| - "src/internal/utf8scannot_lettermarkspecial.h",
|
| - "src/internal/utf8statetable.h",
|
| - "src/public/compact_lang_det.h",
|
| - "src/public/encodings.h",
|
| -]
|
| -
|
| -core_impl_files = [
|
| - "src/internal/cldutil.cc",
|
| - "src/internal/cldutil_shared.cc",
|
| - "src/internal/compact_lang_det.cc",
|
| - "src/internal/compact_lang_det_hint_code.cc",
|
| - "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",
|
| - "src/internal/getonescriptspan.cc",
|
| - "src/internal/lang_script.cc",
|
| - "src/internal/offsetmap.cc",
|
| - "src/internal/scoreonescriptspan.cc",
|
| - "src/internal/tote.cc",
|
| - "src/internal/utf8statetable.cc",
|
| -]
|
| -
|
| -data_loader_files = [
|
| - "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",
|
| -]
|
| +cld2_table_size = 2
|
|
|
| source_set("cld2_data") {
|
| - sources = [
|
| - "src/internal/cld2_generated_cjk_compatible.cc",
|
| - "src/internal/cld2_generated_deltaoctachrome.cc",
|
| - "src/internal/cld2_generated_distinctoctachrome.cc",
|
| - "src/internal/cld_generated_cjk_delta_bi_4.cc",
|
| - "src/internal/cld_generated_cjk_uni_prop_80.cc",
|
| - "src/internal/cld_generated_score_quad_octa_2.cc",
|
| - ]
|
| + sources = gypi_values.cld2_data_sources
|
| if (cld2_table_size == 0) {
|
| - sources += [ "src/internal/cld2_generated_quadchrome_16.cc" ]
|
| + sources += gypi_values.cld2_data_smallest_sources
|
| } else if (cld2_table_size == 2) {
|
| - sources += [ "src/internal/cld2_generated_quadchrome_2.cc" ]
|
| + sources += gypi_values.cld2_data_largest_sources
|
| }
|
|
|
| include_dirs = [
|
| @@ -93,7 +60,7 @@ source_set("cld2_data") {
|
| # CLD2. You must still declare a dependency on a specific data set, either
|
| # cld2_dynamic or cld2_static.
|
| source_set("cld_2") {
|
| - sources = core_files
|
| + sources = gypi_values.cld2_core_sources
|
| include_dirs = [
|
| "src/internal",
|
| "src/public",
|
| @@ -109,18 +76,22 @@ source_set("cld_2") {
|
|
|
|
|
| source_set("cld2_platform_impl") {
|
| - # TODO: Make this something that can be overridden
|
| - deps = [ ":cld2_static" ]
|
| + deps = []
|
| + if (cld2_platform_support == "static") {
|
| + deps += [ ":cld2_static" ]
|
| + } else if (cld2_platform_support == "dynamic") {
|
| + deps += [ ":cld2_dynamic" ]
|
| + }
|
| }
|
|
|
| static_library("cld2_static") {
|
| - sources = core_files + core_impl_files
|
| + sources = gypi_values.cld2_core_impl_sources
|
| include_dirs = [
|
| "src/internal",
|
| "src/public",
|
| ]
|
|
|
| - deps = [ ":cld2_data" ]
|
| + deps = [ ":cld_2", ":cld2_data" ]
|
| configs -= [ "//build/config/compiler:chromium_code" ]
|
| configs += [ "//build/config/compiler:no_chromium_code" ]
|
|
|
| @@ -134,7 +105,7 @@ config("cld2_dynamic_mode_config") {
|
| }
|
|
|
| static_library("cld2_dynamic") {
|
| - sources = core_files + core_impl_files + data_loader_files
|
| + sources = gypi_values.cld2_core_sources + gypi_values.cld2_core_impl_sources + gypi_values.cld2_dynamic_data_loader_sources
|
| include_dirs = [
|
| "src/internal",
|
| "src/public",
|
|
|