blob: b3ed087f86581a9b281d659027a788b0c4144a80 [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") {
72 visibility = [ ":*" ]
73
Mike Reeda9e241d2017-05-03 10:52:00 -040074 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050075 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070076 defines += [
77 "SK_GAMMA_EXPONENT=1.4",
78 "SK_GAMMA_CONTRAST=0.0",
79 ]
80 }
Mike Kleinb45d8622019-04-24 14:04:01 -050081 if (is_skia_dev_build) {
82 defines += [
83 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
84 "GR_TEST_UTILS=1",
85 ]
mtklein88a7ac02016-09-14 11:16:49 -070086 }
Brian Salomon789e25e2016-09-30 13:41:03 -040087 libs = []
88 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040089 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050090 defines += [ "SK_ANGLE" ]
91 }
Greg Danielb16beb92020-04-27 14:26:21 +000092 if (skia_use_vma) {
93 defines += [ "SK_USE_VMA" ]
94 }
mtkleinc04ff472016-06-23 10:29:30 -070095}
96
97# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
98config("skia_library") {
99 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000100 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700101}
102
103skia_library_configs = [
104 ":skia_public",
105 ":skia_private",
106 ":skia_library",
107]
108
mtklein9b8583d2016-08-24 17:32:30 -0700109# Use for CPU-specific Skia code that needs particular compiler flags.
110template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500111 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700112 if (invoker.enabled) {
113 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500114 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700115 forward_variables_from(invoker, "*")
116 configs += skia_library_configs
117 }
118 } else {
119 # If not enabled, a phony empty target that swallows all otherwise unused variables.
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 "*",
124 [
125 "sources",
126 "cflags",
127 ])
128 }
129 }
anmittala7eaf2e2016-08-17 13:57:26 -0700130}
131
mtklein422310d2016-08-16 18:28:43 -0700132is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700133
mtklein7d6fb2c2016-08-25 14:50:44 -0700134opts("none") {
135 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700136 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700137 cflags = []
138}
139
mtklein7d6fb2c2016-08-25 14:50:44 -0700140opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700141 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700142 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700143 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700144}
145
146opts("arm64") {
147 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700148 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700149 cflags = []
150}
151
152opts("crc32") {
153 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700154 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700155 cflags = [ "-march=armv8-a+crc" ]
156}
157
mtklein9b8583d2016-08-24 17:32:30 -0700158opts("sse2") {
159 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700160 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400161 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400162 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
163 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400164 cflags = [ "-msse2" ]
165 }
mtklein9b8583d2016-08-24 17:32:30 -0700166}
mtkleinc04ff472016-06-23 10:29:30 -0700167
mtklein9b8583d2016-08-24 17:32:30 -0700168opts("ssse3") {
169 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700170 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400171 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400172 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
173 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400174 cflags = [ "-mssse3" ]
175 }
mtklein9b8583d2016-08-24 17:32:30 -0700176}
mtkleinc04ff472016-06-23 10:29:30 -0700177
mtklein9b8583d2016-08-24 17:32:30 -0700178opts("sse41") {
179 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400181 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400182 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
183 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400184 cflags = [ "-msse4.1" ]
185 }
mtklein9b8583d2016-08-24 17:32:30 -0700186}
mtklein4e976072016-08-08 09:06:27 -0700187
mtklein9b8583d2016-08-24 17:32:30 -0700188opts("sse42") {
189 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700190 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400191 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400192 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
193 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400194 cflags = [ "-msse4.2" ]
195 }
mtklein9b8583d2016-08-24 17:32:30 -0700196}
197
198opts("avx") {
199 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700200 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400201 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000202 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400203 } else {
204 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500205 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500206 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500207 }
Mike Klein3eb71212016-10-11 17:08:53 -0400208 }
mtkleinc04ff472016-06-23 10:29:30 -0700209}
210
Mike Klein1b9b7d52018-02-27 10:37:40 -0500211opts("hsw") {
212 enabled = is_x86
213 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400214 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500215 cflags = [ "/arch:AVX2" ]
216 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000217 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600218 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500219 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600220 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500221 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500222}
223
Mike Kleinad56c4c2020-06-05 06:57:30 -0500224opts("skx") {
225 enabled = is_x86
226 sources = skia_opts.skx_sources
227 if (is_win) {
228 cflags = [ "/arch:AVX512" ]
229 } else {
230 cflags = [ "-march=skylake-avx512" ]
231 if (is_mac && is_debug) {
232 cflags += [ "-fno-stack-check" ] # Work around skia:9709
233 }
234 }
235}
236
mtkleinc095df52016-08-24 12:23:52 -0700237# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700238template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500239 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700240 if (invoker.enabled) {
241 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700242 if (defined(invoker.public_defines)) {
243 defines = invoker.public_defines
244 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600245 if (defined(invoker.public_configs)) {
246 configs = invoker.public_configs
247 }
Hal Canary2dad9902019-11-20 16:01:31 -0500248 if (defined(invoker.public_include_dirs)) {
249 include_dirs = invoker.public_include_dirs
250 }
mtklein457b42a2016-08-23 13:56:37 -0700251 }
252 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500253 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700254 forward_variables_from(invoker,
255 "*",
256 [
257 "public_defines",
258 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700259 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700260 ])
mtklein457b42a2016-08-23 13:56:37 -0700261 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700262 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700263 if (defined(invoker.configs_to_remove)) {
264 configs -= invoker.configs_to_remove
265 }
mtklein457b42a2016-08-23 13:56:37 -0700266 }
267 } else {
mtklein457b42a2016-08-23 13:56:37 -0700268 source_set(target_name) {
269 forward_variables_from(invoker,
270 "*",
271 [
Ben Wagnerea765a32020-06-05 13:42:30 -0400272 "public",
mtklein457b42a2016-08-23 13:56:37 -0700273 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400274 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700275 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700276 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400277 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700278 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700279 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700280 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700281 ])
mtkleincd01b032016-08-31 04:58:19 -0700282 if (defined(invoker.sources_when_disabled)) {
283 sources = invoker.sources_when_disabled
284 }
285 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700286 }
mtkleineb3c4252016-08-23 07:38:09 -0700287 }
mtklein457b42a2016-08-23 13:56:37 -0700288}
mtklein457b42a2016-08-23 13:56:37 -0700289
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400290optional("android_utils") {
291 enabled = skia_enable_android_utils
292
Leon Scroggins III87caae62020-05-04 10:02:45 -0400293 public = [
294 "client_utils/android/BRDAllocator.h",
295 "client_utils/android/BitmapRegionDecoder.h",
296 "client_utils/android/FrontBufferedStream.h",
297 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400298 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400299 sources = [
300 "client_utils/android/BitmapRegionDecoder.cpp",
301 "client_utils/android/FrontBufferedStream.cpp",
302 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400303}
304
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400305group("fontmgr_factory") {
306 public_deps = [ skia_fontmgr_factory ]
307}
308
309optional("fontmgr_empty_factory") {
310 enabled = true
311 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400312}
313
mtkleina45be612016-08-29 15:22:10 -0700314optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500315 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700316
317 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500318 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700319 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700320 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400321 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700322 sources = [
323 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700324 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400325 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700326 ]
327}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400328optional("fontmgr_android_factory") {
329 enabled = skia_enable_fontmgr_android
330 deps = [ ":fontmgr_android" ]
331 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
332}
mtkleina45be612016-08-29 15:22:10 -0700333
mtkleind2e39db2016-09-07 07:52:55 -0700334optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400335 enabled =
336 skia_enable_fontmgr_custom_directory ||
337 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700338
Mike Kleina01c6b02020-04-01 13:47:34 -0500339 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400340 public = [ "src/ports/SkFontMgr_custom.h" ]
341 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
342}
343
344optional("fontmgr_custom_directory") {
345 enabled = skia_enable_fontmgr_custom_directory
346
347 deps = [
348 ":fontmgr_custom",
349 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700350 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400351 public = [ "include/ports/SkFontMgr_directory.h" ]
352 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
353}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400354optional("fontmgr_custom_directory_factory") {
355 enabled = skia_enable_fontmgr_custom_directory
356 deps = [ ":fontmgr_custom_directory" ]
357 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
358}
Ben Wagner75626e42020-06-03 13:20:37 -0400359
360optional("fontmgr_custom_embedded") {
361 enabled = skia_enable_fontmgr_custom_embedded
362
363 deps = [
364 ":fontmgr_custom",
365 ":typeface_freetype",
366 ]
367 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700368}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400369optional("fontmgr_custom_embedded_factory") {
370 enabled = skia_enable_fontmgr_custom_embedded
371 deps = [ ":fontmgr_custom_embedded" ]
372 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
373}
mtkleind2e39db2016-09-07 07:52:55 -0700374
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500375optional("fontmgr_custom_empty") {
376 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500377
Ben Wagner75626e42020-06-03 13:20:37 -0400378 deps = [
379 ":fontmgr_custom",
380 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800381 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400382 public = [ "include/ports/SkFontMgr_empty.h" ]
383 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500384}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400385optional("fontmgr_custom_empty_factory") {
386 enabled = skia_enable_fontmgr_custom_empty
387 deps = [ ":fontmgr_custom_empty" ]
388 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
389}
Hal Canaryff2742e2018-01-30 11:35:47 -0500390
mtklein3cc22182016-08-29 13:26:14 -0700391optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400392 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700393
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400394 # The public header includes fontconfig.h and uses FcConfig*
395 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400396 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400397 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400398 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
399}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400400optional("fontmgr_fontconfig_factory") {
401 enabled = skia_enable_fontmgr_fontconfig
402 deps = [ ":fontmgr_fontconfig" ]
403 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
404}
Ben Wagner75626e42020-06-03 13:20:37 -0400405
406optional("fontmgr_FontConfigInterface") {
407 enabled = skia_enable_fontmgr_FontConfigInterface
408
409 deps = [
410 ":typeface_freetype",
411 "//third_party:fontconfig",
412 ]
413 public = [
414 "include/ports/SkFontConfigInterface.h",
415 "include/ports/SkFontMgr_FontConfigInterface.h",
416 ]
mtklein3cc22182016-08-29 13:26:14 -0700417 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700418 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700419 "src/ports/SkFontConfigInterface_direct.cpp",
420 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400421 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700422 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700423 ]
424}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400425optional("fontmgr_FontConfigInterface_factory") {
426 enabled = skia_enable_fontmgr_FontConfigInterface
427 deps = [ ":fontmgr_FontConfigInterface" ]
428 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
429}
mtklein3cc22182016-08-29 13:26:14 -0700430
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500431optional("fontmgr_fuchsia") {
432 enabled = skia_enable_fontmgr_fuchsia
433
Chinmay Garde89820762019-05-06 16:44:06 -0700434 deps = []
435
436 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700437 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700438 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500439 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700440 }
Ben Wagner75626e42020-06-03 13:20:37 -0400441 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
442 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500443}
444
Ben Wagner75626e42020-06-03 13:20:37 -0400445optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400446 enabled = skia_use_fonthost_mac
447
Ben Wagner75626e42020-06-03 13:20:37 -0400448 public = [
449 "include/ports/SkFontMgr_mac_ct.h",
450 "include/ports/SkTypeface_mac.h",
451 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400452 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400453 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400454 "src/ports/SkScalerContext_mac_ct.cpp",
455 "src/ports/SkScalerContext_mac_ct.h",
456 "src/ports/SkTypeface_mac_ct.cpp",
457 "src/ports/SkTypeface_mac_ct.h",
458 ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400459
460 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400461 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400462 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
463 "AppKit.framework",
464 "ApplicationServices.framework",
465 ]
466 }
467
468 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400469 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400470 "CoreFoundation.framework",
471 "CoreGraphics.framework",
472 "CoreText.framework",
473
474 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
475 "UIKit.framework",
476 ]
477 }
478}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400479optional("fontmgr_mac_ct_factory") {
480 enabled = skia_use_fonthost_mac
481 deps = [ ":fontmgr_mac_ct" ]
482 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
483}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400484
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500485optional("fontmgr_win") {
486 enabled = skia_enable_fontmgr_win
487
Ben Wagner75626e42020-06-03 13:20:37 -0400488 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500489 sources = [
490 "src/fonts/SkFontMgr_indirect.cpp",
491 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500492 "src/ports/SkScalerContext_win_dw.cpp",
493 "src/ports/SkTypeface_win_dw.cpp",
494 ]
495}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400496optional("fontmgr_win_factory") {
497 enabled = skia_enable_fontmgr_win
498 deps = [ ":fontmgr_win" ]
499 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
500}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500501
502optional("fontmgr_win_gdi") {
503 enabled = skia_enable_fontmgr_win_gdi
504
Ben Wagner75626e42020-06-03 13:20:37 -0400505 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500506 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500507 libs = [ "Gdi32.lib" ]
508}
509
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700510if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400511 executable("sksllex") {
512 sources = [
513 "src/sksl/lex/Main.cpp",
514 "src/sksl/lex/NFA.cpp",
515 "src/sksl/lex/RegexNode.cpp",
516 "src/sksl/lex/RegexParser.cpp",
517 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500518 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400519 }
520
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700521 action("run_sksllex") {
522 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500523 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
524 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700525
526 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
527 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
528 outputs = [
529 "$target_out_dir/" +
530 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
531 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
532 # confused due to the same file being named by two different paths
533 ]
534 sksllex_path = "$root_out_dir/"
535 sksllex_path += "sksllex"
536 if (host_os == "win") {
537 sksllex_path += ".exe"
538 }
539 args = [
540 rebase_path(sksllex_path),
541 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400542 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700543 rebase_path("src"),
544 ]
545 }
546} else {
547 group("run_sksllex") {
548 }
549}
550
John Stilesd836f842020-09-14 10:21:44 -0400551# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
552if (skia_compile_processors || skia_compile_sksl_tests) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400553 executable("skslc") {
554 defines = [ "SKSL_STANDALONE" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500555 sources = [ "src/sksl/SkSLMain.cpp" ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400556 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400557 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500558 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400559 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500560 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400561 "//third_party/spirv-tools:spvtools",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400562 ]
563 }
564
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400565 skslc_path = "$root_out_dir/"
566 if (host_toolchain != default_toolchain_name) {
567 skslc_path += "$host_toolchain/"
568 }
569 skslc_path += "skslc"
570 if (host_os == "win") {
571 skslc_path += ".exe"
572 }
573
Brian Osmandd496172020-08-08 08:17:18 -0400574 action("create_sksl_fp") {
575 script = "gn/create_sksl_fp.py"
576 sources = [
577 "include/private/GrSharedEnums.h",
578 "src/sksl/sksl_fp_raw.sksl",
579 ]
580 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
581 args = [
582 rebase_path(sources[0]),
583 rebase_path(sources[1]),
584 rebase_path(outputs[0]),
585 ]
586 }
587
588 copy("sksl_pre_includes") {
589 sources = [
590 "src/sksl/sksl_frag.sksl",
591 "src/sksl/sksl_geom.sksl",
592 "src/sksl/sksl_gpu.sksl",
593 "src/sksl/sksl_interp.sksl",
594 "src/sksl/sksl_pipeline.sksl",
595 "src/sksl/sksl_vert.sksl",
596 ]
597 outputs = [ "$root_out_dir/{{source_file_part}}" ]
598 }
599
600 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
601 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
602
603 dehydrate_sksl_outputs = []
604 foreach(src, dehydrate_sksl_sources) {
605 name = get_path_info(src, "name")
606
607 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
608 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
609 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
610 "src/sksl/generated/$name.dehydrated.sksl",
611 target_out_dir) ]
612 }
613
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400614 action("dehydrate_sksl") {
615 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400616 deps = [
617 ":create_sksl_fp",
618 ":sksl_pre_includes",
619 ":skslc(//gn/toolchain:$host_toolchain)",
620 ]
621 sources = dehydrate_sksl_sources
622 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000623 args = [
624 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400625 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000626 ]
Brian Osmandd496172020-08-08 08:17:18 -0400627 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400628 }
John Stilesd836f842020-09-14 10:21:44 -0400629} else {
630 group("dehydrate_sksl") {
631 }
632}
633
634skia_gpu_processor_outputs = []
635if (skia_compile_processors) {
636 foreach(src, skia_gpu_processor_sources) {
637 dir = get_path_info(src, "dir")
638 name = get_path_info(src, "name")
639
640 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
641 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
642 skia_gpu_processor_outputs += [
643 "$target_out_dir/" +
644 rebase_path("$dir/generated/$name.h", target_out_dir),
645 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
646 # confused due to the same file being named by two different paths
647 ]
648 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400649
Ethan Nicholas762466e2017-06-29 10:03:38 -0400650 action("compile_processors") {
651 script = "gn/compile_processors.py"
652 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400653 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400654 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400655 ":skslc(//gn/toolchain:$host_toolchain)",
656 ]
657 sources = skia_gpu_processor_sources
658 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400659 args = [
660 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400661 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400662 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400663 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400664 args += rebase_path(skia_gpu_processor_sources)
665 }
666} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400667 group("compile_processors") {
668 }
John Stilesd836f842020-09-14 10:21:44 -0400669}
670
671if (skia_compile_sksl_tests) {
672 import("gn/sksl_tests.gni")
673 sksl_fp_tests_outputs = []
674 foreach(src, sksl_fp_tests_sources) {
675 dir = get_path_info(src, "dir")
676 name = get_path_info(src, "name")
677 sksl_fp_tests_outputs += [
678 "$target_out_dir/" + rebase_path("$dir/golden/$name.cpp", target_out_dir),
679 "$target_out_dir/" + rebase_path("$dir/golden/$name.h", target_out_dir),
680 ]
681 }
682
683 sksl_glsl_tests_outputs = []
684 foreach(src, sksl_glsl_tests_sources) {
685 dir = get_path_info(src, "dir")
686 name = get_path_info(src, "name")
687 sksl_glsl_tests_outputs +=
688 [ "$target_out_dir/" +
689 rebase_path("$dir/golden/$name.glsl", target_out_dir) ]
690 }
691
692 action("compile_sksl_tests") {
693 script = "gn/compile_sksl_tests.py"
694 deps = [
695 ":create_sksl_fp",
696 ":sksl_pre_includes",
697 ":skslc(//gn/toolchain:$host_toolchain)",
698 ]
699 sources = sksl_fp_tests_sources + sksl_glsl_tests_sources
700 outputs = sksl_fp_tests_outputs + sksl_glsl_tests_outputs
701 args = [ rebase_path(skslc_path) ]
702 args += rebase_path(sksl_fp_tests_sources)
703 args += rebase_path(sksl_glsl_tests_sources)
704 }
705} else {
706 group("compile_sksl_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400707 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400708}
709
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500710optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700711 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400712 deps = [
713 ":compile_processors",
John Stilesd836f842020-09-14 10:21:44 -0400714 ":compile_sksl_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400715 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700716 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400717 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700718 if (skia_generate_workarounds) {
719 deps += [ ":workaround_list" ]
720 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800721 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600722 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400723 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700724
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400725 sources =
726 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400727 if (!skia_enable_ccpr) {
728 sources -= skia_ccpr_sources
729 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
730 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400731 if (!skia_enable_nvpr) {
732 sources -= skia_nvpr_sources
733 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
734 }
mtklein06c35c02016-09-20 12:28:12 -0700735
Mike Klein703cf5a2016-10-13 17:18:04 -0400736 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400737 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700738
John Rosascoa9b348f2019-11-08 13:18:15 -0800739 if (skia_use_gl) {
740 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400741 if (is_android) {
742 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
743
744 # this lib is required to link against AHardwareBuffer
745 if (defined(ndk_api) && ndk_api >= 26) {
746 libs += [ "android" ]
747 }
748 } else if (skia_use_egl) {
749 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
750 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400751 } else if (skia_use_webgl) {
752 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400753 } else if (is_linux && skia_use_x11) {
754 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
755 libs += [ "GL" ]
756 } else if (is_mac) {
757 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
758 } else if (is_ios) {
759 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
760 } else if (is_win) {
761 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
762 if (target_cpu != "arm64") {
763 libs += [ "OpenGL32.lib" ]
764 }
765 } else {
766 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
767 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800768 sources += skia_gl_gpu_sources
769 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400770
mtkleine9fb3d52016-09-20 15:11:46 -0700771 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400772 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000773 if (skia_use_vma) {
774 deps += [ "third_party/vulkanmemoryallocator" ]
775 }
mtkleine9fb3d52016-09-20 15:11:46 -0700776 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700777 if (skia_enable_vulkan_debug_layers) {
778 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
779 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800780 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800781 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700782 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
783 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400784 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700785 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800786 }
mtkleine9fb3d52016-09-20 15:11:46 -0700787 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400788
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400789 if (is_android && (skia_use_gl || skia_use_vulkan)) {
790 # this lib is required to link against AHardwareBuffer
791 if (defined(ndk_api) && ndk_api >= 26) {
792 libs += [ "android" ]
793 }
794 }
795
Stephen White0d70b712019-07-10 15:51:30 -0400796 if (skia_use_dawn) {
797 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400798 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700799 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400800 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700801 "//third_party/externals/dawn/src/dawn:dawn_proc",
802 "//third_party/externals/dawn/src/dawn:dawncpp",
803 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400804 ]
805 if (dawn_enable_d3d12) {
806 libs += [
807 "d3d12.lib",
808 "dxgi.lib",
809 "d3dcompiler.lib",
810 ]
811 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400812 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400813 }
814 }
815
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500816 if (skia_use_direct3d) {
817 public_defines += [ "SK_DIRECT3D" ]
Brian Osmanc0243912020-02-19 15:35:26 -0500818 deps += [ "//third_party/spirv-cross:spirv_cross" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500819 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500820 if (skia_enable_direct3d_debug_layer) {
821 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
822 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500823 libs += [
824 "d3d12.lib",
825 "dxgi.lib",
826 "d3dcompiler.lib",
827 ]
828 }
829
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400830 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400831 if (skia_use_metal) {
832 public_defines += [ "SK_METAL" ]
833 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400834 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400835 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000836 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400837 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500838
Kevin Lubickf4def342018-10-04 12:52:50 -0400839 if (is_debug) {
840 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
841 }
mtklein06c35c02016-09-20 12:28:12 -0700842}
843
Leon Scroggins III41169202019-01-29 09:29:57 -0500844optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500845 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500846 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
847 if ("True" ==
848 exec_script("gn/checkpath.py",
849 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
850 "trim string")) {
851 public_defines = [ "SK_USE_LIBGIFCODEC" ]
852 public_include_dirs = [
853 ".",
854 skia_libgifcodec_path,
855 ]
856 include_dirs = public_include_dirs
857 import(_libgifcodec_gni_path)
858 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
859 ".",
860 skia_libgifcodec_path)
861 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500862}
863
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400864optional("heif") {
865 enabled = skia_use_libheif
866 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
867
868 deps = []
869
Mike Kleina01c6b02020-04-01 13:47:34 -0500870 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400871}
872
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400873optional("jpeg_decode") {
874 enabled = skia_use_libjpeg_turbo_decode
875 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
876
Mike Kleina01c6b02020-04-01 13:47:34 -0500877 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400878 sources = [
879 "src/codec/SkJpegCodec.cpp",
880 "src/codec/SkJpegDecoderMgr.cpp",
881 "src/codec/SkJpegUtility.cpp",
882 ]
883}
884
885optional("jpeg_encode") {
886 enabled = skia_use_libjpeg_turbo_encode
887 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -0700888
Mike Kleina01c6b02020-04-01 13:47:34 -0500889 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
890 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -0700891 sources = [
mtklein63213812016-08-24 09:55:56 -0700892 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400893 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700894 ]
895}
896
Leon Scroggins III326b9892020-08-05 16:51:10 -0400897optional("ndk_images") {
898 enabled = skia_use_ndk_images
899 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
900 sources = [
901 "src/ports/SkImageEncoder_NDK.cpp",
902 "src/ports/SkImageGeneratorNDK.cpp",
903 "src/ports/SkNDKConversions.cpp",
904 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400905 libs = [ "jnigraphics" ]
906}
907
mtklein63213812016-08-24 09:55:56 -0700908optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500909 enabled = skia_use_zlib && skia_enable_pdf
910 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700911
Mike Kleina01c6b02020-04-01 13:47:34 -0500912 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400913 if (skia_use_libjpeg_turbo_decode) {
914 deps += [ ":jpeg_decode" ]
915 }
916 if (skia_use_libjpeg_turbo_encode) {
917 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400918 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -0400919 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -0700920 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700921 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500922 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
923 deps += [ "//third_party/harfbuzz" ]
924 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
925 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700926 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500927 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700928 }
929}
930
Robert Phillips9b00f1f2020-03-24 12:29:44 -0400931optional("xps") {
932 enabled = skia_use_xps && is_win
933 public_defines = [ "SK_SUPPORT_XPS" ]
934 public = skia_xps_public
935 sources = skia_xps_sources
936}
937
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400938optional("png_decode") {
939 enabled = skia_use_libpng_decode
940 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -0700941
Mike Kleina01c6b02020-04-01 13:47:34 -0500942 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -0700943 sources = [
944 "src/codec/SkIcoCodec.cpp",
945 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400946 ]
947}
948
949optional("png_encode") {
950 enabled = skia_use_libpng_encode
951 public_defines = [ "SK_ENCODE_PNG" ]
952
Mike Kleina01c6b02020-04-01 13:47:34 -0500953 deps = [ "//third_party/libpng" ]
954 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700955}
956
scroggof84ad642016-10-31 09:02:57 -0700957optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400958 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700959 public_defines = [ "SK_CODEC_DECODES_RAW" ]
960
961 deps = [
962 "//third_party/dng_sdk",
963 "//third_party/libjpeg-turbo:libjpeg",
964 "//third_party/piex",
965 ]
966
967 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
968 # Skia.
969 configs_to_remove = [ "//gn:no_exceptions" ]
970
Mike Kleina01c6b02020-04-01 13:47:34 -0500971 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -0700972}
973
Mike Klein852a8cb2018-05-15 10:46:58 -0400974import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400975source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400976 cflags = []
977 if (!is_win || is_clang) {
978 cflags += [
979 "-w",
980 "-std=c11",
981 ]
982 }
983
Mike Kleina01c6b02020-04-01 13:47:34 -0500984 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400985 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400986 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
987}
988
mtklein3cc22182016-08-29 13:26:14 -0700989optional("typeface_freetype") {
990 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700991
Mike Kleina01c6b02020-04-01 13:47:34 -0500992 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -0700993 sources = [
994 "src/ports/SkFontHost_FreeType.cpp",
995 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -0400996 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -0700997 ]
998}
999
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001000optional("webp_decode") {
1001 enabled = skia_use_libwebp_decode
1002 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001003
Mike Kleina01c6b02020-04-01 13:47:34 -05001004 deps = [ "//third_party/libwebp" ]
1005 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001006}
1007
1008optional("webp_encode") {
1009 enabled = skia_use_libwebp_encode
1010 public_defines = [ "SK_ENCODE_WEBP" ]
1011
Mike Kleina01c6b02020-04-01 13:47:34 -05001012 deps = [ "//third_party/libwebp" ]
1013 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001014}
1015
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001016optional("wuffs") {
1017 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001018 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001019
Mike Kleina01c6b02020-04-01 13:47:34 -05001020 deps = [ "//third_party/wuffs" ]
1021 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001022}
1023
mtklein63213812016-08-24 09:55:56 -07001024optional("xml") {
1025 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001026 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001027
Mike Kleina01c6b02020-04-01 13:47:34 -05001028 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001029 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001030 "src/svg/SkSVGCanvas.cpp",
1031 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001032 "src/xml/SkDOM.cpp",
1033 "src/xml/SkXMLParser.cpp",
1034 "src/xml/SkXMLWriter.cpp",
1035 ]
1036}
1037
Mike Klein853d4ed2020-08-20 00:41:00 +00001038optional("sksl_interpreter") {
1039 enabled = skia_enable_sksl_interpreter
1040 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
1041}
1042
Mike Klein613ad382019-06-06 11:42:02 -05001043optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001044 enabled = skia_enable_skvm_jit_when_possible
1045 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001046 if (skia_vtune_path != "") {
1047 public_defines += [ "SKVM_JIT_VTUNE" ]
1048 public_include_dirs = [ "$skia_vtune_path/include" ]
1049 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1050 }
Mike Klein613ad382019-06-06 11:42:02 -05001051}
1052
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001053if (skia_enable_gpu && skia_generate_workarounds) {
1054 action("workaround_list") {
1055 script = "tools/build_workaround_header.py"
1056
Mike Kleina01c6b02020-04-01 13:47:34 -05001057 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001058
1059 # see comments in skia_compile_processors about out dir path shenanigans.
1060 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001061 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001062
Mike Kleina01c6b02020-04-01 13:47:34 -05001063 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001064 args = [
1065 "--output-file",
1066 "$output_file",
1067 ]
1068
1069 foreach(file, inputs) {
1070 args += [ rebase_path(file, root_build_dir) ]
1071 }
1072 }
1073}
1074
mtkleinc04ff472016-06-23 10:29:30 -07001075component("skia") {
1076 public_configs = [ ":skia_public" ]
1077 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001078
Mike Klein607b0a72018-11-07 16:17:34 -05001079 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001080 ":fontmgr_FontConfigInterface",
1081 ":fontmgr_android",
1082 ":fontmgr_custom_directory",
1083 ":fontmgr_custom_embedded",
1084 ":fontmgr_custom_empty",
1085 ":fontmgr_fontconfig",
1086 ":fontmgr_fuchsia",
1087 ":fontmgr_mac_ct",
1088 ":fontmgr_win",
1089 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001090 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001091 ":pdf",
1092 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001093 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001094 ]
1095
mtkleinc04ff472016-06-23 10:29:30 -07001096 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001097 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001098 ":arm64",
1099 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001100 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001101 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001102 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001103 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001104 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001105 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001106 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001107 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001108 ":jpeg_decode",
1109 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001110 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001111 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001112 ":png_decode",
1113 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001114 ":raw",
Mike Klein853d4ed2020-08-20 00:41:00 +00001115 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -05001116 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001117 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001118 ":sse2",
1119 ":sse41",
1120 ":sse42",
1121 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001122 ":webp_decode",
1123 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001124 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001125 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001126 ]
1127
Chinmay Garde43f115c2016-11-16 15:04:12 -08001128 # This file (and all GN files in Skia) are designed to work with an
1129 # empty sources assignment filter; we handle all that explicitly.
1130 # We clear the filter here for clients who may have set up a global filter.
1131 set_sources_assignment_filter([])
1132
Hal Canaryc25f4e92019-02-26 11:54:25 -05001133 public = skia_core_public
1134 public += skia_utils_public
1135 public += skia_effects_public
1136 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001137
mtkleinc04ff472016-06-23 10:29:30 -07001138 sources = []
brettwb9447282016-09-01 14:24:39 -07001139 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001140 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001141 sources += skia_effects_sources
1142 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001143 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001144 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001145 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001146 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001147 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001148 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001149 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001150 "src/codec/SkBmpCodec.cpp",
1151 "src/codec/SkBmpMaskCodec.cpp",
1152 "src/codec/SkBmpRLECodec.cpp",
1153 "src/codec/SkBmpStandardCodec.cpp",
1154 "src/codec/SkCodec.cpp",
1155 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001156 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001157 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001158 "src/codec/SkMaskSwizzler.cpp",
1159 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001160 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001161 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001162 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001163 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001164 "src/codec/SkSwizzler.cpp",
1165 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001166 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001167 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001168 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001169 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001170 "src/ports/SkMemory_malloc.cpp",
1171 "src/ports/SkOSFile_stdio.cpp",
1172 "src/sfnt/SkOTTable_name.cpp",
1173 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001174 ]
brettwb9447282016-09-01 14:24:39 -07001175
Kevin Lubick32dfdbe2018-10-18 09:47:01 -04001176 defines = []
mtklein7d6fb2c2016-08-25 14:50:44 -07001177 libs = []
1178
mtkleinc04ff472016-06-23 10:29:30 -07001179 if (is_win) {
1180 sources += [
1181 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001182 "src/ports/SkImageEncoder_WIC.cpp",
1183 "src/ports/SkImageGeneratorWIC.cpp",
1184 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001185 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001186 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001187 libs += [
1188 "FontSub.lib",
1189 "Ole32.lib",
1190 "OleAut32.lib",
1191 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001192 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001193 ]
mtkleinc04ff472016-06-23 10:29:30 -07001194 } else {
1195 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001196 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001197 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001198 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001199 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001200 }
1201
mtklein7d6fb2c2016-08-25 14:50:44 -07001202 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001203 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001204 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001205 deps += [ "//third_party/cpu-features" ]
1206 }
mtklein06c35c02016-09-20 12:28:12 -07001207 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001208 libs += [
1209 "EGL",
1210 "GLESv2",
1211 "log",
1212 ]
1213 }
1214
Kevin Lubick217056c2018-09-20 17:39:31 -04001215 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001216 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001217 if (skia_use_egl) {
1218 libs += [ "GLESv2" ]
1219 }
mtkleinc04ff472016-06-23 10:29:30 -07001220 }
1221
1222 if (is_mac) {
1223 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001224 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001225 "src/ports/SkImageEncoder_CG.cpp",
1226 "src/ports/SkImageGeneratorCG.cpp",
1227 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001228 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001229 "ApplicationServices.framework",
1230 "OpenGL.framework",
1231 ]
mtkleinc04ff472016-06-23 10:29:30 -07001232 }
abarth6fc8ff02016-07-15 15:15:15 -07001233
Mike Klein7d302882016-11-03 14:06:31 -04001234 if (is_ios) {
1235 sources += [
1236 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001237 "src/ports/SkImageEncoder_CG.cpp",
1238 "src/ports/SkImageGeneratorCG.cpp",
1239 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001240 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001241 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001242 "ImageIO.framework",
1243 "MobileCoreServices.framework",
1244 ]
1245 }
1246
abarth6fc8ff02016-07-15 15:15:15 -07001247 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001248 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001249 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001250
1251 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -04001252 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001253 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1254 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001255
1256 if (skia_include_multiframe_procs) {
1257 sources += [ "tools/SkSharingProc.cpp" ]
1258 }
mtkleinc04ff472016-06-23 10:29:30 -07001259}
1260
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001261# DebugCanvas used in experimental/wasm-skp-debugger
1262if (target_cpu == "wasm") {
1263 static_library("debugcanvas") {
1264 public_configs = [ ":skia_public" ]
1265
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001266 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001267 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001268 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001269 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001270 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001271 "tools/debugger/DrawCommand.cpp",
1272 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001273 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001274 }
1275}
1276
Kevin Lubickcbcff382018-10-02 09:02:18 -04001277static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001278 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001279 public_configs = [ ":skia_public" ]
1280 configs += skia_library_configs
1281
1282 deps = [
1283 ":arm64",
1284 ":armv7",
1285 ":avx",
1286 ":crc32",
1287 ":hsw",
1288 ":none",
1289 ":sse2",
1290 ":sse41",
1291 ":sse42",
1292 ":ssse3",
1293 ]
1294
1295 # This file (and all GN files in Skia) are designed to work with an
1296 # empty sources assignment filter; we handle all that explicitly.
1297 # We clear the filter here for clients who may have set up a global filter.
1298 set_sources_assignment_filter([])
1299
1300 sources = []
1301 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001302 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001303 sources += [
1304 "src/core/SkAnalyticEdge.cpp",
1305 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001306 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001307 "src/core/SkCubicMap.cpp",
1308 "src/core/SkEdge.cpp",
1309 "src/core/SkEdgeBuilder.cpp",
1310 "src/core/SkEdgeClipper.cpp",
1311 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001312 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001313 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001314 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001315 "src/core/SkMallocPixelRef.cpp",
1316 "src/core/SkMath.cpp",
1317 "src/core/SkMatrix.cpp",
1318 "src/core/SkOpts.cpp",
1319 "src/core/SkPaint.cpp",
1320 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001321 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001322 "src/core/SkPathEffect.cpp",
1323 "src/core/SkPathMeasure.cpp",
1324 "src/core/SkPathRef.cpp",
1325 "src/core/SkPoint.cpp",
1326 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001327 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001328 "src/core/SkRect.cpp",
1329 "src/core/SkSemaphore.cpp",
1330 "src/core/SkStream.cpp",
1331 "src/core/SkString.cpp",
1332 "src/core/SkStringUtils.cpp",
1333 "src/core/SkStroke.cpp",
1334 "src/core/SkStrokeRec.cpp",
1335 "src/core/SkStrokerPriv.cpp",
1336 "src/core/SkThreadID.cpp",
1337 "src/core/SkUtils.cpp",
1338 "src/effects/SkDashPathEffect.cpp",
1339 "src/effects/SkTrimPathEffect.cpp",
1340 "src/ports/SkDebug_stdio.cpp",
1341 "src/ports/SkMemory_malloc.cpp",
1342 "src/utils/SkDashPath.cpp",
1343 "src/utils/SkParse.cpp",
1344 "src/utils/SkParsePath.cpp",
1345 "src/utils/SkUTF.cpp",
1346 ]
1347}
1348
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001349group("modules") {
1350 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001351 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001352 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001353 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001354 "modules/skshaper",
1355 ]
1356}
1357
Brian Osmancd28fa62020-07-07 16:01:26 -04001358config("our_vulkan_headers") {
1359 include_dirs = [ "include/third_party/vulkan" ]
1360}
1361
mtkleinc095df52016-08-24 12:23:52 -07001362# Targets guarded by skia_enable_tools may use //third_party freely.
1363if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001364 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001365 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001366 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001367 "include/c",
1368 "include/codec",
1369 "include/config",
1370 "include/core",
1371 "include/docs",
1372 "include/effects",
1373 "include/encode",
1374 "include/gpu",
1375 "include/pathops",
1376 "include/ports",
1377 "include/svg",
1378 "include/utils",
1379 "include/utils/mac",
Julia Lavrova70258c72020-07-15 11:28:57 -04001380 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001381 "modules/skshaper/include",
1382 "modules/skottie/include",
1383 ]
1384
Mike Klein308b5ac2016-12-06 16:03:52 -05001385 # Used by gn_to_bp.py to list our public include dirs.
1386 source_set("public") {
1387 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001388 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001389 }
1390
Mike Kleinc36dedf2016-11-18 09:35:28 -05001391 config("skia.h_config") {
1392 include_dirs = [ "$target_gen_dir" ]
1393 }
1394 action("skia.h") {
1395 public_configs = [ ":skia.h_config" ]
1396 skia_h = "$target_gen_dir/skia.h"
1397 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001398
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001399 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1400 [ rebase_path(skia_h, root_build_dir) ] +
1401 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001402 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001403 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001404 }
1405
Brian Osmanc9a42472018-05-31 13:17:12 -04001406 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001407 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001408 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001409 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001410 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001411 "tools/fiddle/draw.cpp",
1412 "tools/fiddle/fiddle_main.cpp",
1413 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001414
1415 if (skia_use_egl) {
1416 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001417 } else {
1418 sources += [ "tools/fiddle/null_context.cpp" ]
1419 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001420 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001421 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001422 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001423 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001424 ":skia",
1425 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001426 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001427 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001428 ]
1429 }
1430 }
1431
Mike Kleine5463e62020-06-11 13:53:53 -05001432 config("cpp14") {
1433 if (is_win) {
1434 cflags_cc = [ "/std:c++14" ]
1435 } else {
1436 cflags_cc = [ "-std=c++14" ]
1437 }
1438 }
1439
Brian Osmanc9a42472018-05-31 13:17:12 -04001440 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001441 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001442 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001443 configs += [
1444 ":our_vulkan_headers",
1445 ":cpp14",
1446 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001447 deps = [
1448 ":skia",
1449 ":skia.h",
1450 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001451 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001452 ]
Stephen White0d70b712019-07-10 15:51:30 -04001453
1454 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001455 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001456 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001457 }
1458
mtkleinc095df52016-08-24 12:23:52 -07001459 template("test_lib") {
1460 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001461 if (defined(invoker.public_defines)) {
1462 defines = invoker.public_defines
1463 }
mtklein25c81d42016-07-27 13:55:26 -07001464 }
mtkleinc095df52016-08-24 12:23:52 -07001465 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001466 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001467 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001468 public_configs = [
1469 ":" + target_name + "_config",
1470 ":skia_private",
1471 ]
1472
1473 if (!defined(deps)) {
1474 deps = []
1475 }
1476 deps += [ ":skia" ]
1477 testonly = true
1478 }
mtklein25c81d42016-07-27 13:55:26 -07001479 }
mtklein25c81d42016-07-27 13:55:26 -07001480
Mike Kleine6682eb2017-01-05 10:54:57 -05001481 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001482 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001483 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001484 forward_variables_from(invoker,
1485 "*",
1486 [
1487 "output_name",
1488 "visibility",
1489 "is_shared_library",
1490 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001491 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001492 extra_configs = [ ":skia_private" ]
1493 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1494 data_sources = [ "resources" ]
1495 if ("True" == exec_script("//gn/checkdir.py",
1496 [ rebase_path("skps", root_build_dir) ],
1497 "trim string")) {
1498 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001499 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001500 }
1501 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001502 # !is_ios
1503
Jim Van Verth92411c72020-04-03 15:18:31 -04001504 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001505 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1506 shared_library("lib" + target_name) {
1507 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1508 configs += [ ":skia_private" ]
1509 testonly = true
1510 }
1511 } else {
1512 _executable = target_name
1513 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001514 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001515 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1516 configs += [ ":skia_private" ]
1517 testonly = true
1518 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001519 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001520 if (is_android && skia_android_serial != "" && defined(_executable)) {
1521 action("push_" + target_name) {
1522 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001523 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001524 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001525 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001526 args = [
1527 rebase_path("$root_build_dir/$_executable"),
1528 skia_android_serial,
1529 rebase_path(_stamp),
1530 ]
1531 testonly = true
1532 }
Mike Klein7d921032017-01-05 12:20:41 -05001533 }
1534 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001535 }
1536
mtkleinc095df52016-08-24 12:23:52 -07001537 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001538 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001539
Mike Klein9e25bb92019-04-29 09:46:36 -05001540 # Bots and even devs may not have Vulkan headers, so put
1541 # include/third_party/vulkan on our path so they're always available.
1542 all_dependent_configs = [ ":our_vulkan_headers" ]
1543
Mike Klein333fb452019-04-24 08:48:11 -05001544 defines = []
1545 if (skia_enable_discrete_gpu) {
1546 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1547 }
1548
Brian Osmanc9a42472018-05-31 13:17:12 -04001549 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001550 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001551 sources = [
Brian Salomon63a0a752020-06-26 13:32:09 -04001552 "tools/gpu/BackendTextureImageFactory.cpp",
1553 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001554 "tools/gpu/FlushFinishTracker.cpp",
1555 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001556 "tools/gpu/GrContextFactory.cpp",
1557 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001558 "tools/gpu/MemoryCache.cpp",
1559 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001560 "tools/gpu/ProxyUtils.cpp",
1561 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001562 "tools/gpu/TestOps.cpp",
1563 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001564 "tools/gpu/YUVUtils.cpp",
1565 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001566 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1567 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001568 "tools/gpu/mock/MockTestContext.cpp",
1569 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001570
1571 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001572 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001573
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001574 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001575 sources +=
1576 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001577 if (is_ios) {
1578 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001579 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001580 } else if (is_mac) {
1581 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001582 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001583 if (skia_use_angle) {
1584 deps += [ "//third_party/angle2" ]
1585 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1586 }
Brian Salomon1171d312020-03-19 08:47:44 -04001587 }
1588
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001589 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1590 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001591 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001592 if (is_android || skia_use_egl) {
1593 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1594 libs += [ "EGL" ]
1595 } else if (is_linux) {
1596 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1597 libs += [
1598 "GLU",
1599 "GL",
1600 "X11",
1601 ]
1602 } else if (is_win) {
1603 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1604 libs += [ "Gdi32.lib" ]
1605 if (target_cpu != "arm64") {
1606 libs += [ "OpenGL32.lib" ]
1607 }
1608 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001609 }
Greg Daniel54200e42018-12-11 17:03:39 -05001610
Brian Osmanc9a42472018-05-31 13:17:12 -04001611 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001612 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001613 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001614 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1615 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001616 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001617 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001618 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1619 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001620 }
1621 if (skia_use_metal) {
1622 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001623 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001624 if (skia_use_direct3d) {
1625 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001626 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001627 }
Stephen White985741a2019-07-18 11:43:45 -04001628 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001629 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001630 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001631 if (is_clang) {
1632 cflags_cc = [ "-Wno-microsoft-cast" ]
1633 }
Stephen White985741a2019-07-18 11:43:45 -04001634 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001635
1636 if (is_fuchsia && using_fuchsia_sdk) {
1637 libs +=
1638 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1639 }
Jim Van Verth36b86af2020-08-24 17:16:46 +00001640
1641 cflags_objcc = [ "-fobjc-arc" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07001642 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001643
mtkleinc095df52016-08-24 12:23:52 -07001644 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001645 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001646 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001647
1648 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001649 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1650 deps = [ ":flags" ]
1651 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001652 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001653 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001654 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1655 deps = [ ":flags" ]
1656 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001657 }
1658 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001659 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1660 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001661 }
1662 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001663 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1664 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001665 }
mtklein25c81d42016-07-27 13:55:26 -07001666
Mike Klein499f0ac2019-03-25 13:00:12 -05001667 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001668 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001669 sources = [
1670 "tools/trace/ChromeTracingTracer.cpp",
1671 "tools/trace/ChromeTracingTracer.h",
1672 "tools/trace/EventTracingPriv.cpp",
1673 "tools/trace/EventTracingPriv.h",
1674 "tools/trace/SkDebugfTracer.cpp",
1675 "tools/trace/SkDebugfTracer.h",
1676 ]
1677 }
1678
mtkleinc095df52016-08-24 12:23:52 -07001679 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001680 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001681 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001682 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001683 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001684 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001685 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001686 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001687 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001688 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001689 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001690 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001691 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001692 "tools/SkMetaData.cpp",
1693 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001694 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001695 "tools/SkSharingProc.h",
1696 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001697 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001698 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001699 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001700 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001701 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001702 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001703 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001704 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001705 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001706 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001707 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001708 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001709 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001710 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001711 "tools/fonts/TestEmptyTypeface.h",
1712 "tools/fonts/TestFontMgr.cpp",
1713 "tools/fonts/TestFontMgr.h",
1714 "tools/fonts/TestSVGTypeface.cpp",
1715 "tools/fonts/TestSVGTypeface.h",
1716 "tools/fonts/TestTypeface.cpp",
1717 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001718 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001719 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001720 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001721 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001722 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001723 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001724 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001725 if (target_cpu != "wasm") {
1726 sources += [ "tools/CrashHandler.cpp" ]
1727 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001728 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001729 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001730 if (is_ios) {
1731 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001732 sources += [ "tools/ios_utils.h" ]
1733 if (skia_use_metal) {
1734 sources += [ "tools/AutoreleasePool.mm" ]
1735 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001736 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001737 } else if (is_mac) {
1738 if (skia_use_metal) {
1739 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001740 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001741 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001742 } else if (is_win) {
1743 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001744 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001745
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001746 defines = []
1747 if (skia_tools_require_resources) {
1748 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1749 }
mtkleinc095df52016-08-24 12:23:52 -07001750 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001751 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001752 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001753 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001754 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001755 }
mtklein25c81d42016-07-27 13:55:26 -07001756
Mike Kleine11e5c12019-04-24 12:46:06 -05001757 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001758 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001759 }
1760
Mike Klein6e744122016-10-27 12:21:40 -04001761 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001762 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001763 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001764 if (skia_use_gl) {
1765 sources += gl_gm_sources
1766 }
mtkleinc095df52016-08-24 12:23:52 -07001767 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001768 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001769 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001770 ":skia",
1771 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001772 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001773 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001774 "modules/skparagraph",
1775 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001776 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001777 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001778 if (is_skia_dev_build) {
1779 sources += [ "gm/fiddle.cpp" ]
1780 deps += [ ":skia.h" ]
1781 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001782 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001783
1784 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001785 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001786 sources += [ "gm/video_decoder.cpp" ]
1787 }
mtkleinc095df52016-08-24 12:23:52 -07001788 }
mtklein25c81d42016-07-27 13:55:26 -07001789
Mike Klein7b7077c2019-06-03 17:10:59 -05001790 test_lib("skvm_builders") {
1791 sources = [
1792 "tools/SkVMBuilders.cpp",
1793 "tools/SkVMBuilders.h",
1794 ]
1795 }
1796
Mike Klein6e744122016-10-27 12:21:40 -04001797 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001798 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001799 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001800 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001801 if (skia_use_metal) {
1802 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001803 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001804 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001805 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001806 if (skia_use_gl) {
1807 sources += gl_tests_sources
1808 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001809 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001810 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001811 }
Ben Wagner75626e42020-06-03 13:20:37 -04001812 if (!skia_enable_fontmgr_fontconfig) {
Ben Wagner37a06c02018-06-22 21:11:00 +00001813 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1814 }
mtkleinc095df52016-08-24 12:23:52 -07001815 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001816 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001817 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001818 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001819 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001820 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001821 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001822 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001823 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001824 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001825 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001826 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001827 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001828 "//third_party/zlib",
1829 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001830 public_deps = [
1831 ":gpu_tool_utils", # Test.h #includes headers from this target.
1832 ]
mtkleinc095df52016-08-24 12:23:52 -07001833 }
mtklein2f3416d2016-08-02 16:02:05 -07001834
Mike Klein6e744122016-10-27 12:21:40 -04001835 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001836 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001837 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001838 deps = [
1839 ":flags",
1840 ":gm",
1841 ":gpu_tool_utils",
1842 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001843 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001844 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001845 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001846 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001847 ]
1848 }
mtklein2b6870c2016-07-28 14:17:33 -07001849
mtkleinc095df52016-08-24 12:23:52 -07001850 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001851 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001852 sources = [
1853 "experimental/svg/model/SkSVGAttribute.cpp",
1854 "experimental/svg/model/SkSVGAttributeParser.cpp",
1855 "experimental/svg/model/SkSVGCircle.cpp",
1856 "experimental/svg/model/SkSVGClipPath.cpp",
1857 "experimental/svg/model/SkSVGContainer.cpp",
1858 "experimental/svg/model/SkSVGDOM.cpp",
1859 "experimental/svg/model/SkSVGEllipse.cpp",
1860 "experimental/svg/model/SkSVGGradient.cpp",
1861 "experimental/svg/model/SkSVGLine.cpp",
1862 "experimental/svg/model/SkSVGLinearGradient.cpp",
1863 "experimental/svg/model/SkSVGNode.cpp",
1864 "experimental/svg/model/SkSVGPath.cpp",
1865 "experimental/svg/model/SkSVGPattern.cpp",
1866 "experimental/svg/model/SkSVGPoly.cpp",
1867 "experimental/svg/model/SkSVGRadialGradient.cpp",
1868 "experimental/svg/model/SkSVGRect.cpp",
1869 "experimental/svg/model/SkSVGRenderContext.cpp",
1870 "experimental/svg/model/SkSVGSVG.cpp",
1871 "experimental/svg/model/SkSVGShape.cpp",
1872 "experimental/svg/model/SkSVGStop.cpp",
Xavier Phane29cdaf2020-03-26 16:15:14 +00001873 "experimental/svg/model/SkSVGText.cpp",
Hal Canary0f666812018-03-22 15:21:12 -04001874 "experimental/svg/model/SkSVGTransformableNode.cpp",
1875 "experimental/svg/model/SkSVGUse.cpp",
Florin Malitaf4403e72020-04-10 14:14:04 +00001876 "experimental/svg/model/SkSVGValue.cpp",
Hal Canary0f666812018-03-22 15:21:12 -04001877 ]
1878 deps = [
1879 ":skia",
1880 ":xml",
1881 ]
1882 }
mtkleinc095df52016-08-24 12:23:52 -07001883 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001884
Mike Reedd62d4062019-06-12 10:20:44 -04001885 test_lib("experimental_xform") {
1886 sources = [
1887 "experimental/xform/SkShape.cpp",
1888 "experimental/xform/SkXform.cpp",
1889 "experimental/xform/XContext.cpp",
1890 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001891 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04001892 }
1893
Florin Malitabfe876a2018-09-02 12:33:59 -04001894 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001895 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001896 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04001897 }
1898 }
1899
Hal Canary5b39dc82019-04-17 13:29:46 -04001900 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001901 sources = [ "tools/skqp/make_skqp_model.cpp" ]
1902 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04001903 }
1904
Chris Dalton2b598902020-03-25 10:50:35 -06001905 import("gn/samples.gni")
1906 test_lib("samples") {
1907 sources = samples_sources
1908 if (skia_enable_ccpr) {
1909 sources += samples_sources_ccpr
Kevin Lubickebf648e2017-09-21 13:45:16 -04001910 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001911 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06001912 deps = [
1913 ":experimental_svg_model",
1914 ":flags",
1915 ":gpu_tool_utils",
1916 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04001917 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06001918 "modules/skparagraph:samples",
1919 "modules/skshaper",
1920 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001921 }
1922 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10001923 test_app("convert-to-nia") {
1924 sources = [ "tools/convert-to-nia.cpp" ]
1925 deps = [ ":skia" ]
1926 }
Mike Klein7af351a2018-07-27 09:54:43 -04001927 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001928 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04001929 deps = [
1930 ":skcms",
1931 ":skia",
1932 ]
1933 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001934 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001935 sources = [
1936 "tools/HashAndEncode.cpp",
1937 "tools/HashAndEncode.h",
1938 ]
1939 deps = [
1940 ":flags",
1941 ":skia",
1942 "//third_party/libpng",
1943 ]
1944 }
1945 test_app("fm") {
1946 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06001947 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05001948 "tools/fm/fm.cpp",
1949 ]
1950 deps = [
1951 ":common_flags_aa",
1952 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001953 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001954 ":flags",
1955 ":gm",
1956 ":gpu_tool_utils",
1957 ":hash_and_encode",
1958 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06001959 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05001960 ":tool_utils",
1961 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001962 "modules/skottie",
1963 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001964 ]
1965 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001966 test_app("dm") {
1967 sources = [
1968 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001969 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001970 "dm/DMJsonWriter.cpp",
1971 "dm/DMSrcSink.cpp",
1972 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001973 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001974 ":common_flags_aa",
1975 ":common_flags_config",
1976 ":common_flags_gpu",
1977 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001978 ":experimental_svg_model",
1979 ":flags",
1980 ":gm",
1981 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001982 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001983 ":skia",
1984 ":tests",
1985 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001986 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04001987 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04001988 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001989 "modules/skottie:utils",
Mike Klein38af9432016-11-11 11:39:44 -05001990 ]
1991 }
Brian Osman16adfa32016-10-18 14:42:44 -04001992 }
1993
Mike Kleina8a51ce2018-01-09 12:34:11 -05001994 if (!is_win) {
1995 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001996 sources = [ "tools/remote_demo.cpp" ]
1997 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05001998 }
1999 }
2000
Hal Canarye107faa2019-10-23 12:52:33 -04002001 if (!is_win) {
2002 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002003 sources = [ "tools/blob_cache_sim.cpp" ]
2004 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002005 }
2006 }
2007
Mike Kleine6682eb2017-01-05 10:54:57 -05002008 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002009 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002010 deps = [
2011 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002012 ":common_flags_aa",
2013 ":common_flags_config",
2014 ":common_flags_gpu",
2015 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07002016 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07002017 ":flags",
2018 ":gm",
2019 ":gpu_tool_utils",
2020 ":skia",
2021 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002022 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002023 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002024 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07002025 ]
mtklein2b6870c2016-07-28 14:17:33 -07002026 }
halcanary19a97202016-08-03 15:08:04 -07002027
Ravi Mistry10d36c52017-01-31 09:49:18 -05002028 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002029 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002030 deps = [
2031 ":flags",
2032 ":skia",
2033 ]
2034 }
2035
Mike Reedc0ee21f2019-05-28 16:11:03 -04002036 if (skia_use_ffmpeg) {
2037 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002038 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002039 deps = [
2040 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002041 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002042 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002043 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002044 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002045 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002046 ]
2047 }
2048 }
2049
Brian Osmanc9a42472018-05-31 13:17:12 -04002050 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002051 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002052 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002053 ":common_flags_config",
2054 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002055 ":flags",
2056 ":gpu_tool_utils",
2057 ":skia",
2058 ":tool_utils",
2059 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002060 }
2061
Mike Kleine6682eb2017-01-05 10:54:57 -05002062 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002063 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002064 deps = [
2065 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002066 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002067 ]
halcanary3eee9d92016-09-10 07:01:53 -07002068 }
mtklein046cb562016-09-16 10:23:12 -07002069
Ben Wagner219f3622017-07-17 15:32:25 -04002070 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002071 sources = [ "tools/fonts/create_test_font.cpp" ]
2072 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002073 assert_no_deps = [
2074 # tool_utils requires the output of this app.
2075 ":tool_utils",
2076 ]
2077 }
2078
Florin Malita5d3ff432018-07-31 16:38:43 -04002079 if (skia_use_expat) {
2080 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002081 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002082 deps = [
2083 ":flags",
2084 ":skia",
2085 ":tool_utils",
2086 ]
2087 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002088 }
2089
Mike Kleine6682eb2017-01-05 10:54:57 -05002090 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002091 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002092 deps = [
2093 ":flags",
2094 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002095 ]
mtklein046cb562016-09-16 10:23:12 -07002096 }
mtkleinecbc5262016-09-22 11:51:24 -07002097
Brian Osman6788a542018-12-10 11:56:01 -05002098 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002099 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002100 sources = [
2101 "tools/skiaserve/Request.cpp",
2102 "tools/skiaserve/Response.cpp",
2103 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002104 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2105 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2106 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2107 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2108 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2109 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2110 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2111 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2112 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002113 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2114 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002115 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2116 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2117 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2118 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2119 ]
2120 deps = [
2121 ":flags",
2122 ":gpu_tool_utils",
2123 ":skia",
2124 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002125 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002126 ]
Mike Klein7d302882016-11-03 14:06:31 -04002127 }
mtkleinecbc5262016-09-22 11:51:24 -07002128 }
kjlubick14f984b2016-10-03 11:49:45 -07002129
Mike Kleine6682eb2017-01-05 10:54:57 -05002130 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002131 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002132 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002133 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002134 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002135 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002136 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002137 "fuzz/FuzzCreateDDL.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002138 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002139 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002140 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002141 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002142 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002143 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002144 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002145 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002146 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002147 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002148 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2149 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002150 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002151 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002152 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002153 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002154 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2155 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002156 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002157 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2158 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002159 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002160 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002161 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002162 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002163 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002164 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002165 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002166 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002167 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002168 "tools/debugger/DrawCommand.cpp",
2169 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002170 ]
2171 deps = [
2172 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002173 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002174 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002175 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002176 ]
kjlubick14f984b2016-10-03 11:49:45 -07002177 }
Mike Klein38312422016-10-05 15:41:01 -04002178
Mike Kleine6682eb2017-01-05 10:54:57 -05002179 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002180 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002181 rebase_path("tests/skia_test.cpp"),
2182 rebase_path("tests/Test.cpp"),
2183 ]
caryclark9feb6322016-10-25 08:58:26 -07002184 deps = [
2185 ":flags",
2186 ":gpu_tool_utils",
2187 ":skia",
2188 ":tool_utils",
2189 ]
caryclark9feb6322016-10-25 08:58:26 -07002190 }
2191
Mike Kleine6682eb2017-01-05 10:54:57 -05002192 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002193 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002194 deps = [
2195 ":flags",
2196 ":skia",
2197 ]
Mike Klein38312422016-10-05 15:41:01 -04002198 }
bungemanfe917272016-10-13 17:36:40 -04002199
Mike Kleine6682eb2017-01-05 10:54:57 -05002200 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002201 sources = [
2202 "tools/skdiff/skdiff.cpp",
2203 "tools/skdiff/skdiff_html.cpp",
2204 "tools/skdiff/skdiff_main.cpp",
2205 "tools/skdiff/skdiff_utils.cpp",
2206 ]
2207 deps = [
2208 ":skia",
2209 ":tool_utils",
2210 ]
bungemanfe917272016-10-13 17:36:40 -04002211 }
halcanarya73d76a2016-10-17 13:19:02 -07002212
Mike Kleine6682eb2017-01-05 10:54:57 -05002213 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002214 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002215 deps = [
2216 ":skia",
2217 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002218 ]
halcanarya73d76a2016-10-17 13:19:02 -07002219 }
Brian Osman16adfa32016-10-18 14:42:44 -04002220
Brian Osmanc9a42472018-05-31 13:17:12 -04002221 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002222 source_set("skqp_lib") {
2223 check_includes = false
2224 testonly = true
2225 if (!is_official_build) {
2226 configs -= [ "//gn:warnings" ]
2227 }
2228 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002229 defines =
2230 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002231 sources = [
2232 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002233 "tools/skqp/src/skqp.cpp",
2234 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002235 ]
2236 deps = [
2237 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002238 ":skia",
2239 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002240 ":tool_utils",
2241 ]
2242 }
2243 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002244 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002245 include_dirs = [ "//" ]
2246 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002247 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002248 }
2249 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002250 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002251 deps = [
2252 ":gm",
2253 ":skia",
2254 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002255 ]
2256 }
2257 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002258 if (is_fuchsia) {
2259 # Build a package repository for skqp on Fuchsia.
2260 group("skqp_repo") {
2261 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002262 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002263 }
2264 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002265 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002266 shared_library("libskqp_app") {
2267 configs += [ ":skia_private" ]
2268 if (!is_official_build) {
2269 configs -= [ "//gn:warnings" ]
2270 }
2271 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002272 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002273 deps = [
2274 ":skia",
2275 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002276 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002277 ]
2278 libs = [ "android" ]
2279 }
2280 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002281 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002282 test_app("skottie_android") {
2283 is_shared_library = true
2284
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002285 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002286 libs = []
2287
Stan Iliev93151722018-08-02 11:10:52 -04002288 deps = [
2289 ":skia",
2290 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002291 "modules/sksg:samples",
Jorge Betancourt646d6c52020-08-31 16:07:25 -04002292 "//third_party/oboe",
Stan Iliev93151722018-08-02 11:10:52 -04002293 ]
2294 }
2295 }
Hal Canary75427132017-10-11 16:00:31 -04002296
Hal Canarya9de7602018-01-19 13:08:23 -05002297 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002298 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002299 deps = [
2300 ":gm",
2301 ":skia",
2302 ]
2303 }
2304 test_app("list_gpu_unit_tests") {
2305 sources = [
2306 "dm/DMGpuTestProcs.cpp",
2307 "tools/list_gpu_unit_tests.cpp",
2308 ]
2309 deps = [
2310 ":skia",
2311 ":tests",
2312 ]
2313 }
2314
Brian Osmanc9a42472018-05-31 13:17:12 -04002315 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002316 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002317 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002318 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002319 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002320 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002321 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002322 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002323 "tools/sk_app/CommandSet.h",
2324 "tools/sk_app/DisplayParams.h",
2325 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002326 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002327 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002328 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002329 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002330 ]
2331 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002332 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002333
2334 if (is_android) {
2335 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002336 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002337 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002338 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002339 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002340 "tools/sk_app/android/main_android.cpp",
2341 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002342 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002343 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002344 libs += [ "android" ]
2345 } else if (is_linux) {
2346 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002347 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002348 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002349 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002350 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002351 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002352 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002353 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002354 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002355 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002356 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002357 "X11",
2358 ]
2359 } else if (is_win) {
2360 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002361 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002362 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002363 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002364 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002365 "tools/sk_app/win/main_win.cpp",
2366 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002367 } else if (is_mac) {
2368 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002369 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002370 "tools/sk_app/mac/WindowContextFactory_mac.h",
2371 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002372 "tools/sk_app/mac/Window_mac.mm",
2373 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002374 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002375 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002376 "QuartzCore.framework",
2377 "Cocoa.framework",
2378 "Foundation.framework",
2379 ]
2380 } else if (is_ios) {
2381 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002382 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002383 "tools/sk_app/ios/WindowContextFactory_ios.h",
2384 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002385 "tools/sk_app/ios/Window_ios.mm",
2386 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002387 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002388 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002389 }
2390
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002391 if (skia_use_gl) {
2392 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002393 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002394 if (is_android) {
2395 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2396 } else if (is_linux) {
2397 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2398 } else if (is_win) {
2399 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2400 if (skia_use_angle) {
2401 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2402 }
2403 } else if (is_mac) {
2404 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2405 } else if (is_ios) {
2406 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2407 }
2408 }
2409
Brian Osmanc9a42472018-05-31 13:17:12 -04002410 if (skia_use_vulkan) {
2411 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002412 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002413 if (is_android) {
2414 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2415 } else if (is_linux) {
2416 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2417 libs += [ "X11-xcb" ]
2418 } else if (is_win) {
2419 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2420 }
2421 }
2422
Jim Van Verthbe39f712019-02-08 15:36:14 -05002423 if (skia_use_metal) {
2424 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002425 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002426 if (is_mac) {
2427 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002428 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002429 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002430 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002431 }
2432
Jim Van Verth682a2f42020-05-13 16:54:09 -04002433 if (skia_use_direct3d) {
2434 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2435 }
2436
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002437 if (skia_use_dawn) {
2438 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002439 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002440 if (is_linux) {
2441 if (dawn_enable_vulkan) {
2442 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2443 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2444 libs += [ "X11-xcb" ]
2445 }
2446 } else if (is_win) {
2447 if (dawn_enable_d3d12) {
2448 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2449 }
2450 } else if (is_mac) {
2451 if (dawn_enable_metal) {
2452 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2453 }
2454 }
2455 }
2456
Mike Kleina01c6b02020-04-01 13:47:34 -05002457 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002458 if (is_android) {
2459 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002460 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002461 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002462 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002463 }
Brian Osman16adfa32016-10-18 14:42:44 -04002464 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002465
Hal Canary87515122019-03-15 14:22:51 -04002466 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2467 test_app("fiddle_examples") {
2468 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002469 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002470 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002471 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002472 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002473 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002474 cflags = [
2475 "/wd4756", # Overflow in constant arithmetic
2476 "/wd4305", # truncation from 'double' to 'float'
2477 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002478 }
Hal Canary87515122019-03-15 14:22:51 -04002479 deps = [
2480 ":skia",
2481 ":skia.h",
2482 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002483 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002484 ]
2485 }
2486 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002487
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002488 # sk_app can work without GL but viewer always runs raster through a GL window context.
2489 if (skia_use_gl) {
2490 test_app("viewer") {
2491 is_shared_library = is_android
2492 sources = [
2493 "tools/viewer/AnimTimer.h",
2494 "tools/viewer/BisectSlide.cpp",
2495 "tools/viewer/GMSlide.cpp",
2496 "tools/viewer/ImGuiLayer.cpp",
2497 "tools/viewer/ImageSlide.cpp",
2498 "tools/viewer/ParticlesSlide.cpp",
2499 "tools/viewer/SKPSlide.cpp",
2500 "tools/viewer/SampleSlide.cpp",
Florin Malita45cd2002020-06-09 14:00:54 -04002501 "tools/viewer/SkRiveSlide.cpp",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002502 "tools/viewer/SkSLSlide.cpp",
2503 "tools/viewer/SkottieSlide.cpp",
2504 "tools/viewer/SlideDir.cpp",
2505 "tools/viewer/StatsLayer.cpp",
2506 "tools/viewer/SvgSlide.cpp",
2507 "tools/viewer/TouchGesture.cpp",
2508 "tools/viewer/TouchGesture.h",
2509 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002510 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002511 ]
2512 libs = []
2513
2514 deps = [
2515 ":common_flags_gpu",
2516 ":experimental_svg_model",
2517 ":flags",
2518 ":gm",
2519 ":gpu_tool_utils",
2520 ":samples",
2521 ":sk_app",
2522 ":skia",
2523 ":tool_utils",
2524 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002525 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002526 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002527 "modules/particles",
2528 "modules/skottie",
2529 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002530 "modules/sksg:samples",
2531 "//third_party/imgui",
2532 ]
2533 if (skia_use_experimental_xform) {
2534 deps += [ ":experimental_xform" ]
2535 sources += [ "gm/xform.cpp" ]
2536 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002537 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002538 deps += [
2539 "//third_party/spirv-tools:spvtools",
2540
2541 #spvtools depends on this but doesn't deps it in. Looks like upstream bug
2542 #that we replicated in our third_party/spirv-tools/BUILD.gn
2543 "//third_party/spirv-tools:spvtools_val",
2544 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002545 }
Mike Reedd62d4062019-06-12 10:20:44 -04002546 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002547 }
2548
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002549 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002550 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002551 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002552 libs = []
2553
Brian Osmaneff04b52017-11-21 13:18:02 -05002554 deps = [
2555 ":flags",
2556 ":gpu_tool_utils",
2557 ":sk_app",
2558 ":skia",
2559 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002560 ]
2561 }
2562 }
2563
Mike Klein9f6468f2020-05-19 13:14:40 -05002564 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002565 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002566 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002567 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002568 deps = [
2569 ":gpu_tool_utils",
2570 ":skia",
2571 "//third_party/libsdl",
2572 ]
2573 }
2574 }
2575
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002576 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2577 action_foreach("generate_mocs") {
2578 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002579 sources = [ "tools/mdbviz/MainWindow.h" ]
2580 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002581 args = [
2582 "$skia_qt_path" + "/bin/moc",
2583 "{{source}}",
2584 "-o",
2585 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2586 ]
2587 }
2588 action_foreach("generate_resources") {
2589 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002590 sources = [ "tools/mdbviz/resources.qrc" ]
2591 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002592 args = [
2593 "$skia_qt_path" + "/bin/rcc",
2594 "{{source}}",
2595 "-o",
2596 "gen/mdbviz/{{source_name_part}}_res.cpp",
2597 ]
2598 }
2599 test_app("mdbviz") {
2600 if (is_win) {
2601 # on Windows we need to disable some exception handling warnings due to the Qt headers
2602 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2603 }
2604 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002605 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002606 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002607 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002608 "tools/debugger/DrawCommand.cpp",
2609 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002610 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002611 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002612 "tools/mdbviz/main.cpp",
2613
2614 # generated files
2615 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2616 "$target_gen_dir/mdbviz/resources_res.cpp",
2617 ]
2618 lib_dirs = [ "$skia_qt_path/lib" ]
2619 libs = [
2620 "Qt5Core.lib",
2621 "Qt5Gui.lib",
2622 "Qt5Widgets.lib",
2623 ]
2624 include_dirs = [
2625 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002626 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002627 "$skia_qt_path/include/QtWidgets",
2628 ]
2629 deps = [
2630 ":generate_mocs",
2631 ":generate_resources",
2632 ":skia",
2633 ]
2634 }
2635 }
2636
Mike Kleine459afd2017-03-03 09:21:30 -05002637 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002638 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002639 sources = [ "$ndk/$ndk_gdbserver" ]
2640 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002641 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002642 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002643
2644 if (skia_use_opencl) {
2645 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002646 sources = [ "tools/hello-opencl.cpp" ]
2647 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002648 }
2649 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002650
Brian Osmanf564f152019-07-23 15:14:30 -04002651 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002652 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002653 deps = [
2654 ":skia",
2655 "modules/particles",
2656 ]
2657 }
2658
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002659 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002660 test_app("editor") {
2661 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002662 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002663 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002664 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002665
2666 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002667 sources = [ "tools/image_diff_metric.cpp" ]
2668 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002669 }
Chris Dalton2b598902020-03-25 10:50:35 -06002670
2671 group("modules_testonly") {
2672 testonly = true
2673 deps = []
2674 if (target_cpu == "wasm") {
2675 deps += [ "modules/canvaskit:viewer_wasm" ]
2676 }
2677 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002678
2679 if (skia_build_fuzzers) {
2680 template("libfuzzer_app") {
2681 output_dir = root_build_dir
2682 executable(target_name) {
2683 check_includes = false
2684 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2685 configs += [ ":skia_private" ]
2686 sources += [
2687 "fuzz/Fuzz.cpp",
2688 "fuzz/FuzzCommon.cpp",
2689 ]
2690 deps += [
2691 ":flags",
2692 ":gpu_tool_utils",
2693 ":skia",
2694 ]
2695 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2696 if (skia_use_libfuzzer_defaults) {
2697 cflags = [ "-fsanitize=fuzzer" ]
2698 ldflags = [ "-fsanitize=fuzzer" ]
2699 }
2700 testonly = true
2701 }
2702 }
2703
2704 libfuzzer_app("region_deserialize") {
2705 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2706 deps = []
2707 }
2708
2709 libfuzzer_app("image_filter_deserialize") {
2710 include_dirs = [
2711 "tools",
2712 "tools/fonts",
2713 ]
2714 sources = [
2715 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2716 "tools/Resources.cpp",
2717 "tools/fonts/TestFontMgr.cpp",
2718 "tools/fonts/TestSVGTypeface.cpp",
2719 "tools/fonts/TestTypeface.cpp",
2720 ]
2721 deps = [ ":experimental_svg_model" ]
2722 }
2723
2724 libfuzzer_app("region_set_path") {
2725 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2726 deps = []
2727 }
2728
2729 libfuzzer_app("textblob_deserialize") {
2730 include_dirs = [
2731 "tools",
2732 "tools/fonts",
2733 ]
2734 sources = [
2735 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2736 "tools/Resources.cpp",
2737 "tools/fonts/TestFontMgr.cpp",
2738 "tools/fonts/TestSVGTypeface.cpp",
2739 "tools/fonts/TestTypeface.cpp",
2740 ]
2741 deps = [ ":experimental_svg_model" ]
2742 }
2743
2744 libfuzzer_app("path_deserialize") {
2745 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2746 deps = []
2747 }
2748
2749 libfuzzer_app("image_decode") {
2750 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2751 deps = []
2752 }
2753
2754 libfuzzer_app("animated_image_decode") {
2755 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2756 deps = []
2757 }
2758
2759 libfuzzer_app("api_create_ddl") {
2760 include_dirs = [
2761 "include",
2762 "include/gpu",
2763 ]
2764 sources = [
2765 "fuzz/FuzzCreateDDL.cpp",
2766 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2767 "tools/Resources.cpp",
2768 "tools/UrlDataManager.cpp",
2769 "tools/debugger/DebugCanvas.cpp",
2770 "tools/debugger/DebugLayerManager.cpp",
2771 "tools/debugger/DrawCommand.cpp",
2772 "tools/debugger/JsonWriteBuffer.cpp",
2773 "tools/fonts/TestFontMgr.cpp",
2774 "tools/fonts/TestSVGTypeface.cpp",
2775 "tools/fonts/TestTypeface.cpp",
2776 ]
2777 deps = [
2778 ":experimental_svg_model",
2779 "//third_party/libpng",
2780 ]
2781 }
2782
2783 libfuzzer_app("api_draw_functions") {
2784 sources = [
2785 "fuzz/FuzzDrawFunctions.cpp",
2786 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2787 ]
2788 deps = []
2789 }
2790
2791 libfuzzer_app("api_gradients") {
2792 sources = [
2793 "fuzz/FuzzGradients.cpp",
2794 "fuzz/oss_fuzz/FuzzGradients.cpp",
2795 ]
2796 deps = []
2797 }
2798
2799 libfuzzer_app("api_image_filter") {
2800 include_dirs = [
2801 "tools",
2802 "tools/debugger",
2803 ]
2804 sources = [
2805 "fuzz/FuzzCanvas.cpp",
2806 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2807 "tools/UrlDataManager.cpp",
2808 "tools/debugger/DebugCanvas.cpp",
2809 "tools/debugger/DebugLayerManager.cpp",
2810 "tools/debugger/DrawCommand.cpp",
2811 "tools/debugger/JsonWriteBuffer.cpp",
2812 ]
2813 deps = [ "//third_party/libpng" ]
2814 }
2815
2816 libfuzzer_app("api_path_measure") {
2817 sources = [
2818 "fuzz/FuzzPathMeasure.cpp",
2819 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2820 ]
2821 deps = []
2822 }
2823
2824 libfuzzer_app("api_pathop") {
2825 sources = [
2826 "fuzz/FuzzPathop.cpp",
2827 "fuzz/oss_fuzz/FuzzPathop.cpp",
2828 ]
2829 deps = []
2830 }
2831
2832 libfuzzer_app("api_raster_n32_canvas") {
2833 include_dirs = [
2834 "tools",
2835 "tools/debugger",
2836 "tools/fonts",
2837 ]
2838 sources = [
2839 "fuzz/FuzzCanvas.cpp",
2840 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
2841 "tools/Resources.cpp",
2842 "tools/UrlDataManager.cpp",
2843 "tools/debugger/DebugCanvas.cpp",
2844 "tools/debugger/DebugLayerManager.cpp",
2845 "tools/debugger/DrawCommand.cpp",
2846 "tools/debugger/JsonWriteBuffer.cpp",
2847 "tools/fonts/TestFontMgr.cpp",
2848 "tools/fonts/TestSVGTypeface.cpp",
2849 "tools/fonts/TestTypeface.cpp",
2850 ]
2851 deps = [
2852 ":experimental_svg_model",
2853 "//third_party/libpng",
2854 ]
2855 }
2856
2857 if (skia_use_gl) {
2858 libfuzzer_app("api_mock_gpu_canvas") {
2859 include_dirs = [
2860 "tools",
2861 "tools/debugger",
2862 "tools/fonts",
2863 ]
2864 sources = [
2865 "fuzz/FuzzCanvas.cpp",
2866 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
2867 "tools/LsanSuppressions.cpp",
2868 "tools/Resources.cpp",
2869 "tools/UrlDataManager.cpp",
2870 "tools/debugger/DebugCanvas.cpp",
2871 "tools/debugger/DebugLayerManager.cpp",
2872 "tools/debugger/DrawCommand.cpp",
2873 "tools/debugger/JsonWriteBuffer.cpp",
2874 "tools/fonts/TestFontMgr.cpp",
2875 "tools/fonts/TestSVGTypeface.cpp",
2876 "tools/fonts/TestTypeface.cpp",
2877 ]
2878 deps = [
2879 ":experimental_svg_model",
2880 "//third_party/libpng",
2881 ]
2882 }
2883 }
2884
2885 libfuzzer_app("api_null_canvas") {
2886 include_dirs = [
2887 "tools",
2888 "tools/debugger",
2889 "tools/fonts",
2890 ]
2891 sources = [
2892 "fuzz/FuzzCanvas.cpp",
2893 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
2894 "tools/Resources.cpp",
2895 "tools/UrlDataManager.cpp",
2896 "tools/debugger/DebugCanvas.cpp",
2897 "tools/debugger/DebugLayerManager.cpp",
2898 "tools/debugger/DrawCommand.cpp",
2899 "tools/debugger/JsonWriteBuffer.cpp",
2900 "tools/fonts/TestFontMgr.cpp",
2901 "tools/fonts/TestSVGTypeface.cpp",
2902 "tools/fonts/TestTypeface.cpp",
2903 ]
2904 deps = [
2905 ":experimental_svg_model",
2906 "//third_party/libpng",
2907 ]
2908 }
2909
2910 libfuzzer_app("api_svg_canvas") {
2911 include_dirs = [
2912 "include",
2913 "include/svg",
2914 ]
2915 sources = [
2916 "fuzz/FuzzCanvas.cpp",
2917 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
2918 "tools/Resources.cpp",
2919 "tools/UrlDataManager.cpp",
2920 "tools/debugger/DebugCanvas.cpp",
2921 "tools/debugger/DebugLayerManager.cpp",
2922 "tools/debugger/DrawCommand.cpp",
2923 "tools/debugger/JsonWriteBuffer.cpp",
2924 "tools/fonts/TestFontMgr.cpp",
2925 "tools/fonts/TestSVGTypeface.cpp",
2926 "tools/fonts/TestTypeface.cpp",
2927 ]
2928 deps = [
2929 ":experimental_svg_model",
2930 "//third_party/libpng",
2931 ]
2932 }
2933
2934 libfuzzer_app("png_encoder") {
2935 sources = [
2936 "fuzz/FuzzEncoders.cpp",
2937 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
2938 ]
2939 deps = []
2940 }
2941
2942 libfuzzer_app("jpeg_encoder") {
2943 sources = [
2944 "fuzz/FuzzEncoders.cpp",
2945 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
2946 ]
2947 deps = []
2948 }
2949
2950 libfuzzer_app("webp_encoder") {
2951 sources = [
2952 "fuzz/FuzzEncoders.cpp",
2953 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
2954 ]
2955 deps = []
2956 }
2957
2958 libfuzzer_app("skottie_json") {
2959 sources = [
2960 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
2961 "tools/Resources.cpp",
2962 "tools/fonts/TestFontMgr.cpp",
2963 "tools/fonts/TestSVGTypeface.cpp",
2964 "tools/fonts/TestTypeface.cpp",
2965 ]
2966 deps = [
2967 ":experimental_svg_model",
2968 "modules/skottie:skottie",
2969 ]
2970 }
2971
2972 libfuzzer_app("skjson") {
2973 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
2974 deps = []
2975 }
2976
2977 libfuzzer_app("api_polyutils") {
2978 sources = [
2979 "fuzz/FuzzPolyUtils.cpp",
2980 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
2981 ]
2982 deps = [ ":skia" ]
2983 }
2984
2985 libfuzzer_app("android_codec") {
2986 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
2987 deps = []
2988 }
2989
2990 libfuzzer_app("image_decode_incremental") {
2991 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
2992 deps = []
2993 }
2994
2995 libfuzzer_app("sksl2glsl") {
2996 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
2997 deps = []
2998 }
2999
3000 libfuzzer_app("sksl2spirv") {
3001 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3002 deps = []
3003 }
3004
3005 libfuzzer_app("sksl2metal") {
3006 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3007 deps = []
3008 }
3009
3010 libfuzzer_app("sksl2pipeline") {
3011 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3012 deps = []
3013 }
3014
3015 libfuzzer_app("skdescriptor_deserialize") {
3016 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3017 deps = []
3018 }
3019
3020 libfuzzer_app("svg_dom") {
3021 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
3022 deps = [ ":experimental_svg_model" ]
3023 }
3024
3025 libfuzzer_app("skruntimeeffect") {
3026 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3027 deps = []
3028 }
3029
3030 libfuzzer_app("skp") {
3031 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3032 deps = []
3033 }
3034 }
mtklein25c81d42016-07-27 13:55:26 -07003035}
Hal Canary932a2c02019-09-17 10:43:18 -04003036
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003037if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003038 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003039 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003040 }
Hal Canary27483062019-12-06 15:01:08 -05003041}
3042
Hal Canary60ff6512020-01-21 12:39:20 -05003043if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003044 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003045 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003046 }
3047}