blob: f601666ba032f3fe5851a8a008d63badc9f9e21a [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" ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400555 sources = [
556 "src/core/SkMalloc.cpp",
557 "src/core/SkMath.cpp",
558 "src/ports/SkMemory_malloc.cpp",
559 "src/sksl/SkSLMain.cpp",
560 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400561 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400562 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500563 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400564 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500565 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400566 "//third_party/spirv-tools:spvtools",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400567 ]
568 }
569
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400570 skslc_path = "$root_out_dir/"
571 if (host_toolchain != default_toolchain_name) {
572 skslc_path += "$host_toolchain/"
573 }
574 skslc_path += "skslc"
575 if (host_os == "win") {
576 skslc_path += ".exe"
577 }
578
Brian Osmandd496172020-08-08 08:17:18 -0400579 action("create_sksl_fp") {
580 script = "gn/create_sksl_fp.py"
581 sources = [
582 "include/private/GrSharedEnums.h",
583 "src/sksl/sksl_fp_raw.sksl",
584 ]
585 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
586 args = [
587 rebase_path(sources[0]),
588 rebase_path(sources[1]),
589 rebase_path(outputs[0]),
590 ]
591 }
592
593 copy("sksl_pre_includes") {
594 sources = [
595 "src/sksl/sksl_frag.sksl",
596 "src/sksl/sksl_geom.sksl",
597 "src/sksl/sksl_gpu.sksl",
598 "src/sksl/sksl_interp.sksl",
599 "src/sksl/sksl_pipeline.sksl",
600 "src/sksl/sksl_vert.sksl",
601 ]
602 outputs = [ "$root_out_dir/{{source_file_part}}" ]
603 }
604
605 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
606 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
607
608 dehydrate_sksl_outputs = []
609 foreach(src, dehydrate_sksl_sources) {
610 name = get_path_info(src, "name")
611
612 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
613 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
614 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
615 "src/sksl/generated/$name.dehydrated.sksl",
616 target_out_dir) ]
617 }
618
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400619 action("dehydrate_sksl") {
620 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400621 deps = [
622 ":create_sksl_fp",
623 ":sksl_pre_includes",
624 ":skslc(//gn/toolchain:$host_toolchain)",
625 ]
626 sources = dehydrate_sksl_sources
627 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000628 args = [
629 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400630 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000631 ]
Brian Osmandd496172020-08-08 08:17:18 -0400632 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400633 }
John Stilesd836f842020-09-14 10:21:44 -0400634} else {
635 group("dehydrate_sksl") {
636 }
637}
638
639skia_gpu_processor_outputs = []
640if (skia_compile_processors) {
641 foreach(src, skia_gpu_processor_sources) {
642 dir = get_path_info(src, "dir")
643 name = get_path_info(src, "name")
644
645 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
646 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
647 skia_gpu_processor_outputs += [
648 "$target_out_dir/" +
649 rebase_path("$dir/generated/$name.h", target_out_dir),
650 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
651 # confused due to the same file being named by two different paths
652 ]
653 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400654
Ethan Nicholas762466e2017-06-29 10:03:38 -0400655 action("compile_processors") {
656 script = "gn/compile_processors.py"
657 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400658 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400659 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400660 ":skslc(//gn/toolchain:$host_toolchain)",
661 ]
662 sources = skia_gpu_processor_sources
663 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400664 args = [
665 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400666 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400667 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400668 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400669 args += rebase_path(skia_gpu_processor_sources)
670 }
671} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400672 group("compile_processors") {
673 }
John Stilesd836f842020-09-14 10:21:44 -0400674}
675
676if (skia_compile_sksl_tests) {
677 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400678
John Stiles7e248712020-09-24 16:42:09 -0400679 template("compile_sksl") {
680 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
681 action("compile_sksl_${target_name}") {
682 script = "gn/compile_sksl_tests.py"
683 deps = [
684 ":create_sksl_fp",
685 ":sksl_pre_includes",
686 ":skslc(//gn/toolchain:$host_toolchain)",
687 ]
688 sources = invoker.sources
689 outputs = []
690 foreach(src, sources) {
691 dir = get_path_info(src, "dir")
692 name = get_path_info(src, "name")
693 foreach(outputPattern, invoker.outputPatterns) {
694 outputs += [ target_out_dir + "/" + rebase_path(
695 dir + outputPattern[0] + name + outputPattern[1],
696 target_out_dir) ]
697 }
698 }
699 args = [
700 rebase_path(skslc_path),
701 invoker.lang,
702 invoker.settings,
703 ]
704 args += rebase_path(sources)
705 }
John Stilesd836f842020-09-14 10:21:44 -0400706 }
John Stiles7e248712020-09-24 16:42:09 -0400707 compile_sksl("fp_tests") {
708 sources = sksl_fp_tests_sources
709 outputPatterns = [
710 [
711 "/golden/",
712 ".cpp",
713 ],
714 [
715 "/golden/",
716 ".h",
717 ],
718 ]
719 lang = "--fp"
720 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400721 }
John Stiles7e248712020-09-24 16:42:09 -0400722 compile_sksl("glsl_tests") {
723 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
724 outputPatterns = [ [
725 "/golden/",
726 ".glsl",
727 ] ]
728 lang = "--glsl"
729 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400730 }
John Stiles7e248712020-09-24 16:42:09 -0400731 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400732 sources = sksl_glsl_settings_tests_sources
John Stiles7e248712020-09-24 16:42:09 -0400733 outputPatterns = [ [
734 "/golden/",
735 "StandaloneSettings.glsl",
736 ] ]
737 lang = "--glsl"
738 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400739 }
John Stilesaeae3a52020-09-25 13:35:58 -0400740 compile_sksl("metal_tests") {
741 sources = sksl_metal_tests_sources
742 outputPatterns = [ [
743 "/golden/",
744 ".metal",
745 ] ]
746 lang = "--metal"
747 settings = "--settings"
748 }
John Stilesd836f842020-09-14 10:21:44 -0400749} else {
John Stiles7e248712020-09-24 16:42:09 -0400750 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400751 }
John Stiles7e248712020-09-24 16:42:09 -0400752 group("compile_sksl_glsl_tests") {
753 }
754 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400755 }
John Stilesaeae3a52020-09-25 13:35:58 -0400756 group("compile_sksl_metal_tests") {
757 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400758}
759
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500760optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700761 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400762 deps = [
763 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400764 ":compile_sksl_fp_tests",
765 ":compile_sksl_glsl_nosettings_tests",
766 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400767 ":compile_sksl_metal_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400768 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700769 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400770 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700771 if (skia_generate_workarounds) {
772 deps += [ ":workaround_list" ]
773 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800774 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600775 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400776 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700777
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400778 sources =
779 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400780 if (!skia_enable_ccpr) {
781 sources -= skia_ccpr_sources
782 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
783 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400784 if (!skia_enable_nvpr) {
785 sources -= skia_nvpr_sources
786 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
787 }
mtklein06c35c02016-09-20 12:28:12 -0700788
Mike Klein703cf5a2016-10-13 17:18:04 -0400789 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400790 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700791
John Rosascoa9b348f2019-11-08 13:18:15 -0800792 if (skia_use_gl) {
793 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400794 if (is_android) {
795 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
796
797 # this lib is required to link against AHardwareBuffer
798 if (defined(ndk_api) && ndk_api >= 26) {
799 libs += [ "android" ]
800 }
801 } else if (skia_use_egl) {
802 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
803 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400804 } else if (skia_use_webgl) {
805 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400806 } else if (is_linux && skia_use_x11) {
807 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
808 libs += [ "GL" ]
809 } else if (is_mac) {
810 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
811 } else if (is_ios) {
812 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
813 } else if (is_win) {
814 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
815 if (target_cpu != "arm64") {
816 libs += [ "OpenGL32.lib" ]
817 }
818 } else {
819 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
820 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800821 sources += skia_gl_gpu_sources
822 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400823
mtkleine9fb3d52016-09-20 15:11:46 -0700824 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400825 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000826 if (skia_use_vma) {
827 deps += [ "third_party/vulkanmemoryallocator" ]
828 }
mtkleine9fb3d52016-09-20 15:11:46 -0700829 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700830 if (skia_enable_vulkan_debug_layers) {
831 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
832 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800833 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800834 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700835 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
836 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400837 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700838 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800839 }
mtkleine9fb3d52016-09-20 15:11:46 -0700840 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400841
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400842 if (is_android && (skia_use_gl || skia_use_vulkan)) {
843 # this lib is required to link against AHardwareBuffer
844 if (defined(ndk_api) && ndk_api >= 26) {
845 libs += [ "android" ]
846 }
847 }
848
Stephen White0d70b712019-07-10 15:51:30 -0400849 if (skia_use_dawn) {
850 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400851 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700852 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400853 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700854 "//third_party/externals/dawn/src/dawn:dawn_proc",
855 "//third_party/externals/dawn/src/dawn:dawncpp",
856 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400857 ]
858 if (dawn_enable_d3d12) {
859 libs += [
860 "d3d12.lib",
861 "dxgi.lib",
862 "d3dcompiler.lib",
863 ]
864 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400865 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400866 }
867 }
868
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500869 if (skia_use_direct3d) {
870 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400871 deps += [
872 "//third_party/d3d12allocator",
873 "//third_party/spirv-cross:spirv_cross",
874 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500875 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500876 if (skia_enable_direct3d_debug_layer) {
877 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
878 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500879 libs += [
880 "d3d12.lib",
881 "dxgi.lib",
882 "d3dcompiler.lib",
883 ]
884 }
885
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400886 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400887 if (skia_use_metal) {
888 public_defines += [ "SK_METAL" ]
889 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400890 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400891 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000892 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400893 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500894
Kevin Lubickf4def342018-10-04 12:52:50 -0400895 if (is_debug) {
896 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
897 }
mtklein06c35c02016-09-20 12:28:12 -0700898}
899
Leon Scroggins III41169202019-01-29 09:29:57 -0500900optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500901 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500902 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
903 if ("True" ==
904 exec_script("gn/checkpath.py",
905 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
906 "trim string")) {
907 public_defines = [ "SK_USE_LIBGIFCODEC" ]
908 public_include_dirs = [
909 ".",
910 skia_libgifcodec_path,
911 ]
912 include_dirs = public_include_dirs
913 import(_libgifcodec_gni_path)
914 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
915 ".",
916 skia_libgifcodec_path)
917 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500918}
919
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400920optional("heif") {
921 enabled = skia_use_libheif
922 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
923
924 deps = []
925
Mike Kleina01c6b02020-04-01 13:47:34 -0500926 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400927}
928
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400929optional("jpeg_decode") {
930 enabled = skia_use_libjpeg_turbo_decode
931 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
932
Mike Kleina01c6b02020-04-01 13:47:34 -0500933 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400934 sources = [
935 "src/codec/SkJpegCodec.cpp",
936 "src/codec/SkJpegDecoderMgr.cpp",
937 "src/codec/SkJpegUtility.cpp",
938 ]
939}
940
941optional("jpeg_encode") {
942 enabled = skia_use_libjpeg_turbo_encode
943 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -0700944
Mike Kleina01c6b02020-04-01 13:47:34 -0500945 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
946 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -0700947 sources = [
mtklein63213812016-08-24 09:55:56 -0700948 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400949 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700950 ]
951}
952
Leon Scroggins III326b9892020-08-05 16:51:10 -0400953optional("ndk_images") {
954 enabled = skia_use_ndk_images
955 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
956 sources = [
957 "src/ports/SkImageEncoder_NDK.cpp",
958 "src/ports/SkImageGeneratorNDK.cpp",
959 "src/ports/SkNDKConversions.cpp",
960 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -0400961 libs = [ "jnigraphics" ]
962}
963
mtklein63213812016-08-24 09:55:56 -0700964optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500965 enabled = skia_use_zlib && skia_enable_pdf
966 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700967
Mike Kleina01c6b02020-04-01 13:47:34 -0500968 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400969 if (skia_use_libjpeg_turbo_decode) {
970 deps += [ ":jpeg_decode" ]
971 }
972 if (skia_use_libjpeg_turbo_encode) {
973 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400974 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -0400975 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -0700976 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700977 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500978 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
979 deps += [ "//third_party/harfbuzz" ]
980 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
981 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700982 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500983 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700984 }
985}
986
Robert Phillips9b00f1f2020-03-24 12:29:44 -0400987optional("xps") {
988 enabled = skia_use_xps && is_win
989 public_defines = [ "SK_SUPPORT_XPS" ]
990 public = skia_xps_public
991 sources = skia_xps_sources
992}
993
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400994optional("png_decode") {
995 enabled = skia_use_libpng_decode
996 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -0700997
Mike Kleina01c6b02020-04-01 13:47:34 -0500998 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -0700999 sources = [
1000 "src/codec/SkIcoCodec.cpp",
1001 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001002 ]
1003}
1004
1005optional("png_encode") {
1006 enabled = skia_use_libpng_encode
1007 public_defines = [ "SK_ENCODE_PNG" ]
1008
Mike Kleina01c6b02020-04-01 13:47:34 -05001009 deps = [ "//third_party/libpng" ]
1010 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001011}
1012
scroggof84ad642016-10-31 09:02:57 -07001013optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001014 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001015 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1016
1017 deps = [
1018 "//third_party/dng_sdk",
1019 "//third_party/libjpeg-turbo:libjpeg",
1020 "//third_party/piex",
1021 ]
1022
1023 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1024 # Skia.
1025 configs_to_remove = [ "//gn:no_exceptions" ]
1026
Mike Kleina01c6b02020-04-01 13:47:34 -05001027 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001028}
1029
Mike Klein852a8cb2018-05-15 10:46:58 -04001030import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -04001031source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001032 cflags = []
1033 if (!is_win || is_clang) {
1034 cflags += [
1035 "-w",
1036 "-std=c11",
1037 ]
1038 }
1039
Mike Kleina01c6b02020-04-01 13:47:34 -05001040 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001041 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001042 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1043}
1044
mtklein3cc22182016-08-29 13:26:14 -07001045optional("typeface_freetype") {
1046 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001047
Mike Kleina01c6b02020-04-01 13:47:34 -05001048 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001049 sources = [
1050 "src/ports/SkFontHost_FreeType.cpp",
1051 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001052 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001053 ]
1054}
1055
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001056optional("webp_decode") {
1057 enabled = skia_use_libwebp_decode
1058 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001059
Mike Kleina01c6b02020-04-01 13:47:34 -05001060 deps = [ "//third_party/libwebp" ]
1061 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001062}
1063
1064optional("webp_encode") {
1065 enabled = skia_use_libwebp_encode
1066 public_defines = [ "SK_ENCODE_WEBP" ]
1067
Mike Kleina01c6b02020-04-01 13:47:34 -05001068 deps = [ "//third_party/libwebp" ]
1069 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001070}
1071
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001072optional("wuffs") {
1073 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001074 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001075
Mike Kleina01c6b02020-04-01 13:47:34 -05001076 deps = [ "//third_party/wuffs" ]
1077 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001078}
1079
mtklein63213812016-08-24 09:55:56 -07001080optional("xml") {
1081 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001082 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001083
Mike Kleina01c6b02020-04-01 13:47:34 -05001084 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001085 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001086 "src/svg/SkSVGCanvas.cpp",
1087 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001088 "src/xml/SkDOM.cpp",
1089 "src/xml/SkXMLParser.cpp",
1090 "src/xml/SkXMLWriter.cpp",
1091 ]
1092}
1093
Mike Klein853d4ed2020-08-20 00:41:00 +00001094optional("sksl_interpreter") {
1095 enabled = skia_enable_sksl_interpreter
1096 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
1097}
1098
Mike Klein613ad382019-06-06 11:42:02 -05001099optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001100 enabled = skia_enable_skvm_jit_when_possible
1101 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001102 if (skia_vtune_path != "") {
1103 public_defines += [ "SKVM_JIT_VTUNE" ]
1104 public_include_dirs = [ "$skia_vtune_path/include" ]
1105 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1106 }
Mike Klein613ad382019-06-06 11:42:02 -05001107}
1108
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001109if (skia_enable_gpu && skia_generate_workarounds) {
1110 action("workaround_list") {
1111 script = "tools/build_workaround_header.py"
1112
Mike Kleina01c6b02020-04-01 13:47:34 -05001113 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001114
1115 # see comments in skia_compile_processors about out dir path shenanigans.
1116 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001117 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001118
Mike Kleina01c6b02020-04-01 13:47:34 -05001119 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001120 args = [
1121 "--output-file",
1122 "$output_file",
1123 ]
1124
1125 foreach(file, inputs) {
1126 args += [ rebase_path(file, root_build_dir) ]
1127 }
1128 }
1129}
1130
mtkleinc04ff472016-06-23 10:29:30 -07001131component("skia") {
1132 public_configs = [ ":skia_public" ]
1133 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001134
Mike Klein607b0a72018-11-07 16:17:34 -05001135 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001136 ":fontmgr_FontConfigInterface",
1137 ":fontmgr_android",
1138 ":fontmgr_custom_directory",
1139 ":fontmgr_custom_embedded",
1140 ":fontmgr_custom_empty",
1141 ":fontmgr_fontconfig",
1142 ":fontmgr_fuchsia",
1143 ":fontmgr_mac_ct",
1144 ":fontmgr_win",
1145 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001146 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001147 ":pdf",
1148 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001149 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001150 ]
1151
mtkleinc04ff472016-06-23 10:29:30 -07001152 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001153 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001154 ":arm64",
1155 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001156 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001157 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001158 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001159 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001160 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001161 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001162 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001163 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001164 ":jpeg_decode",
1165 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001166 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001167 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001168 ":png_decode",
1169 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001170 ":raw",
Mike Klein853d4ed2020-08-20 00:41:00 +00001171 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -05001172 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001173 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001174 ":sse2",
1175 ":sse41",
1176 ":sse42",
1177 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001178 ":webp_decode",
1179 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001180 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001181 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001182 ]
1183
Chinmay Garde43f115c2016-11-16 15:04:12 -08001184 # This file (and all GN files in Skia) are designed to work with an
1185 # empty sources assignment filter; we handle all that explicitly.
1186 # We clear the filter here for clients who may have set up a global filter.
1187 set_sources_assignment_filter([])
1188
Hal Canaryc25f4e92019-02-26 11:54:25 -05001189 public = skia_core_public
1190 public += skia_utils_public
1191 public += skia_effects_public
1192 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001193
mtkleinc04ff472016-06-23 10:29:30 -07001194 sources = []
brettwb9447282016-09-01 14:24:39 -07001195 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001196 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001197 sources += skia_effects_sources
1198 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001199 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001200 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001201 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001202 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001203 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001204 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001205 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001206 "src/codec/SkBmpCodec.cpp",
1207 "src/codec/SkBmpMaskCodec.cpp",
1208 "src/codec/SkBmpRLECodec.cpp",
1209 "src/codec/SkBmpStandardCodec.cpp",
1210 "src/codec/SkCodec.cpp",
1211 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001212 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001213 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001214 "src/codec/SkMaskSwizzler.cpp",
1215 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001216 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001217 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001218 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001219 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001220 "src/codec/SkSwizzler.cpp",
1221 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001222 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001223 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001224 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001225 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001226 "src/ports/SkMemory_malloc.cpp",
1227 "src/ports/SkOSFile_stdio.cpp",
1228 "src/sfnt/SkOTTable_name.cpp",
1229 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001230 ]
brettwb9447282016-09-01 14:24:39 -07001231
Kevin Lubick32dfdbe2018-10-18 09:47:01 -04001232 defines = []
mtklein7d6fb2c2016-08-25 14:50:44 -07001233 libs = []
1234
mtkleinc04ff472016-06-23 10:29:30 -07001235 if (is_win) {
1236 sources += [
1237 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001238 "src/ports/SkImageEncoder_WIC.cpp",
1239 "src/ports/SkImageGeneratorWIC.cpp",
1240 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001241 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001242 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001243 libs += [
1244 "FontSub.lib",
1245 "Ole32.lib",
1246 "OleAut32.lib",
1247 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001248 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001249 ]
mtkleinc04ff472016-06-23 10:29:30 -07001250 } else {
1251 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001252 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001253 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001254 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001255 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001256 }
1257
mtklein7d6fb2c2016-08-25 14:50:44 -07001258 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001259 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001260 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001261 deps += [ "//third_party/cpu-features" ]
1262 }
mtklein06c35c02016-09-20 12:28:12 -07001263 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001264 libs += [
1265 "EGL",
1266 "GLESv2",
1267 "log",
1268 ]
1269 }
1270
Kevin Lubick217056c2018-09-20 17:39:31 -04001271 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001272 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001273 if (skia_use_egl) {
1274 libs += [ "GLESv2" ]
1275 }
mtkleinc04ff472016-06-23 10:29:30 -07001276 }
1277
1278 if (is_mac) {
1279 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001280 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001281 "src/ports/SkImageEncoder_CG.cpp",
1282 "src/ports/SkImageGeneratorCG.cpp",
1283 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001284 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001285 "ApplicationServices.framework",
1286 "OpenGL.framework",
1287 ]
mtkleinc04ff472016-06-23 10:29:30 -07001288 }
abarth6fc8ff02016-07-15 15:15:15 -07001289
Mike Klein7d302882016-11-03 14:06:31 -04001290 if (is_ios) {
1291 sources += [
1292 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001293 "src/ports/SkImageEncoder_CG.cpp",
1294 "src/ports/SkImageGeneratorCG.cpp",
1295 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001296 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001297 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001298 "ImageIO.framework",
1299 "MobileCoreServices.framework",
1300 ]
1301 }
1302
abarth6fc8ff02016-07-15 15:15:15 -07001303 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001304 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001305 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001306
1307 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -04001308 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001309 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1310 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001311
1312 if (skia_include_multiframe_procs) {
1313 sources += [ "tools/SkSharingProc.cpp" ]
1314 }
mtkleinc04ff472016-06-23 10:29:30 -07001315}
1316
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001317# DebugCanvas used in experimental/wasm-skp-debugger
1318if (target_cpu == "wasm") {
1319 static_library("debugcanvas") {
1320 public_configs = [ ":skia_public" ]
1321
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001322 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001323 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001324 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001325 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001326 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001327 "tools/debugger/DrawCommand.cpp",
1328 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001329 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001330 }
1331}
1332
Kevin Lubickcbcff382018-10-02 09:02:18 -04001333static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001334 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001335 public_configs = [ ":skia_public" ]
1336 configs += skia_library_configs
1337
1338 deps = [
1339 ":arm64",
1340 ":armv7",
1341 ":avx",
1342 ":crc32",
1343 ":hsw",
1344 ":none",
1345 ":sse2",
1346 ":sse41",
1347 ":sse42",
1348 ":ssse3",
1349 ]
1350
1351 # This file (and all GN files in Skia) are designed to work with an
1352 # empty sources assignment filter; we handle all that explicitly.
1353 # We clear the filter here for clients who may have set up a global filter.
1354 set_sources_assignment_filter([])
1355
1356 sources = []
1357 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001358 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001359 sources += [
1360 "src/core/SkAnalyticEdge.cpp",
1361 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001362 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001363 "src/core/SkCubicMap.cpp",
1364 "src/core/SkEdge.cpp",
1365 "src/core/SkEdgeBuilder.cpp",
1366 "src/core/SkEdgeClipper.cpp",
1367 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001368 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001369 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001370 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001371 "src/core/SkMallocPixelRef.cpp",
1372 "src/core/SkMath.cpp",
1373 "src/core/SkMatrix.cpp",
1374 "src/core/SkOpts.cpp",
1375 "src/core/SkPaint.cpp",
1376 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001377 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001378 "src/core/SkPathEffect.cpp",
1379 "src/core/SkPathMeasure.cpp",
1380 "src/core/SkPathRef.cpp",
1381 "src/core/SkPoint.cpp",
1382 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001383 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001384 "src/core/SkRect.cpp",
1385 "src/core/SkSemaphore.cpp",
1386 "src/core/SkStream.cpp",
1387 "src/core/SkString.cpp",
1388 "src/core/SkStringUtils.cpp",
1389 "src/core/SkStroke.cpp",
1390 "src/core/SkStrokeRec.cpp",
1391 "src/core/SkStrokerPriv.cpp",
1392 "src/core/SkThreadID.cpp",
1393 "src/core/SkUtils.cpp",
1394 "src/effects/SkDashPathEffect.cpp",
1395 "src/effects/SkTrimPathEffect.cpp",
1396 "src/ports/SkDebug_stdio.cpp",
1397 "src/ports/SkMemory_malloc.cpp",
1398 "src/utils/SkDashPath.cpp",
1399 "src/utils/SkParse.cpp",
1400 "src/utils/SkParsePath.cpp",
1401 "src/utils/SkUTF.cpp",
1402 ]
1403}
1404
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001405group("modules") {
1406 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001407 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001408 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001409 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001410 "modules/skshaper",
1411 ]
1412}
1413
Brian Osmancd28fa62020-07-07 16:01:26 -04001414config("our_vulkan_headers") {
1415 include_dirs = [ "include/third_party/vulkan" ]
1416}
1417
mtkleinc095df52016-08-24 12:23:52 -07001418# Targets guarded by skia_enable_tools may use //third_party freely.
1419if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001420 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001421 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001422 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001423 "include/c",
1424 "include/codec",
1425 "include/config",
1426 "include/core",
1427 "include/docs",
1428 "include/effects",
1429 "include/encode",
1430 "include/gpu",
1431 "include/pathops",
1432 "include/ports",
1433 "include/svg",
1434 "include/utils",
1435 "include/utils/mac",
Julia Lavrova70258c72020-07-15 11:28:57 -04001436 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001437 "modules/skshaper/include",
1438 "modules/skottie/include",
1439 ]
1440
Mike Klein308b5ac2016-12-06 16:03:52 -05001441 # Used by gn_to_bp.py to list our public include dirs.
1442 source_set("public") {
1443 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001444 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001445 }
1446
Mike Kleinc36dedf2016-11-18 09:35:28 -05001447 config("skia.h_config") {
1448 include_dirs = [ "$target_gen_dir" ]
1449 }
1450 action("skia.h") {
1451 public_configs = [ ":skia.h_config" ]
1452 skia_h = "$target_gen_dir/skia.h"
1453 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001454
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001455 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1456 [ rebase_path(skia_h, root_build_dir) ] +
1457 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001458 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001459 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001460 }
1461
Brian Osmanc9a42472018-05-31 13:17:12 -04001462 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001463 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001464 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001465 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001466 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001467 "tools/fiddle/draw.cpp",
1468 "tools/fiddle/fiddle_main.cpp",
1469 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001470
1471 if (skia_use_egl) {
1472 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001473 } else {
1474 sources += [ "tools/fiddle/null_context.cpp" ]
1475 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001476 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001477 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001478 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001479 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001480 ":skia",
1481 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001482 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001483 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001484 ]
1485 }
1486 }
1487
Mike Kleine5463e62020-06-11 13:53:53 -05001488 config("cpp14") {
1489 if (is_win) {
1490 cflags_cc = [ "/std:c++14" ]
1491 } else {
1492 cflags_cc = [ "-std=c++14" ]
1493 }
1494 }
1495
Brian Osmanc9a42472018-05-31 13:17:12 -04001496 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001497 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001498 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001499 configs += [
1500 ":our_vulkan_headers",
1501 ":cpp14",
1502 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001503 deps = [
1504 ":skia",
1505 ":skia.h",
1506 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001507 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001508 ]
Stephen White0d70b712019-07-10 15:51:30 -04001509
1510 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001511 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001512 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001513 }
1514
mtkleinc095df52016-08-24 12:23:52 -07001515 template("test_lib") {
1516 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001517 if (defined(invoker.public_defines)) {
1518 defines = invoker.public_defines
1519 }
mtklein25c81d42016-07-27 13:55:26 -07001520 }
mtkleinc095df52016-08-24 12:23:52 -07001521 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001522 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001523 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001524 public_configs = [
1525 ":" + target_name + "_config",
1526 ":skia_private",
1527 ]
1528
1529 if (!defined(deps)) {
1530 deps = []
1531 }
1532 deps += [ ":skia" ]
1533 testonly = true
1534 }
mtklein25c81d42016-07-27 13:55:26 -07001535 }
mtklein25c81d42016-07-27 13:55:26 -07001536
Mike Kleine6682eb2017-01-05 10:54:57 -05001537 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001538 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001539 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001540 forward_variables_from(invoker,
1541 "*",
1542 [
1543 "output_name",
1544 "visibility",
1545 "is_shared_library",
1546 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001547 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001548 extra_configs = [ ":skia_private" ]
1549 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1550 data_sources = [ "resources" ]
1551 if ("True" == exec_script("//gn/checkdir.py",
1552 [ rebase_path("skps", root_build_dir) ],
1553 "trim string")) {
1554 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001555 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001556 }
1557 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001558 # !is_ios
1559
Jim Van Verth92411c72020-04-03 15:18:31 -04001560 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001561 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1562 shared_library("lib" + target_name) {
1563 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1564 configs += [ ":skia_private" ]
1565 testonly = true
1566 }
1567 } else {
1568 _executable = target_name
1569 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001570 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001571 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1572 configs += [ ":skia_private" ]
1573 testonly = true
1574 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001575 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001576 if (is_android && skia_android_serial != "" && defined(_executable)) {
1577 action("push_" + target_name) {
1578 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001579 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001580 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001581 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001582 args = [
1583 rebase_path("$root_build_dir/$_executable"),
1584 skia_android_serial,
1585 rebase_path(_stamp),
1586 ]
1587 testonly = true
1588 }
Mike Klein7d921032017-01-05 12:20:41 -05001589 }
1590 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001591 }
1592
mtkleinc095df52016-08-24 12:23:52 -07001593 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001594 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001595
Mike Klein9e25bb92019-04-29 09:46:36 -05001596 # Bots and even devs may not have Vulkan headers, so put
1597 # include/third_party/vulkan on our path so they're always available.
1598 all_dependent_configs = [ ":our_vulkan_headers" ]
1599
Mike Klein333fb452019-04-24 08:48:11 -05001600 defines = []
1601 if (skia_enable_discrete_gpu) {
1602 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1603 }
1604
Brian Osmanc9a42472018-05-31 13:17:12 -04001605 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001606 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001607 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001608 "tools/gpu/BackendSurfaceFactory.cpp",
1609 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001610 "tools/gpu/BackendTextureImageFactory.cpp",
1611 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001612 "tools/gpu/FlushFinishTracker.cpp",
1613 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001614 "tools/gpu/GrContextFactory.cpp",
1615 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001616 "tools/gpu/MemoryCache.cpp",
1617 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001618 "tools/gpu/ProxyUtils.cpp",
1619 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001620 "tools/gpu/TestOps.cpp",
1621 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001622 "tools/gpu/YUVUtils.cpp",
1623 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001624 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1625 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001626 "tools/gpu/mock/MockTestContext.cpp",
1627 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001628
1629 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001630 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001631
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001632 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001633 sources +=
1634 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001635 if (is_ios) {
1636 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001637 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001638 } else if (is_mac) {
1639 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001640 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001641 if (skia_use_angle) {
1642 deps += [ "//third_party/angle2" ]
1643 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1644 }
Brian Salomon1171d312020-03-19 08:47:44 -04001645 }
1646
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001647 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1648 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001649 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001650 if (is_android || skia_use_egl) {
1651 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1652 libs += [ "EGL" ]
1653 } else if (is_linux) {
1654 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1655 libs += [
1656 "GLU",
1657 "GL",
1658 "X11",
1659 ]
1660 } else if (is_win) {
1661 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1662 libs += [ "Gdi32.lib" ]
1663 if (target_cpu != "arm64") {
1664 libs += [ "OpenGL32.lib" ]
1665 }
1666 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001667 }
Greg Daniel54200e42018-12-11 17:03:39 -05001668
Brian Osmanc9a42472018-05-31 13:17:12 -04001669 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001670 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001671 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001672 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1673 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001674 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001675 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001676 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1677 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001678 }
1679 if (skia_use_metal) {
1680 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001681 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001682 if (skia_use_direct3d) {
1683 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001684 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001685 }
Stephen White985741a2019-07-18 11:43:45 -04001686 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001687 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001688 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001689 if (is_clang) {
1690 cflags_cc = [ "-Wno-microsoft-cast" ]
1691 }
Stephen White985741a2019-07-18 11:43:45 -04001692 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001693
1694 if (is_fuchsia && using_fuchsia_sdk) {
1695 libs +=
1696 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1697 }
Jim Van Verth36b86af2020-08-24 17:16:46 +00001698
1699 cflags_objcc = [ "-fobjc-arc" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07001700 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001701
mtkleinc095df52016-08-24 12:23:52 -07001702 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001703 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001704 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001705
1706 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001707 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1708 deps = [ ":flags" ]
1709 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001710 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001711 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001712 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1713 deps = [ ":flags" ]
1714 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001715 }
1716 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001717 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1718 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001719 }
1720 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001721 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1722 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001723 }
mtklein25c81d42016-07-27 13:55:26 -07001724
Mike Klein499f0ac2019-03-25 13:00:12 -05001725 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001726 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001727 sources = [
1728 "tools/trace/ChromeTracingTracer.cpp",
1729 "tools/trace/ChromeTracingTracer.h",
1730 "tools/trace/EventTracingPriv.cpp",
1731 "tools/trace/EventTracingPriv.h",
1732 "tools/trace/SkDebugfTracer.cpp",
1733 "tools/trace/SkDebugfTracer.h",
1734 ]
1735 }
1736
mtkleinc095df52016-08-24 12:23:52 -07001737 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001738 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001739 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001740 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001741 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001742 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001743 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001744 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001745 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001746 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001747 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001748 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001749 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001750 "tools/SkMetaData.cpp",
1751 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001752 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001753 "tools/SkSharingProc.h",
1754 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001755 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001756 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001757 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001758 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001759 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001760 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001761 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001762 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001763 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001764 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001765 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001766 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001767 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001768 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001769 "tools/fonts/TestEmptyTypeface.h",
1770 "tools/fonts/TestFontMgr.cpp",
1771 "tools/fonts/TestFontMgr.h",
1772 "tools/fonts/TestSVGTypeface.cpp",
1773 "tools/fonts/TestSVGTypeface.h",
1774 "tools/fonts/TestTypeface.cpp",
1775 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001776 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001777 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001778 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001779 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001780 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001781 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001782 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001783 if (target_cpu != "wasm") {
1784 sources += [ "tools/CrashHandler.cpp" ]
1785 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001786 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001787 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001788 if (is_ios) {
1789 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001790 sources += [ "tools/ios_utils.h" ]
1791 if (skia_use_metal) {
1792 sources += [ "tools/AutoreleasePool.mm" ]
1793 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001794 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001795 } else if (is_mac) {
1796 if (skia_use_metal) {
1797 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001798 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001799 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001800 } else if (is_win) {
1801 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001802 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001803
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001804 defines = []
1805 if (skia_tools_require_resources) {
1806 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1807 }
mtkleinc095df52016-08-24 12:23:52 -07001808 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001809 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001810 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001811 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001812 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001813 }
mtklein25c81d42016-07-27 13:55:26 -07001814
Mike Kleine11e5c12019-04-24 12:46:06 -05001815 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001816 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001817 }
1818
Mike Klein6e744122016-10-27 12:21:40 -04001819 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001820 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001821 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001822 if (skia_use_gl) {
1823 sources += gl_gm_sources
1824 }
mtkleinc095df52016-08-24 12:23:52 -07001825 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001826 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001827 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001828 ":skia",
1829 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001830 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001831 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001832 "modules/skparagraph",
1833 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001834 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001835 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001836 if (is_skia_dev_build) {
1837 sources += [ "gm/fiddle.cpp" ]
1838 deps += [ ":skia.h" ]
1839 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001840 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001841
1842 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001843 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001844 sources += [ "gm/video_decoder.cpp" ]
1845 }
mtkleinc095df52016-08-24 12:23:52 -07001846 }
mtklein25c81d42016-07-27 13:55:26 -07001847
Mike Klein7b7077c2019-06-03 17:10:59 -05001848 test_lib("skvm_builders") {
1849 sources = [
1850 "tools/SkVMBuilders.cpp",
1851 "tools/SkVMBuilders.h",
1852 ]
1853 }
1854
Mike Klein6e744122016-10-27 12:21:40 -04001855 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001856 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001857 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001858 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001859 if (skia_use_metal) {
1860 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001861 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001862 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001863 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001864 if (skia_use_gl) {
1865 sources += gl_tests_sources
1866 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001867 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001868 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001869 }
Ben Wagner75626e42020-06-03 13:20:37 -04001870 if (!skia_enable_fontmgr_fontconfig) {
Ben Wagner37a06c02018-06-22 21:11:00 +00001871 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1872 }
mtkleinc095df52016-08-24 12:23:52 -07001873 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001874 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001875 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001876 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001877 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001878 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001879 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001880 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001881 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001882 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001883 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001884 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001885 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001886 "//third_party/zlib",
1887 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001888 public_deps = [
1889 ":gpu_tool_utils", # Test.h #includes headers from this target.
1890 ]
mtkleinc095df52016-08-24 12:23:52 -07001891 }
mtklein2f3416d2016-08-02 16:02:05 -07001892
Mike Klein6e744122016-10-27 12:21:40 -04001893 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001894 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001895 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001896 deps = [
1897 ":flags",
1898 ":gm",
1899 ":gpu_tool_utils",
1900 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001901 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001902 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001903 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001904 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001905 ]
1906 }
mtklein2b6870c2016-07-28 14:17:33 -07001907
mtkleinc095df52016-08-24 12:23:52 -07001908 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001909 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001910 sources = [
1911 "experimental/svg/model/SkSVGAttribute.cpp",
1912 "experimental/svg/model/SkSVGAttributeParser.cpp",
1913 "experimental/svg/model/SkSVGCircle.cpp",
1914 "experimental/svg/model/SkSVGClipPath.cpp",
1915 "experimental/svg/model/SkSVGContainer.cpp",
1916 "experimental/svg/model/SkSVGDOM.cpp",
1917 "experimental/svg/model/SkSVGEllipse.cpp",
1918 "experimental/svg/model/SkSVGGradient.cpp",
1919 "experimental/svg/model/SkSVGLine.cpp",
1920 "experimental/svg/model/SkSVGLinearGradient.cpp",
1921 "experimental/svg/model/SkSVGNode.cpp",
1922 "experimental/svg/model/SkSVGPath.cpp",
1923 "experimental/svg/model/SkSVGPattern.cpp",
1924 "experimental/svg/model/SkSVGPoly.cpp",
1925 "experimental/svg/model/SkSVGRadialGradient.cpp",
1926 "experimental/svg/model/SkSVGRect.cpp",
1927 "experimental/svg/model/SkSVGRenderContext.cpp",
1928 "experimental/svg/model/SkSVGSVG.cpp",
1929 "experimental/svg/model/SkSVGShape.cpp",
1930 "experimental/svg/model/SkSVGStop.cpp",
Xavier Phane29cdaf2020-03-26 16:15:14 +00001931 "experimental/svg/model/SkSVGText.cpp",
Hal Canary0f666812018-03-22 15:21:12 -04001932 "experimental/svg/model/SkSVGTransformableNode.cpp",
1933 "experimental/svg/model/SkSVGUse.cpp",
Florin Malitaf4403e72020-04-10 14:14:04 +00001934 "experimental/svg/model/SkSVGValue.cpp",
Hal Canary0f666812018-03-22 15:21:12 -04001935 ]
1936 deps = [
1937 ":skia",
1938 ":xml",
1939 ]
1940 }
mtkleinc095df52016-08-24 12:23:52 -07001941 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001942
Mike Reedd62d4062019-06-12 10:20:44 -04001943 test_lib("experimental_xform") {
1944 sources = [
1945 "experimental/xform/SkShape.cpp",
1946 "experimental/xform/SkXform.cpp",
1947 "experimental/xform/XContext.cpp",
1948 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001949 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04001950 }
1951
Florin Malitabfe876a2018-09-02 12:33:59 -04001952 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001953 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001954 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04001955 }
1956 }
1957
Hal Canary5b39dc82019-04-17 13:29:46 -04001958 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001959 sources = [ "tools/skqp/make_skqp_model.cpp" ]
1960 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04001961 }
1962
Chris Dalton2b598902020-03-25 10:50:35 -06001963 import("gn/samples.gni")
1964 test_lib("samples") {
1965 sources = samples_sources
1966 if (skia_enable_ccpr) {
1967 sources += samples_sources_ccpr
Kevin Lubickebf648e2017-09-21 13:45:16 -04001968 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001969 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06001970 deps = [
1971 ":experimental_svg_model",
1972 ":flags",
1973 ":gpu_tool_utils",
1974 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04001975 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06001976 "modules/skparagraph:samples",
1977 "modules/skshaper",
1978 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001979 }
1980 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10001981 test_app("convert-to-nia") {
1982 sources = [ "tools/convert-to-nia.cpp" ]
1983 deps = [ ":skia" ]
1984 }
Mike Klein7af351a2018-07-27 09:54:43 -04001985 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001986 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04001987 deps = [
1988 ":skcms",
1989 ":skia",
1990 ]
1991 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001992 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001993 sources = [
1994 "tools/HashAndEncode.cpp",
1995 "tools/HashAndEncode.h",
1996 ]
1997 deps = [
1998 ":flags",
1999 ":skia",
2000 "//third_party/libpng",
2001 ]
2002 }
2003 test_app("fm") {
2004 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002005 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002006 "tools/fm/fm.cpp",
2007 ]
2008 deps = [
2009 ":common_flags_aa",
2010 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05002011 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05002012 ":flags",
2013 ":gm",
2014 ":gpu_tool_utils",
2015 ":hash_and_encode",
2016 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002017 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002018 ":tool_utils",
2019 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002020 "modules/skottie",
2021 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002022 ]
2023 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002024 test_app("dm") {
2025 sources = [
2026 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002027 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002028 "dm/DMJsonWriter.cpp",
2029 "dm/DMSrcSink.cpp",
2030 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002031 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002032 ":common_flags_aa",
2033 ":common_flags_config",
2034 ":common_flags_gpu",
2035 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002036 ":experimental_svg_model",
2037 ":flags",
2038 ":gm",
2039 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002040 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002041 ":skia",
2042 ":tests",
2043 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002044 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002045 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002046 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002047 "modules/skottie:utils",
Mike Klein38af9432016-11-11 11:39:44 -05002048 ]
2049 }
Brian Osman16adfa32016-10-18 14:42:44 -04002050 }
2051
Mike Kleina8a51ce2018-01-09 12:34:11 -05002052 if (!is_win) {
2053 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002054 sources = [ "tools/remote_demo.cpp" ]
2055 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002056 }
2057 }
2058
Hal Canarye107faa2019-10-23 12:52:33 -04002059 if (!is_win) {
2060 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002061 sources = [ "tools/blob_cache_sim.cpp" ]
2062 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002063 }
2064 }
2065
Mike Kleine6682eb2017-01-05 10:54:57 -05002066 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002067 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002068 deps = [
2069 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002070 ":common_flags_aa",
2071 ":common_flags_config",
2072 ":common_flags_gpu",
2073 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07002074 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07002075 ":flags",
2076 ":gm",
2077 ":gpu_tool_utils",
2078 ":skia",
2079 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002080 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002081 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002082 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07002083 ]
mtklein2b6870c2016-07-28 14:17:33 -07002084 }
halcanary19a97202016-08-03 15:08:04 -07002085
Ravi Mistry10d36c52017-01-31 09:49:18 -05002086 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002087 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002088 deps = [
2089 ":flags",
2090 ":skia",
2091 ]
2092 }
2093
Mike Reedc0ee21f2019-05-28 16:11:03 -04002094 if (skia_use_ffmpeg) {
2095 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002096 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002097 deps = [
2098 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002099 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002100 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002101 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002102 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002103 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002104 ]
2105 }
2106 }
2107
Brian Osmanc9a42472018-05-31 13:17:12 -04002108 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002109 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002110 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002111 ":common_flags_config",
2112 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002113 ":flags",
2114 ":gpu_tool_utils",
2115 ":skia",
2116 ":tool_utils",
2117 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002118 }
2119
Mike Kleine6682eb2017-01-05 10:54:57 -05002120 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002121 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002122 deps = [
2123 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002124 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002125 ]
halcanary3eee9d92016-09-10 07:01:53 -07002126 }
mtklein046cb562016-09-16 10:23:12 -07002127
Ben Wagner219f3622017-07-17 15:32:25 -04002128 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002129 sources = [ "tools/fonts/create_test_font.cpp" ]
2130 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002131 assert_no_deps = [
2132 # tool_utils requires the output of this app.
2133 ":tool_utils",
2134 ]
2135 }
2136
Florin Malita5d3ff432018-07-31 16:38:43 -04002137 if (skia_use_expat) {
2138 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002139 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002140 deps = [
2141 ":flags",
2142 ":skia",
2143 ":tool_utils",
2144 ]
2145 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002146 }
2147
Mike Kleine6682eb2017-01-05 10:54:57 -05002148 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002149 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002150 deps = [
2151 ":flags",
2152 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002153 ]
mtklein046cb562016-09-16 10:23:12 -07002154 }
mtkleinecbc5262016-09-22 11:51:24 -07002155
Brian Osman6788a542018-12-10 11:56:01 -05002156 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002157 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002158 sources = [
2159 "tools/skiaserve/Request.cpp",
2160 "tools/skiaserve/Response.cpp",
2161 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002162 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2163 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2164 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2165 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2166 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2167 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2168 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2169 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2170 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002171 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2172 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002173 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2174 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2175 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2176 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2177 ]
2178 deps = [
2179 ":flags",
2180 ":gpu_tool_utils",
2181 ":skia",
2182 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002183 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002184 ]
Mike Klein7d302882016-11-03 14:06:31 -04002185 }
mtkleinecbc5262016-09-22 11:51:24 -07002186 }
kjlubick14f984b2016-10-03 11:49:45 -07002187
Mike Kleine6682eb2017-01-05 10:54:57 -05002188 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002189 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002190 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002191 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002192 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002193 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002194 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002195 "fuzz/FuzzCreateDDL.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002196 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002197 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002198 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002199 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002200 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002201 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002202 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002203 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002204 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002205 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002206 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2207 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002208 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002209 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002210 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002211 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002212 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2213 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002214 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002215 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2216 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002217 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002218 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002219 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002220 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002221 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002222 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002223 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002224 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002225 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002226 "tools/debugger/DrawCommand.cpp",
2227 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002228 ]
2229 deps = [
2230 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002231 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002232 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002233 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002234 ]
kjlubick14f984b2016-10-03 11:49:45 -07002235 }
Mike Klein38312422016-10-05 15:41:01 -04002236
Mike Kleine6682eb2017-01-05 10:54:57 -05002237 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002238 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002239 rebase_path("tests/skia_test.cpp"),
2240 rebase_path("tests/Test.cpp"),
2241 ]
caryclark9feb6322016-10-25 08:58:26 -07002242 deps = [
2243 ":flags",
2244 ":gpu_tool_utils",
2245 ":skia",
2246 ":tool_utils",
2247 ]
caryclark9feb6322016-10-25 08:58:26 -07002248 }
2249
Mike Kleine6682eb2017-01-05 10:54:57 -05002250 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002251 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002252 deps = [
2253 ":flags",
2254 ":skia",
2255 ]
Mike Klein38312422016-10-05 15:41:01 -04002256 }
bungemanfe917272016-10-13 17:36:40 -04002257
Mike Kleine6682eb2017-01-05 10:54:57 -05002258 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002259 sources = [
2260 "tools/skdiff/skdiff.cpp",
2261 "tools/skdiff/skdiff_html.cpp",
2262 "tools/skdiff/skdiff_main.cpp",
2263 "tools/skdiff/skdiff_utils.cpp",
2264 ]
2265 deps = [
2266 ":skia",
2267 ":tool_utils",
2268 ]
bungemanfe917272016-10-13 17:36:40 -04002269 }
halcanarya73d76a2016-10-17 13:19:02 -07002270
Mike Kleine6682eb2017-01-05 10:54:57 -05002271 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002272 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002273 deps = [
2274 ":skia",
2275 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002276 ]
halcanarya73d76a2016-10-17 13:19:02 -07002277 }
Brian Osman16adfa32016-10-18 14:42:44 -04002278
Brian Osmanc9a42472018-05-31 13:17:12 -04002279 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002280 source_set("skqp_lib") {
2281 check_includes = false
2282 testonly = true
2283 if (!is_official_build) {
2284 configs -= [ "//gn:warnings" ]
2285 }
2286 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002287 defines =
2288 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002289 sources = [
2290 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002291 "tools/skqp/src/skqp.cpp",
2292 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002293 ]
2294 deps = [
2295 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002296 ":skia",
2297 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002298 ":tool_utils",
2299 ]
2300 }
2301 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002302 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002303 include_dirs = [ "//" ]
2304 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002305 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002306 }
2307 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002308 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002309 deps = [
2310 ":gm",
2311 ":skia",
2312 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002313 ]
2314 }
2315 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002316 if (is_fuchsia) {
2317 # Build a package repository for skqp on Fuchsia.
2318 group("skqp_repo") {
2319 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002320 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002321 }
2322 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002323 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002324 shared_library("libskqp_app") {
2325 configs += [ ":skia_private" ]
2326 if (!is_official_build) {
2327 configs -= [ "//gn:warnings" ]
2328 }
2329 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002330 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002331 deps = [
2332 ":skia",
2333 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002334 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002335 ]
2336 libs = [ "android" ]
2337 }
2338 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002339 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002340 test_app("skottie_android") {
2341 is_shared_library = true
2342
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002343 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002344 libs = []
2345
Stan Iliev93151722018-08-02 11:10:52 -04002346 deps = [
2347 ":skia",
2348 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002349 "modules/sksg:samples",
Jorge Betancourt646d6c52020-08-31 16:07:25 -04002350 "//third_party/oboe",
Stan Iliev93151722018-08-02 11:10:52 -04002351 ]
2352 }
2353 }
Hal Canary75427132017-10-11 16:00:31 -04002354
Hal Canarya9de7602018-01-19 13:08:23 -05002355 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002356 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002357 deps = [
2358 ":gm",
2359 ":skia",
2360 ]
2361 }
2362 test_app("list_gpu_unit_tests") {
2363 sources = [
2364 "dm/DMGpuTestProcs.cpp",
2365 "tools/list_gpu_unit_tests.cpp",
2366 ]
2367 deps = [
2368 ":skia",
2369 ":tests",
2370 ]
2371 }
2372
Brian Osmanc9a42472018-05-31 13:17:12 -04002373 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002374 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002375 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002376 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002377 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002378 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002379 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002380 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002381 "tools/sk_app/CommandSet.h",
2382 "tools/sk_app/DisplayParams.h",
2383 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002384 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002385 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002386 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002387 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002388 ]
2389 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002390 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002391
2392 if (is_android) {
2393 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002394 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002395 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002396 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002397 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002398 "tools/sk_app/android/main_android.cpp",
2399 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002400 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002401 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002402 libs += [ "android" ]
2403 } else if (is_linux) {
2404 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002405 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002406 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002407 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002408 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002409 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002410 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002411 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002412 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002413 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002414 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002415 "X11",
2416 ]
2417 } else if (is_win) {
2418 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002419 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002420 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002421 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002422 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002423 "tools/sk_app/win/main_win.cpp",
2424 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002425 } else if (is_mac) {
2426 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002427 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002428 "tools/sk_app/mac/WindowContextFactory_mac.h",
2429 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002430 "tools/sk_app/mac/Window_mac.mm",
2431 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002432 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002433 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002434 "QuartzCore.framework",
2435 "Cocoa.framework",
2436 "Foundation.framework",
2437 ]
2438 } else if (is_ios) {
2439 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002440 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002441 "tools/sk_app/ios/WindowContextFactory_ios.h",
2442 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002443 "tools/sk_app/ios/Window_ios.mm",
2444 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002445 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002446 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002447 }
2448
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002449 if (skia_use_gl) {
2450 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002451 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002452 if (is_android) {
2453 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2454 } else if (is_linux) {
2455 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2456 } else if (is_win) {
2457 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2458 if (skia_use_angle) {
2459 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2460 }
2461 } else if (is_mac) {
2462 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2463 } else if (is_ios) {
2464 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2465 }
2466 }
2467
Brian Osmanc9a42472018-05-31 13:17:12 -04002468 if (skia_use_vulkan) {
2469 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002470 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002471 if (is_android) {
2472 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2473 } else if (is_linux) {
2474 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2475 libs += [ "X11-xcb" ]
2476 } else if (is_win) {
2477 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2478 }
2479 }
2480
Jim Van Verthbe39f712019-02-08 15:36:14 -05002481 if (skia_use_metal) {
2482 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002483 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002484 if (is_mac) {
2485 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002486 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002487 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002488 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002489 }
2490
Jim Van Verth682a2f42020-05-13 16:54:09 -04002491 if (skia_use_direct3d) {
2492 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2493 }
2494
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002495 if (skia_use_dawn) {
2496 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002497 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002498 if (is_linux) {
2499 if (dawn_enable_vulkan) {
2500 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2501 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2502 libs += [ "X11-xcb" ]
2503 }
2504 } else if (is_win) {
2505 if (dawn_enable_d3d12) {
2506 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2507 }
2508 } else if (is_mac) {
2509 if (dawn_enable_metal) {
2510 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2511 }
2512 }
2513 }
2514
Mike Kleina01c6b02020-04-01 13:47:34 -05002515 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002516 if (is_android) {
2517 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002518 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002519 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002520 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002521 }
Brian Osman16adfa32016-10-18 14:42:44 -04002522 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002523
Hal Canary87515122019-03-15 14:22:51 -04002524 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2525 test_app("fiddle_examples") {
2526 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002527 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002528 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002529 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002530 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002531 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002532 cflags = [
2533 "/wd4756", # Overflow in constant arithmetic
2534 "/wd4305", # truncation from 'double' to 'float'
2535 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002536 }
Hal Canary87515122019-03-15 14:22:51 -04002537 deps = [
2538 ":skia",
2539 ":skia.h",
2540 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002541 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002542 ]
2543 }
2544 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002545
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002546 # sk_app can work without GL but viewer always runs raster through a GL window context.
2547 if (skia_use_gl) {
2548 test_app("viewer") {
2549 is_shared_library = is_android
2550 sources = [
2551 "tools/viewer/AnimTimer.h",
2552 "tools/viewer/BisectSlide.cpp",
2553 "tools/viewer/GMSlide.cpp",
2554 "tools/viewer/ImGuiLayer.cpp",
2555 "tools/viewer/ImageSlide.cpp",
2556 "tools/viewer/ParticlesSlide.cpp",
2557 "tools/viewer/SKPSlide.cpp",
2558 "tools/viewer/SampleSlide.cpp",
Florin Malita45cd2002020-06-09 14:00:54 -04002559 "tools/viewer/SkRiveSlide.cpp",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002560 "tools/viewer/SkSLSlide.cpp",
2561 "tools/viewer/SkottieSlide.cpp",
2562 "tools/viewer/SlideDir.cpp",
2563 "tools/viewer/StatsLayer.cpp",
2564 "tools/viewer/SvgSlide.cpp",
2565 "tools/viewer/TouchGesture.cpp",
2566 "tools/viewer/TouchGesture.h",
2567 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002568 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002569 ]
2570 libs = []
2571
2572 deps = [
2573 ":common_flags_gpu",
2574 ":experimental_svg_model",
2575 ":flags",
2576 ":gm",
2577 ":gpu_tool_utils",
2578 ":samples",
2579 ":sk_app",
2580 ":skia",
2581 ":tool_utils",
2582 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002583 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002584 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002585 "modules/particles",
2586 "modules/skottie",
2587 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002588 "modules/sksg:samples",
2589 "//third_party/imgui",
2590 ]
2591 if (skia_use_experimental_xform) {
2592 deps += [ ":experimental_xform" ]
2593 sources += [ "gm/xform.cpp" ]
2594 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002595 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002596 deps += [
2597 "//third_party/spirv-tools:spvtools",
2598
2599 #spvtools depends on this but doesn't deps it in. Looks like upstream bug
2600 #that we replicated in our third_party/spirv-tools/BUILD.gn
2601 "//third_party/spirv-tools:spvtools_val",
2602 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002603 }
Mike Reedd62d4062019-06-12 10:20:44 -04002604 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002605 }
2606
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002607 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002608 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002609 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002610 libs = []
2611
Brian Osmaneff04b52017-11-21 13:18:02 -05002612 deps = [
2613 ":flags",
2614 ":gpu_tool_utils",
2615 ":sk_app",
2616 ":skia",
2617 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002618 ]
2619 }
2620 }
2621
Mike Klein9f6468f2020-05-19 13:14:40 -05002622 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002623 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002624 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002625 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002626 deps = [
2627 ":gpu_tool_utils",
2628 ":skia",
2629 "//third_party/libsdl",
2630 ]
2631 }
2632 }
2633
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002634 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2635 action_foreach("generate_mocs") {
2636 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002637 sources = [ "tools/mdbviz/MainWindow.h" ]
2638 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002639 args = [
2640 "$skia_qt_path" + "/bin/moc",
2641 "{{source}}",
2642 "-o",
2643 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2644 ]
2645 }
2646 action_foreach("generate_resources") {
2647 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002648 sources = [ "tools/mdbviz/resources.qrc" ]
2649 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002650 args = [
2651 "$skia_qt_path" + "/bin/rcc",
2652 "{{source}}",
2653 "-o",
2654 "gen/mdbviz/{{source_name_part}}_res.cpp",
2655 ]
2656 }
2657 test_app("mdbviz") {
2658 if (is_win) {
2659 # on Windows we need to disable some exception handling warnings due to the Qt headers
2660 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2661 }
2662 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002663 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002664 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002665 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002666 "tools/debugger/DrawCommand.cpp",
2667 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002668 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002669 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002670 "tools/mdbviz/main.cpp",
2671
2672 # generated files
2673 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2674 "$target_gen_dir/mdbviz/resources_res.cpp",
2675 ]
2676 lib_dirs = [ "$skia_qt_path/lib" ]
2677 libs = [
2678 "Qt5Core.lib",
2679 "Qt5Gui.lib",
2680 "Qt5Widgets.lib",
2681 ]
2682 include_dirs = [
2683 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002684 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002685 "$skia_qt_path/include/QtWidgets",
2686 ]
2687 deps = [
2688 ":generate_mocs",
2689 ":generate_resources",
2690 ":skia",
2691 ]
2692 }
2693 }
2694
Mike Kleine459afd2017-03-03 09:21:30 -05002695 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002696 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002697 sources = [ "$ndk/$ndk_gdbserver" ]
2698 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002699 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002700 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002701
2702 if (skia_use_opencl) {
2703 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002704 sources = [ "tools/hello-opencl.cpp" ]
2705 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002706 }
2707 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002708
Brian Osmanf564f152019-07-23 15:14:30 -04002709 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002710 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002711 deps = [
2712 ":skia",
2713 "modules/particles",
2714 ]
2715 }
2716
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002717 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002718 test_app("editor") {
2719 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002720 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002721 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002722 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002723
2724 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002725 sources = [ "tools/image_diff_metric.cpp" ]
2726 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002727 }
Chris Dalton2b598902020-03-25 10:50:35 -06002728
2729 group("modules_testonly") {
2730 testonly = true
2731 deps = []
2732 if (target_cpu == "wasm") {
2733 deps += [ "modules/canvaskit:viewer_wasm" ]
2734 }
2735 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002736
2737 if (skia_build_fuzzers) {
2738 template("libfuzzer_app") {
2739 output_dir = root_build_dir
2740 executable(target_name) {
2741 check_includes = false
2742 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2743 configs += [ ":skia_private" ]
2744 sources += [
2745 "fuzz/Fuzz.cpp",
2746 "fuzz/FuzzCommon.cpp",
2747 ]
2748 deps += [
2749 ":flags",
2750 ":gpu_tool_utils",
2751 ":skia",
2752 ]
2753 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2754 if (skia_use_libfuzzer_defaults) {
2755 cflags = [ "-fsanitize=fuzzer" ]
2756 ldflags = [ "-fsanitize=fuzzer" ]
2757 }
2758 testonly = true
2759 }
2760 }
2761
2762 libfuzzer_app("region_deserialize") {
2763 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2764 deps = []
2765 }
2766
2767 libfuzzer_app("image_filter_deserialize") {
2768 include_dirs = [
2769 "tools",
2770 "tools/fonts",
2771 ]
2772 sources = [
2773 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2774 "tools/Resources.cpp",
2775 "tools/fonts/TestFontMgr.cpp",
2776 "tools/fonts/TestSVGTypeface.cpp",
2777 "tools/fonts/TestTypeface.cpp",
2778 ]
2779 deps = [ ":experimental_svg_model" ]
2780 }
2781
2782 libfuzzer_app("region_set_path") {
2783 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2784 deps = []
2785 }
2786
2787 libfuzzer_app("textblob_deserialize") {
2788 include_dirs = [
2789 "tools",
2790 "tools/fonts",
2791 ]
2792 sources = [
2793 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2794 "tools/Resources.cpp",
2795 "tools/fonts/TestFontMgr.cpp",
2796 "tools/fonts/TestSVGTypeface.cpp",
2797 "tools/fonts/TestTypeface.cpp",
2798 ]
2799 deps = [ ":experimental_svg_model" ]
2800 }
2801
2802 libfuzzer_app("path_deserialize") {
2803 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2804 deps = []
2805 }
2806
2807 libfuzzer_app("image_decode") {
2808 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2809 deps = []
2810 }
2811
2812 libfuzzer_app("animated_image_decode") {
2813 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2814 deps = []
2815 }
2816
2817 libfuzzer_app("api_create_ddl") {
2818 include_dirs = [
2819 "include",
2820 "include/gpu",
2821 ]
2822 sources = [
2823 "fuzz/FuzzCreateDDL.cpp",
2824 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2825 "tools/Resources.cpp",
2826 "tools/UrlDataManager.cpp",
2827 "tools/debugger/DebugCanvas.cpp",
2828 "tools/debugger/DebugLayerManager.cpp",
2829 "tools/debugger/DrawCommand.cpp",
2830 "tools/debugger/JsonWriteBuffer.cpp",
2831 "tools/fonts/TestFontMgr.cpp",
2832 "tools/fonts/TestSVGTypeface.cpp",
2833 "tools/fonts/TestTypeface.cpp",
2834 ]
2835 deps = [
2836 ":experimental_svg_model",
2837 "//third_party/libpng",
2838 ]
2839 }
2840
2841 libfuzzer_app("api_draw_functions") {
2842 sources = [
2843 "fuzz/FuzzDrawFunctions.cpp",
2844 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2845 ]
2846 deps = []
2847 }
2848
2849 libfuzzer_app("api_gradients") {
2850 sources = [
2851 "fuzz/FuzzGradients.cpp",
2852 "fuzz/oss_fuzz/FuzzGradients.cpp",
2853 ]
2854 deps = []
2855 }
2856
2857 libfuzzer_app("api_image_filter") {
2858 include_dirs = [
2859 "tools",
2860 "tools/debugger",
2861 ]
2862 sources = [
2863 "fuzz/FuzzCanvas.cpp",
2864 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2865 "tools/UrlDataManager.cpp",
2866 "tools/debugger/DebugCanvas.cpp",
2867 "tools/debugger/DebugLayerManager.cpp",
2868 "tools/debugger/DrawCommand.cpp",
2869 "tools/debugger/JsonWriteBuffer.cpp",
2870 ]
2871 deps = [ "//third_party/libpng" ]
2872 }
2873
2874 libfuzzer_app("api_path_measure") {
2875 sources = [
2876 "fuzz/FuzzPathMeasure.cpp",
2877 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2878 ]
2879 deps = []
2880 }
2881
2882 libfuzzer_app("api_pathop") {
2883 sources = [
2884 "fuzz/FuzzPathop.cpp",
2885 "fuzz/oss_fuzz/FuzzPathop.cpp",
2886 ]
2887 deps = []
2888 }
2889
2890 libfuzzer_app("api_raster_n32_canvas") {
2891 include_dirs = [
2892 "tools",
2893 "tools/debugger",
2894 "tools/fonts",
2895 ]
2896 sources = [
2897 "fuzz/FuzzCanvas.cpp",
2898 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
2899 "tools/Resources.cpp",
2900 "tools/UrlDataManager.cpp",
2901 "tools/debugger/DebugCanvas.cpp",
2902 "tools/debugger/DebugLayerManager.cpp",
2903 "tools/debugger/DrawCommand.cpp",
2904 "tools/debugger/JsonWriteBuffer.cpp",
2905 "tools/fonts/TestFontMgr.cpp",
2906 "tools/fonts/TestSVGTypeface.cpp",
2907 "tools/fonts/TestTypeface.cpp",
2908 ]
2909 deps = [
2910 ":experimental_svg_model",
2911 "//third_party/libpng",
2912 ]
2913 }
2914
2915 if (skia_use_gl) {
2916 libfuzzer_app("api_mock_gpu_canvas") {
2917 include_dirs = [
2918 "tools",
2919 "tools/debugger",
2920 "tools/fonts",
2921 ]
2922 sources = [
2923 "fuzz/FuzzCanvas.cpp",
2924 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
2925 "tools/LsanSuppressions.cpp",
2926 "tools/Resources.cpp",
2927 "tools/UrlDataManager.cpp",
2928 "tools/debugger/DebugCanvas.cpp",
2929 "tools/debugger/DebugLayerManager.cpp",
2930 "tools/debugger/DrawCommand.cpp",
2931 "tools/debugger/JsonWriteBuffer.cpp",
2932 "tools/fonts/TestFontMgr.cpp",
2933 "tools/fonts/TestSVGTypeface.cpp",
2934 "tools/fonts/TestTypeface.cpp",
2935 ]
2936 deps = [
2937 ":experimental_svg_model",
2938 "//third_party/libpng",
2939 ]
2940 }
2941 }
2942
2943 libfuzzer_app("api_null_canvas") {
2944 include_dirs = [
2945 "tools",
2946 "tools/debugger",
2947 "tools/fonts",
2948 ]
2949 sources = [
2950 "fuzz/FuzzCanvas.cpp",
2951 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
2952 "tools/Resources.cpp",
2953 "tools/UrlDataManager.cpp",
2954 "tools/debugger/DebugCanvas.cpp",
2955 "tools/debugger/DebugLayerManager.cpp",
2956 "tools/debugger/DrawCommand.cpp",
2957 "tools/debugger/JsonWriteBuffer.cpp",
2958 "tools/fonts/TestFontMgr.cpp",
2959 "tools/fonts/TestSVGTypeface.cpp",
2960 "tools/fonts/TestTypeface.cpp",
2961 ]
2962 deps = [
2963 ":experimental_svg_model",
2964 "//third_party/libpng",
2965 ]
2966 }
2967
2968 libfuzzer_app("api_svg_canvas") {
2969 include_dirs = [
2970 "include",
2971 "include/svg",
2972 ]
2973 sources = [
2974 "fuzz/FuzzCanvas.cpp",
2975 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
2976 "tools/Resources.cpp",
2977 "tools/UrlDataManager.cpp",
2978 "tools/debugger/DebugCanvas.cpp",
2979 "tools/debugger/DebugLayerManager.cpp",
2980 "tools/debugger/DrawCommand.cpp",
2981 "tools/debugger/JsonWriteBuffer.cpp",
2982 "tools/fonts/TestFontMgr.cpp",
2983 "tools/fonts/TestSVGTypeface.cpp",
2984 "tools/fonts/TestTypeface.cpp",
2985 ]
2986 deps = [
2987 ":experimental_svg_model",
2988 "//third_party/libpng",
2989 ]
2990 }
2991
2992 libfuzzer_app("png_encoder") {
2993 sources = [
2994 "fuzz/FuzzEncoders.cpp",
2995 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
2996 ]
2997 deps = []
2998 }
2999
3000 libfuzzer_app("jpeg_encoder") {
3001 sources = [
3002 "fuzz/FuzzEncoders.cpp",
3003 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3004 ]
3005 deps = []
3006 }
3007
3008 libfuzzer_app("webp_encoder") {
3009 sources = [
3010 "fuzz/FuzzEncoders.cpp",
3011 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3012 ]
3013 deps = []
3014 }
3015
3016 libfuzzer_app("skottie_json") {
3017 sources = [
3018 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3019 "tools/Resources.cpp",
3020 "tools/fonts/TestFontMgr.cpp",
3021 "tools/fonts/TestSVGTypeface.cpp",
3022 "tools/fonts/TestTypeface.cpp",
3023 ]
3024 deps = [
3025 ":experimental_svg_model",
3026 "modules/skottie:skottie",
3027 ]
3028 }
3029
3030 libfuzzer_app("skjson") {
3031 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3032 deps = []
3033 }
3034
3035 libfuzzer_app("api_polyutils") {
3036 sources = [
3037 "fuzz/FuzzPolyUtils.cpp",
3038 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3039 ]
3040 deps = [ ":skia" ]
3041 }
3042
3043 libfuzzer_app("android_codec") {
3044 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3045 deps = []
3046 }
3047
3048 libfuzzer_app("image_decode_incremental") {
3049 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3050 deps = []
3051 }
3052
3053 libfuzzer_app("sksl2glsl") {
3054 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3055 deps = []
3056 }
3057
3058 libfuzzer_app("sksl2spirv") {
3059 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3060 deps = []
3061 }
3062
3063 libfuzzer_app("sksl2metal") {
3064 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3065 deps = []
3066 }
3067
3068 libfuzzer_app("sksl2pipeline") {
3069 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3070 deps = []
3071 }
3072
3073 libfuzzer_app("skdescriptor_deserialize") {
3074 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3075 deps = []
3076 }
3077
3078 libfuzzer_app("svg_dom") {
3079 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
3080 deps = [ ":experimental_svg_model" ]
3081 }
3082
3083 libfuzzer_app("skruntimeeffect") {
3084 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3085 deps = []
3086 }
3087
3088 libfuzzer_app("skp") {
3089 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3090 deps = []
3091 }
3092 }
mtklein25c81d42016-07-27 13:55:26 -07003093}
Hal Canary932a2c02019-09-17 10:43:18 -04003094
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003095if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003096 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003097 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003098 }
Hal Canary27483062019-12-06 15:01:08 -05003099}
3100
Hal Canary60ff6512020-01-21 12:39:20 -05003101if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003102 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003103 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003104 }
3105}