skia2/third_party/icu/BUILD.gn
Hal Canary 1b85323f10 ICU: enable on wasm
Change-Id: I0647f641d4716af39f4afb832cfcc9fa7d571880
Reviewed-on: https://skia-review.googlesource.com/c/192832
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-02-15 18:14:43 +00:00

117 lines
2.9 KiB
Plaintext

# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
declare_args() {
skia_use_system_icu = is_official_build
}
import("../../gn/skia.gni")
import("../third_party.gni")
import("icu.gni")
if (skia_use_icu) {
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"
} else {
data_assembly = "$target_gen_dir/icudtl_dat.S"
}
data_dir = "../externals/icu/"
if (target_cpu == "wasm") {
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") {
if (target_cpu == "wasm") {
_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),
]
} else {
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" ]
}
}
}
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",
]
sources = icu_sources
if (is_win) {
deps = [
":icudata",
]
public_defines += [
"U_NOEXCEPT=",
"U_STATIC_IMPLEMENTATION",
]
libs = [ "Advapi32.lib" ]
sources += [
"../externals/icu/source/stubdata/stubdata.cpp",
"SkLoadICU.cpp",
]
} else {
sources += [ "$data_assembly" ]
deps = [
":make_data_assembly",
]
}
}
if (is_win) {
copy("icudata") {
sources = [
"../externals/icu/windows/icudt.dll",
]
outputs = [
"$root_out_dir/icudt.dll",
]
data = outputs
}
}
}
}