blob: 443859f7e6d08e32a1112610efa35cff952d30d5 [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") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500561 defines = [
562 "SKSL_STANDALONE",
563 "SK_ENABLE_SPIRV_VALIDATION",
564 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400565 sources = [
566 "src/core/SkMalloc.cpp",
567 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400568 "src/core/SkSemaphore.cpp",
569 "src/core/SkThreadID.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400570 "src/gpu/GrBlockAllocator.cpp",
571 "src/gpu/GrMemoryPool.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400572 "src/ports/SkMemory_malloc.cpp",
573 "src/sksl/SkSLMain.cpp",
574 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400576 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500577 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400578 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500579 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400580 "//third_party/spirv-tools:spvtools",
John Stilesdda1d312020-11-20 16:28:50 -0500581 "//third_party/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400582 ]
583 }
584
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400585 skslc_path = "$root_out_dir/"
586 if (host_toolchain != default_toolchain_name) {
587 skslc_path += "$host_toolchain/"
588 }
589 skslc_path += "skslc"
590 if (host_os == "win") {
591 skslc_path += ".exe"
592 }
593
Brian Osmandd496172020-08-08 08:17:18 -0400594 action("create_sksl_fp") {
595 script = "gn/create_sksl_fp.py"
596 sources = [
597 "include/private/GrSharedEnums.h",
598 "src/sksl/sksl_fp_raw.sksl",
599 ]
600 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
601 args = [
602 rebase_path(sources[0]),
603 rebase_path(sources[1]),
604 rebase_path(outputs[0]),
605 ]
606 }
607
608 copy("sksl_pre_includes") {
609 sources = [
610 "src/sksl/sksl_frag.sksl",
611 "src/sksl/sksl_geom.sksl",
612 "src/sksl/sksl_gpu.sksl",
613 "src/sksl/sksl_interp.sksl",
614 "src/sksl/sksl_pipeline.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500615 "src/sksl/sksl_public.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400616 "src/sksl/sksl_vert.sksl",
617 ]
618 outputs = [ "$root_out_dir/{{source_file_part}}" ]
619 }
620
621 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
622 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
623
624 dehydrate_sksl_outputs = []
625 foreach(src, dehydrate_sksl_sources) {
626 name = get_path_info(src, "name")
627
628 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
629 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
630 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
631 "src/sksl/generated/$name.dehydrated.sksl",
632 target_out_dir) ]
633 }
634
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400635 action("dehydrate_sksl") {
636 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400637 deps = [
638 ":create_sksl_fp",
639 ":sksl_pre_includes",
640 ":skslc(//gn/toolchain:$host_toolchain)",
641 ]
642 sources = dehydrate_sksl_sources
643 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000644 args = [
645 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400646 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000647 ]
Brian Osmandd496172020-08-08 08:17:18 -0400648 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400649 }
John Stilesd836f842020-09-14 10:21:44 -0400650} else {
651 group("dehydrate_sksl") {
652 }
653}
654
655skia_gpu_processor_outputs = []
656if (skia_compile_processors) {
657 foreach(src, skia_gpu_processor_sources) {
658 dir = get_path_info(src, "dir")
659 name = get_path_info(src, "name")
660
661 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
662 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
663 skia_gpu_processor_outputs += [
664 "$target_out_dir/" +
665 rebase_path("$dir/generated/$name.h", target_out_dir),
666 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
667 # confused due to the same file being named by two different paths
668 ]
669 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400670
Ethan Nicholas762466e2017-06-29 10:03:38 -0400671 action("compile_processors") {
672 script = "gn/compile_processors.py"
673 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400674 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400675 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400676 ":skslc(//gn/toolchain:$host_toolchain)",
677 ]
678 sources = skia_gpu_processor_sources
679 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400680 args = [
681 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400682 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400683 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400684 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400685 args += rebase_path(skia_gpu_processor_sources)
686 }
687} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400688 group("compile_processors") {
689 }
John Stilesd836f842020-09-14 10:21:44 -0400690}
691
692if (skia_compile_sksl_tests) {
693 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400694
John Stiles7e248712020-09-24 16:42:09 -0400695 template("compile_sksl") {
696 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
697 action("compile_sksl_${target_name}") {
698 script = "gn/compile_sksl_tests.py"
699 deps = [
700 ":create_sksl_fp",
701 ":sksl_pre_includes",
702 ":skslc(//gn/toolchain:$host_toolchain)",
703 ]
704 sources = invoker.sources
705 outputs = []
706 foreach(src, sources) {
707 dir = get_path_info(src, "dir")
708 name = get_path_info(src, "name")
709 foreach(outputPattern, invoker.outputPatterns) {
710 outputs += [ target_out_dir + "/" + rebase_path(
711 dir + outputPattern[0] + name + outputPattern[1],
712 target_out_dir) ]
713 }
714 }
715 args = [
716 rebase_path(skslc_path),
717 invoker.lang,
718 invoker.settings,
719 ]
720 args += rebase_path(sources)
721 }
John Stilesd836f842020-09-14 10:21:44 -0400722 }
John Stiles7e248712020-09-24 16:42:09 -0400723 compile_sksl("fp_tests") {
724 sources = sksl_fp_tests_sources
725 outputPatterns = [
726 [
727 "/golden/",
728 ".cpp",
729 ],
730 [
731 "/golden/",
732 ".h",
733 ],
734 ]
735 lang = "--fp"
736 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400737 }
John Stiles7e248712020-09-24 16:42:09 -0400738 compile_sksl("glsl_tests") {
739 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
740 outputPatterns = [ [
741 "/golden/",
742 ".glsl",
743 ] ]
744 lang = "--glsl"
745 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400746 }
John Stiles7e248712020-09-24 16:42:09 -0400747 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400748 sources = sksl_glsl_settings_tests_sources
John Stiles7e248712020-09-24 16:42:09 -0400749 outputPatterns = [ [
750 "/golden/",
751 "StandaloneSettings.glsl",
752 ] ]
753 lang = "--glsl"
754 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400755 }
John Stilesaeae3a52020-09-25 13:35:58 -0400756 compile_sksl("metal_tests") {
757 sources = sksl_metal_tests_sources
758 outputPatterns = [ [
759 "/golden/",
760 ".metal",
761 ] ]
762 lang = "--metal"
763 settings = "--settings"
764 }
John Stilesdda1d312020-11-20 16:28:50 -0500765 compile_sksl("spirv_tests") {
766 sources = sksl_spirv_tests_sources
767 outputPatterns = [ [
768 "/golden/",
769 ".spirv",
770 ] ]
771 lang = "--spirv"
772 settings = "--settings"
773 }
John Stilesd836f842020-09-14 10:21:44 -0400774} else {
John Stiles7e248712020-09-24 16:42:09 -0400775 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400776 }
John Stiles7e248712020-09-24 16:42:09 -0400777 group("compile_sksl_glsl_tests") {
778 }
779 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400780 }
John Stilesaeae3a52020-09-25 13:35:58 -0400781 group("compile_sksl_metal_tests") {
782 }
John Stilesdda1d312020-11-20 16:28:50 -0500783 group("compile_sksl_spirv_tests") {
784 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400785}
786
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500787optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700788 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400789 deps = [
790 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400791 ":compile_sksl_fp_tests",
792 ":compile_sksl_glsl_nosettings_tests",
793 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400794 ":compile_sksl_metal_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500795 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400796 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700797 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400798 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700799 if (skia_generate_workarounds) {
800 deps += [ ":workaround_list" ]
801 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800802 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600803 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400804 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700805
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400806 sources =
807 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400808 if (!skia_enable_ccpr) {
809 sources -= skia_ccpr_sources
810 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
811 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400812 if (!skia_enable_nvpr) {
813 sources -= skia_nvpr_sources
814 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
815 }
mtklein06c35c02016-09-20 12:28:12 -0700816
Mike Klein703cf5a2016-10-13 17:18:04 -0400817 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400818 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700819
John Rosascoa9b348f2019-11-08 13:18:15 -0800820 if (skia_use_gl) {
821 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400822 if (is_android) {
823 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
824
825 # this lib is required to link against AHardwareBuffer
826 if (defined(ndk_api) && ndk_api >= 26) {
827 libs += [ "android" ]
828 }
829 } else if (skia_use_egl) {
830 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
831 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400832 } else if (skia_use_webgl) {
833 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400834 } else if (is_linux && skia_use_x11) {
835 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
836 libs += [ "GL" ]
837 } else if (is_mac) {
838 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
839 } else if (is_ios) {
840 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
841 } else if (is_win) {
842 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
843 if (target_cpu != "arm64") {
844 libs += [ "OpenGL32.lib" ]
845 }
846 } else {
847 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
848 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800849 sources += skia_gl_gpu_sources
850 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400851
mtkleine9fb3d52016-09-20 15:11:46 -0700852 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400853 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000854 if (skia_use_vma) {
855 deps += [ "third_party/vulkanmemoryallocator" ]
856 }
mtkleine9fb3d52016-09-20 15:11:46 -0700857 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700858 if (skia_enable_vulkan_debug_layers) {
859 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
860 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800861 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800862 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700863 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
864 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400865 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700866 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800867 }
mtkleine9fb3d52016-09-20 15:11:46 -0700868 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400869
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400870 if (is_android && (skia_use_gl || skia_use_vulkan)) {
871 # this lib is required to link against AHardwareBuffer
872 if (defined(ndk_api) && ndk_api >= 26) {
873 libs += [ "android" ]
874 }
875 }
876
Stephen White0d70b712019-07-10 15:51:30 -0400877 if (skia_use_dawn) {
878 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400879 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700880 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400881 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700882 "//third_party/externals/dawn/src/dawn:dawn_proc",
883 "//third_party/externals/dawn/src/dawn:dawncpp",
884 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400885 ]
886 if (dawn_enable_d3d12) {
887 libs += [
888 "d3d12.lib",
889 "dxgi.lib",
890 "d3dcompiler.lib",
891 ]
892 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400893 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400894 }
895 }
896
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500897 if (skia_use_direct3d) {
898 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400899 deps += [
900 "//third_party/d3d12allocator",
901 "//third_party/spirv-cross:spirv_cross",
902 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500903 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500904 if (skia_enable_direct3d_debug_layer) {
905 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
906 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500907 libs += [
908 "d3d12.lib",
909 "dxgi.lib",
910 "d3dcompiler.lib",
911 ]
912 }
913
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400914 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400915 if (skia_use_metal) {
916 public_defines += [ "SK_METAL" ]
917 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400918 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400919 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000920 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400921 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500922
Kevin Lubickf4def342018-10-04 12:52:50 -0400923 if (is_debug) {
924 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
925 }
mtklein06c35c02016-09-20 12:28:12 -0700926}
927
Leon Scroggins III41169202019-01-29 09:29:57 -0500928optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500929 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500930 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
931 if ("True" ==
932 exec_script("gn/checkpath.py",
933 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
934 "trim string")) {
935 public_defines = [ "SK_USE_LIBGIFCODEC" ]
936 public_include_dirs = [
937 ".",
938 skia_libgifcodec_path,
939 ]
940 include_dirs = public_include_dirs
941 import(_libgifcodec_gni_path)
942 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
943 ".",
944 skia_libgifcodec_path)
945 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500946}
947
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400948optional("heif") {
949 enabled = skia_use_libheif
950 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
951
952 deps = []
953
Mike Kleina01c6b02020-04-01 13:47:34 -0500954 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400955}
956
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400957optional("jpeg_decode") {
958 enabled = skia_use_libjpeg_turbo_decode
959 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
960
Mike Kleina01c6b02020-04-01 13:47:34 -0500961 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400962 sources = [
963 "src/codec/SkJpegCodec.cpp",
964 "src/codec/SkJpegDecoderMgr.cpp",
965 "src/codec/SkJpegUtility.cpp",
966 ]
967}
968
969optional("jpeg_encode") {
970 enabled = skia_use_libjpeg_turbo_encode
971 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -0700972
Mike Kleina01c6b02020-04-01 13:47:34 -0500973 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
974 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -0700975 sources = [
mtklein63213812016-08-24 09:55:56 -0700976 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400977 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700978 ]
979}
980
Leon Scroggins III326b9892020-08-05 16:51:10 -0400981optional("ndk_images") {
982 enabled = skia_use_ndk_images
983 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
984 sources = [
985 "src/ports/SkImageEncoder_NDK.cpp",
986 "src/ports/SkImageGeneratorNDK.cpp",
987 "src/ports/SkNDKConversions.cpp",
988 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400989 libs = [ "jnigraphics" ]
990}
991
mtklein63213812016-08-24 09:55:56 -0700992optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500993 enabled = skia_use_zlib && skia_enable_pdf
994 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700995
Mike Kleina01c6b02020-04-01 13:47:34 -0500996 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400997 if (skia_use_libjpeg_turbo_decode) {
998 deps += [ ":jpeg_decode" ]
999 }
1000 if (skia_use_libjpeg_turbo_encode) {
1001 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001002 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001003 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001004 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001005 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001006 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1007 deps += [ "//third_party/harfbuzz" ]
1008 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1009 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001010 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001011 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001012 }
1013}
1014
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001015optional("xps") {
1016 enabled = skia_use_xps && is_win
1017 public_defines = [ "SK_SUPPORT_XPS" ]
1018 public = skia_xps_public
1019 sources = skia_xps_sources
1020}
1021
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001022optional("png_decode") {
1023 enabled = skia_use_libpng_decode
1024 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001025
Mike Kleina01c6b02020-04-01 13:47:34 -05001026 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001027 sources = [
1028 "src/codec/SkIcoCodec.cpp",
1029 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001030 ]
1031}
1032
1033optional("png_encode") {
1034 enabled = skia_use_libpng_encode
1035 public_defines = [ "SK_ENCODE_PNG" ]
1036
Mike Kleina01c6b02020-04-01 13:47:34 -05001037 deps = [ "//third_party/libpng" ]
1038 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001039}
1040
scroggof84ad642016-10-31 09:02:57 -07001041optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001042 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001043 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1044
1045 deps = [
1046 "//third_party/dng_sdk",
1047 "//third_party/libjpeg-turbo:libjpeg",
1048 "//third_party/piex",
1049 ]
1050
1051 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1052 # Skia.
1053 configs_to_remove = [ "//gn:no_exceptions" ]
1054
Mike Kleina01c6b02020-04-01 13:47:34 -05001055 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001056}
1057
Mike Klein852a8cb2018-05-15 10:46:58 -04001058import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -04001059source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001060 cflags = []
1061 if (!is_win || is_clang) {
1062 cflags += [
1063 "-w",
1064 "-std=c11",
1065 ]
1066 }
1067
Mike Kleina01c6b02020-04-01 13:47:34 -05001068 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001069 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001070 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1071}
1072
mtklein3cc22182016-08-29 13:26:14 -07001073optional("typeface_freetype") {
1074 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001075
Mike Kleina01c6b02020-04-01 13:47:34 -05001076 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001077 sources = [
1078 "src/ports/SkFontHost_FreeType.cpp",
1079 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001080 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001081 ]
1082}
1083
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001084optional("webp_decode") {
1085 enabled = skia_use_libwebp_decode
1086 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001087
Mike Kleina01c6b02020-04-01 13:47:34 -05001088 deps = [ "//third_party/libwebp" ]
1089 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001090}
1091
1092optional("webp_encode") {
1093 enabled = skia_use_libwebp_encode
1094 public_defines = [ "SK_ENCODE_WEBP" ]
1095
Mike Kleina01c6b02020-04-01 13:47:34 -05001096 deps = [ "//third_party/libwebp" ]
1097 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001098}
1099
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001100optional("wuffs") {
1101 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001102 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001103
Mike Kleina01c6b02020-04-01 13:47:34 -05001104 deps = [ "//third_party/wuffs" ]
1105 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001106}
1107
mtklein63213812016-08-24 09:55:56 -07001108optional("xml") {
1109 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001110 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001111
Mike Kleina01c6b02020-04-01 13:47:34 -05001112 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001113 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001114 "src/svg/SkSVGCanvas.cpp",
1115 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001116 "src/xml/SkDOM.cpp",
1117 "src/xml/SkXMLParser.cpp",
1118 "src/xml/SkXMLWriter.cpp",
1119 ]
1120}
1121
Mike Klein853d4ed2020-08-20 00:41:00 +00001122optional("sksl_interpreter") {
1123 enabled = skia_enable_sksl_interpreter
1124 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
1125}
1126
Mike Klein613ad382019-06-06 11:42:02 -05001127optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001128 enabled = skia_enable_skvm_jit_when_possible
1129 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001130 if (skia_vtune_path != "") {
1131 public_defines += [ "SKVM_JIT_VTUNE" ]
1132 public_include_dirs = [ "$skia_vtune_path/include" ]
1133 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1134 }
Mike Klein613ad382019-06-06 11:42:02 -05001135}
1136
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001137if (skia_enable_gpu && skia_generate_workarounds) {
1138 action("workaround_list") {
1139 script = "tools/build_workaround_header.py"
1140
Mike Kleina01c6b02020-04-01 13:47:34 -05001141 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001142
1143 # see comments in skia_compile_processors about out dir path shenanigans.
1144 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001145 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001146
Mike Kleina01c6b02020-04-01 13:47:34 -05001147 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001148 args = [
1149 "--output-file",
1150 "$output_file",
1151 ]
1152
1153 foreach(file, inputs) {
1154 args += [ rebase_path(file, root_build_dir) ]
1155 }
1156 }
1157}
1158
mtkleinc04ff472016-06-23 10:29:30 -07001159component("skia") {
1160 public_configs = [ ":skia_public" ]
1161 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001162
Mike Klein607b0a72018-11-07 16:17:34 -05001163 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001164 ":fontmgr_FontConfigInterface",
1165 ":fontmgr_android",
1166 ":fontmgr_custom_directory",
1167 ":fontmgr_custom_embedded",
1168 ":fontmgr_custom_empty",
1169 ":fontmgr_fontconfig",
1170 ":fontmgr_fuchsia",
1171 ":fontmgr_mac_ct",
1172 ":fontmgr_win",
1173 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001174 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001175 ":pdf",
1176 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001177 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001178 ]
1179
mtkleinc04ff472016-06-23 10:29:30 -07001180 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001181 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001182 ":arm64",
1183 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001184 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001185 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001186 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001187 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001188 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001189 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001190 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001191 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001192 ":jpeg_decode",
1193 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001194 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001195 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001196 ":png_decode",
1197 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001198 ":raw",
Mike Klein853d4ed2020-08-20 00:41:00 +00001199 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -05001200 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001201 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001202 ":sse2",
1203 ":sse41",
1204 ":sse42",
1205 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001206 ":webp_decode",
1207 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001208 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001209 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001210 ]
1211
Hal Canaryc25f4e92019-02-26 11:54:25 -05001212 public = skia_core_public
1213 public += skia_utils_public
1214 public += skia_effects_public
1215 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001216
mtkleinc04ff472016-06-23 10:29:30 -07001217 sources = []
brettwb9447282016-09-01 14:24:39 -07001218 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001219 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001220 sources += skia_effects_sources
1221 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001222 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001223 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001224 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001225 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001226 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001227 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001228 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001229 "src/codec/SkBmpCodec.cpp",
1230 "src/codec/SkBmpMaskCodec.cpp",
1231 "src/codec/SkBmpRLECodec.cpp",
1232 "src/codec/SkBmpStandardCodec.cpp",
1233 "src/codec/SkCodec.cpp",
1234 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001235 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001236 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001237 "src/codec/SkMaskSwizzler.cpp",
1238 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001239 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001240 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001241 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001242 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001243 "src/codec/SkSwizzler.cpp",
1244 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001245 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001246 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001247 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001248 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001249 "src/ports/SkMemory_malloc.cpp",
1250 "src/ports/SkOSFile_stdio.cpp",
1251 "src/sfnt/SkOTTable_name.cpp",
1252 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001253 ]
brettwb9447282016-09-01 14:24:39 -07001254
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001255 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001256 libs = []
1257
mtkleinc04ff472016-06-23 10:29:30 -07001258 if (is_win) {
1259 sources += [
1260 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001261 "src/ports/SkImageEncoder_WIC.cpp",
1262 "src/ports/SkImageGeneratorWIC.cpp",
1263 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001264 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001265 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001266 libs += [
1267 "FontSub.lib",
1268 "Ole32.lib",
1269 "OleAut32.lib",
1270 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001271 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001272 ]
mtkleinc04ff472016-06-23 10:29:30 -07001273 } else {
1274 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001275 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001276 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001277 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001278 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001279 }
1280
mtklein7d6fb2c2016-08-25 14:50:44 -07001281 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001282 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001283 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001284 deps += [ "//third_party/cpu-features" ]
1285 }
mtklein06c35c02016-09-20 12:28:12 -07001286 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001287 libs += [
1288 "EGL",
1289 "GLESv2",
1290 "log",
1291 ]
1292 }
1293
Kevin Lubick217056c2018-09-20 17:39:31 -04001294 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001295 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001296 if (skia_use_egl) {
1297 libs += [ "GLESv2" ]
1298 }
mtkleinc04ff472016-06-23 10:29:30 -07001299 }
1300
1301 if (is_mac) {
1302 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001303 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001304 "src/ports/SkImageEncoder_CG.cpp",
1305 "src/ports/SkImageGeneratorCG.cpp",
1306 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001307 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001308 "ApplicationServices.framework",
1309 "OpenGL.framework",
1310 ]
mtkleinc04ff472016-06-23 10:29:30 -07001311 }
abarth6fc8ff02016-07-15 15:15:15 -07001312
Mike Klein7d302882016-11-03 14:06:31 -04001313 if (is_ios) {
1314 sources += [
1315 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001316 "src/ports/SkImageEncoder_CG.cpp",
1317 "src/ports/SkImageGeneratorCG.cpp",
1318 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001319 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001320 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001321 "ImageIO.framework",
1322 "MobileCoreServices.framework",
1323 ]
1324 }
1325
abarth6fc8ff02016-07-15 15:15:15 -07001326 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001327 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001328 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001329
1330 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -04001331 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001332 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1333 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001334
1335 if (skia_include_multiframe_procs) {
1336 sources += [ "tools/SkSharingProc.cpp" ]
1337 }
mtkleinc04ff472016-06-23 10:29:30 -07001338}
1339
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001340# DebugCanvas used in experimental/wasm-skp-debugger
1341if (target_cpu == "wasm") {
1342 static_library("debugcanvas") {
1343 public_configs = [ ":skia_public" ]
1344
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001345 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001346 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001347 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001348 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001349 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001350 "tools/debugger/DrawCommand.cpp",
1351 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001352 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001353 }
1354}
1355
Kevin Lubickcbcff382018-10-02 09:02:18 -04001356static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001357 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001358 public_configs = [ ":skia_public" ]
1359 configs += skia_library_configs
1360
1361 deps = [
1362 ":arm64",
1363 ":armv7",
1364 ":avx",
1365 ":crc32",
1366 ":hsw",
1367 ":none",
1368 ":sse2",
1369 ":sse41",
1370 ":sse42",
1371 ":ssse3",
1372 ]
1373
Kevin Lubickcbcff382018-10-02 09:02:18 -04001374 sources = []
1375 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001376 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001377 sources += [
1378 "src/core/SkAnalyticEdge.cpp",
1379 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001380 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001381 "src/core/SkCubicMap.cpp",
1382 "src/core/SkEdge.cpp",
1383 "src/core/SkEdgeBuilder.cpp",
1384 "src/core/SkEdgeClipper.cpp",
1385 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001386 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001387 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001388 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001389 "src/core/SkMallocPixelRef.cpp",
1390 "src/core/SkMath.cpp",
1391 "src/core/SkMatrix.cpp",
1392 "src/core/SkOpts.cpp",
1393 "src/core/SkPaint.cpp",
1394 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001395 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001396 "src/core/SkPathEffect.cpp",
1397 "src/core/SkPathMeasure.cpp",
1398 "src/core/SkPathRef.cpp",
1399 "src/core/SkPoint.cpp",
1400 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001401 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001402 "src/core/SkRect.cpp",
1403 "src/core/SkSemaphore.cpp",
1404 "src/core/SkStream.cpp",
1405 "src/core/SkString.cpp",
1406 "src/core/SkStringUtils.cpp",
1407 "src/core/SkStroke.cpp",
1408 "src/core/SkStrokeRec.cpp",
1409 "src/core/SkStrokerPriv.cpp",
1410 "src/core/SkThreadID.cpp",
1411 "src/core/SkUtils.cpp",
1412 "src/effects/SkDashPathEffect.cpp",
1413 "src/effects/SkTrimPathEffect.cpp",
1414 "src/ports/SkDebug_stdio.cpp",
1415 "src/ports/SkMemory_malloc.cpp",
1416 "src/utils/SkDashPath.cpp",
1417 "src/utils/SkParse.cpp",
1418 "src/utils/SkParsePath.cpp",
1419 "src/utils/SkUTF.cpp",
1420 ]
1421}
1422
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001423group("modules") {
1424 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001425 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001426 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001427 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001428 "modules/skshaper",
1429 ]
1430}
1431
Brian Osmancd28fa62020-07-07 16:01:26 -04001432config("our_vulkan_headers") {
1433 include_dirs = [ "include/third_party/vulkan" ]
1434}
1435
mtkleinc095df52016-08-24 12:23:52 -07001436# Targets guarded by skia_enable_tools may use //third_party freely.
1437if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001438 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001439 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001440 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001441 "include/c",
1442 "include/codec",
1443 "include/config",
1444 "include/core",
1445 "include/docs",
1446 "include/effects",
1447 "include/encode",
1448 "include/gpu",
1449 "include/pathops",
1450 "include/ports",
1451 "include/svg",
1452 "include/utils",
1453 "include/utils/mac",
Julia Lavrova70258c72020-07-15 11:28:57 -04001454 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001455 "modules/skshaper/include",
1456 "modules/skottie/include",
1457 ]
1458
Mike Klein308b5ac2016-12-06 16:03:52 -05001459 # Used by gn_to_bp.py to list our public include dirs.
1460 source_set("public") {
1461 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001462 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001463 }
1464
Mike Kleinc36dedf2016-11-18 09:35:28 -05001465 config("skia.h_config") {
1466 include_dirs = [ "$target_gen_dir" ]
1467 }
1468 action("skia.h") {
1469 public_configs = [ ":skia.h_config" ]
1470 skia_h = "$target_gen_dir/skia.h"
1471 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001472
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001473 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1474 [ rebase_path(skia_h, root_build_dir) ] +
1475 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001476 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001477 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001478 }
1479
Brian Osmanc9a42472018-05-31 13:17:12 -04001480 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001481 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001482 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001483 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001484 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001485 "tools/fiddle/draw.cpp",
1486 "tools/fiddle/fiddle_main.cpp",
1487 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001488
1489 if (skia_use_egl) {
1490 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001491 } else {
1492 sources += [ "tools/fiddle/null_context.cpp" ]
1493 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001494 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001495 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001496 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001497 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001498 ":skia",
1499 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001500 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001501 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001502 ]
1503 }
1504 }
1505
Mike Kleine5463e62020-06-11 13:53:53 -05001506 config("cpp14") {
1507 if (is_win) {
1508 cflags_cc = [ "/std:c++14" ]
1509 } else {
1510 cflags_cc = [ "-std=c++14" ]
1511 }
1512 }
1513
Brian Osmanc9a42472018-05-31 13:17:12 -04001514 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001515 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001516 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001517 configs += [
1518 ":our_vulkan_headers",
1519 ":cpp14",
1520 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001521 deps = [
1522 ":skia",
1523 ":skia.h",
1524 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001525 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001526 ]
Stephen White0d70b712019-07-10 15:51:30 -04001527
1528 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001529 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001530 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001531 }
1532
mtkleinc095df52016-08-24 12:23:52 -07001533 template("test_lib") {
1534 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001535 if (defined(invoker.public_defines)) {
1536 defines = invoker.public_defines
1537 }
mtklein25c81d42016-07-27 13:55:26 -07001538 }
mtkleinc095df52016-08-24 12:23:52 -07001539 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001540 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001541 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001542 public_configs = [
1543 ":" + target_name + "_config",
1544 ":skia_private",
1545 ]
1546
1547 if (!defined(deps)) {
1548 deps = []
1549 }
1550 deps += [ ":skia" ]
1551 testonly = true
1552 }
mtklein25c81d42016-07-27 13:55:26 -07001553 }
mtklein25c81d42016-07-27 13:55:26 -07001554
Mike Kleine6682eb2017-01-05 10:54:57 -05001555 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001556 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001557 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001558 forward_variables_from(invoker,
1559 "*",
1560 [
1561 "output_name",
1562 "visibility",
1563 "is_shared_library",
1564 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001565 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001566 extra_configs = [ ":skia_private" ]
1567 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1568 data_sources = [ "resources" ]
1569 if ("True" == exec_script("//gn/checkdir.py",
1570 [ rebase_path("skps", root_build_dir) ],
1571 "trim string")) {
1572 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001573 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001574 }
1575 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001576 # !is_ios
1577
Jim Van Verth92411c72020-04-03 15:18:31 -04001578 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001579 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1580 shared_library("lib" + target_name) {
1581 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1582 configs += [ ":skia_private" ]
1583 testonly = true
1584 }
1585 } else {
1586 _executable = target_name
1587 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001588 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001589 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1590 configs += [ ":skia_private" ]
1591 testonly = true
1592 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001593 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001594 if (is_android && skia_android_serial != "" && defined(_executable)) {
1595 action("push_" + target_name) {
1596 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001597 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001598 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001599 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001600 args = [
1601 rebase_path("$root_build_dir/$_executable"),
1602 skia_android_serial,
1603 rebase_path(_stamp),
1604 ]
1605 testonly = true
1606 }
Mike Klein7d921032017-01-05 12:20:41 -05001607 }
1608 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001609 }
1610
mtkleinc095df52016-08-24 12:23:52 -07001611 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001612 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001613
Mike Klein9e25bb92019-04-29 09:46:36 -05001614 # Bots and even devs may not have Vulkan headers, so put
1615 # include/third_party/vulkan on our path so they're always available.
1616 all_dependent_configs = [ ":our_vulkan_headers" ]
1617
Mike Klein333fb452019-04-24 08:48:11 -05001618 defines = []
1619 if (skia_enable_discrete_gpu) {
1620 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1621 }
1622
Brian Osmanc9a42472018-05-31 13:17:12 -04001623 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001624 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001625 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001626 "tools/gpu/BackendSurfaceFactory.cpp",
1627 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001628 "tools/gpu/BackendTextureImageFactory.cpp",
1629 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001630 "tools/gpu/FlushFinishTracker.cpp",
1631 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001632 "tools/gpu/GrContextFactory.cpp",
1633 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001634 "tools/gpu/ManagedBackendTexture.cpp",
1635 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001636 "tools/gpu/MemoryCache.cpp",
1637 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001638 "tools/gpu/ProxyUtils.cpp",
1639 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001640 "tools/gpu/TestOps.cpp",
1641 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001642 "tools/gpu/YUVUtils.cpp",
1643 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001644 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1645 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001646 "tools/gpu/mock/MockTestContext.cpp",
1647 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001648
1649 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001650 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001651
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001652 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001653 sources +=
1654 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001655 if (is_ios) {
1656 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001657 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001658 } else if (is_mac) {
1659 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001660 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001661 if (skia_use_angle) {
1662 deps += [ "//third_party/angle2" ]
1663 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1664 }
Brian Salomon1171d312020-03-19 08:47:44 -04001665 }
1666
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001667 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1668 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001669 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001670 if (is_android || skia_use_egl) {
1671 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1672 libs += [ "EGL" ]
1673 } else if (is_linux) {
1674 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1675 libs += [
1676 "GLU",
1677 "GL",
1678 "X11",
1679 ]
1680 } else if (is_win) {
1681 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1682 libs += [ "Gdi32.lib" ]
1683 if (target_cpu != "arm64") {
1684 libs += [ "OpenGL32.lib" ]
1685 }
1686 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001687 }
Greg Daniel54200e42018-12-11 17:03:39 -05001688
Brian Osmanc9a42472018-05-31 13:17:12 -04001689 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001690 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001691 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001692 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1693 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001694 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001695 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001696 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1697 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001698 }
1699 if (skia_use_metal) {
1700 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001701 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001702 if (skia_use_direct3d) {
1703 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001704 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001705 }
Stephen White985741a2019-07-18 11:43:45 -04001706 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001707 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001708 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001709 if (is_clang) {
1710 cflags_cc = [ "-Wno-microsoft-cast" ]
1711 }
Stephen White985741a2019-07-18 11:43:45 -04001712 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001713
1714 if (is_fuchsia && using_fuchsia_sdk) {
1715 libs +=
1716 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1717 }
Jim Van Verth36b86af2020-08-24 17:16:46 +00001718
1719 cflags_objcc = [ "-fobjc-arc" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07001720 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001721
mtkleinc095df52016-08-24 12:23:52 -07001722 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001723 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001724 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001725
1726 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001727 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1728 deps = [ ":flags" ]
1729 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001730 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001731 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001732 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1733 deps = [ ":flags" ]
1734 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001735 }
1736 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001737 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1738 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001739 }
1740 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001741 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1742 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001743 }
mtklein25c81d42016-07-27 13:55:26 -07001744
Mike Klein499f0ac2019-03-25 13:00:12 -05001745 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001746 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001747 sources = [
1748 "tools/trace/ChromeTracingTracer.cpp",
1749 "tools/trace/ChromeTracingTracer.h",
1750 "tools/trace/EventTracingPriv.cpp",
1751 "tools/trace/EventTracingPriv.h",
1752 "tools/trace/SkDebugfTracer.cpp",
1753 "tools/trace/SkDebugfTracer.h",
1754 ]
1755 }
1756
mtkleinc095df52016-08-24 12:23:52 -07001757 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001758 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001759 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001760 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001761 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001762 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001763 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001764 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001765 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001766 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001767 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001768 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001769 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001770 "tools/SkMetaData.cpp",
1771 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001772 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001773 "tools/SkSharingProc.h",
1774 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001775 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001776 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001777 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001778 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001779 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001780 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001781 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001782 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001783 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001784 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001785 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001786 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001787 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001788 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001789 "tools/fonts/TestEmptyTypeface.h",
1790 "tools/fonts/TestFontMgr.cpp",
1791 "tools/fonts/TestFontMgr.h",
1792 "tools/fonts/TestSVGTypeface.cpp",
1793 "tools/fonts/TestSVGTypeface.h",
1794 "tools/fonts/TestTypeface.cpp",
1795 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001796 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001797 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001798 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001799 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001800 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001801 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001802 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001803 if (target_cpu != "wasm") {
1804 sources += [ "tools/CrashHandler.cpp" ]
1805 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001806 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001807 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001808 if (is_ios) {
1809 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001810 sources += [ "tools/ios_utils.h" ]
1811 if (skia_use_metal) {
1812 sources += [ "tools/AutoreleasePool.mm" ]
1813 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001814 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001815 } else if (is_mac) {
1816 if (skia_use_metal) {
1817 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001818 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001819 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001820 } else if (is_win) {
1821 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001822 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001823
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001824 defines = []
1825 if (skia_tools_require_resources) {
1826 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1827 }
mtkleinc095df52016-08-24 12:23:52 -07001828 deps = [
1829 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001830 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001831 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001832 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001833 }
mtklein25c81d42016-07-27 13:55:26 -07001834
Mike Kleine11e5c12019-04-24 12:46:06 -05001835 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001836 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001837 }
1838
Mike Klein6e744122016-10-27 12:21:40 -04001839 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001840 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001841 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001842 if (skia_use_gl) {
1843 sources += gl_gm_sources
1844 }
mtkleinc095df52016-08-24 12:23:52 -07001845 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001846 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001847 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001848 ":skia",
1849 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001850 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001851 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001852 "modules/skparagraph",
1853 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001854 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001855 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001856 if (is_skia_dev_build) {
1857 sources += [ "gm/fiddle.cpp" ]
1858 deps += [ ":skia.h" ]
1859 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001860 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001861
1862 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001863 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001864 sources += [ "gm/video_decoder.cpp" ]
1865 }
mtkleinc095df52016-08-24 12:23:52 -07001866 }
mtklein25c81d42016-07-27 13:55:26 -07001867
Mike Klein7b7077c2019-06-03 17:10:59 -05001868 test_lib("skvm_builders") {
1869 sources = [
1870 "tools/SkVMBuilders.cpp",
1871 "tools/SkVMBuilders.h",
1872 ]
1873 }
1874
Mike Klein6e744122016-10-27 12:21:40 -04001875 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001876 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001877 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001878 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001879 if (skia_use_metal) {
1880 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001881 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001882 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001883 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001884 if (skia_use_gl) {
1885 sources += gl_tests_sources
1886 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001887 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001888 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001889 }
Ben Wagner75626e42020-06-03 13:20:37 -04001890 if (!skia_enable_fontmgr_fontconfig) {
Ben Wagner37a06c02018-06-22 21:11:00 +00001891 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1892 }
mtkleinc095df52016-08-24 12:23:52 -07001893 deps = [
1894 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001895 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001896 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001897 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001898 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001899 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001900 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001901 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001902 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001903 "modules/svg",
mtkleinc095df52016-08-24 12:23:52 -07001904 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001905 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001906 "//third_party/zlib",
1907 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001908 public_deps = [
1909 ":gpu_tool_utils", # Test.h #includes headers from this target.
1910 ]
mtkleinc095df52016-08-24 12:23:52 -07001911 }
mtklein2f3416d2016-08-02 16:02:05 -07001912
Mike Klein6e744122016-10-27 12:21:40 -04001913 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001914 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001915 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001916 deps = [
1917 ":flags",
1918 ":gm",
1919 ":gpu_tool_utils",
1920 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001921 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001922 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001923 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001924 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001925 ]
1926 }
mtklein2b6870c2016-07-28 14:17:33 -07001927
Mike Reedd62d4062019-06-12 10:20:44 -04001928 test_lib("experimental_xform") {
1929 sources = [
1930 "experimental/xform/SkShape.cpp",
1931 "experimental/xform/SkXform.cpp",
1932 "experimental/xform/XContext.cpp",
1933 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001934 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04001935 }
1936
Florin Malitabfe876a2018-09-02 12:33:59 -04001937 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001938 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001939 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04001940 }
Florin Malitab3418102020-10-15 18:10:29 -04001941 test_app("svg_tool") {
1942 deps = [ "modules/svg:tool" ]
1943 }
Florin Malita79725d32018-06-05 16:16:57 -04001944 }
1945
Hal Canary5b39dc82019-04-17 13:29:46 -04001946 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001947 sources = [ "tools/skqp/make_skqp_model.cpp" ]
1948 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04001949 }
1950
Chris Dalton2b598902020-03-25 10:50:35 -06001951 import("gn/samples.gni")
1952 test_lib("samples") {
1953 sources = samples_sources
1954 if (skia_enable_ccpr) {
1955 sources += samples_sources_ccpr
Kevin Lubickebf648e2017-09-21 13:45:16 -04001956 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001957 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06001958 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06001959 ":flags",
1960 ":gpu_tool_utils",
1961 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04001962 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06001963 "modules/skparagraph:samples",
1964 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001965 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04001966 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06001967 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001968 }
Kevin Lubick00398742020-10-08 10:05:07 -04001969 test_lib("hash_and_encode") {
1970 sources = [
1971 "tools/HashAndEncode.cpp",
1972 "tools/HashAndEncode.h",
1973 ]
1974 deps = [
1975 ":flags",
1976 ":skia",
1977 "//third_party/libpng",
1978 ]
1979 }
Chris Dalton2b598902020-03-25 10:50:35 -06001980 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10001981 test_app("convert-to-nia") {
1982 sources = [ "tools/convert-to-nia.cpp" ]
1983 deps = [ ":skia" ]
1984 }
Mike Klein7af351a2018-07-27 09:54:43 -04001985 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001986 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04001987 deps = [
1988 ":skcms",
1989 ":skia",
1990 ]
1991 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001992 test_app("fm") {
1993 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06001994 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05001995 "tools/fm/fm.cpp",
1996 ]
1997 deps = [
1998 ":common_flags_aa",
1999 ":common_flags_gpu",
2000 ":flags",
2001 ":gm",
2002 ":gpu_tool_utils",
2003 ":hash_and_encode",
2004 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002005 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002006 ":tool_utils",
2007 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002008 "modules/skottie",
2009 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002010 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002011 ]
2012 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002013 test_app("dm") {
2014 sources = [
2015 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002016 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002017 "dm/DMJsonWriter.cpp",
2018 "dm/DMSrcSink.cpp",
2019 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002020 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002021 ":common_flags_aa",
2022 ":common_flags_config",
2023 ":common_flags_gpu",
2024 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002025 ":flags",
2026 ":gm",
2027 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002028 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002029 ":skia",
2030 ":tests",
2031 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002032 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002033 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002034 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002035 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002036 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002037 ]
2038 }
Brian Osman16adfa32016-10-18 14:42:44 -04002039 }
2040
Mike Kleina8a51ce2018-01-09 12:34:11 -05002041 if (!is_win) {
2042 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002043 sources = [ "tools/remote_demo.cpp" ]
2044 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002045 }
2046 }
2047
Hal Canarye107faa2019-10-23 12:52:33 -04002048 if (!is_win) {
2049 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002050 sources = [ "tools/blob_cache_sim.cpp" ]
2051 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002052 }
2053 }
2054
Mike Kleine6682eb2017-01-05 10:54:57 -05002055 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002056 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002057 deps = [
2058 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002059 ":common_flags_aa",
2060 ":common_flags_config",
2061 ":common_flags_gpu",
2062 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002063 ":flags",
2064 ":gm",
2065 ":gpu_tool_utils",
2066 ":skia",
2067 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002068 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002069 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002070 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002071 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002072 ]
mtklein2b6870c2016-07-28 14:17:33 -07002073 }
halcanary19a97202016-08-03 15:08:04 -07002074
Ravi Mistry10d36c52017-01-31 09:49:18 -05002075 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002076 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002077 deps = [
2078 ":flags",
2079 ":skia",
2080 ]
2081 }
2082
Mike Reedc0ee21f2019-05-28 16:11:03 -04002083 if (skia_use_ffmpeg) {
2084 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002085 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002086 deps = [
2087 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002088 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002089 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002090 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002091 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002092 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002093 ]
2094 }
2095 }
2096
Brian Osmanc9a42472018-05-31 13:17:12 -04002097 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002098 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002099 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002100 ":common_flags_config",
2101 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002102 ":flags",
2103 ":gpu_tool_utils",
2104 ":skia",
2105 ":tool_utils",
2106 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002107 }
2108
Mike Kleine6682eb2017-01-05 10:54:57 -05002109 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002110 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002111 deps = [
2112 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002113 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002114 ]
halcanary3eee9d92016-09-10 07:01:53 -07002115 }
mtklein046cb562016-09-16 10:23:12 -07002116
Ben Wagner219f3622017-07-17 15:32:25 -04002117 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002118 sources = [ "tools/fonts/create_test_font.cpp" ]
2119 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002120 assert_no_deps = [
2121 # tool_utils requires the output of this app.
2122 ":tool_utils",
2123 ]
2124 }
2125
Florin Malita5d3ff432018-07-31 16:38:43 -04002126 if (skia_use_expat) {
2127 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002128 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002129 deps = [
2130 ":flags",
2131 ":skia",
2132 ":tool_utils",
2133 ]
2134 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002135 }
2136
Mike Kleine6682eb2017-01-05 10:54:57 -05002137 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002138 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002139 deps = [
2140 ":flags",
2141 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002142 ]
mtklein046cb562016-09-16 10:23:12 -07002143 }
mtkleinecbc5262016-09-22 11:51:24 -07002144
Brian Osman6788a542018-12-10 11:56:01 -05002145 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002146 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002147 sources = [
2148 "tools/skiaserve/Request.cpp",
2149 "tools/skiaserve/Response.cpp",
2150 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002151 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2152 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2153 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2154 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2155 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2156 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2157 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2158 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2159 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002160 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2161 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002162 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2163 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2164 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2165 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2166 ]
2167 deps = [
2168 ":flags",
2169 ":gpu_tool_utils",
2170 ":skia",
2171 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002172 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002173 ]
Mike Klein7d302882016-11-03 14:06:31 -04002174 }
mtkleinecbc5262016-09-22 11:51:24 -07002175 }
kjlubick14f984b2016-10-03 11:49:45 -07002176
Mike Kleine6682eb2017-01-05 10:54:57 -05002177 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002178 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002179 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002180 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002181 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002182 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002183 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002184 "fuzz/FuzzCreateDDL.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002185 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002186 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002187 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002188 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002189 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002190 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002191 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002192 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002193 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002194 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002195 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2196 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002197 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002198 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002199 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002200 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002201 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2202 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002203 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002204 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2205 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002206 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002207 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002208 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002209 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002210 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002211 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002212 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002213 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002214 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002215 "tools/debugger/DrawCommand.cpp",
2216 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002217 ]
2218 deps = [
2219 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002220 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002221 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002222 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002223 ]
kjlubick14f984b2016-10-03 11:49:45 -07002224 }
Mike Klein38312422016-10-05 15:41:01 -04002225
Mike Kleine6682eb2017-01-05 10:54:57 -05002226 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002227 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002228 rebase_path("tests/skia_test.cpp"),
2229 rebase_path("tests/Test.cpp"),
2230 ]
caryclark9feb6322016-10-25 08:58:26 -07002231 deps = [
2232 ":flags",
2233 ":gpu_tool_utils",
2234 ":skia",
2235 ":tool_utils",
2236 ]
caryclark9feb6322016-10-25 08:58:26 -07002237 }
2238
Mike Kleine6682eb2017-01-05 10:54:57 -05002239 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002240 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002241 deps = [
2242 ":flags",
2243 ":skia",
2244 ]
Mike Klein38312422016-10-05 15:41:01 -04002245 }
bungemanfe917272016-10-13 17:36:40 -04002246
Mike Kleine6682eb2017-01-05 10:54:57 -05002247 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002248 sources = [
2249 "tools/skdiff/skdiff.cpp",
2250 "tools/skdiff/skdiff_html.cpp",
2251 "tools/skdiff/skdiff_main.cpp",
2252 "tools/skdiff/skdiff_utils.cpp",
2253 ]
2254 deps = [
2255 ":skia",
2256 ":tool_utils",
2257 ]
bungemanfe917272016-10-13 17:36:40 -04002258 }
halcanarya73d76a2016-10-17 13:19:02 -07002259
Mike Kleine6682eb2017-01-05 10:54:57 -05002260 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002261 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002262 deps = [
2263 ":skia",
2264 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002265 ]
halcanarya73d76a2016-10-17 13:19:02 -07002266 }
Brian Osman16adfa32016-10-18 14:42:44 -04002267
Brian Osmanc9a42472018-05-31 13:17:12 -04002268 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002269 source_set("skqp_lib") {
2270 check_includes = false
2271 testonly = true
2272 if (!is_official_build) {
2273 configs -= [ "//gn:warnings" ]
2274 }
2275 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002276 defines =
2277 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002278 sources = [
2279 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002280 "tools/skqp/src/skqp.cpp",
2281 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002282 ]
2283 deps = [
2284 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002285 ":skia",
2286 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002287 ":tool_utils",
2288 ]
2289 }
2290 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002291 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002292 include_dirs = [ "//" ]
2293 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002294 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002295 }
2296 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002297 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002298 deps = [
2299 ":gm",
2300 ":skia",
2301 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002302 ]
2303 }
2304 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002305 if (is_fuchsia) {
2306 # Build a package repository for skqp on Fuchsia.
2307 group("skqp_repo") {
2308 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002309 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002310 }
2311 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002312 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002313 shared_library("libskqp_app") {
2314 configs += [ ":skia_private" ]
2315 if (!is_official_build) {
2316 configs -= [ "//gn:warnings" ]
2317 }
2318 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002319 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002320 deps = [
2321 ":skia",
2322 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002323 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002324 ]
2325 libs = [ "android" ]
2326 }
2327 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002328 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002329 test_app("skottie_android") {
2330 is_shared_library = true
2331
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002332 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002333 libs = []
2334
Stan Iliev93151722018-08-02 11:10:52 -04002335 deps = [
2336 ":skia",
2337 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002338 "modules/sksg:samples",
Jorge Betancourt646d6c52020-08-31 16:07:25 -04002339 "//third_party/oboe",
Stan Iliev93151722018-08-02 11:10:52 -04002340 ]
2341 }
2342 }
Hal Canary75427132017-10-11 16:00:31 -04002343
Hal Canarya9de7602018-01-19 13:08:23 -05002344 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002345 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002346 deps = [
2347 ":gm",
2348 ":skia",
2349 ]
2350 }
2351 test_app("list_gpu_unit_tests") {
2352 sources = [
2353 "dm/DMGpuTestProcs.cpp",
2354 "tools/list_gpu_unit_tests.cpp",
2355 ]
2356 deps = [
2357 ":skia",
2358 ":tests",
2359 ]
2360 }
2361
Brian Osmanc9a42472018-05-31 13:17:12 -04002362 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002363 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002364 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002365 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002366 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002367 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002368 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002369 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002370 "tools/sk_app/CommandSet.h",
2371 "tools/sk_app/DisplayParams.h",
2372 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002373 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002374 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002375 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002376 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002377 ]
2378 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002379 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002380
2381 if (is_android) {
2382 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002383 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002384 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002385 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002386 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002387 "tools/sk_app/android/main_android.cpp",
2388 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002389 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002390 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002391 libs += [ "android" ]
2392 } else if (is_linux) {
2393 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002394 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002395 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002396 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002397 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002398 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002399 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002400 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002401 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002402 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002403 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002404 "X11",
2405 ]
2406 } else if (is_win) {
2407 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002408 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002409 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002410 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002411 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002412 "tools/sk_app/win/main_win.cpp",
2413 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002414 } else if (is_mac) {
2415 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002416 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002417 "tools/sk_app/mac/WindowContextFactory_mac.h",
2418 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002419 "tools/sk_app/mac/Window_mac.mm",
2420 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002421 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002422 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002423 "QuartzCore.framework",
2424 "Cocoa.framework",
2425 "Foundation.framework",
2426 ]
2427 } else if (is_ios) {
2428 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002429 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002430 "tools/sk_app/ios/WindowContextFactory_ios.h",
2431 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002432 "tools/sk_app/ios/Window_ios.mm",
2433 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002434 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002435 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002436 }
2437
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002438 if (skia_use_gl) {
2439 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002440 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002441 if (is_android) {
2442 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2443 } else if (is_linux) {
2444 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2445 } else if (is_win) {
2446 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2447 if (skia_use_angle) {
2448 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2449 }
2450 } else if (is_mac) {
2451 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2452 } else if (is_ios) {
2453 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2454 }
2455 }
2456
Brian Osmanc9a42472018-05-31 13:17:12 -04002457 if (skia_use_vulkan) {
2458 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002459 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002460 if (is_android) {
2461 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2462 } else if (is_linux) {
2463 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2464 libs += [ "X11-xcb" ]
2465 } else if (is_win) {
2466 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2467 }
2468 }
2469
Jim Van Verthbe39f712019-02-08 15:36:14 -05002470 if (skia_use_metal) {
2471 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002472 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002473 if (is_mac) {
2474 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002475 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002476 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002477 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002478 }
2479
Jim Van Verth682a2f42020-05-13 16:54:09 -04002480 if (skia_use_direct3d) {
2481 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2482 }
2483
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002484 if (skia_use_dawn) {
2485 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002486 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002487 if (is_linux) {
2488 if (dawn_enable_vulkan) {
2489 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2490 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2491 libs += [ "X11-xcb" ]
2492 }
2493 } else if (is_win) {
2494 if (dawn_enable_d3d12) {
2495 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2496 }
2497 } else if (is_mac) {
2498 if (dawn_enable_metal) {
2499 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2500 }
2501 }
2502 }
2503
Mike Kleina01c6b02020-04-01 13:47:34 -05002504 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002505 if (is_android) {
2506 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002507 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002508 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002509 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002510 }
Brian Osman16adfa32016-10-18 14:42:44 -04002511 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002512
Hal Canary87515122019-03-15 14:22:51 -04002513 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2514 test_app("fiddle_examples") {
2515 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002516 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002517 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002518 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002519 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002520 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002521 cflags = [
2522 "/wd4756", # Overflow in constant arithmetic
2523 "/wd4305", # truncation from 'double' to 'float'
2524 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002525 }
Hal Canary87515122019-03-15 14:22:51 -04002526 deps = [
2527 ":skia",
2528 ":skia.h",
2529 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002530 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002531 ]
2532 }
2533 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002534
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002535 # sk_app can work without GL but viewer always runs raster through a GL window context.
2536 if (skia_use_gl) {
2537 test_app("viewer") {
2538 is_shared_library = is_android
2539 sources = [
2540 "tools/viewer/AnimTimer.h",
2541 "tools/viewer/BisectSlide.cpp",
2542 "tools/viewer/GMSlide.cpp",
2543 "tools/viewer/ImGuiLayer.cpp",
2544 "tools/viewer/ImageSlide.cpp",
2545 "tools/viewer/ParticlesSlide.cpp",
2546 "tools/viewer/SKPSlide.cpp",
2547 "tools/viewer/SampleSlide.cpp",
Florin Malita45cd2002020-06-09 14:00:54 -04002548 "tools/viewer/SkRiveSlide.cpp",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002549 "tools/viewer/SkSLSlide.cpp",
2550 "tools/viewer/SkottieSlide.cpp",
2551 "tools/viewer/SlideDir.cpp",
2552 "tools/viewer/StatsLayer.cpp",
2553 "tools/viewer/SvgSlide.cpp",
2554 "tools/viewer/TouchGesture.cpp",
2555 "tools/viewer/TouchGesture.h",
2556 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002557 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002558 ]
2559 libs = []
2560
2561 deps = [
2562 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002563 ":flags",
2564 ":gm",
2565 ":gpu_tool_utils",
2566 ":samples",
2567 ":sk_app",
2568 ":skia",
2569 ":tool_utils",
2570 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002571 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002572 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002573 "modules/particles",
2574 "modules/skottie",
2575 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002576 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002577 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002578 "//third_party/imgui",
2579 ]
2580 if (skia_use_experimental_xform) {
2581 deps += [ ":experimental_xform" ]
2582 sources += [ "gm/xform.cpp" ]
2583 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002584 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002585 deps += [
2586 "//third_party/spirv-tools:spvtools",
2587
2588 #spvtools depends on this but doesn't deps it in. Looks like upstream bug
2589 #that we replicated in our third_party/spirv-tools/BUILD.gn
2590 "//third_party/spirv-tools:spvtools_val",
2591 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002592 }
Mike Reedd62d4062019-06-12 10:20:44 -04002593 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002594 }
2595
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002596 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002597 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002598 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002599 libs = []
2600
Brian Osmaneff04b52017-11-21 13:18:02 -05002601 deps = [
2602 ":flags",
2603 ":gpu_tool_utils",
2604 ":sk_app",
2605 ":skia",
2606 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002607 ]
2608 }
2609 }
2610
Mike Klein9f6468f2020-05-19 13:14:40 -05002611 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002612 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002613 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002614 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002615 deps = [
2616 ":gpu_tool_utils",
2617 ":skia",
2618 "//third_party/libsdl",
2619 ]
2620 }
2621 }
2622
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002623 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2624 action_foreach("generate_mocs") {
2625 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002626 sources = [ "tools/mdbviz/MainWindow.h" ]
2627 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002628 args = [
2629 "$skia_qt_path" + "/bin/moc",
2630 "{{source}}",
2631 "-o",
2632 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2633 ]
2634 }
2635 action_foreach("generate_resources") {
2636 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002637 sources = [ "tools/mdbviz/resources.qrc" ]
2638 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002639 args = [
2640 "$skia_qt_path" + "/bin/rcc",
2641 "{{source}}",
2642 "-o",
2643 "gen/mdbviz/{{source_name_part}}_res.cpp",
2644 ]
2645 }
2646 test_app("mdbviz") {
2647 if (is_win) {
2648 # on Windows we need to disable some exception handling warnings due to the Qt headers
2649 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2650 }
2651 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002652 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002653 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002654 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002655 "tools/debugger/DrawCommand.cpp",
2656 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002657 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002658 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002659 "tools/mdbviz/main.cpp",
2660
2661 # generated files
2662 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2663 "$target_gen_dir/mdbviz/resources_res.cpp",
2664 ]
2665 lib_dirs = [ "$skia_qt_path/lib" ]
2666 libs = [
2667 "Qt5Core.lib",
2668 "Qt5Gui.lib",
2669 "Qt5Widgets.lib",
2670 ]
2671 include_dirs = [
2672 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002673 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002674 "$skia_qt_path/include/QtWidgets",
2675 ]
2676 deps = [
2677 ":generate_mocs",
2678 ":generate_resources",
2679 ":skia",
2680 ]
2681 }
2682 }
2683
Mike Kleine459afd2017-03-03 09:21:30 -05002684 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002685 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002686 sources = [ "$ndk/$ndk_gdbserver" ]
2687 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002688 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002689 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002690
2691 if (skia_use_opencl) {
2692 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002693 sources = [ "tools/hello-opencl.cpp" ]
2694 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002695 }
2696 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002697
Brian Osmanf564f152019-07-23 15:14:30 -04002698 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002699 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002700 deps = [
2701 ":skia",
2702 "modules/particles",
2703 ]
2704 }
2705
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002706 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002707 test_app("editor") {
2708 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002709 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002710 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002711 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002712
2713 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002714 sources = [ "tools/image_diff_metric.cpp" ]
2715 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002716 }
Chris Dalton2b598902020-03-25 10:50:35 -06002717
2718 group("modules_testonly") {
2719 testonly = true
2720 deps = []
2721 if (target_cpu == "wasm") {
2722 deps += [ "modules/canvaskit:viewer_wasm" ]
2723 }
2724 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002725
2726 if (skia_build_fuzzers) {
2727 template("libfuzzer_app") {
2728 output_dir = root_build_dir
2729 executable(target_name) {
2730 check_includes = false
2731 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2732 configs += [ ":skia_private" ]
2733 sources += [
2734 "fuzz/Fuzz.cpp",
2735 "fuzz/FuzzCommon.cpp",
2736 ]
2737 deps += [
2738 ":flags",
2739 ":gpu_tool_utils",
2740 ":skia",
2741 ]
2742 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2743 if (skia_use_libfuzzer_defaults) {
2744 cflags = [ "-fsanitize=fuzzer" ]
2745 ldflags = [ "-fsanitize=fuzzer" ]
2746 }
2747 testonly = true
2748 }
2749 }
2750
2751 libfuzzer_app("region_deserialize") {
2752 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2753 deps = []
2754 }
2755
2756 libfuzzer_app("image_filter_deserialize") {
2757 include_dirs = [
2758 "tools",
2759 "tools/fonts",
2760 ]
2761 sources = [
2762 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2763 "tools/Resources.cpp",
2764 "tools/fonts/TestFontMgr.cpp",
2765 "tools/fonts/TestSVGTypeface.cpp",
2766 "tools/fonts/TestTypeface.cpp",
2767 ]
Florin Malitab3418102020-10-15 18:10:29 -04002768 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002769 }
2770
2771 libfuzzer_app("region_set_path") {
2772 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2773 deps = []
2774 }
2775
2776 libfuzzer_app("textblob_deserialize") {
2777 include_dirs = [
2778 "tools",
2779 "tools/fonts",
2780 ]
2781 sources = [
2782 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2783 "tools/Resources.cpp",
2784 "tools/fonts/TestFontMgr.cpp",
2785 "tools/fonts/TestSVGTypeface.cpp",
2786 "tools/fonts/TestTypeface.cpp",
2787 ]
Florin Malitab3418102020-10-15 18:10:29 -04002788 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002789 }
2790
2791 libfuzzer_app("path_deserialize") {
2792 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2793 deps = []
2794 }
2795
2796 libfuzzer_app("image_decode") {
2797 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2798 deps = []
2799 }
2800
2801 libfuzzer_app("animated_image_decode") {
2802 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2803 deps = []
2804 }
2805
2806 libfuzzer_app("api_create_ddl") {
2807 include_dirs = [
2808 "include",
2809 "include/gpu",
2810 ]
2811 sources = [
2812 "fuzz/FuzzCreateDDL.cpp",
2813 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2814 "tools/Resources.cpp",
2815 "tools/UrlDataManager.cpp",
2816 "tools/debugger/DebugCanvas.cpp",
2817 "tools/debugger/DebugLayerManager.cpp",
2818 "tools/debugger/DrawCommand.cpp",
2819 "tools/debugger/JsonWriteBuffer.cpp",
2820 "tools/fonts/TestFontMgr.cpp",
2821 "tools/fonts/TestSVGTypeface.cpp",
2822 "tools/fonts/TestTypeface.cpp",
2823 ]
2824 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002825 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002826 "//third_party/libpng",
2827 ]
2828 }
2829
2830 libfuzzer_app("api_draw_functions") {
2831 sources = [
2832 "fuzz/FuzzDrawFunctions.cpp",
2833 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2834 ]
2835 deps = []
2836 }
2837
2838 libfuzzer_app("api_gradients") {
2839 sources = [
2840 "fuzz/FuzzGradients.cpp",
2841 "fuzz/oss_fuzz/FuzzGradients.cpp",
2842 ]
2843 deps = []
2844 }
2845
2846 libfuzzer_app("api_image_filter") {
2847 include_dirs = [
2848 "tools",
2849 "tools/debugger",
2850 ]
2851 sources = [
2852 "fuzz/FuzzCanvas.cpp",
2853 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2854 "tools/UrlDataManager.cpp",
2855 "tools/debugger/DebugCanvas.cpp",
2856 "tools/debugger/DebugLayerManager.cpp",
2857 "tools/debugger/DrawCommand.cpp",
2858 "tools/debugger/JsonWriteBuffer.cpp",
2859 ]
2860 deps = [ "//third_party/libpng" ]
2861 }
2862
2863 libfuzzer_app("api_path_measure") {
2864 sources = [
2865 "fuzz/FuzzPathMeasure.cpp",
2866 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2867 ]
2868 deps = []
2869 }
2870
2871 libfuzzer_app("api_pathop") {
2872 sources = [
2873 "fuzz/FuzzPathop.cpp",
2874 "fuzz/oss_fuzz/FuzzPathop.cpp",
2875 ]
2876 deps = []
2877 }
2878
2879 libfuzzer_app("api_raster_n32_canvas") {
2880 include_dirs = [
2881 "tools",
2882 "tools/debugger",
2883 "tools/fonts",
2884 ]
2885 sources = [
2886 "fuzz/FuzzCanvas.cpp",
2887 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
2888 "tools/Resources.cpp",
2889 "tools/UrlDataManager.cpp",
2890 "tools/debugger/DebugCanvas.cpp",
2891 "tools/debugger/DebugLayerManager.cpp",
2892 "tools/debugger/DrawCommand.cpp",
2893 "tools/debugger/JsonWriteBuffer.cpp",
2894 "tools/fonts/TestFontMgr.cpp",
2895 "tools/fonts/TestSVGTypeface.cpp",
2896 "tools/fonts/TestTypeface.cpp",
2897 ]
2898 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002899 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002900 "//third_party/libpng",
2901 ]
2902 }
2903
2904 if (skia_use_gl) {
2905 libfuzzer_app("api_mock_gpu_canvas") {
2906 include_dirs = [
2907 "tools",
2908 "tools/debugger",
2909 "tools/fonts",
2910 ]
2911 sources = [
2912 "fuzz/FuzzCanvas.cpp",
2913 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
2914 "tools/LsanSuppressions.cpp",
2915 "tools/Resources.cpp",
2916 "tools/UrlDataManager.cpp",
2917 "tools/debugger/DebugCanvas.cpp",
2918 "tools/debugger/DebugLayerManager.cpp",
2919 "tools/debugger/DrawCommand.cpp",
2920 "tools/debugger/JsonWriteBuffer.cpp",
2921 "tools/fonts/TestFontMgr.cpp",
2922 "tools/fonts/TestSVGTypeface.cpp",
2923 "tools/fonts/TestTypeface.cpp",
2924 ]
2925 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002926 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002927 "//third_party/libpng",
2928 ]
2929 }
2930 }
2931
2932 libfuzzer_app("api_null_canvas") {
2933 include_dirs = [
2934 "tools",
2935 "tools/debugger",
2936 "tools/fonts",
2937 ]
2938 sources = [
2939 "fuzz/FuzzCanvas.cpp",
2940 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
2941 "tools/Resources.cpp",
2942 "tools/UrlDataManager.cpp",
2943 "tools/debugger/DebugCanvas.cpp",
2944 "tools/debugger/DebugLayerManager.cpp",
2945 "tools/debugger/DrawCommand.cpp",
2946 "tools/debugger/JsonWriteBuffer.cpp",
2947 "tools/fonts/TestFontMgr.cpp",
2948 "tools/fonts/TestSVGTypeface.cpp",
2949 "tools/fonts/TestTypeface.cpp",
2950 ]
2951 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002952 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002953 "//third_party/libpng",
2954 ]
2955 }
2956
2957 libfuzzer_app("api_svg_canvas") {
2958 include_dirs = [
2959 "include",
2960 "include/svg",
2961 ]
2962 sources = [
2963 "fuzz/FuzzCanvas.cpp",
2964 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
2965 "tools/Resources.cpp",
2966 "tools/UrlDataManager.cpp",
2967 "tools/debugger/DebugCanvas.cpp",
2968 "tools/debugger/DebugLayerManager.cpp",
2969 "tools/debugger/DrawCommand.cpp",
2970 "tools/debugger/JsonWriteBuffer.cpp",
2971 "tools/fonts/TestFontMgr.cpp",
2972 "tools/fonts/TestSVGTypeface.cpp",
2973 "tools/fonts/TestTypeface.cpp",
2974 ]
2975 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002976 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002977 "//third_party/libpng",
2978 ]
2979 }
2980
2981 libfuzzer_app("png_encoder") {
2982 sources = [
2983 "fuzz/FuzzEncoders.cpp",
2984 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
2985 ]
2986 deps = []
2987 }
2988
2989 libfuzzer_app("jpeg_encoder") {
2990 sources = [
2991 "fuzz/FuzzEncoders.cpp",
2992 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
2993 ]
2994 deps = []
2995 }
2996
2997 libfuzzer_app("webp_encoder") {
2998 sources = [
2999 "fuzz/FuzzEncoders.cpp",
3000 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3001 ]
3002 deps = []
3003 }
3004
3005 libfuzzer_app("skottie_json") {
3006 sources = [
3007 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3008 "tools/Resources.cpp",
3009 "tools/fonts/TestFontMgr.cpp",
3010 "tools/fonts/TestSVGTypeface.cpp",
3011 "tools/fonts/TestTypeface.cpp",
3012 ]
3013 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003014 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003015 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003016 ]
3017 }
3018
3019 libfuzzer_app("skjson") {
3020 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3021 deps = []
3022 }
3023
3024 libfuzzer_app("api_polyutils") {
3025 sources = [
3026 "fuzz/FuzzPolyUtils.cpp",
3027 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3028 ]
3029 deps = [ ":skia" ]
3030 }
3031
3032 libfuzzer_app("android_codec") {
3033 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3034 deps = []
3035 }
3036
3037 libfuzzer_app("image_decode_incremental") {
3038 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3039 deps = []
3040 }
3041
3042 libfuzzer_app("sksl2glsl") {
3043 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3044 deps = []
3045 }
3046
3047 libfuzzer_app("sksl2spirv") {
3048 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3049 deps = []
3050 }
3051
3052 libfuzzer_app("sksl2metal") {
3053 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3054 deps = []
3055 }
3056
3057 libfuzzer_app("sksl2pipeline") {
3058 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3059 deps = []
3060 }
3061
3062 libfuzzer_app("skdescriptor_deserialize") {
3063 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3064 deps = []
3065 }
3066
3067 libfuzzer_app("svg_dom") {
3068 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003069 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003070 }
3071
3072 libfuzzer_app("skruntimeeffect") {
3073 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3074 deps = []
3075 }
3076
3077 libfuzzer_app("skp") {
3078 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3079 deps = []
3080 }
3081 }
mtklein25c81d42016-07-27 13:55:26 -07003082}
Hal Canary932a2c02019-09-17 10:43:18 -04003083
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003084if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003085 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003086 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003087 }
Hal Canary27483062019-12-06 15:01:08 -05003088}
3089
Hal Canary60ff6512020-01-21 12:39:20 -05003090if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003091 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003092 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003093 }
3094}