blob: 6377dfb8c213a9e2f3b144ac634b74a54f623797 [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") {
Martin Vejdarskied435952020-11-07 00:07:17 +010072 visibility = [
73 ":*",
74 "//modules/*",
75 "//experimental/*",
76 ]
mtkleinc04ff472016-06-23 10:29:30 -070077
Mike Reeda9e241d2017-05-03 10:52:00 -040078 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Herb Derbybbfc0152020-10-06 11:24:40 -040079 if (skia_enable_gpu) {
80 defines += [ "GR_OP_ALLOCATE_USE_NEW" ]
81 }
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050082 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070083 defines += [
84 "SK_GAMMA_EXPONENT=1.4",
85 "SK_GAMMA_CONTRAST=0.0",
86 ]
87 }
Mike Kleinb45d8622019-04-24 14:04:01 -050088 if (is_skia_dev_build) {
89 defines += [
90 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
91 "GR_TEST_UTILS=1",
92 ]
mtklein88a7ac02016-09-14 11:16:49 -070093 }
Brian Salomon789e25e2016-09-30 13:41:03 -040094 libs = []
95 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040096 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050097 defines += [ "SK_ANGLE" ]
98 }
Greg Danielb16beb92020-04-27 14:26:21 +000099 if (skia_use_vma) {
100 defines += [ "SK_USE_VMA" ]
101 }
mtkleinc04ff472016-06-23 10:29:30 -0700102}
103
104# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
105config("skia_library") {
106 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000107 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700108}
109
110skia_library_configs = [
111 ":skia_public",
112 ":skia_private",
113 ":skia_library",
114]
115
mtklein9b8583d2016-08-24 17:32:30 -0700116# Use for CPU-specific Skia code that needs particular compiler flags.
117template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500118 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700119 if (invoker.enabled) {
120 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500121 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700122 forward_variables_from(invoker, "*")
123 configs += skia_library_configs
124 }
125 } else {
126 # If not enabled, a phony empty target that swallows all otherwise unused variables.
127 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500128 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700129 forward_variables_from(invoker,
130 "*",
131 [
132 "sources",
133 "cflags",
134 ])
135 }
136 }
anmittala7eaf2e2016-08-17 13:57:26 -0700137}
138
mtklein422310d2016-08-16 18:28:43 -0700139is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700140
mtklein7d6fb2c2016-08-25 14:50:44 -0700141opts("none") {
142 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700143 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700144 cflags = []
145}
146
mtklein7d6fb2c2016-08-25 14:50:44 -0700147opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700148 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700149 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700150 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700151}
152
153opts("arm64") {
154 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700156 cflags = []
157}
158
159opts("crc32") {
160 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700162 cflags = [ "-march=armv8-a+crc" ]
163}
164
mtklein9b8583d2016-08-24 17:32:30 -0700165opts("sse2") {
166 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400168 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400169 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
170 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400171 cflags = [ "-msse2" ]
172 }
mtklein9b8583d2016-08-24 17:32:30 -0700173}
mtkleinc04ff472016-06-23 10:29:30 -0700174
mtklein9b8583d2016-08-24 17:32:30 -0700175opts("ssse3") {
176 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700177 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400178 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400179 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
180 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400181 cflags = [ "-mssse3" ]
182 }
mtklein9b8583d2016-08-24 17:32:30 -0700183}
mtkleinc04ff472016-06-23 10:29:30 -0700184
mtklein9b8583d2016-08-24 17:32:30 -0700185opts("sse41") {
186 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700187 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400188 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400189 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
190 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400191 cflags = [ "-msse4.1" ]
192 }
mtklein9b8583d2016-08-24 17:32:30 -0700193}
mtklein4e976072016-08-08 09:06:27 -0700194
mtklein9b8583d2016-08-24 17:32:30 -0700195opts("sse42") {
196 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700197 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400198 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400199 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
200 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400201 cflags = [ "-msse4.2" ]
202 }
mtklein9b8583d2016-08-24 17:32:30 -0700203}
204
205opts("avx") {
206 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400208 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000209 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400210 } else {
211 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500212 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500213 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500214 }
Mike Klein3eb71212016-10-11 17:08:53 -0400215 }
mtkleinc04ff472016-06-23 10:29:30 -0700216}
217
Mike Klein1b9b7d52018-02-27 10:37:40 -0500218opts("hsw") {
219 enabled = is_x86
220 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400221 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500222 cflags = [ "/arch:AVX2" ]
223 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000224 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600225 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500226 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600227 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500228 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500229}
230
Mike Kleinad56c4c2020-06-05 06:57:30 -0500231opts("skx") {
232 enabled = is_x86
233 sources = skia_opts.skx_sources
234 if (is_win) {
235 cflags = [ "/arch:AVX512" ]
236 } else {
237 cflags = [ "-march=skylake-avx512" ]
238 if (is_mac && is_debug) {
239 cflags += [ "-fno-stack-check" ] # Work around skia:9709
240 }
241 }
242}
243
mtkleinc095df52016-08-24 12:23:52 -0700244# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700245template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500246 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700247 if (invoker.enabled) {
248 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700249 if (defined(invoker.public_defines)) {
250 defines = invoker.public_defines
251 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600252 if (defined(invoker.public_configs)) {
253 configs = invoker.public_configs
254 }
Hal Canary2dad9902019-11-20 16:01:31 -0500255 if (defined(invoker.public_include_dirs)) {
256 include_dirs = invoker.public_include_dirs
257 }
mtklein457b42a2016-08-23 13:56:37 -0700258 }
259 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500260 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700261 forward_variables_from(invoker,
262 "*",
263 [
264 "public_defines",
265 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700266 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700267 ])
mtklein457b42a2016-08-23 13:56:37 -0700268 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700269 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700270 if (defined(invoker.configs_to_remove)) {
271 configs -= invoker.configs_to_remove
272 }
mtklein457b42a2016-08-23 13:56:37 -0700273 }
274 } else {
mtklein457b42a2016-08-23 13:56:37 -0700275 source_set(target_name) {
276 forward_variables_from(invoker,
277 "*",
278 [
Ben Wagnerea765a32020-06-05 13:42:30 -0400279 "public",
mtklein457b42a2016-08-23 13:56:37 -0700280 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400281 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700282 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700283 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400284 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700285 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700286 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700287 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700288 ])
mtkleincd01b032016-08-31 04:58:19 -0700289 if (defined(invoker.sources_when_disabled)) {
290 sources = invoker.sources_when_disabled
291 }
292 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700293 }
mtkleineb3c4252016-08-23 07:38:09 -0700294 }
mtklein457b42a2016-08-23 13:56:37 -0700295}
mtklein457b42a2016-08-23 13:56:37 -0700296
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400297optional("android_utils") {
298 enabled = skia_enable_android_utils
299
Leon Scroggins III87caae62020-05-04 10:02:45 -0400300 public = [
301 "client_utils/android/BRDAllocator.h",
302 "client_utils/android/BitmapRegionDecoder.h",
303 "client_utils/android/FrontBufferedStream.h",
304 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400305 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400306 sources = [
307 "client_utils/android/BitmapRegionDecoder.cpp",
308 "client_utils/android/FrontBufferedStream.cpp",
309 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400310}
311
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400312group("fontmgr_factory") {
313 public_deps = [ skia_fontmgr_factory ]
314}
315
316optional("fontmgr_empty_factory") {
317 enabled = true
318 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400319}
320
mtkleina45be612016-08-29 15:22:10 -0700321optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500322 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700323
324 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500325 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700326 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700327 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400328 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700329 sources = [
330 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700331 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400332 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700333 ]
334}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400335optional("fontmgr_android_factory") {
336 enabled = skia_enable_fontmgr_android
337 deps = [ ":fontmgr_android" ]
338 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
339}
mtkleina45be612016-08-29 15:22:10 -0700340
mtkleind2e39db2016-09-07 07:52:55 -0700341optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400342 enabled =
343 skia_enable_fontmgr_custom_directory ||
344 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700345
Mike Kleina01c6b02020-04-01 13:47:34 -0500346 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400347 public = [ "src/ports/SkFontMgr_custom.h" ]
348 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
349}
350
351optional("fontmgr_custom_directory") {
352 enabled = skia_enable_fontmgr_custom_directory
353
354 deps = [
355 ":fontmgr_custom",
356 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700357 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400358 public = [ "include/ports/SkFontMgr_directory.h" ]
359 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
360}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400361optional("fontmgr_custom_directory_factory") {
362 enabled = skia_enable_fontmgr_custom_directory
363 deps = [ ":fontmgr_custom_directory" ]
364 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
365}
Ben Wagner75626e42020-06-03 13:20:37 -0400366
367optional("fontmgr_custom_embedded") {
368 enabled = skia_enable_fontmgr_custom_embedded
369
370 deps = [
371 ":fontmgr_custom",
372 ":typeface_freetype",
373 ]
374 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700375}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400376optional("fontmgr_custom_embedded_factory") {
377 enabled = skia_enable_fontmgr_custom_embedded
378 deps = [ ":fontmgr_custom_embedded" ]
379 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
380}
mtkleind2e39db2016-09-07 07:52:55 -0700381
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500382optional("fontmgr_custom_empty") {
383 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500384
Ben Wagner75626e42020-06-03 13:20:37 -0400385 deps = [
386 ":fontmgr_custom",
387 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800388 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400389 public = [ "include/ports/SkFontMgr_empty.h" ]
390 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500391}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400392optional("fontmgr_custom_empty_factory") {
393 enabled = skia_enable_fontmgr_custom_empty
394 deps = [ ":fontmgr_custom_empty" ]
395 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
396}
Hal Canaryff2742e2018-01-30 11:35:47 -0500397
mtklein3cc22182016-08-29 13:26:14 -0700398optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400399 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700400
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400401 # The public header includes fontconfig.h and uses FcConfig*
402 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400403 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400404 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400405 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
406}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400407optional("fontmgr_fontconfig_factory") {
408 enabled = skia_enable_fontmgr_fontconfig
409 deps = [ ":fontmgr_fontconfig" ]
410 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
411}
Ben Wagner75626e42020-06-03 13:20:37 -0400412
413optional("fontmgr_FontConfigInterface") {
414 enabled = skia_enable_fontmgr_FontConfigInterface
415
416 deps = [
417 ":typeface_freetype",
418 "//third_party:fontconfig",
419 ]
420 public = [
421 "include/ports/SkFontConfigInterface.h",
422 "include/ports/SkFontMgr_FontConfigInterface.h",
423 ]
mtklein3cc22182016-08-29 13:26:14 -0700424 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700425 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700426 "src/ports/SkFontConfigInterface_direct.cpp",
427 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400428 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700429 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700430 ]
431}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400432optional("fontmgr_FontConfigInterface_factory") {
433 enabled = skia_enable_fontmgr_FontConfigInterface
434 deps = [ ":fontmgr_FontConfigInterface" ]
435 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
436}
mtklein3cc22182016-08-29 13:26:14 -0700437
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500438optional("fontmgr_fuchsia") {
439 enabled = skia_enable_fontmgr_fuchsia
440
Chinmay Garde89820762019-05-06 16:44:06 -0700441 deps = []
442
443 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700444 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700445 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500446 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700447 }
Ben Wagner75626e42020-06-03 13:20:37 -0400448 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
449 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500450}
451
Ben Wagner75626e42020-06-03 13:20:37 -0400452optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400453 enabled = skia_use_fonthost_mac
454
Ben Wagner75626e42020-06-03 13:20:37 -0400455 public = [
456 "include/ports/SkFontMgr_mac_ct.h",
457 "include/ports/SkTypeface_mac.h",
458 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400459 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400460 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400461 "src/ports/SkScalerContext_mac_ct.cpp",
462 "src/ports/SkScalerContext_mac_ct.h",
463 "src/ports/SkTypeface_mac_ct.cpp",
464 "src/ports/SkTypeface_mac_ct.h",
465 ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400466
467 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400468 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400469 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
470 "AppKit.framework",
471 "ApplicationServices.framework",
472 ]
473 }
474
475 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400476 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400477 "CoreFoundation.framework",
478 "CoreGraphics.framework",
479 "CoreText.framework",
480
481 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
482 "UIKit.framework",
483 ]
484 }
485}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400486optional("fontmgr_mac_ct_factory") {
487 enabled = skia_use_fonthost_mac
488 deps = [ ":fontmgr_mac_ct" ]
489 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
490}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400491
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500492optional("fontmgr_win") {
493 enabled = skia_enable_fontmgr_win
494
Ben Wagner75626e42020-06-03 13:20:37 -0400495 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500496 sources = [
497 "src/fonts/SkFontMgr_indirect.cpp",
498 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500499 "src/ports/SkScalerContext_win_dw.cpp",
500 "src/ports/SkTypeface_win_dw.cpp",
501 ]
502}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400503optional("fontmgr_win_factory") {
504 enabled = skia_enable_fontmgr_win
505 deps = [ ":fontmgr_win" ]
506 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
507}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500508
509optional("fontmgr_win_gdi") {
510 enabled = skia_enable_fontmgr_win_gdi
511
Ben Wagner75626e42020-06-03 13:20:37 -0400512 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500513 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500514 libs = [ "Gdi32.lib" ]
515}
516
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700517if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400518 executable("sksllex") {
519 sources = [
520 "src/sksl/lex/Main.cpp",
521 "src/sksl/lex/NFA.cpp",
522 "src/sksl/lex/RegexNode.cpp",
523 "src/sksl/lex/RegexParser.cpp",
524 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500525 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400526 }
527
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700528 action("run_sksllex") {
529 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500530 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
531 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700532
533 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
534 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
535 outputs = [
536 "$target_out_dir/" +
537 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
538 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
539 # confused due to the same file being named by two different paths
540 ]
541 sksllex_path = "$root_out_dir/"
542 sksllex_path += "sksllex"
543 if (host_os == "win") {
544 sksllex_path += ".exe"
545 }
546 args = [
547 rebase_path(sksllex_path),
548 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400549 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700550 rebase_path("src"),
551 ]
552 }
553} else {
554 group("run_sksllex") {
555 }
556}
557
John Stilesd836f842020-09-14 10:21:44 -0400558# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
559if (skia_compile_processors || skia_compile_sksl_tests) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400560 executable("skslc") {
561 defines = [ "SKSL_STANDALONE" ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400562 sources = [
563 "src/core/SkMalloc.cpp",
564 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400565 "src/core/SkSemaphore.cpp",
566 "src/core/SkThreadID.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400567 "src/gpu/GrBlockAllocator.cpp",
568 "src/gpu/GrMemoryPool.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400569 "src/ports/SkMemory_malloc.cpp",
570 "src/sksl/SkSLMain.cpp",
571 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400572 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400573 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500574 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500576 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400577 "//third_party/spirv-tools:spvtools",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400578 ]
579 }
580
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400581 skslc_path = "$root_out_dir/"
582 if (host_toolchain != default_toolchain_name) {
583 skslc_path += "$host_toolchain/"
584 }
585 skslc_path += "skslc"
586 if (host_os == "win") {
587 skslc_path += ".exe"
588 }
589
Brian Osmandd496172020-08-08 08:17:18 -0400590 action("create_sksl_fp") {
591 script = "gn/create_sksl_fp.py"
592 sources = [
593 "include/private/GrSharedEnums.h",
594 "src/sksl/sksl_fp_raw.sksl",
595 ]
596 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
597 args = [
598 rebase_path(sources[0]),
599 rebase_path(sources[1]),
600 rebase_path(outputs[0]),
601 ]
602 }
603
604 copy("sksl_pre_includes") {
605 sources = [
606 "src/sksl/sksl_frag.sksl",
607 "src/sksl/sksl_geom.sksl",
608 "src/sksl/sksl_gpu.sksl",
609 "src/sksl/sksl_interp.sksl",
610 "src/sksl/sksl_pipeline.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500611 "src/sksl/sksl_public.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400612 "src/sksl/sksl_vert.sksl",
613 ]
614 outputs = [ "$root_out_dir/{{source_file_part}}" ]
615 }
616
617 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
618 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
619
620 dehydrate_sksl_outputs = []
621 foreach(src, dehydrate_sksl_sources) {
622 name = get_path_info(src, "name")
623
624 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
625 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
626 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
627 "src/sksl/generated/$name.dehydrated.sksl",
628 target_out_dir) ]
629 }
630
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400631 action("dehydrate_sksl") {
632 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400633 deps = [
634 ":create_sksl_fp",
635 ":sksl_pre_includes",
636 ":skslc(//gn/toolchain:$host_toolchain)",
637 ]
638 sources = dehydrate_sksl_sources
639 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000640 args = [
641 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400642 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000643 ]
Brian Osmandd496172020-08-08 08:17:18 -0400644 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400645 }
John Stilesd836f842020-09-14 10:21:44 -0400646} else {
647 group("dehydrate_sksl") {
648 }
649}
650
651skia_gpu_processor_outputs = []
652if (skia_compile_processors) {
653 foreach(src, skia_gpu_processor_sources) {
654 dir = get_path_info(src, "dir")
655 name = get_path_info(src, "name")
656
657 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
658 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
659 skia_gpu_processor_outputs += [
660 "$target_out_dir/" +
661 rebase_path("$dir/generated/$name.h", target_out_dir),
662 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
663 # confused due to the same file being named by two different paths
664 ]
665 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400666
Ethan Nicholas762466e2017-06-29 10:03:38 -0400667 action("compile_processors") {
668 script = "gn/compile_processors.py"
669 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400670 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400671 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400672 ":skslc(//gn/toolchain:$host_toolchain)",
673 ]
674 sources = skia_gpu_processor_sources
675 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400676 args = [
677 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400678 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400679 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400680 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400681 args += rebase_path(skia_gpu_processor_sources)
682 }
683} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400684 group("compile_processors") {
685 }
John Stilesd836f842020-09-14 10:21:44 -0400686}
687
688if (skia_compile_sksl_tests) {
689 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400690
John Stiles7e248712020-09-24 16:42:09 -0400691 template("compile_sksl") {
692 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
693 action("compile_sksl_${target_name}") {
694 script = "gn/compile_sksl_tests.py"
695 deps = [
696 ":create_sksl_fp",
697 ":sksl_pre_includes",
698 ":skslc(//gn/toolchain:$host_toolchain)",
699 ]
700 sources = invoker.sources
701 outputs = []
702 foreach(src, sources) {
703 dir = get_path_info(src, "dir")
704 name = get_path_info(src, "name")
705 foreach(outputPattern, invoker.outputPatterns) {
706 outputs += [ target_out_dir + "/" + rebase_path(
707 dir + outputPattern[0] + name + outputPattern[1],
708 target_out_dir) ]
709 }
710 }
711 args = [
712 rebase_path(skslc_path),
713 invoker.lang,
714 invoker.settings,
715 ]
716 args += rebase_path(sources)
717 }
John Stilesd836f842020-09-14 10:21:44 -0400718 }
John Stiles7e248712020-09-24 16:42:09 -0400719 compile_sksl("fp_tests") {
720 sources = sksl_fp_tests_sources
721 outputPatterns = [
722 [
723 "/golden/",
724 ".cpp",
725 ],
726 [
727 "/golden/",
728 ".h",
729 ],
730 ]
731 lang = "--fp"
732 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400733 }
John Stiles7e248712020-09-24 16:42:09 -0400734 compile_sksl("glsl_tests") {
735 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
736 outputPatterns = [ [
737 "/golden/",
738 ".glsl",
739 ] ]
740 lang = "--glsl"
741 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400742 }
John Stiles7e248712020-09-24 16:42:09 -0400743 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400744 sources = sksl_glsl_settings_tests_sources
John Stiles7e248712020-09-24 16:42:09 -0400745 outputPatterns = [ [
746 "/golden/",
747 "StandaloneSettings.glsl",
748 ] ]
749 lang = "--glsl"
750 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400751 }
John Stilesaeae3a52020-09-25 13:35:58 -0400752 compile_sksl("metal_tests") {
753 sources = sksl_metal_tests_sources
754 outputPatterns = [ [
755 "/golden/",
756 ".metal",
757 ] ]
758 lang = "--metal"
759 settings = "--settings"
760 }
John Stilesd836f842020-09-14 10:21:44 -0400761} else {
John Stiles7e248712020-09-24 16:42:09 -0400762 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400763 }
John Stiles7e248712020-09-24 16:42:09 -0400764 group("compile_sksl_glsl_tests") {
765 }
766 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400767 }
John Stilesaeae3a52020-09-25 13:35:58 -0400768 group("compile_sksl_metal_tests") {
769 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400770}
771
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500772optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700773 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400774 deps = [
775 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400776 ":compile_sksl_fp_tests",
777 ":compile_sksl_glsl_nosettings_tests",
778 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400779 ":compile_sksl_metal_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400780 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700781 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400782 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700783 if (skia_generate_workarounds) {
784 deps += [ ":workaround_list" ]
785 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800786 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600787 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400788 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700789
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400790 sources =
791 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400792 if (!skia_enable_ccpr) {
793 sources -= skia_ccpr_sources
794 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
795 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400796 if (!skia_enable_nvpr) {
797 sources -= skia_nvpr_sources
798 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
799 }
mtklein06c35c02016-09-20 12:28:12 -0700800
Mike Klein703cf5a2016-10-13 17:18:04 -0400801 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400802 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700803
John Rosascoa9b348f2019-11-08 13:18:15 -0800804 if (skia_use_gl) {
805 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400806 if (is_android) {
807 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
808
809 # this lib is required to link against AHardwareBuffer
810 if (defined(ndk_api) && ndk_api >= 26) {
811 libs += [ "android" ]
812 }
813 } else if (skia_use_egl) {
814 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
815 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400816 } else if (skia_use_webgl) {
817 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400818 } else if (is_linux && skia_use_x11) {
819 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
820 libs += [ "GL" ]
821 } else if (is_mac) {
822 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
823 } else if (is_ios) {
824 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
825 } else if (is_win) {
826 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
827 if (target_cpu != "arm64") {
828 libs += [ "OpenGL32.lib" ]
829 }
830 } else {
831 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
832 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800833 sources += skia_gl_gpu_sources
834 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400835
mtkleine9fb3d52016-09-20 15:11:46 -0700836 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400837 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000838 if (skia_use_vma) {
839 deps += [ "third_party/vulkanmemoryallocator" ]
840 }
mtkleine9fb3d52016-09-20 15:11:46 -0700841 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700842 if (skia_enable_vulkan_debug_layers) {
843 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
844 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800845 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800846 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700847 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
848 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400849 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700850 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800851 }
mtkleine9fb3d52016-09-20 15:11:46 -0700852 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400853
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400854 if (is_android && (skia_use_gl || skia_use_vulkan)) {
855 # this lib is required to link against AHardwareBuffer
856 if (defined(ndk_api) && ndk_api >= 26) {
857 libs += [ "android" ]
858 }
859 }
860
Stephen White0d70b712019-07-10 15:51:30 -0400861 if (skia_use_dawn) {
862 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400863 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700864 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400865 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700866 "//third_party/externals/dawn/src/dawn:dawn_proc",
867 "//third_party/externals/dawn/src/dawn:dawncpp",
868 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400869 ]
870 if (dawn_enable_d3d12) {
871 libs += [
872 "d3d12.lib",
873 "dxgi.lib",
874 "d3dcompiler.lib",
875 ]
876 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400877 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400878 }
879 }
880
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500881 if (skia_use_direct3d) {
882 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400883 deps += [
884 "//third_party/d3d12allocator",
885 "//third_party/spirv-cross:spirv_cross",
886 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500887 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500888 if (skia_enable_direct3d_debug_layer) {
889 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
890 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500891 libs += [
892 "d3d12.lib",
893 "dxgi.lib",
894 "d3dcompiler.lib",
895 ]
896 }
897
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400898 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400899 if (skia_use_metal) {
900 public_defines += [ "SK_METAL" ]
901 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400902 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400903 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000904 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400905 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500906
Kevin Lubickf4def342018-10-04 12:52:50 -0400907 if (is_debug) {
908 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
909 }
mtklein06c35c02016-09-20 12:28:12 -0700910}
911
Leon Scroggins III41169202019-01-29 09:29:57 -0500912optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500913 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500914 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
915 if ("True" ==
916 exec_script("gn/checkpath.py",
917 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
918 "trim string")) {
919 public_defines = [ "SK_USE_LIBGIFCODEC" ]
920 public_include_dirs = [
921 ".",
922 skia_libgifcodec_path,
923 ]
924 include_dirs = public_include_dirs
925 import(_libgifcodec_gni_path)
926 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
927 ".",
928 skia_libgifcodec_path)
929 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500930}
931
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400932optional("heif") {
933 enabled = skia_use_libheif
934 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
935
936 deps = []
937
Mike Kleina01c6b02020-04-01 13:47:34 -0500938 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400939}
940
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400941optional("jpeg_decode") {
942 enabled = skia_use_libjpeg_turbo_decode
943 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
944
Mike Kleina01c6b02020-04-01 13:47:34 -0500945 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400946 sources = [
947 "src/codec/SkJpegCodec.cpp",
948 "src/codec/SkJpegDecoderMgr.cpp",
949 "src/codec/SkJpegUtility.cpp",
950 ]
951}
952
953optional("jpeg_encode") {
954 enabled = skia_use_libjpeg_turbo_encode
955 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -0700956
Mike Kleina01c6b02020-04-01 13:47:34 -0500957 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
958 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -0700959 sources = [
mtklein63213812016-08-24 09:55:56 -0700960 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400961 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700962 ]
963}
964
Leon Scroggins III326b9892020-08-05 16:51:10 -0400965optional("ndk_images") {
966 enabled = skia_use_ndk_images
967 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
968 sources = [
969 "src/ports/SkImageEncoder_NDK.cpp",
970 "src/ports/SkImageGeneratorNDK.cpp",
971 "src/ports/SkNDKConversions.cpp",
972 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400973 libs = [ "jnigraphics" ]
974}
975
mtklein63213812016-08-24 09:55:56 -0700976optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500977 enabled = skia_use_zlib && skia_enable_pdf
978 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700979
Mike Kleina01c6b02020-04-01 13:47:34 -0500980 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400981 if (skia_use_libjpeg_turbo_decode) {
982 deps += [ ":jpeg_decode" ]
983 }
984 if (skia_use_libjpeg_turbo_encode) {
985 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400986 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -0400987 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -0700988 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700989 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500990 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
991 deps += [ "//third_party/harfbuzz" ]
992 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
993 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700994 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500995 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700996 }
997}
998
Robert Phillips9b00f1f2020-03-24 12:29:44 -0400999optional("xps") {
1000 enabled = skia_use_xps && is_win
1001 public_defines = [ "SK_SUPPORT_XPS" ]
1002 public = skia_xps_public
1003 sources = skia_xps_sources
1004}
1005
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001006optional("png_decode") {
1007 enabled = skia_use_libpng_decode
1008 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001009
Mike Kleina01c6b02020-04-01 13:47:34 -05001010 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001011 sources = [
1012 "src/codec/SkIcoCodec.cpp",
1013 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001014 ]
1015}
1016
1017optional("png_encode") {
1018 enabled = skia_use_libpng_encode
1019 public_defines = [ "SK_ENCODE_PNG" ]
1020
Mike Kleina01c6b02020-04-01 13:47:34 -05001021 deps = [ "//third_party/libpng" ]
1022 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001023}
1024
scroggof84ad642016-10-31 09:02:57 -07001025optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001026 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001027 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1028
1029 deps = [
1030 "//third_party/dng_sdk",
1031 "//third_party/libjpeg-turbo:libjpeg",
1032 "//third_party/piex",
1033 ]
1034
1035 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1036 # Skia.
1037 configs_to_remove = [ "//gn:no_exceptions" ]
1038
Mike Kleina01c6b02020-04-01 13:47:34 -05001039 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001040}
1041
Mike Klein852a8cb2018-05-15 10:46:58 -04001042import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -04001043source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001044 cflags = []
1045 if (!is_win || is_clang) {
1046 cflags += [
1047 "-w",
1048 "-std=c11",
1049 ]
1050 }
1051
Mike Kleina01c6b02020-04-01 13:47:34 -05001052 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001053 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001054 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1055}
1056
mtklein3cc22182016-08-29 13:26:14 -07001057optional("typeface_freetype") {
1058 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001059
Mike Kleina01c6b02020-04-01 13:47:34 -05001060 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001061 sources = [
1062 "src/ports/SkFontHost_FreeType.cpp",
1063 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001064 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001065 ]
1066}
1067
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001068optional("webp_decode") {
1069 enabled = skia_use_libwebp_decode
1070 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001071
Mike Kleina01c6b02020-04-01 13:47:34 -05001072 deps = [ "//third_party/libwebp" ]
1073 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001074}
1075
1076optional("webp_encode") {
1077 enabled = skia_use_libwebp_encode
1078 public_defines = [ "SK_ENCODE_WEBP" ]
1079
Mike Kleina01c6b02020-04-01 13:47:34 -05001080 deps = [ "//third_party/libwebp" ]
1081 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001082}
1083
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001084optional("wuffs") {
1085 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001086 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001087
Mike Kleina01c6b02020-04-01 13:47:34 -05001088 deps = [ "//third_party/wuffs" ]
1089 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001090}
1091
mtklein63213812016-08-24 09:55:56 -07001092optional("xml") {
1093 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001094 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001095
Mike Kleina01c6b02020-04-01 13:47:34 -05001096 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001097 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001098 "src/svg/SkSVGCanvas.cpp",
1099 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001100 "src/xml/SkDOM.cpp",
1101 "src/xml/SkXMLParser.cpp",
1102 "src/xml/SkXMLWriter.cpp",
1103 ]
1104}
1105
Mike Klein853d4ed2020-08-20 00:41:00 +00001106optional("sksl_interpreter") {
1107 enabled = skia_enable_sksl_interpreter
1108 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
1109}
1110
Mike Klein613ad382019-06-06 11:42:02 -05001111optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001112 enabled = skia_enable_skvm_jit_when_possible
1113 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001114 if (skia_vtune_path != "") {
1115 public_defines += [ "SKVM_JIT_VTUNE" ]
1116 public_include_dirs = [ "$skia_vtune_path/include" ]
1117 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1118 }
Mike Klein613ad382019-06-06 11:42:02 -05001119}
1120
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001121if (skia_enable_gpu && skia_generate_workarounds) {
1122 action("workaround_list") {
1123 script = "tools/build_workaround_header.py"
1124
Mike Kleina01c6b02020-04-01 13:47:34 -05001125 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001126
1127 # see comments in skia_compile_processors about out dir path shenanigans.
1128 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001129 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001130
Mike Kleina01c6b02020-04-01 13:47:34 -05001131 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001132 args = [
1133 "--output-file",
1134 "$output_file",
1135 ]
1136
1137 foreach(file, inputs) {
1138 args += [ rebase_path(file, root_build_dir) ]
1139 }
1140 }
1141}
1142
mtkleinc04ff472016-06-23 10:29:30 -07001143component("skia") {
1144 public_configs = [ ":skia_public" ]
1145 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001146
Mike Klein607b0a72018-11-07 16:17:34 -05001147 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001148 ":fontmgr_FontConfigInterface",
1149 ":fontmgr_android",
1150 ":fontmgr_custom_directory",
1151 ":fontmgr_custom_embedded",
1152 ":fontmgr_custom_empty",
1153 ":fontmgr_fontconfig",
1154 ":fontmgr_fuchsia",
1155 ":fontmgr_mac_ct",
1156 ":fontmgr_win",
1157 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001158 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001159 ":pdf",
1160 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001161 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001162 ]
1163
mtkleinc04ff472016-06-23 10:29:30 -07001164 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001165 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001166 ":arm64",
1167 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001168 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001169 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001170 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001171 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001172 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001173 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001174 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001175 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001176 ":jpeg_decode",
1177 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001178 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001179 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001180 ":png_decode",
1181 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001182 ":raw",
Mike Klein853d4ed2020-08-20 00:41:00 +00001183 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -05001184 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001185 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001186 ":sse2",
1187 ":sse41",
1188 ":sse42",
1189 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001190 ":webp_decode",
1191 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001192 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001193 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001194 ]
1195
Hal Canaryc25f4e92019-02-26 11:54:25 -05001196 public = skia_core_public
1197 public += skia_utils_public
1198 public += skia_effects_public
1199 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001200
mtkleinc04ff472016-06-23 10:29:30 -07001201 sources = []
brettwb9447282016-09-01 14:24:39 -07001202 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001203 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001204 sources += skia_effects_sources
1205 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001206 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001207 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001208 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001209 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001210 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001211 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001212 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001213 "src/codec/SkBmpCodec.cpp",
1214 "src/codec/SkBmpMaskCodec.cpp",
1215 "src/codec/SkBmpRLECodec.cpp",
1216 "src/codec/SkBmpStandardCodec.cpp",
1217 "src/codec/SkCodec.cpp",
1218 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001219 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001220 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001221 "src/codec/SkMaskSwizzler.cpp",
1222 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001223 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001224 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001225 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001226 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001227 "src/codec/SkSwizzler.cpp",
1228 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001229 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001230 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001231 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001232 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001233 "src/ports/SkMemory_malloc.cpp",
1234 "src/ports/SkOSFile_stdio.cpp",
1235 "src/sfnt/SkOTTable_name.cpp",
1236 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001237 ]
brettwb9447282016-09-01 14:24:39 -07001238
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001239 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001240 libs = []
1241
mtkleinc04ff472016-06-23 10:29:30 -07001242 if (is_win) {
1243 sources += [
1244 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001245 "src/ports/SkImageEncoder_WIC.cpp",
1246 "src/ports/SkImageGeneratorWIC.cpp",
1247 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001248 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001249 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001250 libs += [
1251 "FontSub.lib",
1252 "Ole32.lib",
1253 "OleAut32.lib",
1254 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001255 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001256 ]
mtkleinc04ff472016-06-23 10:29:30 -07001257 } else {
1258 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001259 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001260 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001261 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001262 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001263 }
1264
mtklein7d6fb2c2016-08-25 14:50:44 -07001265 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001266 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001267 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001268 deps += [ "//third_party/cpu-features" ]
1269 }
mtklein06c35c02016-09-20 12:28:12 -07001270 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001271 libs += [
1272 "EGL",
1273 "GLESv2",
1274 "log",
1275 ]
1276 }
1277
Kevin Lubick217056c2018-09-20 17:39:31 -04001278 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001279 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001280 if (skia_use_egl) {
1281 libs += [ "GLESv2" ]
1282 }
mtkleinc04ff472016-06-23 10:29:30 -07001283 }
1284
1285 if (is_mac) {
1286 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001287 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001288 "src/ports/SkImageEncoder_CG.cpp",
1289 "src/ports/SkImageGeneratorCG.cpp",
1290 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001291 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001292 "ApplicationServices.framework",
1293 "OpenGL.framework",
1294 ]
mtkleinc04ff472016-06-23 10:29:30 -07001295 }
abarth6fc8ff02016-07-15 15:15:15 -07001296
Mike Klein7d302882016-11-03 14:06:31 -04001297 if (is_ios) {
1298 sources += [
1299 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001300 "src/ports/SkImageEncoder_CG.cpp",
1301 "src/ports/SkImageGeneratorCG.cpp",
1302 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001303 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001304 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001305 "ImageIO.framework",
1306 "MobileCoreServices.framework",
1307 ]
1308 }
1309
abarth6fc8ff02016-07-15 15:15:15 -07001310 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001311 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001312 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001313
1314 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -04001315 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001316 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1317 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001318
1319 if (skia_include_multiframe_procs) {
1320 sources += [ "tools/SkSharingProc.cpp" ]
1321 }
mtkleinc04ff472016-06-23 10:29:30 -07001322}
1323
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001324# DebugCanvas used in experimental/wasm-skp-debugger
1325if (target_cpu == "wasm") {
1326 static_library("debugcanvas") {
1327 public_configs = [ ":skia_public" ]
1328
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001329 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001330 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001331 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001332 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001333 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001334 "tools/debugger/DrawCommand.cpp",
1335 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001336 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001337 }
1338}
1339
Kevin Lubickcbcff382018-10-02 09:02:18 -04001340static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001341 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001342 public_configs = [ ":skia_public" ]
1343 configs += skia_library_configs
1344
1345 deps = [
1346 ":arm64",
1347 ":armv7",
1348 ":avx",
1349 ":crc32",
1350 ":hsw",
1351 ":none",
1352 ":sse2",
1353 ":sse41",
1354 ":sse42",
1355 ":ssse3",
1356 ]
1357
Kevin Lubickcbcff382018-10-02 09:02:18 -04001358 sources = []
1359 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001360 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001361 sources += [
1362 "src/core/SkAnalyticEdge.cpp",
1363 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001364 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001365 "src/core/SkCubicMap.cpp",
1366 "src/core/SkEdge.cpp",
1367 "src/core/SkEdgeBuilder.cpp",
1368 "src/core/SkEdgeClipper.cpp",
1369 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001370 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001371 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001372 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001373 "src/core/SkMallocPixelRef.cpp",
1374 "src/core/SkMath.cpp",
1375 "src/core/SkMatrix.cpp",
1376 "src/core/SkOpts.cpp",
1377 "src/core/SkPaint.cpp",
1378 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001379 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001380 "src/core/SkPathEffect.cpp",
1381 "src/core/SkPathMeasure.cpp",
1382 "src/core/SkPathRef.cpp",
1383 "src/core/SkPoint.cpp",
1384 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001385 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001386 "src/core/SkRect.cpp",
1387 "src/core/SkSemaphore.cpp",
1388 "src/core/SkStream.cpp",
1389 "src/core/SkString.cpp",
1390 "src/core/SkStringUtils.cpp",
1391 "src/core/SkStroke.cpp",
1392 "src/core/SkStrokeRec.cpp",
1393 "src/core/SkStrokerPriv.cpp",
1394 "src/core/SkThreadID.cpp",
1395 "src/core/SkUtils.cpp",
1396 "src/effects/SkDashPathEffect.cpp",
1397 "src/effects/SkTrimPathEffect.cpp",
1398 "src/ports/SkDebug_stdio.cpp",
1399 "src/ports/SkMemory_malloc.cpp",
1400 "src/utils/SkDashPath.cpp",
1401 "src/utils/SkParse.cpp",
1402 "src/utils/SkParsePath.cpp",
1403 "src/utils/SkUTF.cpp",
1404 ]
1405}
1406
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001407group("modules") {
1408 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001409 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001410 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001411 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001412 "modules/skshaper",
1413 ]
1414}
1415
Brian Osmancd28fa62020-07-07 16:01:26 -04001416config("our_vulkan_headers") {
1417 include_dirs = [ "include/third_party/vulkan" ]
1418}
1419
mtkleinc095df52016-08-24 12:23:52 -07001420# Targets guarded by skia_enable_tools may use //third_party freely.
1421if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001422 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001423 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001424 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001425 "include/c",
1426 "include/codec",
1427 "include/config",
1428 "include/core",
1429 "include/docs",
1430 "include/effects",
1431 "include/encode",
1432 "include/gpu",
1433 "include/pathops",
1434 "include/ports",
1435 "include/svg",
1436 "include/utils",
1437 "include/utils/mac",
Julia Lavrova70258c72020-07-15 11:28:57 -04001438 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001439 "modules/skshaper/include",
1440 "modules/skottie/include",
1441 ]
1442
Mike Klein308b5ac2016-12-06 16:03:52 -05001443 # Used by gn_to_bp.py to list our public include dirs.
1444 source_set("public") {
1445 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001446 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001447 }
1448
Mike Kleinc36dedf2016-11-18 09:35:28 -05001449 config("skia.h_config") {
1450 include_dirs = [ "$target_gen_dir" ]
1451 }
1452 action("skia.h") {
1453 public_configs = [ ":skia.h_config" ]
1454 skia_h = "$target_gen_dir/skia.h"
1455 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001456
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001457 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1458 [ rebase_path(skia_h, root_build_dir) ] +
1459 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001460 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001461 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001462 }
1463
Brian Osmanc9a42472018-05-31 13:17:12 -04001464 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001465 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001466 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001467 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001468 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001469 "tools/fiddle/draw.cpp",
1470 "tools/fiddle/fiddle_main.cpp",
1471 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001472
1473 if (skia_use_egl) {
1474 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001475 } else {
1476 sources += [ "tools/fiddle/null_context.cpp" ]
1477 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001478 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001479 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001480 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001481 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001482 ":skia",
1483 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001484 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001485 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001486 ]
1487 }
1488 }
1489
Mike Kleine5463e62020-06-11 13:53:53 -05001490 config("cpp14") {
1491 if (is_win) {
1492 cflags_cc = [ "/std:c++14" ]
1493 } else {
1494 cflags_cc = [ "-std=c++14" ]
1495 }
1496 }
1497
Brian Osmanc9a42472018-05-31 13:17:12 -04001498 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001499 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001500 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001501 configs += [
1502 ":our_vulkan_headers",
1503 ":cpp14",
1504 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001505 deps = [
1506 ":skia",
1507 ":skia.h",
1508 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001509 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001510 ]
Stephen White0d70b712019-07-10 15:51:30 -04001511
1512 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001513 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001514 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001515 }
1516
mtkleinc095df52016-08-24 12:23:52 -07001517 template("test_lib") {
1518 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001519 if (defined(invoker.public_defines)) {
1520 defines = invoker.public_defines
1521 }
mtklein25c81d42016-07-27 13:55:26 -07001522 }
mtkleinc095df52016-08-24 12:23:52 -07001523 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001524 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001525 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001526 public_configs = [
1527 ":" + target_name + "_config",
1528 ":skia_private",
1529 ]
1530
1531 if (!defined(deps)) {
1532 deps = []
1533 }
1534 deps += [ ":skia" ]
1535 testonly = true
1536 }
mtklein25c81d42016-07-27 13:55:26 -07001537 }
mtklein25c81d42016-07-27 13:55:26 -07001538
Mike Kleine6682eb2017-01-05 10:54:57 -05001539 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001540 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001541 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001542 forward_variables_from(invoker,
1543 "*",
1544 [
1545 "output_name",
1546 "visibility",
1547 "is_shared_library",
1548 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001549 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001550 extra_configs = [ ":skia_private" ]
1551 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1552 data_sources = [ "resources" ]
1553 if ("True" == exec_script("//gn/checkdir.py",
1554 [ rebase_path("skps", root_build_dir) ],
1555 "trim string")) {
1556 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001557 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001558 }
1559 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001560 # !is_ios
1561
Jim Van Verth92411c72020-04-03 15:18:31 -04001562 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001563 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1564 shared_library("lib" + target_name) {
1565 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1566 configs += [ ":skia_private" ]
1567 testonly = true
1568 }
1569 } else {
1570 _executable = target_name
1571 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001572 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001573 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1574 configs += [ ":skia_private" ]
1575 testonly = true
1576 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001577 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001578 if (is_android && skia_android_serial != "" && defined(_executable)) {
1579 action("push_" + target_name) {
1580 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001581 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001582 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001583 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001584 args = [
1585 rebase_path("$root_build_dir/$_executable"),
1586 skia_android_serial,
1587 rebase_path(_stamp),
1588 ]
1589 testonly = true
1590 }
Mike Klein7d921032017-01-05 12:20:41 -05001591 }
1592 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001593 }
1594
mtkleinc095df52016-08-24 12:23:52 -07001595 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001596 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001597
Mike Klein9e25bb92019-04-29 09:46:36 -05001598 # Bots and even devs may not have Vulkan headers, so put
1599 # include/third_party/vulkan on our path so they're always available.
1600 all_dependent_configs = [ ":our_vulkan_headers" ]
1601
Mike Klein333fb452019-04-24 08:48:11 -05001602 defines = []
1603 if (skia_enable_discrete_gpu) {
1604 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1605 }
1606
Brian Osmanc9a42472018-05-31 13:17:12 -04001607 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001608 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001609 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001610 "tools/gpu/BackendSurfaceFactory.cpp",
1611 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001612 "tools/gpu/BackendTextureImageFactory.cpp",
1613 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001614 "tools/gpu/FlushFinishTracker.cpp",
1615 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001616 "tools/gpu/GrContextFactory.cpp",
1617 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001618 "tools/gpu/ManagedBackendTexture.cpp",
1619 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001620 "tools/gpu/MemoryCache.cpp",
1621 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001622 "tools/gpu/ProxyUtils.cpp",
1623 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001624 "tools/gpu/TestOps.cpp",
1625 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001626 "tools/gpu/YUVUtils.cpp",
1627 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001628 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1629 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001630 "tools/gpu/mock/MockTestContext.cpp",
1631 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001632
1633 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001634 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001635
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001636 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001637 sources +=
1638 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001639 if (is_ios) {
1640 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001641 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001642 } else if (is_mac) {
1643 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001644 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001645 if (skia_use_angle) {
1646 deps += [ "//third_party/angle2" ]
1647 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1648 }
Brian Salomon1171d312020-03-19 08:47:44 -04001649 }
1650
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001651 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1652 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001653 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001654 if (is_android || skia_use_egl) {
1655 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1656 libs += [ "EGL" ]
1657 } else if (is_linux) {
1658 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1659 libs += [
1660 "GLU",
1661 "GL",
1662 "X11",
1663 ]
1664 } else if (is_win) {
1665 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1666 libs += [ "Gdi32.lib" ]
1667 if (target_cpu != "arm64") {
1668 libs += [ "OpenGL32.lib" ]
1669 }
1670 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001671 }
Greg Daniel54200e42018-12-11 17:03:39 -05001672
Brian Osmanc9a42472018-05-31 13:17:12 -04001673 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001674 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001675 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001676 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1677 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001678 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001679 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001680 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1681 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001682 }
1683 if (skia_use_metal) {
1684 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001685 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001686 if (skia_use_direct3d) {
1687 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001688 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001689 }
Stephen White985741a2019-07-18 11:43:45 -04001690 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001691 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001692 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001693 if (is_clang) {
1694 cflags_cc = [ "-Wno-microsoft-cast" ]
1695 }
Stephen White985741a2019-07-18 11:43:45 -04001696 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001697
1698 if (is_fuchsia && using_fuchsia_sdk) {
1699 libs +=
1700 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1701 }
Jim Van Verth36b86af2020-08-24 17:16:46 +00001702
1703 cflags_objcc = [ "-fobjc-arc" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07001704 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001705
mtkleinc095df52016-08-24 12:23:52 -07001706 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001707 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001708 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001709
1710 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001711 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1712 deps = [ ":flags" ]
1713 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001714 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001715 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001716 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1717 deps = [ ":flags" ]
1718 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001719 }
1720 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001721 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1722 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001723 }
1724 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001725 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1726 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001727 }
mtklein25c81d42016-07-27 13:55:26 -07001728
Mike Klein499f0ac2019-03-25 13:00:12 -05001729 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001730 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001731 sources = [
1732 "tools/trace/ChromeTracingTracer.cpp",
1733 "tools/trace/ChromeTracingTracer.h",
1734 "tools/trace/EventTracingPriv.cpp",
1735 "tools/trace/EventTracingPriv.h",
1736 "tools/trace/SkDebugfTracer.cpp",
1737 "tools/trace/SkDebugfTracer.h",
1738 ]
1739 }
1740
mtkleinc095df52016-08-24 12:23:52 -07001741 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001742 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001743 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001744 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001745 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001746 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001747 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001748 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001749 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001750 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001751 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001752 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001753 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001754 "tools/SkMetaData.cpp",
1755 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001756 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001757 "tools/SkSharingProc.h",
1758 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001759 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001760 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001761 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001762 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001763 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001764 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001765 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001766 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001767 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001768 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001769 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001770 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001771 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001772 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001773 "tools/fonts/TestEmptyTypeface.h",
1774 "tools/fonts/TestFontMgr.cpp",
1775 "tools/fonts/TestFontMgr.h",
1776 "tools/fonts/TestSVGTypeface.cpp",
1777 "tools/fonts/TestSVGTypeface.h",
1778 "tools/fonts/TestTypeface.cpp",
1779 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001780 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001781 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001782 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001783 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001784 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001785 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001786 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001787 if (target_cpu != "wasm") {
1788 sources += [ "tools/CrashHandler.cpp" ]
1789 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001790 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001791 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001792 if (is_ios) {
1793 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001794 sources += [ "tools/ios_utils.h" ]
1795 if (skia_use_metal) {
1796 sources += [ "tools/AutoreleasePool.mm" ]
1797 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001798 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001799 } else if (is_mac) {
1800 if (skia_use_metal) {
1801 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001802 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001803 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001804 } else if (is_win) {
1805 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001806 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001807
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001808 defines = []
1809 if (skia_tools_require_resources) {
1810 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1811 }
mtkleinc095df52016-08-24 12:23:52 -07001812 deps = [
1813 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001814 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001815 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001816 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001817 }
mtklein25c81d42016-07-27 13:55:26 -07001818
Mike Kleine11e5c12019-04-24 12:46:06 -05001819 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001820 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001821 }
1822
Mike Klein6e744122016-10-27 12:21:40 -04001823 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001824 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001825 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001826 if (skia_use_gl) {
1827 sources += gl_gm_sources
1828 }
mtkleinc095df52016-08-24 12:23:52 -07001829 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001830 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001831 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001832 ":skia",
1833 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001834 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001835 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001836 "modules/skparagraph",
1837 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001838 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001839 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001840 if (is_skia_dev_build) {
1841 sources += [ "gm/fiddle.cpp" ]
1842 deps += [ ":skia.h" ]
1843 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001844 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001845
1846 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001847 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001848 sources += [ "gm/video_decoder.cpp" ]
1849 }
mtkleinc095df52016-08-24 12:23:52 -07001850 }
mtklein25c81d42016-07-27 13:55:26 -07001851
Mike Klein7b7077c2019-06-03 17:10:59 -05001852 test_lib("skvm_builders") {
1853 sources = [
1854 "tools/SkVMBuilders.cpp",
1855 "tools/SkVMBuilders.h",
1856 ]
1857 }
1858
Mike Klein6e744122016-10-27 12:21:40 -04001859 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001860 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001861 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001862 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001863 if (skia_use_metal) {
1864 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001865 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001866 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001867 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001868 if (skia_use_gl) {
1869 sources += gl_tests_sources
1870 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001871 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001872 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001873 }
Ben Wagner75626e42020-06-03 13:20:37 -04001874 if (!skia_enable_fontmgr_fontconfig) {
Ben Wagner37a06c02018-06-22 21:11:00 +00001875 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1876 }
mtkleinc095df52016-08-24 12:23:52 -07001877 deps = [
1878 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001879 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001880 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001881 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001882 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001883 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001884 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001885 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001886 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001887 "modules/svg",
mtkleinc095df52016-08-24 12:23:52 -07001888 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001889 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001890 "//third_party/zlib",
1891 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001892 public_deps = [
1893 ":gpu_tool_utils", # Test.h #includes headers from this target.
1894 ]
mtkleinc095df52016-08-24 12:23:52 -07001895 }
mtklein2f3416d2016-08-02 16:02:05 -07001896
Mike Klein6e744122016-10-27 12:21:40 -04001897 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001898 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001899 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001900 deps = [
1901 ":flags",
1902 ":gm",
1903 ":gpu_tool_utils",
1904 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001905 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001906 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001907 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001908 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001909 ]
1910 }
mtklein2b6870c2016-07-28 14:17:33 -07001911
Mike Reedd62d4062019-06-12 10:20:44 -04001912 test_lib("experimental_xform") {
1913 sources = [
1914 "experimental/xform/SkShape.cpp",
1915 "experimental/xform/SkXform.cpp",
1916 "experimental/xform/XContext.cpp",
1917 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001918 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04001919 }
1920
Florin Malitabfe876a2018-09-02 12:33:59 -04001921 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001922 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001923 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04001924 }
Florin Malitab3418102020-10-15 18:10:29 -04001925 test_app("svg_tool") {
1926 deps = [ "modules/svg:tool" ]
1927 }
Florin Malita79725d32018-06-05 16:16:57 -04001928 }
1929
Hal Canary5b39dc82019-04-17 13:29:46 -04001930 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001931 sources = [ "tools/skqp/make_skqp_model.cpp" ]
1932 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04001933 }
1934
Chris Dalton2b598902020-03-25 10:50:35 -06001935 import("gn/samples.gni")
1936 test_lib("samples") {
1937 sources = samples_sources
1938 if (skia_enable_ccpr) {
1939 sources += samples_sources_ccpr
Kevin Lubickebf648e2017-09-21 13:45:16 -04001940 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001941 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06001942 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06001943 ":flags",
1944 ":gpu_tool_utils",
1945 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04001946 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06001947 "modules/skparagraph:samples",
1948 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001949 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04001950 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06001951 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001952 }
Kevin Lubick00398742020-10-08 10:05:07 -04001953 test_lib("hash_and_encode") {
1954 sources = [
1955 "tools/HashAndEncode.cpp",
1956 "tools/HashAndEncode.h",
1957 ]
1958 deps = [
1959 ":flags",
1960 ":skia",
1961 "//third_party/libpng",
1962 ]
1963 }
Chris Dalton2b598902020-03-25 10:50:35 -06001964 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10001965 test_app("convert-to-nia") {
1966 sources = [ "tools/convert-to-nia.cpp" ]
1967 deps = [ ":skia" ]
1968 }
Mike Klein7af351a2018-07-27 09:54:43 -04001969 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001970 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04001971 deps = [
1972 ":skcms",
1973 ":skia",
1974 ]
1975 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001976 test_app("fm") {
1977 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06001978 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05001979 "tools/fm/fm.cpp",
1980 ]
1981 deps = [
1982 ":common_flags_aa",
1983 ":common_flags_gpu",
1984 ":flags",
1985 ":gm",
1986 ":gpu_tool_utils",
1987 ":hash_and_encode",
1988 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06001989 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05001990 ":tool_utils",
1991 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001992 "modules/skottie",
1993 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04001994 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05001995 ]
1996 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001997 test_app("dm") {
1998 sources = [
1999 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002000 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002001 "dm/DMJsonWriter.cpp",
2002 "dm/DMSrcSink.cpp",
2003 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002004 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002005 ":common_flags_aa",
2006 ":common_flags_config",
2007 ":common_flags_gpu",
2008 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002009 ":flags",
2010 ":gm",
2011 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002012 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002013 ":skia",
2014 ":tests",
2015 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002016 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002017 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002018 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002019 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002020 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002021 ]
2022 }
Brian Osman16adfa32016-10-18 14:42:44 -04002023 }
2024
Mike Kleina8a51ce2018-01-09 12:34:11 -05002025 if (!is_win) {
2026 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002027 sources = [ "tools/remote_demo.cpp" ]
2028 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002029 }
2030 }
2031
Hal Canarye107faa2019-10-23 12:52:33 -04002032 if (!is_win) {
2033 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002034 sources = [ "tools/blob_cache_sim.cpp" ]
2035 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002036 }
2037 }
2038
Mike Kleine6682eb2017-01-05 10:54:57 -05002039 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002040 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002041 deps = [
2042 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002043 ":common_flags_aa",
2044 ":common_flags_config",
2045 ":common_flags_gpu",
2046 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002047 ":flags",
2048 ":gm",
2049 ":gpu_tool_utils",
2050 ":skia",
2051 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002052 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002053 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002054 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002055 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002056 ]
mtklein2b6870c2016-07-28 14:17:33 -07002057 }
halcanary19a97202016-08-03 15:08:04 -07002058
Ravi Mistry10d36c52017-01-31 09:49:18 -05002059 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002060 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002061 deps = [
2062 ":flags",
2063 ":skia",
2064 ]
2065 }
2066
Mike Reedc0ee21f2019-05-28 16:11:03 -04002067 if (skia_use_ffmpeg) {
2068 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002069 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002070 deps = [
2071 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002072 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002073 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002074 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002075 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002076 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002077 ]
2078 }
2079 }
2080
Brian Osmanc9a42472018-05-31 13:17:12 -04002081 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002082 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002083 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002084 ":common_flags_config",
2085 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002086 ":flags",
2087 ":gpu_tool_utils",
2088 ":skia",
2089 ":tool_utils",
2090 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002091 }
2092
Mike Kleine6682eb2017-01-05 10:54:57 -05002093 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002094 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002095 deps = [
2096 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002097 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002098 ]
halcanary3eee9d92016-09-10 07:01:53 -07002099 }
mtklein046cb562016-09-16 10:23:12 -07002100
Ben Wagner219f3622017-07-17 15:32:25 -04002101 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002102 sources = [ "tools/fonts/create_test_font.cpp" ]
2103 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002104 assert_no_deps = [
2105 # tool_utils requires the output of this app.
2106 ":tool_utils",
2107 ]
2108 }
2109
Florin Malita5d3ff432018-07-31 16:38:43 -04002110 if (skia_use_expat) {
2111 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002112 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002113 deps = [
2114 ":flags",
2115 ":skia",
2116 ":tool_utils",
2117 ]
2118 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002119 }
2120
Mike Kleine6682eb2017-01-05 10:54:57 -05002121 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002122 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002123 deps = [
2124 ":flags",
2125 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002126 ]
mtklein046cb562016-09-16 10:23:12 -07002127 }
mtkleinecbc5262016-09-22 11:51:24 -07002128
Brian Osman6788a542018-12-10 11:56:01 -05002129 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002130 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002131 sources = [
2132 "tools/skiaserve/Request.cpp",
2133 "tools/skiaserve/Response.cpp",
2134 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002135 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2136 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2137 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2138 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2139 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2140 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2141 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2142 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2143 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002144 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2145 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002146 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2147 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2148 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2149 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2150 ]
2151 deps = [
2152 ":flags",
2153 ":gpu_tool_utils",
2154 ":skia",
2155 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002156 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002157 ]
Mike Klein7d302882016-11-03 14:06:31 -04002158 }
mtkleinecbc5262016-09-22 11:51:24 -07002159 }
kjlubick14f984b2016-10-03 11:49:45 -07002160
Mike Kleine6682eb2017-01-05 10:54:57 -05002161 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002162 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002163 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002164 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002165 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002166 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002167 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002168 "fuzz/FuzzCreateDDL.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002169 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002170 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002171 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002172 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002173 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002174 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002175 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002176 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002177 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002178 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002179 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2180 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002181 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002182 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002183 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002184 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002185 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2186 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002187 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002188 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2189 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002190 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002191 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002192 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002193 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002194 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002195 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002196 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002197 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002198 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002199 "tools/debugger/DrawCommand.cpp",
2200 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002201 ]
2202 deps = [
2203 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002204 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002205 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002206 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002207 ]
kjlubick14f984b2016-10-03 11:49:45 -07002208 }
Mike Klein38312422016-10-05 15:41:01 -04002209
Mike Kleine6682eb2017-01-05 10:54:57 -05002210 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002211 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002212 rebase_path("tests/skia_test.cpp"),
2213 rebase_path("tests/Test.cpp"),
2214 ]
caryclark9feb6322016-10-25 08:58:26 -07002215 deps = [
2216 ":flags",
2217 ":gpu_tool_utils",
2218 ":skia",
2219 ":tool_utils",
2220 ]
caryclark9feb6322016-10-25 08:58:26 -07002221 }
2222
Mike Kleine6682eb2017-01-05 10:54:57 -05002223 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002224 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002225 deps = [
2226 ":flags",
2227 ":skia",
2228 ]
Mike Klein38312422016-10-05 15:41:01 -04002229 }
bungemanfe917272016-10-13 17:36:40 -04002230
Mike Kleine6682eb2017-01-05 10:54:57 -05002231 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002232 sources = [
2233 "tools/skdiff/skdiff.cpp",
2234 "tools/skdiff/skdiff_html.cpp",
2235 "tools/skdiff/skdiff_main.cpp",
2236 "tools/skdiff/skdiff_utils.cpp",
2237 ]
2238 deps = [
2239 ":skia",
2240 ":tool_utils",
2241 ]
bungemanfe917272016-10-13 17:36:40 -04002242 }
halcanarya73d76a2016-10-17 13:19:02 -07002243
Mike Kleine6682eb2017-01-05 10:54:57 -05002244 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002245 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002246 deps = [
2247 ":skia",
2248 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002249 ]
halcanarya73d76a2016-10-17 13:19:02 -07002250 }
Brian Osman16adfa32016-10-18 14:42:44 -04002251
Brian Osmanc9a42472018-05-31 13:17:12 -04002252 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002253 source_set("skqp_lib") {
2254 check_includes = false
2255 testonly = true
2256 if (!is_official_build) {
2257 configs -= [ "//gn:warnings" ]
2258 }
2259 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002260 defines =
2261 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002262 sources = [
2263 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002264 "tools/skqp/src/skqp.cpp",
2265 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002266 ]
2267 deps = [
2268 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002269 ":skia",
2270 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002271 ":tool_utils",
2272 ]
2273 }
2274 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002275 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002276 include_dirs = [ "//" ]
2277 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002278 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002279 }
2280 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002281 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002282 deps = [
2283 ":gm",
2284 ":skia",
2285 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002286 ]
2287 }
2288 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002289 if (is_fuchsia) {
2290 # Build a package repository for skqp on Fuchsia.
2291 group("skqp_repo") {
2292 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002293 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002294 }
2295 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002296 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002297 shared_library("libskqp_app") {
2298 configs += [ ":skia_private" ]
2299 if (!is_official_build) {
2300 configs -= [ "//gn:warnings" ]
2301 }
2302 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002303 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002304 deps = [
2305 ":skia",
2306 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002307 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002308 ]
2309 libs = [ "android" ]
2310 }
2311 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002312 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002313 test_app("skottie_android") {
2314 is_shared_library = true
2315
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002316 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002317 libs = []
2318
Stan Iliev93151722018-08-02 11:10:52 -04002319 deps = [
2320 ":skia",
2321 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002322 "modules/sksg:samples",
Jorge Betancourt646d6c52020-08-31 16:07:25 -04002323 "//third_party/oboe",
Stan Iliev93151722018-08-02 11:10:52 -04002324 ]
2325 }
2326 }
Hal Canary75427132017-10-11 16:00:31 -04002327
Hal Canarya9de7602018-01-19 13:08:23 -05002328 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002329 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002330 deps = [
2331 ":gm",
2332 ":skia",
2333 ]
2334 }
2335 test_app("list_gpu_unit_tests") {
2336 sources = [
2337 "dm/DMGpuTestProcs.cpp",
2338 "tools/list_gpu_unit_tests.cpp",
2339 ]
2340 deps = [
2341 ":skia",
2342 ":tests",
2343 ]
2344 }
2345
Brian Osmanc9a42472018-05-31 13:17:12 -04002346 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002347 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002348 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002349 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002350 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002351 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002352 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002353 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002354 "tools/sk_app/CommandSet.h",
2355 "tools/sk_app/DisplayParams.h",
2356 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002357 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002358 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002359 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002360 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002361 ]
2362 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002363 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002364
2365 if (is_android) {
2366 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002367 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002368 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002369 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002370 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002371 "tools/sk_app/android/main_android.cpp",
2372 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002373 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002374 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002375 libs += [ "android" ]
2376 } else if (is_linux) {
2377 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002378 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002379 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002380 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002381 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002382 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002383 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002384 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002385 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002386 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002387 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002388 "X11",
2389 ]
2390 } else if (is_win) {
2391 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002392 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002393 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002394 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002395 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002396 "tools/sk_app/win/main_win.cpp",
2397 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002398 } else if (is_mac) {
2399 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002400 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002401 "tools/sk_app/mac/WindowContextFactory_mac.h",
2402 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002403 "tools/sk_app/mac/Window_mac.mm",
2404 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002405 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002406 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002407 "QuartzCore.framework",
2408 "Cocoa.framework",
2409 "Foundation.framework",
2410 ]
2411 } else if (is_ios) {
2412 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002413 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002414 "tools/sk_app/ios/WindowContextFactory_ios.h",
2415 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002416 "tools/sk_app/ios/Window_ios.mm",
2417 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002418 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002419 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002420 }
2421
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002422 if (skia_use_gl) {
2423 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002424 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002425 if (is_android) {
2426 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2427 } else if (is_linux) {
2428 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2429 } else if (is_win) {
2430 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2431 if (skia_use_angle) {
2432 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2433 }
2434 } else if (is_mac) {
2435 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2436 } else if (is_ios) {
2437 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2438 }
2439 }
2440
Brian Osmanc9a42472018-05-31 13:17:12 -04002441 if (skia_use_vulkan) {
2442 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002443 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002444 if (is_android) {
2445 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2446 } else if (is_linux) {
2447 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2448 libs += [ "X11-xcb" ]
2449 } else if (is_win) {
2450 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2451 }
2452 }
2453
Jim Van Verthbe39f712019-02-08 15:36:14 -05002454 if (skia_use_metal) {
2455 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002456 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002457 if (is_mac) {
2458 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002459 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002460 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002461 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002462 }
2463
Jim Van Verth682a2f42020-05-13 16:54:09 -04002464 if (skia_use_direct3d) {
2465 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2466 }
2467
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002468 if (skia_use_dawn) {
2469 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002470 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002471 if (is_linux) {
2472 if (dawn_enable_vulkan) {
2473 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2474 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2475 libs += [ "X11-xcb" ]
2476 }
2477 } else if (is_win) {
2478 if (dawn_enable_d3d12) {
2479 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2480 }
2481 } else if (is_mac) {
2482 if (dawn_enable_metal) {
2483 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2484 }
2485 }
2486 }
2487
Mike Kleina01c6b02020-04-01 13:47:34 -05002488 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002489 if (is_android) {
2490 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002491 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002492 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002493 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002494 }
Brian Osman16adfa32016-10-18 14:42:44 -04002495 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002496
Hal Canary87515122019-03-15 14:22:51 -04002497 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2498 test_app("fiddle_examples") {
2499 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002500 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002501 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002502 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002503 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002504 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002505 cflags = [
2506 "/wd4756", # Overflow in constant arithmetic
2507 "/wd4305", # truncation from 'double' to 'float'
2508 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002509 }
Hal Canary87515122019-03-15 14:22:51 -04002510 deps = [
2511 ":skia",
2512 ":skia.h",
2513 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002514 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002515 ]
2516 }
2517 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002518
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002519 # sk_app can work without GL but viewer always runs raster through a GL window context.
2520 if (skia_use_gl) {
2521 test_app("viewer") {
2522 is_shared_library = is_android
2523 sources = [
2524 "tools/viewer/AnimTimer.h",
2525 "tools/viewer/BisectSlide.cpp",
2526 "tools/viewer/GMSlide.cpp",
2527 "tools/viewer/ImGuiLayer.cpp",
2528 "tools/viewer/ImageSlide.cpp",
2529 "tools/viewer/ParticlesSlide.cpp",
2530 "tools/viewer/SKPSlide.cpp",
2531 "tools/viewer/SampleSlide.cpp",
Florin Malita45cd2002020-06-09 14:00:54 -04002532 "tools/viewer/SkRiveSlide.cpp",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002533 "tools/viewer/SkSLSlide.cpp",
2534 "tools/viewer/SkottieSlide.cpp",
2535 "tools/viewer/SlideDir.cpp",
2536 "tools/viewer/StatsLayer.cpp",
2537 "tools/viewer/SvgSlide.cpp",
2538 "tools/viewer/TouchGesture.cpp",
2539 "tools/viewer/TouchGesture.h",
2540 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002541 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002542 ]
2543 libs = []
2544
2545 deps = [
2546 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002547 ":flags",
2548 ":gm",
2549 ":gpu_tool_utils",
2550 ":samples",
2551 ":sk_app",
2552 ":skia",
2553 ":tool_utils",
2554 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002555 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002556 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002557 "modules/particles",
2558 "modules/skottie",
2559 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002560 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002561 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002562 "//third_party/imgui",
2563 ]
2564 if (skia_use_experimental_xform) {
2565 deps += [ ":experimental_xform" ]
2566 sources += [ "gm/xform.cpp" ]
2567 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002568 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002569 deps += [
2570 "//third_party/spirv-tools:spvtools",
2571
2572 #spvtools depends on this but doesn't deps it in. Looks like upstream bug
2573 #that we replicated in our third_party/spirv-tools/BUILD.gn
2574 "//third_party/spirv-tools:spvtools_val",
2575 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002576 }
Mike Reedd62d4062019-06-12 10:20:44 -04002577 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002578 }
2579
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002580 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002581 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002582 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002583 libs = []
2584
Brian Osmaneff04b52017-11-21 13:18:02 -05002585 deps = [
2586 ":flags",
2587 ":gpu_tool_utils",
2588 ":sk_app",
2589 ":skia",
2590 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002591 ]
2592 }
2593 }
2594
Mike Klein9f6468f2020-05-19 13:14:40 -05002595 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002596 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002597 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002598 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002599 deps = [
2600 ":gpu_tool_utils",
2601 ":skia",
2602 "//third_party/libsdl",
2603 ]
2604 }
2605 }
2606
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002607 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2608 action_foreach("generate_mocs") {
2609 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002610 sources = [ "tools/mdbviz/MainWindow.h" ]
2611 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002612 args = [
2613 "$skia_qt_path" + "/bin/moc",
2614 "{{source}}",
2615 "-o",
2616 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2617 ]
2618 }
2619 action_foreach("generate_resources") {
2620 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002621 sources = [ "tools/mdbviz/resources.qrc" ]
2622 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002623 args = [
2624 "$skia_qt_path" + "/bin/rcc",
2625 "{{source}}",
2626 "-o",
2627 "gen/mdbviz/{{source_name_part}}_res.cpp",
2628 ]
2629 }
2630 test_app("mdbviz") {
2631 if (is_win) {
2632 # on Windows we need to disable some exception handling warnings due to the Qt headers
2633 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2634 }
2635 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002636 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002637 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002638 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002639 "tools/debugger/DrawCommand.cpp",
2640 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002641 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002642 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002643 "tools/mdbviz/main.cpp",
2644
2645 # generated files
2646 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2647 "$target_gen_dir/mdbviz/resources_res.cpp",
2648 ]
2649 lib_dirs = [ "$skia_qt_path/lib" ]
2650 libs = [
2651 "Qt5Core.lib",
2652 "Qt5Gui.lib",
2653 "Qt5Widgets.lib",
2654 ]
2655 include_dirs = [
2656 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002657 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002658 "$skia_qt_path/include/QtWidgets",
2659 ]
2660 deps = [
2661 ":generate_mocs",
2662 ":generate_resources",
2663 ":skia",
2664 ]
2665 }
2666 }
2667
Mike Kleine459afd2017-03-03 09:21:30 -05002668 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002669 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002670 sources = [ "$ndk/$ndk_gdbserver" ]
2671 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002672 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002673 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002674
2675 if (skia_use_opencl) {
2676 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002677 sources = [ "tools/hello-opencl.cpp" ]
2678 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002679 }
2680 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002681
Brian Osmanf564f152019-07-23 15:14:30 -04002682 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002683 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002684 deps = [
2685 ":skia",
2686 "modules/particles",
2687 ]
2688 }
2689
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002690 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002691 test_app("editor") {
2692 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002693 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002694 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002695 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002696
2697 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002698 sources = [ "tools/image_diff_metric.cpp" ]
2699 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002700 }
Chris Dalton2b598902020-03-25 10:50:35 -06002701
2702 group("modules_testonly") {
2703 testonly = true
2704 deps = []
2705 if (target_cpu == "wasm") {
2706 deps += [ "modules/canvaskit:viewer_wasm" ]
2707 }
2708 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002709
2710 if (skia_build_fuzzers) {
2711 template("libfuzzer_app") {
2712 output_dir = root_build_dir
2713 executable(target_name) {
2714 check_includes = false
2715 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2716 configs += [ ":skia_private" ]
2717 sources += [
2718 "fuzz/Fuzz.cpp",
2719 "fuzz/FuzzCommon.cpp",
2720 ]
2721 deps += [
2722 ":flags",
2723 ":gpu_tool_utils",
2724 ":skia",
2725 ]
2726 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2727 if (skia_use_libfuzzer_defaults) {
2728 cflags = [ "-fsanitize=fuzzer" ]
2729 ldflags = [ "-fsanitize=fuzzer" ]
2730 }
2731 testonly = true
2732 }
2733 }
2734
2735 libfuzzer_app("region_deserialize") {
2736 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2737 deps = []
2738 }
2739
2740 libfuzzer_app("image_filter_deserialize") {
2741 include_dirs = [
2742 "tools",
2743 "tools/fonts",
2744 ]
2745 sources = [
2746 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2747 "tools/Resources.cpp",
2748 "tools/fonts/TestFontMgr.cpp",
2749 "tools/fonts/TestSVGTypeface.cpp",
2750 "tools/fonts/TestTypeface.cpp",
2751 ]
Florin Malitab3418102020-10-15 18:10:29 -04002752 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002753 }
2754
2755 libfuzzer_app("region_set_path") {
2756 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2757 deps = []
2758 }
2759
2760 libfuzzer_app("textblob_deserialize") {
2761 include_dirs = [
2762 "tools",
2763 "tools/fonts",
2764 ]
2765 sources = [
2766 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2767 "tools/Resources.cpp",
2768 "tools/fonts/TestFontMgr.cpp",
2769 "tools/fonts/TestSVGTypeface.cpp",
2770 "tools/fonts/TestTypeface.cpp",
2771 ]
Florin Malitab3418102020-10-15 18:10:29 -04002772 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002773 }
2774
2775 libfuzzer_app("path_deserialize") {
2776 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2777 deps = []
2778 }
2779
2780 libfuzzer_app("image_decode") {
2781 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2782 deps = []
2783 }
2784
2785 libfuzzer_app("animated_image_decode") {
2786 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2787 deps = []
2788 }
2789
2790 libfuzzer_app("api_create_ddl") {
2791 include_dirs = [
2792 "include",
2793 "include/gpu",
2794 ]
2795 sources = [
2796 "fuzz/FuzzCreateDDL.cpp",
2797 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2798 "tools/Resources.cpp",
2799 "tools/UrlDataManager.cpp",
2800 "tools/debugger/DebugCanvas.cpp",
2801 "tools/debugger/DebugLayerManager.cpp",
2802 "tools/debugger/DrawCommand.cpp",
2803 "tools/debugger/JsonWriteBuffer.cpp",
2804 "tools/fonts/TestFontMgr.cpp",
2805 "tools/fonts/TestSVGTypeface.cpp",
2806 "tools/fonts/TestTypeface.cpp",
2807 ]
2808 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002809 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002810 "//third_party/libpng",
2811 ]
2812 }
2813
2814 libfuzzer_app("api_draw_functions") {
2815 sources = [
2816 "fuzz/FuzzDrawFunctions.cpp",
2817 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2818 ]
2819 deps = []
2820 }
2821
2822 libfuzzer_app("api_gradients") {
2823 sources = [
2824 "fuzz/FuzzGradients.cpp",
2825 "fuzz/oss_fuzz/FuzzGradients.cpp",
2826 ]
2827 deps = []
2828 }
2829
2830 libfuzzer_app("api_image_filter") {
2831 include_dirs = [
2832 "tools",
2833 "tools/debugger",
2834 ]
2835 sources = [
2836 "fuzz/FuzzCanvas.cpp",
2837 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2838 "tools/UrlDataManager.cpp",
2839 "tools/debugger/DebugCanvas.cpp",
2840 "tools/debugger/DebugLayerManager.cpp",
2841 "tools/debugger/DrawCommand.cpp",
2842 "tools/debugger/JsonWriteBuffer.cpp",
2843 ]
2844 deps = [ "//third_party/libpng" ]
2845 }
2846
2847 libfuzzer_app("api_path_measure") {
2848 sources = [
2849 "fuzz/FuzzPathMeasure.cpp",
2850 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2851 ]
2852 deps = []
2853 }
2854
2855 libfuzzer_app("api_pathop") {
2856 sources = [
2857 "fuzz/FuzzPathop.cpp",
2858 "fuzz/oss_fuzz/FuzzPathop.cpp",
2859 ]
2860 deps = []
2861 }
2862
2863 libfuzzer_app("api_raster_n32_canvas") {
2864 include_dirs = [
2865 "tools",
2866 "tools/debugger",
2867 "tools/fonts",
2868 ]
2869 sources = [
2870 "fuzz/FuzzCanvas.cpp",
2871 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
2872 "tools/Resources.cpp",
2873 "tools/UrlDataManager.cpp",
2874 "tools/debugger/DebugCanvas.cpp",
2875 "tools/debugger/DebugLayerManager.cpp",
2876 "tools/debugger/DrawCommand.cpp",
2877 "tools/debugger/JsonWriteBuffer.cpp",
2878 "tools/fonts/TestFontMgr.cpp",
2879 "tools/fonts/TestSVGTypeface.cpp",
2880 "tools/fonts/TestTypeface.cpp",
2881 ]
2882 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002883 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002884 "//third_party/libpng",
2885 ]
2886 }
2887
2888 if (skia_use_gl) {
2889 libfuzzer_app("api_mock_gpu_canvas") {
2890 include_dirs = [
2891 "tools",
2892 "tools/debugger",
2893 "tools/fonts",
2894 ]
2895 sources = [
2896 "fuzz/FuzzCanvas.cpp",
2897 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
2898 "tools/LsanSuppressions.cpp",
2899 "tools/Resources.cpp",
2900 "tools/UrlDataManager.cpp",
2901 "tools/debugger/DebugCanvas.cpp",
2902 "tools/debugger/DebugLayerManager.cpp",
2903 "tools/debugger/DrawCommand.cpp",
2904 "tools/debugger/JsonWriteBuffer.cpp",
2905 "tools/fonts/TestFontMgr.cpp",
2906 "tools/fonts/TestSVGTypeface.cpp",
2907 "tools/fonts/TestTypeface.cpp",
2908 ]
2909 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002910 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002911 "//third_party/libpng",
2912 ]
2913 }
2914 }
2915
2916 libfuzzer_app("api_null_canvas") {
2917 include_dirs = [
2918 "tools",
2919 "tools/debugger",
2920 "tools/fonts",
2921 ]
2922 sources = [
2923 "fuzz/FuzzCanvas.cpp",
2924 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
2925 "tools/Resources.cpp",
2926 "tools/UrlDataManager.cpp",
2927 "tools/debugger/DebugCanvas.cpp",
2928 "tools/debugger/DebugLayerManager.cpp",
2929 "tools/debugger/DrawCommand.cpp",
2930 "tools/debugger/JsonWriteBuffer.cpp",
2931 "tools/fonts/TestFontMgr.cpp",
2932 "tools/fonts/TestSVGTypeface.cpp",
2933 "tools/fonts/TestTypeface.cpp",
2934 ]
2935 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002936 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002937 "//third_party/libpng",
2938 ]
2939 }
2940
2941 libfuzzer_app("api_svg_canvas") {
2942 include_dirs = [
2943 "include",
2944 "include/svg",
2945 ]
2946 sources = [
2947 "fuzz/FuzzCanvas.cpp",
2948 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
2949 "tools/Resources.cpp",
2950 "tools/UrlDataManager.cpp",
2951 "tools/debugger/DebugCanvas.cpp",
2952 "tools/debugger/DebugLayerManager.cpp",
2953 "tools/debugger/DrawCommand.cpp",
2954 "tools/debugger/JsonWriteBuffer.cpp",
2955 "tools/fonts/TestFontMgr.cpp",
2956 "tools/fonts/TestSVGTypeface.cpp",
2957 "tools/fonts/TestTypeface.cpp",
2958 ]
2959 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002960 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002961 "//third_party/libpng",
2962 ]
2963 }
2964
2965 libfuzzer_app("png_encoder") {
2966 sources = [
2967 "fuzz/FuzzEncoders.cpp",
2968 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
2969 ]
2970 deps = []
2971 }
2972
2973 libfuzzer_app("jpeg_encoder") {
2974 sources = [
2975 "fuzz/FuzzEncoders.cpp",
2976 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
2977 ]
2978 deps = []
2979 }
2980
2981 libfuzzer_app("webp_encoder") {
2982 sources = [
2983 "fuzz/FuzzEncoders.cpp",
2984 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
2985 ]
2986 deps = []
2987 }
2988
2989 libfuzzer_app("skottie_json") {
2990 sources = [
2991 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
2992 "tools/Resources.cpp",
2993 "tools/fonts/TestFontMgr.cpp",
2994 "tools/fonts/TestSVGTypeface.cpp",
2995 "tools/fonts/TestTypeface.cpp",
2996 ]
2997 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002998 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04002999 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003000 ]
3001 }
3002
3003 libfuzzer_app("skjson") {
3004 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3005 deps = []
3006 }
3007
3008 libfuzzer_app("api_polyutils") {
3009 sources = [
3010 "fuzz/FuzzPolyUtils.cpp",
3011 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3012 ]
3013 deps = [ ":skia" ]
3014 }
3015
3016 libfuzzer_app("android_codec") {
3017 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3018 deps = []
3019 }
3020
3021 libfuzzer_app("image_decode_incremental") {
3022 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3023 deps = []
3024 }
3025
3026 libfuzzer_app("sksl2glsl") {
3027 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3028 deps = []
3029 }
3030
3031 libfuzzer_app("sksl2spirv") {
3032 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3033 deps = []
3034 }
3035
3036 libfuzzer_app("sksl2metal") {
3037 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3038 deps = []
3039 }
3040
3041 libfuzzer_app("sksl2pipeline") {
3042 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3043 deps = []
3044 }
3045
3046 libfuzzer_app("skdescriptor_deserialize") {
3047 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3048 deps = []
3049 }
3050
3051 libfuzzer_app("svg_dom") {
3052 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003053 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003054 }
3055
3056 libfuzzer_app("skruntimeeffect") {
3057 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3058 deps = []
3059 }
3060
3061 libfuzzer_app("skp") {
3062 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3063 deps = []
3064 }
3065 }
mtklein25c81d42016-07-27 13:55:26 -07003066}
Hal Canary932a2c02019-09-17 10:43:18 -04003067
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003068if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003069 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003070 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003071 }
Hal Canary27483062019-12-06 15:01:08 -05003072}
3073
Hal Canary60ff6512020-01-21 12:39:20 -05003074if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003075 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003076 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003077 }
3078}