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 3 # found in the LICENSE file. 4 5 import("//build/config/features.gni") 6 7 # May need to make this a build arg, keep the name for now to match gyp 8 cld2_table_size = 2 9 10 core_files = [ 11 "src/internal/cld2tablesummary.h", 12 "src/internal/cldutil.cc", 13 "src/internal/cldutil.h", 14 "src/internal/cldutil_shared.cc", 15 "src/internal/cldutil_shared.h", 16 "src/internal/compact_lang_det.cc", 17 "src/internal/compact_lang_det_hint_code.cc", 18 "src/internal/compact_lang_det_hint_code.h", 19 "src/internal/compact_lang_det_impl.cc", 20 "src/internal/compact_lang_det_impl.h", 21 "src/internal/debug.h", 22 "src/internal/debug_empty.cc", 23 "src/internal/fixunicodevalue.cc", 24 "src/internal/fixunicodevalue.h", 25 "src/internal/generated_distinct_bi_0.cc", 26 "src/internal/generated_entities.cc", 27 "src/internal/generated_language.cc", 28 "src/internal/generated_language.h", 29 "src/internal/generated_ulscript.cc", 30 "src/internal/generated_ulscript.h", 31 "src/internal/getonescriptspan.cc", 32 "src/internal/getonescriptspan.h", 33 "src/internal/integral_types.h", 34 "src/internal/lang_script.cc", 35 "src/internal/lang_script.h", 36 "src/internal/langspan.h", 37 "src/internal/offsetmap.cc", 38 "src/internal/offsetmap.h", 39 "src/internal/port.h", 40 "src/internal/scoreonescriptspan.cc", 41 "src/internal/scoreonescriptspan.h", 42 "src/internal/stringpiece.h", 43 "src/internal/tote.cc", 44 "src/internal/tote.h", 45 "src/internal/utf8prop_lettermarkscriptnum.h", 46 "src/internal/utf8repl_lettermarklower.h", 47 "src/internal/utf8scannot_lettermarkspecial.h", 48 "src/internal/utf8statetable.cc", 49 "src/internal/utf8statetable.h", 50 "src/public/compact_lang_det.h", 51 "src/public/encodings.h", 52 ] 53 54 data_loader_files = [ 55 "src/internal/cld2_dynamic_data.h", 56 "src/internal/cld2_dynamic_data.cc", 57 "src/internal/cld2_dynamic_data_loader.h", 58 "src/internal/cld2_dynamic_data_loader.cc", 59 ] 60 61 source_set("cld2_data") { 62 sources = [ 63 "src/internal/cld2_generated_cjk_compatible.cc", 64 "src/internal/cld2_generated_deltaoctachrome0122.cc", 65 "src/internal/cld2_generated_distinctoctachrome0122.cc", 66 "src/internal/cld_generated_cjk_delta_bi_4.cc", 67 "src/internal/cld_generated_cjk_uni_prop_80.cc", 68 "src/internal/cld_generated_score_quad_octa_0122_2.cc", 69 ] 70 if (cld2_table_size == 0) { 71 sources += [ "src/internal/cld2_generated_quadchrome0122_16.cc" ] 72 } else if (cld2_table_size == 1) { 73 sources += [ "src/internal/cld2_generated_quadchrome0122_19.cc" ] 74 } else if (cld2_table_size == 2) { 75 sources += [ "src/internal/cld2_generated_quadchrome0122_2.cc" ] 76 } 77 78 include_dirs = [ 79 "src/internal", 80 "src/public", 81 ] 82 83 configs -= [ "//build/config/compiler:chromium_code" ] 84 configs += [ "//build/config/compiler:no_chromium_code" ] 85 86 if (is_win) { 87 cflags = [ "/wd4267" ] # size_t -> int conversion. 88 } 89 } 90 91 static_library("cld2_static") { 92 sources = core_files 93 include_dirs = [ 94 "src/internal", 95 "src/public", 96 ] 97 98 deps = [ ":cld2_data" ] 99 configs -= [ "//build/config/compiler:chromium_code" ] 100 configs += [ "//build/config/compiler:no_chromium_code" ] 101 102 if (is_win) { 103 cflags = [ "/wd4267" ] # size_t -> int conversion. 104 } 105 } 106 107 # Meta-target for convenience; dependents don't need to know if this if CLD2 108 # is in dynamic or static configuration. 109 group("cld_2") { 110 if (cld2_data_source == "static") { 111 deps = [ ":cld2_static" ] 112 } else { 113 deps = [ ":cld2_dynamic" ] 114 } 115 } 116 117 config("cld2_dynamic_mode_config") { 118 defines = [ "CLD2_DYNAMIC_MODE" ] 119 } 120 121 static_library("cld2_dynamic") { 122 sources = core_files + data_loader_files 123 all_dependent_configs = [ ":cld2_dynamic_mode_config" ] 124 include_dirs = [ 125 "src/internal", 126 "src/public", 127 ] 128 129 configs -= [ "//build/config/compiler:chromium_code" ] 130 configs += [ "//build/config/compiler:no_chromium_code" ] 131 132 if (is_win) { 133 cflags = [ "/wd4267" ] # size_t -> int conversion. 134 } 135 } 136 137 # Does not build on Windows. 138 if (!is_win) { 139 executable("cld_2_dynamic_data_tool") { 140 sources = [ 141 "src/internal/cld2_dynamic_data_extractor.h", 142 "src/internal/cld2_dynamic_data_extractor.cc", 143 "src/internal/cld2_dynamic_data_tool.cc", 144 ] 145 146 include_dirs = [ 147 "src/internal", 148 "src/public", 149 ] 150 151 deps = [ ":cld2_data", ":cld2_dynamic" ] 152 153 configs -= [ "//build/config/compiler:chromium_code" ] 154 configs += [ "//build/config/compiler:no_chromium_code" ] 155 156 if (is_win) { 157 cflags = [ "/wd4267" ] # size_t -> int conversion. 158 } 159 } 160 } 161