| 1 |
# Copyright 2021 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 |
|
| 6 |
import("../../gn/skia.gni") |
| 7 |
import("../../third_party/icu/icu.gni") |
| 8 |
import("skunicode.gni") |
| 9 |
|
| 10 |
declare_args() { |
| 11 |
skia_use_runtime_icu = false |
| 12 |
skunicode_tests_enabled = true |
| 13 |
} |
| 14 |
|
| 15 |
if (skia_use_icu || skia_use_client_icu || skia_use_libgrapheme || |
| 16 |
skia_use_bidi || skia_use_icu4x) { |
| 17 |
config("public_config") { |
| 18 |
defines = [ "SK_UNICODE_AVAILABLE" ] |
| 19 |
if (skia_use_icu) { |
| 20 |
defines += [ "SK_UNICODE_ICU_IMPLEMENTATION" ] |
| 21 |
} |
| 22 |
if (skia_use_client_icu) { |
| 23 |
defines += [ "SK_UNICODE_CLIENT_IMPLEMENTATION" ] |
| 24 |
} |
| 25 |
if (skia_use_libgrapheme) { |
| 26 |
defines += [ "SK_UNICODE_LIBGRAPHEME_IMPLEMENTATION" ] |
| 27 |
} |
| 28 |
if (skia_use_icu4x) { |
| 29 |
defines += [ "SK_UNICODE_ICU4X_IMPLEMENTATION" ] |
| 30 |
} |
| 31 |
if (skia_use_bidi) { |
| 32 |
defines += [ "SK_UNICODE_BIDI_IMPLEMENTATION" ] |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
config("module") { |
| 37 |
defines = [ "SKUNICODE_IMPLEMENTATION=1" ] |
| 38 |
if (is_component_build) { |
| 39 |
defines += [ "SKUNICODE_DLL" ] |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
skia_component("skunicode_core") { |
| 44 |
check_includes = false |
| 45 |
deps = [ "../..:skia" ] |
| 46 |
configs = [ |
| 47 |
":module", |
| 48 |
"../../:skia_private", |
| 49 |
"../../third_party/icu/config:no_cxx", |
| 50 |
] |
| 51 |
sources = skia_unicode_sources |
| 52 |
} |
| 53 |
|
| 54 |
if (skia_use_icu) { |
| 55 |
skia_component("skunicode_icu") { |
| 56 |
check_includes = false |
| 57 |
deps = [ |
| 58 |
":skunicode_core", |
| 59 |
"../..:skia", |
| 60 |
] |
| 61 |
configs = [ |
| 62 |
":module", |
| 63 |
"../../:skia_private", |
| 64 |
"../../third_party/icu/config:no_cxx", |
| 65 |
] |
| 66 |
|
| 67 |
# These are explicitly *not* public defines because we don't want them |
| 68 |
# to leak to dependents. |
| 69 |
defines = [ "U_USING_ICU_NAMESPACE=0" ] |
| 70 |
if (!skia_use_system_icu) { |
| 71 |
defines += [ "U_DISABLE_RENAMING=1" ] |
| 72 |
} |
| 73 |
|
| 74 |
sources = skia_unicode_icu_bidi_sources |
| 75 |
sources += skia_unicode_bidi_full_sources |
| 76 |
sources += skia_unicode_icu_sources |
| 77 |
|
| 78 |
# only available for Android at the moment |
| 79 |
if (skia_use_runtime_icu && (is_android || is_linux)) { |
| 80 |
sources += skia_unicode_runtime_icu_sources |
| 81 |
defines += [ "SK_UNICODE_RUNTIME_ICU_AVAILABLE" ] |
| 82 |
deps += [ "//third_party/icu:headers" ] |
| 83 |
} else { |
| 84 |
sources += skia_unicode_builtin_icu_sources |
| 85 |
deps += [ "//third_party/icu" ] |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
if (skia_use_client_icu) { |
| 91 |
skia_component("skunicode_client_icu") { |
| 92 |
check_includes = false |
| 93 |
deps = [ |
| 94 |
":skunicode_core", |
| 95 |
"../..:skia", |
| 96 |
] |
| 97 |
configs = [ |
| 98 |
":module", |
| 99 |
"../../:skia_private", |
| 100 |
"../../third_party/icu/config:no_cxx", |
| 101 |
] |
| 102 |
defines = [ |
| 103 |
# In order to use the bidi_subset at the same time as "full ICU", we must have |
| 104 |
# compiled icu with the given defines also being set. This is to make sure the functions |
| 105 |
# we call are given a suffix of "_skia" to prevent ODR violations if this "subset of ICU" |
| 106 |
# is compiled alongside a full ICU build also. |
| 107 |
# See https://chromium.googlesource.com/chromium/deps/icu.git/+/d94ab131bc8fef3bc17f356a628d8e4cd44d65d9/source/common/unicode/uversion.h |
| 108 |
# for how these are used. |
| 109 |
"U_DISABLE_RENAMING=0", |
| 110 |
"U_USING_ICU_NAMESPACE=0", |
| 111 |
"U_LIB_SUFFIX_C_NAME=_skia", |
| 112 |
"U_HAVE_LIB_SUFFIX=1", |
| 113 |
"U_DISABLE_VERSION_SUFFIX=1", |
| 114 |
] |
| 115 |
|
| 116 |
sources = skia_unicode_icu_bidi_sources |
| 117 |
sources += skia_unicode_bidi_subset_sources |
| 118 |
sources += skia_unicode_client_icu_sources |
| 119 |
deps += [ skia_icu_bidi_third_party_dir ] |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
if (skia_use_bidi) { |
| 124 |
skia_component("skunicode_bidi") { |
| 125 |
check_includes = false |
| 126 |
deps = [ |
| 127 |
":skunicode_core", |
| 128 |
"../..:skia", |
| 129 |
] |
| 130 |
configs = [ |
| 131 |
":module", |
| 132 |
"../../:skia_private", |
| 133 |
"../../third_party/icu/config:no_cxx", |
| 134 |
] |
| 135 |
defines = [ |
| 136 |
# In order to use the bidi_subset at the same time as "full ICU", we must have |
| 137 |
# compiled icu with the given defines also being set. This is to make sure the functions |
| 138 |
# we call are given a suffix of "_skia" to prevent ODR violations if this "subset of ICU" |
| 139 |
# is compiled alongside a full ICU build also. |
| 140 |
# See https://chromium.googlesource.com/chromium/deps/icu.git/+/d94ab131bc8fef3bc17f356a628d8e4cd44d65d9/source/common/unicode/uversion.h |
| 141 |
# for how these are used. |
| 142 |
"U_DISABLE_RENAMING=0", |
| 143 |
"U_USING_ICU_NAMESPACE=0", |
| 144 |
"U_LIB_SUFFIX_C_NAME=_skia", |
| 145 |
"U_HAVE_LIB_SUFFIX=1", |
| 146 |
"U_DISABLE_VERSION_SUFFIX=1", |
| 147 |
] |
| 148 |
|
| 149 |
sources = skia_unicode_icu_bidi_sources |
| 150 |
sources += skia_unicode_bidi_subset_sources |
| 151 |
sources += skia_unicode_bidi_sources |
| 152 |
deps += [ skia_icu_bidi_third_party_dir ] |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
if (skia_use_libgrapheme) { |
| 157 |
skia_component("skunicode_libgrapheme") { |
| 158 |
check_includes = false |
| 159 |
deps = [ |
| 160 |
":skunicode_core", |
| 161 |
"../..:skia", |
| 162 |
] |
| 163 |
configs = [ |
| 164 |
":module", |
| 165 |
"../../:skia_private", |
| 166 |
"../../third_party/icu/config:no_cxx", |
| 167 |
] |
| 168 |
defines = [ |
| 169 |
"U_DISABLE_RENAMING=0", |
| 170 |
"U_USING_ICU_NAMESPACE=0", |
| 171 |
"U_LIB_SUFFIX_C_NAME=_skia", |
| 172 |
"U_HAVE_LIB_SUFFIX=1", |
| 173 |
"U_DISABLE_VERSION_SUFFIX=1", |
| 174 |
] |
| 175 |
|
| 176 |
sources = skia_unicode_icu_bidi_sources |
| 177 |
sources += skia_unicode_bidi_subset_sources |
| 178 |
|
| 179 |
sources += skia_unicode_libgrapheme_sources |
| 180 |
deps += [ |
| 181 |
skia_icu_bidi_third_party_dir, |
| 182 |
skia_libgrapheme_third_party_dir, |
| 183 |
] |
| 184 |
} |
| 185 |
} |
| 186 |
|
| 187 |
if (skia_use_icu4x) { |
| 188 |
skia_component("skunicode_icu4x") { |
| 189 |
check_includes = false |
| 190 |
deps = [ |
| 191 |
":skunicode_core", |
| 192 |
"../..:skia", |
| 193 |
] |
| 194 |
configs = [ |
| 195 |
":module", |
| 196 |
"../../:skia_private", |
| 197 |
"../../third_party/icu/config:no_cxx", |
| 198 |
] |
| 199 |
|
| 200 |
sources = skia_unicode_icu4x_sources |
| 201 |
|
| 202 |
deps += [ "//third_party/icu4x" ] |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
group("skunicode") { |
| 207 |
public_configs = [ ":public_config" ] |
| 208 |
public_deps = [ ":skunicode_core" ] |
| 209 |
|
| 210 |
# We have these different flavors of skunicode as independent components because |
| 211 |
# we have to set different defines for different builds of ICU. |
| 212 |
if (skia_use_icu) { |
| 213 |
public_deps += [ ":skunicode_icu" ] |
| 214 |
} |
| 215 |
if (skia_use_client_icu) { |
| 216 |
public_deps += [ ":skunicode_client_icu" ] |
| 217 |
} |
| 218 |
if (skia_use_bidi) { |
| 219 |
public_deps += [ ":skunicode_bidi" ] |
| 220 |
} |
| 221 |
if (skia_use_libgrapheme) { |
| 222 |
public_deps += [ ":skunicode_libgrapheme" ] |
| 223 |
} |
| 224 |
if (skia_use_icu4x) { |
| 225 |
public_deps += [ ":skunicode_icu4x" ] |
| 226 |
} |
| 227 |
} |
| 228 |
|
| 229 |
if (defined(is_skia_standalone) && skia_enable_tools) { |
| 230 |
skia_source_set("tests") { |
| 231 |
if (skunicode_tests_enabled && |
| 232 |
(skia_use_icu || skia_use_libgrapheme || skia_use_icu4x)) { |
| 233 |
testonly = true |
| 234 |
deps = [ |
| 235 |
":skunicode", |
| 236 |
"../..:skia", |
| 237 |
"../..:test", |
| 238 |
] |
| 239 |
sources = skia_unicode_tests |
| 240 |
deps += [ skia_icu_bidi_third_party_dir ] |
| 241 |
} else { |
| 242 |
sources = [] |
| 243 |
} |
| 244 |
} |
| 245 |
} |
| 246 |
} else { |
| 247 |
group("skunicode") { |
| 248 |
} |
| 249 |
group("tests") { |
| 250 |
} |
| 251 |
} |