blob: e53b4f8162935882b3b03993597c63ad6a39b2f0 [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",
John Stilesdda1d312020-11-20 16:28:50 -0500578 "//third_party/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400579 ]
580 }
581
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400582 skslc_path = "$root_out_dir/"
583 if (host_toolchain != default_toolchain_name) {
584 skslc_path += "$host_toolchain/"
585 }
586 skslc_path += "skslc"
587 if (host_os == "win") {
588 skslc_path += ".exe"
589 }
590
Brian Osmandd496172020-08-08 08:17:18 -0400591 action("create_sksl_fp") {
592 script = "gn/create_sksl_fp.py"
593 sources = [
594 "include/private/GrSharedEnums.h",
595 "src/sksl/sksl_fp_raw.sksl",
596 ]
597 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
598 args = [
599 rebase_path(sources[0]),
600 rebase_path(sources[1]),
601 rebase_path(outputs[0]),
602 ]
603 }
604
605 copy("sksl_pre_includes") {
606 sources = [
607 "src/sksl/sksl_frag.sksl",
608 "src/sksl/sksl_geom.sksl",
609 "src/sksl/sksl_gpu.sksl",
610 "src/sksl/sksl_interp.sksl",
611 "src/sksl/sksl_pipeline.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500612 "src/sksl/sksl_public.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400613 "src/sksl/sksl_vert.sksl",
614 ]
615 outputs = [ "$root_out_dir/{{source_file_part}}" ]
616 }
617
618 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
619 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
620
621 dehydrate_sksl_outputs = []
622 foreach(src, dehydrate_sksl_sources) {
623 name = get_path_info(src, "name")
624
625 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
626 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
627 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
628 "src/sksl/generated/$name.dehydrated.sksl",
629 target_out_dir) ]
630 }
631
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400632 action("dehydrate_sksl") {
633 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400634 deps = [
635 ":create_sksl_fp",
636 ":sksl_pre_includes",
637 ":skslc(//gn/toolchain:$host_toolchain)",
638 ]
639 sources = dehydrate_sksl_sources
640 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000641 args = [
642 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400643 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000644 ]
Brian Osmandd496172020-08-08 08:17:18 -0400645 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400646 }
John Stilesd836f842020-09-14 10:21:44 -0400647} else {
648 group("dehydrate_sksl") {
649 }
650}
651
652skia_gpu_processor_outputs = []
653if (skia_compile_processors) {
654 foreach(src, skia_gpu_processor_sources) {
655 dir = get_path_info(src, "dir")
656 name = get_path_info(src, "name")
657
658 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
659 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
660 skia_gpu_processor_outputs += [
661 "$target_out_dir/" +
662 rebase_path("$dir/generated/$name.h", target_out_dir),
663 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
664 # confused due to the same file being named by two different paths
665 ]
666 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400667
Ethan Nicholas762466e2017-06-29 10:03:38 -0400668 action("compile_processors") {
669 script = "gn/compile_processors.py"
670 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400671 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400672 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400673 ":skslc(//gn/toolchain:$host_toolchain)",
674 ]
675 sources = skia_gpu_processor_sources
676 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400677 args = [
678 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400679 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400680 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400681 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400682 args += rebase_path(skia_gpu_processor_sources)
683 }
684} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400685 group("compile_processors") {
686 }
John Stilesd836f842020-09-14 10:21:44 -0400687}
688
689if (skia_compile_sksl_tests) {
690 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400691
John Stiles7e248712020-09-24 16:42:09 -0400692 template("compile_sksl") {
693 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
694 action("compile_sksl_${target_name}") {
695 script = "gn/compile_sksl_tests.py"
696 deps = [
697 ":create_sksl_fp",
698 ":sksl_pre_includes",
699 ":skslc(//gn/toolchain:$host_toolchain)",
700 ]
701 sources = invoker.sources
702 outputs = []
703 foreach(src, sources) {
704 dir = get_path_info(src, "dir")
705 name = get_path_info(src, "name")
706 foreach(outputPattern, invoker.outputPatterns) {
707 outputs += [ target_out_dir + "/" + rebase_path(
708 dir + outputPattern[0] + name + outputPattern[1],
709 target_out_dir) ]
710 }
711 }
712 args = [
713 rebase_path(skslc_path),
714 invoker.lang,
715 invoker.settings,
716 ]
717 args += rebase_path(sources)
718 }
John Stilesd836f842020-09-14 10:21:44 -0400719 }
John Stiles7e248712020-09-24 16:42:09 -0400720 compile_sksl("fp_tests") {
721 sources = sksl_fp_tests_sources
722 outputPatterns = [
723 [
724 "/golden/",
725 ".cpp",
726 ],
727 [
728 "/golden/",
729 ".h",
730 ],
731 ]
732 lang = "--fp"
733 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400734 }
John Stiles7e248712020-09-24 16:42:09 -0400735 compile_sksl("glsl_tests") {
736 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
737 outputPatterns = [ [
738 "/golden/",
739 ".glsl",
740 ] ]
741 lang = "--glsl"
742 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400743 }
John Stiles7e248712020-09-24 16:42:09 -0400744 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400745 sources = sksl_glsl_settings_tests_sources
John Stiles7e248712020-09-24 16:42:09 -0400746 outputPatterns = [ [
747 "/golden/",
748 "StandaloneSettings.glsl",
749 ] ]
750 lang = "--glsl"
751 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400752 }
John Stilesaeae3a52020-09-25 13:35:58 -0400753 compile_sksl("metal_tests") {
754 sources = sksl_metal_tests_sources
755 outputPatterns = [ [
756 "/golden/",
757 ".metal",
758 ] ]
759 lang = "--metal"
760 settings = "--settings"
761 }
John Stilesdda1d312020-11-20 16:28:50 -0500762 compile_sksl("spirv_tests") {
763 sources = sksl_spirv_tests_sources
764 outputPatterns = [ [
765 "/golden/",
766 ".spirv",
767 ] ]
768 lang = "--spirv"
769 settings = "--settings"
770 }
John Stilesd836f842020-09-14 10:21:44 -0400771} else {
John Stiles7e248712020-09-24 16:42:09 -0400772 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400773 }
John Stiles7e248712020-09-24 16:42:09 -0400774 group("compile_sksl_glsl_tests") {
775 }
776 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400777 }
John Stilesaeae3a52020-09-25 13:35:58 -0400778 group("compile_sksl_metal_tests") {
779 }
John Stilesdda1d312020-11-20 16:28:50 -0500780 group("compile_sksl_spirv_tests") {
781 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400782}
783
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500784optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700785 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400786 deps = [
787 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400788 ":compile_sksl_fp_tests",
789 ":compile_sksl_glsl_nosettings_tests",
790 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400791 ":compile_sksl_metal_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500792 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400793 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700794 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400795 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700796 if (skia_generate_workarounds) {
797 deps += [ ":workaround_list" ]
798 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800799 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600800 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400801 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700802
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400803 sources =
804 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400805 if (!skia_enable_ccpr) {
806 sources -= skia_ccpr_sources
807 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
808 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400809 if (!skia_enable_nvpr) {
810 sources -= skia_nvpr_sources
811 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
812 }
mtklein06c35c02016-09-20 12:28:12 -0700813
Mike Klein703cf5a2016-10-13 17:18:04 -0400814 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400815 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700816
John Rosascoa9b348f2019-11-08 13:18:15 -0800817 if (skia_use_gl) {
818 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400819 if (is_android) {
820 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
821
822 # this lib is required to link against AHardwareBuffer
823 if (defined(ndk_api) && ndk_api >= 26) {
824 libs += [ "android" ]
825 }
826 } else if (skia_use_egl) {
827 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
828 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400829 } else if (skia_use_webgl) {
830 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400831 } else if (is_linux && skia_use_x11) {
832 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
833 libs += [ "GL" ]
834 } else if (is_mac) {
835 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
836 } else if (is_ios) {
837 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
838 } else if (is_win) {
839 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
840 if (target_cpu != "arm64") {
841 libs += [ "OpenGL32.lib" ]
842 }
843 } else {
844 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
845 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800846 sources += skia_gl_gpu_sources
847 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400848
mtkleine9fb3d52016-09-20 15:11:46 -0700849 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400850 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000851 if (skia_use_vma) {
852 deps += [ "third_party/vulkanmemoryallocator" ]
853 }
mtkleine9fb3d52016-09-20 15:11:46 -0700854 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700855 if (skia_enable_vulkan_debug_layers) {
856 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
857 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800858 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800859 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700860 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
861 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400862 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700863 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800864 }
mtkleine9fb3d52016-09-20 15:11:46 -0700865 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400866
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400867 if (is_android && (skia_use_gl || skia_use_vulkan)) {
868 # this lib is required to link against AHardwareBuffer
869 if (defined(ndk_api) && ndk_api >= 26) {
870 libs += [ "android" ]
871 }
872 }
873
Stephen White0d70b712019-07-10 15:51:30 -0400874 if (skia_use_dawn) {
875 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400876 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700877 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400878 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700879 "//third_party/externals/dawn/src/dawn:dawn_proc",
880 "//third_party/externals/dawn/src/dawn:dawncpp",
881 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400882 ]
883 if (dawn_enable_d3d12) {
884 libs += [
885 "d3d12.lib",
886 "dxgi.lib",
887 "d3dcompiler.lib",
888 ]
889 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400890 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400891 }
892 }
893
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500894 if (skia_use_direct3d) {
895 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400896 deps += [
897 "//third_party/d3d12allocator",
898 "//third_party/spirv-cross:spirv_cross",
899 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500900 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500901 if (skia_enable_direct3d_debug_layer) {
902 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
903 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500904 libs += [
905 "d3d12.lib",
906 "dxgi.lib",
907 "d3dcompiler.lib",
908 ]
909 }
910
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400911 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400912 if (skia_use_metal) {
913 public_defines += [ "SK_METAL" ]
914 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400915 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400916 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000917 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400918 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500919
Kevin Lubickf4def342018-10-04 12:52:50 -0400920 if (is_debug) {
921 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
922 }
mtklein06c35c02016-09-20 12:28:12 -0700923}
924
Leon Scroggins III41169202019-01-29 09:29:57 -0500925optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500926 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500927 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
928 if ("True" ==
929 exec_script("gn/checkpath.py",
930 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
931 "trim string")) {
932 public_defines = [ "SK_USE_LIBGIFCODEC" ]
933 public_include_dirs = [
934 ".",
935 skia_libgifcodec_path,
936 ]
937 include_dirs = public_include_dirs
938 import(_libgifcodec_gni_path)
939 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
940 ".",
941 skia_libgifcodec_path)
942 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500943}
944
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400945optional("heif") {
946 enabled = skia_use_libheif
947 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
948
949 deps = []
950
Mike Kleina01c6b02020-04-01 13:47:34 -0500951 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400952}
953
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400954optional("jpeg_decode") {
955 enabled = skia_use_libjpeg_turbo_decode
956 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
957
Mike Kleina01c6b02020-04-01 13:47:34 -0500958 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400959 sources = [
960 "src/codec/SkJpegCodec.cpp",
961 "src/codec/SkJpegDecoderMgr.cpp",
962 "src/codec/SkJpegUtility.cpp",
963 ]
964}
965
966optional("jpeg_encode") {
967 enabled = skia_use_libjpeg_turbo_encode
968 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -0700969
Mike Kleina01c6b02020-04-01 13:47:34 -0500970 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
971 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -0700972 sources = [
mtklein63213812016-08-24 09:55:56 -0700973 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400974 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700975 ]
976}
977
Leon Scroggins III326b9892020-08-05 16:51:10 -0400978optional("ndk_images") {
979 enabled = skia_use_ndk_images
980 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
981 sources = [
982 "src/ports/SkImageEncoder_NDK.cpp",
983 "src/ports/SkImageGeneratorNDK.cpp",
984 "src/ports/SkNDKConversions.cpp",
985 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400986 libs = [ "jnigraphics" ]
987}
988
mtklein63213812016-08-24 09:55:56 -0700989optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500990 enabled = skia_use_zlib && skia_enable_pdf
991 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700992
Mike Kleina01c6b02020-04-01 13:47:34 -0500993 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400994 if (skia_use_libjpeg_turbo_decode) {
995 deps += [ ":jpeg_decode" ]
996 }
997 if (skia_use_libjpeg_turbo_encode) {
998 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400999 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001000 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001001 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001002 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001003 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1004 deps += [ "//third_party/harfbuzz" ]
1005 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1006 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001007 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001008 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001009 }
1010}
1011
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001012optional("xps") {
1013 enabled = skia_use_xps && is_win
1014 public_defines = [ "SK_SUPPORT_XPS" ]
1015 public = skia_xps_public
1016 sources = skia_xps_sources
1017}
1018
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001019optional("png_decode") {
1020 enabled = skia_use_libpng_decode
1021 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001022
Mike Kleina01c6b02020-04-01 13:47:34 -05001023 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001024 sources = [
1025 "src/codec/SkIcoCodec.cpp",
1026 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001027 ]
1028}
1029
1030optional("png_encode") {
1031 enabled = skia_use_libpng_encode
1032 public_defines = [ "SK_ENCODE_PNG" ]
1033
Mike Kleina01c6b02020-04-01 13:47:34 -05001034 deps = [ "//third_party/libpng" ]
1035 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001036}
1037
scroggof84ad642016-10-31 09:02:57 -07001038optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001039 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001040 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1041
1042 deps = [
1043 "//third_party/dng_sdk",
1044 "//third_party/libjpeg-turbo:libjpeg",
1045 "//third_party/piex",
1046 ]
1047
1048 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1049 # Skia.
1050 configs_to_remove = [ "//gn:no_exceptions" ]
1051
Mike Kleina01c6b02020-04-01 13:47:34 -05001052 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001053}
1054
Mike Klein852a8cb2018-05-15 10:46:58 -04001055import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -04001056source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001057 cflags = []
1058 if (!is_win || is_clang) {
1059 cflags += [
1060 "-w",
1061 "-std=c11",
1062 ]
1063 }
1064
Mike Kleina01c6b02020-04-01 13:47:34 -05001065 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001066 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001067 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1068}
1069
mtklein3cc22182016-08-29 13:26:14 -07001070optional("typeface_freetype") {
1071 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001072
Mike Kleina01c6b02020-04-01 13:47:34 -05001073 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001074 sources = [
1075 "src/ports/SkFontHost_FreeType.cpp",
1076 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001077 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001078 ]
1079}
1080
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001081optional("webp_decode") {
1082 enabled = skia_use_libwebp_decode
1083 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001084
Mike Kleina01c6b02020-04-01 13:47:34 -05001085 deps = [ "//third_party/libwebp" ]
1086 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001087}
1088
1089optional("webp_encode") {
1090 enabled = skia_use_libwebp_encode
1091 public_defines = [ "SK_ENCODE_WEBP" ]
1092
Mike Kleina01c6b02020-04-01 13:47:34 -05001093 deps = [ "//third_party/libwebp" ]
1094 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001095}
1096
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001097optional("wuffs") {
1098 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001099 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001100
Mike Kleina01c6b02020-04-01 13:47:34 -05001101 deps = [ "//third_party/wuffs" ]
1102 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001103}
1104
mtklein63213812016-08-24 09:55:56 -07001105optional("xml") {
1106 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001107 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001108
Mike Kleina01c6b02020-04-01 13:47:34 -05001109 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001110 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001111 "src/svg/SkSVGCanvas.cpp",
1112 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001113 "src/xml/SkDOM.cpp",
1114 "src/xml/SkXMLParser.cpp",
1115 "src/xml/SkXMLWriter.cpp",
1116 ]
1117}
1118
Mike Klein853d4ed2020-08-20 00:41:00 +00001119optional("sksl_interpreter") {
1120 enabled = skia_enable_sksl_interpreter
1121 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
1122}
1123
Mike Klein613ad382019-06-06 11:42:02 -05001124optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001125 enabled = skia_enable_skvm_jit_when_possible
1126 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001127 if (skia_vtune_path != "") {
1128 public_defines += [ "SKVM_JIT_VTUNE" ]
1129 public_include_dirs = [ "$skia_vtune_path/include" ]
1130 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1131 }
Mike Klein613ad382019-06-06 11:42:02 -05001132}
1133
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001134if (skia_enable_gpu && skia_generate_workarounds) {
1135 action("workaround_list") {
1136 script = "tools/build_workaround_header.py"
1137
Mike Kleina01c6b02020-04-01 13:47:34 -05001138 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001139
1140 # see comments in skia_compile_processors about out dir path shenanigans.
1141 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001142 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001143
Mike Kleina01c6b02020-04-01 13:47:34 -05001144 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001145 args = [
1146 "--output-file",
1147 "$output_file",
1148 ]
1149
1150 foreach(file, inputs) {
1151 args += [ rebase_path(file, root_build_dir) ]
1152 }
1153 }
1154}
1155
mtkleinc04ff472016-06-23 10:29:30 -07001156component("skia") {
1157 public_configs = [ ":skia_public" ]
1158 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001159
Mike Klein607b0a72018-11-07 16:17:34 -05001160 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001161 ":fontmgr_FontConfigInterface",
1162 ":fontmgr_android",
1163 ":fontmgr_custom_directory",
1164 ":fontmgr_custom_embedded",
1165 ":fontmgr_custom_empty",
1166 ":fontmgr_fontconfig",
1167 ":fontmgr_fuchsia",
1168 ":fontmgr_mac_ct",
1169 ":fontmgr_win",
1170 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001171 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001172 ":pdf",
1173 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001174 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001175 ]
1176
mtkleinc04ff472016-06-23 10:29:30 -07001177 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001178 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001179 ":arm64",
1180 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001181 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001182 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001183 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001184 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001185 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001186 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001187 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001188 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001189 ":jpeg_decode",
1190 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001191 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001192 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001193 ":png_decode",
1194 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001195 ":raw",
Mike Klein853d4ed2020-08-20 00:41:00 +00001196 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -05001197 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001198 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001199 ":sse2",
1200 ":sse41",
1201 ":sse42",
1202 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001203 ":webp_decode",
1204 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001205 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001206 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001207 ]
1208
Hal Canaryc25f4e92019-02-26 11:54:25 -05001209 public = skia_core_public
1210 public += skia_utils_public
1211 public += skia_effects_public
1212 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001213
mtkleinc04ff472016-06-23 10:29:30 -07001214 sources = []
brettwb9447282016-09-01 14:24:39 -07001215 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001216 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001217 sources += skia_effects_sources
1218 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001219 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001220 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001221 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001222 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001223 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001224 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001225 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001226 "src/codec/SkBmpCodec.cpp",
1227 "src/codec/SkBmpMaskCodec.cpp",
1228 "src/codec/SkBmpRLECodec.cpp",
1229 "src/codec/SkBmpStandardCodec.cpp",
1230 "src/codec/SkCodec.cpp",
1231 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001232 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001233 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001234 "src/codec/SkMaskSwizzler.cpp",
1235 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001236 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001237 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001238 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001239 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001240 "src/codec/SkSwizzler.cpp",
1241 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001242 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001243 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001244 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001245 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001246 "src/ports/SkMemory_malloc.cpp",
1247 "src/ports/SkOSFile_stdio.cpp",
1248 "src/sfnt/SkOTTable_name.cpp",
1249 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001250 ]
brettwb9447282016-09-01 14:24:39 -07001251
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001252 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001253 libs = []
1254
mtkleinc04ff472016-06-23 10:29:30 -07001255 if (is_win) {
1256 sources += [
1257 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001258 "src/ports/SkImageEncoder_WIC.cpp",
1259 "src/ports/SkImageGeneratorWIC.cpp",
1260 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001261 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001262 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001263 libs += [
1264 "FontSub.lib",
1265 "Ole32.lib",
1266 "OleAut32.lib",
1267 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001268 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001269 ]
mtkleinc04ff472016-06-23 10:29:30 -07001270 } else {
1271 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001272 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001273 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001274 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001275 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001276 }
1277
mtklein7d6fb2c2016-08-25 14:50:44 -07001278 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001279 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001280 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001281 deps += [ "//third_party/cpu-features" ]
1282 }
mtklein06c35c02016-09-20 12:28:12 -07001283 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001284 libs += [
1285 "EGL",
1286 "GLESv2",
1287 "log",
1288 ]
1289 }
1290
Kevin Lubick217056c2018-09-20 17:39:31 -04001291 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001292 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001293 if (skia_use_egl) {
1294 libs += [ "GLESv2" ]
1295 }
mtkleinc04ff472016-06-23 10:29:30 -07001296 }
1297
1298 if (is_mac) {
1299 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001300 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001301 "src/ports/SkImageEncoder_CG.cpp",
1302 "src/ports/SkImageGeneratorCG.cpp",
1303 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001304 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001305 "ApplicationServices.framework",
1306 "OpenGL.framework",
1307 ]
mtkleinc04ff472016-06-23 10:29:30 -07001308 }
abarth6fc8ff02016-07-15 15:15:15 -07001309
Mike Klein7d302882016-11-03 14:06:31 -04001310 if (is_ios) {
1311 sources += [
1312 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001313 "src/ports/SkImageEncoder_CG.cpp",
1314 "src/ports/SkImageGeneratorCG.cpp",
1315 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001316 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001317 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001318 "ImageIO.framework",
1319 "MobileCoreServices.framework",
1320 ]
1321 }
1322
abarth6fc8ff02016-07-15 15:15:15 -07001323 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001324 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001325 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001326
1327 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -04001328 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001329 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1330 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001331
1332 if (skia_include_multiframe_procs) {
1333 sources += [ "tools/SkSharingProc.cpp" ]
1334 }
mtkleinc04ff472016-06-23 10:29:30 -07001335}
1336
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001337# DebugCanvas used in experimental/wasm-skp-debugger
1338if (target_cpu == "wasm") {
1339 static_library("debugcanvas") {
1340 public_configs = [ ":skia_public" ]
1341
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001342 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001343 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001344 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001345 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001346 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001347 "tools/debugger/DrawCommand.cpp",
1348 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001349 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001350 }
1351}
1352
Kevin Lubickcbcff382018-10-02 09:02:18 -04001353static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001354 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001355 public_configs = [ ":skia_public" ]
1356 configs += skia_library_configs
1357
1358 deps = [
1359 ":arm64",
1360 ":armv7",
1361 ":avx",
1362 ":crc32",
1363 ":hsw",
1364 ":none",
1365 ":sse2",
1366 ":sse41",
1367 ":sse42",
1368 ":ssse3",
1369 ]
1370
Kevin Lubickcbcff382018-10-02 09:02:18 -04001371 sources = []
1372 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001373 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001374 sources += [
1375 "src/core/SkAnalyticEdge.cpp",
1376 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001377 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001378 "src/core/SkCubicMap.cpp",
1379 "src/core/SkEdge.cpp",
1380 "src/core/SkEdgeBuilder.cpp",
1381 "src/core/SkEdgeClipper.cpp",
1382 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001383 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001384 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001385 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001386 "src/core/SkMallocPixelRef.cpp",
1387 "src/core/SkMath.cpp",
1388 "src/core/SkMatrix.cpp",
1389 "src/core/SkOpts.cpp",
1390 "src/core/SkPaint.cpp",
1391 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001392 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001393 "src/core/SkPathEffect.cpp",
1394 "src/core/SkPathMeasure.cpp",
1395 "src/core/SkPathRef.cpp",
1396 "src/core/SkPoint.cpp",
1397 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001398 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001399 "src/core/SkRect.cpp",
1400 "src/core/SkSemaphore.cpp",
1401 "src/core/SkStream.cpp",
1402 "src/core/SkString.cpp",
1403 "src/core/SkStringUtils.cpp",
1404 "src/core/SkStroke.cpp",
1405 "src/core/SkStrokeRec.cpp",
1406 "src/core/SkStrokerPriv.cpp",
1407 "src/core/SkThreadID.cpp",
1408 "src/core/SkUtils.cpp",
1409 "src/effects/SkDashPathEffect.cpp",
1410 "src/effects/SkTrimPathEffect.cpp",
1411 "src/ports/SkDebug_stdio.cpp",
1412 "src/ports/SkMemory_malloc.cpp",
1413 "src/utils/SkDashPath.cpp",
1414 "src/utils/SkParse.cpp",
1415 "src/utils/SkParsePath.cpp",
1416 "src/utils/SkUTF.cpp",
1417 ]
1418}
1419
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001420group("modules") {
1421 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001422 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001423 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001424 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001425 "modules/skshaper",
1426 ]
1427}
1428
Brian Osmancd28fa62020-07-07 16:01:26 -04001429config("our_vulkan_headers") {
1430 include_dirs = [ "include/third_party/vulkan" ]
1431}
1432
mtkleinc095df52016-08-24 12:23:52 -07001433# Targets guarded by skia_enable_tools may use //third_party freely.
1434if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001435 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001436 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001437 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001438 "include/c",
1439 "include/codec",
1440 "include/config",
1441 "include/core",
1442 "include/docs",
1443 "include/effects",
1444 "include/encode",
1445 "include/gpu",
1446 "include/pathops",
1447 "include/ports",
1448 "include/svg",
1449 "include/utils",
1450 "include/utils/mac",
Julia Lavrova70258c72020-07-15 11:28:57 -04001451 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001452 "modules/skshaper/include",
1453 "modules/skottie/include",
1454 ]
1455
Mike Klein308b5ac2016-12-06 16:03:52 -05001456 # Used by gn_to_bp.py to list our public include dirs.
1457 source_set("public") {
1458 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001459 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001460 }
1461
Mike Kleinc36dedf2016-11-18 09:35:28 -05001462 config("skia.h_config") {
1463 include_dirs = [ "$target_gen_dir" ]
1464 }
1465 action("skia.h") {
1466 public_configs = [ ":skia.h_config" ]
1467 skia_h = "$target_gen_dir/skia.h"
1468 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001469
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001470 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1471 [ rebase_path(skia_h, root_build_dir) ] +
1472 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001473 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001474 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001475 }
1476
Brian Osmanc9a42472018-05-31 13:17:12 -04001477 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001478 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001479 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001480 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001481 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001482 "tools/fiddle/draw.cpp",
1483 "tools/fiddle/fiddle_main.cpp",
1484 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001485
1486 if (skia_use_egl) {
1487 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001488 } else {
1489 sources += [ "tools/fiddle/null_context.cpp" ]
1490 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001491 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001492 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001493 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001494 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001495 ":skia",
1496 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001497 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001498 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001499 ]
1500 }
1501 }
1502
Mike Kleine5463e62020-06-11 13:53:53 -05001503 config("cpp14") {
1504 if (is_win) {
1505 cflags_cc = [ "/std:c++14" ]
1506 } else {
1507 cflags_cc = [ "-std=c++14" ]
1508 }
1509 }
1510
Brian Osmanc9a42472018-05-31 13:17:12 -04001511 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001512 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001513 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001514 configs += [
1515 ":our_vulkan_headers",
1516 ":cpp14",
1517 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001518 deps = [
1519 ":skia",
1520 ":skia.h",
1521 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001522 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001523 ]
Stephen White0d70b712019-07-10 15:51:30 -04001524
1525 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001526 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001527 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001528 }
1529
mtkleinc095df52016-08-24 12:23:52 -07001530 template("test_lib") {
1531 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001532 if (defined(invoker.public_defines)) {
1533 defines = invoker.public_defines
1534 }
mtklein25c81d42016-07-27 13:55:26 -07001535 }
mtkleinc095df52016-08-24 12:23:52 -07001536 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001537 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001538 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001539 public_configs = [
1540 ":" + target_name + "_config",
1541 ":skia_private",
1542 ]
1543
1544 if (!defined(deps)) {
1545 deps = []
1546 }
1547 deps += [ ":skia" ]
1548 testonly = true
1549 }
mtklein25c81d42016-07-27 13:55:26 -07001550 }
mtklein25c81d42016-07-27 13:55:26 -07001551
Mike Kleine6682eb2017-01-05 10:54:57 -05001552 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001553 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001554 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001555 forward_variables_from(invoker,
1556 "*",
1557 [
1558 "output_name",
1559 "visibility",
1560 "is_shared_library",
1561 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001562 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001563 extra_configs = [ ":skia_private" ]
1564 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1565 data_sources = [ "resources" ]
1566 if ("True" == exec_script("//gn/checkdir.py",
1567 [ rebase_path("skps", root_build_dir) ],
1568 "trim string")) {
1569 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001570 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001571 }
1572 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001573 # !is_ios
1574
Jim Van Verth92411c72020-04-03 15:18:31 -04001575 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001576 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1577 shared_library("lib" + target_name) {
1578 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1579 configs += [ ":skia_private" ]
1580 testonly = true
1581 }
1582 } else {
1583 _executable = target_name
1584 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001585 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001586 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1587 configs += [ ":skia_private" ]
1588 testonly = true
1589 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001590 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001591 if (is_android && skia_android_serial != "" && defined(_executable)) {
1592 action("push_" + target_name) {
1593 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001594 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001595 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001596 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001597 args = [
1598 rebase_path("$root_build_dir/$_executable"),
1599 skia_android_serial,
1600 rebase_path(_stamp),
1601 ]
1602 testonly = true
1603 }
Mike Klein7d921032017-01-05 12:20:41 -05001604 }
1605 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001606 }
1607
mtkleinc095df52016-08-24 12:23:52 -07001608 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001609 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001610
Mike Klein9e25bb92019-04-29 09:46:36 -05001611 # Bots and even devs may not have Vulkan headers, so put
1612 # include/third_party/vulkan on our path so they're always available.
1613 all_dependent_configs = [ ":our_vulkan_headers" ]
1614
Mike Klein333fb452019-04-24 08:48:11 -05001615 defines = []
1616 if (skia_enable_discrete_gpu) {
1617 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1618 }
1619
Brian Osmanc9a42472018-05-31 13:17:12 -04001620 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001621 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001622 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001623 "tools/gpu/BackendSurfaceFactory.cpp",
1624 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001625 "tools/gpu/BackendTextureImageFactory.cpp",
1626 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001627 "tools/gpu/FlushFinishTracker.cpp",
1628 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001629 "tools/gpu/GrContextFactory.cpp",
1630 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001631 "tools/gpu/ManagedBackendTexture.cpp",
1632 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001633 "tools/gpu/MemoryCache.cpp",
1634 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001635 "tools/gpu/ProxyUtils.cpp",
1636 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001637 "tools/gpu/TestOps.cpp",
1638 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001639 "tools/gpu/YUVUtils.cpp",
1640 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001641 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1642 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001643 "tools/gpu/mock/MockTestContext.cpp",
1644 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001645
1646 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001647 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001648
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001649 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001650 sources +=
1651 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001652 if (is_ios) {
1653 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001654 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001655 } else if (is_mac) {
1656 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001657 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001658 if (skia_use_angle) {
1659 deps += [ "//third_party/angle2" ]
1660 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1661 }
Brian Salomon1171d312020-03-19 08:47:44 -04001662 }
1663
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001664 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1665 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001666 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001667 if (is_android || skia_use_egl) {
1668 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1669 libs += [ "EGL" ]
1670 } else if (is_linux) {
1671 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1672 libs += [
1673 "GLU",
1674 "GL",
1675 "X11",
1676 ]
1677 } else if (is_win) {
1678 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1679 libs += [ "Gdi32.lib" ]
1680 if (target_cpu != "arm64") {
1681 libs += [ "OpenGL32.lib" ]
1682 }
1683 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001684 }
Greg Daniel54200e42018-12-11 17:03:39 -05001685
Brian Osmanc9a42472018-05-31 13:17:12 -04001686 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001687 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001688 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001689 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1690 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001691 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001692 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001693 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1694 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001695 }
1696 if (skia_use_metal) {
1697 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001698 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001699 if (skia_use_direct3d) {
1700 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001701 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001702 }
Stephen White985741a2019-07-18 11:43:45 -04001703 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001704 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001705 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001706 if (is_clang) {
1707 cflags_cc = [ "-Wno-microsoft-cast" ]
1708 }
Stephen White985741a2019-07-18 11:43:45 -04001709 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001710
1711 if (is_fuchsia && using_fuchsia_sdk) {
1712 libs +=
1713 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1714 }
Jim Van Verth36b86af2020-08-24 17:16:46 +00001715
1716 cflags_objcc = [ "-fobjc-arc" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07001717 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001718
mtkleinc095df52016-08-24 12:23:52 -07001719 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001720 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001721 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001722
1723 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001724 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1725 deps = [ ":flags" ]
1726 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001727 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001728 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001729 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1730 deps = [ ":flags" ]
1731 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001732 }
1733 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001734 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1735 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001736 }
1737 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001738 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1739 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001740 }
mtklein25c81d42016-07-27 13:55:26 -07001741
Mike Klein499f0ac2019-03-25 13:00:12 -05001742 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001743 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001744 sources = [
1745 "tools/trace/ChromeTracingTracer.cpp",
1746 "tools/trace/ChromeTracingTracer.h",
1747 "tools/trace/EventTracingPriv.cpp",
1748 "tools/trace/EventTracingPriv.h",
1749 "tools/trace/SkDebugfTracer.cpp",
1750 "tools/trace/SkDebugfTracer.h",
1751 ]
1752 }
1753
mtkleinc095df52016-08-24 12:23:52 -07001754 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001755 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001756 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001757 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001758 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001759 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001760 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001761 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001762 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001763 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001764 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001765 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001766 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001767 "tools/SkMetaData.cpp",
1768 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001769 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001770 "tools/SkSharingProc.h",
1771 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001772 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001773 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001774 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001775 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001776 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001777 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001778 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001779 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001780 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001781 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001782 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001783 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001784 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001785 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001786 "tools/fonts/TestEmptyTypeface.h",
1787 "tools/fonts/TestFontMgr.cpp",
1788 "tools/fonts/TestFontMgr.h",
1789 "tools/fonts/TestSVGTypeface.cpp",
1790 "tools/fonts/TestSVGTypeface.h",
1791 "tools/fonts/TestTypeface.cpp",
1792 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001793 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001794 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001795 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001796 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001797 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001798 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001799 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001800 if (target_cpu != "wasm") {
1801 sources += [ "tools/CrashHandler.cpp" ]
1802 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001803 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001804 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001805 if (is_ios) {
1806 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001807 sources += [ "tools/ios_utils.h" ]
1808 if (skia_use_metal) {
1809 sources += [ "tools/AutoreleasePool.mm" ]
1810 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001811 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001812 } else if (is_mac) {
1813 if (skia_use_metal) {
1814 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001815 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001816 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001817 } else if (is_win) {
1818 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001819 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001820
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001821 defines = []
1822 if (skia_tools_require_resources) {
1823 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1824 }
mtkleinc095df52016-08-24 12:23:52 -07001825 deps = [
1826 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001827 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001828 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001829 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001830 }
mtklein25c81d42016-07-27 13:55:26 -07001831
Mike Kleine11e5c12019-04-24 12:46:06 -05001832 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001833 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001834 }
1835
Mike Klein6e744122016-10-27 12:21:40 -04001836 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001837 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001838 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001839 if (skia_use_gl) {
1840 sources += gl_gm_sources
1841 }
mtkleinc095df52016-08-24 12:23:52 -07001842 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001843 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001844 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001845 ":skia",
1846 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001847 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001848 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001849 "modules/skparagraph",
1850 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001851 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001852 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001853 if (is_skia_dev_build) {
1854 sources += [ "gm/fiddle.cpp" ]
1855 deps += [ ":skia.h" ]
1856 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001857 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001858
1859 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001860 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001861 sources += [ "gm/video_decoder.cpp" ]
1862 }
mtkleinc095df52016-08-24 12:23:52 -07001863 }
mtklein25c81d42016-07-27 13:55:26 -07001864
Mike Klein7b7077c2019-06-03 17:10:59 -05001865 test_lib("skvm_builders") {
1866 sources = [
1867 "tools/SkVMBuilders.cpp",
1868 "tools/SkVMBuilders.h",
1869 ]
1870 }
1871
Mike Klein6e744122016-10-27 12:21:40 -04001872 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001873 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001874 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001875 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001876 if (skia_use_metal) {
1877 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001878 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001879 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001880 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001881 if (skia_use_gl) {
1882 sources += gl_tests_sources
1883 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001884 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001885 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001886 }
Ben Wagner75626e42020-06-03 13:20:37 -04001887 if (!skia_enable_fontmgr_fontconfig) {
Ben Wagner37a06c02018-06-22 21:11:00 +00001888 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1889 }
mtkleinc095df52016-08-24 12:23:52 -07001890 deps = [
1891 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001892 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001893 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001894 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001895 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001896 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001897 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001898 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001899 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001900 "modules/svg",
mtkleinc095df52016-08-24 12:23:52 -07001901 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001902 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001903 "//third_party/zlib",
1904 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001905 public_deps = [
1906 ":gpu_tool_utils", # Test.h #includes headers from this target.
1907 ]
mtkleinc095df52016-08-24 12:23:52 -07001908 }
mtklein2f3416d2016-08-02 16:02:05 -07001909
Mike Klein6e744122016-10-27 12:21:40 -04001910 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001911 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001912 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001913 deps = [
1914 ":flags",
1915 ":gm",
1916 ":gpu_tool_utils",
1917 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001918 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001919 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001920 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001921 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001922 ]
1923 }
mtklein2b6870c2016-07-28 14:17:33 -07001924
Mike Reedd62d4062019-06-12 10:20:44 -04001925 test_lib("experimental_xform") {
1926 sources = [
1927 "experimental/xform/SkShape.cpp",
1928 "experimental/xform/SkXform.cpp",
1929 "experimental/xform/XContext.cpp",
1930 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001931 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04001932 }
1933
Florin Malitabfe876a2018-09-02 12:33:59 -04001934 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001935 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001936 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04001937 }
Florin Malitab3418102020-10-15 18:10:29 -04001938 test_app("svg_tool") {
1939 deps = [ "modules/svg:tool" ]
1940 }
Florin Malita79725d32018-06-05 16:16:57 -04001941 }
1942
Hal Canary5b39dc82019-04-17 13:29:46 -04001943 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001944 sources = [ "tools/skqp/make_skqp_model.cpp" ]
1945 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04001946 }
1947
Chris Dalton2b598902020-03-25 10:50:35 -06001948 import("gn/samples.gni")
1949 test_lib("samples") {
1950 sources = samples_sources
1951 if (skia_enable_ccpr) {
1952 sources += samples_sources_ccpr
Kevin Lubickebf648e2017-09-21 13:45:16 -04001953 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001954 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06001955 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06001956 ":flags",
1957 ":gpu_tool_utils",
1958 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04001959 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06001960 "modules/skparagraph:samples",
1961 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001962 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04001963 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06001964 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001965 }
Kevin Lubick00398742020-10-08 10:05:07 -04001966 test_lib("hash_and_encode") {
1967 sources = [
1968 "tools/HashAndEncode.cpp",
1969 "tools/HashAndEncode.h",
1970 ]
1971 deps = [
1972 ":flags",
1973 ":skia",
1974 "//third_party/libpng",
1975 ]
1976 }
Chris Dalton2b598902020-03-25 10:50:35 -06001977 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10001978 test_app("convert-to-nia") {
1979 sources = [ "tools/convert-to-nia.cpp" ]
1980 deps = [ ":skia" ]
1981 }
Mike Klein7af351a2018-07-27 09:54:43 -04001982 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001983 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04001984 deps = [
1985 ":skcms",
1986 ":skia",
1987 ]
1988 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001989 test_app("fm") {
1990 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06001991 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05001992 "tools/fm/fm.cpp",
1993 ]
1994 deps = [
1995 ":common_flags_aa",
1996 ":common_flags_gpu",
1997 ":flags",
1998 ":gm",
1999 ":gpu_tool_utils",
2000 ":hash_and_encode",
2001 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002002 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002003 ":tool_utils",
2004 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002005 "modules/skottie",
2006 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002007 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002008 ]
2009 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002010 test_app("dm") {
2011 sources = [
2012 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002013 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002014 "dm/DMJsonWriter.cpp",
2015 "dm/DMSrcSink.cpp",
2016 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002017 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002018 ":common_flags_aa",
2019 ":common_flags_config",
2020 ":common_flags_gpu",
2021 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002022 ":flags",
2023 ":gm",
2024 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002025 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002026 ":skia",
2027 ":tests",
2028 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002029 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002030 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002031 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002032 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002033 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002034 ]
2035 }
Brian Osman16adfa32016-10-18 14:42:44 -04002036 }
2037
Mike Kleina8a51ce2018-01-09 12:34:11 -05002038 if (!is_win) {
2039 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002040 sources = [ "tools/remote_demo.cpp" ]
2041 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002042 }
2043 }
2044
Hal Canarye107faa2019-10-23 12:52:33 -04002045 if (!is_win) {
2046 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002047 sources = [ "tools/blob_cache_sim.cpp" ]
2048 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002049 }
2050 }
2051
Mike Kleine6682eb2017-01-05 10:54:57 -05002052 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002053 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002054 deps = [
2055 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002056 ":common_flags_aa",
2057 ":common_flags_config",
2058 ":common_flags_gpu",
2059 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002060 ":flags",
2061 ":gm",
2062 ":gpu_tool_utils",
2063 ":skia",
2064 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002065 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002066 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002067 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002068 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002069 ]
mtklein2b6870c2016-07-28 14:17:33 -07002070 }
halcanary19a97202016-08-03 15:08:04 -07002071
Ravi Mistry10d36c52017-01-31 09:49:18 -05002072 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002073 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002074 deps = [
2075 ":flags",
2076 ":skia",
2077 ]
2078 }
2079
Mike Reedc0ee21f2019-05-28 16:11:03 -04002080 if (skia_use_ffmpeg) {
2081 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002082 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002083 deps = [
2084 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002085 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002086 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002087 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002088 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002089 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002090 ]
2091 }
2092 }
2093
Brian Osmanc9a42472018-05-31 13:17:12 -04002094 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002095 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002096 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002097 ":common_flags_config",
2098 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002099 ":flags",
2100 ":gpu_tool_utils",
2101 ":skia",
2102 ":tool_utils",
2103 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002104 }
2105
Mike Kleine6682eb2017-01-05 10:54:57 -05002106 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002107 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002108 deps = [
2109 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002110 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002111 ]
halcanary3eee9d92016-09-10 07:01:53 -07002112 }
mtklein046cb562016-09-16 10:23:12 -07002113
Ben Wagner219f3622017-07-17 15:32:25 -04002114 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002115 sources = [ "tools/fonts/create_test_font.cpp" ]
2116 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002117 assert_no_deps = [
2118 # tool_utils requires the output of this app.
2119 ":tool_utils",
2120 ]
2121 }
2122
Florin Malita5d3ff432018-07-31 16:38:43 -04002123 if (skia_use_expat) {
2124 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002125 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002126 deps = [
2127 ":flags",
2128 ":skia",
2129 ":tool_utils",
2130 ]
2131 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002132 }
2133
Mike Kleine6682eb2017-01-05 10:54:57 -05002134 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002135 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002136 deps = [
2137 ":flags",
2138 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002139 ]
mtklein046cb562016-09-16 10:23:12 -07002140 }
mtkleinecbc5262016-09-22 11:51:24 -07002141
Brian Osman6788a542018-12-10 11:56:01 -05002142 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002143 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002144 sources = [
2145 "tools/skiaserve/Request.cpp",
2146 "tools/skiaserve/Response.cpp",
2147 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002148 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2149 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2150 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2151 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2152 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2153 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2154 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2155 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2156 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002157 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2158 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002159 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2160 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2161 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2162 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2163 ]
2164 deps = [
2165 ":flags",
2166 ":gpu_tool_utils",
2167 ":skia",
2168 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002169 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002170 ]
Mike Klein7d302882016-11-03 14:06:31 -04002171 }
mtkleinecbc5262016-09-22 11:51:24 -07002172 }
kjlubick14f984b2016-10-03 11:49:45 -07002173
Mike Kleine6682eb2017-01-05 10:54:57 -05002174 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002175 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002176 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002177 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002178 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002179 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002180 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002181 "fuzz/FuzzCreateDDL.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002182 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002183 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002184 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002185 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002186 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002187 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002188 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002189 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002190 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002191 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002192 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2193 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002194 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002195 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002196 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002197 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002198 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2199 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002200 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002201 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2202 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002203 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002204 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002205 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002206 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002207 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002208 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002209 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002210 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002211 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002212 "tools/debugger/DrawCommand.cpp",
2213 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002214 ]
2215 deps = [
2216 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002217 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002218 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002219 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002220 ]
kjlubick14f984b2016-10-03 11:49:45 -07002221 }
Mike Klein38312422016-10-05 15:41:01 -04002222
Mike Kleine6682eb2017-01-05 10:54:57 -05002223 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002224 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002225 rebase_path("tests/skia_test.cpp"),
2226 rebase_path("tests/Test.cpp"),
2227 ]
caryclark9feb6322016-10-25 08:58:26 -07002228 deps = [
2229 ":flags",
2230 ":gpu_tool_utils",
2231 ":skia",
2232 ":tool_utils",
2233 ]
caryclark9feb6322016-10-25 08:58:26 -07002234 }
2235
Mike Kleine6682eb2017-01-05 10:54:57 -05002236 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002237 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002238 deps = [
2239 ":flags",
2240 ":skia",
2241 ]
Mike Klein38312422016-10-05 15:41:01 -04002242 }
bungemanfe917272016-10-13 17:36:40 -04002243
Mike Kleine6682eb2017-01-05 10:54:57 -05002244 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002245 sources = [
2246 "tools/skdiff/skdiff.cpp",
2247 "tools/skdiff/skdiff_html.cpp",
2248 "tools/skdiff/skdiff_main.cpp",
2249 "tools/skdiff/skdiff_utils.cpp",
2250 ]
2251 deps = [
2252 ":skia",
2253 ":tool_utils",
2254 ]
bungemanfe917272016-10-13 17:36:40 -04002255 }
halcanarya73d76a2016-10-17 13:19:02 -07002256
Mike Kleine6682eb2017-01-05 10:54:57 -05002257 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002258 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002259 deps = [
2260 ":skia",
2261 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002262 ]
halcanarya73d76a2016-10-17 13:19:02 -07002263 }
Brian Osman16adfa32016-10-18 14:42:44 -04002264
Brian Osmanc9a42472018-05-31 13:17:12 -04002265 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002266 source_set("skqp_lib") {
2267 check_includes = false
2268 testonly = true
2269 if (!is_official_build) {
2270 configs -= [ "//gn:warnings" ]
2271 }
2272 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002273 defines =
2274 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002275 sources = [
2276 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002277 "tools/skqp/src/skqp.cpp",
2278 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002279 ]
2280 deps = [
2281 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002282 ":skia",
2283 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002284 ":tool_utils",
2285 ]
2286 }
2287 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002288 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002289 include_dirs = [ "//" ]
2290 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002291 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002292 }
2293 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002294 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002295 deps = [
2296 ":gm",
2297 ":skia",
2298 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002299 ]
2300 }
2301 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002302 if (is_fuchsia) {
2303 # Build a package repository for skqp on Fuchsia.
2304 group("skqp_repo") {
2305 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002306 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002307 }
2308 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002309 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002310 shared_library("libskqp_app") {
2311 configs += [ ":skia_private" ]
2312 if (!is_official_build) {
2313 configs -= [ "//gn:warnings" ]
2314 }
2315 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002316 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002317 deps = [
2318 ":skia",
2319 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002320 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002321 ]
2322 libs = [ "android" ]
2323 }
2324 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002325 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002326 test_app("skottie_android") {
2327 is_shared_library = true
2328
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002329 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002330 libs = []
2331
Stan Iliev93151722018-08-02 11:10:52 -04002332 deps = [
2333 ":skia",
2334 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002335 "modules/sksg:samples",
Jorge Betancourt646d6c52020-08-31 16:07:25 -04002336 "//third_party/oboe",
Stan Iliev93151722018-08-02 11:10:52 -04002337 ]
2338 }
2339 }
Hal Canary75427132017-10-11 16:00:31 -04002340
Hal Canarya9de7602018-01-19 13:08:23 -05002341 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002342 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002343 deps = [
2344 ":gm",
2345 ":skia",
2346 ]
2347 }
2348 test_app("list_gpu_unit_tests") {
2349 sources = [
2350 "dm/DMGpuTestProcs.cpp",
2351 "tools/list_gpu_unit_tests.cpp",
2352 ]
2353 deps = [
2354 ":skia",
2355 ":tests",
2356 ]
2357 }
2358
Brian Osmanc9a42472018-05-31 13:17:12 -04002359 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002360 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002361 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002362 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002363 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002364 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002365 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002366 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002367 "tools/sk_app/CommandSet.h",
2368 "tools/sk_app/DisplayParams.h",
2369 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002370 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002371 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002372 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002373 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002374 ]
2375 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002376 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002377
2378 if (is_android) {
2379 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002380 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002381 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002382 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002383 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002384 "tools/sk_app/android/main_android.cpp",
2385 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002386 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002387 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002388 libs += [ "android" ]
2389 } else if (is_linux) {
2390 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002391 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002392 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002393 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002394 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002395 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002396 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002397 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002398 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002399 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002400 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002401 "X11",
2402 ]
2403 } else if (is_win) {
2404 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002405 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002406 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002407 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002408 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002409 "tools/sk_app/win/main_win.cpp",
2410 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002411 } else if (is_mac) {
2412 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002413 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002414 "tools/sk_app/mac/WindowContextFactory_mac.h",
2415 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002416 "tools/sk_app/mac/Window_mac.mm",
2417 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002418 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002419 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002420 "QuartzCore.framework",
2421 "Cocoa.framework",
2422 "Foundation.framework",
2423 ]
2424 } else if (is_ios) {
2425 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002426 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002427 "tools/sk_app/ios/WindowContextFactory_ios.h",
2428 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002429 "tools/sk_app/ios/Window_ios.mm",
2430 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002431 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002432 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002433 }
2434
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002435 if (skia_use_gl) {
2436 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002437 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002438 if (is_android) {
2439 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2440 } else if (is_linux) {
2441 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2442 } else if (is_win) {
2443 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2444 if (skia_use_angle) {
2445 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2446 }
2447 } else if (is_mac) {
2448 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2449 } else if (is_ios) {
2450 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2451 }
2452 }
2453
Brian Osmanc9a42472018-05-31 13:17:12 -04002454 if (skia_use_vulkan) {
2455 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002456 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002457 if (is_android) {
2458 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2459 } else if (is_linux) {
2460 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2461 libs += [ "X11-xcb" ]
2462 } else if (is_win) {
2463 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2464 }
2465 }
2466
Jim Van Verthbe39f712019-02-08 15:36:14 -05002467 if (skia_use_metal) {
2468 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002469 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002470 if (is_mac) {
2471 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002472 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002473 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002474 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002475 }
2476
Jim Van Verth682a2f42020-05-13 16:54:09 -04002477 if (skia_use_direct3d) {
2478 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2479 }
2480
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002481 if (skia_use_dawn) {
2482 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002483 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002484 if (is_linux) {
2485 if (dawn_enable_vulkan) {
2486 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2487 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2488 libs += [ "X11-xcb" ]
2489 }
2490 } else if (is_win) {
2491 if (dawn_enable_d3d12) {
2492 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2493 }
2494 } else if (is_mac) {
2495 if (dawn_enable_metal) {
2496 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2497 }
2498 }
2499 }
2500
Mike Kleina01c6b02020-04-01 13:47:34 -05002501 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002502 if (is_android) {
2503 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002504 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002505 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002506 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002507 }
Brian Osman16adfa32016-10-18 14:42:44 -04002508 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002509
Hal Canary87515122019-03-15 14:22:51 -04002510 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2511 test_app("fiddle_examples") {
2512 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002513 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002514 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002515 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002516 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002517 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002518 cflags = [
2519 "/wd4756", # Overflow in constant arithmetic
2520 "/wd4305", # truncation from 'double' to 'float'
2521 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002522 }
Hal Canary87515122019-03-15 14:22:51 -04002523 deps = [
2524 ":skia",
2525 ":skia.h",
2526 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002527 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002528 ]
2529 }
2530 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002531
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002532 # sk_app can work without GL but viewer always runs raster through a GL window context.
2533 if (skia_use_gl) {
2534 test_app("viewer") {
2535 is_shared_library = is_android
2536 sources = [
2537 "tools/viewer/AnimTimer.h",
2538 "tools/viewer/BisectSlide.cpp",
2539 "tools/viewer/GMSlide.cpp",
2540 "tools/viewer/ImGuiLayer.cpp",
2541 "tools/viewer/ImageSlide.cpp",
2542 "tools/viewer/ParticlesSlide.cpp",
2543 "tools/viewer/SKPSlide.cpp",
2544 "tools/viewer/SampleSlide.cpp",
Florin Malita45cd2002020-06-09 14:00:54 -04002545 "tools/viewer/SkRiveSlide.cpp",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002546 "tools/viewer/SkSLSlide.cpp",
2547 "tools/viewer/SkottieSlide.cpp",
2548 "tools/viewer/SlideDir.cpp",
2549 "tools/viewer/StatsLayer.cpp",
2550 "tools/viewer/SvgSlide.cpp",
2551 "tools/viewer/TouchGesture.cpp",
2552 "tools/viewer/TouchGesture.h",
2553 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002554 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002555 ]
2556 libs = []
2557
2558 deps = [
2559 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002560 ":flags",
2561 ":gm",
2562 ":gpu_tool_utils",
2563 ":samples",
2564 ":sk_app",
2565 ":skia",
2566 ":tool_utils",
2567 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002568 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002569 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002570 "modules/particles",
2571 "modules/skottie",
2572 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002573 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002574 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002575 "//third_party/imgui",
2576 ]
2577 if (skia_use_experimental_xform) {
2578 deps += [ ":experimental_xform" ]
2579 sources += [ "gm/xform.cpp" ]
2580 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002581 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002582 deps += [
2583 "//third_party/spirv-tools:spvtools",
2584
2585 #spvtools depends on this but doesn't deps it in. Looks like upstream bug
2586 #that we replicated in our third_party/spirv-tools/BUILD.gn
2587 "//third_party/spirv-tools:spvtools_val",
2588 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002589 }
Mike Reedd62d4062019-06-12 10:20:44 -04002590 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002591 }
2592
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002593 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002594 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002595 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002596 libs = []
2597
Brian Osmaneff04b52017-11-21 13:18:02 -05002598 deps = [
2599 ":flags",
2600 ":gpu_tool_utils",
2601 ":sk_app",
2602 ":skia",
2603 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002604 ]
2605 }
2606 }
2607
Mike Klein9f6468f2020-05-19 13:14:40 -05002608 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002609 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002610 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002611 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002612 deps = [
2613 ":gpu_tool_utils",
2614 ":skia",
2615 "//third_party/libsdl",
2616 ]
2617 }
2618 }
2619
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002620 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2621 action_foreach("generate_mocs") {
2622 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002623 sources = [ "tools/mdbviz/MainWindow.h" ]
2624 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002625 args = [
2626 "$skia_qt_path" + "/bin/moc",
2627 "{{source}}",
2628 "-o",
2629 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2630 ]
2631 }
2632 action_foreach("generate_resources") {
2633 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002634 sources = [ "tools/mdbviz/resources.qrc" ]
2635 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002636 args = [
2637 "$skia_qt_path" + "/bin/rcc",
2638 "{{source}}",
2639 "-o",
2640 "gen/mdbviz/{{source_name_part}}_res.cpp",
2641 ]
2642 }
2643 test_app("mdbviz") {
2644 if (is_win) {
2645 # on Windows we need to disable some exception handling warnings due to the Qt headers
2646 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2647 }
2648 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002649 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002650 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002651 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002652 "tools/debugger/DrawCommand.cpp",
2653 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002654 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002655 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002656 "tools/mdbviz/main.cpp",
2657
2658 # generated files
2659 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2660 "$target_gen_dir/mdbviz/resources_res.cpp",
2661 ]
2662 lib_dirs = [ "$skia_qt_path/lib" ]
2663 libs = [
2664 "Qt5Core.lib",
2665 "Qt5Gui.lib",
2666 "Qt5Widgets.lib",
2667 ]
2668 include_dirs = [
2669 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002670 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002671 "$skia_qt_path/include/QtWidgets",
2672 ]
2673 deps = [
2674 ":generate_mocs",
2675 ":generate_resources",
2676 ":skia",
2677 ]
2678 }
2679 }
2680
Mike Kleine459afd2017-03-03 09:21:30 -05002681 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002682 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002683 sources = [ "$ndk/$ndk_gdbserver" ]
2684 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002685 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002686 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002687
2688 if (skia_use_opencl) {
2689 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002690 sources = [ "tools/hello-opencl.cpp" ]
2691 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002692 }
2693 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002694
Brian Osmanf564f152019-07-23 15:14:30 -04002695 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002696 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002697 deps = [
2698 ":skia",
2699 "modules/particles",
2700 ]
2701 }
2702
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002703 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002704 test_app("editor") {
2705 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002706 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002707 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002708 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002709
2710 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002711 sources = [ "tools/image_diff_metric.cpp" ]
2712 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002713 }
Chris Dalton2b598902020-03-25 10:50:35 -06002714
2715 group("modules_testonly") {
2716 testonly = true
2717 deps = []
2718 if (target_cpu == "wasm") {
2719 deps += [ "modules/canvaskit:viewer_wasm" ]
2720 }
2721 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002722
2723 if (skia_build_fuzzers) {
2724 template("libfuzzer_app") {
2725 output_dir = root_build_dir
2726 executable(target_name) {
2727 check_includes = false
2728 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2729 configs += [ ":skia_private" ]
2730 sources += [
2731 "fuzz/Fuzz.cpp",
2732 "fuzz/FuzzCommon.cpp",
2733 ]
2734 deps += [
2735 ":flags",
2736 ":gpu_tool_utils",
2737 ":skia",
2738 ]
2739 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2740 if (skia_use_libfuzzer_defaults) {
2741 cflags = [ "-fsanitize=fuzzer" ]
2742 ldflags = [ "-fsanitize=fuzzer" ]
2743 }
2744 testonly = true
2745 }
2746 }
2747
2748 libfuzzer_app("region_deserialize") {
2749 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2750 deps = []
2751 }
2752
2753 libfuzzer_app("image_filter_deserialize") {
2754 include_dirs = [
2755 "tools",
2756 "tools/fonts",
2757 ]
2758 sources = [
2759 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2760 "tools/Resources.cpp",
2761 "tools/fonts/TestFontMgr.cpp",
2762 "tools/fonts/TestSVGTypeface.cpp",
2763 "tools/fonts/TestTypeface.cpp",
2764 ]
Florin Malitab3418102020-10-15 18:10:29 -04002765 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002766 }
2767
2768 libfuzzer_app("region_set_path") {
2769 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2770 deps = []
2771 }
2772
2773 libfuzzer_app("textblob_deserialize") {
2774 include_dirs = [
2775 "tools",
2776 "tools/fonts",
2777 ]
2778 sources = [
2779 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2780 "tools/Resources.cpp",
2781 "tools/fonts/TestFontMgr.cpp",
2782 "tools/fonts/TestSVGTypeface.cpp",
2783 "tools/fonts/TestTypeface.cpp",
2784 ]
Florin Malitab3418102020-10-15 18:10:29 -04002785 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002786 }
2787
2788 libfuzzer_app("path_deserialize") {
2789 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2790 deps = []
2791 }
2792
2793 libfuzzer_app("image_decode") {
2794 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2795 deps = []
2796 }
2797
2798 libfuzzer_app("animated_image_decode") {
2799 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2800 deps = []
2801 }
2802
2803 libfuzzer_app("api_create_ddl") {
2804 include_dirs = [
2805 "include",
2806 "include/gpu",
2807 ]
2808 sources = [
2809 "fuzz/FuzzCreateDDL.cpp",
2810 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2811 "tools/Resources.cpp",
2812 "tools/UrlDataManager.cpp",
2813 "tools/debugger/DebugCanvas.cpp",
2814 "tools/debugger/DebugLayerManager.cpp",
2815 "tools/debugger/DrawCommand.cpp",
2816 "tools/debugger/JsonWriteBuffer.cpp",
2817 "tools/fonts/TestFontMgr.cpp",
2818 "tools/fonts/TestSVGTypeface.cpp",
2819 "tools/fonts/TestTypeface.cpp",
2820 ]
2821 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002822 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002823 "//third_party/libpng",
2824 ]
2825 }
2826
2827 libfuzzer_app("api_draw_functions") {
2828 sources = [
2829 "fuzz/FuzzDrawFunctions.cpp",
2830 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2831 ]
2832 deps = []
2833 }
2834
2835 libfuzzer_app("api_gradients") {
2836 sources = [
2837 "fuzz/FuzzGradients.cpp",
2838 "fuzz/oss_fuzz/FuzzGradients.cpp",
2839 ]
2840 deps = []
2841 }
2842
2843 libfuzzer_app("api_image_filter") {
2844 include_dirs = [
2845 "tools",
2846 "tools/debugger",
2847 ]
2848 sources = [
2849 "fuzz/FuzzCanvas.cpp",
2850 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2851 "tools/UrlDataManager.cpp",
2852 "tools/debugger/DebugCanvas.cpp",
2853 "tools/debugger/DebugLayerManager.cpp",
2854 "tools/debugger/DrawCommand.cpp",
2855 "tools/debugger/JsonWriteBuffer.cpp",
2856 ]
2857 deps = [ "//third_party/libpng" ]
2858 }
2859
2860 libfuzzer_app("api_path_measure") {
2861 sources = [
2862 "fuzz/FuzzPathMeasure.cpp",
2863 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2864 ]
2865 deps = []
2866 }
2867
2868 libfuzzer_app("api_pathop") {
2869 sources = [
2870 "fuzz/FuzzPathop.cpp",
2871 "fuzz/oss_fuzz/FuzzPathop.cpp",
2872 ]
2873 deps = []
2874 }
2875
2876 libfuzzer_app("api_raster_n32_canvas") {
2877 include_dirs = [
2878 "tools",
2879 "tools/debugger",
2880 "tools/fonts",
2881 ]
2882 sources = [
2883 "fuzz/FuzzCanvas.cpp",
2884 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
2885 "tools/Resources.cpp",
2886 "tools/UrlDataManager.cpp",
2887 "tools/debugger/DebugCanvas.cpp",
2888 "tools/debugger/DebugLayerManager.cpp",
2889 "tools/debugger/DrawCommand.cpp",
2890 "tools/debugger/JsonWriteBuffer.cpp",
2891 "tools/fonts/TestFontMgr.cpp",
2892 "tools/fonts/TestSVGTypeface.cpp",
2893 "tools/fonts/TestTypeface.cpp",
2894 ]
2895 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002896 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002897 "//third_party/libpng",
2898 ]
2899 }
2900
2901 if (skia_use_gl) {
2902 libfuzzer_app("api_mock_gpu_canvas") {
2903 include_dirs = [
2904 "tools",
2905 "tools/debugger",
2906 "tools/fonts",
2907 ]
2908 sources = [
2909 "fuzz/FuzzCanvas.cpp",
2910 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
2911 "tools/LsanSuppressions.cpp",
2912 "tools/Resources.cpp",
2913 "tools/UrlDataManager.cpp",
2914 "tools/debugger/DebugCanvas.cpp",
2915 "tools/debugger/DebugLayerManager.cpp",
2916 "tools/debugger/DrawCommand.cpp",
2917 "tools/debugger/JsonWriteBuffer.cpp",
2918 "tools/fonts/TestFontMgr.cpp",
2919 "tools/fonts/TestSVGTypeface.cpp",
2920 "tools/fonts/TestTypeface.cpp",
2921 ]
2922 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002923 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002924 "//third_party/libpng",
2925 ]
2926 }
2927 }
2928
2929 libfuzzer_app("api_null_canvas") {
2930 include_dirs = [
2931 "tools",
2932 "tools/debugger",
2933 "tools/fonts",
2934 ]
2935 sources = [
2936 "fuzz/FuzzCanvas.cpp",
2937 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
2938 "tools/Resources.cpp",
2939 "tools/UrlDataManager.cpp",
2940 "tools/debugger/DebugCanvas.cpp",
2941 "tools/debugger/DebugLayerManager.cpp",
2942 "tools/debugger/DrawCommand.cpp",
2943 "tools/debugger/JsonWriteBuffer.cpp",
2944 "tools/fonts/TestFontMgr.cpp",
2945 "tools/fonts/TestSVGTypeface.cpp",
2946 "tools/fonts/TestTypeface.cpp",
2947 ]
2948 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002949 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002950 "//third_party/libpng",
2951 ]
2952 }
2953
2954 libfuzzer_app("api_svg_canvas") {
2955 include_dirs = [
2956 "include",
2957 "include/svg",
2958 ]
2959 sources = [
2960 "fuzz/FuzzCanvas.cpp",
2961 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
2962 "tools/Resources.cpp",
2963 "tools/UrlDataManager.cpp",
2964 "tools/debugger/DebugCanvas.cpp",
2965 "tools/debugger/DebugLayerManager.cpp",
2966 "tools/debugger/DrawCommand.cpp",
2967 "tools/debugger/JsonWriteBuffer.cpp",
2968 "tools/fonts/TestFontMgr.cpp",
2969 "tools/fonts/TestSVGTypeface.cpp",
2970 "tools/fonts/TestTypeface.cpp",
2971 ]
2972 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002973 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002974 "//third_party/libpng",
2975 ]
2976 }
2977
2978 libfuzzer_app("png_encoder") {
2979 sources = [
2980 "fuzz/FuzzEncoders.cpp",
2981 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
2982 ]
2983 deps = []
2984 }
2985
2986 libfuzzer_app("jpeg_encoder") {
2987 sources = [
2988 "fuzz/FuzzEncoders.cpp",
2989 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
2990 ]
2991 deps = []
2992 }
2993
2994 libfuzzer_app("webp_encoder") {
2995 sources = [
2996 "fuzz/FuzzEncoders.cpp",
2997 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
2998 ]
2999 deps = []
3000 }
3001
3002 libfuzzer_app("skottie_json") {
3003 sources = [
3004 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3005 "tools/Resources.cpp",
3006 "tools/fonts/TestFontMgr.cpp",
3007 "tools/fonts/TestSVGTypeface.cpp",
3008 "tools/fonts/TestTypeface.cpp",
3009 ]
3010 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003011 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003012 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003013 ]
3014 }
3015
3016 libfuzzer_app("skjson") {
3017 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3018 deps = []
3019 }
3020
3021 libfuzzer_app("api_polyutils") {
3022 sources = [
3023 "fuzz/FuzzPolyUtils.cpp",
3024 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3025 ]
3026 deps = [ ":skia" ]
3027 }
3028
3029 libfuzzer_app("android_codec") {
3030 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3031 deps = []
3032 }
3033
3034 libfuzzer_app("image_decode_incremental") {
3035 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3036 deps = []
3037 }
3038
3039 libfuzzer_app("sksl2glsl") {
3040 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3041 deps = []
3042 }
3043
3044 libfuzzer_app("sksl2spirv") {
3045 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3046 deps = []
3047 }
3048
3049 libfuzzer_app("sksl2metal") {
3050 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3051 deps = []
3052 }
3053
3054 libfuzzer_app("sksl2pipeline") {
3055 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3056 deps = []
3057 }
3058
3059 libfuzzer_app("skdescriptor_deserialize") {
3060 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3061 deps = []
3062 }
3063
3064 libfuzzer_app("svg_dom") {
3065 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003066 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003067 }
3068
3069 libfuzzer_app("skruntimeeffect") {
3070 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3071 deps = []
3072 }
3073
3074 libfuzzer_app("skp") {
3075 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3076 deps = []
3077 }
3078 }
mtklein25c81d42016-07-27 13:55:26 -07003079}
Hal Canary932a2c02019-09-17 10:43:18 -04003080
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003081if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003082 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003083 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003084 }
Hal Canary27483062019-12-06 15:01:08 -05003085}
3086
Hal Canary60ff6512020-01-21 12:39:20 -05003087if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003088 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003089 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003090 }
3091}