skia2/tools/sk_app/BUILD.bazel
Kevin Lubick 24f0b884c0 [bazel] Move Dawn BUILD.bazel to third_party/bazel
Rather than having a monolithic third_party/BUILD.bazel, this moves
our Dawn rules to their own subdirectory and makes it callable via
@dawn instead of //third_party/dawn.

This will help with the G3 roll and make our rules more organized in
general.

This also rolls Dawn
Roll Dawn from ab9757036bd6 to e831fb61046b (22 revisions)

https://dawn.googlesource.com/dawn.git/+log/ab9757036bd6..e831fb61046b

Suggested Review Order:
 - WORKSPACE.bazel, where we define @dawn and its deps
   (@vulkan_headers and @vulkan_tools). I initially thought
   I needed to define all of Dawn's deps in the workspace_file_content
   for new_local_repository, but that WORKSPACE file is
   ignored when building Skia rules.
 - third_party/dawn/BUILD.bazel, the contents of which were copied
   from //third_party/BUILD.bazel and modified largely via
   find-and-replace to point to files relative to
   //third_party/externals/dawn. One exception is the cpu_wasm
   config_setting because @dawn isn't able to see Skia's
   //bazel/macros.bzl.
 - All other files

Change-Id: Ib2d7bc972ef00b6b68370ce5c2839ffb70ed9a2f
Bug: skia:12541, skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538638
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-05-16 14:06:59 +00:00

299 lines
8.0 KiB
Python

load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "generated_cc_atom", "selects")
licenses(["notice"])
exports_files_legacy()
selects.config_setting_group(
name = "dawn_unix",
match_all = [
"//bazel/common_config_settings:dawn_backend",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "gl_unix",
match_all = [
"//bazel/common_config_settings:gl_backend",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "vulkan_unix",
match_all = [
"//bazel/common_config_settings:vulkan_backend",
"@platforms//os:linux",
],
)
cc_library(
name = "sk_app",
linkopts = select({
"@platforms//os:linux": [
"-lX11",
"-lxcb", # dep of X11
"-lXau", # dep of xcb
"-lXdmcp", # dep of xcb
],
"//conditions:default": [],
}) + selects.with_or({
(":dawn_unix", ":vulkan_unix"): ["-lX11-xcb"],
"//conditions:default": [],
}),
visibility = ["//:__subpackages__"],
deps = [
":Application_hdr",
":CommandSet_src",
":RasterWindowContext_hdr",
":WindowContext_src",
":Window_src",
] + select({
"@platforms//os:linux": [
"//tools/sk_app/unix:RasterWindowContext_unix_src",
"//tools/sk_app/unix:Window_unix_src",
"//tools/sk_app/unix:keysym2ucs_src",
"//tools/sk_app/unix:main_unix_src",
],
# TODO(kjlubick) add Windows/Mac support
}) + select({
"//bazel/common_config_settings:dawn_backend": [
":DawnWindowContext_src",
],
"//bazel/common_config_settings:gl_backend": [
":GLWindowContext_src",
],
"//bazel/common_config_settings:vulkan_backend": [
":VulkanWindowContext_src",
"//tools/gpu/vk:VkTestUtils_src",
],
}) + select({
":dawn_unix": ["//tools/sk_app/unix:DawnVulkanWindowContext_unix_src"],
":gl_unix": ["//tools/sk_app/unix:GLWindowContext_unix_src"],
":vulkan_unix": ["//tools/sk_app/unix:VulkanWindowContext_unix_src"],
}),
)
generated_cc_atom(
name = "Application_hdr",
hdrs = ["Application.h"],
enforce_iwyu = True,
visibility = ["//:__subpackages__"],
)
generated_cc_atom(
name = "CommandSet_hdr",
hdrs = ["CommandSet.h"],
enforce_iwyu = True,
visibility = ["//:__subpackages__"],
deps = [
"//include/core:SkString_hdr",
"//include/core:SkTypes_hdr",
"//include/private:SkTArray_hdr",
"//tools/skui:InputState_hdr",
"//tools/skui:Key_hdr",
"//tools/skui:ModifierKey_hdr",
],
)
generated_cc_atom(
name = "CommandSet_src",
srcs = ["CommandSet.cpp"],
enforce_iwyu = True,
visibility = ["//:__subpackages__"],
deps = [
":CommandSet_hdr",
":Window_hdr",
"//include/core:SkCanvas_hdr",
"//include/core:SkFontTypes_hdr",
"//include/core:SkFont_hdr",
"//include/core:SkPaint_hdr",
"//include/core:SkScalar_hdr",
"//src/core:SkStringUtils_hdr",
],
)
generated_cc_atom(
name = "DawnWindowContext_hdr",
hdrs = ["DawnWindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//include/core:SkRefCnt_hdr",
"//include/core:SkSurface_hdr",
"@dawn",
],
)
generated_cc_atom(
name = "DawnWindowContext_src",
srcs = ["DawnWindowContext.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":DawnWindowContext_hdr",
"//include/core:SkSurface_hdr",
"//include/gpu:GrBackendSurface_hdr",
"//include/gpu:GrDirectContext_hdr",
"//src/core:SkAutoMalloc_hdr",
"@dawn",
],
)
generated_cc_atom(
name = "DisplayParams_hdr",
hdrs = ["DisplayParams.h"],
visibility = ["//:__subpackages__"],
deps = [
"//include/core:SkColorSpace_hdr",
"//include/core:SkImageInfo_hdr",
"//include/core:SkSurfaceProps_hdr",
"//include/gpu:GrContextOptions_hdr",
],
)
generated_cc_atom(
name = "GLWindowContext_hdr",
hdrs = ["GLWindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//include/core:SkRefCnt_hdr",
"//include/core:SkSurface_hdr",
"//include/gpu/gl:GrGLInterface_hdr",
],
)
generated_cc_atom(
name = "GLWindowContext_src",
srcs = ["GLWindowContext.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":GLWindowContext_hdr",
"//include/core:SkCanvas_hdr",
"//include/core:SkSurface_hdr",
"//include/gpu:GrBackendSurface_hdr",
"//include/gpu:GrDirectContext_hdr",
"//src/core:SkMathPriv_hdr",
"//src/gpu/ganesh:GrCaps_hdr",
"//src/gpu/ganesh:GrDirectContextPriv_hdr",
"//src/gpu/ganesh/gl:GrGLDefines_impl_hdr",
"//src/gpu/ganesh/gl:GrGLUtil_hdr",
"//src/image:SkImage_Base_hdr",
],
)
generated_cc_atom(
name = "GraphiteMetalWindowContext_hdr",
hdrs = ["GraphiteMetalWindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//include/core:SkRefCnt_hdr",
"//include/ports:SkCFObject_hdr",
],
)
generated_cc_atom(
name = "MetalWindowContext_hdr",
hdrs = ["MetalWindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//include/core:SkRefCnt_hdr",
"//include/core:SkSurface_hdr",
"//include/ports:SkCFObject_hdr",
"//include/private/gpu/ganesh:GrMtlTypesPriv_hdr",
],
)
generated_cc_atom(
name = "RasterWindowContext_hdr",
hdrs = ["RasterWindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [":WindowContext_hdr"],
)
generated_cc_atom(
name = "VulkanWindowContext_hdr",
hdrs = ["VulkanWindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//include/core:SkTypes_hdr",
"//include/gpu/vk:GrVkBackendContext_hdr",
"//include/gpu/vk:GrVkVulkan_hdr",
"//src/gpu/ganesh/vk:GrVkInterface_hdr",
"//tools/gpu/vk:VkTestUtils_hdr",
],
)
generated_cc_atom(
name = "VulkanWindowContext_src",
srcs = ["VulkanWindowContext.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":VulkanWindowContext_hdr",
"//include/core:SkSurface_hdr",
"//include/gpu:GrBackendSemaphore_hdr",
"//include/gpu:GrBackendSurface_hdr",
"//include/gpu:GrDirectContext_hdr",
"//include/gpu/vk:GrVkExtensions_hdr",
"//include/gpu/vk:GrVkTypes_hdr",
"//src/core:SkAutoMalloc_hdr",
"//src/gpu/ganesh/vk:GrVkImage_hdr",
"//src/gpu/ganesh/vk:GrVkUtil_hdr",
],
)
generated_cc_atom(
name = "WindowContext_hdr",
hdrs = ["WindowContext.h"],
visibility = ["//:__subpackages__"],
deps = [
":DisplayParams_hdr",
"//include/core:SkRefCnt_hdr",
"//include/core:SkSurfaceProps_hdr",
"//include/gpu:GrTypes_hdr",
],
)
generated_cc_atom(
name = "WindowContext_src",
srcs = ["WindowContext.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
"//include/gpu:GrDirectContext_hdr",
"//include/gpu/graphite:Context_hdr",
"//include/gpu/graphite:Recorder_hdr",
],
)
generated_cc_atom(
name = "Window_hdr",
hdrs = ["Window.h"],
visibility = ["//:__subpackages__"],
deps = [
":DisplayParams_hdr",
"//include/core:SkRect_hdr",
"//include/core:SkTypes_hdr",
"//include/private:SkTDArray_hdr",
"//tools/skui:InputState_hdr",
"//tools/skui:Key_hdr",
"//tools/skui:ModifierKey_hdr",
],
)
generated_cc_atom(
name = "Window_src",
srcs = ["Window.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":WindowContext_hdr",
":Window_hdr",
"//include/core:SkCanvas_hdr",
"//include/core:SkSurface_hdr",
],
)