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("//third_party/icu/config.gni") 6 7 # Meta target that includes both icuuc and icui18n. Most targets want both. 8 # You can depend on the individually if you need to. 9 group("icu") { 10 deps = [ 11 ":icui18n", 12 ":icuuc", 13 ] 14 } 15 16 # Shared config used by ICU and all dependents. 17 config("icu_config") { 18 defines = [ 19 "U_USING_ICU_NAMESPACE=0", 20 "U_ENABLE_DYLOAD=0", 21 ] 22 23 if (component_mode != "shared_library") { 24 defines += [ "U_STATIC_IMPLEMENTATION" ] 25 } 26 27 include_dirs = [ 28 "source/common", 29 "source/i18n", 30 ] 31 } 32 33 # Config used only by ICU code. 34 config("icu_code") { 35 cflags = [] 36 if (is_win) { 37 # Disable some compiler warnings. 38 cflags += [ 39 "/wd4005", # Macro redefinition. 40 "/wd4068", # Unknown pragmas. 41 "/wd4267", # Conversion from size_t on 64-bits. 42 "/wd4996", # Deprecated functions. 43 ] 44 } else if (is_linux) { 45 cflags += [ 46 # Since ICU wants to internally use its own deprecated APIs, don't 47 # complain about it. 48 "-Wno-deprecated-declarations", 49 "-Wno-unused-function", 50 ] 51 } 52 if (is_clang) { 53 cflags += [ 54 "-Wno-deprecated-declarations", 55 "-Wno-logical-op-parentheses", 56 "-Wno-tautological-compare", 57 "-Wno-switch", 58 ] 59 } 60 } 61 62 component("icui18n") { 63 sources = [ 64 "source/i18n/alphaindex.cpp", 65 "source/i18n/anytrans.cpp", 66 "source/i18n/astro.cpp", 67 "source/i18n/basictz.cpp", 68 "source/i18n/bocsu.cpp", 69 "source/i18n/brktrans.cpp", 70 "source/i18n/buddhcal.cpp", 71 "source/i18n/calendar.cpp", 72 "source/i18n/casetrn.cpp", 73 "source/i18n/cecal.cpp", 74 "source/i18n/chnsecal.cpp", 75 "source/i18n/choicfmt.cpp", 76 "source/i18n/coleitr.cpp", 77 "source/i18n/coll.cpp", 78 "source/i18n/compactdecimalformat.cpp", 79 "source/i18n/coptccal.cpp", 80 "source/i18n/cpdtrans.cpp", 81 "source/i18n/csdetect.cpp", 82 "source/i18n/csmatch.cpp", 83 "source/i18n/csr2022.cpp", 84 "source/i18n/csrecog.cpp", 85 "source/i18n/csrmbcs.cpp", 86 "source/i18n/csrsbcs.cpp", 87 "source/i18n/csrucode.cpp", 88 "source/i18n/csrutf8.cpp", 89 "source/i18n/curramt.cpp", 90 "source/i18n/currfmt.cpp", 91 "source/i18n/currpinf.cpp", 92 "source/i18n/currunit.cpp", 93 "source/i18n/dangical.cpp", 94 "source/i18n/datefmt.cpp", 95 "source/i18n/dcfmtsym.cpp", 96 "source/i18n/decContext.c", 97 "source/i18n/decfmtst.cpp", 98 "source/i18n/decimfmt.cpp", 99 "source/i18n/decNumber.c", 100 "source/i18n/digitlst.cpp", 101 "source/i18n/dtfmtsym.cpp", 102 "source/i18n/dtitvfmt.cpp", 103 "source/i18n/dtitvinf.cpp", 104 "source/i18n/dtptngen.cpp", 105 "source/i18n/dtrule.cpp", 106 "source/i18n/esctrn.cpp", 107 "source/i18n/ethpccal.cpp", 108 "source/i18n/fmtable_cnv.cpp", 109 "source/i18n/fmtable.cpp", 110 "source/i18n/format.cpp", 111 "source/i18n/fphdlimp.cpp", 112 "source/i18n/fpositer.cpp", 113 "source/i18n/funcrepl.cpp", 114 "source/i18n/gender.cpp", 115 "source/i18n/gregocal.cpp", 116 "source/i18n/gregoimp.cpp", 117 "source/i18n/hebrwcal.cpp", 118 "source/i18n/identifier_info.cpp", 119 "source/i18n/indiancal.cpp", 120 "source/i18n/inputext.cpp", 121 "source/i18n/islamcal.cpp", 122 "source/i18n/japancal.cpp", 123 "source/i18n/locdspnm.cpp", 124 "source/i18n/measfmt.cpp", 125 "source/i18n/measure.cpp", 126 "source/i18n/msgfmt.cpp", 127 "source/i18n/name2uni.cpp", 128 "source/i18n/nfrs.cpp", 129 "source/i18n/nfrule.cpp", 130 "source/i18n/nfsubs.cpp", 131 "source/i18n/nortrans.cpp", 132 "source/i18n/nultrans.cpp", 133 "source/i18n/numfmt.cpp", 134 "source/i18n/numsys.cpp", 135 "source/i18n/olsontz.cpp", 136 "source/i18n/persncal.cpp", 137 "source/i18n/plurfmt.cpp", 138 "source/i18n/plurrule.cpp", 139 "source/i18n/quant.cpp", 140 "source/i18n/rbnf.cpp", 141 "source/i18n/rbt.cpp", 142 "source/i18n/rbt_data.cpp", 143 "source/i18n/rbt_pars.cpp", 144 "source/i18n/rbt_rule.cpp", 145 "source/i18n/rbt_set.cpp", 146 "source/i18n/rbtz.cpp", 147 "source/i18n/regexcmp.cpp", 148 "source/i18n/regeximp.cpp", 149 "source/i18n/regexst.cpp", 150 "source/i18n/regextxt.cpp", 151 "source/i18n/region.cpp", 152 "source/i18n/reldtfmt.cpp", 153 "source/i18n/rematch.cpp", 154 "source/i18n/remtrans.cpp", 155 "source/i18n/repattrn.cpp", 156 "source/i18n/scriptset.cpp", 157 "source/i18n/search.cpp", 158 "source/i18n/selfmt.cpp", 159 "source/i18n/simpletz.cpp", 160 "source/i18n/smpdtfmt.cpp", 161 "source/i18n/smpdtfst.cpp", 162 "source/i18n/sortkey.cpp", 163 "source/i18n/strmatch.cpp", 164 "source/i18n/strrepl.cpp", 165 "source/i18n/stsearch.cpp", 166 "source/i18n/taiwncal.cpp", 167 "source/i18n/tblcoll.cpp", 168 "source/i18n/timezone.cpp", 169 "source/i18n/titletrn.cpp", 170 "source/i18n/tmunit.cpp", 171 "source/i18n/tmutamt.cpp", 172 "source/i18n/tmutfmt.cpp", 173 "source/i18n/tolowtrn.cpp", 174 "source/i18n/toupptrn.cpp", 175 "source/i18n/translit.cpp", 176 "source/i18n/transreg.cpp", 177 "source/i18n/tridpars.cpp", 178 "source/i18n/tzfmt.cpp", 179 "source/i18n/tzgnames.cpp", 180 "source/i18n/tznames.cpp", 181 "source/i18n/tznames_impl.cpp", 182 "source/i18n/tzrule.cpp", 183 "source/i18n/tztrans.cpp", 184 "source/i18n/ucal.cpp", 185 "source/i18n/ucln_in.c", 186 "source/i18n/ucol_bld.cpp", 187 "source/i18n/ucol_cnt.cpp", 188 "source/i18n/ucol.cpp", 189 "source/i18n/ucoleitr.cpp", 190 "source/i18n/ucol_elm.cpp", 191 "source/i18n/ucol_res.cpp", 192 "source/i18n/ucol_sit.cpp", 193 "source/i18n/ucol_tok.cpp", 194 "source/i18n/ucol_wgt.cpp", 195 "source/i18n/ucsdet.cpp", 196 "source/i18n/ucurr.cpp", 197 "source/i18n/udat.cpp", 198 "source/i18n/udateintervalformat.cpp", 199 "source/i18n/udatpg.cpp", 200 "source/i18n/ulocdata.c", 201 "source/i18n/umsg.cpp", 202 "source/i18n/unesctrn.cpp", 203 "source/i18n/uni2name.cpp", 204 "source/i18n/unum.cpp", 205 "source/i18n/unumsys.cpp", 206 "source/i18n/upluralrules.cpp", 207 "source/i18n/uregexc.cpp", 208 "source/i18n/uregex.cpp", 209 "source/i18n/uregion.cpp", 210 "source/i18n/usearch.cpp", 211 "source/i18n/uspoof_build.cpp", 212 "source/i18n/uspoof_conf.cpp", 213 "source/i18n/uspoof.cpp", 214 "source/i18n/uspoof_impl.cpp", 215 "source/i18n/uspoof_wsconf.cpp", 216 "source/i18n/utmscale.c", 217 "source/i18n/utrans.cpp", 218 "source/i18n/vtzone.cpp", 219 "source/i18n/vzone.cpp", 220 "source/i18n/windtfmt.cpp", 221 "source/i18n/winnmfmt.cpp", 222 "source/i18n/wintzimpl.cpp", 223 "source/i18n/zonemeta.cpp", 224 "source/i18n/zrule.cpp", 225 "source/i18n/ztrans.cpp", 226 ] 227 defines = [ 228 "U_I18N_IMPLEMENTATION", 229 ] 230 deps = [ 231 ":icuuc", 232 ] 233 234 # ICU uses RTTI, replace the default "no rtti" config. 235 configs -= [ 236 "//build/config/compiler:no_rtti", # ICU uses RTTI. 237 "//build/config/compiler:chromium_code", 238 ] 239 configs += [ 240 "//build/config/compiler:rtti", 241 "//build/config/compiler:no_chromium_code", 242 ] 243 244 configs += [ ":icu_code" ] 245 public_configs = [ ":icu_config" ] 246 247 cflags = [] 248 if (is_android || is_linux) { 249 cflags += [ 250 # ICU uses its own deprecated functions. 251 "-Wno-deprecated-declarations", 252 ] 253 } 254 if (is_clang) { 255 # uspoof.h has a U_NAMESPACE_USE macro. That's a bug, 256 # the header should use U_NAMESPACE_BEGIN instead. 257 # http://bugs.icu-project.org/trac/ticket/9054 258 configs -= [ "//build/config/clang:extra_warnings" ] 259 260 cflags += [ 261 "-Wno-header-hygiene", 262 # Looks like a real issue, see http://crbug.com/114660 263 "-Wno-return-type-c-linkage", 264 ] 265 } 266 } 267 268 component("icuuc") { 269 sources = [ 270 "source/common/appendable.cpp", 271 "source/common/bmpset.cpp", 272 "source/common/brkeng.cpp", 273 "source/common/brkiter.cpp", 274 "source/common/bytestream.cpp", 275 "source/common/bytestriebuilder.cpp", 276 "source/common/bytestrie.cpp", 277 "source/common/bytestrieiterator.cpp", 278 "source/common/caniter.cpp", 279 "source/common/chariter.cpp", 280 "source/common/charstr.cpp", 281 "source/common/cmemory.c", 282 "source/common/cstring.c", 283 "source/common/cwchar.c", 284 "source/common/dictbe.cpp", 285 "source/common/dictionarydata.cpp", 286 "source/common/dtintrv.cpp", 287 "source/common/errorcode.cpp", 288 "source/common/filterednormalizer2.cpp", 289 "source/common/icudataver.c", 290 "source/common/icuplug.c", 291 "source/common/listformatter.cpp", 292 "source/common/locavailable.cpp", 293 "source/common/locbased.cpp", 294 "source/common/locdispnames.cpp", 295 "source/common/locid.cpp", 296 "source/common/loclikely.cpp", 297 "source/common/locmap.c", 298 "source/common/locresdata.cpp", 299 "source/common/locutil.cpp", 300 "source/common/messagepattern.cpp", 301 "source/common/normalizer2.cpp", 302 "source/common/normalizer2impl.cpp", 303 "source/common/normlzr.cpp", 304 "source/common/parsepos.cpp", 305 "source/common/patternprops.cpp", 306 "source/common/propname.cpp", 307 "source/common/propsvec.c", 308 "source/common/punycode.cpp", 309 "source/common/putil.cpp", 310 "source/common/rbbi.cpp", 311 "source/common/rbbidata.cpp", 312 "source/common/rbbinode.cpp", 313 "source/common/rbbirb.cpp", 314 "source/common/rbbiscan.cpp", 315 "source/common/rbbisetb.cpp", 316 "source/common/rbbistbl.cpp", 317 "source/common/rbbitblb.cpp", 318 "source/common/resbund_cnv.cpp", 319 "source/common/resbund.cpp", 320 "source/common/ruleiter.cpp", 321 "source/common/schriter.cpp", 322 "source/common/serv.cpp", 323 "source/common/servlk.cpp", 324 "source/common/servlkf.cpp", 325 "source/common/servls.cpp", 326 "source/common/servnotf.cpp", 327 "source/common/servrbf.cpp", 328 "source/common/servslkf.cpp", 329 "source/common/stringpiece.cpp", 330 "source/common/stringtriebuilder.cpp", 331 "source/common/uarrsort.c", 332 "source/common/ubidi.c", 333 "source/common/ubidiln.c", 334 "source/common/ubidi_props.c", 335 "source/common/ubidiwrt.c", 336 "source/common/ubrk.cpp", 337 "source/common/ucase.cpp", 338 "source/common/ucasemap.cpp", 339 "source/common/ucasemap_titlecase_brkiter.cpp", 340 "source/common/ucat.c", 341 "source/common/uchar.c", 342 "source/common/ucharstriebuilder.cpp", 343 "source/common/ucharstrie.cpp", 344 "source/common/ucharstrieiterator.cpp", 345 "source/common/uchriter.cpp", 346 "source/common/ucln_cmn.c", 347 "source/common/ucmndata.c", 348 "source/common/ucnv2022.cpp", 349 "source/common/ucnv_bld.cpp", 350 "source/common/ucnvbocu.cpp", 351 "source/common/ucnv.c", 352 "source/common/ucnv_cb.c", 353 "source/common/ucnv_cnv.c", 354 "source/common/ucnv_ct.c", 355 "source/common/ucnvdisp.c", 356 "source/common/ucnv_err.c", 357 "source/common/ucnv_ext.cpp", 358 "source/common/ucnvhz.c", 359 "source/common/ucnv_io.cpp", 360 "source/common/ucnvisci.c", 361 "source/common/ucnvlat1.c", 362 "source/common/ucnv_lmb.c", 363 "source/common/ucnvmbcs.c", 364 "source/common/ucnvscsu.c", 365 "source/common/ucnvsel.cpp", 366 "source/common/ucnv_set.c", 367 "source/common/ucnv_u16.c", 368 "source/common/ucnv_u32.c", 369 "source/common/ucnv_u7.c", 370 "source/common/ucnv_u8.c", 371 "source/common/ucol_swp.cpp", 372 "source/common/udata.cpp", 373 "source/common/udatamem.c", 374 "source/common/udataswp.c", 375 "source/common/uenum.c", 376 "source/common/uhash.c", 377 "source/common/uhash_us.cpp", 378 "source/common/uidna.cpp", 379 "source/common/uinit.cpp", 380 "source/common/uinvchar.c", 381 "source/common/uiter.cpp", 382 "source/common/ulist.c", 383 "source/common/uloc.cpp", 384 "source/common/uloc_tag.c", 385 "source/common/umapfile.c", 386 "source/common/umath.c", 387 "source/common/umutex.cpp", 388 "source/common/unames.cpp", 389 "source/common/unifilt.cpp", 390 "source/common/unifunct.cpp", 391 "source/common/uniset_closure.cpp", 392 "source/common/uniset.cpp", 393 "source/common/uniset_props.cpp", 394 "source/common/unisetspan.cpp", 395 "source/common/unistr_case.cpp", 396 "source/common/unistr_case_locale.cpp", 397 "source/common/unistr_cnv.cpp", 398 "source/common/unistr.cpp", 399 "source/common/unistr_props.cpp", 400 "source/common/unistr_titlecase_brkiter.cpp", 401 "source/common/unormcmp.cpp", 402 "source/common/unorm.cpp", 403 "source/common/unorm_it.c", 404 "source/common/uobject.cpp", 405 "source/common/uprops.cpp", 406 "source/common/uresbund.cpp", 407 "source/common/ures_cnv.c", 408 "source/common/uresdata.c", 409 "source/common/usc_impl.c", 410 "source/common/uscript.c", 411 "source/common/uscript_props.cpp", 412 "source/common/uset.cpp", 413 "source/common/usetiter.cpp", 414 "source/common/uset_props.cpp", 415 "source/common/ushape.cpp", 416 "source/common/usprep.cpp", 417 "source/common/ustack.cpp", 418 "source/common/ustrcase.cpp", 419 "source/common/ustrcase_locale.cpp", 420 "source/common/ustr_cnv.c", 421 "source/common/ustrenum.cpp", 422 "source/common/ustrfmt.c", 423 "source/common/ustring.cpp", 424 "source/common/ustr_titlecase_brkiter.cpp", 425 "source/common/ustrtrns.cpp", 426 "source/common/ustr_wcs.cpp", 427 "source/common/utext.cpp", 428 "source/common/utf_impl.c", 429 "source/common/util.cpp", 430 "source/common/util_props.cpp", 431 "source/common/utrace.c", 432 "source/common/utrie2_builder.cpp", 433 "source/common/utrie2.cpp", 434 "source/common/utrie.cpp", 435 "source/common/uts46.cpp", 436 "source/common/utypes.c", 437 "source/common/uvector.cpp", 438 "source/common/uvectr32.cpp", 439 "source/common/uvectr64.cpp", 440 "source/common/wintz.c", 441 ] 442 defines = [ 443 "U_COMMON_IMPLEMENTATION", 444 ] 445 deps = [ 446 ":icudata", 447 ] 448 configs += [ ":icu_code" ] 449 450 configs -= [ 451 "//build/config/compiler:no_rtti", # ICU uses RTTI. 452 "//build/config/compiler:chromium_code", 453 ] 454 configs += [ 455 "//build/config/compiler:rtti", 456 "//build/config/compiler:no_chromium_code", 457 ] 458 459 public_configs = [ ":icu_config" ] 460 461 if (is_win || icu_use_data_file) { 462 sources += [ "source/stubdata/stubdata.c" ] 463 } 464 } 465 466 # TODO(GYP) support use_system_icu. 467 if (icu_use_data_file) { 468 if (is_ios) { 469 # TODO(GYP): Support mac resource bundle shown below. 470 # 'link_settings': { 471 # 'mac_bundle_resources': [ 472 # 'source/data/in/icudtl.dat', 473 # ], 474 # } 475 } else { 476 copy("icudata") { 477 if (is_android) { 478 sources = [ "android/icudtl.dat" ] 479 } else { 480 sources = [ "source/data/in/icudtl.dat" ] 481 } 482 483 outputs = [ "$root_out_dir/icudtl.dat" ] 484 } 485 } 486 } else { 487 if (is_win) { 488 # On Windows the target DLL is pre-built so just use a copy rule. 489 copy("icudata") { 490 sources = [ "windows/icudt.dll" ] 491 outputs = [ "$root_out_dir/icudt.dll" ] 492 } 493 } else { 494 source_set("icudata") { 495 # These are hand-generated, but will do for now. 496 # 497 # TODO(GYP): Gyp has considerations here for QNX and for the host toolchain 498 # that have not been ported over. 499 if (is_linux) { 500 sources = [ "linux/icudtl_dat.S" ] 501 } else if (is_mac) { 502 sources = [ "mac/icudtl_dat.S" ] 503 } else if (is_android) { 504 sources = [ "android/icudtl_dat.S" ] 505 } else { 506 assert(false, "No icu data for this platform") 507 } 508 defines = [ "U_HIDE_DATA_SYMBOL" ] 509 } 510 } 511 } 512