blob: 6fe195e7477ae40f4b1040a99a11ce3ef3e829f6 [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
Forrest Reiling30229ac2017-04-17 13:36:39 -070010if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -070011 import("//build/fuchsia/sdk.gni")
Forrest Reiling30229ac2017-04-17 13:36:39 -070012 import("//build/vulkan/config.gni")
13}
14
Hal Canary45812a12019-09-04 08:58:59 -040015import("gn/skia.gni")
16
Stephen White0d70b712019-07-10 15:51:30 -040017if (skia_use_dawn) {
18 import("third_party/externals/dawn/scripts/dawn_features.gni")
19}
20
Adam Barth54ef74a2017-10-13 10:59:38 -070021if (defined(skia_settings)) {
22 import(skia_settings)
23}
24
mtkleinc04ff472016-06-23 10:29:30 -070025# Skia public API, generally provided by :skia.
26config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050027 include_dirs = [ "." ]
28
Mike Kleinae7e6712016-10-11 17:49:33 -040029 defines = []
30 if (is_component_build) {
31 defines += [ "SKIA_DLL" ]
32 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040033 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050034 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070035 }
Brian Osmanf2c90142017-07-13 15:50:03 -040036 if (skia_enable_flutter_defines) {
37 defines += flutter_defines
38 }
mtklein06c35c02016-09-20 12:28:12 -070039 if (!skia_enable_gpu) {
40 defines += [ "SK_SUPPORT_GPU=0" ]
41 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -050042 if (skia_enable_atlas_text) {
43 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
44 }
Mike Reed025f7832018-11-12 09:27:05 -050045 if (is_fuchsia) {
46 defines += fuchsia_defines
47 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040048 if (skia_gl_standard == "gles") {
49 defines += [ "SK_ASSUME_GL_ES=1" ]
50 } else if (skia_gl_standard == "gl") {
51 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040052 } else if (skia_gl_standard == "webgl") {
53 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040054 }
mtkleinc04ff472016-06-23 10:29:30 -070055}
56
57# Skia internal APIs, used by Skia itself and a few test tools.
58config("skia_private") {
59 visibility = [ ":*" ]
60
Mike Reeda9e241d2017-05-03 10:52:00 -040061 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050062 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070063 defines += [
64 "SK_GAMMA_EXPONENT=1.4",
65 "SK_GAMMA_CONTRAST=0.0",
66 ]
67 }
Mike Kleinb45d8622019-04-24 14:04:01 -050068 if (is_skia_dev_build) {
69 defines += [
70 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
71 "GR_TEST_UTILS=1",
72 ]
mtklein88a7ac02016-09-14 11:16:49 -070073 }
Brian Salomon789e25e2016-09-30 13:41:03 -040074 libs = []
75 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -050076 if (skia_use_angle) {
77 defines += [ "SK_ANGLE" ]
78 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040079 if (skia_llvm_path != "") {
80 defines += [ "SK_LLVM_AVAILABLE" ]
81 include_dirs += [ "$skia_llvm_path/include" ]
82 libs += [ skia_llvm_lib ]
83 lib_dirs += [ "$skia_llvm_path/lib/" ]
84 }
mtkleinc04ff472016-06-23 10:29:30 -070085}
86
87# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
88config("skia_library") {
89 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +000090 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -070091}
92
93skia_library_configs = [
94 ":skia_public",
95 ":skia_private",
96 ":skia_library",
97]
98
mtklein9b8583d2016-08-24 17:32:30 -070099# Use for CPU-specific Skia code that needs particular compiler flags.
100template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500101 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700102 if (invoker.enabled) {
103 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500104 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700105 forward_variables_from(invoker, "*")
106 configs += skia_library_configs
107 }
108 } else {
109 # If not enabled, a phony empty target that swallows all otherwise unused variables.
110 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500111 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700112 forward_variables_from(invoker,
113 "*",
114 [
115 "sources",
116 "cflags",
117 ])
118 }
119 }
anmittala7eaf2e2016-08-17 13:57:26 -0700120}
121
mtklein422310d2016-08-16 18:28:43 -0700122is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700123
mtklein7d6fb2c2016-08-25 14:50:44 -0700124opts("none") {
125 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700126 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700127 cflags = []
128}
129
mtklein7d6fb2c2016-08-25 14:50:44 -0700130opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700131 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700132 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700133 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700134}
135
136opts("arm64") {
137 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700138 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700139 cflags = []
140}
141
142opts("crc32") {
143 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700144 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700145 cflags = [ "-march=armv8-a+crc" ]
146}
147
mtklein9b8583d2016-08-24 17:32:30 -0700148opts("sse2") {
149 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700150 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400151 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400152 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
153 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400154 cflags = [ "-msse2" ]
155 }
mtklein9b8583d2016-08-24 17:32:30 -0700156}
mtkleinc04ff472016-06-23 10:29:30 -0700157
mtklein9b8583d2016-08-24 17:32:30 -0700158opts("ssse3") {
159 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700160 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400161 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400162 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
163 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400164 cflags = [ "-mssse3" ]
165 }
mtklein9b8583d2016-08-24 17:32:30 -0700166}
mtkleinc04ff472016-06-23 10:29:30 -0700167
mtklein9b8583d2016-08-24 17:32:30 -0700168opts("sse41") {
169 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700170 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400171 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400172 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
173 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400174 cflags = [ "-msse4.1" ]
175 }
mtklein9b8583d2016-08-24 17:32:30 -0700176}
mtklein4e976072016-08-08 09:06:27 -0700177
mtklein9b8583d2016-08-24 17:32:30 -0700178opts("sse42") {
179 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400181 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400182 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
183 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400184 cflags = [ "-msse4.2" ]
185 }
mtklein9b8583d2016-08-24 17:32:30 -0700186}
187
188opts("avx") {
189 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700190 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400191 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000192 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400193 } else {
194 cflags = [ "-mavx" ]
195 }
mtkleinc04ff472016-06-23 10:29:30 -0700196}
197
Mike Klein1b9b7d52018-02-27 10:37:40 -0500198opts("hsw") {
199 enabled = is_x86
200 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400201 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500202 cflags = [ "/arch:AVX2" ]
203 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000204 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500205 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500206}
207
mtkleinc095df52016-08-24 12:23:52 -0700208# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700209template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500210 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700211 if (invoker.enabled) {
212 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700213 if (defined(invoker.public_defines)) {
214 defines = invoker.public_defines
215 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600216 if (defined(invoker.public_configs)) {
217 configs = invoker.public_configs
218 }
mtklein457b42a2016-08-23 13:56:37 -0700219 }
220 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500221 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700222 forward_variables_from(invoker,
223 "*",
224 [
225 "public_defines",
226 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700227 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700228 ])
mtklein457b42a2016-08-23 13:56:37 -0700229 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700230 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700231 if (defined(invoker.configs_to_remove)) {
232 configs -= invoker.configs_to_remove
233 }
mtklein457b42a2016-08-23 13:56:37 -0700234 }
235 } else {
mtklein457b42a2016-08-23 13:56:37 -0700236 source_set(target_name) {
237 forward_variables_from(invoker,
238 "*",
239 [
240 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400241 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700242 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700243 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700244 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700245 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700246 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700247 ])
mtkleincd01b032016-08-31 04:58:19 -0700248 if (defined(invoker.sources_when_disabled)) {
249 sources = invoker.sources_when_disabled
250 }
251 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700252 }
mtkleineb3c4252016-08-23 07:38:09 -0700253 }
mtklein457b42a2016-08-23 13:56:37 -0700254}
mtklein457b42a2016-08-23 13:56:37 -0700255
mtkleina45be612016-08-29 15:22:10 -0700256optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500257 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700258
259 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500260 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700261 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700262 ]
263 sources = [
264 "src/ports/SkFontMgr_android.cpp",
265 "src/ports/SkFontMgr_android_factory.cpp",
266 "src/ports/SkFontMgr_android_parser.cpp",
267 ]
268}
269
mtkleind2e39db2016-09-07 07:52:55 -0700270optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500271 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700272
273 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500274 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700275 ]
276 sources = [
277 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500278 "src/ports/SkFontMgr_custom.h",
279 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700280 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500281 "src/ports/SkFontMgr_custom_embedded.cpp",
282 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700283 ]
284}
285
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500286optional("fontmgr_custom_empty") {
287 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500288
289 deps = [
290 ":typeface_freetype",
291 ]
292 sources = [
293 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500294 "src/ports/SkFontMgr_custom_empty.cpp",
295 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800296 ]
297}
298
Hal Canaryff2742e2018-01-30 11:35:47 -0500299optional("fontmgr_empty") {
300 enabled = skia_enable_fontmgr_empty
301 sources = [
302 "src/ports/SkFontMgr_empty_factory.cpp",
303 ]
304}
305
mtklein3cc22182016-08-29 13:26:14 -0700306optional("fontmgr_fontconfig") {
307 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700308
309 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500310 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700311 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700312 ]
313 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700314 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700315 "src/ports/SkFontConfigInterface_direct.cpp",
316 "src/ports/SkFontConfigInterface_direct_factory.cpp",
317 "src/ports/SkFontMgr_FontConfigInterface.cpp",
318 "src/ports/SkFontMgr_fontconfig.cpp",
319 "src/ports/SkFontMgr_fontconfig_factory.cpp",
320 ]
321}
322
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500323optional("fontmgr_fuchsia") {
324 enabled = skia_enable_fontmgr_fuchsia
325
Chinmay Garde89820762019-05-06 16:44:06 -0700326 deps = []
327
328 if (is_fuchsia && using_fuchsia_sdk) {
329 deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
330 } else {
331 deps += [ "//sdk/fidl/fuchsia.fonts" ]
332 }
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500333 sources = [
334 "src/ports/SkFontMgr_fuchsia.cpp",
335 "src/ports/SkFontMgr_fuchsia.h",
336 ]
337}
338
339optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400340 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700341
342 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500343 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700344 ]
345 sources = [
346 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500347 "src/ports/SkFontMgr_custom.h",
348 "src/ports/SkFontMgr_custom_embedded.cpp",
349 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700350 ]
351}
352
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500353optional("fontmgr_win") {
354 enabled = skia_enable_fontmgr_win
355
356 sources = [
357 "src/fonts/SkFontMgr_indirect.cpp",
358 "src/ports/SkFontMgr_win_dw.cpp",
359 "src/ports/SkFontMgr_win_dw_factory.cpp",
360 "src/ports/SkScalerContext_win_dw.cpp",
361 "src/ports/SkTypeface_win_dw.cpp",
362 ]
363}
364
365optional("fontmgr_win_gdi") {
366 enabled = skia_enable_fontmgr_win_gdi
367
368 sources = [
369 "src/ports/SkFontHost_win.cpp",
370 ]
371 libs = [ "Gdi32.lib" ]
372}
373
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700374if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400375 executable("sksllex") {
376 sources = [
377 "src/sksl/lex/Main.cpp",
378 "src/sksl/lex/NFA.cpp",
379 "src/sksl/lex/RegexNode.cpp",
380 "src/sksl/lex/RegexParser.cpp",
381 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500382 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400383 }
384
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700385 action("run_sksllex") {
386 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400387 deps = [
388 ":sksllex(//gn/toolchain:$host_toolchain)",
389 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700390 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700391 "src/sksl/lex/sksl.lex",
392 ]
393
394 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
395 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
396 outputs = [
397 "$target_out_dir/" +
398 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
399 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
400 # confused due to the same file being named by two different paths
401 ]
402 sksllex_path = "$root_out_dir/"
403 sksllex_path += "sksllex"
404 if (host_os == "win") {
405 sksllex_path += ".exe"
406 }
407 args = [
408 rebase_path(sksllex_path),
409 rebase_path("bin/clang-format"),
410 rebase_path("src"),
411 ]
412 }
413} else {
414 group("run_sksllex") {
415 }
416}
417
418if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400419 executable("skslc") {
420 defines = [ "SKSL_STANDALONE" ]
421 sources = [
422 "src/sksl/SkSLMain.cpp",
423 ]
424 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400425 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500426 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400427 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500428 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400429 "//third_party/spirv-tools:spvtools",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400430 ]
431 }
432
433 skia_gpu_processor_outputs = []
434 foreach(src, skia_gpu_processor_sources) {
435 dir = get_path_info(src, "dir")
436 name = get_path_info(src, "name")
437
438 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
439 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
440 skia_gpu_processor_outputs += [
Brian Osmanf5ac1992019-07-18 11:23:16 -0400441 "$target_out_dir/" +
442 rebase_path("$dir/generated/$name.h", target_out_dir),
Ethan Nicholas762466e2017-06-29 10:03:38 -0400443 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
444 # confused due to the same file being named by two different paths
445 ]
446 }
447
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500448 action("create_sksl_enums") {
449 script = "gn/create_sksl_enums.py"
450 sources = [
451 "include/private/GrSharedEnums.h",
452 ]
453 outputs = [
454 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500455 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500456 ]
457 args = [
458 rebase_path(sources[0]),
459 rebase_path(outputs[0]),
460 ]
461 }
462
Ethan Nicholas762466e2017-06-29 10:03:38 -0400463 action("compile_processors") {
464 script = "gn/compile_processors.py"
465 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500466 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400467 ":skslc(//gn/toolchain:$host_toolchain)",
468 ]
469 sources = skia_gpu_processor_sources
470 outputs = skia_gpu_processor_outputs
471 skslc_path = "$root_out_dir/"
472 if (host_toolchain != default_toolchain_name) {
473 skslc_path += "$host_toolchain/"
474 }
475 skslc_path += "skslc"
476 if (host_os == "win") {
477 skslc_path += ".exe"
478 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400479 args = [
480 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400481 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400482 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400483 args += rebase_path(skia_gpu_processor_sources)
484 }
485} else {
486 skia_gpu_processor_outputs = []
487 group("compile_processors") {
488 }
489}
490
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500491optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700492 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400493 deps = [
494 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700495 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400496 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700497 if (skia_generate_workarounds) {
498 deps += [ ":workaround_list" ]
499 }
Robert Phillipsefb9f142019-05-17 14:19:44 -0400500 public_defines = [ "SK_GL" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600501 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400502 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700503
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400504 sources =
505 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400506 if (!skia_enable_ccpr) {
507 sources -= skia_ccpr_sources
508 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
509 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400510 if (!skia_enable_nvpr) {
511 sources -= skia_nvpr_sources
512 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
513 }
mtklein06c35c02016-09-20 12:28:12 -0700514
515 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500516 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700517 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400518 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700519 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400520 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400521
522 # this lib is required to link against AHardwareBuffer
523 if (defined(ndk_api) && ndk_api >= 26) {
524 libs += [ "android" ]
525 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400526 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500527 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400528 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700529 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500530 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400531 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700532 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500533 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800534 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500535 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400536 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500537 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500538 if (target_cpu != "arm64") {
539 libs += [ "OpenGL32.lib" ]
540 }
mtklein06c35c02016-09-20 12:28:12 -0700541 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500542 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700543 }
mtkleine9fb3d52016-09-20 15:11:46 -0700544
545 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400546 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400547 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700548 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700549 if (skia_enable_vulkan_debug_layers) {
550 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
551 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800552 if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -0700553 if (using_fuchsia_sdk) {
554 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
555 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400556 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700557 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800558 }
mtkleine9fb3d52016-09-20 15:11:46 -0700559 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400560
Stephen White0d70b712019-07-10 15:51:30 -0400561 if (skia_use_dawn) {
562 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400563 sources += skia_dawn_sources
Stephen White0d70b712019-07-10 15:51:30 -0400564 public_deps += [
565 "//third_party/dawn:dawn_headers",
566 "//third_party/dawn:libdawn",
567 "//third_party/dawn:libdawn_native_sources",
568 ]
569 if (dawn_enable_d3d12) {
570 libs += [
571 "d3d12.lib",
572 "dxgi.lib",
573 "d3dcompiler.lib",
574 ]
575 } else if (dawn_enable_metal) {
576 libs += [ "Metal.framework" ]
577 }
578 }
579
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400580 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400581 if (skia_use_metal) {
582 public_defines += [ "SK_METAL" ]
583 sources += skia_metal_sources
584 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400585 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400586 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400587 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500588
589 if (skia_enable_atlas_text) {
590 sources += skia_atlas_text_sources
591 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400592
593 if (is_debug) {
594 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
595 }
mtklein06c35c02016-09-20 12:28:12 -0700596}
597
Leon Scroggins III41169202019-01-29 09:29:57 -0500598optional("gif") {
599 enabled = !skia_use_wuffs
600 sources = [
601 "src/codec/SkGifCodec.cpp",
602 "third_party/gif/SkGifImageReader.cpp",
603 ]
604}
605
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400606optional("heif") {
607 enabled = skia_use_libheif
608 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
609
610 deps = []
611
612 sources = [
613 "src/codec/SkHeifCodec.cpp",
614 ]
615}
616
mtklein63213812016-08-24 09:55:56 -0700617optional("jpeg") {
618 enabled = skia_use_libjpeg_turbo
619 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
620
mtklein63213812016-08-24 09:55:56 -0700621 deps = [
622 "//third_party/libjpeg-turbo:libjpeg",
623 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400624 public = [
625 "include/encode/SkJpegEncoder.h",
626 ]
mtklein63213812016-08-24 09:55:56 -0700627 sources = [
628 "src/codec/SkJpegCodec.cpp",
629 "src/codec/SkJpegDecoderMgr.cpp",
630 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700631 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400632 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700633 ]
634}
635
636optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500637 enabled = skia_use_zlib && skia_enable_pdf
638 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700639
mtklein63213812016-08-24 09:55:56 -0700640 deps = [
641 "//third_party/zlib",
642 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400643 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700644 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400645 }
brettwb9447282016-09-01 14:24:39 -0700646 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700647 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500648 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
649 deps += [ "//third_party/harfbuzz" ]
650 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
651 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700652 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500653 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700654 }
655}
656
657optional("png") {
658 enabled = skia_use_libpng
659 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
660
mtklein63213812016-08-24 09:55:56 -0700661 deps = [
662 "//third_party/libpng",
663 ]
664 sources = [
665 "src/codec/SkIcoCodec.cpp",
666 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400667 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700668 ]
669}
670
scroggof84ad642016-10-31 09:02:57 -0700671optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400672 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700673 public_defines = [ "SK_CODEC_DECODES_RAW" ]
674
675 deps = [
676 "//third_party/dng_sdk",
677 "//third_party/libjpeg-turbo:libjpeg",
678 "//third_party/piex",
679 ]
680
681 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
682 # Skia.
683 configs_to_remove = [ "//gn:no_exceptions" ]
684
685 sources = [
scroggof84ad642016-10-31 09:02:57 -0700686 "src/codec/SkRawCodec.cpp",
687 ]
688}
689
Mike Klein852a8cb2018-05-15 10:46:58 -0400690import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400691source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400692 cflags = []
693 if (!is_win || is_clang) {
694 cflags += [
695 "-w",
696 "-std=c11",
697 ]
698 }
699
700 public = [
Brian Osmanea236bf2019-04-29 10:28:22 -0400701 "include/third_party/skcms/skcms.h",
Mike Klein852a8cb2018-05-15 10:46:58 -0400702 ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400703 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400704 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
705}
706
mtklein3cc22182016-08-29 13:26:14 -0700707optional("typeface_freetype") {
708 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700709
710 deps = [
711 "//third_party/freetype2",
712 ]
713 sources = [
714 "src/ports/SkFontHost_FreeType.cpp",
715 "src/ports/SkFontHost_FreeType_common.cpp",
716 ]
717}
718
mtklein457b42a2016-08-23 13:56:37 -0700719optional("webp") {
720 enabled = skia_use_libwebp
721 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
722
mtklein457b42a2016-08-23 13:56:37 -0700723 deps = [
724 "//third_party/libwebp",
725 ]
726 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700727 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400728 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700729 ]
mtkleineb3c4252016-08-23 07:38:09 -0700730}
731
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400732optional("wuffs") {
733 enabled = skia_use_wuffs
734 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
735
736 deps = [
737 "//third_party/wuffs",
738 ]
739 sources = [
740 "src/codec/SkWuffsCodec.cpp",
741 ]
742}
743
mtklein63213812016-08-24 09:55:56 -0700744optional("xml") {
745 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000746 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700747
mtklein63213812016-08-24 09:55:56 -0700748 deps = [
749 "//third_party/expat",
750 ]
751 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500752 "src/svg/SkSVGCanvas.cpp",
753 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700754 "src/xml/SkDOM.cpp",
755 "src/xml/SkXMLParser.cpp",
756 "src/xml/SkXMLWriter.cpp",
757 ]
758}
759
Brian Osman489cf882019-07-09 10:48:28 -0400760optional("sksl_interpreter") {
761 enabled = skia_enable_sksl_interpreter
762 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
763}
764
Mike Klein613ad382019-06-06 11:42:02 -0500765optional("skvm_jit") {
Mike Klein6bbeb4a2019-06-21 16:34:06 -0500766 enabled = skia_enable_skvm_jit
Mike Klein613ad382019-06-06 11:42:02 -0500767 public_defines = [ "SKVM_JIT" ]
Mike Klein613ad382019-06-06 11:42:02 -0500768}
769
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700770if (skia_enable_gpu && skia_generate_workarounds) {
771 action("workaround_list") {
772 script = "tools/build_workaround_header.py"
773
774 inputs = [
775 "src/gpu/gpu_workaround_list.txt",
776 ]
777
778 # see comments in skia_compile_processors about out dir path shenanigans.
779 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700780 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700781
782 outputs = [
783 "$root_out_dir/$output_file",
784 ]
785 args = [
786 "--output-file",
787 "$output_file",
788 ]
789
790 foreach(file, inputs) {
791 args += [ rebase_path(file, root_build_dir) ]
792 }
793 }
794}
795
mtkleinc04ff472016-06-23 10:29:30 -0700796component("skia") {
797 public_configs = [ ":skia_public" ]
798 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700799
Mike Klein607b0a72018-11-07 16:17:34 -0500800 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500801 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500802 ":pdf",
803 ":skcms",
804 ]
805
mtkleinc04ff472016-06-23 10:29:30 -0700806 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700807 ":arm64",
808 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700809 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000810 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700811 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700812 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700813 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500814 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500815 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700816 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800817 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500818 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500819 ":fontmgr_win",
820 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500821 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400822 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500823 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700824 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700825 ":none",
mtklein63213812016-08-24 09:55:56 -0700826 ":png",
scroggof84ad642016-10-31 09:02:57 -0700827 ":raw",
Brian Osman489cf882019-07-09 10:48:28 -0400828 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -0500829 ":skvm_jit",
mtklein9b8583d2016-08-24 17:32:30 -0700830 ":sse2",
831 ":sse41",
832 ":sse42",
833 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700834 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400835 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700836 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700837 ]
838
Chinmay Garde43f115c2016-11-16 15:04:12 -0800839 # This file (and all GN files in Skia) are designed to work with an
840 # empty sources assignment filter; we handle all that explicitly.
841 # We clear the filter here for clients who may have set up a global filter.
842 set_sources_assignment_filter([])
843
Hal Canaryc25f4e92019-02-26 11:54:25 -0500844 public = skia_core_public
845 public += skia_utils_public
846 public += skia_effects_public
847 public += skia_effects_imagefilter_public
848 public += skia_xps_public
849
mtkleinc04ff472016-06-23 10:29:30 -0700850 sources = []
brettwb9447282016-09-01 14:24:39 -0700851 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700852 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500853 if (skia_use_xps) {
854 sources += skia_xps_sources
855 }
Mike Klein54378232018-11-08 12:08:05 +0000856 sources += skia_effects_sources
857 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400858 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -0700859 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400860 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500861 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700862 "src/android/SkBitmapRegionCodec.cpp",
863 "src/android/SkBitmapRegionDecoder.cpp",
864 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100865 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400866 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700867 "src/codec/SkBmpCodec.cpp",
868 "src/codec/SkBmpMaskCodec.cpp",
869 "src/codec/SkBmpRLECodec.cpp",
870 "src/codec/SkBmpStandardCodec.cpp",
871 "src/codec/SkCodec.cpp",
872 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400873 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400874 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700875 "src/codec/SkMaskSwizzler.cpp",
876 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700877 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700878 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700879 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700880 "src/codec/SkSwizzler.cpp",
881 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700882 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700883 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000884 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700885 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700886 "src/ports/SkMemory_malloc.cpp",
887 "src/ports/SkOSFile_stdio.cpp",
888 "src/sfnt/SkOTTable_name.cpp",
889 "src/sfnt/SkOTUtils.cpp",
890 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700891 ]
brettwb9447282016-09-01 14:24:39 -0700892
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400893 defines = []
mtklein7d6fb2c2016-08-25 14:50:44 -0700894 libs = []
895
mtkleinc04ff472016-06-23 10:29:30 -0700896 if (is_win) {
897 sources += [
898 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700899 "src/ports/SkImageEncoder_WIC.cpp",
900 "src/ports/SkImageGeneratorWIC.cpp",
901 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700902 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700903 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700904 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400905 libs += [
906 "FontSub.lib",
907 "Ole32.lib",
908 "OleAut32.lib",
909 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500910 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400911 ]
mtkleinc04ff472016-06-23 10:29:30 -0700912 } else {
913 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700914 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700915 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700916 "src/ports/SkTLS_pthread.cpp",
917 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400918 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700919 }
920
mtklein7d6fb2c2016-08-25 14:50:44 -0700921 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500922 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500923 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500924 deps += [ "//third_party/cpu-features" ]
925 }
mtklein06c35c02016-09-20 12:28:12 -0700926 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700927 libs += [
928 "EGL",
929 "GLESv2",
930 "log",
931 ]
932 }
933
Kevin Lubick217056c2018-09-20 17:39:31 -0400934 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700935 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400936 if (skia_use_egl) {
937 libs += [ "GLESv2" ]
938 }
mtkleinc04ff472016-06-23 10:29:30 -0700939 }
940
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500941 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800942 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500943 }
944
mtkleinc04ff472016-06-23 10:29:30 -0700945 if (is_mac) {
946 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700947 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700948 "src/ports/SkImageEncoder_CG.cpp",
949 "src/ports/SkImageGeneratorCG.cpp",
950 ]
mtklein09e61f72016-08-23 13:35:28 -0700951 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400952 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
953 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700954 "ApplicationServices.framework",
955 "OpenGL.framework",
956 ]
mtkleinc04ff472016-06-23 10:29:30 -0700957 }
abarth6fc8ff02016-07-15 15:15:15 -0700958
Mike Klein7d302882016-11-03 14:06:31 -0400959 if (is_ios) {
960 sources += [
961 "src/ports/SkDebug_stdio.cpp",
962 "src/ports/SkFontHost_mac.cpp",
963 "src/ports/SkImageEncoder_CG.cpp",
964 "src/ports/SkImageGeneratorCG.cpp",
965 ]
966 libs += [
967 "CoreFoundation.framework",
968 "CoreGraphics.framework",
969 "CoreText.framework",
970 "ImageIO.framework",
971 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400972
973 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
974 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400975 ]
976 }
977
abarth6fc8ff02016-07-15 15:15:15 -0700978 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700979 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700980 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400981
982 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -0400983 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400984 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
985 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -0400986
987 if (skia_include_multiframe_procs) {
988 sources += [ "tools/SkSharingProc.cpp" ]
989 }
mtkleinc04ff472016-06-23 10:29:30 -0700990}
991
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500992# DebugCanvas used in experimental/wasm-skp-debugger
993if (target_cpu == "wasm") {
994 static_library("debugcanvas") {
995 public_configs = [ ":skia_public" ]
996
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500997 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -0400998 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -0500999 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001000 "tools/debugger/DebugCanvas.cpp",
1001 "tools/debugger/DrawCommand.cpp",
1002 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001003 ]
1004
1005 deps = [
1006 ":fontmgr_wasm",
1007 ]
1008 }
1009}
1010
Kevin Lubickcbcff382018-10-02 09:02:18 -04001011static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001012 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001013 public_configs = [ ":skia_public" ]
1014 configs += skia_library_configs
1015
1016 deps = [
1017 ":arm64",
1018 ":armv7",
1019 ":avx",
1020 ":crc32",
1021 ":hsw",
1022 ":none",
1023 ":sse2",
1024 ":sse41",
1025 ":sse42",
1026 ":ssse3",
1027 ]
1028
1029 # This file (and all GN files in Skia) are designed to work with an
1030 # empty sources assignment filter; we handle all that explicitly.
1031 # We clear the filter here for clients who may have set up a global filter.
1032 set_sources_assignment_filter([])
1033
1034 sources = []
1035 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001036 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001037 sources += [
1038 "src/core/SkAnalyticEdge.cpp",
1039 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001040 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001041 "src/core/SkCubicMap.cpp",
1042 "src/core/SkEdge.cpp",
1043 "src/core/SkEdgeBuilder.cpp",
1044 "src/core/SkEdgeClipper.cpp",
1045 "src/core/SkGeometry.cpp",
1046 "src/core/SkLineClipper.cpp",
1047 "src/core/SkMallocPixelRef.cpp",
1048 "src/core/SkMath.cpp",
1049 "src/core/SkMatrix.cpp",
1050 "src/core/SkOpts.cpp",
1051 "src/core/SkPaint.cpp",
1052 "src/core/SkPath.cpp",
1053 "src/core/SkPathEffect.cpp",
1054 "src/core/SkPathMeasure.cpp",
1055 "src/core/SkPathRef.cpp",
1056 "src/core/SkPoint.cpp",
1057 "src/core/SkRRect.cpp",
1058 "src/core/SkRect.cpp",
1059 "src/core/SkSemaphore.cpp",
1060 "src/core/SkStream.cpp",
1061 "src/core/SkString.cpp",
1062 "src/core/SkStringUtils.cpp",
1063 "src/core/SkStroke.cpp",
1064 "src/core/SkStrokeRec.cpp",
1065 "src/core/SkStrokerPriv.cpp",
1066 "src/core/SkThreadID.cpp",
1067 "src/core/SkUtils.cpp",
1068 "src/effects/SkDashPathEffect.cpp",
1069 "src/effects/SkTrimPathEffect.cpp",
1070 "src/ports/SkDebug_stdio.cpp",
1071 "src/ports/SkMemory_malloc.cpp",
1072 "src/utils/SkDashPath.cpp",
1073 "src/utils/SkParse.cpp",
1074 "src/utils/SkParsePath.cpp",
1075 "src/utils/SkUTF.cpp",
1076 ]
1077}
1078
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001079group("modules") {
1080 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001081 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001082 "modules/skottie",
1083 "modules/skshaper",
1084 ]
1085}
1086
mtkleinc095df52016-08-24 12:23:52 -07001087# Targets guarded by skia_enable_tools may use //third_party freely.
1088if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001089 skia_public_includes = [
1090 "include/android",
1091 "include/atlastext",
1092 "include/c",
1093 "include/codec",
1094 "include/config",
1095 "include/core",
1096 "include/docs",
1097 "include/effects",
1098 "include/encode",
1099 "include/gpu",
1100 "include/pathops",
1101 "include/ports",
1102 "include/svg",
1103 "include/utils",
1104 "include/utils/mac",
1105 "modules/sksg/include",
1106 "modules/skshaper/include",
1107 "modules/skottie/include",
1108 ]
1109
Mike Klein308b5ac2016-12-06 16:03:52 -05001110 # Used by gn_to_bp.py to list our public include dirs.
1111 source_set("public") {
1112 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001113 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001114 }
1115
Mike Kleinc36dedf2016-11-18 09:35:28 -05001116 config("skia.h_config") {
1117 include_dirs = [ "$target_gen_dir" ]
1118 }
1119 action("skia.h") {
1120 public_configs = [ ":skia.h_config" ]
1121 skia_h = "$target_gen_dir/skia.h"
1122 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001123
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001124 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1125 [ rebase_path(skia_h, root_build_dir) ] +
1126 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001127 depfile = "$skia_h.deps"
1128 outputs = [
1129 skia_h,
1130 ]
1131 }
1132
Brian Osmanc9a42472018-05-31 13:17:12 -04001133 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001134 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001135 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001136 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001137 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001138 "tools/fiddle/draw.cpp",
1139 "tools/fiddle/fiddle_main.cpp",
1140 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001141
1142 if (skia_use_egl) {
1143 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001144 } else {
1145 sources += [ "tools/fiddle/null_context.cpp" ]
1146 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001147 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001148 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001149 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001150 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001151 ":skia",
1152 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001153 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001154 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001155 ]
1156 }
1157 }
1158
Mike Klein9e25bb92019-04-29 09:46:36 -05001159 config("our_vulkan_headers") {
1160 # We add this directory to simulate the client already have
1161 # vulkan/vulkan_core.h on their path.
1162 include_dirs = [ "include/third_party/vulkan" ]
1163 }
1164
Brian Osmanc9a42472018-05-31 13:17:12 -04001165 source_set("public_headers_warnings_check") {
1166 sources = [
1167 "tools/public_headers_warnings_check.cpp",
1168 ]
1169 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001170 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001171 deps = [
1172 ":skia",
1173 ":skia.h",
1174 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001175 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001176 ]
Stephen White0d70b712019-07-10 15:51:30 -04001177
1178 if (skia_use_dawn) {
1179 deps += [ "//third_party/dawn:dawn_headers" ]
1180 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001181 }
1182
mtkleinc095df52016-08-24 12:23:52 -07001183 template("test_lib") {
1184 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001185 if (defined(invoker.public_defines)) {
1186 defines = invoker.public_defines
1187 }
mtklein25c81d42016-07-27 13:55:26 -07001188 }
mtkleinc095df52016-08-24 12:23:52 -07001189 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001190 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001191 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001192 public_configs = [
1193 ":" + target_name + "_config",
1194 ":skia_private",
1195 ]
1196
1197 if (!defined(deps)) {
1198 deps = []
1199 }
1200 deps += [ ":skia" ]
1201 testonly = true
1202 }
mtklein25c81d42016-07-27 13:55:26 -07001203 }
mtklein25c81d42016-07-27 13:55:26 -07001204
Mike Kleine6682eb2017-01-05 10:54:57 -05001205 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001206 if (is_ios) {
1207 app_name = target_name
1208 gen_path = target_gen_dir
1209
1210 action("${app_name}_generate_info_plist") {
1211 script = "//gn/gen_plist_ios.py"
1212 outputs = [
1213 "$gen_path/${app_name}_Info.plist",
1214 ]
1215 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1216 }
1217
1218 bundle_data("${app_name}_bundle_info_plist") {
1219 public_deps = [
1220 ":${app_name}_generate_info_plist",
1221 ]
1222 sources = [
1223 "$gen_path/${app_name}_Info.plist",
1224 ]
1225 outputs = [
1226 "{{bundle_root_dir}}/Info.plist",
1227 ]
1228 }
1229
Jim Van Verthffacf652019-04-02 11:59:34 -04001230 has_skps = "True" == exec_script("//gn/checkdir.py",
1231 [ rebase_path("skps", root_build_dir) ],
1232 "trim string")
1233 bundle_data("${app_name}_bundle_resources") {
1234 sources = [
1235 "resources",
1236 ]
1237 outputs = [
1238 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1239 "{{bundle_resources_dir}}/data/resources",
1240 ]
1241 }
1242 if (has_skps) {
1243 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001244 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001245 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001246 ]
1247 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001248 # Store in same folder as resources
1249 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001250 ]
1251 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001252 }
1253
Jim Van Verth443a9132017-11-28 09:45:26 -05001254 executable("${app_name}_generate_executable") {
1255 forward_variables_from(invoker,
1256 "*",
1257 [
1258 "output_name",
1259 "visibility",
1260 "is_shared_library",
1261 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001262 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001263 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001264 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1265 }
1266
1267 bundle_data("${app_name}_bundle_executable") {
1268 public_deps = [
1269 ":${app_name}_generate_executable",
1270 ]
1271 sources = [
1272 "$gen_path/$app_name",
1273 ]
1274 outputs = [
1275 "{{bundle_executable_dir}}/$app_name",
1276 ]
1277 testonly = true
1278 }
1279
Ben Wagnerd51ea412019-09-02 15:41:34 -04001280 action("${app_name}_dsymutil") {
Jim Van Verthffacf652019-04-02 11:59:34 -04001281 public_deps = [
1282 ":${app_name}_generate_executable",
1283 ]
1284 sources = [
Ben Wagnerd51ea412019-09-02 15:41:34 -04001285 "$gen_path/$app_name",
1286 ]
1287 script = "//gn/call.py"
1288 args = [
1289 "dsymutil",
Jim Van Verth86c49832019-09-03 15:18:36 -04001290 rebase_path("$gen_path/$app_name"),
Ben Wagnerd51ea412019-09-02 15:41:34 -04001291 ]
1292 outputs = [
1293 "$gen_path/${app_name}.dSYM",
1294 ]
1295 testonly = true
Ben Wagneredcce312019-09-02 16:50:20 -04001296 pool = "//gn/toolchain:dsymutil_pool($default_toolchain)"
Ben Wagnerd51ea412019-09-02 15:41:34 -04001297 }
1298
1299 bundle_data("${app_name}_bundle_symbols") {
1300 public_deps = [
1301 ":${app_name}_dsymutil",
1302 ]
1303 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001304 "$gen_path/${app_name}.dSYM",
1305 ]
1306 outputs = [
1307 "{{bundle_executable_dir}}/${app_name}.dSYM",
1308 ]
1309 testonly = true
1310 }
1311
Jim Van Verth443a9132017-11-28 09:45:26 -05001312 create_bundle("$app_name") {
1313 product_type = "com.apple.product-type.application"
1314 testonly = true
1315
1316 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1317 bundle_resources_dir = bundle_root_dir
1318 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001319
1320 deps = [
1321 ":${app_name}_bundle_executable",
1322 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001323 ":${app_name}_bundle_resources",
1324 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001325 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001326 if (has_skps) {
1327 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001328 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001329
1330 # should only code sign when running on a device, not the simulator
1331 if (target_cpu != "x64") {
1332 code_signing_script = "//gn/codesign_ios.py"
1333 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1334 code_signing_outputs = [
1335 "$bundle_root_dir/_CodeSignature/CodeResources",
1336 "$bundle_root_dir/embedded.mobileprovision",
1337 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001338 code_signing_args = [
1339 rebase_path("$bundle_root_dir", root_build_dir),
1340 skia_ios_identity,
1341 skia_ios_profile,
1342 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001343 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001344 }
1345 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001346 # !is_ios
1347
1348 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1349 shared_library("lib" + target_name) {
1350 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1351 configs += [ ":skia_private" ]
1352 testonly = true
1353 }
1354 } else {
1355 _executable = target_name
1356 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001357 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001358 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1359 configs += [ ":skia_private" ]
1360 testonly = true
1361 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001362 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001363 if (is_android && skia_android_serial != "" && defined(_executable)) {
1364 action("push_" + target_name) {
1365 script = "gn/push_to_android.py"
1366 deps = [
1367 ":" + _executable,
1368 ]
1369 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1370 outputs = [
1371 _stamp,
1372 ]
1373 args = [
1374 rebase_path("$root_build_dir/$_executable"),
1375 skia_android_serial,
1376 rebase_path(_stamp),
1377 ]
1378 testonly = true
1379 }
Mike Klein7d921032017-01-05 12:20:41 -05001380 }
1381 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001382 }
1383
Greg Danielda16cce2018-08-01 09:23:57 -04001384 config("moltenvk_config") {
1385 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1386 if (is_ios) {
1387 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1388 } else {
1389 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1390 }
1391 cflags = [ "-F$moltenvk_framework_path" ]
1392 ldflags = [ "-F$moltenvk_framework_path" ]
1393 libs = [
1394 "MoltenVK.framework",
1395 "Metal.framework",
1396 "IOSurface.framework",
1397 "QuartzCore.framework",
1398 "Foundation.framework",
1399 ]
1400 if (is_ios) {
1401 libs += [ "UIKit.framework" ]
1402 } else {
1403 libs += [ "IOKit.framework" ]
1404 }
1405 defines = [ "SK_MOLTENVK" ]
1406 }
1407 }
1408
1409 source_set("moltenvk") {
1410 public_configs = [ ":moltenvk_config" ]
1411 }
1412
mtkleinc095df52016-08-24 12:23:52 -07001413 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001414 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001415
Mike Klein9e25bb92019-04-29 09:46:36 -05001416 # Bots and even devs may not have Vulkan headers, so put
1417 # include/third_party/vulkan on our path so they're always available.
1418 all_dependent_configs = [ ":our_vulkan_headers" ]
1419
Mike Klein333fb452019-04-24 08:48:11 -05001420 defines = []
1421 if (skia_enable_discrete_gpu) {
1422 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1423 }
1424
Brian Osmanc9a42472018-05-31 13:17:12 -04001425 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001426 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001427 sources = [
1428 "tools/gpu/GrContextFactory.cpp",
1429 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001430 "tools/gpu/MemoryCache.cpp",
1431 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001432 "tools/gpu/ProxyUtils.cpp",
1433 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001434 "tools/gpu/YUVUtils.cpp",
1435 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001436 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1437 "tools/gpu/gl/GLTestContext.cpp",
1438 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001439 "tools/gpu/mock/MockTestContext.cpp",
1440 ]
1441 libs = []
1442
1443 if (is_android || skia_use_egl) {
1444 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1445 } else if (is_ios) {
1446 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1447 libs += [ "OpenGLES.framework" ]
1448 } else if (is_linux) {
1449 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001450 libs += [
1451 "GLU",
1452 "X11",
1453 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001454 } else if (is_mac) {
1455 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1456 } else if (is_win) {
1457 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001458 libs += [ "Gdi32.lib" ]
1459 if (target_cpu != "arm64") {
1460 libs += [ "OpenGL32.lib" ]
1461 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001462 }
mtklein25c81d42016-07-27 13:55:26 -07001463
Brian Osmanc9a42472018-05-31 13:17:12 -04001464 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001465
Brian Osmanc9a42472018-05-31 13:17:12 -04001466 if (skia_use_angle) {
1467 deps += [ "//third_party/angle2" ]
1468 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1469 }
Greg Daniel54200e42018-12-11 17:03:39 -05001470
Brian Osmanc9a42472018-05-31 13:17:12 -04001471 if (skia_use_vulkan) {
1472 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1473 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001474 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1475 public_deps += [ ":moltenvk" ]
1476 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001477 }
1478 if (skia_use_metal) {
1479 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001480 }
Stephen White985741a2019-07-18 11:43:45 -04001481 if (skia_use_dawn) {
1482 public_deps += [ "//third_party/dawn:dawn_headers" ]
1483 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
1484 }
mtklein25c81d42016-07-27 13:55:26 -07001485 }
mtklein25c81d42016-07-27 13:55:26 -07001486
mtkleinc095df52016-08-24 12:23:52 -07001487 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001488 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001489 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001490 ]
1491 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001492
1493 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001494 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001495 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001496 ]
1497 deps = [
mtklein046cb562016-09-16 10:23:12 -07001498 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001499 ]
1500 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001501 ":gpu_tool_utils",
1502 ]
1503 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001504 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001505 sources = [
1506 "tools/flags/CommonFlagsGpu.cpp",
1507 ]
1508 deps = [
1509 ":flags",
1510 ]
1511 public_deps = [
1512 ":gpu_tool_utils",
1513 ]
1514 }
1515 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001516 sources = [
1517 "tools/flags/CommonFlagsImages.cpp",
1518 ]
1519 deps = [
1520 ":flags",
1521 ]
1522 }
1523 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001524 sources = [
1525 "tools/flags/CommonFlagsAA.cpp",
1526 ]
1527 deps = [
1528 ":flags",
1529 ]
1530 }
mtklein25c81d42016-07-27 13:55:26 -07001531
Mike Klein499f0ac2019-03-25 13:00:12 -05001532 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001533 deps = [
1534 ":flags",
1535 ]
1536 sources = [
1537 "tools/trace/ChromeTracingTracer.cpp",
1538 "tools/trace/ChromeTracingTracer.h",
1539 "tools/trace/EventTracingPriv.cpp",
1540 "tools/trace/EventTracingPriv.h",
1541 "tools/trace/SkDebugfTracer.cpp",
1542 "tools/trace/SkDebugfTracer.h",
1543 ]
1544 }
1545
mtkleinc095df52016-08-24 12:23:52 -07001546 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001547 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001548 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001549 "tools/AutoreleasePool.h",
mtkleinc095df52016-08-24 12:23:52 -07001550 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001551 "tools/DDLPromiseImageHelper.cpp",
1552 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001553 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001554 "tools/ProcStats.cpp",
1555 "tools/Resources.cpp",
Hal Canarye574f1e2019-07-15 14:01:37 -04001556 "tools/SkMetaData.cpp",
1557 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001558 "tools/SkSharingProc.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001559 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001560 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001561 "tools/debugger/DebugCanvas.cpp",
1562 "tools/debugger/DrawCommand.cpp",
1563 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001564 "tools/fonts/RandomScalerContext.cpp",
1565 "tools/fonts/TestEmptyTypeface.h",
1566 "tools/fonts/TestFontMgr.cpp",
1567 "tools/fonts/TestFontMgr.h",
1568 "tools/fonts/TestSVGTypeface.cpp",
1569 "tools/fonts/TestSVGTypeface.h",
1570 "tools/fonts/TestTypeface.cpp",
1571 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001572 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001573 "tools/random_parse_path.cpp",
Hal Canary41248072019-07-11 16:32:53 -04001574 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001575 "tools/timer/Timer.cpp",
1576 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001577 libs = []
1578 if (is_ios) {
1579 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001580 sources += [ "tools/ios_utils.h" ]
1581 if (skia_use_metal) {
1582 sources += [ "tools/AutoreleasePool.mm" ]
1583 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001584 libs += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001585 } else if (is_mac) {
1586 if (skia_use_metal) {
1587 sources += [ "tools/AutoreleasePool.mm" ]
1588 libs += [ "Foundation.framework" ]
1589 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001590 } else if (is_win) {
1591 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001592 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001593
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001594 defines = []
1595 if (skia_tools_require_resources) {
1596 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1597 }
mtkleinc095df52016-08-24 12:23:52 -07001598 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001599 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001600 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001601 ]
1602 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001603 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001604 ]
mtkleinc095df52016-08-24 12:23:52 -07001605 }
mtklein25c81d42016-07-27 13:55:26 -07001606
Mike Kleine11e5c12019-04-24 12:46:06 -05001607 test_lib("etc1") {
1608 sources = [
1609 "third_party/etc1/etc1.cpp",
1610 ]
1611 }
1612
Mike Reed7bf160e2019-05-17 16:50:51 -04001613 if (skia_use_ffmpeg) {
1614 test_lib("video_decoder") {
1615 sources = [
1616 "experimental/ffmpeg/SkVideoDecoder.cpp",
1617 "experimental/ffmpeg/SkVideoDecoder.h",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001618 "experimental/ffmpeg/SkVideoEncoder.cpp",
1619 "experimental/ffmpeg/SkVideoEncoder.h",
Mike Reed7bf160e2019-05-17 16:50:51 -04001620 ]
1621 libs = [
Mike Reedf97e8e92019-05-29 13:33:55 -04001622 "swscale",
Mike Reed7bf160e2019-05-17 16:50:51 -04001623 "avcodec",
1624 "avformat",
1625 "avutil",
1626 ]
1627 }
1628 }
1629
Mike Klein6e744122016-10-27 12:21:40 -04001630 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001631 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001632 sources = gm_sources
1633 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001634 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001635 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001636 ":skia",
1637 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001638 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001639 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001640 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001641 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001642 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001643 if (is_skia_dev_build) {
1644 sources += [ "gm/fiddle.cpp" ]
1645 deps += [ ":skia.h" ]
1646 }
Greg Danielda16cce2018-08-01 09:23:57 -04001647 public_deps = [
1648 ":gpu_tool_utils",
1649 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001650
1651 if (skia_use_ffmpeg) {
1652 deps += [ ":video_decoder" ]
1653 sources += [ "gm/video_decoder.cpp" ]
1654 }
mtkleinc095df52016-08-24 12:23:52 -07001655 }
mtklein25c81d42016-07-27 13:55:26 -07001656
Mike Klein7b7077c2019-06-03 17:10:59 -05001657 test_lib("skvm_builders") {
1658 sources = [
1659 "tools/SkVMBuilders.cpp",
1660 "tools/SkVMBuilders.h",
1661 ]
1662 }
1663
Mike Klein6e744122016-10-27 12:21:40 -04001664 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001665 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001666 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001667 if (skia_use_metal) {
1668 sources += metal_tests_sources
1669 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001670 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001671 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001672 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001673 if (!(skia_use_freetype && skia_use_fontconfig)) {
1674 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1675 }
mtkleinc095df52016-08-24 12:23:52 -07001676 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001677 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001678 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001679 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001680 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001681 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001682 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001683 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001684 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001685 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001686 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001687 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001688 "//third_party/zlib",
1689 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001690 public_deps = [
1691 ":gpu_tool_utils", # Test.h #includes headers from this target.
1692 ]
mtkleinc095df52016-08-24 12:23:52 -07001693 }
mtklein2f3416d2016-08-02 16:02:05 -07001694
Mike Klein6e744122016-10-27 12:21:40 -04001695 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001696 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001697 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001698 deps = [
1699 ":flags",
1700 ":gm",
1701 ":gpu_tool_utils",
1702 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001703 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001704 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001705 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001706 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001707 ]
1708 }
mtklein2b6870c2016-07-28 14:17:33 -07001709
mtkleinc095df52016-08-24 12:23:52 -07001710 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001711 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001712 sources = [
1713 "experimental/svg/model/SkSVGAttribute.cpp",
1714 "experimental/svg/model/SkSVGAttributeParser.cpp",
1715 "experimental/svg/model/SkSVGCircle.cpp",
1716 "experimental/svg/model/SkSVGClipPath.cpp",
1717 "experimental/svg/model/SkSVGContainer.cpp",
1718 "experimental/svg/model/SkSVGDOM.cpp",
1719 "experimental/svg/model/SkSVGEllipse.cpp",
1720 "experimental/svg/model/SkSVGGradient.cpp",
1721 "experimental/svg/model/SkSVGLine.cpp",
1722 "experimental/svg/model/SkSVGLinearGradient.cpp",
1723 "experimental/svg/model/SkSVGNode.cpp",
1724 "experimental/svg/model/SkSVGPath.cpp",
1725 "experimental/svg/model/SkSVGPattern.cpp",
1726 "experimental/svg/model/SkSVGPoly.cpp",
1727 "experimental/svg/model/SkSVGRadialGradient.cpp",
1728 "experimental/svg/model/SkSVGRect.cpp",
1729 "experimental/svg/model/SkSVGRenderContext.cpp",
1730 "experimental/svg/model/SkSVGSVG.cpp",
1731 "experimental/svg/model/SkSVGShape.cpp",
1732 "experimental/svg/model/SkSVGStop.cpp",
1733 "experimental/svg/model/SkSVGTransformableNode.cpp",
1734 "experimental/svg/model/SkSVGUse.cpp",
1735 "experimental/svg/model/SkSVGValue.cpp",
1736 ]
1737 deps = [
1738 ":skia",
1739 ":xml",
1740 ]
1741 }
mtkleinc095df52016-08-24 12:23:52 -07001742 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001743
Mike Reedd62d4062019-06-12 10:20:44 -04001744 test_lib("experimental_xform") {
1745 sources = [
1746 "experimental/xform/SkShape.cpp",
1747 "experimental/xform/SkXform.cpp",
1748 "experimental/xform/XContext.cpp",
1749 ]
1750 deps = [
1751 ":skia",
1752 ]
1753 }
1754
Mike Klein38af9432016-11-11 11:39:44 -05001755 if (skia_use_lua) {
1756 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001757 sources = [
1758 "src/utils/SkLua.cpp",
1759 "src/utils/SkLuaCanvas.cpp",
1760 ]
1761 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001762 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001763 "//third_party/lua",
1764 ]
1765 }
1766
Mike Kleine6682eb2017-01-05 10:54:57 -05001767 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001768 sources = [
1769 "tools/lua/lua_app.cpp",
1770 ]
1771 deps = [
1772 ":lua",
1773 ":skia",
1774 "//third_party/lua",
1775 ]
Mike Klein38af9432016-11-11 11:39:44 -05001776 }
1777
Mike Kleine6682eb2017-01-05 10:54:57 -05001778 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001779 sources = [
1780 "tools/lua/lua_pictures.cpp",
1781 ]
1782 deps = [
1783 ":flags",
1784 ":lua",
1785 ":skia",
1786 ":tool_utils",
1787 "//third_party/lua",
1788 ]
Mike Klein38af9432016-11-11 11:39:44 -05001789 }
1790 }
1791
Florin Malitabfe876a2018-09-02 12:33:59 -04001792 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001793 test_app("skottie_tool") {
1794 deps = [
1795 "modules/skottie:tool",
1796 ]
1797 }
1798 }
1799
Hal Canary5b39dc82019-04-17 13:29:46 -04001800 test_app("make_skqp_model") {
1801 sources = [
1802 "tools/skqp/make_skqp_model.cpp",
1803 ]
1804 deps = [
1805 ":skia",
1806 ]
1807 }
1808
Kevin Lubickebf648e2017-09-21 13:45:16 -04001809 if (target_cpu != "wasm") {
1810 import("gn/samples.gni")
1811 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001812 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001813 public_deps = [
1814 ":tool_utils",
1815 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001816 deps = [
1817 ":experimental_svg_model",
1818 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001819 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001820 ":xml",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001821 "modules/skparagraph:samples",
Mike Reedec80d902019-02-12 11:31:27 -05001822 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001823 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001824 ]
Mike Klein38af9432016-11-11 11:39:44 -05001825
Kevin Lubickebf648e2017-09-21 13:45:16 -04001826 if (skia_use_lua) {
1827 sources += [ "samplecode/SampleLua.cpp" ]
1828 deps += [
1829 ":lua",
1830 "//third_party/lua",
1831 ]
1832 }
1833 }
Mike Klein7af351a2018-07-27 09:54:43 -04001834 test_app("imgcvt") {
1835 sources = [
1836 "tools/imgcvt.cpp",
1837 ]
1838 deps = [
1839 ":skcms",
1840 ":skia",
1841 ]
1842 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001843 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001844 sources = [
1845 "tools/HashAndEncode.cpp",
1846 "tools/HashAndEncode.h",
1847 ]
1848 deps = [
1849 ":flags",
1850 ":skia",
1851 "//third_party/libpng",
1852 ]
1853 }
1854 test_app("fm") {
1855 sources = [
1856 "tools/fm/fm.cpp",
1857 ]
1858 deps = [
1859 ":common_flags_aa",
1860 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001861 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001862 ":flags",
1863 ":gm",
1864 ":gpu_tool_utils",
1865 ":hash_and_encode",
1866 ":skia",
1867 ":tool_utils",
1868 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001869 "modules/skottie",
1870 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001871 ]
1872 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001873 test_app("dm") {
1874 sources = [
1875 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001876 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001877 "dm/DMJsonWriter.cpp",
1878 "dm/DMSrcSink.cpp",
1879 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001880 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001881 ":common_flags_aa",
1882 ":common_flags_config",
1883 ":common_flags_gpu",
1884 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001885 ":experimental_svg_model",
1886 ":flags",
1887 ":gm",
1888 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001889 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001890 ":skia",
1891 ":tests",
1892 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001893 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001894 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001895 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001896 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001897 ]
1898 }
Brian Osman16adfa32016-10-18 14:42:44 -04001899 }
1900
Mike Kleina8a51ce2018-01-09 12:34:11 -05001901 if (!is_win) {
1902 test_app("remote_demo") {
1903 sources = [
1904 "tools/remote_demo.cpp",
1905 ]
1906 deps = [
1907 ":skia",
1908 ]
1909 }
1910 }
1911
Mike Kleine6682eb2017-01-05 10:54:57 -05001912 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001913 sources = [
1914 "bench/nanobench.cpp",
1915 ]
1916 deps = [
1917 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001918 ":common_flags_aa",
1919 ":common_flags_config",
1920 ":common_flags_gpu",
1921 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001922 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001923 ":flags",
1924 ":gm",
1925 ":gpu_tool_utils",
1926 ":skia",
1927 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001928 ":trace",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001929 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001930 "modules/sksg",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001931 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07001932 ]
mtklein2b6870c2016-07-28 14:17:33 -07001933 }
halcanary19a97202016-08-03 15:08:04 -07001934
Ravi Mistry10d36c52017-01-31 09:49:18 -05001935 test_app("skpinfo") {
1936 sources = [
1937 "tools/skpinfo.cpp",
1938 ]
1939 deps = [
1940 ":flags",
1941 ":skia",
1942 ]
1943 }
1944
Mike Reedc0ee21f2019-05-28 16:11:03 -04001945 if (skia_use_ffmpeg) {
1946 test_app("skottie2movie") {
1947 sources = [
1948 "tools/skottie2movie.cpp",
1949 ]
1950 deps = [
1951 ":flags",
1952 ":skia",
1953 ":video_decoder",
1954 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04001955 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001956 ]
1957 }
1958 }
1959
Brian Osmanc9a42472018-05-31 13:17:12 -04001960 test_app("skpbench") {
1961 sources = [
1962 "tools/skpbench/skpbench.cpp",
1963 ]
1964 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001965 ":common_flags_config",
1966 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001967 ":flags",
1968 ":gpu_tool_utils",
1969 ":skia",
1970 ":tool_utils",
1971 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001972 }
1973
Mike Kleine6682eb2017-01-05 10:54:57 -05001974 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001975 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001976 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001977 ]
1978 deps = [
1979 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001980 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001981 ]
halcanary3eee9d92016-09-10 07:01:53 -07001982 }
mtklein046cb562016-09-16 10:23:12 -07001983
Ben Wagner219f3622017-07-17 15:32:25 -04001984 test_app("create_test_font") {
1985 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001986 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001987 ]
1988 deps = [
1989 ":skia",
1990 ]
1991 assert_no_deps = [
1992 # tool_utils requires the output of this app.
1993 ":tool_utils",
1994 ]
1995 }
1996
Florin Malita5d3ff432018-07-31 16:38:43 -04001997 if (skia_use_expat) {
1998 test_app("create_test_font_color") {
1999 sources = [
2000 "tools/fonts/create_test_font_color.cpp",
2001 ]
2002 deps = [
2003 ":flags",
2004 ":skia",
2005 ":tool_utils",
2006 ]
2007 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002008 }
2009
Mike Kleine6682eb2017-01-05 10:54:57 -05002010 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07002011 sources = [
2012 "tools/get_images_from_skps.cpp",
2013 ]
2014 deps = [
2015 ":flags",
2016 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002017 ]
mtklein046cb562016-09-16 10:23:12 -07002018 }
mtkleinecbc5262016-09-22 11:51:24 -07002019
Brian Osman6788a542018-12-10 11:56:01 -05002020 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002021 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002022 sources = [
2023 "tools/skiaserve/Request.cpp",
2024 "tools/skiaserve/Response.cpp",
2025 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002026 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2027 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2028 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2029 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2030 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2031 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2032 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2033 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2034 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002035 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2036 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002037 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2038 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2039 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2040 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2041 ]
2042 deps = [
2043 ":flags",
2044 ":gpu_tool_utils",
2045 ":skia",
2046 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002047 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002048 ]
Mike Klein7d302882016-11-03 14:06:31 -04002049 }
mtkleinecbc5262016-09-22 11:51:24 -07002050 }
kjlubick14f984b2016-10-03 11:49:45 -07002051
Mike Kleine6682eb2017-01-05 10:54:57 -05002052 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002053 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002054 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002055 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002056 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002057 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002058 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002059 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002060 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002061 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002062 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002063 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002064 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002065 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002066 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002067 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2068 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002069 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002070 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002071 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002072 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002073 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2074 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002075 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2076 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002077 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002078 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002079 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002080 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002081 "tools/debugger/DebugCanvas.cpp",
2082 "tools/debugger/DrawCommand.cpp",
2083 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002084 ]
2085 deps = [
2086 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002087 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002088 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002089 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002090 ]
kjlubick14f984b2016-10-03 11:49:45 -07002091 }
Mike Klein38312422016-10-05 15:41:01 -04002092
Mike Kleine6682eb2017-01-05 10:54:57 -05002093 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002094 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002095 rebase_path("tests/skia_test.cpp"),
2096 rebase_path("tests/Test.cpp"),
2097 ]
caryclark9feb6322016-10-25 08:58:26 -07002098 deps = [
2099 ":flags",
2100 ":gpu_tool_utils",
2101 ":skia",
2102 ":tool_utils",
2103 ]
caryclark9feb6322016-10-25 08:58:26 -07002104 }
2105
Mike Kleine6682eb2017-01-05 10:54:57 -05002106 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002107 sources = [
2108 "tools/DumpRecord.cpp",
2109 "tools/dump_record.cpp",
2110 ]
2111 deps = [
2112 ":flags",
2113 ":skia",
2114 ]
Mike Klein38312422016-10-05 15:41:01 -04002115 }
bungemanfe917272016-10-13 17:36:40 -04002116
Mike Kleine6682eb2017-01-05 10:54:57 -05002117 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002118 sources = [
2119 "tools/skdiff/skdiff.cpp",
2120 "tools/skdiff/skdiff_html.cpp",
2121 "tools/skdiff/skdiff_main.cpp",
2122 "tools/skdiff/skdiff_utils.cpp",
2123 ]
2124 deps = [
2125 ":skia",
2126 ":tool_utils",
2127 ]
bungemanfe917272016-10-13 17:36:40 -04002128 }
halcanarya73d76a2016-10-17 13:19:02 -07002129
Mike Kleine6682eb2017-01-05 10:54:57 -05002130 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002131 sources = [
2132 "tools/skp_parser.cpp",
2133 ]
2134 deps = [
2135 ":skia",
2136 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002137 ]
halcanarya73d76a2016-10-17 13:19:02 -07002138 }
Brian Osman16adfa32016-10-18 14:42:44 -04002139
Brian Osmanc9a42472018-05-31 13:17:12 -04002140 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002141 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002142 defines =
2143 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002144 sources = [
2145 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002146 "tools/skqp/src/skqp.cpp",
2147 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002148 ]
2149 deps = [
2150 ":gm",
2151 ":gpu_tool_utils",
2152 ":skia",
2153 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002154 ":tool_utils",
2155 ]
2156 }
2157 test_app("skqp") {
2158 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002159 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002160 ]
2161 deps = [
2162 ":skia",
2163 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002164 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002165 ]
2166 }
2167 test_app("jitter_gms") {
2168 sources = [
2169 "tools/skqp/jitter_gms.cpp",
2170 ]
2171 deps = [
2172 ":gm",
2173 ":skia",
2174 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002175 ]
2176 }
2177 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002178 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002179 test_app("skqp_app") {
2180 is_shared_library = true
2181 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002182 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002183 ]
2184 deps = [
2185 ":skia",
2186 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002187 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002188 ]
2189 libs = [ "android" ]
2190 }
2191 }
Stan Iliev93151722018-08-02 11:10:52 -04002192 if (is_android && skia_enable_gpu) {
2193 test_app("skottie_android") {
2194 is_shared_library = true
2195
2196 sources = [
2197 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2198 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2199 ]
2200 libs = []
2201
Stan Iliev93151722018-08-02 11:10:52 -04002202 deps = [
2203 ":skia",
2204 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002205 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002206 ]
2207 }
2208 }
Hal Canary75427132017-10-11 16:00:31 -04002209
Hal Canarya9de7602018-01-19 13:08:23 -05002210 test_app("list_gms") {
2211 sources = [
2212 "tools/list_gms.cpp",
2213 ]
2214 deps = [
2215 ":gm",
2216 ":skia",
2217 ]
2218 }
2219 test_app("list_gpu_unit_tests") {
2220 sources = [
2221 "dm/DMGpuTestProcs.cpp",
2222 "tools/list_gpu_unit_tests.cpp",
2223 ]
2224 deps = [
2225 ":skia",
2226 ":tests",
2227 ]
2228 }
2229
Brian Osmanc9a42472018-05-31 13:17:12 -04002230 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002231 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002232 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002233 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002234 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002235 sources = [
2236 "tools/sk_app/CommandSet.cpp",
2237 "tools/sk_app/GLWindowContext.cpp",
2238 "tools/sk_app/Window.cpp",
2239 ]
2240 libs = []
2241
Stephen Whitea800ec92019-08-02 15:04:52 -04002242 if (skia_use_dawn) {
2243 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
2244 }
2245
Brian Osmanc9a42472018-05-31 13:17:12 -04002246 if (is_android) {
2247 sources += [
2248 "tools/sk_app/android/GLWindowContext_android.cpp",
2249 "tools/sk_app/android/RasterWindowContext_android.cpp",
2250 "tools/sk_app/android/Window_android.cpp",
2251 "tools/sk_app/android/main_android.cpp",
2252 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002253 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002254 libs += [ "android" ]
2255 } else if (is_linux) {
2256 sources += [
2257 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2258 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2259 "tools/sk_app/unix/Window_unix.cpp",
2260 "tools/sk_app/unix/keysym2ucs.c",
2261 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002262 ]
Stephen Whitea800ec92019-08-02 15:04:52 -04002263 if (skia_use_dawn) {
2264 if (dawn_enable_vulkan) {
2265 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2266 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2267 libs += [ "X11-xcb" ]
2268 }
2269 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002270 libs += [
2271 "GL",
2272 "X11",
2273 ]
2274 } else if (is_win) {
2275 sources += [
2276 "tools/sk_app/win/GLWindowContext_win.cpp",
2277 "tools/sk_app/win/RasterWindowContext_win.cpp",
2278 "tools/sk_app/win/Window_win.cpp",
2279 "tools/sk_app/win/main_win.cpp",
2280 ]
Brian Salomon194db172017-08-17 14:37:06 -04002281 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002282 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002283 }
Stephen Whitea800ec92019-08-02 15:04:52 -04002284 if (skia_use_dawn) {
2285 if (dawn_enable_d3d12) {
2286 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2287 }
2288 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002289 } else if (is_mac) {
2290 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002291 "tools/sk_app/mac/GLWindowContext_mac.mm",
2292 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2293 "tools/sk_app/mac/Window_mac.mm",
2294 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002295 ]
Stephen Whitea800ec92019-08-02 15:04:52 -04002296 if (skia_use_dawn) {
2297 if (dawn_enable_metal) {
2298 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2299 }
2300 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002301 libs += [
2302 "QuartzCore.framework",
2303 "Cocoa.framework",
2304 "Foundation.framework",
2305 ]
2306 } else if (is_ios) {
2307 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002308 "tools/sk_app/ios/GLWindowContext_ios.mm",
2309 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2310 "tools/sk_app/ios/Window_ios.mm",
2311 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002312 ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002313 libs += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002314 }
2315
2316 if (skia_use_vulkan) {
2317 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2318 if (is_android) {
2319 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2320 } else if (is_linux) {
2321 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2322 libs += [ "X11-xcb" ]
2323 } else if (is_win) {
2324 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002325 } else if (is_mac) {
2326 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2327 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002328 }
2329 }
2330
Jim Van Verthbe39f712019-02-08 15:36:14 -05002331 if (skia_use_metal) {
2332 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2333 if (is_mac) {
2334 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002335 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002336 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002337 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002338 }
2339
Brian Osmanc9a42472018-05-31 13:17:12 -04002340 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002341 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002342 ]
2343 if (is_android) {
2344 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002345 }
2346 if (skia_use_angle) {
2347 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002348 }
Brian Osman16adfa32016-10-18 14:42:44 -04002349 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002350
Hal Canary87515122019-03-15 14:22:51 -04002351 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2352 test_app("fiddle_examples") {
2353 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002354 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002355 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002356 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002357 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002358 if (is_win) {
2359 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2360 }
Hal Canary87515122019-03-15 14:22:51 -04002361 deps = [
2362 ":skia",
2363 ":skia.h",
2364 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002365 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002366 ]
2367 }
2368 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002369 test_app("viewer") {
2370 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002371 sources = [
Hal Canary41248072019-07-11 16:32:53 -04002372 "tools/viewer/AnimTimer.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002373 "tools/viewer/BisectSlide.cpp",
2374 "tools/viewer/GMSlide.cpp",
2375 "tools/viewer/ImGuiLayer.cpp",
2376 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002377 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002378 "tools/viewer/SKPSlide.cpp",
2379 "tools/viewer/SampleSlide.cpp",
2380 "tools/viewer/SkottieSlide.cpp",
2381 "tools/viewer/SlideDir.cpp",
2382 "tools/viewer/StatsLayer.cpp",
2383 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002384 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002385 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002386 "tools/viewer/Viewer.cpp",
2387 ]
2388 libs = []
2389
Brian Osmanc9a42472018-05-31 13:17:12 -04002390 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002391 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002392 ":experimental_svg_model",
2393 ":flags",
2394 ":gm",
2395 ":gpu_tool_utils",
2396 ":samples",
2397 ":sk_app",
2398 ":skia",
2399 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002400 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002401 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002402 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002403 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002404 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002405 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002406 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002407 ]
Mike Reedd62d4062019-06-12 10:20:44 -04002408 if (skia_use_experimental_xform) {
2409 deps += [ ":experimental_xform" ]
2410 sources += [ "gm/xform.cpp" ]
2411 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002412 }
2413
Brian Osmanc9a42472018-05-31 13:17:12 -04002414 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002415 test_app("HelloWorld") {
2416 sources = [
2417 "example/HelloWorld.cpp",
2418 ]
2419 libs = []
2420
Brian Osmaneff04b52017-11-21 13:18:02 -05002421 deps = [
2422 ":flags",
2423 ":gpu_tool_utils",
2424 ":sk_app",
2425 ":skia",
2426 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002427 ]
2428 }
2429 }
2430
Brian Osmanc9a42472018-05-31 13:17:12 -04002431 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002432 test_app("SkiaSDLExample") {
2433 sources = [
2434 "example/SkiaSDLExample.cpp",
2435 ]
2436 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002437 deps = [
2438 ":gpu_tool_utils",
2439 ":skia",
2440 "//third_party/libsdl",
2441 ]
2442 }
2443 }
2444
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002445 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2446 action_foreach("generate_mocs") {
2447 script = "gn/call.py"
2448 sources = [
2449 "tools/mdbviz/MainWindow.h",
2450 ]
2451 outputs = [
2452 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2453 ]
2454 args = [
2455 "$skia_qt_path" + "/bin/moc",
2456 "{{source}}",
2457 "-o",
2458 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2459 ]
2460 }
2461 action_foreach("generate_resources") {
2462 script = "gn/call.py"
2463 sources = [
2464 "tools/mdbviz/resources.qrc",
2465 ]
2466 outputs = [
2467 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2468 ]
2469 args = [
2470 "$skia_qt_path" + "/bin/rcc",
2471 "{{source}}",
2472 "-o",
2473 "gen/mdbviz/{{source_name_part}}_res.cpp",
2474 ]
2475 }
2476 test_app("mdbviz") {
2477 if (is_win) {
2478 # on Windows we need to disable some exception handling warnings due to the Qt headers
2479 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2480 }
2481 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002482 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002483 "tools/debugger/DebugCanvas.cpp",
2484 "tools/debugger/DrawCommand.cpp",
2485 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002486 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002487 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002488 "tools/mdbviz/main.cpp",
2489
2490 # generated files
2491 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2492 "$target_gen_dir/mdbviz/resources_res.cpp",
2493 ]
2494 lib_dirs = [ "$skia_qt_path/lib" ]
2495 libs = [
2496 "Qt5Core.lib",
2497 "Qt5Gui.lib",
2498 "Qt5Widgets.lib",
2499 ]
2500 include_dirs = [
2501 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002502 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002503 "$skia_qt_path/include/QtWidgets",
2504 ]
2505 deps = [
2506 ":generate_mocs",
2507 ":generate_resources",
2508 ":skia",
2509 ]
2510 }
2511 }
2512
Mike Kleine459afd2017-03-03 09:21:30 -05002513 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002514 copy("gdbserver") {
2515 sources = [
2516 "$ndk/$ndk_gdbserver",
2517 ]
2518 outputs = [
2519 "$root_out_dir/gdbserver",
2520 ]
2521 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002522 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002523
2524 if (skia_use_opencl) {
2525 test_app("hello-opencl") {
2526 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002527 "tools/hello-opencl.cpp",
2528 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002529 deps = [
2530 "//third_party/opencl",
2531 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002532 }
2533 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002534
Brian Osmanf564f152019-07-23 15:14:30 -04002535 executable("cpu_modules") {
2536 sources = [
2537 "tools/cpu_modules.cpp",
2538 ]
2539 deps = [
2540 ":skia",
2541 "modules/particles",
2542 ]
2543 }
2544
Hal Canary1f94d392019-07-30 09:27:56 -04002545 if (skia_use_icu && skia_use_harfbuzz) {
2546 test_app("editor") {
2547 is_shared_library = is_android
2548 deps = [
Hal Canarya0b66fc2019-08-23 10:16:51 -04002549 "modules/skplaintexteditor:editor_app",
Hal Canary1f94d392019-07-30 09:27:56 -04002550 ]
2551 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002552 }
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002553
Mike Klein7e650762019-07-02 15:21:11 -05002554 if (skia_enable_skvm_jit) {
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002555 test_app("skvmtool") {
2556 defines = [
2557 "SKVM_JIT",
2558 "SKVM_PERF_DUMPS",
2559 ]
2560 include_dirs = [ "." ]
2561 sources = [
2562 "src/core/SkSpinlock.cpp",
2563 "src/core/SkThreadID.cpp",
2564 "src/core/SkVM.cpp",
Mike Klein84bcd0c2019-07-23 11:46:09 -05002565 "tools/SkVMBuilders.cpp",
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002566 "tools/SkVMTool.cpp",
2567 ]
2568 if (target_cpu == "x64") {
2569 sources += [ "src/core/SkCpu.cpp" ]
2570 }
2571 }
2572 }
mtklein25c81d42016-07-27 13:55:26 -07002573}