xref: /aosp_15_r20/external/skia/tools/window/BUILD.bazel (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_filegroup", "skia_objc_library")
2
3package(
4    default_applicable_licenses = ["//:license"],
5)
6
7licenses(["notice"])
8
9skia_filegroup(
10    name = "common_hdrs",
11    srcs = [
12        "DisplayParams.h",
13        "WindowContext.h",
14    ],
15)
16
17skia_filegroup(
18    name = "common_srcs",
19    srcs = [
20        "RasterWindowContext.h",  # only used in tools/window/ so not part of public API
21        "WindowContext.cpp",
22    ],
23)
24
25skia_filegroup(
26    name = "common_linux_hdrs",
27    srcs = [
28        "unix/RasterWindowContext_unix.h",
29        "unix/XlibWindowInfo.h",
30    ],
31)
32
33skia_filegroup(
34    name = "common_linux_srcs",
35    srcs = [
36        "unix/RasterWindowContext_unix.cpp",
37    ],
38)
39
40skia_filegroup(
41    name = "common_mac_hdrs",
42    srcs = [
43        "mac/RasterWindowContext_mac.h",
44    ],
45)
46
47skia_filegroup(
48    name = "common_mac_srcs",
49    srcs = [
50        "mac/RasterWindowContext_mac.mm",
51    ],
52)
53
54skia_filegroup(
55    name = "common_ios_srcs",
56    srcs = [
57        "ios/RasterWindowContext_ios.mm",
58    ],
59)
60
61skia_filegroup(
62    name = "common_ganesh_gl_srcs",
63    srcs = [
64        "GLWindowContext.cpp",
65        "GLWindowContext.h",
66    ],
67)
68
69skia_filegroup(
70    name = "linux_ganesh_gl_hdrs",
71    srcs = [
72        "unix/GaneshGLWindowContext_unix.h",
73    ],
74)
75
76skia_filegroup(
77    name = "linux_ganesh_gl_srcs",
78    srcs = [
79        "unix/GaneshGLWindowContext_unix.cpp",
80    ],
81)
82
83skia_filegroup(
84    name = "mac_ganesh_gl_hdrs",
85    srcs = [
86        "mac/GaneshGLWindowContext_mac.h",
87    ],
88)
89
90skia_filegroup(
91    name = "mac_ganesh_gl_srcs",
92    srcs = [
93        "mac/GaneshGLWindowContext_mac.mm",
94    ],
95)
96
97skia_filegroup(
98    name = "common_metal_hdrs",
99    srcs = [
100        "MetalWindowContext.h",
101    ],
102)
103
104skia_filegroup(
105    name = "common_metal_srcs",
106    srcs = [
107        "MetalWindowContext.mm",
108    ],
109)
110
111skia_filegroup(
112    name = "mac_ganesh_metal_hdrs",
113    srcs = [
114        "mac/GaneshMetalWindowContext_mac.h",
115    ],
116)
117
118skia_filegroup(
119    name = "mac_ganesh_metal_srcs",
120    srcs = [
121        "mac/GaneshMetalWindowContext_mac.mm",
122    ],
123)
124
125skia_filegroup(
126    name = "common_vulkan_srcs",
127    srcs = [
128        "VulkanWindowContext.cpp",
129        "VulkanWindowContext.h",
130    ],
131)
132
133skia_filegroup(
134    name = "linux_ganesh_vulkan_hdrs",
135    srcs = [
136        "unix/GaneshVulkanWindowContext_unix.h",
137    ],
138)
139
140skia_filegroup(
141    name = "linux_ganesh_vulkan_srcs",
142    srcs = [
143        "unix/GaneshVulkanWindowContext_unix.cpp",
144    ],
145)
146
147skia_cc_library(
148    name = "window",
149    testonly = True,
150    visibility = ["//tools:__subpackages__"],
151    deps = select({
152        "@platforms//os:linux": [":window_linux"],
153        "@platforms//os:macos": [":window_mac"],
154        "@platforms//os:ios": [":window_ios"],
155    }),
156)
157
158skia_cc_library(
159    name = "window_linux",
160    testonly = True,
161    srcs = [
162        ":common_ganesh_gl_srcs",
163        ":common_linux_srcs",
164        ":common_srcs",
165        ":common_vulkan_srcs",
166        ":linux_ganesh_gl_srcs",
167        ":linux_ganesh_vulkan_srcs",
168    ],
169    hdrs = [
170        ":common_hdrs",
171        ":common_linux_hdrs",
172        ":linux_ganesh_gl_hdrs",
173        ":linux_ganesh_vulkan_hdrs",
174    ],
175    linkopts = [
176        "-lX11",
177        "-lxcb",  # dep of X11
178        "-lXau",  # dep of xcb
179        "-lXdmcp",  # dep of xcb
180        "-lX11-xcb",  # needed for Vulkan
181    ],
182    deps = [
183        "//:core",
184        "//src/gpu/ganesh:ganesh_TEST_UTIL",
185        "//src/gpu/ganesh/gl:ganesh_gl_TEST_UTIL",
186        "//src/gpu/ganesh/gl/glx:glx_factory_TEST_UTIL",
187        "//src/gpu/ganesh/vk:ganesh_vulkan_TEST_UTIL",
188        "//tools/gpu/vk:testutils",
189    ],
190)
191
192skia_objc_library(
193    name = "window_mac",
194    testonly = True,
195    srcs = [
196        "common_ganesh_gl_srcs",
197        ":common_mac_srcs",
198        ":common_metal_srcs",
199        ":common_srcs",
200        ":mac_ganesh_gl_srcs",
201        ":mac_ganesh_metal_srcs",
202    ],
203    hdrs = [
204        ":common_hdrs",
205        ":common_mac_hdrs",
206        ":common_metal_hdrs",
207        ":mac_ganesh_gl_hdrs",
208        ":mac_ganesh_metal_hdrs",
209    ],
210    sdk_frameworks = [
211        "QuartzCore",
212        "Cocoa",
213        "Foundation",
214    ],
215    deps = [
216        "//:core",
217        "//src/gpu/ganesh/gl:ganesh_gl_TEST_UTIL",
218        "//src/gpu/ganesh/gl/mac:mac_factory_TEST_UTIL",
219        "//src/gpu/ganesh/mtl:ganesh_metal_TEST_UTIL",
220    ],
221)
222
223skia_objc_library(
224    name = "window_ios",
225    testonly = True,
226    srcs = [
227        "common_ganesh_gl_srcs",
228        ":common_ios_srcs",
229        ":common_srcs",
230    ],
231    hdrs = [
232        "ios/WindowContextFactory_ios.h",
233        ":common_hdrs",
234        ":common_metal_hdrs",
235        "//tools/sk_app:hdrs",
236        "//tools/sk_app/ios:hdrs",
237    ],
238    deps = [
239        "//:core",
240        "//src/gpu/ganesh/gl:ganesh_gl_TEST_UTIL",
241        "//src/gpu/ganesh/gl/iOS:ios_factory",
242        "//tools:tool_utils",
243        "//tools/skui",
244    ],
245)
246
247# TODO(kjlubick): fold this into window above for the backends which depend on graphite
248skia_cc_library(
249    name = "window_graphite",
250    testonly = True,
251    hdrs = [
252        "GraphiteDisplayParams.h",
253    ],
254    visibility = ["//tools:__subpackages__"],
255    deps = [
256        ":window",
257        "//tools/graphite:graphite_utils",
258    ],
259)
260