blob: 1be2f3335f46dd7fff49843b2cc027e8685cf8e0 [file] [log] [blame]
load("//bazel:flags.bzl", "selects")
load(
"//bazel:skia_rules.bzl",
"exports_files_legacy",
"select_multi",
"skia_cc_deps",
"skia_cc_library",
"skia_filegroup",
"skia_objc_library",
)
licenses(["notice"])
exports_files_legacy()
skia_filegroup(
name = "discardable_memory_pool",
srcs = select({
"//src/lazy:use_default_global_memory_pool_true": ["SkDiscardableMemory_none.cpp"],
"//conditions:default": [],
}),
)
# Any setting that causes this skia_filegroup to be included also needs to have a dependency on freetype.
# See "deps" and "uses_freetype" at the bottom of this file.
skia_filegroup(
name = "typeface_freetype",
srcs = [
"SkFontHost_FreeType.cpp",
"SkFontHost_FreeType_common.cpp",
],
)
skia_filegroup(
name = "typeface_freetype_hdrs",
srcs = [
"SkFontHost_FreeType_common.h",
"SkTypeface_FreeType.h",
],
)
skia_filegroup(
name = "typeface_fontations",
srcs = select({
"//bazel/common_config_settings:use_fontations_true": [
"SkTypeface_fontations.cpp",
"SkTypeface_fontations_priv.h",
],
"//conditions:default": [],
}),
)
skia_filegroup(
name = "fontmgr",
srcs = select_multi(
{
"//bazel/common_config_settings:android_fontmgr": [":fontmgr_android"],
"//bazel/common_config_settings:custom_directory_fontmgr": [":fontmgr_custom_directory"],
"//bazel/common_config_settings:custom_embedded_fontmgr": [":fontmgr_custom_embedded"],
"//bazel/common_config_settings:custom_empty_fontmgr": [":fontmgr_custom_empty"],
"//bazel/common_config_settings:fci_fontmgr": [":fontmgr_fci"],
},
) + select({
"@platforms//os:linux": [":legacy_fontmgr_fontconfig"],
"//conditions:default": [],
}),
)
skia_filegroup(
name = "fontmgr_android",
srcs = [
"SkFontMgr_android.cpp",
"SkFontMgr_android_parser.cpp",
":typeface_freetype",
],
)
skia_filegroup(
name = "fontmgr_android_hdrs",
srcs = [
"SkFontMgr_android_parser.h",
],
)
skia_filegroup(
name = "legacy_fontmgr_custom",
srcs = [
"SkFontMgr_custom.cpp",
":typeface_freetype",
],
)
skia_filegroup(
name = "fontmgr_custom_directory",
srcs = [
"SkFontMgr_custom_directory.cpp",
":legacy_fontmgr_custom",
],
)
skia_filegroup(
name = "fontmgr_custom_embedded",
srcs = [
"SkFontMgr_custom_embedded.cpp",
":legacy_fontmgr_custom",
],
)
skia_filegroup(
name = "fontmgr_custom_empty",
srcs = [
"SkFontMgr_custom_empty.cpp",
":legacy_fontmgr_custom",
],
)
# Any setting that causes this skia_filegroup to be included also needs to have a dependency on
# fontconfig. See "deps" and "uses_fontconfig" at the bottom of this file.
skia_filegroup(
name = "legacy_fontmgr_fontconfig",
srcs = [
"SkFontMgr_fontconfig.cpp",
":typeface_freetype",
],
)
# TODO(bungeman, kjlubick) break this up into the direct and Interface part.
# Alternatively, delete it.
# Any setting that causes this skia_filegroup to be included also needs to have a dependency on
# fontconfig. See "deps" and "uses_fontconfig" at the bottom of this file.
skia_filegroup(
name = "fontmgr_fci",
srcs = [
"SkFontConfigInterface.cpp",
"SkFontConfigInterface_direct.cpp",
"SkFontConfigInterface_direct_factory.cpp",
"SkFontMgr_FontConfigInterface.cpp",
":typeface_freetype",
],
)
skia_filegroup(
name = "global_init",
srcs = ["SkGlobalInitialization_default.cpp"],
)
# In own group to prevent exporting to *.gni files.
skia_filegroup(
name = "osfile_platform",
srcs = select({
"@platforms//os:windows": ["SkOSFile_win.cpp"],
"@platforms//os:ios": [
"SkOSFile_ios.h",
"SkOSFile_posix.cpp",
"//include/ports:core_foundation_hdrs",
],
"//conditions:default": ["SkOSFile_posix.cpp"],
}),
)
skia_filegroup(
name = "osfile",
srcs = [
"SkOSFile_stdio.cpp",
":osfile_platform",
],
visibility = ["//tools/skslc:__pkg__"],
)
skia_filegroup(
name = "malloc",
srcs = ["SkMemory_malloc.cpp"], # TODO(kjlubick) add select() if necessary
)
skia_filegroup(
name = "load_dynamic_library",
srcs = ["SkOSLibrary.h"] + select({
"@platforms//os:windows": ["SkOSLibrary_win.cpp"],
"//conditions:default": ["SkOSLibrary_posix.cpp"],
}),
visibility = ["//tools/gpu:__pkg__"],
)
skia_filegroup(
name = "skdebug",
srcs = select({
"@platforms//os:windows": ["SkDebug_win.cpp"],
"@platforms//os:android": ["SkDebug_android.cpp"],
"//conditions:default": ["SkDebug_stdio.cpp"],
}),
)
skia_filegroup(
name = "srcs",
srcs = [
":discardable_memory_pool",
":fontmgr",
":global_init",
":load_dynamic_library",
":malloc",
":osfile",
":skdebug",
":typeface_fontations",
],
visibility = ["//src:__pkg__"],
)
skia_filegroup(
name = "private_hdrs",
srcs = [
"SkOSLibrary.h",
] + select({
":uses_freetype": [
"SkFontHost_FreeType_common.h",
"SkFontMgr_custom.h",
"SkTypeface_FreeType.h",
],
"//conditions:default": [],
}) + select({
"@platforms//os:ios": ["SkOSFile_ios.h"],
"//conditions:default": [],
}) + select({
"//bazel/common_config_settings:android_fontmgr": [":fontmgr_android_hdrs"],
"//conditions:default": [],
}) + select({
"//bazel/common_config_settings:fci_fontmgr": [
"SkFontConfigInterface_direct.h",
"SkFontConfigTypeface.h",
],
"//conditions:default": [],
}) + select({
"//bazel/common_config_settings:use_fontations_true": [
"SkFontScanner_fontations.h",
"SkTypeface_fontations_priv.h",
],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
)
selects.config_setting_group(
name = "uses_freetype",
match_any = [
"//bazel/common_config_settings:android_fontmgr",
"//bazel/common_config_settings:custom_directory_fontmgr",
"//bazel/common_config_settings:custom_embedded_fontmgr",
"//bazel/common_config_settings:custom_empty_fontmgr",
"//bazel/common_config_settings:fontconfig_fontmgr",
"//bazel/common_config_settings:fci_fontmgr",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "uses_fontconfig",
match_any = [
"//bazel/common_config_settings:fontconfig_fontmgr",
"//bazel/common_config_settings:fci_fontmgr",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "uses_fontations",
match_any = [
"//bazel/common_config_settings:use_fontations_true",
],
)
skia_cc_deps(
name = "deps",
linkopts = select({
"@platforms//os:linux": ["-ldl"],
"@platforms//os:android": [
"-llog", # Provides __android_log_vprint, needed by //src/ports/SkDebug_android.cpp.
],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
deps = select({
":uses_freetype": ["@freetype"],
"//conditions:default": [],
}) + select({
":uses_fontconfig": ["//bazel/external/fontconfig"],
"//conditions:default": [],
}) + select({
"//bazel/common_config_settings:android_fontmgr": ["@expat"],
"//conditions:default": [],
}) + select({
"//bazel/common_config_settings:use_fontations_true": [
":fontmgr_fontations_empty",
"//src/ports/fontations:deps",
],
"//conditions:default": [],
}),
)
skia_filegroup(
name = "base_srcs",
srcs = [
":skdebug",
# TODO(kjlubick) Chromium will need a way to overwrite the malloc impls. Having malloc
# be a module doesn't quite work because ld complains "backward reference detected"
# when something in a module like pathops uses malloc without depending on it.
":malloc",
],
visibility = ["//src/base:__pkg__"],
)
skia_filegroup(
name = "core_srcs",
srcs = [
":global_init",
":osfile",
],
visibility = ["//src/core:__pkg__"],
)
skia_filegroup(
name = "fontmgr_custom",
srcs = [
"SkFontMgr_custom.cpp",
"SkFontMgr_custom.h",
],
)
skia_cc_library(
name = "freetype_support",
srcs = [
":typeface_freetype",
"//src/utils:char_to_glyphcache",
],
hdrs = [":typeface_freetype_hdrs"],
deps = [
"//:core",
"//:pathops",
"@freetype",
],
)
skia_cc_library(
name = "fontmgr_android_freetype",
srcs = [
"SkFontMgr_android.cpp",
"SkFontMgr_android_parser.cpp",
],
hdrs = [
"SkFontMgr_android_parser.h",
"//include/ports:android_fontmgr_hdrs",
],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
"//src/base",
"//src/core:core_priv",
"@expat",
],
)
skia_objc_library(
name = "fontmgr_coretext",
srcs = [
"SkFontMgr_mac_ct.cpp",
],
hdrs = [
"//include/ports:coretext_fontmgr_hdrs",
],
defines = ["SK_FONTMGR_CORETEXT_AVAILABLE"],
features = ["layering_check"],
ios_frameworks = [
"CoreText",
"CoreGraphics",
"CoreFoundation",
],
mac_frameworks = ["ApplicationServices"],
visibility = ["//:__pkg__"],
deps = [
":coretext_typeface",
"//:core",
"//src/base",
"//src/core:core_priv",
],
)
skia_cc_library(
name = "fontmgr_data_freetype",
srcs = [
"SkFontMgr_custom_embedded.cpp",
":fontmgr_custom",
],
hdrs = [
"//include/ports:data_fontmgr_hdrs",
],
defines = ["SK_FONTMGR_FREETYPE_DATA_AVAILABLE"],
features = ["layering_check"],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
"//src/base",
"//src/core:core_priv",
],
)
skia_cc_library(
name = "fontmgr_directory_freetype",
srcs = [
"SkFontMgr_custom_directory.cpp",
":fontmgr_custom",
],
hdrs = [
"//include/ports:directory_fontmgr_hdrs",
],
defines = ["SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE"],
features = ["layering_check"],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
"//src/base",
"//src/core:core_priv",
],
)
skia_cc_library(
name = "fontmgr_empty_freetype",
srcs = [
"SkFontMgr_custom_empty.cpp",
":fontmgr_custom",
],
hdrs = [
"//include/ports:empty_fontmgr_hdrs",
],
defines = ["SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE"],
features = ["layering_check"],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
"//src/base",
"//src/core:core_priv",
],
)
skia_cc_library(
name = "fontmgr_fontations_empty",
srcs = [
"SkFontMgr_fontations_empty.cpp",
"SkFontMgr_fontations_empty.h",
":typeface_fontations",
"//include/ports:typeface_fontations_hdrs",
],
hdrs = [
"//include/ports:fontmgr_fontations_hdrs",
],
defines = ["SK_FONTMGR_FONTATIONS_AVAILABLE"],
visibility = [
"//:__pkg__",
"//tools/fonts:__pkg__",
],
deps = [
"//:core",
"//:pathops",
"//src/ports/fontations:deps",
],
)
skia_cc_library(
name = "fontmgr_fontconfig_freetype",
srcs = [
"SkFontMgr_fontconfig.cpp",
],
hdrs = [
"//include/ports:fontconfig_fontmgr_hdrs",
],
defines = ["SK_FONTMGR_FONTCONFIG_AVAILABLE"],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
"//bazel/external/fontconfig",
"//src/base",
"//src/core:core_priv",
],
)
skia_filegroup(
name = "typeface_mac_hdrs",
srcs = ["SkTypeface_mac_ct.h"],
visibility = ["//src/utils/mac:__pkg__"],
)
skia_objc_library(
name = "coretext_typeface",
srcs = [
"SkScalerContext_mac_ct.cpp",
"SkScalerContext_mac_ct.h",
"SkTypeface_mac_ct.cpp",
],
hdrs = [
"SkTypeface_mac_ct.h",
"//include/ports:mac_typeface",
],
features = ["layering_check"],
ios_frameworks = [
"CoreFoundation",
"CoreGraphics",
"CoreText",
],
mac_frameworks = ["ApplicationServices"],
deps = [
"//:core",
"//src/base",
"//src/core:core_priv",
"//src/utils/mac:mac_utils_priv",
],
)
skia_objc_library(
name = "imagegenerator_coregraphics",
srcs = [
"SkImageGeneratorCG.cpp",
],
hdrs = [
"//include/ports:imagegenerator_cg_hdrs",
],
features = ["layering_check"],
ios_frameworks = [
"CoreGraphics",
"ImageIO",
"MobileCoreServices",
],
mac_frameworks = ["ApplicationServices"],
visibility = ["//:__pkg__"],
deps = [
"//:core",
"//src/base",
"//src/codec:any_decoder",
"//src/core:core_priv",
"//src/utils/mac:mac_utils_priv",
],
)