1# Copyright 2016 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6declare_args() { 7 skia_use_system_icu = is_official_build 8} 9 10import("../third_party.gni") 11import("icu.gni") 12 13if (skia_use_system_icu) { 14 system("icu") { 15 libs = [ "icuuc" ] 16 defines = [ "U_USING_ICU_NAMESPACE=0" ] 17 } 18} else { 19 data_assembly = "$target_gen_dir/icudtl_dat.S" 20 data_dir = "../externals/icu/" 21 if (is_android) { 22 data_dir += "android" 23 } else if (is_ios) { 24 data_dir += "ios" 25 } else { 26 data_dir += "common" 27 } 28 action("make_data_assembly") { 29 script = "../externals/icu/scripts/make_data_assembly.py" 30 inputs = [ 31 "$data_dir/icudtl.dat", 32 ] 33 outputs = [ 34 "$data_assembly", 35 ] 36 args = [ 37 rebase_path(inputs[0], root_build_dir), 38 rebase_path(data_assembly, root_build_dir), 39 ] 40 if (is_mac || is_ios) { 41 args += [ "--mac" ] 42 } 43 } 44 45 third_party("icu") { 46 public_include_dirs = [ 47 "../externals/icu/source/common", 48 "../externals/icu/source/i18n", 49 ".", 50 ] 51 public_defines = [ "U_USING_ICU_NAMESPACE=0" ] 52 configs -= [ "//gn:no_rtti" ] 53 defines = [ 54 # http://userguide.icu-project.org/howtouseicu 55 "U_COMMON_IMPLEMENTATION", 56 "U_STATIC_IMPLEMENTATION", 57 "U_ENABLE_DYLOAD=0", 58 "U_I18N_IMPLEMENTATION", 59 ] 60 sources = icu_sources 61 if (is_win) { 62 deps = [ 63 ":icudata", 64 ] 65 public_defines += [ 66 "U_NOEXCEPT=", 67 "U_STATIC_IMPLEMENTATION", 68 ] 69 libs = [ "Advapi32.lib" ] 70 sources += [ "../externals/icu/source/stubdata/stubdata.cpp" ] 71 } else { 72 sources += [ "$data_assembly" ] 73 deps = [ 74 ":make_data_assembly", 75 ] 76 } 77 } 78 if (is_win) { 79 copy("icudata") { 80 sources = [ 81 "../externals/icu/windows/icudt.dll", 82 ] 83 outputs = [ 84 "$root_out_dir/icudt.dll", 85 ] 86 data = outputs 87 } 88 } 89} 90