blob: 9db9eb11afd85fbd1154812763800bb80decd201 [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",
mtklein25c81d42016-07-27 13:55:26 -0700874 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700875 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700876 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700877 "src/codec/SkSwizzler.cpp",
878 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700879 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700880 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000881 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700882 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700883 "src/ports/SkMemory_malloc.cpp",
884 "src/ports/SkOSFile_stdio.cpp",
885 "src/sfnt/SkOTTable_name.cpp",
886 "src/sfnt/SkOTUtils.cpp",
887 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700888 ]
brettwb9447282016-09-01 14:24:39 -0700889
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400890 defines = []
mtklein7d6fb2c2016-08-25 14:50:44 -0700891 libs = []
892
mtkleinc04ff472016-06-23 10:29:30 -0700893 if (is_win) {
894 sources += [
895 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700896 "src/ports/SkImageEncoder_WIC.cpp",
897 "src/ports/SkImageGeneratorWIC.cpp",
898 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700899 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700900 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700901 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400902 libs += [
903 "FontSub.lib",
904 "Ole32.lib",
905 "OleAut32.lib",
906 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500907 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400908 ]
mtkleinc04ff472016-06-23 10:29:30 -0700909 } else {
910 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700911 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700912 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700913 "src/ports/SkTLS_pthread.cpp",
914 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400915 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700916 }
917
mtklein7d6fb2c2016-08-25 14:50:44 -0700918 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500919 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500920 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500921 deps += [ "//third_party/cpu-features" ]
922 }
mtklein06c35c02016-09-20 12:28:12 -0700923 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700924 libs += [
925 "EGL",
926 "GLESv2",
927 "log",
928 ]
929 }
930
Kevin Lubick217056c2018-09-20 17:39:31 -0400931 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700932 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400933 if (skia_use_egl) {
934 libs += [ "GLESv2" ]
935 }
mtkleinc04ff472016-06-23 10:29:30 -0700936 }
937
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500938 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800939 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500940 }
941
mtkleinc04ff472016-06-23 10:29:30 -0700942 if (is_mac) {
943 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700944 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700945 "src/ports/SkImageEncoder_CG.cpp",
946 "src/ports/SkImageGeneratorCG.cpp",
947 ]
mtklein09e61f72016-08-23 13:35:28 -0700948 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400949 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
950 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700951 "ApplicationServices.framework",
952 "OpenGL.framework",
953 ]
mtkleinc04ff472016-06-23 10:29:30 -0700954 }
abarth6fc8ff02016-07-15 15:15:15 -0700955
Mike Klein7d302882016-11-03 14:06:31 -0400956 if (is_ios) {
957 sources += [
958 "src/ports/SkDebug_stdio.cpp",
959 "src/ports/SkFontHost_mac.cpp",
960 "src/ports/SkImageEncoder_CG.cpp",
961 "src/ports/SkImageGeneratorCG.cpp",
962 ]
963 libs += [
964 "CoreFoundation.framework",
965 "CoreGraphics.framework",
966 "CoreText.framework",
967 "ImageIO.framework",
968 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400969
970 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
971 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400972 ]
973 }
974
abarth6fc8ff02016-07-15 15:15:15 -0700975 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700976 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700977 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400978
979 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -0400980 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400981 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
982 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -0400983
984 if (skia_include_multiframe_procs) {
985 sources += [ "tools/SkSharingProc.cpp" ]
986 }
mtkleinc04ff472016-06-23 10:29:30 -0700987}
988
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500989# DebugCanvas used in experimental/wasm-skp-debugger
990if (target_cpu == "wasm") {
991 static_library("debugcanvas") {
992 public_configs = [ ":skia_public" ]
993
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500994 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -0400995 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500996 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -0500997 "tools/debugger/DebugCanvas.cpp",
998 "tools/debugger/DrawCommand.cpp",
999 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001000 ]
1001
1002 deps = [
1003 ":fontmgr_wasm",
1004 ]
1005 }
1006}
1007
Kevin Lubickcbcff382018-10-02 09:02:18 -04001008static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001009 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001010 public_configs = [ ":skia_public" ]
1011 configs += skia_library_configs
1012
1013 deps = [
1014 ":arm64",
1015 ":armv7",
1016 ":avx",
1017 ":crc32",
1018 ":hsw",
1019 ":none",
1020 ":sse2",
1021 ":sse41",
1022 ":sse42",
1023 ":ssse3",
1024 ]
1025
1026 # This file (and all GN files in Skia) are designed to work with an
1027 # empty sources assignment filter; we handle all that explicitly.
1028 # We clear the filter here for clients who may have set up a global filter.
1029 set_sources_assignment_filter([])
1030
1031 sources = []
1032 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001033 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001034 sources += [
1035 "src/core/SkAnalyticEdge.cpp",
1036 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001037 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001038 "src/core/SkCubicMap.cpp",
1039 "src/core/SkEdge.cpp",
1040 "src/core/SkEdgeBuilder.cpp",
1041 "src/core/SkEdgeClipper.cpp",
1042 "src/core/SkGeometry.cpp",
1043 "src/core/SkLineClipper.cpp",
1044 "src/core/SkMallocPixelRef.cpp",
1045 "src/core/SkMath.cpp",
1046 "src/core/SkMatrix.cpp",
1047 "src/core/SkOpts.cpp",
1048 "src/core/SkPaint.cpp",
1049 "src/core/SkPath.cpp",
1050 "src/core/SkPathEffect.cpp",
1051 "src/core/SkPathMeasure.cpp",
1052 "src/core/SkPathRef.cpp",
1053 "src/core/SkPoint.cpp",
1054 "src/core/SkRRect.cpp",
1055 "src/core/SkRect.cpp",
1056 "src/core/SkSemaphore.cpp",
1057 "src/core/SkStream.cpp",
1058 "src/core/SkString.cpp",
1059 "src/core/SkStringUtils.cpp",
1060 "src/core/SkStroke.cpp",
1061 "src/core/SkStrokeRec.cpp",
1062 "src/core/SkStrokerPriv.cpp",
1063 "src/core/SkThreadID.cpp",
1064 "src/core/SkUtils.cpp",
1065 "src/effects/SkDashPathEffect.cpp",
1066 "src/effects/SkTrimPathEffect.cpp",
1067 "src/ports/SkDebug_stdio.cpp",
1068 "src/ports/SkMemory_malloc.cpp",
1069 "src/utils/SkDashPath.cpp",
1070 "src/utils/SkParse.cpp",
1071 "src/utils/SkParsePath.cpp",
1072 "src/utils/SkUTF.cpp",
1073 ]
1074}
1075
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001076group("modules") {
1077 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001078 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001079 "modules/skottie",
1080 "modules/skshaper",
1081 ]
1082}
1083
mtkleinc095df52016-08-24 12:23:52 -07001084# Targets guarded by skia_enable_tools may use //third_party freely.
1085if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001086 skia_public_includes = [
1087 "include/android",
1088 "include/atlastext",
1089 "include/c",
1090 "include/codec",
1091 "include/config",
1092 "include/core",
1093 "include/docs",
1094 "include/effects",
1095 "include/encode",
1096 "include/gpu",
1097 "include/pathops",
1098 "include/ports",
1099 "include/svg",
1100 "include/utils",
1101 "include/utils/mac",
1102 "modules/sksg/include",
1103 "modules/skshaper/include",
1104 "modules/skottie/include",
1105 ]
1106
Mike Klein308b5ac2016-12-06 16:03:52 -05001107 # Used by gn_to_bp.py to list our public include dirs.
1108 source_set("public") {
1109 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001110 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001111 }
1112
Mike Kleinc36dedf2016-11-18 09:35:28 -05001113 config("skia.h_config") {
1114 include_dirs = [ "$target_gen_dir" ]
1115 }
1116 action("skia.h") {
1117 public_configs = [ ":skia.h_config" ]
1118 skia_h = "$target_gen_dir/skia.h"
1119 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001120
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001121 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1122 [ rebase_path(skia_h, root_build_dir) ] +
1123 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001124 depfile = "$skia_h.deps"
1125 outputs = [
1126 skia_h,
1127 ]
1128 }
1129
Brian Osmanc9a42472018-05-31 13:17:12 -04001130 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001131 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001132 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001133 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001134 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001135 "tools/fiddle/draw.cpp",
1136 "tools/fiddle/fiddle_main.cpp",
1137 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001138
1139 if (skia_use_egl) {
1140 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001141 } else {
1142 sources += [ "tools/fiddle/null_context.cpp" ]
1143 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001144 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001145 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001146 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001147 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001148 ":skia",
1149 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001150 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001151 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001152 ]
1153 }
1154 }
1155
Mike Klein9e25bb92019-04-29 09:46:36 -05001156 config("our_vulkan_headers") {
1157 # We add this directory to simulate the client already have
1158 # vulkan/vulkan_core.h on their path.
1159 include_dirs = [ "include/third_party/vulkan" ]
1160 }
1161
Brian Osmanc9a42472018-05-31 13:17:12 -04001162 source_set("public_headers_warnings_check") {
1163 sources = [
1164 "tools/public_headers_warnings_check.cpp",
1165 ]
1166 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001167 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001168 deps = [
1169 ":skia",
1170 ":skia.h",
1171 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001172 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001173 ]
Stephen White0d70b712019-07-10 15:51:30 -04001174
1175 if (skia_use_dawn) {
1176 deps += [ "//third_party/dawn:dawn_headers" ]
1177 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001178 }
1179
mtkleinc095df52016-08-24 12:23:52 -07001180 template("test_lib") {
1181 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001182 if (defined(invoker.public_defines)) {
1183 defines = invoker.public_defines
1184 }
mtklein25c81d42016-07-27 13:55:26 -07001185 }
mtkleinc095df52016-08-24 12:23:52 -07001186 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001187 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001188 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001189 public_configs = [
1190 ":" + target_name + "_config",
1191 ":skia_private",
1192 ]
1193
1194 if (!defined(deps)) {
1195 deps = []
1196 }
1197 deps += [ ":skia" ]
1198 testonly = true
1199 }
mtklein25c81d42016-07-27 13:55:26 -07001200 }
mtklein25c81d42016-07-27 13:55:26 -07001201
Mike Kleine6682eb2017-01-05 10:54:57 -05001202 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001203 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001204 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001205 forward_variables_from(invoker,
1206 "*",
1207 [
1208 "output_name",
1209 "visibility",
1210 "is_shared_library",
1211 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001212 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001213 extra_configs = [ ":skia_private" ]
1214 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1215 data_sources = [ "resources" ]
1216 if ("True" == exec_script("//gn/checkdir.py",
1217 [ rebase_path("skps", root_build_dir) ],
1218 "trim string")) {
1219 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001220 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001221 }
1222 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001223 # !is_ios
1224
1225 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1226 shared_library("lib" + target_name) {
1227 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1228 configs += [ ":skia_private" ]
1229 testonly = true
1230 }
1231 } else {
1232 _executable = target_name
1233 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001234 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001235 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1236 configs += [ ":skia_private" ]
1237 testonly = true
1238 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001239 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001240 if (is_android && skia_android_serial != "" && defined(_executable)) {
1241 action("push_" + target_name) {
1242 script = "gn/push_to_android.py"
1243 deps = [
1244 ":" + _executable,
1245 ]
1246 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1247 outputs = [
1248 _stamp,
1249 ]
1250 args = [
1251 rebase_path("$root_build_dir/$_executable"),
1252 skia_android_serial,
1253 rebase_path(_stamp),
1254 ]
1255 testonly = true
1256 }
Mike Klein7d921032017-01-05 12:20:41 -05001257 }
1258 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001259 }
1260
Greg Danielda16cce2018-08-01 09:23:57 -04001261 config("moltenvk_config") {
1262 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1263 if (is_ios) {
1264 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1265 } else {
1266 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1267 }
1268 cflags = [ "-F$moltenvk_framework_path" ]
1269 ldflags = [ "-F$moltenvk_framework_path" ]
1270 libs = [
1271 "MoltenVK.framework",
1272 "Metal.framework",
1273 "IOSurface.framework",
1274 "QuartzCore.framework",
1275 "Foundation.framework",
1276 ]
1277 if (is_ios) {
1278 libs += [ "UIKit.framework" ]
1279 } else {
1280 libs += [ "IOKit.framework" ]
1281 }
1282 defines = [ "SK_MOLTENVK" ]
1283 }
1284 }
1285
1286 source_set("moltenvk") {
1287 public_configs = [ ":moltenvk_config" ]
1288 }
1289
mtkleinc095df52016-08-24 12:23:52 -07001290 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001291 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001292
Mike Klein9e25bb92019-04-29 09:46:36 -05001293 # Bots and even devs may not have Vulkan headers, so put
1294 # include/third_party/vulkan on our path so they're always available.
1295 all_dependent_configs = [ ":our_vulkan_headers" ]
1296
Mike Klein333fb452019-04-24 08:48:11 -05001297 defines = []
1298 if (skia_enable_discrete_gpu) {
1299 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1300 }
1301
Brian Osmanc9a42472018-05-31 13:17:12 -04001302 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001303 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001304 sources = [
1305 "tools/gpu/GrContextFactory.cpp",
1306 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001307 "tools/gpu/MemoryCache.cpp",
1308 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001309 "tools/gpu/ProxyUtils.cpp",
1310 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001311 "tools/gpu/YUVUtils.cpp",
1312 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001313 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1314 "tools/gpu/gl/GLTestContext.cpp",
1315 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001316 "tools/gpu/mock/MockTestContext.cpp",
1317 ]
1318 libs = []
1319
1320 if (is_android || skia_use_egl) {
1321 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1322 } else if (is_ios) {
1323 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1324 libs += [ "OpenGLES.framework" ]
1325 } else if (is_linux) {
1326 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001327 libs += [
1328 "GLU",
1329 "X11",
1330 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001331 } else if (is_mac) {
1332 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1333 } else if (is_win) {
1334 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001335 libs += [ "Gdi32.lib" ]
1336 if (target_cpu != "arm64") {
1337 libs += [ "OpenGL32.lib" ]
1338 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001339 }
mtklein25c81d42016-07-27 13:55:26 -07001340
Brian Osmanc9a42472018-05-31 13:17:12 -04001341 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001342
Brian Osmanc9a42472018-05-31 13:17:12 -04001343 if (skia_use_angle) {
1344 deps += [ "//third_party/angle2" ]
1345 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1346 }
Greg Daniel54200e42018-12-11 17:03:39 -05001347
Brian Osmanc9a42472018-05-31 13:17:12 -04001348 if (skia_use_vulkan) {
1349 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1350 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001351 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1352 public_deps += [ ":moltenvk" ]
1353 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001354 }
1355 if (skia_use_metal) {
1356 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001357 }
Stephen White985741a2019-07-18 11:43:45 -04001358 if (skia_use_dawn) {
1359 public_deps += [ "//third_party/dawn:dawn_headers" ]
1360 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
1361 }
mtklein25c81d42016-07-27 13:55:26 -07001362 }
mtklein25c81d42016-07-27 13:55:26 -07001363
mtkleinc095df52016-08-24 12:23:52 -07001364 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001365 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001366 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001367 ]
1368 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001369
1370 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001371 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001372 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001373 ]
1374 deps = [
mtklein046cb562016-09-16 10:23:12 -07001375 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001376 ]
1377 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001378 ":gpu_tool_utils",
1379 ]
1380 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001381 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001382 sources = [
1383 "tools/flags/CommonFlagsGpu.cpp",
1384 ]
1385 deps = [
1386 ":flags",
1387 ]
1388 public_deps = [
1389 ":gpu_tool_utils",
1390 ]
1391 }
1392 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001393 sources = [
1394 "tools/flags/CommonFlagsImages.cpp",
1395 ]
1396 deps = [
1397 ":flags",
1398 ]
1399 }
1400 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001401 sources = [
1402 "tools/flags/CommonFlagsAA.cpp",
1403 ]
1404 deps = [
1405 ":flags",
1406 ]
1407 }
mtklein25c81d42016-07-27 13:55:26 -07001408
Mike Klein499f0ac2019-03-25 13:00:12 -05001409 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001410 deps = [
1411 ":flags",
1412 ]
1413 sources = [
1414 "tools/trace/ChromeTracingTracer.cpp",
1415 "tools/trace/ChromeTracingTracer.h",
1416 "tools/trace/EventTracingPriv.cpp",
1417 "tools/trace/EventTracingPriv.h",
1418 "tools/trace/SkDebugfTracer.cpp",
1419 "tools/trace/SkDebugfTracer.h",
1420 ]
1421 }
1422
mtkleinc095df52016-08-24 12:23:52 -07001423 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001424 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001425 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001426 "tools/AutoreleasePool.h",
mtkleinc095df52016-08-24 12:23:52 -07001427 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001428 "tools/DDLPromiseImageHelper.cpp",
1429 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001430 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001431 "tools/ProcStats.cpp",
1432 "tools/Resources.cpp",
Hal Canarye574f1e2019-07-15 14:01:37 -04001433 "tools/SkMetaData.cpp",
1434 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001435 "tools/SkSharingProc.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001436 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001437 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001438 "tools/debugger/DebugCanvas.cpp",
1439 "tools/debugger/DrawCommand.cpp",
1440 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001441 "tools/fonts/RandomScalerContext.cpp",
1442 "tools/fonts/TestEmptyTypeface.h",
1443 "tools/fonts/TestFontMgr.cpp",
1444 "tools/fonts/TestFontMgr.h",
1445 "tools/fonts/TestSVGTypeface.cpp",
1446 "tools/fonts/TestSVGTypeface.h",
1447 "tools/fonts/TestTypeface.cpp",
1448 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001449 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001450 "tools/random_parse_path.cpp",
Hal Canary41248072019-07-11 16:32:53 -04001451 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001452 "tools/timer/Timer.cpp",
1453 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001454 libs = []
1455 if (is_ios) {
1456 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001457 sources += [ "tools/ios_utils.h" ]
1458 if (skia_use_metal) {
1459 sources += [ "tools/AutoreleasePool.mm" ]
1460 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001461 libs += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001462 } else if (is_mac) {
1463 if (skia_use_metal) {
1464 sources += [ "tools/AutoreleasePool.mm" ]
1465 libs += [ "Foundation.framework" ]
1466 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001467 } else if (is_win) {
1468 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001469 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001470
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001471 defines = []
1472 if (skia_tools_require_resources) {
1473 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1474 }
mtkleinc095df52016-08-24 12:23:52 -07001475 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001476 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001477 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001478 ]
1479 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001480 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001481 ]
mtkleinc095df52016-08-24 12:23:52 -07001482 }
mtklein25c81d42016-07-27 13:55:26 -07001483
Mike Kleine11e5c12019-04-24 12:46:06 -05001484 test_lib("etc1") {
1485 sources = [
1486 "third_party/etc1/etc1.cpp",
1487 ]
1488 }
1489
Mike Reed7bf160e2019-05-17 16:50:51 -04001490 if (skia_use_ffmpeg) {
1491 test_lib("video_decoder") {
1492 sources = [
1493 "experimental/ffmpeg/SkVideoDecoder.cpp",
1494 "experimental/ffmpeg/SkVideoDecoder.h",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001495 "experimental/ffmpeg/SkVideoEncoder.cpp",
1496 "experimental/ffmpeg/SkVideoEncoder.h",
Mike Reed7bf160e2019-05-17 16:50:51 -04001497 ]
1498 libs = [
Mike Reedf97e8e92019-05-29 13:33:55 -04001499 "swscale",
Mike Reed7bf160e2019-05-17 16:50:51 -04001500 "avcodec",
1501 "avformat",
1502 "avutil",
1503 ]
1504 }
1505 }
1506
Mike Klein6e744122016-10-27 12:21:40 -04001507 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001508 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001509 sources = gm_sources
1510 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001511 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001512 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001513 ":skia",
1514 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001515 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001516 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001517 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001518 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001519 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001520 if (is_skia_dev_build) {
1521 sources += [ "gm/fiddle.cpp" ]
1522 deps += [ ":skia.h" ]
1523 }
Greg Danielda16cce2018-08-01 09:23:57 -04001524 public_deps = [
1525 ":gpu_tool_utils",
1526 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001527
1528 if (skia_use_ffmpeg) {
1529 deps += [ ":video_decoder" ]
1530 sources += [ "gm/video_decoder.cpp" ]
1531 }
mtkleinc095df52016-08-24 12:23:52 -07001532 }
mtklein25c81d42016-07-27 13:55:26 -07001533
Mike Klein7b7077c2019-06-03 17:10:59 -05001534 test_lib("skvm_builders") {
1535 sources = [
1536 "tools/SkVMBuilders.cpp",
1537 "tools/SkVMBuilders.h",
1538 ]
1539 }
1540
Mike Klein6e744122016-10-27 12:21:40 -04001541 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001542 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001543 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001544 if (skia_use_metal) {
1545 sources += metal_tests_sources
1546 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001547 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001548 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001549 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001550 if (!(skia_use_freetype && skia_use_fontconfig)) {
1551 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1552 }
mtkleinc095df52016-08-24 12:23:52 -07001553 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001554 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001555 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001556 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001557 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001558 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001559 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001560 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001561 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001562 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001563 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001564 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001565 "//third_party/zlib",
1566 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001567 public_deps = [
1568 ":gpu_tool_utils", # Test.h #includes headers from this target.
1569 ]
mtkleinc095df52016-08-24 12:23:52 -07001570 }
mtklein2f3416d2016-08-02 16:02:05 -07001571
Mike Klein6e744122016-10-27 12:21:40 -04001572 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001573 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001574 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001575 deps = [
1576 ":flags",
1577 ":gm",
1578 ":gpu_tool_utils",
1579 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001580 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001581 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001582 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001583 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001584 ]
1585 }
mtklein2b6870c2016-07-28 14:17:33 -07001586
mtkleinc095df52016-08-24 12:23:52 -07001587 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001588 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001589 sources = [
1590 "experimental/svg/model/SkSVGAttribute.cpp",
1591 "experimental/svg/model/SkSVGAttributeParser.cpp",
1592 "experimental/svg/model/SkSVGCircle.cpp",
1593 "experimental/svg/model/SkSVGClipPath.cpp",
1594 "experimental/svg/model/SkSVGContainer.cpp",
1595 "experimental/svg/model/SkSVGDOM.cpp",
1596 "experimental/svg/model/SkSVGEllipse.cpp",
1597 "experimental/svg/model/SkSVGGradient.cpp",
1598 "experimental/svg/model/SkSVGLine.cpp",
1599 "experimental/svg/model/SkSVGLinearGradient.cpp",
1600 "experimental/svg/model/SkSVGNode.cpp",
1601 "experimental/svg/model/SkSVGPath.cpp",
1602 "experimental/svg/model/SkSVGPattern.cpp",
1603 "experimental/svg/model/SkSVGPoly.cpp",
1604 "experimental/svg/model/SkSVGRadialGradient.cpp",
1605 "experimental/svg/model/SkSVGRect.cpp",
1606 "experimental/svg/model/SkSVGRenderContext.cpp",
1607 "experimental/svg/model/SkSVGSVG.cpp",
1608 "experimental/svg/model/SkSVGShape.cpp",
1609 "experimental/svg/model/SkSVGStop.cpp",
1610 "experimental/svg/model/SkSVGTransformableNode.cpp",
1611 "experimental/svg/model/SkSVGUse.cpp",
1612 "experimental/svg/model/SkSVGValue.cpp",
1613 ]
1614 deps = [
1615 ":skia",
1616 ":xml",
1617 ]
1618 }
mtkleinc095df52016-08-24 12:23:52 -07001619 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001620
Mike Reedd62d4062019-06-12 10:20:44 -04001621 test_lib("experimental_xform") {
1622 sources = [
1623 "experimental/xform/SkShape.cpp",
1624 "experimental/xform/SkXform.cpp",
1625 "experimental/xform/XContext.cpp",
1626 ]
1627 deps = [
1628 ":skia",
1629 ]
1630 }
1631
Mike Klein38af9432016-11-11 11:39:44 -05001632 if (skia_use_lua) {
1633 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001634 sources = [
1635 "src/utils/SkLua.cpp",
1636 "src/utils/SkLuaCanvas.cpp",
1637 ]
1638 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001639 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001640 "//third_party/lua",
1641 ]
1642 }
1643
Mike Kleine6682eb2017-01-05 10:54:57 -05001644 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001645 sources = [
1646 "tools/lua/lua_app.cpp",
1647 ]
1648 deps = [
1649 ":lua",
1650 ":skia",
1651 "//third_party/lua",
1652 ]
Mike Klein38af9432016-11-11 11:39:44 -05001653 }
1654
Mike Kleine6682eb2017-01-05 10:54:57 -05001655 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001656 sources = [
1657 "tools/lua/lua_pictures.cpp",
1658 ]
1659 deps = [
1660 ":flags",
1661 ":lua",
1662 ":skia",
1663 ":tool_utils",
1664 "//third_party/lua",
1665 ]
Mike Klein38af9432016-11-11 11:39:44 -05001666 }
1667 }
1668
Florin Malitabfe876a2018-09-02 12:33:59 -04001669 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001670 test_app("skottie_tool") {
1671 deps = [
1672 "modules/skottie:tool",
1673 ]
1674 }
1675 }
1676
Hal Canary5b39dc82019-04-17 13:29:46 -04001677 test_app("make_skqp_model") {
1678 sources = [
1679 "tools/skqp/make_skqp_model.cpp",
1680 ]
1681 deps = [
1682 ":skia",
1683 ]
1684 }
1685
Kevin Lubickebf648e2017-09-21 13:45:16 -04001686 if (target_cpu != "wasm") {
1687 import("gn/samples.gni")
1688 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001689 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001690 public_deps = [
1691 ":tool_utils",
1692 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001693 deps = [
1694 ":experimental_svg_model",
1695 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001696 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001697 ":xml",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001698 "modules/skparagraph:samples",
Mike Reedec80d902019-02-12 11:31:27 -05001699 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001700 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001701 ]
Mike Klein38af9432016-11-11 11:39:44 -05001702
Kevin Lubickebf648e2017-09-21 13:45:16 -04001703 if (skia_use_lua) {
1704 sources += [ "samplecode/SampleLua.cpp" ]
1705 deps += [
1706 ":lua",
1707 "//third_party/lua",
1708 ]
1709 }
1710 }
Mike Klein7af351a2018-07-27 09:54:43 -04001711 test_app("imgcvt") {
1712 sources = [
1713 "tools/imgcvt.cpp",
1714 ]
1715 deps = [
1716 ":skcms",
1717 ":skia",
1718 ]
1719 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001720 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001721 sources = [
1722 "tools/HashAndEncode.cpp",
1723 "tools/HashAndEncode.h",
1724 ]
1725 deps = [
1726 ":flags",
1727 ":skia",
1728 "//third_party/libpng",
1729 ]
1730 }
1731 test_app("fm") {
1732 sources = [
1733 "tools/fm/fm.cpp",
1734 ]
1735 deps = [
1736 ":common_flags_aa",
1737 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001738 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001739 ":flags",
1740 ":gm",
1741 ":gpu_tool_utils",
1742 ":hash_and_encode",
1743 ":skia",
1744 ":tool_utils",
1745 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001746 "modules/skottie",
1747 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001748 ]
1749 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001750 test_app("dm") {
1751 sources = [
1752 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001753 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001754 "dm/DMJsonWriter.cpp",
1755 "dm/DMSrcSink.cpp",
1756 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001757 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001758 ":common_flags_aa",
1759 ":common_flags_config",
1760 ":common_flags_gpu",
1761 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001762 ":experimental_svg_model",
1763 ":flags",
1764 ":gm",
1765 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001766 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001767 ":skia",
1768 ":tests",
1769 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001770 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001771 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001772 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001773 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001774 ]
1775 }
Brian Osman16adfa32016-10-18 14:42:44 -04001776 }
1777
Mike Kleina8a51ce2018-01-09 12:34:11 -05001778 if (!is_win) {
1779 test_app("remote_demo") {
1780 sources = [
1781 "tools/remote_demo.cpp",
1782 ]
1783 deps = [
1784 ":skia",
1785 ]
1786 }
1787 }
1788
Mike Kleine6682eb2017-01-05 10:54:57 -05001789 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001790 sources = [
1791 "bench/nanobench.cpp",
1792 ]
1793 deps = [
1794 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001795 ":common_flags_aa",
1796 ":common_flags_config",
1797 ":common_flags_gpu",
1798 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001799 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001800 ":flags",
1801 ":gm",
1802 ":gpu_tool_utils",
1803 ":skia",
1804 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001805 ":trace",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001806 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001807 "modules/sksg",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001808 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07001809 ]
mtklein2b6870c2016-07-28 14:17:33 -07001810 }
halcanary19a97202016-08-03 15:08:04 -07001811
Ravi Mistry10d36c52017-01-31 09:49:18 -05001812 test_app("skpinfo") {
1813 sources = [
1814 "tools/skpinfo.cpp",
1815 ]
1816 deps = [
1817 ":flags",
1818 ":skia",
1819 ]
1820 }
1821
Mike Reedc0ee21f2019-05-28 16:11:03 -04001822 if (skia_use_ffmpeg) {
1823 test_app("skottie2movie") {
1824 sources = [
1825 "tools/skottie2movie.cpp",
1826 ]
1827 deps = [
1828 ":flags",
1829 ":skia",
1830 ":video_decoder",
1831 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04001832 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001833 ]
1834 }
1835 }
1836
Brian Osmanc9a42472018-05-31 13:17:12 -04001837 test_app("skpbench") {
1838 sources = [
1839 "tools/skpbench/skpbench.cpp",
1840 ]
1841 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001842 ":common_flags_config",
1843 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001844 ":flags",
1845 ":gpu_tool_utils",
1846 ":skia",
1847 ":tool_utils",
1848 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001849 }
1850
Mike Kleine6682eb2017-01-05 10:54:57 -05001851 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001852 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001853 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001854 ]
1855 deps = [
1856 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001857 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001858 ]
halcanary3eee9d92016-09-10 07:01:53 -07001859 }
mtklein046cb562016-09-16 10:23:12 -07001860
Ben Wagner219f3622017-07-17 15:32:25 -04001861 test_app("create_test_font") {
1862 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001863 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001864 ]
1865 deps = [
1866 ":skia",
1867 ]
1868 assert_no_deps = [
1869 # tool_utils requires the output of this app.
1870 ":tool_utils",
1871 ]
1872 }
1873
Florin Malita5d3ff432018-07-31 16:38:43 -04001874 if (skia_use_expat) {
1875 test_app("create_test_font_color") {
1876 sources = [
1877 "tools/fonts/create_test_font_color.cpp",
1878 ]
1879 deps = [
1880 ":flags",
1881 ":skia",
1882 ":tool_utils",
1883 ]
1884 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001885 }
1886
Mike Kleine6682eb2017-01-05 10:54:57 -05001887 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001888 sources = [
1889 "tools/get_images_from_skps.cpp",
1890 ]
1891 deps = [
1892 ":flags",
1893 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001894 ]
mtklein046cb562016-09-16 10:23:12 -07001895 }
mtkleinecbc5262016-09-22 11:51:24 -07001896
Brian Osman6788a542018-12-10 11:56:01 -05001897 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001898 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001899 sources = [
1900 "tools/skiaserve/Request.cpp",
1901 "tools/skiaserve/Response.cpp",
1902 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001903 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1904 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1905 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1906 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1907 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1908 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1909 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1910 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1911 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001912 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1913 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001914 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1915 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1916 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1917 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1918 ]
1919 deps = [
1920 ":flags",
1921 ":gpu_tool_utils",
1922 ":skia",
1923 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001924 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04001925 ]
Mike Klein7d302882016-11-03 14:06:31 -04001926 }
mtkleinecbc5262016-09-22 11:51:24 -07001927 }
kjlubick14f984b2016-10-03 11:49:45 -07001928
Mike Kleine6682eb2017-01-05 10:54:57 -05001929 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001930 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001931 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001932 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001933 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001934 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001935 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001936 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001937 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001938 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001939 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001940 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001941 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001942 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001943 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001944 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1945 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001946 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001947 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001948 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001949 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001950 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1951 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04001952 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
1953 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04001954 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04001955 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001956 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001957 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001958 "tools/debugger/DebugCanvas.cpp",
1959 "tools/debugger/DrawCommand.cpp",
1960 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001961 ]
1962 deps = [
1963 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001964 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001965 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001966 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07001967 ]
kjlubick14f984b2016-10-03 11:49:45 -07001968 }
Mike Klein38312422016-10-05 15:41:01 -04001969
Mike Kleine6682eb2017-01-05 10:54:57 -05001970 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001971 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001972 rebase_path("tests/skia_test.cpp"),
1973 rebase_path("tests/Test.cpp"),
1974 ]
caryclark9feb6322016-10-25 08:58:26 -07001975 deps = [
1976 ":flags",
1977 ":gpu_tool_utils",
1978 ":skia",
1979 ":tool_utils",
1980 ]
caryclark9feb6322016-10-25 08:58:26 -07001981 }
1982
Mike Kleine6682eb2017-01-05 10:54:57 -05001983 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001984 sources = [
1985 "tools/DumpRecord.cpp",
1986 "tools/dump_record.cpp",
1987 ]
1988 deps = [
1989 ":flags",
1990 ":skia",
1991 ]
Mike Klein38312422016-10-05 15:41:01 -04001992 }
bungemanfe917272016-10-13 17:36:40 -04001993
Mike Kleine6682eb2017-01-05 10:54:57 -05001994 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001995 sources = [
1996 "tools/skdiff/skdiff.cpp",
1997 "tools/skdiff/skdiff_html.cpp",
1998 "tools/skdiff/skdiff_main.cpp",
1999 "tools/skdiff/skdiff_utils.cpp",
2000 ]
2001 deps = [
2002 ":skia",
2003 ":tool_utils",
2004 ]
bungemanfe917272016-10-13 17:36:40 -04002005 }
halcanarya73d76a2016-10-17 13:19:02 -07002006
Mike Kleine6682eb2017-01-05 10:54:57 -05002007 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002008 sources = [
2009 "tools/skp_parser.cpp",
2010 ]
2011 deps = [
2012 ":skia",
2013 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002014 ]
halcanarya73d76a2016-10-17 13:19:02 -07002015 }
Brian Osman16adfa32016-10-18 14:42:44 -04002016
Brian Osmanc9a42472018-05-31 13:17:12 -04002017 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002018 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002019 defines =
2020 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002021 sources = [
2022 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002023 "tools/skqp/src/skqp.cpp",
2024 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002025 ]
2026 deps = [
2027 ":gm",
2028 ":gpu_tool_utils",
2029 ":skia",
2030 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002031 ":tool_utils",
2032 ]
2033 }
2034 test_app("skqp") {
2035 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002036 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002037 ]
2038 deps = [
2039 ":skia",
2040 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002041 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002042 ]
2043 }
2044 test_app("jitter_gms") {
2045 sources = [
2046 "tools/skqp/jitter_gms.cpp",
2047 ]
2048 deps = [
2049 ":gm",
2050 ":skia",
2051 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002052 ]
2053 }
2054 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002055 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002056 test_app("skqp_app") {
2057 is_shared_library = true
2058 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002059 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002060 ]
2061 deps = [
2062 ":skia",
2063 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002064 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002065 ]
2066 libs = [ "android" ]
2067 }
2068 }
Stan Iliev93151722018-08-02 11:10:52 -04002069 if (is_android && skia_enable_gpu) {
2070 test_app("skottie_android") {
2071 is_shared_library = true
2072
2073 sources = [
2074 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2075 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2076 ]
2077 libs = []
2078
Stan Iliev93151722018-08-02 11:10:52 -04002079 deps = [
2080 ":skia",
2081 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002082 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002083 ]
2084 }
2085 }
Hal Canary75427132017-10-11 16:00:31 -04002086
Hal Canarya9de7602018-01-19 13:08:23 -05002087 test_app("list_gms") {
2088 sources = [
2089 "tools/list_gms.cpp",
2090 ]
2091 deps = [
2092 ":gm",
2093 ":skia",
2094 ]
2095 }
2096 test_app("list_gpu_unit_tests") {
2097 sources = [
2098 "dm/DMGpuTestProcs.cpp",
2099 "tools/list_gpu_unit_tests.cpp",
2100 ]
2101 deps = [
2102 ":skia",
2103 ":tests",
2104 ]
2105 }
2106
Brian Osmanc9a42472018-05-31 13:17:12 -04002107 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002108 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002109 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002110 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002111 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002112 sources = [
2113 "tools/sk_app/CommandSet.cpp",
2114 "tools/sk_app/GLWindowContext.cpp",
2115 "tools/sk_app/Window.cpp",
2116 ]
2117 libs = []
2118
Stephen Whitea800ec92019-08-02 15:04:52 -04002119 if (skia_use_dawn) {
2120 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
2121 }
2122
Brian Osmanc9a42472018-05-31 13:17:12 -04002123 if (is_android) {
2124 sources += [
2125 "tools/sk_app/android/GLWindowContext_android.cpp",
2126 "tools/sk_app/android/RasterWindowContext_android.cpp",
2127 "tools/sk_app/android/Window_android.cpp",
2128 "tools/sk_app/android/main_android.cpp",
2129 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002130 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002131 libs += [ "android" ]
2132 } else if (is_linux) {
2133 sources += [
2134 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2135 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2136 "tools/sk_app/unix/Window_unix.cpp",
2137 "tools/sk_app/unix/keysym2ucs.c",
2138 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002139 ]
Stephen Whitea800ec92019-08-02 15:04:52 -04002140 if (skia_use_dawn) {
2141 if (dawn_enable_vulkan) {
2142 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2143 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2144 libs += [ "X11-xcb" ]
2145 }
2146 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002147 libs += [
2148 "GL",
2149 "X11",
2150 ]
2151 } else if (is_win) {
2152 sources += [
2153 "tools/sk_app/win/GLWindowContext_win.cpp",
2154 "tools/sk_app/win/RasterWindowContext_win.cpp",
2155 "tools/sk_app/win/Window_win.cpp",
2156 "tools/sk_app/win/main_win.cpp",
2157 ]
Brian Salomon194db172017-08-17 14:37:06 -04002158 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002159 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002160 }
Stephen Whitea800ec92019-08-02 15:04:52 -04002161 if (skia_use_dawn) {
2162 if (dawn_enable_d3d12) {
2163 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2164 }
2165 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002166 } else if (is_mac) {
2167 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002168 "tools/sk_app/mac/GLWindowContext_mac.mm",
2169 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2170 "tools/sk_app/mac/Window_mac.mm",
2171 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002172 ]
Stephen Whitea800ec92019-08-02 15:04:52 -04002173 if (skia_use_dawn) {
2174 if (dawn_enable_metal) {
2175 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2176 }
2177 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002178 libs += [
2179 "QuartzCore.framework",
2180 "Cocoa.framework",
2181 "Foundation.framework",
2182 ]
2183 } else if (is_ios) {
2184 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002185 "tools/sk_app/ios/GLWindowContext_ios.mm",
2186 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2187 "tools/sk_app/ios/Window_ios.mm",
2188 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002189 ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002190 libs += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002191 }
2192
2193 if (skia_use_vulkan) {
2194 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2195 if (is_android) {
2196 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2197 } else if (is_linux) {
2198 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2199 libs += [ "X11-xcb" ]
2200 } else if (is_win) {
2201 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002202 } else if (is_mac) {
2203 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2204 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002205 }
2206 }
2207
Jim Van Verthbe39f712019-02-08 15:36:14 -05002208 if (skia_use_metal) {
2209 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2210 if (is_mac) {
2211 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002212 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002213 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002214 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002215 }
2216
Brian Osmanc9a42472018-05-31 13:17:12 -04002217 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002218 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002219 ]
2220 if (is_android) {
2221 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002222 }
2223 if (skia_use_angle) {
2224 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002225 }
Brian Osman16adfa32016-10-18 14:42:44 -04002226 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002227
Hal Canary87515122019-03-15 14:22:51 -04002228 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2229 test_app("fiddle_examples") {
2230 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002231 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002232 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002233 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002234 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002235 if (is_win) {
2236 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2237 }
Hal Canary87515122019-03-15 14:22:51 -04002238 deps = [
2239 ":skia",
2240 ":skia.h",
2241 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002242 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002243 ]
2244 }
2245 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002246 test_app("viewer") {
2247 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002248 sources = [
Hal Canary41248072019-07-11 16:32:53 -04002249 "tools/viewer/AnimTimer.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002250 "tools/viewer/BisectSlide.cpp",
2251 "tools/viewer/GMSlide.cpp",
2252 "tools/viewer/ImGuiLayer.cpp",
2253 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002254 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002255 "tools/viewer/SKPSlide.cpp",
2256 "tools/viewer/SampleSlide.cpp",
2257 "tools/viewer/SkottieSlide.cpp",
2258 "tools/viewer/SlideDir.cpp",
2259 "tools/viewer/StatsLayer.cpp",
2260 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002261 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002262 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002263 "tools/viewer/Viewer.cpp",
2264 ]
2265 libs = []
2266
Brian Osmanc9a42472018-05-31 13:17:12 -04002267 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002268 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002269 ":experimental_svg_model",
2270 ":flags",
2271 ":gm",
2272 ":gpu_tool_utils",
2273 ":samples",
2274 ":sk_app",
2275 ":skia",
2276 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002277 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002278 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002279 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002280 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002281 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002282 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002283 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002284 ]
Mike Reedd62d4062019-06-12 10:20:44 -04002285 if (skia_use_experimental_xform) {
2286 deps += [ ":experimental_xform" ]
2287 sources += [ "gm/xform.cpp" ]
2288 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002289 }
2290
Brian Osmanc9a42472018-05-31 13:17:12 -04002291 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002292 test_app("HelloWorld") {
2293 sources = [
2294 "example/HelloWorld.cpp",
2295 ]
2296 libs = []
2297
Brian Osmaneff04b52017-11-21 13:18:02 -05002298 deps = [
2299 ":flags",
2300 ":gpu_tool_utils",
2301 ":sk_app",
2302 ":skia",
2303 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002304 ]
2305 }
2306 }
2307
Brian Osmanc9a42472018-05-31 13:17:12 -04002308 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002309 test_app("SkiaSDLExample") {
2310 sources = [
2311 "example/SkiaSDLExample.cpp",
2312 ]
2313 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002314 deps = [
2315 ":gpu_tool_utils",
2316 ":skia",
2317 "//third_party/libsdl",
2318 ]
2319 }
2320 }
2321
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002322 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2323 action_foreach("generate_mocs") {
2324 script = "gn/call.py"
2325 sources = [
2326 "tools/mdbviz/MainWindow.h",
2327 ]
2328 outputs = [
2329 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2330 ]
2331 args = [
2332 "$skia_qt_path" + "/bin/moc",
2333 "{{source}}",
2334 "-o",
2335 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2336 ]
2337 }
2338 action_foreach("generate_resources") {
2339 script = "gn/call.py"
2340 sources = [
2341 "tools/mdbviz/resources.qrc",
2342 ]
2343 outputs = [
2344 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2345 ]
2346 args = [
2347 "$skia_qt_path" + "/bin/rcc",
2348 "{{source}}",
2349 "-o",
2350 "gen/mdbviz/{{source_name_part}}_res.cpp",
2351 ]
2352 }
2353 test_app("mdbviz") {
2354 if (is_win) {
2355 # on Windows we need to disable some exception handling warnings due to the Qt headers
2356 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2357 }
2358 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002359 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002360 "tools/debugger/DebugCanvas.cpp",
2361 "tools/debugger/DrawCommand.cpp",
2362 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002363 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002364 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002365 "tools/mdbviz/main.cpp",
2366
2367 # generated files
2368 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2369 "$target_gen_dir/mdbviz/resources_res.cpp",
2370 ]
2371 lib_dirs = [ "$skia_qt_path/lib" ]
2372 libs = [
2373 "Qt5Core.lib",
2374 "Qt5Gui.lib",
2375 "Qt5Widgets.lib",
2376 ]
2377 include_dirs = [
2378 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002379 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002380 "$skia_qt_path/include/QtWidgets",
2381 ]
2382 deps = [
2383 ":generate_mocs",
2384 ":generate_resources",
2385 ":skia",
2386 ]
2387 }
2388 }
2389
Mike Kleine459afd2017-03-03 09:21:30 -05002390 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002391 copy("gdbserver") {
2392 sources = [
2393 "$ndk/$ndk_gdbserver",
2394 ]
2395 outputs = [
2396 "$root_out_dir/gdbserver",
2397 ]
2398 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002399 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002400
2401 if (skia_use_opencl) {
2402 test_app("hello-opencl") {
2403 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002404 "tools/hello-opencl.cpp",
2405 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002406 deps = [
2407 "//third_party/opencl",
2408 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002409 }
2410 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002411
Brian Osmanf564f152019-07-23 15:14:30 -04002412 executable("cpu_modules") {
2413 sources = [
2414 "tools/cpu_modules.cpp",
2415 ]
2416 deps = [
2417 ":skia",
2418 "modules/particles",
2419 ]
2420 }
2421
Hal Canary1f94d392019-07-30 09:27:56 -04002422 if (skia_use_icu && skia_use_harfbuzz) {
2423 test_app("editor") {
2424 is_shared_library = is_android
2425 deps = [
Hal Canarya0b66fc2019-08-23 10:16:51 -04002426 "modules/skplaintexteditor:editor_app",
Hal Canary1f94d392019-07-30 09:27:56 -04002427 ]
2428 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002429 }
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002430
Mike Klein7e650762019-07-02 15:21:11 -05002431 if (skia_enable_skvm_jit) {
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002432 test_app("skvmtool") {
2433 defines = [
2434 "SKVM_JIT",
2435 "SKVM_PERF_DUMPS",
2436 ]
2437 include_dirs = [ "." ]
2438 sources = [
2439 "src/core/SkSpinlock.cpp",
2440 "src/core/SkThreadID.cpp",
2441 "src/core/SkVM.cpp",
Mike Klein84bcd0c2019-07-23 11:46:09 -05002442 "tools/SkVMBuilders.cpp",
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002443 "tools/SkVMTool.cpp",
2444 ]
2445 if (target_cpu == "x64") {
2446 sources += [ "src/core/SkCpu.cpp" ]
2447 }
2448 }
2449 }
mtklein25c81d42016-07-27 13:55:26 -07002450}
Hal Canary932a2c02019-09-17 10:43:18 -04002451
2452if (is_ios && skia_use_metal) {
2453 group("minimal_ios_mtl_skia_app") {
2454 deps = [
2455 "experimental/minimal_ios_mtl_skia_app",
2456 ]
2457 }
2458 group("skottie_ios") {
2459 deps = [
2460 "experimental/skottie_ios",
2461 ]
2462 }
2463}