halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 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 | |
| 6 | declare_args() { |
Mike Klein | e459afd | 2017-03-03 09:21:30 -0500 | [diff] [blame] | 7 | skia_use_system_icu = is_official_build |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 8 | } |
| 9 | |
| 10 | import("../third_party.gni") |
Hal Canary | 70041cf | 2019-01-28 21:33:21 -0500 | [diff] [blame^] | 11 | import("icu.gni") |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 12 | |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 13 | if (skia_use_system_icu) { |
| 14 | system("icu") { |
| 15 | libs = [ "icuuc" ] |
Ben Wagner | be6ae5b | 2017-08-31 16:45:23 -0400 | [diff] [blame] | 16 | defines = [ "U_USING_ICU_NAMESPACE=0" ] |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 17 | } |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 18 | } else { |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 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 | |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 45 | third_party("icu") { |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 46 | public_include_dirs = [ |
| 47 | "../externals/icu/source/common", |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 48 | "../externals/icu/source/i18n", |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 49 | ".", |
| 50 | ] |
Ben Wagner | a25fbef | 2017-08-30 13:56:19 -0400 | [diff] [blame] | 51 | public_defines = [ "U_USING_ICU_NAMESPACE=0" ] |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 52 | configs -= [ "//gn:no_rtti" ] |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 53 | defines = [ |
| 54 | # http://userguide.icu-project.org/howtouseicu |
| 55 | "U_COMMON_IMPLEMENTATION", |
| 56 | "U_STATIC_IMPLEMENTATION", |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 57 | "U_ENABLE_DYLOAD=0", |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 58 | "U_I18N_IMPLEMENTATION", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 59 | ] |
Hal Canary | 70041cf | 2019-01-28 21:33:21 -0500 | [diff] [blame^] | 60 | sources = icu_sources |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 61 | if (is_win) { |
| 62 | deps = [ |
| 63 | ":icudata", |
| 64 | ] |
| 65 | public_defines += [ |
| 66 | "U_NOEXCEPT=", |
| 67 | "U_STATIC_IMPLEMENTATION", |
| 68 | ] |
| 69 | libs = [ "Advapi32.lib" ] |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 70 | sources += [ "../externals/icu/source/stubdata/stubdata.cpp" ] |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 71 | } else { |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 72 | sources += [ "$data_assembly" ] |
| 73 | deps = [ |
| 74 | ":make_data_assembly", |
| 75 | ] |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 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 | } |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 88 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 89 | } |