# https://github.com/bazelbuild/bazel-skylib load("@bazel_skylib//lib:selects.bzl", "selects") load("//bazel:macros.bzl", "select_multi") package(default_visibility = ["//:__subpackages__"]) cc_test( name = "bazel_test", size = "small", srcs = [ "//experimental/bazel_test:srcs", "//include/config:hdrs", "//include/core:hdrs", "//src/ports:skdebug", ], deps = [ "//third_party:libpng", "//third_party:musl_compat", ], ) CORE_SRCS = [ "//include/private:hdrs", "//include/third_party:skcms-hdrs", "//src/android:srcs", "//src/codec:srcs", "//src/core:srcs", "//src/image:srcs", "//src/images:srcs", "//src/effects:srcs", "//src/opts:srcs", "//src/pathops:srcs", "//src/sfnt:srcs", "//src/shaders:srcs", "//src/utils:srcs", "//third_party:skcms", ] + selects.with_or({ # https://github.com/bazelbuild/bazel-skylib/blob/main/docs/selects_doc.md#selectswith_or ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ "//src/gpu:srcs", "//src/sksl:srcs", # TODO(kjlubick) should mock be test only? "//include/private:mock-hdrs", "//src/gpu:mock-srcs", ], "//conditions:default": [], }) CORE_HDRS = [ "//include/android:hdrs", "//include/codec:hdrs", "//include/config:hdrs", "//include/core:hdrs", "//include/effects:hdrs", "//include/encode:hdrs", "//include/pathops:hdrs", "//include/ports:hdrs", "//include/utils:base-hdrs", ] + selects.with_or({ # https://github.com/bazelbuild/bazel-skylib/blob/main/docs/selects_doc.md#selectswith_or ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ "//include/sksl:hdrs", "//include/gpu:hdrs", # TODO(kjlubick) should mock be test only? "//include/gpu:mock-hdrs", ], "//conditions:default": [], }) # Some of these are documented in SkUserConfig.h CORE_DEFINES = ["SK_HAS_ANDROID_CODEC"] + select({ "//bazel/common_config_settings:debug_build": [ "SK_DEBUG", ], "//bazel/common_config_settings:release_build": [ "SK_RELEASE", ], "//conditions:default": [ "SK_RELEASE", ], }) + select({ "//bazel/common_config_settings:gl_backend": [ "SK_GL", "SK_SUPPORT_GPU=1", ], "//bazel/common_config_settings:vulkan_backend": [ "SK_VULKAN", "SK_SUPPORT_GPU=1", ], "//conditions:default": [ "SK_SUPPORT_GPU=0", ], }) + select({ "//bazel/common_config_settings:gl_standard": [ "SK_ASSUME_GL=1", ], "//bazel/common_config_settings:gles_standard": [ "SK_ASSUME_GL_ES=1", ], "//bazel/common_config_settings:webgl_standard": [ "SK_ASSUME_WEBGL=1", "SK_USE_WEBGL", ], "//conditions:default": [], }) + select_multi( { "//bazel/common_config_settings:gif_codec": ["SK_HAS_WUFFS_LIBRARY"], "//bazel/common_config_settings:jpeg_codec": ["SK_CODEC_DECODES_JPEG"], "//bazel/common_config_settings:png_codec": ["SK_CODEC_DECODES_PNG"], "//bazel/common_config_settings:raw_codec": [ "SK_CODEC_DECODES_RAW", "SK_CODEC_DECODES_JPEG", ], "//bazel/common_config_settings:webp_codec": ["SK_CODEC_DECODES_WEBP"], }, default = [], ) CORE_DEPS = [] + select_multi( { "//bazel/common_config_settings:gif_codec": ["//third_party:wuffs"], "//bazel/common_config_settings:png_codec": ["//third_party:libpng"], "//bazel/common_config_settings:raw_codec": [ "//third_party:piex", "//third_party:dng_sdk", ], "//bazel/common_config_settings:webp_codec": ["//third_party:libwebp"], }, default = [], ) + selects.with_or({ # The RAW codec require JPEG, but we cannot list libjpeg-turbo twice in the above list, or # Bazel gets sad. ("//bazel/common_config_settings:jpeg_codec", "//bazel/common_config_settings:raw_codec"): ["//third_party:libjpeg-turbo"], "//conditions:default": [], }) CORE_COPTS = [] cc_library( name = "skia-core", srcs = CORE_SRCS, hdrs = CORE_HDRS, copts = CORE_COPTS, local_defines = CORE_DEFINES, textual_hdrs = ["//src/sksl:txts"], deps = CORE_DEPS, ) cc_library( name = "hash_and_encode", testonly = True, srcs = [ "//tools:cmdline", "//tools:hash_and_encode", ], deps = [ ":skia-core", "//third_party:libpng", ], ) cc_library( name = "gms", testonly = True, srcs = [ "//gm:gms", "//gm:srcs", "//tools:srcs", ], hdrs = [ "//gm:hdrs", ], textual_hdrs = ["//tools:txts"], deps = [":skia-core"], ) cc_library( name = "tests", testonly = True, srcs = [ "//tests:srcs", "//tools:srcs", ], hdrs = [ "//tests:hdrs", ], local_defines = [ "GR_TEST_UTILS", ], textual_hdrs = ["//tools:txts"], deps = [":skia-core"], )