1load( 2 "//bazel:skia_rules.bzl", 3 "exports_files_legacy", 4 "select_multi", 5 "skia_cc_deps", 6 "skia_cc_library", 7 "skia_filegroup", 8) 9load("//bazel:flags.bzl", "selects") 10 11licenses(["notice"]) 12 13exports_files_legacy() 14 15skia_filegroup( 16 name = "discardable_memory_pool", 17 srcs = select({ 18 "//src/lazy:use_default_global_memory_pool_true": ["SkDiscardableMemory_none.cpp"], 19 "//conditions:default": [], 20 }), 21) 22 23# Any setting that causes this skia_filegroup to be included also needs to have a dependency on freetype. 24# See "deps" and "uses_freetype" at the bottom of this file. 25skia_filegroup( 26 name = "typeface_freetype", 27 srcs = [ 28 "SkFontHost_FreeType.cpp", 29 "SkFontHost_FreeType_common.cpp", 30 ], 31) 32 33# There can only be one FontMgr Factory, but multiple different types of FontMgr compiled into 34# a single build. 35skia_filegroup( 36 name = "fontmgr_factory", 37 srcs = selects.with_or({ 38 "//bazel/common_config_settings:android_fontmgr_factory": [ 39 ":fontmgr_android_factory", 40 ], 41 "//bazel/common_config_settings:custom_directory_fontmgr_factory": [ 42 ":fontmgr_custom_directory_factory", 43 ], 44 "//bazel/common_config_settings:custom_embedded_fontmgr_factory": [ 45 ":fontmgr_custom_embedded_factory", 46 ], 47 "//bazel/common_config_settings:custom_empty_fontmgr_factory": [ 48 ":fontmgr_custom_empty_factory", 49 ], 50 "//bazel/common_config_settings:fontconfig_fontmgr_factory": [ 51 ":fontmgr_fontconfig_factory", 52 ], 53 "//bazel/common_config_settings:fci_fontmgr_factory": [ 54 ":fontmgr_fci_factory", 55 ], 56 ("//bazel/common_config_settings:empty_fontmgr_factory", "//conditions:default"): [ 57 ":fontmgr_empty_factory", 58 ], 59 }), 60) 61 62skia_filegroup( 63 name = "fontmgr", 64 srcs = select_multi( 65 { 66 "//bazel/common_config_settings:android_fontmgr": [":fontmgr_android"], 67 "//bazel/common_config_settings:custom_directory_fontmgr": [":fontmgr_custom_directory"], 68 "//bazel/common_config_settings:custom_embedded_fontmgr": [":fontmgr_custom_embedded"], 69 "//bazel/common_config_settings:custom_empty_fontmgr": [":fontmgr_custom_empty"], 70 "//bazel/common_config_settings:fontconfig_fontmgr": [":fontmgr_fontconfig"], 71 "//bazel/common_config_settings:fci_fontmgr": [":fontmgr_fci"], 72 }, 73 ), 74) 75 76skia_filegroup( 77 name = "fontmgr_android", 78 srcs = [ 79 "SkFontMgr_android.cpp", 80 "SkFontMgr_android_parser.cpp", 81 ":typeface_freetype", 82 ], 83) 84 85skia_filegroup( 86 name = "fontmgr_android_factory", 87 srcs = [ 88 "SkFontMgr_android_factory.cpp", 89 ":fontmgr_android", 90 ], 91) 92 93skia_filegroup( 94 name = "fontmgr_custom", 95 srcs = [ 96 "SkFontMgr_custom.cpp", 97 ":typeface_freetype", 98 ], 99) 100 101skia_filegroup( 102 name = "fontmgr_empty_factory", 103 srcs = [ 104 "SkFontMgr_empty_factory.cpp", 105 ], 106) 107 108skia_filegroup( 109 name = "fontmgr_custom_directory", 110 srcs = [ 111 "SkFontMgr_custom_directory.cpp", 112 ":fontmgr_custom", 113 ], 114) 115 116skia_filegroup( 117 name = "fontmgr_custom_directory_factory", 118 srcs = [ 119 "SkFontMgr_custom_directory_factory.cpp", 120 ":fontmgr_custom_directory", 121 ], 122) 123 124skia_filegroup( 125 name = "fontmgr_custom_embedded", 126 srcs = [ 127 "SkFontMgr_custom_embedded.cpp", 128 ":fontmgr_custom", 129 ], 130) 131 132skia_filegroup( 133 name = "fontmgr_custom_embedded_factory", 134 srcs = [ 135 "SkFontMgr_custom_embedded_factory.cpp", 136 ":fontmgr_custom_embedded", 137 ], 138) 139 140skia_filegroup( 141 name = "fontmgr_custom_empty", 142 srcs = [ 143 "SkFontMgr_custom_empty.cpp", 144 ":fontmgr_custom", 145 ], 146) 147 148skia_filegroup( 149 name = "fontmgr_custom_empty_factory", 150 srcs = [ 151 "SkFontMgr_custom_empty_factory.cpp", 152 ":fontmgr_custom_empty", 153 ], 154) 155 156# Any setting that causes this skia_filegroup to be included also needs to have a dependency on 157# fontconfig. See "deps" and "uses_fontconfig" at the bottom of this file. 158skia_filegroup( 159 name = "fontmgr_fontconfig", 160 srcs = [ 161 "SkFontMgr_fontconfig.cpp", 162 ":typeface_freetype", 163 ], 164) 165 166skia_filegroup( 167 name = "fontmgr_fontconfig_factory", 168 srcs = [ 169 "SkFontMgr_fontconfig_factory.cpp", 170 ":fontmgr_fontconfig", 171 ], 172) 173 174# TODO(bungeman, kjlubick) break this up into the direct and Interface part. 175# Alternatively, delete it. 176# Any setting that causes this skia_filegroup to be included also needs to have a dependency on 177# fontconfig. See "deps" and "uses_fontconfig" at the bottom of this file. 178skia_filegroup( 179 name = "fontmgr_fci", 180 srcs = [ 181 "SkFontConfigInterface.cpp", 182 "SkFontConfigInterface_direct.cpp", 183 "SkFontConfigInterface_direct_factory.cpp", 184 "SkFontMgr_FontConfigInterface.cpp", 185 ":typeface_freetype", 186 ], 187) 188 189skia_filegroup( 190 name = "fontmgr_fci_factory", 191 srcs = [ 192 "SkFontMgr_FontConfigInterface_factory.cpp", 193 ":fontmgr_fci", 194 ], 195) 196 197skia_filegroup( 198 name = "global_init", 199 srcs = ["SkGlobalInitialization_default.cpp"], 200) 201 202skia_filegroup( 203 name = "image_generator", 204 srcs = ["SkImageGenerator_skia.cpp"], # TODO(kjlubick) add select() if necessary 205) 206 207# In own group to prevent exporting to *.gni files. 208skia_filegroup( 209 name = "osfile_platform", 210 srcs = select({ 211 "@platforms//os:windows": ["SkOSFile_win.cpp"], 212 "@platforms//os:ios": ["SkOSFile_posix.cpp"], 213 "//conditions:default": ["SkOSFile_posix.cpp"], 214 }), 215) 216 217skia_filegroup( 218 name = "osfile", 219 srcs = [ 220 "SkOSFile_stdio.cpp", 221 ":osfile_platform", 222 ], 223 visibility = ["//tools/skslc:__pkg__"], 224) 225 226skia_filegroup( 227 name = "malloc", 228 srcs = ["SkMemory_malloc.cpp"], # TODO(kjlubick) add select() if necessary 229) 230 231skia_filegroup( 232 name = "load_dynamic_library", 233 srcs = select({ 234 "@platforms//os:windows": ["SkOSLibrary_win.cpp"], 235 "//conditions:default": ["SkOSLibrary_posix.cpp"], 236 }), 237) 238 239skia_filegroup( 240 name = "skdebug", 241 srcs = select({ 242 "@platforms//os:windows": ["SkDebug_win.cpp"], 243 "@platforms//os:android": ["SkDebug_android.cpp"], 244 "//conditions:default": ["SkDebug_stdio.cpp"], 245 }), 246) 247 248skia_filegroup( 249 name = "srcs", 250 srcs = [ 251 ":discardable_memory_pool", 252 ":fontmgr", 253 ":fontmgr_factory", 254 ":global_init", 255 ":image_generator", 256 ":load_dynamic_library", 257 ":malloc", 258 ":osfile", 259 ":skdebug", 260 ], 261 visibility = ["//src:__pkg__"], 262) 263 264skia_filegroup( 265 name = "private_hdrs", 266 srcs = ["SkOSLibrary.h"] + select({ 267 ":uses_freetype": [ 268 "SkFontHost_FreeType_common.h", 269 "SkFontMgr_custom.h", 270 ], 271 "//conditions:default": [], 272 }) + select({ 273 "@platforms//os:ios": ["SkOSFile_ios.h"], 274 "//conditions:default": [], 275 }) + select({ 276 "//bazel/common_config_settings:uses_android_fontmgr": ["SkFontMgr_android_parser.h"], 277 "//conditions:default": [], 278 }) + select({ 279 "//bazel/common_config_settings:uses_fci_fontmgr": [ 280 "SkFontConfigInterface_direct.h", 281 "SkFontConfigTypeface.h", 282 ], 283 "//conditions:default": [], 284 }), 285 visibility = ["//src:__pkg__"], 286) 287 288selects.config_setting_group( 289 name = "uses_freetype", 290 match_any = [ 291 "//bazel/common_config_settings:uses_android_fontmgr", 292 "//bazel/common_config_settings:uses_custom_directory_fontmgr", 293 "//bazel/common_config_settings:uses_custom_embedded_fontmgr", 294 "//bazel/common_config_settings:uses_custom_empty_fontmgr", 295 "//bazel/common_config_settings:uses_fontconfig_fontmgr", 296 "//bazel/common_config_settings:uses_fci_fontmgr", 297 ], 298) 299 300selects.config_setting_group( 301 name = "uses_fontconfig", 302 match_any = [ 303 "//bazel/common_config_settings:uses_fontconfig_fontmgr", 304 "//bazel/common_config_settings:uses_fci_fontmgr", 305 ], 306) 307 308skia_cc_deps( 309 name = "deps", 310 linkopts = select({ 311 "@platforms//os:linux": ["-ldl"], 312 "//conditions:default": [], 313 }), 314 visibility = ["//src:__pkg__"], 315 deps = select({ 316 ":uses_freetype": ["@freetype"], 317 "//conditions:default": [], 318 }) + select({ 319 ":uses_fontconfig": ["//bazel/external/fontconfig:fontconfig"], 320 "//conditions:default": [], 321 }) + select({ 322 "//bazel/common_config_settings:uses_android_fontmgr": ["@expat"], 323 "//conditions:default": [], 324 }), 325) 326 327skia_cc_library( 328 name = "default_logging", 329 srcs = [":skdebug"], 330 copts = ["-Wno-format-nonliteral"], 331 features = ["layering_check"], 332 visibility = ["//:__pkg__"], 333 deps = ["//src:base"], 334) 335 336skia_cc_library( 337 name = "default_malloc", 338 srcs = [":malloc"], 339 features = ["layering_check"], 340 visibility = ["//:__pkg__"], 341 deps = ["//src:base"], 342) 343