• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
2
3# This first example only needs the core Skia functionality and the pathops
4# module. Thus, the client defines a cc_library (skia_core_and_pathops) with
5# those components and then depending on that library.
6cc_binary(
7    name = "path_combiner",
8    srcs = ["src/path_main.cpp"],
9    copts = ["-std=c++17"],
10    linkopts = [
11        "-fuse-ld=lld",
12        "-lpthread",
13    ],
14    deps = [":skia_core_and_pathops"],
15)
16
17cc_library(
18    name = "skia_core_and_pathops",
19    deps = [
20        "@skia//:core",
21        "@skia//:pathops",
22    ],
23)
24
25cc_binary(
26    name = "png_decoder",
27    srcs = ["src/decode_png_main.cpp"],
28    copts = ["-std=c++17"],
29    linkopts = [
30        "-fuse-ld=lld",
31        "-lpthread",
32    ],
33    deps = [
34        "@skia//:core",
35        "@skia//:png_decode_codec",
36    ],
37)
38
39cc_binary(
40    name = "decode_everything",
41    srcs = ["src/decode_everything.cpp"],
42    copts = ["-std=c++17"],
43    linkopts = select({
44        "@platforms//os:linux": [
45            "-fuse-ld=lld",
46            "-lpthread",
47        ],
48        "//conditions:default": [],
49    }),
50    deps = [
51        "@skia//:bmp_decode_codec",
52        "@skia//:core",
53        "@skia//:gif_decode_codec",
54        "@skia//:ico_decode_codec",
55        "@skia//:jpeg_decode_codec",
56        "@skia//:jpegxl_decode_codec",
57        "@skia//:png_decode_codec",
58        "@skia//:wbmp_decode_codec",
59        "@skia//:webp_decode_codec",
60    ],
61)
62
63cc_binary(
64    name = "write_text_to_png",
65    srcs = ["src/write_text_to_png.cpp"],
66    copts = ["-std=c++17"],
67    linkopts = [
68        "-fuse-ld=lld",
69        "-lpthread",
70    ],
71    deps = [
72        "@skia//:core",
73        "@skia//:png_encode_codec",
74    ] + select({
75        "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"],
76        "@platforms//os:macos": ["@skia//:fontmgr_coretext"],
77    }),
78)
79
80cc_binary(
81    name = "shape_text",
82    srcs = ["src/shape_text.cpp"],
83    copts = ["-std=c++17"],
84    linkopts = [
85        "-fuse-ld=lld",
86        "-lpthread",
87    ],
88    deps = [
89        "@skia//:core",
90        "@skia//:fontmgr_empty_freetype",
91        "@skia//:jpeg_encode_codec",
92        "@skia//:skparagraph_harfbuzz_skunicode",
93        "@skia//:skunicode_icu",
94    ],
95)
96
97cc_binary(
98    name = "use_ganesh_gl",
99    srcs = ["src/ganesh_gl.cpp"],
100    copts = ["-std=c++17"],
101    linkopts = [
102        "-lpthread",
103    ] + select(
104        {
105            "@platforms//os:linux": [
106                "-lGL",
107                "-lX11",
108            ],
109            "//conditions:default": [],
110        },
111    ),
112    deps = [
113        "@skia//:core",
114        "@skia//:ganesh_gl",
115        "@skia//:webp_encode_codec",
116    ] + select({
117        "@platforms//os:linux": ["@skia//:ganesh_glx_factory"],
118        "@platforms//os:macos": [
119            ":gl_context_helper",
120            "@skia//:ganesh_gl_mac_factory",
121        ],
122        "//conditions:default": ["@platforms//:incompatible"],
123    }),
124)
125
126objc_library(
127    name = "gl_context_helper",
128    srcs = ["src/gl_context_helper.mm"],
129    hdrs = ["src/gl_context_helper.h"],
130    copts = ["-DGL_SILENCE_DEPRECATION"],
131    includes = ["src"],
132    sdk_frameworks = [
133        "OpenGL",
134    ],
135)
136
137cc_binary(
138    name = "use_ganesh_vulkan",
139    srcs = ["src/ganesh_vulkan.cpp"],
140    copts = ["-std=c++17"],
141    linkopts = [
142        "-lpthread",
143    ],
144    deps = [
145        "@skia//:core",
146        "@skia//:ganesh_vulkan",
147    ],
148)
149
150cc_binary(
151    name = "use_ganesh_metal",
152    srcs = ["src/ganesh_metal.cpp"],
153    copts = ["-std=c++17"],
154    target_compatible_with = select({
155        "@platforms//os:macos": [],
156        "@platforms//os:ios": [],
157        "//conditions:default": ["@platforms//:incompatible"],
158    }),
159    deps = [
160        ":metal_context_helper",
161        "@skia//:core",
162        "@skia//:ganesh_metal",
163    ],
164)
165
166objc_library(
167    name = "metal_context_helper",
168    srcs = ["src/metal_context_helper.mm"],
169    hdrs = ["src/metal_context_helper.h"],
170    copts = ["-std=c++17"],
171    includes = ["src"],
172    sdk_frameworks = [
173        # Without MetalKit added as a dependency, `[*device newCommandQueue]` fails
174        "MetalKit",
175        "Metal",
176    ],
177    target_compatible_with = select({
178        "@platforms//os:macos": [],
179        "@platforms//os:ios": [],
180        "//conditions:default": ["@platforms//:incompatible"],
181    }),
182    deps = [
183        "@skia//:core",
184        "@skia//:ganesh_metal",
185        "@skia//:jpeg_encode_codec",
186    ],
187)
188
189cc_binary(
190    name = "use_skresources",
191    srcs = ["src/use_skresources.cpp"],
192    copts = ["-std=c++17"],
193    linkopts = [
194        "-lpthread",
195    ],
196    deps = [
197        "@skia//:core",
198        "@skia//:jpeg_decode_codec",
199        "@skia//:png_decode_codec",
200        "@skia//:skresources",
201    ],
202)
203
204cc_binary(
205    name = "svg_with_primitive",
206    srcs = ["src/svg_renderer.cpp"],
207    copts = ["-std=c++17"],
208    linkopts = [
209        "-lpthread",
210    ],
211    deps = [
212        "@skia//:core",
213        "@skia//:png_encode_codec",
214        "@skia//:skshaper_core",
215        "@skia//:svg_renderer",
216    ] + select({
217        "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"],
218        "@platforms//os:macos": ["@skia//:fontmgr_coretext"],
219        "//conditions:default": [],
220    }),
221)
222
223cc_binary(
224    name = "svg_with_harfbuzz",
225    srcs = ["src/svg_renderer.cpp"],
226    copts = ["-std=c++17"],
227    linkopts = [
228        "-lpthread",
229    ],
230    deps = [
231        "@skia//:core",
232        "@skia//:png_encode_codec",
233        "@skia//:skshaper_harfbuzz",
234        "@skia//:skshaper_unicode",
235        "@skia//:skunicode_icu",
236        "@skia//:svg_renderer",
237    ] + select({
238        "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"],
239        "@platforms//os:macos": ["@skia//:fontmgr_coretext"],
240        "//conditions:default": [],
241    }),
242)
243
244cc_binary(
245    name = "write_to_pdf",
246    srcs = ["src/write_to_pdf.cpp"],
247    copts = ["-std=c++17"],
248    linkopts = [
249        "-lpthread",
250    ],
251    deps = [
252        "@skia//:core",
253        "@skia//:pdf_writer",
254    ] + select({
255        "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"],
256        "@platforms//os:macos": ["@skia//:fontmgr_coretext"],
257        "//conditions:default": [],
258    }),
259)
260