blob: 0e7985f8d265b18a33aa90b96ec750f2c95d71ce [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary45812a12019-09-04 08:58:59 -04009import("gn/skia.gni")
10
John Rosasco24cbdab2019-09-25 14:14:35 -070011if (is_fuchsia) {
12 import("//build/fuchsia/sdk.gni")
13 import("build/fuchsia/fuchsia_download_sdk.gni")
14}
15
Stephen White0d70b712019-07-10 15:51:30 -040016if (skia_use_dawn) {
17 import("third_party/externals/dawn/scripts/dawn_features.gni")
18}
19
Adam Barth54ef74a2017-10-13 10:59:38 -070020if (defined(skia_settings)) {
21 import(skia_settings)
22}
23
Hal Canary3388c1a2019-09-16 12:53:17 -040024import("gn/ios.gni")
25
mtkleinc04ff472016-06-23 10:29:30 -070026# Skia public API, generally provided by :skia.
27config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050028 include_dirs = [ "." ]
29
Mike Kleinae7e6712016-10-11 17:49:33 -040030 defines = []
Chinmay Gardef832c0a2020-03-18 14:37:23 -070031 cflags_objcc = []
Mike Kleinae7e6712016-10-11 17:49:33 -040032 if (is_component_build) {
33 defines += [ "SKIA_DLL" ]
34 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040035 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050036 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070037 }
Brian Osmanf2c90142017-07-13 15:50:03 -040038 if (skia_enable_flutter_defines) {
39 defines += flutter_defines
40 }
mtklein06c35c02016-09-20 12:28:12 -070041 if (!skia_enable_gpu) {
42 defines += [ "SK_SUPPORT_GPU=0" ]
43 }
Mike Reed025f7832018-11-12 09:27:05 -050044 if (is_fuchsia) {
45 defines += fuchsia_defines
46 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040047 if (skia_gl_standard == "gles") {
48 defines += [ "SK_ASSUME_GL_ES=1" ]
49 } else if (skia_gl_standard == "gl") {
50 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040051 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040052 defines += [
53 "SK_ASSUME_WEBGL=1",
54 "SK_USE_WEBGL",
55 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040056 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070057
58 # Some older versions of the Clang toolchain change the visibility of
59 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
60 # toolchains suppress the use of this macro till toolchain updates are made.
61 if (is_mac || is_ios) {
62 if (skia_enable_api_available_macro) {
63 defines += [ "SK_ENABLE_API_AVAILABLE" ]
64 } else {
65 cflags_objcc += [ "-Wno-unguarded-availability" ]
66 }
67 }
mtkleinc04ff472016-06-23 10:29:30 -070068}
69
70# Skia internal APIs, used by Skia itself and a few test tools.
71config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060072 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070073
Mike Reeda9e241d2017-05-03 10:52:00 -040074 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050075 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070076 defines += [
77 "SK_GAMMA_EXPONENT=1.4",
78 "SK_GAMMA_CONTRAST=0.0",
79 ]
80 }
Mike Kleinb45d8622019-04-24 14:04:01 -050081 if (is_skia_dev_build) {
82 defines += [
83 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
84 "GR_TEST_UTILS=1",
85 ]
mtklein88a7ac02016-09-14 11:16:49 -070086 }
Brian Salomon789e25e2016-09-30 13:41:03 -040087 libs = []
88 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040089 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050090 defines += [ "SK_ANGLE" ]
91 }
Greg Danielb16beb92020-04-27 14:26:21 +000092 if (skia_use_vma) {
93 defines += [ "SK_USE_VMA" ]
94 }
James Clarkeb8c0dab2021-02-09 06:22:41 -080095 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -080096 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -080097 }
98}
99
mtkleinc04ff472016-06-23 10:29:30 -0700100# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
101config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600102 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000103 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700104}
105
106skia_library_configs = [
107 ":skia_public",
108 ":skia_private",
109 ":skia_library",
110]
111
mtklein9b8583d2016-08-24 17:32:30 -0700112# Use for CPU-specific Skia code that needs particular compiler flags.
113template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500114 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700115 if (invoker.enabled) {
116 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500117 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700118 forward_variables_from(invoker, "*")
119 configs += skia_library_configs
120 }
121 } else {
122 # If not enabled, a phony empty target that swallows all otherwise unused variables.
123 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500124 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700125 forward_variables_from(invoker,
126 "*",
127 [
128 "sources",
129 "cflags",
130 ])
131 }
132 }
anmittala7eaf2e2016-08-17 13:57:26 -0700133}
134
mtklein422310d2016-08-16 18:28:43 -0700135is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700136
mtklein7d6fb2c2016-08-25 14:50:44 -0700137opts("none") {
138 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700139 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700140 cflags = []
141}
142
mtklein7d6fb2c2016-08-25 14:50:44 -0700143opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700144 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700145 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700146 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700147}
148
149opts("arm64") {
150 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700151 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700152 cflags = []
153}
154
155opts("crc32") {
156 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700157 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700158 cflags = [ "-march=armv8-a+crc" ]
159}
160
mtklein9b8583d2016-08-24 17:32:30 -0700161opts("sse2") {
162 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700163 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400164 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400165 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
166 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400167 cflags = [ "-msse2" ]
168 }
mtklein9b8583d2016-08-24 17:32:30 -0700169}
mtkleinc04ff472016-06-23 10:29:30 -0700170
mtklein9b8583d2016-08-24 17:32:30 -0700171opts("ssse3") {
172 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400174 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400175 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
176 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400177 cflags = [ "-mssse3" ]
178 }
mtklein9b8583d2016-08-24 17:32:30 -0700179}
mtkleinc04ff472016-06-23 10:29:30 -0700180
mtklein9b8583d2016-08-24 17:32:30 -0700181opts("sse41") {
182 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700183 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400184 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400185 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
186 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400187 cflags = [ "-msse4.1" ]
188 }
mtklein9b8583d2016-08-24 17:32:30 -0700189}
mtklein4e976072016-08-08 09:06:27 -0700190
mtklein9b8583d2016-08-24 17:32:30 -0700191opts("sse42") {
192 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700193 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400194 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400195 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
196 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400197 cflags = [ "-msse4.2" ]
198 }
mtklein9b8583d2016-08-24 17:32:30 -0700199}
200
201opts("avx") {
202 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700203 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400204 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000205 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400206 } else {
207 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500208 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500209 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500210 }
Mike Klein3eb71212016-10-11 17:08:53 -0400211 }
mtkleinc04ff472016-06-23 10:29:30 -0700212}
213
Mike Klein1b9b7d52018-02-27 10:37:40 -0500214opts("hsw") {
215 enabled = is_x86
216 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400217 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500218 cflags = [ "/arch:AVX2" ]
219 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000220 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600221 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500222 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600223 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500224 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500225}
226
Mike Kleinad56c4c2020-06-05 06:57:30 -0500227opts("skx") {
228 enabled = is_x86
229 sources = skia_opts.skx_sources
230 if (is_win) {
231 cflags = [ "/arch:AVX512" ]
232 } else {
233 cflags = [ "-march=skylake-avx512" ]
234 if (is_mac && is_debug) {
235 cflags += [ "-fno-stack-check" ] # Work around skia:9709
236 }
237 }
238}
239
mtkleinc095df52016-08-24 12:23:52 -0700240# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700241template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500242 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700243 if (invoker.enabled) {
244 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700245 if (defined(invoker.public_defines)) {
246 defines = invoker.public_defines
247 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600248 if (defined(invoker.public_configs)) {
249 configs = invoker.public_configs
250 }
Hal Canary2dad9902019-11-20 16:01:31 -0500251 if (defined(invoker.public_include_dirs)) {
252 include_dirs = invoker.public_include_dirs
253 }
mtklein457b42a2016-08-23 13:56:37 -0700254 }
255 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500256 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700257 forward_variables_from(invoker,
258 "*",
259 [
260 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500261 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700262 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700263 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700264 ])
mtklein457b42a2016-08-23 13:56:37 -0700265 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700266 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700267 if (defined(invoker.configs_to_remove)) {
268 configs -= invoker.configs_to_remove
269 }
mtklein457b42a2016-08-23 13:56:37 -0700270 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500271 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
272 source_set(target_name + "_tests") {
273 check_includes = false
274 forward_variables_from(invoker,
275 "*",
276 [
277 "public_defines",
278 "sources",
279 "sources_for_tests",
280 "sources_when_disabled",
281 "configs_to_remove",
282 ])
283 testonly = true
284 sources = invoker.sources_for_tests
285 if (!defined(deps)) {
286 deps = []
287 }
288 deps += [ ":test" ]
289 all_dependent_configs = [ ":" + target_name + "_public" ]
290 configs += skia_library_configs
291 if (defined(invoker.configs_to_remove)) {
292 configs -= invoker.configs_to_remove
293 }
294 }
295 }
mtklein457b42a2016-08-23 13:56:37 -0700296 } else {
mtklein457b42a2016-08-23 13:56:37 -0700297 source_set(target_name) {
298 forward_variables_from(invoker,
299 "*",
300 [
Ben Wagnerea765a32020-06-05 13:42:30 -0400301 "public",
mtklein457b42a2016-08-23 13:56:37 -0700302 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400303 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700304 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700305 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400306 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700307 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500308 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700309 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700310 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700311 ])
mtkleincd01b032016-08-31 04:58:19 -0700312 if (defined(invoker.sources_when_disabled)) {
313 sources = invoker.sources_when_disabled
314 }
315 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700316 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500317 if (defined(invoker.sources_for_tests)) {
318 source_set(target_name + "_tests") {
319 }
320 }
mtkleineb3c4252016-08-23 07:38:09 -0700321 }
mtklein457b42a2016-08-23 13:56:37 -0700322}
mtklein457b42a2016-08-23 13:56:37 -0700323
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400324optional("android_utils") {
325 enabled = skia_enable_android_utils
326
Leon Scroggins III87caae62020-05-04 10:02:45 -0400327 public = [
328 "client_utils/android/BRDAllocator.h",
329 "client_utils/android/BitmapRegionDecoder.h",
330 "client_utils/android/FrontBufferedStream.h",
331 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400332 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400333 sources = [
334 "client_utils/android/BitmapRegionDecoder.cpp",
335 "client_utils/android/FrontBufferedStream.cpp",
336 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400337}
338
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400339group("fontmgr_factory") {
340 public_deps = [ skia_fontmgr_factory ]
341}
342
343optional("fontmgr_empty_factory") {
344 enabled = true
345 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400346}
347
mtkleina45be612016-08-29 15:22:10 -0700348optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500349 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700350
351 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500352 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700353 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700354 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400355 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700356 sources = [
357 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700358 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400359 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700360 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500361 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700362}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400363optional("fontmgr_android_factory") {
364 enabled = skia_enable_fontmgr_android
365 deps = [ ":fontmgr_android" ]
366 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
367}
mtkleina45be612016-08-29 15:22:10 -0700368
mtkleind2e39db2016-09-07 07:52:55 -0700369optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400370 enabled =
371 skia_enable_fontmgr_custom_directory ||
372 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700373
Mike Kleina01c6b02020-04-01 13:47:34 -0500374 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400375 public = [ "src/ports/SkFontMgr_custom.h" ]
376 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
377}
378
379optional("fontmgr_custom_directory") {
380 enabled = skia_enable_fontmgr_custom_directory
381
382 deps = [
383 ":fontmgr_custom",
384 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700385 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400386 public = [ "include/ports/SkFontMgr_directory.h" ]
387 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
388}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400389optional("fontmgr_custom_directory_factory") {
390 enabled = skia_enable_fontmgr_custom_directory
391 deps = [ ":fontmgr_custom_directory" ]
392 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
393}
Ben Wagner75626e42020-06-03 13:20:37 -0400394
395optional("fontmgr_custom_embedded") {
396 enabled = skia_enable_fontmgr_custom_embedded
397
398 deps = [
399 ":fontmgr_custom",
400 ":typeface_freetype",
401 ]
402 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700403}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400404optional("fontmgr_custom_embedded_factory") {
405 enabled = skia_enable_fontmgr_custom_embedded
406 deps = [ ":fontmgr_custom_embedded" ]
407 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
408}
mtkleind2e39db2016-09-07 07:52:55 -0700409
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500410optional("fontmgr_custom_empty") {
411 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500412
Ben Wagner75626e42020-06-03 13:20:37 -0400413 deps = [
414 ":fontmgr_custom",
415 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800416 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400417 public = [ "include/ports/SkFontMgr_empty.h" ]
418 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500419}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400420optional("fontmgr_custom_empty_factory") {
421 enabled = skia_enable_fontmgr_custom_empty
422 deps = [ ":fontmgr_custom_empty" ]
423 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
424}
Hal Canaryff2742e2018-01-30 11:35:47 -0500425
mtklein3cc22182016-08-29 13:26:14 -0700426optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400427 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700428
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400429 # The public header includes fontconfig.h and uses FcConfig*
430 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400431 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400432 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400433 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500434 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400435}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400436optional("fontmgr_fontconfig_factory") {
437 enabled = skia_enable_fontmgr_fontconfig
438 deps = [ ":fontmgr_fontconfig" ]
439 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
440}
Ben Wagner75626e42020-06-03 13:20:37 -0400441
442optional("fontmgr_FontConfigInterface") {
443 enabled = skia_enable_fontmgr_FontConfigInterface
444
445 deps = [
446 ":typeface_freetype",
447 "//third_party:fontconfig",
448 ]
449 public = [
450 "include/ports/SkFontConfigInterface.h",
451 "include/ports/SkFontMgr_FontConfigInterface.h",
452 ]
mtklein3cc22182016-08-29 13:26:14 -0700453 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700454 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700455 "src/ports/SkFontConfigInterface_direct.cpp",
456 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400457 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700458 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700459 ]
460}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400461optional("fontmgr_FontConfigInterface_factory") {
462 enabled = skia_enable_fontmgr_FontConfigInterface
463 deps = [ ":fontmgr_FontConfigInterface" ]
464 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
465}
mtklein3cc22182016-08-29 13:26:14 -0700466
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500467optional("fontmgr_fuchsia") {
468 enabled = skia_enable_fontmgr_fuchsia
469
Chinmay Garde89820762019-05-06 16:44:06 -0700470 deps = []
471
472 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700473 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700474 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500475 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700476 }
Ben Wagner75626e42020-06-03 13:20:37 -0400477 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
478 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500479}
480
Ben Wagner75626e42020-06-03 13:20:37 -0400481optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400482 enabled = skia_use_fonthost_mac
483
Ben Wagner75626e42020-06-03 13:20:37 -0400484 public = [
485 "include/ports/SkFontMgr_mac_ct.h",
486 "include/ports/SkTypeface_mac.h",
487 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400488 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400489 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400490 "src/ports/SkScalerContext_mac_ct.cpp",
491 "src/ports/SkScalerContext_mac_ct.h",
492 "src/ports/SkTypeface_mac_ct.cpp",
493 "src/ports/SkTypeface_mac_ct.h",
494 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000495 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400496
497 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400498 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400499 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
500 "AppKit.framework",
501 "ApplicationServices.framework",
502 ]
503 }
504
505 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400506 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400507 "CoreFoundation.framework",
508 "CoreGraphics.framework",
509 "CoreText.framework",
510
511 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
512 "UIKit.framework",
513 ]
514 }
515}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400516optional("fontmgr_mac_ct_factory") {
517 enabled = skia_use_fonthost_mac
518 deps = [ ":fontmgr_mac_ct" ]
519 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
520}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400521
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500522optional("fontmgr_win") {
523 enabled = skia_enable_fontmgr_win
524
Ben Wagner75626e42020-06-03 13:20:37 -0400525 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500526 sources = [
527 "src/fonts/SkFontMgr_indirect.cpp",
528 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500529 "src/ports/SkScalerContext_win_dw.cpp",
530 "src/ports/SkTypeface_win_dw.cpp",
531 ]
532}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400533optional("fontmgr_win_factory") {
534 enabled = skia_enable_fontmgr_win
535 deps = [ ":fontmgr_win" ]
536 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
537}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500538
539optional("fontmgr_win_gdi") {
540 enabled = skia_enable_fontmgr_win_gdi
541
Ben Wagner75626e42020-06-03 13:20:37 -0400542 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500543 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500544 libs = [ "Gdi32.lib" ]
545}
546
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700547if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400548 executable("sksllex") {
549 sources = [
550 "src/sksl/lex/Main.cpp",
551 "src/sksl/lex/NFA.cpp",
552 "src/sksl/lex/RegexNode.cpp",
553 "src/sksl/lex/RegexParser.cpp",
554 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500555 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400556 }
557
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700558 action("run_sksllex") {
559 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500560 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
561 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700562
563 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
564 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
565 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500566 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700567 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
568 # confused due to the same file being named by two different paths
569 ]
570 sksllex_path = "$root_out_dir/"
571 sksllex_path += "sksllex"
572 if (host_os == "win") {
573 sksllex_path += ".exe"
574 }
575 args = [
576 rebase_path(sksllex_path),
577 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400578 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700579 rebase_path("src"),
580 ]
581 }
582} else {
583 group("run_sksllex") {
584 }
585}
586
John Stilesd836f842020-09-14 10:21:44 -0400587# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
588if (skia_compile_processors || skia_compile_sksl_tests) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400589 executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500590 defines = [
591 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500592 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500593 "SK_ENABLE_SPIRV_VALIDATION",
594 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400595 sources = [
Brian Osman47726a12020-12-17 16:02:08 -0500596 "src/core/SkCpu.cpp",
597 "src/core/SkData.cpp",
598 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400599 "src/core/SkMalloc.cpp",
600 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400601 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500602 "src/core/SkStream.cpp",
603 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500604 "src/core/SkStringUtils.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400605 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500606 "src/core/SkUtils.cpp",
607 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400608 "src/gpu/GrBlockAllocator.cpp",
609 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500610 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400611 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500612 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400613 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500614 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400615 ]
Brian Osman47726a12020-12-17 16:02:08 -0500616 if (is_win) {
617 sources += [ "src/ports/SkOSFile_win.cpp" ]
618 } else {
619 sources += [ "src/ports/SkOSFile_posix.cpp" ]
620 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400621 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400622 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500623 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400624 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500625 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100626 "//third_party/externals/spirv-tools:spvtools",
627 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400628 ]
629 }
630
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400631 skslc_path = "$root_out_dir/"
632 if (host_toolchain != default_toolchain_name) {
633 skslc_path += "$host_toolchain/"
634 }
635 skslc_path += "skslc"
636 if (host_os == "win") {
637 skslc_path += ".exe"
638 }
639
Brian Osmandd496172020-08-08 08:17:18 -0400640 action("create_sksl_fp") {
641 script = "gn/create_sksl_fp.py"
642 sources = [
643 "include/private/GrSharedEnums.h",
644 "src/sksl/sksl_fp_raw.sksl",
645 ]
646 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
647 args = [
648 rebase_path(sources[0]),
649 rebase_path(sources[1]),
650 rebase_path(outputs[0]),
651 ]
652 }
653
654 copy("sksl_pre_includes") {
655 sources = [
656 "src/sksl/sksl_frag.sksl",
657 "src/sksl/sksl_geom.sksl",
658 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500659 "src/sksl/sksl_public.sksl",
Brian Osman91946752020-12-21 13:20:40 -0500660 "src/sksl/sksl_runtime.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400661 "src/sksl/sksl_vert.sksl",
662 ]
663 outputs = [ "$root_out_dir/{{source_file_part}}" ]
664 }
665
666 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
667 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
668
669 dehydrate_sksl_outputs = []
670 foreach(src, dehydrate_sksl_sources) {
671 name = get_path_info(src, "name")
672
673 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
674 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
675 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
676 "src/sksl/generated/$name.dehydrated.sksl",
677 target_out_dir) ]
678 }
679
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400680 action("dehydrate_sksl") {
681 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400682 deps = [
683 ":create_sksl_fp",
684 ":sksl_pre_includes",
685 ":skslc(//gn/toolchain:$host_toolchain)",
686 ]
687 sources = dehydrate_sksl_sources
688 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000689 args = [
690 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400691 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000692 ]
Brian Osmandd496172020-08-08 08:17:18 -0400693 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400694 }
John Stilesd836f842020-09-14 10:21:44 -0400695} else {
696 group("dehydrate_sksl") {
697 }
698}
699
700skia_gpu_processor_outputs = []
701if (skia_compile_processors) {
702 foreach(src, skia_gpu_processor_sources) {
703 dir = get_path_info(src, "dir")
704 name = get_path_info(src, "name")
705
706 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
707 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
708 skia_gpu_processor_outputs += [
709 "$target_out_dir/" +
710 rebase_path("$dir/generated/$name.h", target_out_dir),
711 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
712 # confused due to the same file being named by two different paths
713 ]
714 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400715
Ethan Nicholas762466e2017-06-29 10:03:38 -0400716 action("compile_processors") {
717 script = "gn/compile_processors.py"
718 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400719 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400720 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400721 ":skslc(//gn/toolchain:$host_toolchain)",
722 ]
723 sources = skia_gpu_processor_sources
724 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400725 args = [
726 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400727 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400728 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400729 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400730 args += rebase_path(skia_gpu_processor_sources)
731 }
732} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400733 group("compile_processors") {
734 }
John Stilesd836f842020-09-14 10:21:44 -0400735}
736
737if (skia_compile_sksl_tests) {
738 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400739
John Stiles7e248712020-09-24 16:42:09 -0400740 template("compile_sksl") {
741 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
742 action("compile_sksl_${target_name}") {
743 script = "gn/compile_sksl_tests.py"
744 deps = [
745 ":create_sksl_fp",
746 ":sksl_pre_includes",
747 ":skslc(//gn/toolchain:$host_toolchain)",
748 ]
John Stilesda57fc02021-01-22 11:54:30 -0500749 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400750 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500751 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500752 args = [
753 rebase_path(skslc_path),
754 invoker.lang,
755 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500756 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500757 ]
758
John Stilesbfc9be02021-01-22 11:55:48 -0500759 testsDir = get_path_info("tests", "abspath")
760 resourcesDir = get_path_info("resources", "abspath")
761
762 foreach(partialPath, invoker.sources) {
763 dst = testsDir + partialPath
764 src = resourcesDir + partialPath
765
766 dir = get_path_info(dst, "dir")
767 name = get_path_info(dst, "name")
768 ext = get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500769 response_file_contents += rebase_path([
770 src,
771 dir,
772 ])
John Stilesda57fc02021-01-22 11:54:30 -0500773 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500774
John Stilesda57fc02021-01-22 11:54:30 -0500775 foreach(outExtension, invoker.outExtensions) {
John Stilesc3012182020-12-08 15:07:00 -0500776 # SPIR-V uses separate extensions for .vert and .geom shaders.
777 if (outExtension == ".asm.frag" && ext == "vert") {
778 outExtension = ".asm.vert"
779 } else if (outExtension == ".asm.frag" && ext == "geom") {
780 outExtension = ".asm.geom"
781 }
John Stilesbfc9be02021-01-22 11:55:48 -0500782 outputs +=
783 [ target_out_dir + "/" +
784 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400785 }
786 }
John Stiles7e248712020-09-24 16:42:09 -0400787 }
John Stilesd836f842020-09-14 10:21:44 -0400788 }
John Stiles7e248712020-09-24 16:42:09 -0400789 compile_sksl("fp_tests") {
790 sources = sksl_fp_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500791 outExtensions = [
792 ".cpp",
793 ".h",
John Stiles7e248712020-09-24 16:42:09 -0400794 ]
795 lang = "--fp"
796 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400797 }
John Stiles7e248712020-09-24 16:42:09 -0400798 compile_sksl("glsl_tests") {
799 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500800 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400801 lang = "--glsl"
802 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400803 }
John Stiles7e248712020-09-24 16:42:09 -0400804 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400805 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500806 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400807 lang = "--glsl"
808 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400809 }
John Stilesaeae3a52020-09-25 13:35:58 -0400810 compile_sksl("metal_tests") {
811 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500812 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400813 lang = "--metal"
814 settings = "--settings"
815 }
Brian Osman977feec2020-12-22 11:28:59 -0500816 compile_sksl("skvm_tests") {
817 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500818 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500819 lang = "--skvm"
820 settings = "--settings"
821 }
Brian Osman62b039b2021-02-08 13:49:53 -0500822 compile_sksl("stage_tests") {
823 sources = sksl_stage_tests_sources
824 outExtensions = [ ".stage" ]
825 lang = "--stage"
826 settings = "--settings"
827 }
John Stilesdda1d312020-11-20 16:28:50 -0500828 compile_sksl("spirv_tests") {
829 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500830 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500831 lang = "--spirv"
832 settings = "--settings"
833 }
John Stilesd836f842020-09-14 10:21:44 -0400834} else {
John Stiles7e248712020-09-24 16:42:09 -0400835 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400836 }
John Stiles7e248712020-09-24 16:42:09 -0400837 group("compile_sksl_glsl_tests") {
838 }
839 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400840 }
John Stilesaeae3a52020-09-25 13:35:58 -0400841 group("compile_sksl_metal_tests") {
842 }
Brian Osman977feec2020-12-22 11:28:59 -0500843 group("compile_sksl_skvm_tests") {
844 }
John Stilesdda1d312020-11-20 16:28:50 -0500845 group("compile_sksl_spirv_tests") {
846 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400847}
848
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500849optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700850 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400851 deps = [
852 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400853 ":compile_sksl_fp_tests",
854 ":compile_sksl_glsl_nosettings_tests",
855 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400856 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500857 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500858 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400859 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700860 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400861 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700862 if (skia_generate_workarounds) {
863 deps += [ ":workaround_list" ]
864 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800865 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600866 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400867 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700868
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400869 sources =
870 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400871 if (!skia_enable_ccpr) {
872 sources -= skia_ccpr_sources
873 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
874 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400875 if (!skia_enable_nvpr) {
876 sources -= skia_nvpr_sources
877 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
878 }
mtklein06c35c02016-09-20 12:28:12 -0700879
Mike Klein703cf5a2016-10-13 17:18:04 -0400880 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400881 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700882
John Rosascoa9b348f2019-11-08 13:18:15 -0800883 if (skia_use_gl) {
884 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400885 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500886 sources += [
887 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
888 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
889 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400890
891 # this lib is required to link against AHardwareBuffer
892 if (defined(ndk_api) && ndk_api >= 26) {
893 libs += [ "android" ]
894 }
895 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500896 sources += [
897 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
898 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
899 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400900 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400901 } else if (skia_use_webgl) {
902 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400903 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500904 sources += [
905 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
906 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
907 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400908 libs += [ "GL" ]
909 } else if (is_mac) {
910 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
911 } else if (is_ios) {
912 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800913 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400914 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
915 if (target_cpu != "arm64") {
916 libs += [ "OpenGL32.lib" ]
917 }
918 } else {
919 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
920 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800921 sources += skia_gl_gpu_sources
922 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400923
mtkleine9fb3d52016-09-20 15:11:46 -0700924 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400925 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000926 if (skia_use_vma) {
927 deps += [ "third_party/vulkanmemoryallocator" ]
928 }
mtkleine9fb3d52016-09-20 15:11:46 -0700929 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700930 if (skia_enable_vulkan_debug_layers) {
931 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
932 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800933 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800934 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700935 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
936 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400937 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700938 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800939 }
mtkleine9fb3d52016-09-20 15:11:46 -0700940 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400941
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400942 if (is_android && (skia_use_gl || skia_use_vulkan)) {
943 # this lib is required to link against AHardwareBuffer
944 if (defined(ndk_api) && ndk_api >= 26) {
945 libs += [ "android" ]
946 }
947 }
948
Stephen White0d70b712019-07-10 15:51:30 -0400949 if (skia_use_dawn) {
950 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400951 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700952 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400953 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700954 "//third_party/externals/dawn/src/dawn:dawn_proc",
955 "//third_party/externals/dawn/src/dawn:dawncpp",
956 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400957 ]
958 if (dawn_enable_d3d12) {
959 libs += [
960 "d3d12.lib",
961 "dxgi.lib",
962 "d3dcompiler.lib",
963 ]
964 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400965 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400966 }
967 }
968
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500969 if (skia_use_direct3d) {
970 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400971 deps += [
972 "//third_party/d3d12allocator",
973 "//third_party/spirv-cross:spirv_cross",
974 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500975 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500976 if (skia_enable_direct3d_debug_layer) {
977 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
978 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500979 libs += [
980 "d3d12.lib",
981 "dxgi.lib",
982 "d3dcompiler.lib",
983 ]
984 }
985
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400986 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400987 if (skia_use_metal) {
988 public_defines += [ "SK_METAL" ]
989 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400990 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400991 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000992 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400993 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500994
Kevin Lubickf4def342018-10-04 12:52:50 -0400995 if (is_debug) {
996 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
997 }
mtklein06c35c02016-09-20 12:28:12 -0700998}
999
Leon Scroggins III41169202019-01-29 09:29:57 -05001000optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -05001001 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -05001002 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
1003 if ("True" ==
1004 exec_script("gn/checkpath.py",
1005 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
1006 "trim string")) {
1007 public_defines = [ "SK_USE_LIBGIFCODEC" ]
1008 public_include_dirs = [
1009 ".",
1010 skia_libgifcodec_path,
1011 ]
1012 include_dirs = public_include_dirs
1013 import(_libgifcodec_gni_path)
1014 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1015 ".",
1016 skia_libgifcodec_path)
1017 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001018}
1019
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001020optional("heif") {
1021 enabled = skia_use_libheif
1022 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1023
1024 deps = []
1025
Mike Kleina01c6b02020-04-01 13:47:34 -05001026 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001027}
1028
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001029optional("jpeg_decode") {
1030 enabled = skia_use_libjpeg_turbo_decode
1031 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1032
Mike Kleina01c6b02020-04-01 13:47:34 -05001033 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001034 sources = [
1035 "src/codec/SkJpegCodec.cpp",
1036 "src/codec/SkJpegDecoderMgr.cpp",
1037 "src/codec/SkJpegUtility.cpp",
1038 ]
1039}
1040
1041optional("jpeg_encode") {
1042 enabled = skia_use_libjpeg_turbo_encode
1043 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001044
Mike Kleina01c6b02020-04-01 13:47:34 -05001045 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1046 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001047 sources = [
mtklein63213812016-08-24 09:55:56 -07001048 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001049 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001050 ]
1051}
1052
Leon Scroggins III326b9892020-08-05 16:51:10 -04001053optional("ndk_images") {
1054 enabled = skia_use_ndk_images
1055 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1056 sources = [
1057 "src/ports/SkImageEncoder_NDK.cpp",
1058 "src/ports/SkImageGeneratorNDK.cpp",
1059 "src/ports/SkNDKConversions.cpp",
1060 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001061 libs = [ "jnigraphics" ]
1062}
1063
mtklein63213812016-08-24 09:55:56 -07001064optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001065 enabled = skia_use_zlib && skia_enable_pdf
1066 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001067
Mike Kleina01c6b02020-04-01 13:47:34 -05001068 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001069 if (skia_use_libjpeg_turbo_decode) {
1070 deps += [ ":jpeg_decode" ]
1071 }
1072 if (skia_use_libjpeg_turbo_encode) {
1073 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001074 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001075 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001076 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001077 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001078 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1079 deps += [ "//third_party/harfbuzz" ]
1080 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1081 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001082 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001083 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001084 }
1085}
1086
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001087optional("xps") {
1088 enabled = skia_use_xps && is_win
1089 public_defines = [ "SK_SUPPORT_XPS" ]
1090 public = skia_xps_public
1091 sources = skia_xps_sources
1092}
1093
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001094optional("png_decode") {
1095 enabled = skia_use_libpng_decode
1096 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001097
Mike Kleina01c6b02020-04-01 13:47:34 -05001098 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001099 sources = [
1100 "src/codec/SkIcoCodec.cpp",
1101 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001102 ]
1103}
1104
1105optional("png_encode") {
1106 enabled = skia_use_libpng_encode
1107 public_defines = [ "SK_ENCODE_PNG" ]
1108
Mike Kleina01c6b02020-04-01 13:47:34 -05001109 deps = [ "//third_party/libpng" ]
1110 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001111}
1112
scroggof84ad642016-10-31 09:02:57 -07001113optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001114 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001115 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1116
1117 deps = [
1118 "//third_party/dng_sdk",
1119 "//third_party/libjpeg-turbo:libjpeg",
1120 "//third_party/piex",
1121 ]
1122
1123 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1124 # Skia.
1125 configs_to_remove = [ "//gn:no_exceptions" ]
1126
Mike Kleina01c6b02020-04-01 13:47:34 -05001127 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001128}
1129
Mike Klein852a8cb2018-05-15 10:46:58 -04001130import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -04001131source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001132 cflags = []
1133 if (!is_win || is_clang) {
1134 cflags += [
1135 "-w",
1136 "-std=c11",
1137 ]
1138 }
1139
Mike Kleina01c6b02020-04-01 13:47:34 -05001140 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001141 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001142 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1143}
1144
mtklein3cc22182016-08-29 13:26:14 -07001145optional("typeface_freetype") {
1146 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001147
Mike Kleina01c6b02020-04-01 13:47:34 -05001148 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001149 sources = [
1150 "src/ports/SkFontHost_FreeType.cpp",
1151 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001152 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001153 ]
1154}
1155
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001156optional("webp_decode") {
1157 enabled = skia_use_libwebp_decode
1158 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001159
Mike Kleina01c6b02020-04-01 13:47:34 -05001160 deps = [ "//third_party/libwebp" ]
1161 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001162}
1163
1164optional("webp_encode") {
1165 enabled = skia_use_libwebp_encode
1166 public_defines = [ "SK_ENCODE_WEBP" ]
1167
Mike Kleina01c6b02020-04-01 13:47:34 -05001168 deps = [ "//third_party/libwebp" ]
1169 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001170}
1171
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001172optional("wuffs") {
1173 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001174 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001175
Mike Kleina01c6b02020-04-01 13:47:34 -05001176 deps = [ "//third_party/wuffs" ]
1177 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001178}
1179
mtklein63213812016-08-24 09:55:56 -07001180optional("xml") {
1181 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001182 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001183
Mike Kleina01c6b02020-04-01 13:47:34 -05001184 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001185 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001186 "src/svg/SkSVGCanvas.cpp",
1187 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001188 "src/xml/SkDOM.cpp",
1189 "src/xml/SkXMLParser.cpp",
1190 "src/xml/SkXMLWriter.cpp",
1191 ]
1192}
1193
Mike Klein613ad382019-06-06 11:42:02 -05001194optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001195 enabled = skia_enable_skvm_jit_when_possible
1196 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001197 if (skia_vtune_path != "") {
1198 public_defines += [ "SKVM_JIT_VTUNE" ]
1199 public_include_dirs = [ "$skia_vtune_path/include" ]
1200 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1201 }
Mike Klein613ad382019-06-06 11:42:02 -05001202}
1203
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001204if (skia_enable_gpu && skia_generate_workarounds) {
1205 action("workaround_list") {
1206 script = "tools/build_workaround_header.py"
1207
Mike Kleina01c6b02020-04-01 13:47:34 -05001208 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001209
1210 # see comments in skia_compile_processors about out dir path shenanigans.
1211 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001212 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001213
Mike Kleina01c6b02020-04-01 13:47:34 -05001214 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001215 args = [
1216 "--output-file",
1217 "$output_file",
1218 ]
1219
1220 foreach(file, inputs) {
1221 args += [ rebase_path(file, root_build_dir) ]
1222 }
1223 }
1224}
1225
mtkleinc04ff472016-06-23 10:29:30 -07001226component("skia") {
1227 public_configs = [ ":skia_public" ]
1228 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001229
Mike Klein607b0a72018-11-07 16:17:34 -05001230 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001231 ":fontmgr_FontConfigInterface",
1232 ":fontmgr_android",
1233 ":fontmgr_custom_directory",
1234 ":fontmgr_custom_embedded",
1235 ":fontmgr_custom_empty",
1236 ":fontmgr_fontconfig",
1237 ":fontmgr_fuchsia",
1238 ":fontmgr_mac_ct",
1239 ":fontmgr_win",
1240 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001241 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001242 ":pdf",
1243 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001244 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001245 ]
1246
mtkleinc04ff472016-06-23 10:29:30 -07001247 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001248 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001249 ":arm64",
1250 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001251 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001252 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001253 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001254 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001255 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001256 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001257 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001258 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001259 ":jpeg_decode",
1260 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001261 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001262 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001263 ":png_decode",
1264 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001265 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001266 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001267 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001268 ":sse2",
1269 ":sse41",
1270 ":sse42",
1271 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001272 ":webp_decode",
1273 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001274 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001275 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001276 ]
1277
Hal Canaryc25f4e92019-02-26 11:54:25 -05001278 public = skia_core_public
1279 public += skia_utils_public
1280 public += skia_effects_public
1281 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001282
mtkleinc04ff472016-06-23 10:29:30 -07001283 sources = []
brettwb9447282016-09-01 14:24:39 -07001284 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001285 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001286 sources += skia_effects_sources
1287 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001288 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001289 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001290 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001291 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001292 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001293 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001294 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001295 "src/codec/SkBmpCodec.cpp",
1296 "src/codec/SkBmpMaskCodec.cpp",
1297 "src/codec/SkBmpRLECodec.cpp",
1298 "src/codec/SkBmpStandardCodec.cpp",
1299 "src/codec/SkCodec.cpp",
1300 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001301 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001302 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001303 "src/codec/SkMaskSwizzler.cpp",
1304 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001305 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001306 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001307 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001308 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001309 "src/codec/SkSwizzler.cpp",
1310 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001311 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001312 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001313 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001314 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001315 "src/ports/SkMemory_malloc.cpp",
1316 "src/ports/SkOSFile_stdio.cpp",
1317 "src/sfnt/SkOTTable_name.cpp",
1318 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001319 ]
brettwb9447282016-09-01 14:24:39 -07001320
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001321 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001322 libs = []
1323
mtkleinc04ff472016-06-23 10:29:30 -07001324 if (is_win) {
1325 sources += [
1326 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001327 "src/ports/SkImageEncoder_WIC.cpp",
1328 "src/ports/SkImageGeneratorWIC.cpp",
1329 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001330 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001331 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001332 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001333 "Ole32.lib",
1334 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001335 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001336
1337 if (!skia_enable_winuwp) {
1338 libs += [
1339 "FontSub.lib",
1340 "User32.lib",
1341 "Usp10.lib",
1342 ]
1343 }
mtkleinc04ff472016-06-23 10:29:30 -07001344 } else {
1345 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001346 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001347 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001348 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001349 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001350 }
1351
mtklein7d6fb2c2016-08-25 14:50:44 -07001352 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001353 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001354 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001355 deps += [ "//third_party/cpu-features" ]
1356 }
mtklein06c35c02016-09-20 12:28:12 -07001357 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001358 libs += [
1359 "EGL",
1360 "GLESv2",
1361 "log",
1362 ]
1363 }
1364
Kevin Lubick217056c2018-09-20 17:39:31 -04001365 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001366 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001367 if (skia_use_egl) {
1368 libs += [ "GLESv2" ]
1369 }
mtkleinc04ff472016-06-23 10:29:30 -07001370 }
1371
1372 if (is_mac) {
1373 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001374 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001375 "src/ports/SkImageEncoder_CG.cpp",
1376 "src/ports/SkImageGeneratorCG.cpp",
1377 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001378 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001379 "ApplicationServices.framework",
1380 "OpenGL.framework",
1381 ]
mtkleinc04ff472016-06-23 10:29:30 -07001382 }
abarth6fc8ff02016-07-15 15:15:15 -07001383
Mike Klein7d302882016-11-03 14:06:31 -04001384 if (is_ios) {
1385 sources += [
1386 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001387 "src/ports/SkImageEncoder_CG.cpp",
1388 "src/ports/SkImageGeneratorCG.cpp",
1389 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001390 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001391 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001392 "ImageIO.framework",
1393 "MobileCoreServices.framework",
1394 ]
1395 }
1396
abarth6fc8ff02016-07-15 15:15:15 -07001397 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001398 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001399 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001400
1401 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001402 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001403 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1404 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001405
1406 if (skia_include_multiframe_procs) {
1407 sources += [ "tools/SkSharingProc.cpp" ]
1408 }
mtkleinc04ff472016-06-23 10:29:30 -07001409}
1410
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001411# DebugCanvas used in experimental/wasm-skp-debugger
1412if (target_cpu == "wasm") {
1413 static_library("debugcanvas") {
1414 public_configs = [ ":skia_public" ]
1415
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001416 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001417 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001418 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001419 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001420 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001421 "tools/debugger/DrawCommand.cpp",
1422 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001423 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001424 }
1425}
1426
Kevin Lubickcbcff382018-10-02 09:02:18 -04001427static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001428 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001429 public_configs = [ ":skia_public" ]
1430 configs += skia_library_configs
1431
1432 deps = [
1433 ":arm64",
1434 ":armv7",
1435 ":avx",
1436 ":crc32",
1437 ":hsw",
1438 ":none",
1439 ":sse2",
1440 ":sse41",
1441 ":sse42",
1442 ":ssse3",
1443 ]
1444
Kevin Lubickcbcff382018-10-02 09:02:18 -04001445 sources = []
1446 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001447 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001448 sources += [
1449 "src/core/SkAnalyticEdge.cpp",
1450 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001451 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001452 "src/core/SkCubicMap.cpp",
1453 "src/core/SkEdge.cpp",
1454 "src/core/SkEdgeBuilder.cpp",
1455 "src/core/SkEdgeClipper.cpp",
1456 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001457 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001458 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001459 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001460 "src/core/SkMallocPixelRef.cpp",
1461 "src/core/SkMath.cpp",
1462 "src/core/SkMatrix.cpp",
1463 "src/core/SkOpts.cpp",
1464 "src/core/SkPaint.cpp",
1465 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001466 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001467 "src/core/SkPathEffect.cpp",
1468 "src/core/SkPathMeasure.cpp",
1469 "src/core/SkPathRef.cpp",
1470 "src/core/SkPoint.cpp",
1471 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001472 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001473 "src/core/SkRect.cpp",
1474 "src/core/SkSemaphore.cpp",
1475 "src/core/SkStream.cpp",
1476 "src/core/SkString.cpp",
1477 "src/core/SkStringUtils.cpp",
1478 "src/core/SkStroke.cpp",
1479 "src/core/SkStrokeRec.cpp",
1480 "src/core/SkStrokerPriv.cpp",
1481 "src/core/SkThreadID.cpp",
1482 "src/core/SkUtils.cpp",
1483 "src/effects/SkDashPathEffect.cpp",
1484 "src/effects/SkTrimPathEffect.cpp",
1485 "src/ports/SkDebug_stdio.cpp",
1486 "src/ports/SkMemory_malloc.cpp",
1487 "src/utils/SkDashPath.cpp",
1488 "src/utils/SkParse.cpp",
1489 "src/utils/SkParsePath.cpp",
1490 "src/utils/SkUTF.cpp",
1491 ]
1492}
1493
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001494group("modules") {
1495 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001496 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001497 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001498 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001499 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001500 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001501 ]
1502}
1503
Brian Osmancd28fa62020-07-07 16:01:26 -04001504config("our_vulkan_headers") {
1505 include_dirs = [ "include/third_party/vulkan" ]
1506}
1507
mtkleinc095df52016-08-24 12:23:52 -07001508# Targets guarded by skia_enable_tools may use //third_party freely.
1509if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001510 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001511 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001512 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001513 "include/c",
1514 "include/codec",
1515 "include/config",
1516 "include/core",
1517 "include/docs",
1518 "include/effects",
1519 "include/encode",
1520 "include/gpu",
1521 "include/pathops",
1522 "include/ports",
1523 "include/svg",
1524 "include/utils",
1525 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001526 "modules/particles/include",
1527 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001528 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001529 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001530 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001531 ]
1532
Mike Klein308b5ac2016-12-06 16:03:52 -05001533 # Used by gn_to_bp.py to list our public include dirs.
1534 source_set("public") {
1535 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001536 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001537 }
1538
Mike Kleinc36dedf2016-11-18 09:35:28 -05001539 config("skia.h_config") {
1540 include_dirs = [ "$target_gen_dir" ]
1541 }
1542 action("skia.h") {
1543 public_configs = [ ":skia.h_config" ]
1544 skia_h = "$target_gen_dir/skia.h"
1545 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001546
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001547 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1548 [ rebase_path(skia_h, root_build_dir) ] +
1549 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001550 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001551 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001552 }
1553
Brian Osmanc9a42472018-05-31 13:17:12 -04001554 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001555 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001556 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001557 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001558 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001559 "tools/fiddle/draw.cpp",
1560 "tools/fiddle/fiddle_main.cpp",
1561 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001562
1563 if (skia_use_egl) {
1564 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001565 } else {
1566 sources += [ "tools/fiddle/null_context.cpp" ]
1567 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001568 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001569 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001570 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001571 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001572 ":skia",
1573 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001574 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001575 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001576 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001577 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001578 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001579 ]
1580 }
1581 }
1582
Mike Kleine5463e62020-06-11 13:53:53 -05001583 config("cpp14") {
1584 if (is_win) {
1585 cflags_cc = [ "/std:c++14" ]
1586 } else {
1587 cflags_cc = [ "-std=c++14" ]
1588 }
1589 }
1590
Brian Osmanc9a42472018-05-31 13:17:12 -04001591 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001592 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001593 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001594 configs += [
1595 ":our_vulkan_headers",
1596 ":cpp14",
1597 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001598 deps = [
1599 ":skia",
1600 ":skia.h",
1601 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001602 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001603 ]
Stephen White0d70b712019-07-10 15:51:30 -04001604
1605 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001606 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001607 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001608 }
1609
mtkleinc095df52016-08-24 12:23:52 -07001610 template("test_lib") {
1611 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001612 if (defined(invoker.public_defines)) {
1613 defines = invoker.public_defines
1614 }
mtklein25c81d42016-07-27 13:55:26 -07001615 }
mtkleinc095df52016-08-24 12:23:52 -07001616 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001617 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001618 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001619 public_configs = [
1620 ":" + target_name + "_config",
1621 ":skia_private",
1622 ]
1623
1624 if (!defined(deps)) {
1625 deps = []
1626 }
1627 deps += [ ":skia" ]
1628 testonly = true
1629 }
mtklein25c81d42016-07-27 13:55:26 -07001630 }
mtklein25c81d42016-07-27 13:55:26 -07001631
Mike Kleine6682eb2017-01-05 10:54:57 -05001632 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001633 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001634 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001635 forward_variables_from(invoker,
1636 "*",
1637 [
1638 "output_name",
1639 "visibility",
1640 "is_shared_library",
1641 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001642 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001643 extra_configs = [ ":skia_private" ]
1644 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1645 data_sources = [ "resources" ]
1646 if ("True" == exec_script("//gn/checkdir.py",
1647 [ rebase_path("skps", root_build_dir) ],
1648 "trim string")) {
1649 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001650 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001651 }
1652 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001653 # !is_ios
1654
Jim Van Verth92411c72020-04-03 15:18:31 -04001655 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001656 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1657 shared_library("lib" + target_name) {
1658 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1659 configs += [ ":skia_private" ]
1660 testonly = true
1661 }
1662 } else {
1663 _executable = target_name
1664 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001665 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001666 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1667 configs += [ ":skia_private" ]
1668 testonly = true
1669 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001670 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001671 if (is_android && skia_android_serial != "" && defined(_executable)) {
1672 action("push_" + target_name) {
1673 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001674 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001675 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001676 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001677 args = [
1678 rebase_path("$root_build_dir/$_executable"),
1679 skia_android_serial,
1680 rebase_path(_stamp),
1681 ]
1682 testonly = true
1683 }
Mike Klein7d921032017-01-05 12:20:41 -05001684 }
1685 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001686 }
1687
mtkleinc095df52016-08-24 12:23:52 -07001688 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001689 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001690
Mike Klein9e25bb92019-04-29 09:46:36 -05001691 # Bots and even devs may not have Vulkan headers, so put
1692 # include/third_party/vulkan on our path so they're always available.
1693 all_dependent_configs = [ ":our_vulkan_headers" ]
1694
Mike Klein333fb452019-04-24 08:48:11 -05001695 defines = []
1696 if (skia_enable_discrete_gpu) {
1697 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1698 }
1699
Brian Osmanc9a42472018-05-31 13:17:12 -04001700 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001701 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001702 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001703 "tools/gpu/BackendSurfaceFactory.cpp",
1704 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001705 "tools/gpu/BackendTextureImageFactory.cpp",
1706 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001707 "tools/gpu/FlushFinishTracker.cpp",
1708 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001709 "tools/gpu/GrContextFactory.cpp",
1710 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001711 "tools/gpu/ManagedBackendTexture.cpp",
1712 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001713 "tools/gpu/MemoryCache.cpp",
1714 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001715 "tools/gpu/ProxyUtils.cpp",
1716 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001717 "tools/gpu/TestOps.cpp",
1718 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001719 "tools/gpu/YUVUtils.cpp",
1720 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001721 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1722 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001723 "tools/gpu/mock/MockTestContext.cpp",
1724 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001725
1726 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001727 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001728
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001729 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001730 sources +=
1731 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001732 if (is_ios) {
1733 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001734 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001735 } else if (is_mac) {
1736 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001737 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001738 if (skia_use_angle) {
1739 deps += [ "//third_party/angle2" ]
1740 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1741 }
Brian Salomon1171d312020-03-19 08:47:44 -04001742 }
1743
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001744 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1745 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001746 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001747 if (is_android || skia_use_egl) {
1748 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1749 libs += [ "EGL" ]
1750 } else if (is_linux) {
1751 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1752 libs += [
1753 "GLU",
1754 "GL",
1755 "X11",
1756 ]
1757 } else if (is_win) {
1758 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1759 libs += [ "Gdi32.lib" ]
1760 if (target_cpu != "arm64") {
1761 libs += [ "OpenGL32.lib" ]
1762 }
1763 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001764 }
Greg Daniel54200e42018-12-11 17:03:39 -05001765
Brian Osmanc9a42472018-05-31 13:17:12 -04001766 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001767 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001768 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001769 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1770 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001771 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001772 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001773 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1774 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001775 }
1776 if (skia_use_metal) {
1777 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001778 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001779 if (skia_use_direct3d) {
1780 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001781 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001782 }
Stephen White985741a2019-07-18 11:43:45 -04001783 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001784 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001785 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001786 if (is_clang) {
1787 cflags_cc = [ "-Wno-microsoft-cast" ]
1788 }
Stephen White985741a2019-07-18 11:43:45 -04001789 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001790
1791 if (is_fuchsia && using_fuchsia_sdk) {
1792 libs +=
1793 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1794 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001795 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001796
mtkleinc095df52016-08-24 12:23:52 -07001797 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001798 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001799 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001800
1801 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001802 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1803 deps = [ ":flags" ]
1804 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001805 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001806 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001807 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1808 deps = [ ":flags" ]
1809 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001810 }
1811 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001812 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1813 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001814 }
1815 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001816 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1817 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001818 }
mtklein25c81d42016-07-27 13:55:26 -07001819
Mike Klein499f0ac2019-03-25 13:00:12 -05001820 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001821 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001822 sources = [
1823 "tools/trace/ChromeTracingTracer.cpp",
1824 "tools/trace/ChromeTracingTracer.h",
1825 "tools/trace/EventTracingPriv.cpp",
1826 "tools/trace/EventTracingPriv.h",
1827 "tools/trace/SkDebugfTracer.cpp",
1828 "tools/trace/SkDebugfTracer.h",
1829 ]
1830 }
1831
mtkleinc095df52016-08-24 12:23:52 -07001832 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001833 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001834 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001835 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001836 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001837 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001838 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001839 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001840 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001841 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001842 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001843 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001844 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001845 "tools/SkMetaData.cpp",
1846 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001847 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001848 "tools/SkSharingProc.h",
1849 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001850 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001851 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001852 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001853 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001854 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001855 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001856 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001857 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001858 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001859 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001860 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001861 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001862 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001863 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001864 "tools/fonts/TestEmptyTypeface.h",
1865 "tools/fonts/TestFontMgr.cpp",
1866 "tools/fonts/TestFontMgr.h",
1867 "tools/fonts/TestSVGTypeface.cpp",
1868 "tools/fonts/TestSVGTypeface.h",
1869 "tools/fonts/TestTypeface.cpp",
1870 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001871 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001872 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001873 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001874 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001875 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001876 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001877 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001878 if (target_cpu != "wasm") {
1879 sources += [ "tools/CrashHandler.cpp" ]
1880 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001881 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001882 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001883 if (is_ios) {
1884 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001885 sources += [ "tools/ios_utils.h" ]
1886 if (skia_use_metal) {
1887 sources += [ "tools/AutoreleasePool.mm" ]
1888 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001889 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001890 } else if (is_mac) {
1891 if (skia_use_metal) {
1892 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001893 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001894 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001895 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001896 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001897 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001898
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001899 defines = []
1900 if (skia_tools_require_resources) {
1901 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1902 }
mtkleinc095df52016-08-24 12:23:52 -07001903 deps = [
1904 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001905 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001906 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001907 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001908 }
mtklein25c81d42016-07-27 13:55:26 -07001909
Mike Kleine11e5c12019-04-24 12:46:06 -05001910 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001911 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001912 }
1913
Mike Klein6e744122016-10-27 12:21:40 -04001914 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001915 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001916 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001917 if (skia_use_gl) {
1918 sources += gl_gm_sources
1919 }
mtkleinc095df52016-08-24 12:23:52 -07001920 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001921 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001922 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001923 ":skia",
1924 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001925 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001926 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001927 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001928 "modules/skparagraph",
1929 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001930 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001931 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001932 if (is_skia_dev_build) {
1933 sources += [ "gm/fiddle.cpp" ]
1934 deps += [ ":skia.h" ]
1935 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001936 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001937
1938 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001939 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001940 sources += [ "gm/video_decoder.cpp" ]
1941 }
mtkleinc095df52016-08-24 12:23:52 -07001942 }
mtklein25c81d42016-07-27 13:55:26 -07001943
Ben Wagnerbded42a2021-02-17 22:14:34 -05001944 test_lib("test") {
1945 sources = [
1946 "tests/Test.cpp",
1947 "tests/Test.h",
1948 "tests/TestUtils.cpp",
1949 "tests/TestUtils.h",
1950 ]
1951 deps = [
1952 ":flags",
1953 ":skia",
1954 ":tool_utils",
1955 ]
1956 public_deps = [
1957 ":gpu_tool_utils", # Test.h #includes headers from this target.
1958 ]
1959 }
1960
Mike Klein6e744122016-10-27 12:21:40 -04001961 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001962 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001963 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001964 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001965 if (skia_use_metal) {
1966 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001967 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001968 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001969 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001970 if (skia_use_gl) {
1971 sources += gl_tests_sources
1972 }
mtkleinc095df52016-08-24 12:23:52 -07001973 deps = [
1974 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05001975 ":fontmgr_android_tests",
1976 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00001977 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07001978 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05001979 ":test",
mtkleinc095df52016-08-24 12:23:52 -07001980 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001981 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001982 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001983 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001984 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001985 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05001986 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001987 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001988 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001989 "//third_party/zlib",
1990 ]
1991 }
mtklein2f3416d2016-08-02 16:02:05 -07001992
Mike Klein6e744122016-10-27 12:21:40 -04001993 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001994 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001995 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001996 deps = [
1997 ":flags",
1998 ":gm",
1999 ":gpu_tool_utils",
2000 ":skia",
2001 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002002 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002003 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002004 ]
2005 }
mtklein2b6870c2016-07-28 14:17:33 -07002006
Mike Reedd62d4062019-06-12 10:20:44 -04002007 test_lib("experimental_xform") {
2008 sources = [
2009 "experimental/xform/SkShape.cpp",
2010 "experimental/xform/SkXform.cpp",
2011 "experimental/xform/XContext.cpp",
2012 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002013 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002014 }
2015
Florin Malitabfe876a2018-09-02 12:33:59 -04002016 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04002017 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002018 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04002019 }
Florin Malitab3418102020-10-15 18:10:29 -04002020 test_app("svg_tool") {
2021 deps = [ "modules/svg:tool" ]
2022 }
Florin Malita79725d32018-06-05 16:16:57 -04002023 }
2024
Hal Canary5b39dc82019-04-17 13:29:46 -04002025 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002026 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2027 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002028 }
2029
Chris Dalton2b598902020-03-25 10:50:35 -06002030 import("gn/samples.gni")
2031 test_lib("samples") {
2032 sources = samples_sources
Mike Kleina01c6b02020-04-01 13:47:34 -05002033 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002034 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002035 ":flags",
2036 ":gpu_tool_utils",
2037 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002038 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002039 "modules/skparagraph:samples",
2040 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002041 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002042 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002043 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002044 }
Kevin Lubick00398742020-10-08 10:05:07 -04002045 test_lib("hash_and_encode") {
2046 sources = [
2047 "tools/HashAndEncode.cpp",
2048 "tools/HashAndEncode.h",
2049 ]
2050 deps = [
2051 ":flags",
2052 ":skia",
2053 "//third_party/libpng",
2054 ]
2055 }
Chris Dalton2b598902020-03-25 10:50:35 -06002056 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002057 test_app("convert-to-nia") {
2058 sources = [ "tools/convert-to-nia.cpp" ]
2059 deps = [ ":skia" ]
2060 }
Mike Klein7af351a2018-07-27 09:54:43 -04002061 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002062 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002063 deps = [
2064 ":skcms",
2065 ":skia",
2066 ]
2067 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002068 test_app("fm") {
2069 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002070 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002071 "tools/fm/fm.cpp",
2072 ]
2073 deps = [
2074 ":common_flags_aa",
2075 ":common_flags_gpu",
2076 ":flags",
2077 ":gm",
2078 ":gpu_tool_utils",
2079 ":hash_and_encode",
2080 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002081 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002082 ":tool_utils",
2083 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002084 "modules/skottie",
2085 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002086 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002087 ]
2088 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002089 test_app("dm") {
2090 sources = [
2091 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002092 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002093 "dm/DMJsonWriter.cpp",
2094 "dm/DMSrcSink.cpp",
2095 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002096 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002097 ":common_flags_aa",
2098 ":common_flags_config",
2099 ":common_flags_gpu",
2100 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002101 ":flags",
2102 ":gm",
2103 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002104 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002105 ":skia",
2106 ":tests",
2107 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002108 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002109 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002110 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002111 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002112 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002113 ]
2114 }
Robert Phillipscd1e3972021-02-22 17:24:22 -05002115 test_app("ddlbench") {
2116 sources = [ "experimental/ddlbench/ddlbench.cpp" ]
2117 deps = [
2118 ":flags",
2119 ":skia",
2120 ":tool_utils",
2121 ]
2122 }
Michael Ludwig30217952020-12-04 12:58:35 -05002123
2124 # optional separate library to dlopen when running CanvasStateTests.
2125 shared_library("canvas_state_lib") {
2126 sources = [
2127 "tests/CanvasStateHelpers.cpp",
2128 "tests/CanvasStateHelpers.h",
2129 ]
2130 deps = [ ":skia" ]
2131 }
Brian Osman16adfa32016-10-18 14:42:44 -04002132 }
2133
Mike Kleina8a51ce2018-01-09 12:34:11 -05002134 if (!is_win) {
2135 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002136 sources = [ "tools/remote_demo.cpp" ]
2137 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002138 }
2139 }
2140
Hal Canarye107faa2019-10-23 12:52:33 -04002141 if (!is_win) {
2142 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002143 sources = [ "tools/blob_cache_sim.cpp" ]
2144 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002145 }
2146 }
2147
Mike Kleine6682eb2017-01-05 10:54:57 -05002148 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002149 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002150 deps = [
2151 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002152 ":common_flags_aa",
2153 ":common_flags_config",
2154 ":common_flags_gpu",
2155 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002156 ":flags",
2157 ":gm",
2158 ":gpu_tool_utils",
2159 ":skia",
2160 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002161 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002162 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002163 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002164 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002165 ]
mtklein2b6870c2016-07-28 14:17:33 -07002166 }
halcanary19a97202016-08-03 15:08:04 -07002167
Ravi Mistry10d36c52017-01-31 09:49:18 -05002168 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002169 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002170 deps = [
2171 ":flags",
2172 ":skia",
2173 ]
2174 }
2175
Mike Reedc0ee21f2019-05-28 16:11:03 -04002176 if (skia_use_ffmpeg) {
2177 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002178 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002179 deps = [
2180 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002181 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002182 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002183 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002184 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002185 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002186 ]
2187 }
2188 }
2189
Brian Osmanc9a42472018-05-31 13:17:12 -04002190 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002191 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002192 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002193 ":common_flags_config",
2194 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002195 ":flags",
2196 ":gpu_tool_utils",
2197 ":skia",
2198 ":tool_utils",
2199 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002200 }
2201
Mike Kleine6682eb2017-01-05 10:54:57 -05002202 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002203 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002204 deps = [
2205 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002206 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002207 ]
halcanary3eee9d92016-09-10 07:01:53 -07002208 }
mtklein046cb562016-09-16 10:23:12 -07002209
Ben Wagner219f3622017-07-17 15:32:25 -04002210 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002211 sources = [ "tools/fonts/create_test_font.cpp" ]
2212 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002213 assert_no_deps = [
2214 # tool_utils requires the output of this app.
2215 ":tool_utils",
2216 ]
2217 }
2218
Florin Malita5d3ff432018-07-31 16:38:43 -04002219 if (skia_use_expat) {
2220 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002221 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002222 deps = [
2223 ":flags",
2224 ":skia",
2225 ":tool_utils",
2226 ]
2227 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002228 }
2229
Mike Kleine6682eb2017-01-05 10:54:57 -05002230 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002231 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002232 deps = [
2233 ":flags",
2234 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002235 ]
mtklein046cb562016-09-16 10:23:12 -07002236 }
mtkleinecbc5262016-09-22 11:51:24 -07002237
Brian Osman6788a542018-12-10 11:56:01 -05002238 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002239 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002240 sources = [
2241 "tools/skiaserve/Request.cpp",
2242 "tools/skiaserve/Response.cpp",
2243 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002244 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2245 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2246 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2247 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2248 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2249 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2250 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2251 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2252 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002253 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2254 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002255 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2256 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2257 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2258 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2259 ]
2260 deps = [
2261 ":flags",
2262 ":gpu_tool_utils",
2263 ":skia",
2264 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002265 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002266 ]
Mike Klein7d302882016-11-03 14:06:31 -04002267 }
mtkleinecbc5262016-09-22 11:51:24 -07002268 }
kjlubick14f984b2016-10-03 11:49:45 -07002269
Mike Kleine6682eb2017-01-05 10:54:57 -05002270 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002271 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002272 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002273 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002274 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002275 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002276 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002277 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002278 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002279 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002280 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002281 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002282 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002283 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002284 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002285 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002286 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002287 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002288 "fuzz/FuzzSkParagraph.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002289 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002290 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2291 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002292 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002293 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002294 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002295 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002296 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2297 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002298 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002299 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2300 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002301 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002302 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002303 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002304 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002305 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002306 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002307 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002308 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002309 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002310 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002311 "tools/debugger/DrawCommand.cpp",
2312 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002313 ]
2314 deps = [
2315 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002316 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002317 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002318 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002319 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002320 ]
kjlubick14f984b2016-10-03 11:49:45 -07002321 }
Mike Klein38312422016-10-05 15:41:01 -04002322
Mike Kleine6682eb2017-01-05 10:54:57 -05002323 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002324 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002325 rebase_path("tests/skia_test.cpp"),
2326 rebase_path("tests/Test.cpp"),
2327 ]
caryclark9feb6322016-10-25 08:58:26 -07002328 deps = [
2329 ":flags",
2330 ":gpu_tool_utils",
2331 ":skia",
2332 ":tool_utils",
2333 ]
caryclark9feb6322016-10-25 08:58:26 -07002334 }
2335
Mike Kleine6682eb2017-01-05 10:54:57 -05002336 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002337 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002338 deps = [
2339 ":flags",
2340 ":skia",
2341 ]
Mike Klein38312422016-10-05 15:41:01 -04002342 }
bungemanfe917272016-10-13 17:36:40 -04002343
Mike Kleine6682eb2017-01-05 10:54:57 -05002344 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002345 sources = [
2346 "tools/skdiff/skdiff.cpp",
2347 "tools/skdiff/skdiff_html.cpp",
2348 "tools/skdiff/skdiff_main.cpp",
2349 "tools/skdiff/skdiff_utils.cpp",
2350 ]
2351 deps = [
2352 ":skia",
2353 ":tool_utils",
2354 ]
bungemanfe917272016-10-13 17:36:40 -04002355 }
halcanarya73d76a2016-10-17 13:19:02 -07002356
Mike Kleine6682eb2017-01-05 10:54:57 -05002357 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002358 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002359 deps = [
2360 ":skia",
2361 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002362 ]
halcanarya73d76a2016-10-17 13:19:02 -07002363 }
Brian Osman16adfa32016-10-18 14:42:44 -04002364
Brian Osmanc9a42472018-05-31 13:17:12 -04002365 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002366 source_set("skqp_lib") {
2367 check_includes = false
2368 testonly = true
2369 if (!is_official_build) {
2370 configs -= [ "//gn:warnings" ]
2371 }
2372 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002373 defines =
2374 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002375 sources = [
2376 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002377 "tools/skqp/src/skqp.cpp",
2378 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002379 ]
2380 deps = [
2381 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002382 ":skia",
2383 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002384 ":tool_utils",
2385 ]
2386 }
2387 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002388 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002389 include_dirs = [ "//" ]
2390 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002391 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002392 }
2393 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002394 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002395 deps = [
2396 ":gm",
2397 ":skia",
2398 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002399 ]
2400 }
2401 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002402 if (is_fuchsia) {
2403 # Build a package repository for skqp on Fuchsia.
2404 group("skqp_repo") {
2405 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002406 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002407 }
2408 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002409 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002410 shared_library("libskqp_app") {
2411 configs += [ ":skia_private" ]
2412 if (!is_official_build) {
2413 configs -= [ "//gn:warnings" ]
2414 }
2415 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002416 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002417 deps = [
2418 ":skia",
2419 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002420 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002421 ]
2422 libs = [ "android" ]
2423 }
2424 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002425 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002426 test_app("skottie_android") {
2427 is_shared_library = true
2428
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002429 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002430 libs = []
2431
Stan Iliev93151722018-08-02 11:10:52 -04002432 deps = [
2433 ":skia",
2434 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002435 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002436 ]
2437 }
2438 }
Hal Canary75427132017-10-11 16:00:31 -04002439
Hal Canarya9de7602018-01-19 13:08:23 -05002440 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002441 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002442 deps = [
2443 ":gm",
2444 ":skia",
2445 ]
2446 }
2447 test_app("list_gpu_unit_tests") {
2448 sources = [
2449 "dm/DMGpuTestProcs.cpp",
2450 "tools/list_gpu_unit_tests.cpp",
2451 ]
2452 deps = [
2453 ":skia",
2454 ":tests",
2455 ]
2456 }
2457
Brian Osmanc9a42472018-05-31 13:17:12 -04002458 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002459 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002460 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002461 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002462 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002463 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002464 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002465 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002466 "tools/sk_app/CommandSet.h",
2467 "tools/sk_app/DisplayParams.h",
2468 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002469 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002470 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002471 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002472 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002473 ]
2474 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002475 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002476
2477 if (is_android) {
2478 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002479 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002480 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002481 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002482 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002483 "tools/sk_app/android/main_android.cpp",
2484 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002485 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002486 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002487 libs += [ "android" ]
2488 } else if (is_linux) {
2489 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002490 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002491 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002492 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002493 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002494 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002495 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002496 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002497 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002498 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002499 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002500 "X11",
2501 ]
2502 } else if (is_win) {
2503 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002504 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002505 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002506 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002507 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002508 "tools/sk_app/win/main_win.cpp",
2509 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002510 } else if (is_mac) {
2511 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002512 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002513 "tools/sk_app/mac/WindowContextFactory_mac.h",
2514 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002515 "tools/sk_app/mac/Window_mac.mm",
2516 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002517 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002518 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002519 "QuartzCore.framework",
2520 "Cocoa.framework",
2521 "Foundation.framework",
2522 ]
2523 } else if (is_ios) {
2524 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002525 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002526 "tools/sk_app/ios/WindowContextFactory_ios.h",
2527 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002528 "tools/sk_app/ios/Window_ios.mm",
2529 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002530 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002531 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002532 }
2533
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002534 if (skia_use_gl) {
2535 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002536 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002537 if (is_android) {
2538 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2539 } else if (is_linux) {
2540 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2541 } else if (is_win) {
2542 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2543 if (skia_use_angle) {
2544 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2545 }
2546 } else if (is_mac) {
2547 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2548 } else if (is_ios) {
2549 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2550 }
2551 }
2552
Brian Osmanc9a42472018-05-31 13:17:12 -04002553 if (skia_use_vulkan) {
2554 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002555 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002556 if (is_android) {
2557 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2558 } else if (is_linux) {
2559 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2560 libs += [ "X11-xcb" ]
2561 } else if (is_win) {
2562 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2563 }
2564 }
2565
Jim Van Verthbe39f712019-02-08 15:36:14 -05002566 if (skia_use_metal) {
2567 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002568 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002569 if (is_mac) {
2570 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002571 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002572 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002573 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002574 }
2575
Jim Van Verth682a2f42020-05-13 16:54:09 -04002576 if (skia_use_direct3d) {
2577 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2578 }
2579
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002580 if (skia_use_dawn) {
2581 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002582 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002583 if (is_linux) {
2584 if (dawn_enable_vulkan) {
2585 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2586 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2587 libs += [ "X11-xcb" ]
2588 }
2589 } else if (is_win) {
2590 if (dawn_enable_d3d12) {
2591 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2592 }
2593 } else if (is_mac) {
2594 if (dawn_enable_metal) {
2595 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2596 }
2597 }
2598 }
2599
Mike Kleina01c6b02020-04-01 13:47:34 -05002600 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002601 if (is_android) {
2602 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002603 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002604 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002605 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002606 }
Brian Osman16adfa32016-10-18 14:42:44 -04002607 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002608
Hal Canary87515122019-03-15 14:22:51 -04002609 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2610 test_app("fiddle_examples") {
2611 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002612 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002613 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002614 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002615 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002616 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002617 cflags = [
2618 "/wd4756", # Overflow in constant arithmetic
2619 "/wd4305", # truncation from 'double' to 'float'
2620 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002621 }
Hal Canary87515122019-03-15 14:22:51 -04002622 deps = [
2623 ":skia",
2624 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002625 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002626 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002627 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002628 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002629 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002630 ]
2631 }
2632 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002633
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002634 # sk_app can work without GL but viewer always runs raster through a GL window context.
2635 if (skia_use_gl) {
2636 test_app("viewer") {
2637 is_shared_library = is_android
2638 sources = [
2639 "tools/viewer/AnimTimer.h",
2640 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002641 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002642 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002643 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002644 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002645 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002646 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002647 "tools/viewer/ImageSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002648 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002649 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002650 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002651 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002652 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002653 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002654 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002655 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002656 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002657 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002658 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002659 "tools/viewer/SkottieSlide.h",
2660 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002661 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002662 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002663 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002664 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002665 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002666 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002667 "tools/viewer/TouchGesture.cpp",
2668 "tools/viewer/TouchGesture.h",
2669 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002670 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002671 ]
2672 libs = []
2673
2674 deps = [
2675 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002676 ":flags",
2677 ":gm",
2678 ":gpu_tool_utils",
2679 ":samples",
2680 ":sk_app",
2681 ":skia",
2682 ":tool_utils",
2683 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002684 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002685 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002686 "modules/particles",
2687 "modules/skottie",
2688 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002689 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002690 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002691 "//third_party/imgui",
2692 ]
2693 if (skia_use_experimental_xform) {
2694 deps += [ ":experimental_xform" ]
2695 sources += [ "gm/xform.cpp" ]
2696 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002697 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002698 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002699 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002700
Corentin Wallez89d6e792021-03-08 15:25:34 +01002701 #spvtools depends on this but doesn't deps it in.
2702 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002703 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002704 }
Mike Reedd62d4062019-06-12 10:20:44 -04002705 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002706 }
2707
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002708 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002709 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002710 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002711 libs = []
2712
Brian Osmaneff04b52017-11-21 13:18:02 -05002713 deps = [
2714 ":flags",
2715 ":gpu_tool_utils",
2716 ":sk_app",
2717 ":skia",
2718 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002719 ]
2720 }
2721 }
2722
Mike Klein9f6468f2020-05-19 13:14:40 -05002723 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002724 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002725 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002726 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002727 deps = [
2728 ":gpu_tool_utils",
2729 ":skia",
2730 "//third_party/libsdl",
2731 ]
2732 }
2733 }
2734
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002735 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2736 action_foreach("generate_mocs") {
2737 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002738 sources = [ "tools/mdbviz/MainWindow.h" ]
2739 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002740 args = [
2741 "$skia_qt_path" + "/bin/moc",
2742 "{{source}}",
2743 "-o",
2744 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2745 ]
2746 }
2747 action_foreach("generate_resources") {
2748 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002749 sources = [ "tools/mdbviz/resources.qrc" ]
2750 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002751 args = [
2752 "$skia_qt_path" + "/bin/rcc",
2753 "{{source}}",
2754 "-o",
2755 "gen/mdbviz/{{source_name_part}}_res.cpp",
2756 ]
2757 }
2758 test_app("mdbviz") {
2759 if (is_win) {
2760 # on Windows we need to disable some exception handling warnings due to the Qt headers
2761 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2762 }
2763 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002764 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002765 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002766 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002767 "tools/debugger/DrawCommand.cpp",
2768 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002769 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002770 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002771 "tools/mdbviz/main.cpp",
2772
2773 # generated files
2774 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2775 "$target_gen_dir/mdbviz/resources_res.cpp",
2776 ]
2777 lib_dirs = [ "$skia_qt_path/lib" ]
2778 libs = [
2779 "Qt5Core.lib",
2780 "Qt5Gui.lib",
2781 "Qt5Widgets.lib",
2782 ]
2783 include_dirs = [
2784 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002785 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002786 "$skia_qt_path/include/QtWidgets",
2787 ]
2788 deps = [
2789 ":generate_mocs",
2790 ":generate_resources",
2791 ":skia",
2792 ]
2793 }
2794 }
2795
Mike Kleine459afd2017-03-03 09:21:30 -05002796 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002797 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002798 sources = [ "$ndk/$ndk_gdbserver" ]
2799 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002800 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002801 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002802
2803 if (skia_use_opencl) {
2804 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002805 sources = [ "tools/hello-opencl.cpp" ]
2806 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002807 }
2808 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002809
Brian Osmanf564f152019-07-23 15:14:30 -04002810 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002811 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002812 deps = [
2813 ":skia",
2814 "modules/particles",
2815 ]
2816 }
2817
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002818 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002819 test_app("editor") {
2820 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002821 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002822 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002823 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002824
2825 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002826 sources = [ "tools/image_diff_metric.cpp" ]
2827 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002828 }
Chris Dalton2b598902020-03-25 10:50:35 -06002829
2830 group("modules_testonly") {
2831 testonly = true
2832 deps = []
2833 if (target_cpu == "wasm") {
2834 deps += [ "modules/canvaskit:viewer_wasm" ]
2835 }
2836 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002837
2838 if (skia_build_fuzzers) {
2839 template("libfuzzer_app") {
2840 output_dir = root_build_dir
2841 executable(target_name) {
2842 check_includes = false
2843 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2844 configs += [ ":skia_private" ]
2845 sources += [
2846 "fuzz/Fuzz.cpp",
2847 "fuzz/FuzzCommon.cpp",
2848 ]
2849 deps += [
2850 ":flags",
2851 ":gpu_tool_utils",
2852 ":skia",
2853 ]
2854 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2855 if (skia_use_libfuzzer_defaults) {
2856 cflags = [ "-fsanitize=fuzzer" ]
2857 ldflags = [ "-fsanitize=fuzzer" ]
2858 }
2859 testonly = true
2860 }
2861 }
2862
2863 libfuzzer_app("region_deserialize") {
2864 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2865 deps = []
2866 }
2867
2868 libfuzzer_app("image_filter_deserialize") {
2869 include_dirs = [
2870 "tools",
2871 "tools/fonts",
2872 ]
2873 sources = [
2874 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2875 "tools/Resources.cpp",
2876 "tools/fonts/TestFontMgr.cpp",
2877 "tools/fonts/TestSVGTypeface.cpp",
2878 "tools/fonts/TestTypeface.cpp",
2879 ]
Florin Malitab3418102020-10-15 18:10:29 -04002880 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002881 }
2882
2883 libfuzzer_app("region_set_path") {
2884 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2885 deps = []
2886 }
2887
2888 libfuzzer_app("textblob_deserialize") {
2889 include_dirs = [
2890 "tools",
2891 "tools/fonts",
2892 ]
2893 sources = [
2894 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2895 "tools/Resources.cpp",
2896 "tools/fonts/TestFontMgr.cpp",
2897 "tools/fonts/TestSVGTypeface.cpp",
2898 "tools/fonts/TestTypeface.cpp",
2899 ]
Florin Malitab3418102020-10-15 18:10:29 -04002900 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002901 }
2902
2903 libfuzzer_app("path_deserialize") {
2904 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2905 deps = []
2906 }
2907
2908 libfuzzer_app("image_decode") {
2909 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2910 deps = []
2911 }
2912
2913 libfuzzer_app("animated_image_decode") {
2914 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2915 deps = []
2916 }
2917
2918 libfuzzer_app("api_create_ddl") {
2919 include_dirs = [
2920 "include",
2921 "include/gpu",
2922 ]
2923 sources = [
2924 "fuzz/FuzzCreateDDL.cpp",
2925 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2926 "tools/Resources.cpp",
2927 "tools/UrlDataManager.cpp",
2928 "tools/debugger/DebugCanvas.cpp",
2929 "tools/debugger/DebugLayerManager.cpp",
2930 "tools/debugger/DrawCommand.cpp",
2931 "tools/debugger/JsonWriteBuffer.cpp",
2932 "tools/fonts/TestFontMgr.cpp",
2933 "tools/fonts/TestSVGTypeface.cpp",
2934 "tools/fonts/TestTypeface.cpp",
2935 ]
2936 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002937 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002938 "//third_party/libpng",
2939 ]
2940 }
2941
2942 libfuzzer_app("api_draw_functions") {
2943 sources = [
2944 "fuzz/FuzzDrawFunctions.cpp",
2945 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2946 ]
2947 deps = []
2948 }
2949
Adlai Hollerccb68662021-02-25 10:28:44 -05002950 libfuzzer_app("api_ddl_threading") {
2951 sources = [
2952 "fuzz/FuzzDDLThreading.cpp",
2953 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
2954 ]
2955 deps = []
2956 }
2957
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002958 libfuzzer_app("api_gradients") {
2959 sources = [
2960 "fuzz/FuzzGradients.cpp",
2961 "fuzz/oss_fuzz/FuzzGradients.cpp",
2962 ]
2963 deps = []
2964 }
2965
2966 libfuzzer_app("api_image_filter") {
2967 include_dirs = [
2968 "tools",
2969 "tools/debugger",
2970 ]
2971 sources = [
2972 "fuzz/FuzzCanvas.cpp",
2973 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2974 "tools/UrlDataManager.cpp",
2975 "tools/debugger/DebugCanvas.cpp",
2976 "tools/debugger/DebugLayerManager.cpp",
2977 "tools/debugger/DrawCommand.cpp",
2978 "tools/debugger/JsonWriteBuffer.cpp",
2979 ]
2980 deps = [ "//third_party/libpng" ]
2981 }
2982
2983 libfuzzer_app("api_path_measure") {
2984 sources = [
2985 "fuzz/FuzzPathMeasure.cpp",
2986 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2987 ]
2988 deps = []
2989 }
2990
2991 libfuzzer_app("api_pathop") {
2992 sources = [
2993 "fuzz/FuzzPathop.cpp",
2994 "fuzz/oss_fuzz/FuzzPathop.cpp",
2995 ]
2996 deps = []
2997 }
2998
2999 libfuzzer_app("api_raster_n32_canvas") {
3000 include_dirs = [
3001 "tools",
3002 "tools/debugger",
3003 "tools/fonts",
3004 ]
3005 sources = [
3006 "fuzz/FuzzCanvas.cpp",
3007 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3008 "tools/Resources.cpp",
3009 "tools/UrlDataManager.cpp",
3010 "tools/debugger/DebugCanvas.cpp",
3011 "tools/debugger/DebugLayerManager.cpp",
3012 "tools/debugger/DrawCommand.cpp",
3013 "tools/debugger/JsonWriteBuffer.cpp",
3014 "tools/fonts/TestFontMgr.cpp",
3015 "tools/fonts/TestSVGTypeface.cpp",
3016 "tools/fonts/TestTypeface.cpp",
3017 ]
3018 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003019 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003020 "//third_party/libpng",
3021 ]
3022 }
3023
3024 if (skia_use_gl) {
3025 libfuzzer_app("api_mock_gpu_canvas") {
3026 include_dirs = [
3027 "tools",
3028 "tools/debugger",
3029 "tools/fonts",
3030 ]
3031 sources = [
3032 "fuzz/FuzzCanvas.cpp",
3033 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3034 "tools/LsanSuppressions.cpp",
3035 "tools/Resources.cpp",
3036 "tools/UrlDataManager.cpp",
3037 "tools/debugger/DebugCanvas.cpp",
3038 "tools/debugger/DebugLayerManager.cpp",
3039 "tools/debugger/DrawCommand.cpp",
3040 "tools/debugger/JsonWriteBuffer.cpp",
3041 "tools/fonts/TestFontMgr.cpp",
3042 "tools/fonts/TestSVGTypeface.cpp",
3043 "tools/fonts/TestTypeface.cpp",
3044 ]
3045 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003046 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003047 "//third_party/libpng",
3048 ]
3049 }
3050 }
3051
3052 libfuzzer_app("api_null_canvas") {
3053 include_dirs = [
3054 "tools",
3055 "tools/debugger",
3056 "tools/fonts",
3057 ]
3058 sources = [
3059 "fuzz/FuzzCanvas.cpp",
3060 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3061 "tools/Resources.cpp",
3062 "tools/UrlDataManager.cpp",
3063 "tools/debugger/DebugCanvas.cpp",
3064 "tools/debugger/DebugLayerManager.cpp",
3065 "tools/debugger/DrawCommand.cpp",
3066 "tools/debugger/JsonWriteBuffer.cpp",
3067 "tools/fonts/TestFontMgr.cpp",
3068 "tools/fonts/TestSVGTypeface.cpp",
3069 "tools/fonts/TestTypeface.cpp",
3070 ]
3071 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003072 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003073 "//third_party/libpng",
3074 ]
3075 }
3076
Weston Tracey1a771fe2021-02-04 11:09:59 -05003077 libfuzzer_app("api_skparagraph") {
3078 sources = [
3079 "fuzz/FuzzSkParagraph.cpp",
3080 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3081 "tools/Resources.cpp",
3082 ]
3083 deps = [ "modules/skparagraph" ]
3084 }
3085
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003086 libfuzzer_app("api_svg_canvas") {
3087 include_dirs = [
3088 "include",
3089 "include/svg",
3090 ]
3091 sources = [
3092 "fuzz/FuzzCanvas.cpp",
3093 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3094 "tools/Resources.cpp",
3095 "tools/UrlDataManager.cpp",
3096 "tools/debugger/DebugCanvas.cpp",
3097 "tools/debugger/DebugLayerManager.cpp",
3098 "tools/debugger/DrawCommand.cpp",
3099 "tools/debugger/JsonWriteBuffer.cpp",
3100 "tools/fonts/TestFontMgr.cpp",
3101 "tools/fonts/TestSVGTypeface.cpp",
3102 "tools/fonts/TestTypeface.cpp",
3103 ]
3104 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003105 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003106 "//third_party/libpng",
3107 ]
3108 }
3109
3110 libfuzzer_app("png_encoder") {
3111 sources = [
3112 "fuzz/FuzzEncoders.cpp",
3113 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3114 ]
3115 deps = []
3116 }
3117
3118 libfuzzer_app("jpeg_encoder") {
3119 sources = [
3120 "fuzz/FuzzEncoders.cpp",
3121 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3122 ]
3123 deps = []
3124 }
3125
3126 libfuzzer_app("webp_encoder") {
3127 sources = [
3128 "fuzz/FuzzEncoders.cpp",
3129 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3130 ]
3131 deps = []
3132 }
3133
3134 libfuzzer_app("skottie_json") {
3135 sources = [
3136 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3137 "tools/Resources.cpp",
3138 "tools/fonts/TestFontMgr.cpp",
3139 "tools/fonts/TestSVGTypeface.cpp",
3140 "tools/fonts/TestTypeface.cpp",
3141 ]
3142 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003143 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003144 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003145 ]
3146 }
3147
3148 libfuzzer_app("skjson") {
3149 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3150 deps = []
3151 }
3152
3153 libfuzzer_app("api_polyutils") {
3154 sources = [
3155 "fuzz/FuzzPolyUtils.cpp",
3156 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3157 ]
3158 deps = [ ":skia" ]
3159 }
3160
3161 libfuzzer_app("android_codec") {
3162 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3163 deps = []
3164 }
3165
3166 libfuzzer_app("image_decode_incremental") {
3167 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3168 deps = []
3169 }
3170
3171 libfuzzer_app("sksl2glsl") {
3172 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3173 deps = []
3174 }
3175
3176 libfuzzer_app("sksl2spirv") {
3177 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3178 deps = []
3179 }
3180
3181 libfuzzer_app("sksl2metal") {
3182 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3183 deps = []
3184 }
3185
3186 libfuzzer_app("sksl2pipeline") {
3187 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3188 deps = []
3189 }
3190
3191 libfuzzer_app("skdescriptor_deserialize") {
3192 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3193 deps = []
3194 }
3195
3196 libfuzzer_app("svg_dom") {
3197 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003198 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003199 }
3200
3201 libfuzzer_app("skruntimeeffect") {
3202 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3203 deps = []
3204 }
3205
3206 libfuzzer_app("skp") {
3207 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3208 deps = []
3209 }
3210 }
mtklein25c81d42016-07-27 13:55:26 -07003211}
Hal Canary932a2c02019-09-17 10:43:18 -04003212
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003213if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003214 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003215 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003216 }
Hal Canary27483062019-12-06 15:01:08 -05003217}
3218
Hal Canary60ff6512020-01-21 12:39:20 -05003219if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003220 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003221 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003222 }
3223}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003224
3225executable("skia_c_api_example") {
3226 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3227 include_dirs = [ "." ]
3228 deps = [ ":skia" ]
3229}