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 | |
Hal Canary | 32498f0 | 2019-02-04 15:36:31 -0500 | [diff] [blame] | 6 | import("../../gn/skia.gni") |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 7 | import("../third_party.gni") |
Hal Canary | 70041cf | 2019-01-28 21:33:21 -0500 | [diff] [blame] | 8 | import("icu.gni") |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 9 | |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 10 | declare_args() { |
| 11 | skia_use_system_icu = is_official_build |
| 12 | } |
| 13 | |
| 14 | if (skia_use_system_icu) { |
| 15 | system("icu") { |
| 16 | libs = [ "icuuc" ] |
| 17 | defines = [ "U_USING_ICU_NAMESPACE=0" ] |
| 18 | } |
| 19 | } else { |
| 20 | if (target_cpu == "wasm") { |
| 21 | data_assembly = "$target_gen_dir/icudtl_dat.cpp" |
Brian Osman | 66c26ac | 2018-12-07 13:43:57 -0500 | [diff] [blame] | 22 | } else { |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 23 | data_assembly = "$target_gen_dir/icudtl_dat.S" |
| 24 | } |
| 25 | data_dir = "../externals/icu/" |
| 26 | if (target_cpu == "wasm") { |
| 27 | # Use a super super super stripped down version for wasm, |
| 28 | # which is the same thing flutter is using. |
| 29 | data_dir += "flutter" |
| 30 | } else if (is_android) { |
| 31 | data_dir += "android" |
| 32 | } else if (is_ios) { |
| 33 | data_dir += "ios" |
| 34 | } else { |
| 35 | data_dir += "common" |
| 36 | } |
| 37 | action("make_data_assembly") { |
Hal Canary | 1b85323 | 2019-02-15 11:28:19 -0500 | [diff] [blame] | 38 | if (target_cpu == "wasm") { |
Mike Klein | a01c6b0 | 2020-04-01 13:47:34 -0500 | [diff] [blame] | 39 | _u_icu_version_major_num = |
| 40 | "65" # defined in source/common/unicode/uvernum.h |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 41 | script = "make_data_cpp.py" |
Mike Klein | a01c6b0 | 2020-04-01 13:47:34 -0500 | [diff] [blame] | 42 | inputs = [ "$data_dir/icudtl.dat" ] |
| 43 | outputs = [ data_assembly ] |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 44 | args = [ |
| 45 | "icudt${_u_icu_version_major_num}_dat", |
| 46 | rebase_path(inputs[0], root_build_dir), |
| 47 | rebase_path(data_assembly, root_build_dir), |
| 48 | ] |
Hal Canary | 1b85323 | 2019-02-15 11:28:19 -0500 | [diff] [blame] | 49 | } else { |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 50 | script = "../externals/icu/scripts/make_data_assembly.py" |
Mike Klein | a01c6b0 | 2020-04-01 13:47:34 -0500 | [diff] [blame] | 51 | inputs = [ "$data_dir/icudtl.dat" ] |
| 52 | outputs = [ "$data_assembly" ] |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 53 | args = [ |
| 54 | rebase_path(inputs[0], root_build_dir), |
| 55 | rebase_path(data_assembly, root_build_dir), |
| 56 | ] |
| 57 | if (is_mac || is_ios) { |
| 58 | args += [ "--mac" ] |
Florin Malita | 0c2add0 | 2019-02-06 02:28:24 +0000 | [diff] [blame] | 59 | } |
| 60 | } |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 61 | } |
Florin Malita | 0c2add0 | 2019-02-06 02:28:24 +0000 | [diff] [blame] | 62 | |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 63 | third_party("icu") { |
| 64 | public_include_dirs = [ |
| 65 | "../externals/icu/source/common", |
| 66 | "../externals/icu/source/i18n", |
| 67 | ".", |
| 68 | ] |
| 69 | public_defines = [ |
| 70 | "U_USING_ICU_NAMESPACE=0", |
| 71 | "SK_USING_THIRD_PARTY_ICU", |
| 72 | ] |
| 73 | configs -= [ "//gn:no_rtti" ] |
| 74 | defines = [ |
| 75 | # http://userguide.icu-project.org/howtouseicu |
| 76 | "U_COMMON_IMPLEMENTATION", |
| 77 | "U_STATIC_IMPLEMENTATION", |
| 78 | "U_ENABLE_DYLOAD=0", |
| 79 | "U_I18N_IMPLEMENTATION", |
| 80 | ] |
| 81 | if (target_cpu == "wasm") { |
| 82 | # Tell ICU that we are a 32 bit platform, otherwise, |
| 83 | # double-conversion-utils.h doesn't know how to operate. |
| 84 | defines += [ "__i386__" ] |
| 85 | } |
| 86 | sources = icu_sources |
| 87 | if (is_win) { |
Mike Klein | a01c6b0 | 2020-04-01 13:47:34 -0500 | [diff] [blame] | 88 | deps = [ ":icudata" ] |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 89 | public_defines += [ |
| 90 | "U_NOEXCEPT=", |
Florin Malita | 0c2add0 | 2019-02-06 02:28:24 +0000 | [diff] [blame] | 91 | "U_STATIC_IMPLEMENTATION", |
Hal Canary | e6cfe77 | 2019-01-25 12:50:35 -0500 | [diff] [blame] | 92 | ] |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 93 | libs = [ "Advapi32.lib" ] |
| 94 | sources += [ |
| 95 | "../externals/icu/source/stubdata/stubdata.cpp", |
| 96 | "SkLoadICU.cpp", |
| 97 | ] |
| 98 | } else { |
| 99 | sources += [ "$data_assembly" ] |
Mike Klein | a01c6b0 | 2020-04-01 13:47:34 -0500 | [diff] [blame] | 100 | deps = [ ":make_data_assembly" ] |
Florin Malita | 0c2add0 | 2019-02-06 02:28:24 +0000 | [diff] [blame] | 101 | } |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 102 | } |
Hal Canary | 689334c | 2019-02-22 11:25:25 -0500 | [diff] [blame] | 103 | |
Kevin Lubick | 867da4b | 2019-02-22 15:55:39 -0500 | [diff] [blame] | 104 | copy("icudata") { |
Mike Klein | a01c6b0 | 2020-04-01 13:47:34 -0500 | [diff] [blame] | 105 | sources = [ "../externals/icu/common/icudtl.dat" ] |
| 106 | outputs = [ "$root_out_dir/icudtl.dat" ] |
| 107 | data = [ "$root_out_dir/icudtl.dat" ] |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 108 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 109 | } |