aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-02-08 13:06:56 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-08 19:36:49 +0000
commit0e07ad7fe7e95365eebde4e870792f0abb1d0890 (patch)
tree7e3631143f119817a159aa3e40928cedfec94a01 /third_party
parent4c790bd7dd8a6edacfc39b65b7043742331ab4da (diff)
ICU on windows
Change-Id: Ib1a2f017d96c5157c60d512332fddfef77c5ae8e Reviewed-on: https://skia-review.googlesource.com/103001 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/icu/BUILD.gn35
-rw-r--r--third_party/icu/SkLoadICU.h52
2 files changed, 82 insertions, 5 deletions
diff --git a/third_party/icu/BUILD.gn b/third_party/icu/BUILD.gn
index 68a5923cc6..6b2482f2fb 100644
--- a/third_party/icu/BUILD.gn
+++ b/third_party/icu/BUILD.gn
@@ -16,16 +16,17 @@ if (skia_use_system_icu) {
}
} else {
third_party("icu") {
- public_include_dirs = [ "../externals/icu/source/common" ]
+ public_include_dirs = [
+ "../externals/icu/source/common",
+ ".",
+ ]
public_defines = [ "U_USING_ICU_NAMESPACE=0" ]
configs -= [ "//gn:no_rtti" ]
- if (!is_win) {
- libs = [ "dl" ]
- }
defines = [
# http://userguide.icu-project.org/howtouseicu
"U_COMMON_IMPLEMENTATION",
"U_STATIC_IMPLEMENTATION",
+ "U_ENABLE_DYLOAD=0",
]
sources = [
"../externals/icu/source/common/appendable.cpp",
@@ -209,6 +210,30 @@ if (skia_use_system_icu) {
"../externals/icu/source/common/uvectr64.cpp",
"../externals/icu/source/common/wintz.c",
]
- sources += [ "../externals/icu/$current_os/icudtl_dat.S" ]
+ if (is_win) {
+ deps = [
+ ":icudata",
+ ]
+ public_defines += [
+ "U_NOEXCEPT=",
+ "U_STATIC_IMPLEMENTATION",
+ ]
+ libs = [ "Advapi32.lib" ]
+ sources += [ "../externals/icu/source/stubdata/stubdata.c" ]
+ } else {
+ sources += [ "../externals/icu/$current_os/icudtl_dat.S" ]
+ libs = [ "dl" ]
+ }
+ }
+ if (is_win) {
+ copy("icudata") {
+ sources = [
+ "../externals/icu/windows/icudt.dll",
+ ]
+ outputs = [
+ "$root_out_dir/icudt.dll",
+ ]
+ data = outputs
+ }
}
}
diff --git a/third_party/icu/SkLoadICU.h b/third_party/icu/SkLoadICU.h
new file mode 100644
index 0000000000..e28d629f1a
--- /dev/null
+++ b/third_party/icu/SkLoadICU.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef load_icu_DEFINED
+#define load_icu_DEFINED
+
+#include "SkTypes.h"
+
+#ifdef SK_BUILD_FOR_WIN
+
+#include "../private/SkLeanWindows.h"
+
+#include "unicode/uvernum.h"
+#include "unicode/udata.h"
+
+#define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
+#define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll"
+
+inline void SkLoadICU() {
+ HMODULE module = LoadLibrary(ICU_UTIL_DATA_SHARED_MODULE_NAME);
+ if (!module) {
+ SK_ABORT("Failed to load " ICU_UTIL_DATA_SHARED_MODULE_NAME "\n");
+ }
+ FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
+ if (!addr) {
+ SK_ABORT("Symbol " ICU_UTIL_DATA_SYMBOL " missing in "
+ ICU_UTIL_DATA_SHARED_MODULE_NAME ".\n");
+ }
+ UErrorCode err = U_ZERO_ERROR;
+ udata_setCommonData(reinterpret_cast<void*>(addr), &err);
+ if (err != U_ZERO_ERROR) {
+ SkDebugf("udata_setCommonData() returned %d.\n", (int)err);
+ SK_ABORT("");
+ }
+ udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
+ if (err != U_ZERO_ERROR) {
+ SkDebugf("udata_setFileAccess() returned %d.\n", (int)err);
+ SK_ABORT("");
+ }
+}
+
+#undef ICU_UTIL_DATA_SHARED_MODULE_NAME
+#undef ICU_UTIL_DATA_SYMBOL
+
+#else
+inline void SkLoadICU() {}
+#endif // SK_BUILD_FOR_WIN
+#endif // load_icu_DEFINED
+