blob: 424814a93b0c2bccffa7f451734900898f2f5332 [file] [log] [blame]
halcanary19a97202016-08-03 15:08:04 -07001# 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() {
Mike Kleine459afd2017-03-03 09:21:30 -05007 skia_use_system_icu = is_official_build
halcanary19a97202016-08-03 15:08:04 -07008}
9
10import("../third_party.gni")
Hal Canary70041cf2019-01-28 21:33:21 -050011import("icu.gni")
halcanary19a97202016-08-03 15:08:04 -070012
Mike Klein10d665d2016-11-01 11:46:10 -040013if (skia_use_system_icu) {
14 system("icu") {
15 libs = [ "icuuc" ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -040016 defines = [ "U_USING_ICU_NAMESPACE=0" ]
Mike Klein3eb71212016-10-11 17:08:53 -040017 }
Mike Klein10d665d2016-11-01 11:46:10 -040018} else {
Brian Osman66c26ac2018-12-07 13:43:57 -050019 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
Mike Klein10d665d2016-11-01 11:46:10 -040045 third_party("icu") {
Hal Canary0e07ad72018-02-08 13:06:56 -050046 public_include_dirs = [
47 "../externals/icu/source/common",
Brian Osman66c26ac2018-12-07 13:43:57 -050048 "../externals/icu/source/i18n",
Hal Canary0e07ad72018-02-08 13:06:56 -050049 ".",
50 ]
Ben Wagnera25fbef2017-08-30 13:56:19 -040051 public_defines = [ "U_USING_ICU_NAMESPACE=0" ]
Mike Klein10d665d2016-11-01 11:46:10 -040052 configs -= [ "//gn:no_rtti" ]
Mike Klein10d665d2016-11-01 11:46:10 -040053 defines = [
54 # http://userguide.icu-project.org/howtouseicu
55 "U_COMMON_IMPLEMENTATION",
56 "U_STATIC_IMPLEMENTATION",
Hal Canary0e07ad72018-02-08 13:06:56 -050057 "U_ENABLE_DYLOAD=0",
Brian Osman66c26ac2018-12-07 13:43:57 -050058 "U_I18N_IMPLEMENTATION",
Mike Klein10d665d2016-11-01 11:46:10 -040059 ]
Hal Canary70041cf2019-01-28 21:33:21 -050060 sources = icu_sources
Hal Canary0e07ad72018-02-08 13:06:56 -050061 if (is_win) {
62 deps = [
63 ":icudata",
64 ]
65 public_defines += [
66 "U_NOEXCEPT=",
67 "U_STATIC_IMPLEMENTATION",
68 ]
69 libs = [ "Advapi32.lib" ]
Brian Osman66c26ac2018-12-07 13:43:57 -050070 sources += [ "../externals/icu/source/stubdata/stubdata.cpp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -050071 } else {
Brian Osman66c26ac2018-12-07 13:43:57 -050072 sources += [ "$data_assembly" ]
73 deps = [
74 ":make_data_assembly",
75 ]
Hal Canary0e07ad72018-02-08 13:06:56 -050076 }
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 }
Mike Klein10d665d2016-11-01 11:46:10 -040088 }
halcanary19a97202016-08-03 15:08:04 -070089}