| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 import("//build/config/features.gni") | 5 import("//build/config/features.gni") |
| 6 | 6 |
| 7 # May need to make this a build arg, keep the name for now to match gyp | 7 gypi_values = exec_script( |
| 8 "//build/gypi_to_gn.py", |
| 9 [ rebase_path("cld_2.gyp") ], |
| 10 "scope", |
| 11 [ "cld_2.gyp" ]) |
| 12 |
| 13 # This variable controls which dependency is resolved by the pass-through |
| 14 # target 'cld2_platform_impl', and allows the embedder to choose which |
| 15 # kind of CLD2 support is required at build time: |
| 16 # |
| 17 # - If the value is 'static', then the cld2_platform_impl target will depend |
| 18 # upon the cld2_static target |
| 19 # - If the value is 'dynamic', then the cld2_platform_impl target will |
| 20 # depend upon the cld2_dynamic target. |
| 21 # |
| 22 # High-level targets for Chromium unit tests hard-code a dependency upon |
| 23 # cld2_static because doing so makes sense for use cases that aren't |
| 24 # affected by the loading of language detection data; however, most other |
| 25 # targets (e.g. the final executables and interactive UI tests) should be |
| 26 # linked against whatever the embedder needs. |
| 27 # |
| 28 # Maintainers: |
| 29 # This value may be reasonably tweaked on a per-platform basis. |
| 30 # Don't forget to update this file as well to match: |
| 31 # components/translate/content/browser/browser_cld_utils.cc |
| 32 # components/translate/content/renderer/renderer_cld_utils.cc |
| 33 cld2_platform_support = "static" |
| 34 |
| 35 |
| 8 cld2_table_size = 2 | 36 cld2_table_size = 2 |
| 9 | 37 |
| 10 core_files = [ | |
| 11 "src/internal/cld2tablesummary.h", | |
| 12 "src/internal/cldutil.h", | |
| 13 "src/internal/cldutil_shared.h", | |
| 14 "src/internal/compact_lang_det_hint_code.h", | |
| 15 "src/internal/compact_lang_det_impl.h", | |
| 16 "src/internal/debug.h", | |
| 17 "src/internal/fixunicodevalue.h", | |
| 18 "src/internal/generated_language.h", | |
| 19 "src/internal/generated_ulscript.h", | |
| 20 "src/internal/getonescriptspan.h", | |
| 21 "src/internal/integral_types.h", | |
| 22 "src/internal/lang_script.h", | |
| 23 "src/internal/langspan.h", | |
| 24 "src/internal/offsetmap.h", | |
| 25 "src/internal/port.h", | |
| 26 "src/internal/scoreonescriptspan.h", | |
| 27 "src/internal/stringpiece.h", | |
| 28 "src/internal/tote.h", | |
| 29 "src/internal/utf8prop_lettermarkscriptnum.h", | |
| 30 "src/internal/utf8repl_lettermarklower.h", | |
| 31 "src/internal/utf8scannot_lettermarkspecial.h", | |
| 32 "src/internal/utf8statetable.h", | |
| 33 "src/public/compact_lang_det.h", | |
| 34 "src/public/encodings.h", | |
| 35 ] | |
| 36 | |
| 37 core_impl_files = [ | |
| 38 "src/internal/cldutil.cc", | |
| 39 "src/internal/cldutil_shared.cc", | |
| 40 "src/internal/compact_lang_det.cc", | |
| 41 "src/internal/compact_lang_det_hint_code.cc", | |
| 42 "src/internal/compact_lang_det_impl.cc", | |
| 43 "src/internal/debug_empty.cc", | |
| 44 "src/internal/fixunicodevalue.cc", | |
| 45 "src/internal/generated_distinct_bi_0.cc", | |
| 46 "src/internal/generated_entities.cc", | |
| 47 "src/internal/generated_language.cc", | |
| 48 "src/internal/generated_ulscript.cc", | |
| 49 "src/internal/getonescriptspan.cc", | |
| 50 "src/internal/lang_script.cc", | |
| 51 "src/internal/offsetmap.cc", | |
| 52 "src/internal/scoreonescriptspan.cc", | |
| 53 "src/internal/tote.cc", | |
| 54 "src/internal/utf8statetable.cc", | |
| 55 ] | |
| 56 | |
| 57 data_loader_files = [ | |
| 58 "src/internal/cld2_dynamic_data.h", | |
| 59 "src/internal/cld2_dynamic_data.cc", | |
| 60 "src/internal/cld2_dynamic_data_loader.h", | |
| 61 "src/internal/cld2_dynamic_data_loader.cc", | |
| 62 ] | |
| 63 | |
| 64 source_set("cld2_data") { | 38 source_set("cld2_data") { |
| 65 sources = [ | 39 sources = gypi_values.cld2_data_sources |
| 66 "src/internal/cld2_generated_cjk_compatible.cc", | |
| 67 "src/internal/cld2_generated_deltaoctachrome.cc", | |
| 68 "src/internal/cld2_generated_distinctoctachrome.cc", | |
| 69 "src/internal/cld_generated_cjk_delta_bi_4.cc", | |
| 70 "src/internal/cld_generated_cjk_uni_prop_80.cc", | |
| 71 "src/internal/cld_generated_score_quad_octa_2.cc", | |
| 72 ] | |
| 73 if (cld2_table_size == 0) { | 40 if (cld2_table_size == 0) { |
| 74 sources += [ "src/internal/cld2_generated_quadchrome_16.cc" ] | 41 sources += gypi_values.cld2_data_smallest_sources |
| 75 } else if (cld2_table_size == 2) { | 42 } else if (cld2_table_size == 2) { |
| 76 sources += [ "src/internal/cld2_generated_quadchrome_2.cc" ] | 43 sources += gypi_values.cld2_data_largest_sources |
| 77 } | 44 } |
| 78 | 45 |
| 79 include_dirs = [ | 46 include_dirs = [ |
| 80 "src/internal", | 47 "src/internal", |
| 81 "src/public", | 48 "src/public", |
| 82 ] | 49 ] |
| 83 | 50 |
| 84 configs -= [ "//build/config/compiler:chromium_code" ] | 51 configs -= [ "//build/config/compiler:chromium_code" ] |
| 85 configs += [ "//build/config/compiler:no_chromium_code" ] | 52 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 86 | 53 |
| 87 if (is_win) { | 54 if (is_win) { |
| 88 cflags = [ "/wd4267" ] # size_t -> int conversion. | 55 cflags = [ "/wd4267" ] # size_t -> int conversion. |
| 89 } | 56 } |
| 90 } | 57 } |
| 91 | 58 |
| 92 # As in the corresponding gyp file, this just builds the core interfaces for | 59 # As in the corresponding gyp file, this just builds the core interfaces for |
| 93 # CLD2. You must still declare a dependency on a specific data set, either | 60 # CLD2. You must still declare a dependency on a specific data set, either |
| 94 # cld2_dynamic or cld2_static. | 61 # cld2_dynamic or cld2_static. |
| 95 source_set("cld_2") { | 62 source_set("cld_2") { |
| 96 sources = core_files | 63 sources = gypi_values.cld2_core_sources |
| 97 include_dirs = [ | 64 include_dirs = [ |
| 98 "src/internal", | 65 "src/internal", |
| 99 "src/public", | 66 "src/public", |
| 100 ] | 67 ] |
| 101 | 68 |
| 102 configs -= [ "//build/config/compiler:chromium_code" ] | 69 configs -= [ "//build/config/compiler:chromium_code" ] |
| 103 configs += [ "//build/config/compiler:no_chromium_code" ] | 70 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 104 | 71 |
| 105 if (is_win) { | 72 if (is_win) { |
| 106 cflags = [ "/wd4267" ] # size_t -> int conversion. | 73 cflags = [ "/wd4267" ] # size_t -> int conversion. |
| 107 } | 74 } |
| 108 } | 75 } |
| 109 | 76 |
| 110 | 77 |
| 111 source_set("cld2_platform_impl") { | 78 source_set("cld2_platform_impl") { |
| 112 # TODO: Make this something that can be overridden | 79 deps = [] |
| 113 deps = [ ":cld2_static" ] | 80 if (cld2_platform_support == "static") { |
| 81 deps += [ ":cld2_static" ] |
| 82 } else if (cld2_platform_support == "dynamic") { |
| 83 deps += [ ":cld2_dynamic" ] |
| 84 } |
| 114 } | 85 } |
| 115 | 86 |
| 116 static_library("cld2_static") { | 87 static_library("cld2_static") { |
| 117 sources = core_files + core_impl_files | 88 sources = gypi_values.cld2_core_impl_sources |
| 118 include_dirs = [ | 89 include_dirs = [ |
| 119 "src/internal", | 90 "src/internal", |
| 120 "src/public", | 91 "src/public", |
| 121 ] | 92 ] |
| 122 | 93 |
| 123 deps = [ ":cld2_data" ] | 94 deps = [ ":cld_2", ":cld2_data" ] |
| 124 configs -= [ "//build/config/compiler:chromium_code" ] | 95 configs -= [ "//build/config/compiler:chromium_code" ] |
| 125 configs += [ "//build/config/compiler:no_chromium_code" ] | 96 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 126 | 97 |
| 127 if (is_win) { | 98 if (is_win) { |
| 128 cflags = [ "/wd4267" ] # size_t -> int conversion. | 99 cflags = [ "/wd4267" ] # size_t -> int conversion. |
| 129 } | 100 } |
| 130 } | 101 } |
| 131 | 102 |
| 132 config("cld2_dynamic_mode_config") { | 103 config("cld2_dynamic_mode_config") { |
| 133 defines = [ "CLD2_DYNAMIC_MODE" ] | 104 defines = [ "CLD2_DYNAMIC_MODE" ] |
| 134 } | 105 } |
| 135 | 106 |
| 136 static_library("cld2_dynamic") { | 107 static_library("cld2_dynamic") { |
| 137 sources = core_files + core_impl_files + data_loader_files | 108 sources = gypi_values.cld2_core_sources + gypi_values.cld2_core_impl_sources +
gypi_values.cld2_dynamic_data_loader_sources |
| 138 include_dirs = [ | 109 include_dirs = [ |
| 139 "src/internal", | 110 "src/internal", |
| 140 "src/public", | 111 "src/public", |
| 141 ] | 112 ] |
| 142 | 113 |
| 143 configs -= [ "//build/config/compiler:chromium_code" ] | 114 configs -= [ "//build/config/compiler:chromium_code" ] |
| 144 configs += [ "//build/config/compiler:no_chromium_code", ":cld2_dynamic_mode_c
onfig" ] | 115 configs += [ "//build/config/compiler:no_chromium_code", ":cld2_dynamic_mode_c
onfig" ] |
| 145 | 116 |
| 146 if (is_win) { | 117 if (is_win) { |
| 147 cflags = [ "/wd4267" ] # size_t -> int conversion. | 118 cflags = [ "/wd4267" ] # size_t -> int conversion. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 165 deps = [ ":cld2_data", ":cld2_dynamic" ] | 136 deps = [ ":cld2_data", ":cld2_dynamic" ] |
| 166 | 137 |
| 167 configs -= [ "//build/config/compiler:chromium_code" ] | 138 configs -= [ "//build/config/compiler:chromium_code" ] |
| 168 configs += [ "//build/config/compiler:no_chromium_code", ":cld2_dynamic_mode
_config" ] | 139 configs += [ "//build/config/compiler:no_chromium_code", ":cld2_dynamic_mode
_config" ] |
| 169 | 140 |
| 170 if (is_win) { | 141 if (is_win) { |
| 171 cflags = [ "/wd4267" ] # size_t -> int conversion. | 142 cflags = [ "/wd4267" ] # size_t -> int conversion. |
| 172 } | 143 } |
| 173 } | 144 } |
| 174 } | 145 } |
| OLD | NEW |