c13cd6479d
This is a reland of ecac712bec
Changes (best viewed comparing PS1 to latest)
- Use emsdk 3.1.3 which includes important bug fixes
- Remove unnecessary steps in compile.sh
- Fix use of various gn args.
- Avoid conflicts with Flutter's GN symbols
- Add/update docs
- Make activate-emsdk script compatible with our infra.
Original change's description:
> Build CanvasKit using GN/Ninja
>
> Build with
>
> ./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'
>
> or
>
> ./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'
>
> Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
Change-Id: I601712a8953c2799fa029e782e097905b95e6b59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507717
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
130 lines
3.5 KiB
Plaintext
130 lines
3.5 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.
|
|
|
|
import("../../gn/skia.gni")
|
|
import("../third_party.gni")
|
|
import("icu.gni")
|
|
|
|
declare_args() {
|
|
skia_use_system_icu = is_official_build && !is_wasm
|
|
}
|
|
|
|
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") {
|
|
# 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") {
|
|
if (target_cpu == "wasm") {
|
|
_u_icu_version_major_num =
|
|
"69" # 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("headers") {
|
|
public_include_dirs = [
|
|
"../externals/icu/source/common",
|
|
"../externals/icu/source/i18n",
|
|
".",
|
|
]
|
|
public_defines = [
|
|
"U_USING_ICU_NAMESPACE=0",
|
|
"U_DISABLE_RENAMING",
|
|
]
|
|
}
|
|
|
|
third_party("icu") {
|
|
public_include_dirs = [
|
|
"../externals/icu/source/common",
|
|
"../externals/icu/source/i18n",
|
|
".",
|
|
]
|
|
public_defines = [
|
|
"U_USING_ICU_NAMESPACE=0",
|
|
"U_DISABLE_RENAMING",
|
|
"SK_USING_THIRD_PARTY_ICU",
|
|
]
|
|
configs = [ "//gn/portable:add_rtti" ]
|
|
defines = [
|
|
# http://userguide.icu-project.org/howtouseicu
|
|
"U_COMMON_IMPLEMENTATION",
|
|
"U_STATIC_IMPLEMENTATION",
|
|
"U_ENABLE_DYLOAD=0",
|
|
"U_I18N_IMPLEMENTATION",
|
|
|
|
# If we don't set this to zero, ICU will set it to 600,
|
|
# which makes Macs set _POSIX_C_SOURCE=200112L,
|
|
# which makes Macs set __DARWIN_C_LEVEL=_POSIX_C_SOURCE instead of =__DARWIN_C_FULL,
|
|
# which makes <time.h> not expose timespec_get,
|
|
# which makes recent libc++ <ctime> not #include-able with -std=c++17.
|
|
"_XOPEN_SOURCE=0",
|
|
]
|
|
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" ]
|
|
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" ]
|
|
}
|
|
}
|
|
|
|
copy("icudata") {
|
|
sources = [ "../externals/icu/common/icudtl.dat" ]
|
|
outputs = [ "$root_out_dir/icudtl.dat" ]
|
|
data = [ "$root_out_dir/icudtl.dat" ]
|
|
}
|
|
}
|