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 |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 8 | skia_icu_use_prebuilt_data = true |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 9 | } |
| 10 | |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 11 | import("../../gn/skia.gni") |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 12 | import("../third_party.gni") |
Hal Canary | 70041cf | 2019-01-28 21:33:21 -0500 | [diff] [blame] | 13 | import("icu.gni") |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 14 | |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 15 | if (skia_use_icu) { |
| 16 | if (skia_use_system_icu) { |
| 17 | system("icu") { |
| 18 | libs = [ "icuuc" ] |
| 19 | defines = [ "U_USING_ICU_NAMESPACE=0" ] |
| 20 | } |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 21 | } else { |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 22 | if (target_cpu == "wasm") { |
| 23 | _data = "$target_gen_dir/icudtl_dat.cpp" |
| 24 | _data_script = "make_data_assembly.py" |
| 25 | } else if (is_win) { |
| 26 | _data = "$target_gen_dir/icudtl_dat.obj" |
| 27 | _data_script = "make_data_obj_win.py" |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 28 | } else { |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 29 | _data = "$target_gen_dir/icudtl_dat.S" |
| 30 | _data_script = "make_data_assembly.py" |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 31 | } |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 32 | third_party("icu") { |
| 33 | public_include_dirs = [ |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 34 | "../externals/icu/icu4c/source/common", |
| 35 | "../externals/icu/icu4c/source/i18n", |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 36 | ".", |
| 37 | ] |
| 38 | public_defines = [ |
| 39 | "U_USING_ICU_NAMESPACE=0", |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 40 | "U_STATIC_IMPLEMENTATION", |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 41 | "SK_USING_THIRD_PARTY_ICU", |
| 42 | ] |
| 43 | configs -= [ "//gn:no_rtti" ] |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 44 | deps = [ |
| 45 | ":assemble_data", |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 46 | ] |
| 47 | sources = icu_sources |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 48 | sources += [ _data ] |
| 49 | defines = [ |
| 50 | # http://userguide.icu-project.org/howtouseicu |
| 51 | "U_ENABLE_DYLOAD=0", |
| 52 | "U_NOEXCEPT=", |
| 53 | "U_COMMON_IMPLEMENTATION", |
| 54 | "U_I18N_IMPLEMENTATION", |
| 55 | ] |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 56 | if (is_win) { |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 57 | defines += [ "U_PLATFORM_HAS_WINUWP_API=1" ] |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 58 | } |
| 59 | } |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 60 | _dat_file = "$target_gen_dir/icu.dat" |
| 61 | action("assemble_data") { |
| 62 | script = _data_script |
| 63 | sources = [ |
| 64 | _dat_file, |
| 65 | ] |
| 66 | outputs = [ |
| 67 | _data, |
| 68 | ] |
| 69 | args = [ |
| 70 | icu_dtname, |
| 71 | current_os, |
| 72 | target_cpu, |
| 73 | rebase_path(_dat_file, root_build_dir), |
| 74 | rebase_path(_data, root_build_dir), |
| 75 | ] |
| 76 | deps = [ |
| 77 | ":get_data", |
| 78 | ] |
| 79 | } |
| 80 | if (skia_icu_use_prebuilt_data) { |
| 81 | action("get_data") { |
| 82 | script = "download_file.py" |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 83 | outputs = [ |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 84 | _dat_file, |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 85 | ] |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame^] | 86 | args = [ |
| 87 | "https://storage.googleapis.com/$icu_dat_bucket/$icu_dat_md5", |
| 88 | icu_dat_md5, |
| 89 | rebase_path(_dat_file, root_build_dir), |
| 90 | ] |
| 91 | } |
| 92 | } else { |
| 93 | action("get_data") { |
| 94 | script = "build_icu_data_file.py" |
| 95 | outputs = [ |
| 96 | _dat_file, |
| 97 | ] |
| 98 | args = [ |
| 99 | rebase_path("../externals/icu", root_build_dir), |
| 100 | rebase_path(_dat_file, root_build_dir), |
| 101 | ] |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 102 | } |
Hal Canary | 0e07ad7 | 2018-02-08 13:06:56 -0500 | [diff] [blame] | 103 | } |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 104 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 105 | } |