blob: c2d04feb43e47690a5c066bc41118d1844fb1ee9 [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")
brettwb9447282016-09-01 14:24:39 -07009
Hal Canary45812a12019-09-04 08:58:59 -040010import("gn/skia.gni")
11
Stephen White0d70b712019-07-10 15:51:30 -040012if (skia_use_dawn) {
13 import("third_party/externals/dawn/scripts/dawn_features.gni")
14}
15
Adam Barth54ef74a2017-10-13 10:59:38 -070016if (defined(skia_settings)) {
17 import(skia_settings)
18}
19
Hal Canary3388c1a2019-09-16 12:53:17 -040020import("gn/ios.gni")
21
mtkleinc04ff472016-06-23 10:29:30 -070022# Skia public API, generally provided by :skia.
23config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050024 include_dirs = [ "." ]
25
Mike Kleinae7e6712016-10-11 17:49:33 -040026 defines = []
27 if (is_component_build) {
28 defines += [ "SKIA_DLL" ]
29 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040030 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050031 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070032 }
Brian Osmanf2c90142017-07-13 15:50:03 -040033 if (skia_enable_flutter_defines) {
34 defines += flutter_defines
35 }
mtklein06c35c02016-09-20 12:28:12 -070036 if (!skia_enable_gpu) {
37 defines += [ "SK_SUPPORT_GPU=0" ]
38 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -050039 if (skia_enable_atlas_text) {
40 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
41 }
Mike Reed025f7832018-11-12 09:27:05 -050042 if (is_fuchsia) {
43 defines += fuchsia_defines
44 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040045 if (skia_gl_standard == "gles") {
46 defines += [ "SK_ASSUME_GL_ES=1" ]
47 } else if (skia_gl_standard == "gl") {
48 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040049 } else if (skia_gl_standard == "webgl") {
50 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040051 }
mtkleinc04ff472016-06-23 10:29:30 -070052}
53
54# Skia internal APIs, used by Skia itself and a few test tools.
55config("skia_private") {
56 visibility = [ ":*" ]
57
Mike Reeda9e241d2017-05-03 10:52:00 -040058 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050059 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070060 defines += [
61 "SK_GAMMA_EXPONENT=1.4",
62 "SK_GAMMA_CONTRAST=0.0",
63 ]
64 }
Mike Kleinb45d8622019-04-24 14:04:01 -050065 if (is_skia_dev_build) {
66 defines += [
67 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
68 "GR_TEST_UTILS=1",
69 ]
mtklein88a7ac02016-09-14 11:16:49 -070070 }
Brian Salomon789e25e2016-09-30 13:41:03 -040071 libs = []
72 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -050073 if (skia_use_angle) {
74 defines += [ "SK_ANGLE" ]
75 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040076 if (skia_llvm_path != "") {
77 defines += [ "SK_LLVM_AVAILABLE" ]
78 include_dirs += [ "$skia_llvm_path/include" ]
79 libs += [ skia_llvm_lib ]
80 lib_dirs += [ "$skia_llvm_path/lib/" ]
81 }
mtkleinc04ff472016-06-23 10:29:30 -070082}
83
84# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
85config("skia_library") {
86 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +000087 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -070088}
89
90skia_library_configs = [
91 ":skia_public",
92 ":skia_private",
93 ":skia_library",
94]
95
mtklein9b8583d2016-08-24 17:32:30 -070096# Use for CPU-specific Skia code that needs particular compiler flags.
97template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -050098 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -070099 if (invoker.enabled) {
100 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500101 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700102 forward_variables_from(invoker, "*")
103 configs += skia_library_configs
104 }
105 } else {
106 # If not enabled, a phony empty target that swallows all otherwise unused variables.
107 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500108 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700109 forward_variables_from(invoker,
110 "*",
111 [
112 "sources",
113 "cflags",
114 ])
115 }
116 }
anmittala7eaf2e2016-08-17 13:57:26 -0700117}
118
mtklein422310d2016-08-16 18:28:43 -0700119is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700120
mtklein7d6fb2c2016-08-25 14:50:44 -0700121opts("none") {
122 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700123 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700124 cflags = []
125}
126
mtklein7d6fb2c2016-08-25 14:50:44 -0700127opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700128 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700129 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700130 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700131}
132
133opts("arm64") {
134 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700135 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700136 cflags = []
137}
138
139opts("crc32") {
140 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700141 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700142 cflags = [ "-march=armv8-a+crc" ]
143}
144
mtklein9b8583d2016-08-24 17:32:30 -0700145opts("sse2") {
146 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700147 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400148 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400149 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
150 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400151 cflags = [ "-msse2" ]
152 }
mtklein9b8583d2016-08-24 17:32:30 -0700153}
mtkleinc04ff472016-06-23 10:29:30 -0700154
mtklein9b8583d2016-08-24 17:32:30 -0700155opts("ssse3") {
156 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700157 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400158 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400159 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
160 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400161 cflags = [ "-mssse3" ]
162 }
mtklein9b8583d2016-08-24 17:32:30 -0700163}
mtkleinc04ff472016-06-23 10:29:30 -0700164
mtklein9b8583d2016-08-24 17:32:30 -0700165opts("sse41") {
166 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400168 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400169 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
170 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400171 cflags = [ "-msse4.1" ]
172 }
mtklein9b8583d2016-08-24 17:32:30 -0700173}
mtklein4e976072016-08-08 09:06:27 -0700174
mtklein9b8583d2016-08-24 17:32:30 -0700175opts("sse42") {
176 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700177 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400178 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400179 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
180 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400181 cflags = [ "-msse4.2" ]
182 }
mtklein9b8583d2016-08-24 17:32:30 -0700183}
184
185opts("avx") {
186 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700187 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400188 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000189 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400190 } else {
191 cflags = [ "-mavx" ]
192 }
mtkleinc04ff472016-06-23 10:29:30 -0700193}
194
Mike Klein1b9b7d52018-02-27 10:37:40 -0500195opts("hsw") {
196 enabled = is_x86
197 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400198 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500199 cflags = [ "/arch:AVX2" ]
200 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000201 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500202 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500203}
204
mtkleinc095df52016-08-24 12:23:52 -0700205# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700206template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500207 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700208 if (invoker.enabled) {
209 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700210 if (defined(invoker.public_defines)) {
211 defines = invoker.public_defines
212 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600213 if (defined(invoker.public_configs)) {
214 configs = invoker.public_configs
215 }
mtklein457b42a2016-08-23 13:56:37 -0700216 }
217 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500218 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700219 forward_variables_from(invoker,
220 "*",
221 [
222 "public_defines",
223 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700224 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700225 ])
mtklein457b42a2016-08-23 13:56:37 -0700226 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700227 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700228 if (defined(invoker.configs_to_remove)) {
229 configs -= invoker.configs_to_remove
230 }
mtklein457b42a2016-08-23 13:56:37 -0700231 }
232 } else {
mtklein457b42a2016-08-23 13:56:37 -0700233 source_set(target_name) {
234 forward_variables_from(invoker,
235 "*",
236 [
237 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400238 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700239 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700240 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700241 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700242 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700243 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700244 ])
mtkleincd01b032016-08-31 04:58:19 -0700245 if (defined(invoker.sources_when_disabled)) {
246 sources = invoker.sources_when_disabled
247 }
248 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700249 }
mtkleineb3c4252016-08-23 07:38:09 -0700250 }
mtklein457b42a2016-08-23 13:56:37 -0700251}
mtklein457b42a2016-08-23 13:56:37 -0700252
mtkleina45be612016-08-29 15:22:10 -0700253optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500254 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700255
256 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500257 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700258 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700259 ]
260 sources = [
261 "src/ports/SkFontMgr_android.cpp",
262 "src/ports/SkFontMgr_android_factory.cpp",
263 "src/ports/SkFontMgr_android_parser.cpp",
264 ]
265}
266
mtkleind2e39db2016-09-07 07:52:55 -0700267optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500268 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700269
270 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500271 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700272 ]
273 sources = [
274 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500275 "src/ports/SkFontMgr_custom.h",
276 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700277 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500278 "src/ports/SkFontMgr_custom_embedded.cpp",
279 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700280 ]
281}
282
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500283optional("fontmgr_custom_empty") {
284 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500285
286 deps = [
287 ":typeface_freetype",
288 ]
289 sources = [
290 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500291 "src/ports/SkFontMgr_custom_empty.cpp",
292 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800293 ]
294}
295
Hal Canaryff2742e2018-01-30 11:35:47 -0500296optional("fontmgr_empty") {
297 enabled = skia_enable_fontmgr_empty
298 sources = [
299 "src/ports/SkFontMgr_empty_factory.cpp",
300 ]
301}
302
mtklein3cc22182016-08-29 13:26:14 -0700303optional("fontmgr_fontconfig") {
304 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700305
306 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500307 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700308 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700309 ]
310 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700311 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700312 "src/ports/SkFontConfigInterface_direct.cpp",
313 "src/ports/SkFontConfigInterface_direct_factory.cpp",
314 "src/ports/SkFontMgr_FontConfigInterface.cpp",
315 "src/ports/SkFontMgr_fontconfig.cpp",
316 "src/ports/SkFontMgr_fontconfig_factory.cpp",
317 ]
318}
319
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500320optional("fontmgr_fuchsia") {
321 enabled = skia_enable_fontmgr_fuchsia
322
Chinmay Garde89820762019-05-06 16:44:06 -0700323 deps = []
324
325 if (is_fuchsia && using_fuchsia_sdk) {
326 deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
327 } else {
328 deps += [ "//sdk/fidl/fuchsia.fonts" ]
329 }
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500330 sources = [
331 "src/ports/SkFontMgr_fuchsia.cpp",
332 "src/ports/SkFontMgr_fuchsia.h",
333 ]
334}
335
336optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400337 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700338
339 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500340 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700341 ]
342 sources = [
343 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500344 "src/ports/SkFontMgr_custom.h",
345 "src/ports/SkFontMgr_custom_embedded.cpp",
346 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700347 ]
348}
349
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500350optional("fontmgr_win") {
351 enabled = skia_enable_fontmgr_win
352
353 sources = [
354 "src/fonts/SkFontMgr_indirect.cpp",
355 "src/ports/SkFontMgr_win_dw.cpp",
356 "src/ports/SkFontMgr_win_dw_factory.cpp",
357 "src/ports/SkScalerContext_win_dw.cpp",
358 "src/ports/SkTypeface_win_dw.cpp",
359 ]
360}
361
362optional("fontmgr_win_gdi") {
363 enabled = skia_enable_fontmgr_win_gdi
364
365 sources = [
366 "src/ports/SkFontHost_win.cpp",
367 ]
368 libs = [ "Gdi32.lib" ]
369}
370
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700371if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400372 executable("sksllex") {
373 sources = [
374 "src/sksl/lex/Main.cpp",
375 "src/sksl/lex/NFA.cpp",
376 "src/sksl/lex/RegexNode.cpp",
377 "src/sksl/lex/RegexParser.cpp",
378 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500379 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400380 }
381
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700382 action("run_sksllex") {
383 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400384 deps = [
385 ":sksllex(//gn/toolchain:$host_toolchain)",
386 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700387 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700388 "src/sksl/lex/sksl.lex",
389 ]
390
391 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
392 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
393 outputs = [
394 "$target_out_dir/" +
395 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
396 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
397 # confused due to the same file being named by two different paths
398 ]
399 sksllex_path = "$root_out_dir/"
400 sksllex_path += "sksllex"
401 if (host_os == "win") {
402 sksllex_path += ".exe"
403 }
404 args = [
405 rebase_path(sksllex_path),
406 rebase_path("bin/clang-format"),
407 rebase_path("src"),
408 ]
409 }
410} else {
411 group("run_sksllex") {
412 }
413}
414
415if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400416 executable("skslc") {
417 defines = [ "SKSL_STANDALONE" ]
418 sources = [
419 "src/sksl/SkSLMain.cpp",
420 ]
421 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400422 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500423 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400424 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500425 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400426 "//third_party/spirv-tools:spvtools",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400427 ]
428 }
429
430 skia_gpu_processor_outputs = []
431 foreach(src, skia_gpu_processor_sources) {
432 dir = get_path_info(src, "dir")
433 name = get_path_info(src, "name")
434
435 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
436 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
437 skia_gpu_processor_outputs += [
Brian Osmanf5ac1992019-07-18 11:23:16 -0400438 "$target_out_dir/" +
439 rebase_path("$dir/generated/$name.h", target_out_dir),
Ethan Nicholas762466e2017-06-29 10:03:38 -0400440 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
441 # confused due to the same file being named by two different paths
442 ]
443 }
444
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500445 action("create_sksl_enums") {
446 script = "gn/create_sksl_enums.py"
447 sources = [
448 "include/private/GrSharedEnums.h",
449 ]
450 outputs = [
451 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500452 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500453 ]
454 args = [
455 rebase_path(sources[0]),
456 rebase_path(outputs[0]),
457 ]
458 }
459
Ethan Nicholas762466e2017-06-29 10:03:38 -0400460 action("compile_processors") {
461 script = "gn/compile_processors.py"
462 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500463 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400464 ":skslc(//gn/toolchain:$host_toolchain)",
465 ]
466 sources = skia_gpu_processor_sources
467 outputs = skia_gpu_processor_outputs
468 skslc_path = "$root_out_dir/"
469 if (host_toolchain != default_toolchain_name) {
470 skslc_path += "$host_toolchain/"
471 }
472 skslc_path += "skslc"
473 if (host_os == "win") {
474 skslc_path += ".exe"
475 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400476 args = [
477 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400478 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400479 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400480 args += rebase_path(skia_gpu_processor_sources)
481 }
482} else {
483 skia_gpu_processor_outputs = []
484 group("compile_processors") {
485 }
486}
487
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500488optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700489 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400490 deps = [
491 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700492 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400493 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700494 if (skia_generate_workarounds) {
495 deps += [ ":workaround_list" ]
496 }
Robert Phillipsefb9f142019-05-17 14:19:44 -0400497 public_defines = [ "SK_GL" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600498 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400499 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700500
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400501 sources =
502 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400503 if (!skia_enable_ccpr) {
504 sources -= skia_ccpr_sources
505 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
506 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400507 if (!skia_enable_nvpr) {
508 sources -= skia_nvpr_sources
509 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
510 }
mtklein06c35c02016-09-20 12:28:12 -0700511
512 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500513 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700514 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400515 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700516 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400517 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400518
519 # this lib is required to link against AHardwareBuffer
520 if (defined(ndk_api) && ndk_api >= 26) {
521 libs += [ "android" ]
522 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400523 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500524 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400525 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700526 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500527 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400528 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700529 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500530 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800531 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500532 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400533 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500534 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500535 if (target_cpu != "arm64") {
536 libs += [ "OpenGL32.lib" ]
537 }
mtklein06c35c02016-09-20 12:28:12 -0700538 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500539 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700540 }
mtkleine9fb3d52016-09-20 15:11:46 -0700541
542 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400543 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400544 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700545 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700546 if (skia_enable_vulkan_debug_layers) {
547 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
548 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800549 if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -0700550 if (using_fuchsia_sdk) {
551 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
552 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400553 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700554 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800555 }
mtkleine9fb3d52016-09-20 15:11:46 -0700556 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400557
Stephen White0d70b712019-07-10 15:51:30 -0400558 if (skia_use_dawn) {
559 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400560 sources += skia_dawn_sources
Stephen White0d70b712019-07-10 15:51:30 -0400561 public_deps += [
562 "//third_party/dawn:dawn_headers",
563 "//third_party/dawn:libdawn",
564 "//third_party/dawn:libdawn_native_sources",
565 ]
566 if (dawn_enable_d3d12) {
567 libs += [
568 "d3d12.lib",
569 "dxgi.lib",
570 "d3dcompiler.lib",
571 ]
572 } else if (dawn_enable_metal) {
573 libs += [ "Metal.framework" ]
574 }
575 }
576
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400577 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400578 if (skia_use_metal) {
579 public_defines += [ "SK_METAL" ]
580 sources += skia_metal_sources
581 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400582 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400583 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400584 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500585
586 if (skia_enable_atlas_text) {
587 sources += skia_atlas_text_sources
588 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400589
590 if (is_debug) {
591 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
592 }
mtklein06c35c02016-09-20 12:28:12 -0700593}
594
Leon Scroggins III41169202019-01-29 09:29:57 -0500595optional("gif") {
596 enabled = !skia_use_wuffs
597 sources = [
598 "src/codec/SkGifCodec.cpp",
599 "third_party/gif/SkGifImageReader.cpp",
600 ]
601}
602
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400603optional("heif") {
604 enabled = skia_use_libheif
605 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
606
607 deps = []
608
609 sources = [
610 "src/codec/SkHeifCodec.cpp",
611 ]
612}
613
mtklein63213812016-08-24 09:55:56 -0700614optional("jpeg") {
615 enabled = skia_use_libjpeg_turbo
616 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
617
mtklein63213812016-08-24 09:55:56 -0700618 deps = [
619 "//third_party/libjpeg-turbo:libjpeg",
620 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400621 public = [
622 "include/encode/SkJpegEncoder.h",
623 ]
mtklein63213812016-08-24 09:55:56 -0700624 sources = [
625 "src/codec/SkJpegCodec.cpp",
626 "src/codec/SkJpegDecoderMgr.cpp",
627 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700628 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400629 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700630 ]
631}
632
633optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500634 enabled = skia_use_zlib && skia_enable_pdf
635 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700636
mtklein63213812016-08-24 09:55:56 -0700637 deps = [
638 "//third_party/zlib",
639 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400640 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700641 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400642 }
brettwb9447282016-09-01 14:24:39 -0700643 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700644 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500645 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
646 deps += [ "//third_party/harfbuzz" ]
647 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
648 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700649 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500650 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700651 }
652}
653
654optional("png") {
655 enabled = skia_use_libpng
656 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
657
mtklein63213812016-08-24 09:55:56 -0700658 deps = [
659 "//third_party/libpng",
660 ]
661 sources = [
662 "src/codec/SkIcoCodec.cpp",
663 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400664 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700665 ]
666}
667
scroggof84ad642016-10-31 09:02:57 -0700668optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400669 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700670 public_defines = [ "SK_CODEC_DECODES_RAW" ]
671
672 deps = [
673 "//third_party/dng_sdk",
674 "//third_party/libjpeg-turbo:libjpeg",
675 "//third_party/piex",
676 ]
677
678 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
679 # Skia.
680 configs_to_remove = [ "//gn:no_exceptions" ]
681
682 sources = [
scroggof84ad642016-10-31 09:02:57 -0700683 "src/codec/SkRawCodec.cpp",
684 ]
685}
686
Mike Klein852a8cb2018-05-15 10:46:58 -0400687import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400688source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400689 cflags = []
690 if (!is_win || is_clang) {
691 cflags += [
692 "-w",
693 "-std=c11",
694 ]
695 }
696
697 public = [
Brian Osmanea236bf2019-04-29 10:28:22 -0400698 "include/third_party/skcms/skcms.h",
Mike Klein852a8cb2018-05-15 10:46:58 -0400699 ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400700 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400701 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
702}
703
mtklein3cc22182016-08-29 13:26:14 -0700704optional("typeface_freetype") {
705 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700706
707 deps = [
708 "//third_party/freetype2",
709 ]
710 sources = [
711 "src/ports/SkFontHost_FreeType.cpp",
712 "src/ports/SkFontHost_FreeType_common.cpp",
713 ]
714}
715
mtklein457b42a2016-08-23 13:56:37 -0700716optional("webp") {
717 enabled = skia_use_libwebp
718 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
719
mtklein457b42a2016-08-23 13:56:37 -0700720 deps = [
721 "//third_party/libwebp",
722 ]
723 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700724 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400725 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700726 ]
mtkleineb3c4252016-08-23 07:38:09 -0700727}
728
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400729optional("wuffs") {
730 enabled = skia_use_wuffs
731 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
732
733 deps = [
734 "//third_party/wuffs",
735 ]
736 sources = [
737 "src/codec/SkWuffsCodec.cpp",
738 ]
739}
740
mtklein63213812016-08-24 09:55:56 -0700741optional("xml") {
742 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000743 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700744
mtklein63213812016-08-24 09:55:56 -0700745 deps = [
746 "//third_party/expat",
747 ]
748 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500749 "src/svg/SkSVGCanvas.cpp",
750 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700751 "src/xml/SkDOM.cpp",
752 "src/xml/SkXMLParser.cpp",
753 "src/xml/SkXMLWriter.cpp",
754 ]
755}
756
Brian Osman489cf882019-07-09 10:48:28 -0400757optional("sksl_interpreter") {
758 enabled = skia_enable_sksl_interpreter
759 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
760}
761
Mike Klein613ad382019-06-06 11:42:02 -0500762optional("skvm_jit") {
Mike Klein6bbeb4a2019-06-21 16:34:06 -0500763 enabled = skia_enable_skvm_jit
Mike Klein613ad382019-06-06 11:42:02 -0500764 public_defines = [ "SKVM_JIT" ]
Mike Klein613ad382019-06-06 11:42:02 -0500765}
766
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700767if (skia_enable_gpu && skia_generate_workarounds) {
768 action("workaround_list") {
769 script = "tools/build_workaround_header.py"
770
771 inputs = [
772 "src/gpu/gpu_workaround_list.txt",
773 ]
774
775 # see comments in skia_compile_processors about out dir path shenanigans.
776 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700777 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700778
779 outputs = [
780 "$root_out_dir/$output_file",
781 ]
782 args = [
783 "--output-file",
784 "$output_file",
785 ]
786
787 foreach(file, inputs) {
788 args += [ rebase_path(file, root_build_dir) ]
789 }
790 }
791}
792
mtkleinc04ff472016-06-23 10:29:30 -0700793component("skia") {
794 public_configs = [ ":skia_public" ]
795 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700796
Mike Klein607b0a72018-11-07 16:17:34 -0500797 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500798 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500799 ":pdf",
800 ":skcms",
801 ]
802
mtkleinc04ff472016-06-23 10:29:30 -0700803 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700804 ":arm64",
805 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700806 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000807 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700808 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700809 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700810 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500811 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500812 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700813 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800814 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500815 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500816 ":fontmgr_win",
817 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500818 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400819 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500820 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700821 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700822 ":none",
mtklein63213812016-08-24 09:55:56 -0700823 ":png",
scroggof84ad642016-10-31 09:02:57 -0700824 ":raw",
Brian Osman489cf882019-07-09 10:48:28 -0400825 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -0500826 ":skvm_jit",
mtklein9b8583d2016-08-24 17:32:30 -0700827 ":sse2",
828 ":sse41",
829 ":sse42",
830 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700831 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400832 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700833 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700834 ]
835
Chinmay Garde43f115c2016-11-16 15:04:12 -0800836 # This file (and all GN files in Skia) are designed to work with an
837 # empty sources assignment filter; we handle all that explicitly.
838 # We clear the filter here for clients who may have set up a global filter.
839 set_sources_assignment_filter([])
840
Hal Canaryc25f4e92019-02-26 11:54:25 -0500841 public = skia_core_public
842 public += skia_utils_public
843 public += skia_effects_public
844 public += skia_effects_imagefilter_public
845 public += skia_xps_public
846
mtkleinc04ff472016-06-23 10:29:30 -0700847 sources = []
brettwb9447282016-09-01 14:24:39 -0700848 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700849 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500850 if (skia_use_xps) {
851 sources += skia_xps_sources
852 }
Mike Klein54378232018-11-08 12:08:05 +0000853 sources += skia_effects_sources
854 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400855 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -0700856 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400857 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500858 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700859 "src/android/SkBitmapRegionCodec.cpp",
860 "src/android/SkBitmapRegionDecoder.cpp",
861 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100862 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400863 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700864 "src/codec/SkBmpCodec.cpp",
865 "src/codec/SkBmpMaskCodec.cpp",
866 "src/codec/SkBmpRLECodec.cpp",
867 "src/codec/SkBmpStandardCodec.cpp",
868 "src/codec/SkCodec.cpp",
869 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400870 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400871 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700872 "src/codec/SkMaskSwizzler.cpp",
873 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -0400874 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700875 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700876 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700877 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700878 "src/codec/SkSwizzler.cpp",
879 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700880 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700881 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000882 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700883 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700884 "src/ports/SkMemory_malloc.cpp",
885 "src/ports/SkOSFile_stdio.cpp",
886 "src/sfnt/SkOTTable_name.cpp",
887 "src/sfnt/SkOTUtils.cpp",
888 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700889 ]
brettwb9447282016-09-01 14:24:39 -0700890
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400891 defines = []
mtklein7d6fb2c2016-08-25 14:50:44 -0700892 libs = []
893
mtkleinc04ff472016-06-23 10:29:30 -0700894 if (is_win) {
895 sources += [
896 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700897 "src/ports/SkImageEncoder_WIC.cpp",
898 "src/ports/SkImageGeneratorWIC.cpp",
899 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700900 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700901 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700902 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400903 libs += [
904 "FontSub.lib",
905 "Ole32.lib",
906 "OleAut32.lib",
907 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500908 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400909 ]
mtkleinc04ff472016-06-23 10:29:30 -0700910 } else {
911 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700912 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700913 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700914 "src/ports/SkTLS_pthread.cpp",
915 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400916 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700917 }
918
mtklein7d6fb2c2016-08-25 14:50:44 -0700919 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500920 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500921 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500922 deps += [ "//third_party/cpu-features" ]
923 }
mtklein06c35c02016-09-20 12:28:12 -0700924 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700925 libs += [
926 "EGL",
927 "GLESv2",
928 "log",
929 ]
930 }
931
Kevin Lubick217056c2018-09-20 17:39:31 -0400932 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700933 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400934 if (skia_use_egl) {
935 libs += [ "GLESv2" ]
936 }
mtkleinc04ff472016-06-23 10:29:30 -0700937 }
938
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500939 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800940 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500941 }
942
mtkleinc04ff472016-06-23 10:29:30 -0700943 if (is_mac) {
944 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700945 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700946 "src/ports/SkImageEncoder_CG.cpp",
947 "src/ports/SkImageGeneratorCG.cpp",
948 ]
mtklein09e61f72016-08-23 13:35:28 -0700949 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400950 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
951 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700952 "ApplicationServices.framework",
953 "OpenGL.framework",
954 ]
mtkleinc04ff472016-06-23 10:29:30 -0700955 }
abarth6fc8ff02016-07-15 15:15:15 -0700956
Mike Klein7d302882016-11-03 14:06:31 -0400957 if (is_ios) {
958 sources += [
959 "src/ports/SkDebug_stdio.cpp",
960 "src/ports/SkFontHost_mac.cpp",
961 "src/ports/SkImageEncoder_CG.cpp",
962 "src/ports/SkImageGeneratorCG.cpp",
963 ]
964 libs += [
965 "CoreFoundation.framework",
966 "CoreGraphics.framework",
967 "CoreText.framework",
968 "ImageIO.framework",
969 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400970
971 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
972 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400973 ]
974 }
975
abarth6fc8ff02016-07-15 15:15:15 -0700976 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700977 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700978 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400979
980 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -0400981 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400982 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
983 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -0400984
985 if (skia_include_multiframe_procs) {
986 sources += [ "tools/SkSharingProc.cpp" ]
987 }
mtkleinc04ff472016-06-23 10:29:30 -0700988}
989
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500990# DebugCanvas used in experimental/wasm-skp-debugger
991if (target_cpu == "wasm") {
992 static_library("debugcanvas") {
993 public_configs = [ ":skia_public" ]
994
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500995 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -0400996 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500997 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -0500998 "tools/debugger/DebugCanvas.cpp",
999 "tools/debugger/DrawCommand.cpp",
1000 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001001 ]
1002
1003 deps = [
1004 ":fontmgr_wasm",
1005 ]
1006 }
1007}
1008
Kevin Lubickcbcff382018-10-02 09:02:18 -04001009static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001010 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001011 public_configs = [ ":skia_public" ]
1012 configs += skia_library_configs
1013
1014 deps = [
1015 ":arm64",
1016 ":armv7",
1017 ":avx",
1018 ":crc32",
1019 ":hsw",
1020 ":none",
1021 ":sse2",
1022 ":sse41",
1023 ":sse42",
1024 ":ssse3",
1025 ]
1026
1027 # This file (and all GN files in Skia) are designed to work with an
1028 # empty sources assignment filter; we handle all that explicitly.
1029 # We clear the filter here for clients who may have set up a global filter.
1030 set_sources_assignment_filter([])
1031
1032 sources = []
1033 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001034 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001035 sources += [
1036 "src/core/SkAnalyticEdge.cpp",
1037 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001038 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001039 "src/core/SkCubicMap.cpp",
1040 "src/core/SkEdge.cpp",
1041 "src/core/SkEdgeBuilder.cpp",
1042 "src/core/SkEdgeClipper.cpp",
1043 "src/core/SkGeometry.cpp",
1044 "src/core/SkLineClipper.cpp",
1045 "src/core/SkMallocPixelRef.cpp",
1046 "src/core/SkMath.cpp",
1047 "src/core/SkMatrix.cpp",
1048 "src/core/SkOpts.cpp",
1049 "src/core/SkPaint.cpp",
1050 "src/core/SkPath.cpp",
1051 "src/core/SkPathEffect.cpp",
1052 "src/core/SkPathMeasure.cpp",
1053 "src/core/SkPathRef.cpp",
1054 "src/core/SkPoint.cpp",
1055 "src/core/SkRRect.cpp",
1056 "src/core/SkRect.cpp",
1057 "src/core/SkSemaphore.cpp",
1058 "src/core/SkStream.cpp",
1059 "src/core/SkString.cpp",
1060 "src/core/SkStringUtils.cpp",
1061 "src/core/SkStroke.cpp",
1062 "src/core/SkStrokeRec.cpp",
1063 "src/core/SkStrokerPriv.cpp",
1064 "src/core/SkThreadID.cpp",
1065 "src/core/SkUtils.cpp",
1066 "src/effects/SkDashPathEffect.cpp",
1067 "src/effects/SkTrimPathEffect.cpp",
1068 "src/ports/SkDebug_stdio.cpp",
1069 "src/ports/SkMemory_malloc.cpp",
1070 "src/utils/SkDashPath.cpp",
1071 "src/utils/SkParse.cpp",
1072 "src/utils/SkParsePath.cpp",
1073 "src/utils/SkUTF.cpp",
1074 ]
1075}
1076
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001077group("modules") {
1078 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001079 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001080 "modules/skottie",
1081 "modules/skshaper",
1082 ]
1083}
1084
mtkleinc095df52016-08-24 12:23:52 -07001085# Targets guarded by skia_enable_tools may use //third_party freely.
1086if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001087 skia_public_includes = [
1088 "include/android",
1089 "include/atlastext",
1090 "include/c",
1091 "include/codec",
1092 "include/config",
1093 "include/core",
1094 "include/docs",
1095 "include/effects",
1096 "include/encode",
1097 "include/gpu",
1098 "include/pathops",
1099 "include/ports",
1100 "include/svg",
1101 "include/utils",
1102 "include/utils/mac",
1103 "modules/sksg/include",
1104 "modules/skshaper/include",
1105 "modules/skottie/include",
1106 ]
1107
Mike Klein308b5ac2016-12-06 16:03:52 -05001108 # Used by gn_to_bp.py to list our public include dirs.
1109 source_set("public") {
1110 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001111 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001112 }
1113
Mike Kleinc36dedf2016-11-18 09:35:28 -05001114 config("skia.h_config") {
1115 include_dirs = [ "$target_gen_dir" ]
1116 }
1117 action("skia.h") {
1118 public_configs = [ ":skia.h_config" ]
1119 skia_h = "$target_gen_dir/skia.h"
1120 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001121
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001122 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1123 [ rebase_path(skia_h, root_build_dir) ] +
1124 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001125 depfile = "$skia_h.deps"
1126 outputs = [
1127 skia_h,
1128 ]
1129 }
1130
Brian Osmanc9a42472018-05-31 13:17:12 -04001131 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001132 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001133 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001134 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001135 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001136 "tools/fiddle/draw.cpp",
1137 "tools/fiddle/fiddle_main.cpp",
1138 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001139
1140 if (skia_use_egl) {
1141 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001142 } else {
1143 sources += [ "tools/fiddle/null_context.cpp" ]
1144 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001145 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001146 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001147 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001148 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001149 ":skia",
1150 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001151 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001152 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001153 ]
1154 }
1155 }
1156
Mike Klein9e25bb92019-04-29 09:46:36 -05001157 config("our_vulkan_headers") {
1158 # We add this directory to simulate the client already have
1159 # vulkan/vulkan_core.h on their path.
1160 include_dirs = [ "include/third_party/vulkan" ]
1161 }
1162
Brian Osmanc9a42472018-05-31 13:17:12 -04001163 source_set("public_headers_warnings_check") {
1164 sources = [
1165 "tools/public_headers_warnings_check.cpp",
1166 ]
1167 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001168 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001169 deps = [
1170 ":skia",
1171 ":skia.h",
1172 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001173 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001174 ]
Stephen White0d70b712019-07-10 15:51:30 -04001175
1176 if (skia_use_dawn) {
1177 deps += [ "//third_party/dawn:dawn_headers" ]
1178 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001179 }
1180
mtkleinc095df52016-08-24 12:23:52 -07001181 template("test_lib") {
1182 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001183 if (defined(invoker.public_defines)) {
1184 defines = invoker.public_defines
1185 }
mtklein25c81d42016-07-27 13:55:26 -07001186 }
mtkleinc095df52016-08-24 12:23:52 -07001187 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001188 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001189 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001190 public_configs = [
1191 ":" + target_name + "_config",
1192 ":skia_private",
1193 ]
1194
1195 if (!defined(deps)) {
1196 deps = []
1197 }
1198 deps += [ ":skia" ]
1199 testonly = true
1200 }
mtklein25c81d42016-07-27 13:55:26 -07001201 }
mtklein25c81d42016-07-27 13:55:26 -07001202
Mike Kleine6682eb2017-01-05 10:54:57 -05001203 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001204 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001205 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001206 forward_variables_from(invoker,
1207 "*",
1208 [
1209 "output_name",
1210 "visibility",
1211 "is_shared_library",
1212 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001213 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001214 extra_configs = [ ":skia_private" ]
1215 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1216 data_sources = [ "resources" ]
1217 if ("True" == exec_script("//gn/checkdir.py",
1218 [ rebase_path("skps", root_build_dir) ],
1219 "trim string")) {
1220 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001221 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001222 }
1223 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001224 # !is_ios
1225
1226 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1227 shared_library("lib" + target_name) {
1228 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1229 configs += [ ":skia_private" ]
1230 testonly = true
1231 }
1232 } else {
1233 _executable = target_name
1234 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001235 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001236 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1237 configs += [ ":skia_private" ]
1238 testonly = true
1239 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001240 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001241 if (is_android && skia_android_serial != "" && defined(_executable)) {
1242 action("push_" + target_name) {
1243 script = "gn/push_to_android.py"
1244 deps = [
1245 ":" + _executable,
1246 ]
1247 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1248 outputs = [
1249 _stamp,
1250 ]
1251 args = [
1252 rebase_path("$root_build_dir/$_executable"),
1253 skia_android_serial,
1254 rebase_path(_stamp),
1255 ]
1256 testonly = true
1257 }
Mike Klein7d921032017-01-05 12:20:41 -05001258 }
1259 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001260 }
1261
Greg Danielda16cce2018-08-01 09:23:57 -04001262 config("moltenvk_config") {
1263 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1264 if (is_ios) {
1265 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1266 } else {
1267 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1268 }
1269 cflags = [ "-F$moltenvk_framework_path" ]
1270 ldflags = [ "-F$moltenvk_framework_path" ]
1271 libs = [
1272 "MoltenVK.framework",
1273 "Metal.framework",
1274 "IOSurface.framework",
1275 "QuartzCore.framework",
1276 "Foundation.framework",
1277 ]
1278 if (is_ios) {
1279 libs += [ "UIKit.framework" ]
1280 } else {
1281 libs += [ "IOKit.framework" ]
1282 }
1283 defines = [ "SK_MOLTENVK" ]
1284 }
1285 }
1286
1287 source_set("moltenvk") {
1288 public_configs = [ ":moltenvk_config" ]
1289 }
1290
mtkleinc095df52016-08-24 12:23:52 -07001291 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001292 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001293
Mike Klein9e25bb92019-04-29 09:46:36 -05001294 # Bots and even devs may not have Vulkan headers, so put
1295 # include/third_party/vulkan on our path so they're always available.
1296 all_dependent_configs = [ ":our_vulkan_headers" ]
1297
Mike Klein333fb452019-04-24 08:48:11 -05001298 defines = []
1299 if (skia_enable_discrete_gpu) {
1300 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1301 }
1302
Brian Osmanc9a42472018-05-31 13:17:12 -04001303 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001304 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001305 sources = [
1306 "tools/gpu/GrContextFactory.cpp",
1307 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001308 "tools/gpu/MemoryCache.cpp",
1309 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001310 "tools/gpu/ProxyUtils.cpp",
1311 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001312 "tools/gpu/YUVUtils.cpp",
1313 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001314 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1315 "tools/gpu/gl/GLTestContext.cpp",
1316 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001317 "tools/gpu/mock/MockTestContext.cpp",
1318 ]
1319 libs = []
1320
1321 if (is_android || skia_use_egl) {
1322 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1323 } else if (is_ios) {
1324 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1325 libs += [ "OpenGLES.framework" ]
1326 } else if (is_linux) {
1327 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001328 libs += [
1329 "GLU",
1330 "X11",
1331 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001332 } else if (is_mac) {
1333 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1334 } else if (is_win) {
1335 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001336 libs += [ "Gdi32.lib" ]
1337 if (target_cpu != "arm64") {
1338 libs += [ "OpenGL32.lib" ]
1339 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001340 }
mtklein25c81d42016-07-27 13:55:26 -07001341
Brian Osmanc9a42472018-05-31 13:17:12 -04001342 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001343
Brian Osmanc9a42472018-05-31 13:17:12 -04001344 if (skia_use_angle) {
1345 deps += [ "//third_party/angle2" ]
1346 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1347 }
Greg Daniel54200e42018-12-11 17:03:39 -05001348
Brian Osmanc9a42472018-05-31 13:17:12 -04001349 if (skia_use_vulkan) {
1350 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1351 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001352 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1353 public_deps += [ ":moltenvk" ]
1354 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001355 }
1356 if (skia_use_metal) {
1357 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001358 }
Stephen White985741a2019-07-18 11:43:45 -04001359 if (skia_use_dawn) {
1360 public_deps += [ "//third_party/dawn:dawn_headers" ]
1361 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
1362 }
mtklein25c81d42016-07-27 13:55:26 -07001363 }
mtklein25c81d42016-07-27 13:55:26 -07001364
mtkleinc095df52016-08-24 12:23:52 -07001365 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001366 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001367 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001368 ]
1369 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001370
1371 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001372 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001373 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001374 ]
1375 deps = [
mtklein046cb562016-09-16 10:23:12 -07001376 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001377 ]
1378 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001379 ":gpu_tool_utils",
1380 ]
1381 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001382 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001383 sources = [
1384 "tools/flags/CommonFlagsGpu.cpp",
1385 ]
1386 deps = [
1387 ":flags",
1388 ]
1389 public_deps = [
1390 ":gpu_tool_utils",
1391 ]
1392 }
1393 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001394 sources = [
1395 "tools/flags/CommonFlagsImages.cpp",
1396 ]
1397 deps = [
1398 ":flags",
1399 ]
1400 }
1401 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001402 sources = [
1403 "tools/flags/CommonFlagsAA.cpp",
1404 ]
1405 deps = [
1406 ":flags",
1407 ]
1408 }
mtklein25c81d42016-07-27 13:55:26 -07001409
Mike Klein499f0ac2019-03-25 13:00:12 -05001410 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001411 deps = [
1412 ":flags",
1413 ]
1414 sources = [
1415 "tools/trace/ChromeTracingTracer.cpp",
1416 "tools/trace/ChromeTracingTracer.h",
1417 "tools/trace/EventTracingPriv.cpp",
1418 "tools/trace/EventTracingPriv.h",
1419 "tools/trace/SkDebugfTracer.cpp",
1420 "tools/trace/SkDebugfTracer.h",
1421 ]
1422 }
1423
mtkleinc095df52016-08-24 12:23:52 -07001424 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001425 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001426 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001427 "tools/AutoreleasePool.h",
mtkleinc095df52016-08-24 12:23:52 -07001428 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001429 "tools/DDLPromiseImageHelper.cpp",
1430 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001431 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001432 "tools/ProcStats.cpp",
1433 "tools/Resources.cpp",
Hal Canarye574f1e2019-07-15 14:01:37 -04001434 "tools/SkMetaData.cpp",
1435 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001436 "tools/SkSharingProc.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001437 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001438 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001439 "tools/debugger/DebugCanvas.cpp",
1440 "tools/debugger/DrawCommand.cpp",
1441 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001442 "tools/fonts/RandomScalerContext.cpp",
1443 "tools/fonts/TestEmptyTypeface.h",
1444 "tools/fonts/TestFontMgr.cpp",
1445 "tools/fonts/TestFontMgr.h",
1446 "tools/fonts/TestSVGTypeface.cpp",
1447 "tools/fonts/TestSVGTypeface.h",
1448 "tools/fonts/TestTypeface.cpp",
1449 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001450 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001451 "tools/random_parse_path.cpp",
Hal Canary41248072019-07-11 16:32:53 -04001452 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001453 "tools/timer/Timer.cpp",
1454 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001455 libs = []
1456 if (is_ios) {
1457 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001458 sources += [ "tools/ios_utils.h" ]
1459 if (skia_use_metal) {
1460 sources += [ "tools/AutoreleasePool.mm" ]
1461 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001462 libs += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001463 } else if (is_mac) {
1464 if (skia_use_metal) {
1465 sources += [ "tools/AutoreleasePool.mm" ]
1466 libs += [ "Foundation.framework" ]
1467 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001468 } else if (is_win) {
1469 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001470 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001471
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001472 defines = []
1473 if (skia_tools_require_resources) {
1474 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1475 }
mtkleinc095df52016-08-24 12:23:52 -07001476 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001477 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001478 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001479 ]
1480 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001481 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001482 ]
mtkleinc095df52016-08-24 12:23:52 -07001483 }
mtklein25c81d42016-07-27 13:55:26 -07001484
Mike Kleine11e5c12019-04-24 12:46:06 -05001485 test_lib("etc1") {
1486 sources = [
1487 "third_party/etc1/etc1.cpp",
1488 ]
1489 }
1490
Mike Reed7bf160e2019-05-17 16:50:51 -04001491 if (skia_use_ffmpeg) {
1492 test_lib("video_decoder") {
1493 sources = [
1494 "experimental/ffmpeg/SkVideoDecoder.cpp",
1495 "experimental/ffmpeg/SkVideoDecoder.h",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001496 "experimental/ffmpeg/SkVideoEncoder.cpp",
1497 "experimental/ffmpeg/SkVideoEncoder.h",
Mike Reed7bf160e2019-05-17 16:50:51 -04001498 ]
1499 libs = [
Mike Reedf97e8e92019-05-29 13:33:55 -04001500 "swscale",
Mike Reed7bf160e2019-05-17 16:50:51 -04001501 "avcodec",
1502 "avformat",
1503 "avutil",
1504 ]
1505 }
1506 }
1507
Mike Klein6e744122016-10-27 12:21:40 -04001508 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001509 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001510 sources = gm_sources
1511 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001512 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001513 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001514 ":skia",
1515 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001516 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001517 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001518 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001519 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001520 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001521 if (is_skia_dev_build) {
1522 sources += [ "gm/fiddle.cpp" ]
1523 deps += [ ":skia.h" ]
1524 }
Greg Danielda16cce2018-08-01 09:23:57 -04001525 public_deps = [
1526 ":gpu_tool_utils",
1527 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001528
1529 if (skia_use_ffmpeg) {
1530 deps += [ ":video_decoder" ]
1531 sources += [ "gm/video_decoder.cpp" ]
1532 }
mtkleinc095df52016-08-24 12:23:52 -07001533 }
mtklein25c81d42016-07-27 13:55:26 -07001534
Mike Klein7b7077c2019-06-03 17:10:59 -05001535 test_lib("skvm_builders") {
1536 sources = [
1537 "tools/SkVMBuilders.cpp",
1538 "tools/SkVMBuilders.h",
1539 ]
1540 }
1541
Mike Klein6e744122016-10-27 12:21:40 -04001542 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001543 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001544 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001545 if (skia_use_metal) {
1546 sources += metal_tests_sources
1547 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001548 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001549 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001550 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001551 if (!(skia_use_freetype && skia_use_fontconfig)) {
1552 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1553 }
mtkleinc095df52016-08-24 12:23:52 -07001554 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001555 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001556 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001557 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001558 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001559 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001560 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001561 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001562 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001563 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001564 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001565 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001566 "//third_party/zlib",
1567 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001568 public_deps = [
1569 ":gpu_tool_utils", # Test.h #includes headers from this target.
1570 ]
mtkleinc095df52016-08-24 12:23:52 -07001571 }
mtklein2f3416d2016-08-02 16:02:05 -07001572
Mike Klein6e744122016-10-27 12:21:40 -04001573 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001574 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001575 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001576 deps = [
1577 ":flags",
1578 ":gm",
1579 ":gpu_tool_utils",
1580 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001581 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001582 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001583 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001584 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001585 ]
1586 }
mtklein2b6870c2016-07-28 14:17:33 -07001587
mtkleinc095df52016-08-24 12:23:52 -07001588 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001589 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001590 sources = [
1591 "experimental/svg/model/SkSVGAttribute.cpp",
1592 "experimental/svg/model/SkSVGAttributeParser.cpp",
1593 "experimental/svg/model/SkSVGCircle.cpp",
1594 "experimental/svg/model/SkSVGClipPath.cpp",
1595 "experimental/svg/model/SkSVGContainer.cpp",
1596 "experimental/svg/model/SkSVGDOM.cpp",
1597 "experimental/svg/model/SkSVGEllipse.cpp",
1598 "experimental/svg/model/SkSVGGradient.cpp",
1599 "experimental/svg/model/SkSVGLine.cpp",
1600 "experimental/svg/model/SkSVGLinearGradient.cpp",
1601 "experimental/svg/model/SkSVGNode.cpp",
1602 "experimental/svg/model/SkSVGPath.cpp",
1603 "experimental/svg/model/SkSVGPattern.cpp",
1604 "experimental/svg/model/SkSVGPoly.cpp",
1605 "experimental/svg/model/SkSVGRadialGradient.cpp",
1606 "experimental/svg/model/SkSVGRect.cpp",
1607 "experimental/svg/model/SkSVGRenderContext.cpp",
1608 "experimental/svg/model/SkSVGSVG.cpp",
1609 "experimental/svg/model/SkSVGShape.cpp",
1610 "experimental/svg/model/SkSVGStop.cpp",
1611 "experimental/svg/model/SkSVGTransformableNode.cpp",
1612 "experimental/svg/model/SkSVGUse.cpp",
1613 "experimental/svg/model/SkSVGValue.cpp",
1614 ]
1615 deps = [
1616 ":skia",
1617 ":xml",
1618 ]
1619 }
mtkleinc095df52016-08-24 12:23:52 -07001620 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001621
Mike Reedd62d4062019-06-12 10:20:44 -04001622 test_lib("experimental_xform") {
1623 sources = [
1624 "experimental/xform/SkShape.cpp",
1625 "experimental/xform/SkXform.cpp",
1626 "experimental/xform/XContext.cpp",
1627 ]
1628 deps = [
1629 ":skia",
1630 ]
1631 }
1632
Mike Klein38af9432016-11-11 11:39:44 -05001633 if (skia_use_lua) {
1634 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001635 sources = [
1636 "src/utils/SkLua.cpp",
1637 "src/utils/SkLuaCanvas.cpp",
1638 ]
1639 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001640 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001641 "//third_party/lua",
1642 ]
1643 }
1644
Mike Kleine6682eb2017-01-05 10:54:57 -05001645 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001646 sources = [
1647 "tools/lua/lua_app.cpp",
1648 ]
1649 deps = [
1650 ":lua",
1651 ":skia",
1652 "//third_party/lua",
1653 ]
Mike Klein38af9432016-11-11 11:39:44 -05001654 }
1655
Mike Kleine6682eb2017-01-05 10:54:57 -05001656 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001657 sources = [
1658 "tools/lua/lua_pictures.cpp",
1659 ]
1660 deps = [
1661 ":flags",
1662 ":lua",
1663 ":skia",
1664 ":tool_utils",
1665 "//third_party/lua",
1666 ]
Mike Klein38af9432016-11-11 11:39:44 -05001667 }
1668 }
1669
Florin Malitabfe876a2018-09-02 12:33:59 -04001670 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001671 test_app("skottie_tool") {
1672 deps = [
1673 "modules/skottie:tool",
1674 ]
1675 }
1676 }
1677
Hal Canary5b39dc82019-04-17 13:29:46 -04001678 test_app("make_skqp_model") {
1679 sources = [
1680 "tools/skqp/make_skqp_model.cpp",
1681 ]
1682 deps = [
1683 ":skia",
1684 ]
1685 }
1686
Kevin Lubickebf648e2017-09-21 13:45:16 -04001687 if (target_cpu != "wasm") {
1688 import("gn/samples.gni")
1689 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001690 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001691 public_deps = [
1692 ":tool_utils",
1693 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001694 deps = [
1695 ":experimental_svg_model",
1696 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001697 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001698 ":xml",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001699 "modules/skparagraph:samples",
Mike Reedec80d902019-02-12 11:31:27 -05001700 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001701 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001702 ]
Mike Klein38af9432016-11-11 11:39:44 -05001703
Kevin Lubickebf648e2017-09-21 13:45:16 -04001704 if (skia_use_lua) {
1705 sources += [ "samplecode/SampleLua.cpp" ]
1706 deps += [
1707 ":lua",
1708 "//third_party/lua",
1709 ]
1710 }
1711 }
Mike Klein7af351a2018-07-27 09:54:43 -04001712 test_app("imgcvt") {
1713 sources = [
1714 "tools/imgcvt.cpp",
1715 ]
1716 deps = [
1717 ":skcms",
1718 ":skia",
1719 ]
1720 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001721 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001722 sources = [
1723 "tools/HashAndEncode.cpp",
1724 "tools/HashAndEncode.h",
1725 ]
1726 deps = [
1727 ":flags",
1728 ":skia",
1729 "//third_party/libpng",
1730 ]
1731 }
1732 test_app("fm") {
1733 sources = [
1734 "tools/fm/fm.cpp",
1735 ]
1736 deps = [
1737 ":common_flags_aa",
1738 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001739 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001740 ":flags",
1741 ":gm",
1742 ":gpu_tool_utils",
1743 ":hash_and_encode",
1744 ":skia",
1745 ":tool_utils",
1746 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001747 "modules/skottie",
1748 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001749 ]
1750 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001751 test_app("dm") {
1752 sources = [
1753 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001754 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001755 "dm/DMJsonWriter.cpp",
1756 "dm/DMSrcSink.cpp",
1757 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001758 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001759 ":common_flags_aa",
1760 ":common_flags_config",
1761 ":common_flags_gpu",
1762 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001763 ":experimental_svg_model",
1764 ":flags",
1765 ":gm",
1766 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001767 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001768 ":skia",
1769 ":tests",
1770 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001771 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001772 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001773 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001774 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001775 ]
1776 }
Brian Osman16adfa32016-10-18 14:42:44 -04001777 }
1778
Mike Kleina8a51ce2018-01-09 12:34:11 -05001779 if (!is_win) {
1780 test_app("remote_demo") {
1781 sources = [
1782 "tools/remote_demo.cpp",
1783 ]
1784 deps = [
1785 ":skia",
1786 ]
1787 }
1788 }
1789
Mike Kleine6682eb2017-01-05 10:54:57 -05001790 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001791 sources = [
1792 "bench/nanobench.cpp",
1793 ]
1794 deps = [
1795 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001796 ":common_flags_aa",
1797 ":common_flags_config",
1798 ":common_flags_gpu",
1799 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001800 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001801 ":flags",
1802 ":gm",
1803 ":gpu_tool_utils",
1804 ":skia",
1805 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001806 ":trace",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001807 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001808 "modules/sksg",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001809 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07001810 ]
mtklein2b6870c2016-07-28 14:17:33 -07001811 }
halcanary19a97202016-08-03 15:08:04 -07001812
Ravi Mistry10d36c52017-01-31 09:49:18 -05001813 test_app("skpinfo") {
1814 sources = [
1815 "tools/skpinfo.cpp",
1816 ]
1817 deps = [
1818 ":flags",
1819 ":skia",
1820 ]
1821 }
1822
Mike Reedc0ee21f2019-05-28 16:11:03 -04001823 if (skia_use_ffmpeg) {
1824 test_app("skottie2movie") {
1825 sources = [
1826 "tools/skottie2movie.cpp",
1827 ]
1828 deps = [
1829 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04001830 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001831 ":skia",
1832 ":video_decoder",
1833 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04001834 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001835 ]
1836 }
1837 }
1838
Brian Osmanc9a42472018-05-31 13:17:12 -04001839 test_app("skpbench") {
1840 sources = [
1841 "tools/skpbench/skpbench.cpp",
1842 ]
1843 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001844 ":common_flags_config",
1845 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001846 ":flags",
1847 ":gpu_tool_utils",
1848 ":skia",
1849 ":tool_utils",
1850 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001851 }
1852
Mike Kleine6682eb2017-01-05 10:54:57 -05001853 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001854 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001855 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001856 ]
1857 deps = [
1858 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001859 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001860 ]
halcanary3eee9d92016-09-10 07:01:53 -07001861 }
mtklein046cb562016-09-16 10:23:12 -07001862
Ben Wagner219f3622017-07-17 15:32:25 -04001863 test_app("create_test_font") {
1864 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001865 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001866 ]
1867 deps = [
1868 ":skia",
1869 ]
1870 assert_no_deps = [
1871 # tool_utils requires the output of this app.
1872 ":tool_utils",
1873 ]
1874 }
1875
Florin Malita5d3ff432018-07-31 16:38:43 -04001876 if (skia_use_expat) {
1877 test_app("create_test_font_color") {
1878 sources = [
1879 "tools/fonts/create_test_font_color.cpp",
1880 ]
1881 deps = [
1882 ":flags",
1883 ":skia",
1884 ":tool_utils",
1885 ]
1886 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001887 }
1888
Mike Kleine6682eb2017-01-05 10:54:57 -05001889 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001890 sources = [
1891 "tools/get_images_from_skps.cpp",
1892 ]
1893 deps = [
1894 ":flags",
1895 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001896 ]
mtklein046cb562016-09-16 10:23:12 -07001897 }
mtkleinecbc5262016-09-22 11:51:24 -07001898
Brian Osman6788a542018-12-10 11:56:01 -05001899 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001900 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001901 sources = [
1902 "tools/skiaserve/Request.cpp",
1903 "tools/skiaserve/Response.cpp",
1904 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001905 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1906 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1907 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1908 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1909 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1910 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1911 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1912 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1913 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001914 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1915 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001916 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1917 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1918 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1919 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1920 ]
1921 deps = [
1922 ":flags",
1923 ":gpu_tool_utils",
1924 ":skia",
1925 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001926 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04001927 ]
Mike Klein7d302882016-11-03 14:06:31 -04001928 }
mtkleinecbc5262016-09-22 11:51:24 -07001929 }
kjlubick14f984b2016-10-03 11:49:45 -07001930
Mike Kleine6682eb2017-01-05 10:54:57 -05001931 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001932 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001933 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001934 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001935 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001936 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001937 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001938 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001939 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001940 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001941 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001942 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001943 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001944 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001945 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001946 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1947 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001948 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001949 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001950 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001951 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001952 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1953 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04001954 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
1955 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04001956 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04001957 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001958 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001959 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001960 "tools/debugger/DebugCanvas.cpp",
1961 "tools/debugger/DrawCommand.cpp",
1962 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001963 ]
1964 deps = [
1965 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001966 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001967 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001968 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07001969 ]
kjlubick14f984b2016-10-03 11:49:45 -07001970 }
Mike Klein38312422016-10-05 15:41:01 -04001971
Mike Kleine6682eb2017-01-05 10:54:57 -05001972 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001973 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001974 rebase_path("tests/skia_test.cpp"),
1975 rebase_path("tests/Test.cpp"),
1976 ]
caryclark9feb6322016-10-25 08:58:26 -07001977 deps = [
1978 ":flags",
1979 ":gpu_tool_utils",
1980 ":skia",
1981 ":tool_utils",
1982 ]
caryclark9feb6322016-10-25 08:58:26 -07001983 }
1984
Mike Kleine6682eb2017-01-05 10:54:57 -05001985 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001986 sources = [
1987 "tools/DumpRecord.cpp",
1988 "tools/dump_record.cpp",
1989 ]
1990 deps = [
1991 ":flags",
1992 ":skia",
1993 ]
Mike Klein38312422016-10-05 15:41:01 -04001994 }
bungemanfe917272016-10-13 17:36:40 -04001995
Mike Kleine6682eb2017-01-05 10:54:57 -05001996 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001997 sources = [
1998 "tools/skdiff/skdiff.cpp",
1999 "tools/skdiff/skdiff_html.cpp",
2000 "tools/skdiff/skdiff_main.cpp",
2001 "tools/skdiff/skdiff_utils.cpp",
2002 ]
2003 deps = [
2004 ":skia",
2005 ":tool_utils",
2006 ]
bungemanfe917272016-10-13 17:36:40 -04002007 }
halcanarya73d76a2016-10-17 13:19:02 -07002008
Mike Kleine6682eb2017-01-05 10:54:57 -05002009 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002010 sources = [
2011 "tools/skp_parser.cpp",
2012 ]
2013 deps = [
2014 ":skia",
2015 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002016 ]
halcanarya73d76a2016-10-17 13:19:02 -07002017 }
Brian Osman16adfa32016-10-18 14:42:44 -04002018
Brian Osmanc9a42472018-05-31 13:17:12 -04002019 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002020 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002021 defines =
2022 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002023 sources = [
2024 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002025 "tools/skqp/src/skqp.cpp",
2026 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002027 ]
2028 deps = [
2029 ":gm",
2030 ":gpu_tool_utils",
2031 ":skia",
2032 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002033 ":tool_utils",
2034 ]
2035 }
2036 test_app("skqp") {
2037 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002038 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002039 ]
2040 deps = [
2041 ":skia",
2042 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002043 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002044 ]
2045 }
2046 test_app("jitter_gms") {
2047 sources = [
2048 "tools/skqp/jitter_gms.cpp",
2049 ]
2050 deps = [
2051 ":gm",
2052 ":skia",
2053 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002054 ]
2055 }
2056 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002057 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002058 test_app("skqp_app") {
2059 is_shared_library = true
2060 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002061 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002062 ]
2063 deps = [
2064 ":skia",
2065 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002066 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002067 ]
2068 libs = [ "android" ]
2069 }
2070 }
Stan Iliev93151722018-08-02 11:10:52 -04002071 if (is_android && skia_enable_gpu) {
2072 test_app("skottie_android") {
2073 is_shared_library = true
2074
2075 sources = [
2076 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2077 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2078 ]
2079 libs = []
2080
Stan Iliev93151722018-08-02 11:10:52 -04002081 deps = [
2082 ":skia",
2083 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002084 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002085 ]
2086 }
2087 }
Hal Canary75427132017-10-11 16:00:31 -04002088
Hal Canarya9de7602018-01-19 13:08:23 -05002089 test_app("list_gms") {
2090 sources = [
2091 "tools/list_gms.cpp",
2092 ]
2093 deps = [
2094 ":gm",
2095 ":skia",
2096 ]
2097 }
2098 test_app("list_gpu_unit_tests") {
2099 sources = [
2100 "dm/DMGpuTestProcs.cpp",
2101 "tools/list_gpu_unit_tests.cpp",
2102 ]
2103 deps = [
2104 ":skia",
2105 ":tests",
2106 ]
2107 }
2108
Brian Osmanc9a42472018-05-31 13:17:12 -04002109 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002110 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002111 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002112 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002113 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002114 sources = [
2115 "tools/sk_app/CommandSet.cpp",
2116 "tools/sk_app/GLWindowContext.cpp",
2117 "tools/sk_app/Window.cpp",
2118 ]
2119 libs = []
2120
Stephen Whitea800ec92019-08-02 15:04:52 -04002121 if (skia_use_dawn) {
2122 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
2123 }
2124
Brian Osmanc9a42472018-05-31 13:17:12 -04002125 if (is_android) {
2126 sources += [
2127 "tools/sk_app/android/GLWindowContext_android.cpp",
2128 "tools/sk_app/android/RasterWindowContext_android.cpp",
2129 "tools/sk_app/android/Window_android.cpp",
2130 "tools/sk_app/android/main_android.cpp",
2131 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002132 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002133 libs += [ "android" ]
2134 } else if (is_linux) {
2135 sources += [
2136 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2137 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2138 "tools/sk_app/unix/Window_unix.cpp",
2139 "tools/sk_app/unix/keysym2ucs.c",
2140 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002141 ]
Stephen Whitea800ec92019-08-02 15:04:52 -04002142 if (skia_use_dawn) {
2143 if (dawn_enable_vulkan) {
2144 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2145 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2146 libs += [ "X11-xcb" ]
2147 }
2148 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002149 libs += [
2150 "GL",
2151 "X11",
2152 ]
2153 } else if (is_win) {
2154 sources += [
2155 "tools/sk_app/win/GLWindowContext_win.cpp",
2156 "tools/sk_app/win/RasterWindowContext_win.cpp",
2157 "tools/sk_app/win/Window_win.cpp",
2158 "tools/sk_app/win/main_win.cpp",
2159 ]
Brian Salomon194db172017-08-17 14:37:06 -04002160 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002161 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002162 }
Stephen Whitea800ec92019-08-02 15:04:52 -04002163 if (skia_use_dawn) {
2164 if (dawn_enable_d3d12) {
2165 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2166 }
2167 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002168 } else if (is_mac) {
2169 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002170 "tools/sk_app/mac/GLWindowContext_mac.mm",
2171 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2172 "tools/sk_app/mac/Window_mac.mm",
2173 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002174 ]
Stephen Whitea800ec92019-08-02 15:04:52 -04002175 if (skia_use_dawn) {
2176 if (dawn_enable_metal) {
2177 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2178 }
2179 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002180 libs += [
2181 "QuartzCore.framework",
2182 "Cocoa.framework",
2183 "Foundation.framework",
2184 ]
2185 } else if (is_ios) {
2186 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002187 "tools/sk_app/ios/GLWindowContext_ios.mm",
2188 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2189 "tools/sk_app/ios/Window_ios.mm",
2190 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002191 ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002192 libs += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002193 }
2194
2195 if (skia_use_vulkan) {
2196 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2197 if (is_android) {
2198 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2199 } else if (is_linux) {
2200 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2201 libs += [ "X11-xcb" ]
2202 } else if (is_win) {
2203 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002204 } else if (is_mac) {
2205 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2206 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002207 }
2208 }
2209
Jim Van Verthbe39f712019-02-08 15:36:14 -05002210 if (skia_use_metal) {
2211 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2212 if (is_mac) {
2213 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002214 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002215 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002216 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002217 }
2218
Brian Osmanc9a42472018-05-31 13:17:12 -04002219 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002220 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002221 ]
2222 if (is_android) {
2223 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002224 }
2225 if (skia_use_angle) {
2226 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002227 }
Brian Osman16adfa32016-10-18 14:42:44 -04002228 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002229
Hal Canary87515122019-03-15 14:22:51 -04002230 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2231 test_app("fiddle_examples") {
2232 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002233 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002234 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002235 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002236 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002237 if (is_win) {
2238 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2239 }
Hal Canary87515122019-03-15 14:22:51 -04002240 deps = [
2241 ":skia",
2242 ":skia.h",
2243 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002244 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002245 ]
2246 }
2247 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002248 test_app("viewer") {
2249 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002250 sources = [
Hal Canary41248072019-07-11 16:32:53 -04002251 "tools/viewer/AnimTimer.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002252 "tools/viewer/BisectSlide.cpp",
2253 "tools/viewer/GMSlide.cpp",
2254 "tools/viewer/ImGuiLayer.cpp",
2255 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002256 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002257 "tools/viewer/SKPSlide.cpp",
2258 "tools/viewer/SampleSlide.cpp",
2259 "tools/viewer/SkottieSlide.cpp",
2260 "tools/viewer/SlideDir.cpp",
2261 "tools/viewer/StatsLayer.cpp",
2262 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002263 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002264 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002265 "tools/viewer/Viewer.cpp",
2266 ]
2267 libs = []
2268
Brian Osmanc9a42472018-05-31 13:17:12 -04002269 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002270 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002271 ":experimental_svg_model",
2272 ":flags",
2273 ":gm",
2274 ":gpu_tool_utils",
2275 ":samples",
2276 ":sk_app",
2277 ":skia",
2278 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002279 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002280 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002281 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002282 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002283 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002284 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002285 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002286 ]
Mike Reedd62d4062019-06-12 10:20:44 -04002287 if (skia_use_experimental_xform) {
2288 deps += [ ":experimental_xform" ]
2289 sources += [ "gm/xform.cpp" ]
2290 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002291 }
2292
Brian Osmanc9a42472018-05-31 13:17:12 -04002293 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002294 test_app("HelloWorld") {
2295 sources = [
2296 "example/HelloWorld.cpp",
2297 ]
2298 libs = []
2299
Brian Osmaneff04b52017-11-21 13:18:02 -05002300 deps = [
2301 ":flags",
2302 ":gpu_tool_utils",
2303 ":sk_app",
2304 ":skia",
2305 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002306 ]
2307 }
2308 }
2309
Brian Osmanc9a42472018-05-31 13:17:12 -04002310 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002311 test_app("SkiaSDLExample") {
2312 sources = [
2313 "example/SkiaSDLExample.cpp",
2314 ]
2315 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002316 deps = [
2317 ":gpu_tool_utils",
2318 ":skia",
2319 "//third_party/libsdl",
2320 ]
2321 }
2322 }
2323
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002324 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2325 action_foreach("generate_mocs") {
2326 script = "gn/call.py"
2327 sources = [
2328 "tools/mdbviz/MainWindow.h",
2329 ]
2330 outputs = [
2331 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2332 ]
2333 args = [
2334 "$skia_qt_path" + "/bin/moc",
2335 "{{source}}",
2336 "-o",
2337 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2338 ]
2339 }
2340 action_foreach("generate_resources") {
2341 script = "gn/call.py"
2342 sources = [
2343 "tools/mdbviz/resources.qrc",
2344 ]
2345 outputs = [
2346 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2347 ]
2348 args = [
2349 "$skia_qt_path" + "/bin/rcc",
2350 "{{source}}",
2351 "-o",
2352 "gen/mdbviz/{{source_name_part}}_res.cpp",
2353 ]
2354 }
2355 test_app("mdbviz") {
2356 if (is_win) {
2357 # on Windows we need to disable some exception handling warnings due to the Qt headers
2358 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2359 }
2360 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002361 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002362 "tools/debugger/DebugCanvas.cpp",
2363 "tools/debugger/DrawCommand.cpp",
2364 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002365 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002366 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002367 "tools/mdbviz/main.cpp",
2368
2369 # generated files
2370 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2371 "$target_gen_dir/mdbviz/resources_res.cpp",
2372 ]
2373 lib_dirs = [ "$skia_qt_path/lib" ]
2374 libs = [
2375 "Qt5Core.lib",
2376 "Qt5Gui.lib",
2377 "Qt5Widgets.lib",
2378 ]
2379 include_dirs = [
2380 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002381 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002382 "$skia_qt_path/include/QtWidgets",
2383 ]
2384 deps = [
2385 ":generate_mocs",
2386 ":generate_resources",
2387 ":skia",
2388 ]
2389 }
2390 }
2391
Mike Kleine459afd2017-03-03 09:21:30 -05002392 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002393 copy("gdbserver") {
2394 sources = [
2395 "$ndk/$ndk_gdbserver",
2396 ]
2397 outputs = [
2398 "$root_out_dir/gdbserver",
2399 ]
2400 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002401 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002402
2403 if (skia_use_opencl) {
2404 test_app("hello-opencl") {
2405 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002406 "tools/hello-opencl.cpp",
2407 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002408 deps = [
2409 "//third_party/opencl",
2410 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002411 }
2412 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002413
Brian Osmanf564f152019-07-23 15:14:30 -04002414 executable("cpu_modules") {
2415 sources = [
2416 "tools/cpu_modules.cpp",
2417 ]
2418 deps = [
2419 ":skia",
2420 "modules/particles",
2421 ]
2422 }
2423
Hal Canary1f94d392019-07-30 09:27:56 -04002424 if (skia_use_icu && skia_use_harfbuzz) {
2425 test_app("editor") {
2426 is_shared_library = is_android
2427 deps = [
Hal Canarya0b66fc2019-08-23 10:16:51 -04002428 "modules/skplaintexteditor:editor_app",
Hal Canary1f94d392019-07-30 09:27:56 -04002429 ]
2430 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002431 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002432
2433 executable("image_diff_metric") {
Brian Osmanaea77262019-09-20 09:20:07 -04002434 sources = [
2435 "tools/image_diff_metric.cpp",
2436 ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002437 deps = [
2438 ":skia",
2439 ]
2440 }
mtklein25c81d42016-07-27 13:55:26 -07002441}
Hal Canary932a2c02019-09-17 10:43:18 -04002442
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07002443if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04002444 group("minimal_ios_mtl_skia_app") {
2445 deps = [
2446 "experimental/minimal_ios_mtl_skia_app",
2447 ]
2448 }
2449 group("skottie_ios") {
2450 deps = [
2451 "experimental/skottie_ios",
2452 ]
2453 }
2454}