2016-08-03 22:08:04 +00:00
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2019-02-04 20:36:31 +00:00
|
|
|
import("../../gn/skia.gni")
|
2016-08-03 22:08:04 +00:00
|
|
|
import("../third_party.gni")
|
2019-01-29 02:33:21 +00:00
|
|
|
import("icu.gni")
|
2016-08-03 22:08:04 +00:00
|
|
|
|
2019-02-22 20:55:39 +00:00
|
|
|
declare_args() {
|
|
|
|
skia_use_system_icu = is_official_build
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skia_use_system_icu) {
|
|
|
|
system("icu") {
|
|
|
|
libs = [ "icuuc" ]
|
|
|
|
defines = [ "U_USING_ICU_NAMESPACE=0" ]
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (target_cpu == "wasm") {
|
|
|
|
data_assembly = "$target_gen_dir/icudtl_dat.cpp"
|
2018-12-07 18:43:57 +00:00
|
|
|
} else {
|
2019-02-22 20:55:39 +00:00
|
|
|
data_assembly = "$target_gen_dir/icudtl_dat.S"
|
|
|
|
}
|
|
|
|
data_dir = "../externals/icu/"
|
|
|
|
if (target_cpu == "wasm") {
|
|
|
|
# Use a super super super stripped down version for wasm,
|
|
|
|
# which is the same thing flutter is using.
|
|
|
|
data_dir += "flutter"
|
|
|
|
} else if (is_android) {
|
|
|
|
data_dir += "android"
|
|
|
|
} else if (is_ios) {
|
|
|
|
data_dir += "ios"
|
|
|
|
} else {
|
|
|
|
data_dir += "common"
|
|
|
|
}
|
|
|
|
action("make_data_assembly") {
|
2019-02-15 16:28:19 +00:00
|
|
|
if (target_cpu == "wasm") {
|
2019-02-22 20:55:39 +00:00
|
|
|
_u_icu_version_major_num = "63" # defined in source/common/unicode/uvernum.h
|
|
|
|
script = "make_data_cpp.py"
|
|
|
|
inputs = [
|
|
|
|
"$data_dir/icudtl.dat",
|
|
|
|
]
|
|
|
|
outputs = [
|
|
|
|
data_assembly,
|
|
|
|
]
|
|
|
|
args = [
|
|
|
|
"icudt${_u_icu_version_major_num}_dat",
|
|
|
|
rebase_path(inputs[0], root_build_dir),
|
|
|
|
rebase_path(data_assembly, root_build_dir),
|
|
|
|
]
|
2019-02-04 20:36:31 +00:00
|
|
|
} else {
|
2019-02-22 20:55:39 +00:00
|
|
|
script = "../externals/icu/scripts/make_data_assembly.py"
|
|
|
|
inputs = [
|
|
|
|
"$data_dir/icudtl.dat",
|
|
|
|
]
|
|
|
|
outputs = [
|
|
|
|
"$data_assembly",
|
|
|
|
]
|
|
|
|
args = [
|
|
|
|
rebase_path(inputs[0], root_build_dir),
|
|
|
|
rebase_path(data_assembly, root_build_dir),
|
|
|
|
]
|
|
|
|
if (is_mac || is_ios) {
|
|
|
|
args += [ "--mac" ]
|
2019-02-06 02:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-22 20:55:39 +00:00
|
|
|
}
|
2019-02-06 02:28:24 +00:00
|
|
|
|
2019-02-22 20:55:39 +00:00
|
|
|
third_party("icu") {
|
|
|
|
public_include_dirs = [
|
|
|
|
"../externals/icu/source/common",
|
|
|
|
"../externals/icu/source/i18n",
|
|
|
|
".",
|
|
|
|
]
|
|
|
|
public_defines = [
|
|
|
|
"U_USING_ICU_NAMESPACE=0",
|
|
|
|
"SK_USING_THIRD_PARTY_ICU",
|
|
|
|
]
|
|
|
|
configs -= [ "//gn:no_rtti" ]
|
|
|
|
defines = [
|
|
|
|
# http://userguide.icu-project.org/howtouseicu
|
|
|
|
"U_COMMON_IMPLEMENTATION",
|
|
|
|
"U_STATIC_IMPLEMENTATION",
|
|
|
|
"U_ENABLE_DYLOAD=0",
|
|
|
|
"U_I18N_IMPLEMENTATION",
|
|
|
|
]
|
|
|
|
if (target_cpu == "wasm") {
|
|
|
|
# Tell ICU that we are a 32 bit platform, otherwise,
|
|
|
|
# double-conversion-utils.h doesn't know how to operate.
|
|
|
|
defines += [ "__i386__" ]
|
|
|
|
}
|
|
|
|
sources = icu_sources
|
|
|
|
if (is_win) {
|
|
|
|
deps = [
|
|
|
|
":icudata",
|
2018-02-08 18:06:56 +00:00
|
|
|
]
|
2019-02-22 20:55:39 +00:00
|
|
|
public_defines += [
|
|
|
|
"U_NOEXCEPT=",
|
2019-02-06 02:28:24 +00:00
|
|
|
"U_STATIC_IMPLEMENTATION",
|
2019-02-04 20:36:31 +00:00
|
|
|
]
|
2019-02-22 20:55:39 +00:00
|
|
|
libs = [ "Advapi32.lib" ]
|
|
|
|
sources += [
|
|
|
|
"../externals/icu/source/stubdata/stubdata.cpp",
|
|
|
|
"SkLoadICU.cpp",
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
sources += [ "$data_assembly" ]
|
|
|
|
deps = [
|
|
|
|
":make_data_assembly",
|
|
|
|
]
|
2019-02-06 02:28:24 +00:00
|
|
|
}
|
2019-02-22 20:55:39 +00:00
|
|
|
}
|
2019-02-22 16:25:25 +00:00
|
|
|
|
2019-02-22 20:55:39 +00:00
|
|
|
copy("icudata") {
|
|
|
|
sources = [
|
|
|
|
"../externals/icu/common/icudtl.dat",
|
|
|
|
]
|
|
|
|
outputs = [
|
|
|
|
"$root_out_dir/icudtl.dat",
|
|
|
|
]
|
|
|
|
data = [
|
|
|
|
"$root_out_dir/icudtl.dat",
|
|
|
|
]
|
2016-10-11 21:08:53 +00:00
|
|
|
}
|
2016-08-03 22:08:04 +00:00
|
|
|
}
|