• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("//bazel:macros.bzl", "py_binary")
2load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_objc_library")
3
4package(
5    default_applicable_licenses = ["//:license"],
6)
7
8licenses(["notice"])
9
10exports_files([
11    "ToolUtils.h",
12    "ToolUtils.cpp",
13    "SkMetaData.h",
14    "SkMetaData.cpp",
15    "Registry.h",
16    "Resources.h",
17    "Resources.cpp",
18    "ResourceFactory.h",
19])
20
21skia_cc_library(
22    name = "registry",
23    hdrs = ["Registry.h"],
24    visibility = [
25        "//bench:__pkg__",
26        "//gm:__pkg__",
27        "//tests:__subpackages__",
28        "//tools/testrunners/benchmark:__pkg__",
29        "//tools/viewer:__pkg__",
30    ],
31    deps = ["//:core"],
32)
33
34skia_cc_library(
35    name = "hash_and_encode",
36    testonly = True,
37    srcs = ["HashAndEncode.cpp"],
38    hdrs = ["HashAndEncode.h"],
39    visibility = [
40        "//dm:__pkg__",
41        "//gm:__pkg__",
42    ],
43    deps = [
44        "//:core",
45        "//:png_encode_codec",
46        "//tools/flags:cmd_flags",
47    ],
48)
49
50py_binary(
51    name = "embed_resources",
52    srcs = ["embed_resources.py"],
53    visibility = ["//:__subpackages__"],
54)
55
56skia_cc_library(
57    name = "autorelease_pool",
58    hdrs = ["AutoreleasePool.h"],
59    visibility = [
60        "//bench:__pkg__",
61        "//dm:__pkg__",
62        "//tools/gpu:__pkg__",
63        "//tools/testrunners/benchmark:__pkg__",
64    ],
65    deps = ["//src/base"],
66)
67
68skia_objc_library(
69    name = "autorelease_pool_objc",
70    srcs = ["AutoreleasePool.mm"],
71    hdrs = ["AutoreleasePool.h"],
72    visibility = ["//tools/gpu:__pkg__"],
73    deps = ["//src/base"],
74)
75
76skia_cc_library(
77    name = "url_data_manager",
78    srcs = ["UrlDataManager.cpp"],
79    hdrs = ["UrlDataManager.h"],
80    visibility = [
81        "//dm:__pkg__",
82        "//tools/debugger:__pkg__",
83    ],
84    deps = ["//:core"],
85)
86
87skia_cc_library(
88    name = "ddl_utils",
89    testonly = True,
90    srcs = [
91        "DDLPromiseImageHelper.cpp",
92        "DDLPromiseImageHelper.h",
93        "DDLTileHelper.cpp",
94        "DDLTileHelper.h",
95    ],
96    hdrs = [
97        "DDLPromiseImageHelper.h",
98        "DDLTileHelper.h",
99    ],
100    visibility = ["//dm:__pkg__"],
101    deps = [
102        "//:core",
103        "//src/codec:codec_support_priv",
104        "//src/gpu/ganesh:ganesh_TEST_UTIL",
105    ],
106)
107
108skia_cc_library(
109    name = "test_font_data_provider",
110    testonly = True,
111    srcs = ["TestFontDataProvider.cpp"],
112    hdrs = ["TestFontDataProvider.h"],
113    visibility = ["//dm:__pkg__"],
114    deps = [
115        "//:core",
116        "//modules/jsonreader",
117        "//tools/flags:cmd_flags",
118    ],
119)
120
121skia_cc_library(
122    name = "sk_sharing_proc",
123    srcs = ["SkSharingProc.cpp"],
124    hdrs = ["SkSharingProc.h"],
125    visibility = ["//tools/debugger:__pkg__"],
126    deps = [
127        "//:core",
128        "//:png_decode_codec",
129        "//:png_encode_codec",
130    ],
131)
132
133skia_cc_library(
134    name = "mskp_player",
135    testonly = True,
136    srcs = ["MSKPPlayer.cpp"],
137    hdrs = ["MSKPPlayer.h"],
138    visibility = ["//tools/viewer:__pkg__"],
139    deps = [
140        ":sk_sharing_proc",
141        "//src/gpu/ganesh:ganesh_TEST_UTIL",
142        "//src/utils:multi_picture_document",
143    ],
144)
145
146skia_cc_library(
147    name = "runtime_blend_utils",
148    srcs = ["RuntimeBlendUtils.cpp"],
149    hdrs = ["RuntimeBlendUtils.h"],
150    visibility = [
151        "//dm:__pkg__",
152        "//tests:__pkg__",
153        "//tools/viewer:__pkg__",
154    ],
155    deps = ["//:core"],
156)
157
158skia_cc_library(
159    name = "stats",
160    srcs = ["ProcStats.cpp"],
161    hdrs = [
162        "ProcStats.h",
163        "Stats.h",
164    ],
165    visibility = [
166        "//bench:__pkg__",
167        "//dm:__pkg__",
168        "//tools/testrunners/benchmark:__pkg__",
169    ],
170    deps = ["//:core"],
171)
172
173skia_cc_library(
174    name = "tool_utils",
175    testonly = True,
176    srcs = [
177        "SkMetaData.cpp",
178        "ToolUtils.cpp",
179    ],
180    hdrs = [
181        "SkMetaData.h",
182        "ToolUtils.h",
183    ],
184    visibility = [
185        "//bench:__subpackages__",
186        "//gm:__subpackages__",
187        "//tools:__subpackages__",
188    ],
189    deps = [
190        "//:core",
191        "//src/base",
192        "//src/core:core_priv",
193    ],
194)
195
196skia_cc_library(
197    name = "codec_utils",
198    testonly = True,
199    srcs = [
200        "DecodeUtils.cpp",
201        "EncodeUtils.cpp",
202    ],
203    hdrs = [
204        "CodecUtils.h",
205        "DecodeUtils.h",
206        "EncodeUtils.h",
207    ],
208    visibility = [
209        "//dm:__pkg__",
210        "//gm:__subpackages__",
211        "//tools/viewer:__pkg__",
212    ],
213    deps = [
214        "//:core",
215        "//:png_decode_codec",
216        "//:png_encode_codec",
217        "//src/base",
218        "//src/core:core_priv",
219        "//tools:resources",
220    ],
221)
222
223skia_cc_library(
224    name = "resources",
225    testonly = True,
226    srcs = [
227        "Resources.cpp",
228    ],
229    hdrs = [
230        "Resources.h",
231    ],
232    visibility = [
233        "//bench:__subpackages__",
234        "//tools:__subpackages__",
235    ],
236    deps = [
237        "//:core",
238        "//src/base",
239        "//src/core:core_priv",
240        "//tools/flags:cmd_flags",
241    ],
242)
243
244skia_cc_library(
245    name = "gpu_tool_utils",
246    testonly = True,
247    hdrs = ["GpuToolUtils.h"],
248    visibility = [
249        "//dm:__pkg__",
250        "//tools:__subpackages__",
251    ],
252    deps = [
253        "//:core",
254    ],
255)
256
257# Regenerate workarounds with `bazel run //tools:generate_workarounds`
258py_binary(
259    name = "generate_workarounds",
260    srcs = [":generate_workarounds.py"],
261    args = [
262        "--output-file",
263        "include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h",
264        "src/gpu/gpu_workaround_list.txt",
265    ],
266    data = [
267        ":build_workaround_header",
268    ],
269    tags = ["no-remote"],
270)
271
272py_binary(
273    name = "build_workaround_header",
274    srcs = ["build_workaround_header.py"],
275)
276
277_GENERATE_WORKAROUNDS = """
278import os
279import subprocess
280import sys
281
282# https://bazel.build/docs/user-manual#running-executables
283# Note: Bazel eats single quotes, so we must use double quotes.
284os.chdir(os.environ["BUILD_WORKSPACE_DIRECTORY"])
285
286# execpath returns the path to the given label relative to the Skia root.
287# This will be something like:
288#   bazel-out/k8-opt-exec-81C6BA4F/bin/tools/build_workaround_header
289# https://bazel.build/reference/be/make-variables#predefined_label_variables
290generate_script = os.path.abspath("$(execpath :build_workaround_header)")
291
292result = subprocess.run(
293    [generate_script] + sys.argv[1:], capture_output=True, encoding="utf-8")
294if result.returncode != 0:
295    print(result.stdout)
296    print(result.stderr)
297    sys.exit(result.returncode)
298"""
299
300genrule(
301    name = "create_generate_workarounds_script",
302    outs = ["generate_workarounds.py"],
303    cmd = "echo '%s' > $@" % _GENERATE_WORKAROUNDS,
304    tools = [":build_workaround_header"],
305)
306
307skia_cc_library(
308    name = "full_build",
309    testonly = True,
310    srcs = [
311        # These are *not* skia_cc_library targets because we'd have to set the deps
312        # for them, which is redundent. Thus we just compile them as a list of files
313        # and the deps specified below should be sufficient for them.
314        "//include/core:headers_to_compile",
315        "//include/effects:headers_to_compile",
316        "//include/encode:headers_to_compile",
317        "//include/gpu/ganesh:headers_to_compile",
318        "//include/gpu:headers_to_compile",
319        "//include/gpu/vk:headers_to_compile",
320        "//include/private/base:headers_to_compile",
321        "//include/private/chromium:headers_to_compile",
322        "//include/private/gpu/ganesh:headers_to_compile",
323        "//include/private:headers_to_compile",
324        "//modules/svg/src:headers_to_compile",
325        "//src/base:headers_to_compile",
326        "//src/codec:headers_to_compile",
327        "//src/core:headers_to_compile",
328        "//src/encode:headers_to_compile",
329        "//src/gpu/ganesh/effects:headers_to_compile",
330        "//src/gpu/ganesh/geometry:headers_to_compile",
331        "//src/gpu/ganesh/gl:headers_to_compile",
332        "//src/gpu/ganesh/mock:headers_to_compile",
333        "//src/gpu/ganesh/ops:headers_to_compile",
334        "//src/gpu/ganesh/tessellate:headers_to_compile",
335        "//src/gpu/ganesh:headers_to_compile",
336        "//src/gpu/graphite/geom:headers_to_compile",
337        "//src/gpu/tessellate:headers_to_compile",
338        "//src/gpu/vk:headers_to_compile",
339        "//src/gpu:headers_to_compile",
340        "//src/pdf:headers_to_compile",
341        "//include/docs:headers_to_compile",
342    ],
343    copts = [
344        # Since we are generating .cpp files for headers, some variables/functions which
345        # were properly declared static could be mis-interpreted to be unused. We don't
346        # want to fail on that. Therefore, we do not want warnings about those unused
347        # things to be flagged.
348        "-Wno-unused-function",
349        "-Wno-unused-template",
350        "-Wno-unused-const-variable",
351        "-Wno-invalid-constexpr",
352    ] + select({
353        "@platforms//os:windows": [
354            "-D_CRT_USE_BUILTIN_OFFSETOF",
355        ],
356        "//conditions:default": [],
357    }),
358    # This is not intended to be used for tests or anything, just for IWYU
359    visibility = ["//visibility:private"],
360    deps = [
361        "//:bmp_decode_codec",
362        "//:core",
363        "//:fontmgr_data_freetype",
364        "//:fontmgr_directory_freetype",
365        "//:fontmgr_empty_freetype",
366        "//:gif_decode_codec",
367        "//:ico_decode_codec",
368        "//:jpeg_decode_codec",
369        "//:jpeg_encode_codec",
370        "//:jpegxl_decode_codec",
371        "//:pathops",
372        "//:pdf_writer",
373        "//:png_decode_codec",
374        "//:png_encode_codec",
375        "//:skparagraph_harfbuzz_skunicode",
376        "//:skresources",
377        "//:skshaper_core",
378        "//:skshaper_harfbuzz",
379        "//:skshaper_unicode",
380        "//:skunicode_core",
381        "//:skunicode_icu",
382        "//:svg_renderer",
383        "//:svg_writer",
384        "//:wbmp_decode_codec",
385        "//:webp_decode_codec",
386        "//:webp_encode_codec",
387        "//modules/jsonreader",
388        "//src/gpu/ganesh/gl:ganesh_gl_TEST_UTIL",
389        "//src/gpu/ganesh/vk:ganesh_vulkan_TEST_UTIL",
390        "//src/gpu/graphite/vk:graphite_native_vulkan_TEST_UTIL",
391        "//tools/sksltrace:sksltraceutils",
392    ],
393)
394