blob: ea779ffb960d2d401c4da4f7a67a3a75b53efb69 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary45812a12019-09-04 08:58:59 -04009import("gn/skia.gni")
10
John Rosasco24cbdab2019-09-25 14:14:35 -070011if (is_fuchsia) {
12 import("//build/fuchsia/sdk.gni")
13 import("build/fuchsia/fuchsia_download_sdk.gni")
14}
15
Stephen White0d70b712019-07-10 15:51:30 -040016if (skia_use_dawn) {
17 import("third_party/externals/dawn/scripts/dawn_features.gni")
18}
19
Adam Barth54ef74a2017-10-13 10:59:38 -070020if (defined(skia_settings)) {
21 import(skia_settings)
22}
23
Hal Canary3388c1a2019-09-16 12:53:17 -040024import("gn/ios.gni")
25
mtkleinc04ff472016-06-23 10:29:30 -070026# Skia public API, generally provided by :skia.
27config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050028 include_dirs = [ "." ]
29
Mike Kleinae7e6712016-10-11 17:49:33 -040030 defines = []
Chinmay Gardef832c0a2020-03-18 14:37:23 -070031 cflags_objcc = []
Mike Kleinae7e6712016-10-11 17:49:33 -040032 if (is_component_build) {
33 defines += [ "SKIA_DLL" ]
34 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040035 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050036 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070037 }
Brian Osmanf2c90142017-07-13 15:50:03 -040038 if (skia_enable_flutter_defines) {
39 defines += flutter_defines
40 }
mtklein06c35c02016-09-20 12:28:12 -070041 if (!skia_enable_gpu) {
42 defines += [ "SK_SUPPORT_GPU=0" ]
43 }
Brian Osman946a4cb2021-07-12 17:02:21 -040044 if (skia_enable_sksl) {
45 defines += [ "SK_ENABLE_SKSL" ]
46 }
Mike Reed025f7832018-11-12 09:27:05 -050047 if (is_fuchsia) {
48 defines += fuchsia_defines
49 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040050 if (skia_gl_standard == "gles") {
51 defines += [ "SK_ASSUME_GL_ES=1" ]
52 } else if (skia_gl_standard == "gl") {
53 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040054 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040055 defines += [
56 "SK_ASSUME_WEBGL=1",
57 "SK_USE_WEBGL",
58 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040059 }
Robert Phillips024668c2021-07-01 12:12:52 -040060 if (!skia_enable_skgpu_v1) {
Robert Phillips7cef6782021-07-01 13:21:37 -040061 defines += [ "SK_GPU_V1=0" ]
Robert Phillips3b97aa22021-05-03 11:42:40 -040062 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070063
64 # Some older versions of the Clang toolchain change the visibility of
65 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
66 # toolchains suppress the use of this macro till toolchain updates are made.
67 if (is_mac || is_ios) {
68 if (skia_enable_api_available_macro) {
69 defines += [ "SK_ENABLE_API_AVAILABLE" ]
70 } else {
71 cflags_objcc += [ "-Wno-unguarded-availability" ]
72 }
73 }
mtkleinc04ff472016-06-23 10:29:30 -070074}
75
76# Skia internal APIs, used by Skia itself and a few test tools.
77config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060078 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070079
Mike Reeda9e241d2017-05-03 10:52:00 -040080 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050081 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070082 defines += [
83 "SK_GAMMA_EXPONENT=1.4",
84 "SK_GAMMA_CONTRAST=0.0",
85 ]
86 }
Mike Kleinb45d8622019-04-24 14:04:01 -050087 if (is_skia_dev_build) {
88 defines += [
89 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
90 "GR_TEST_UTILS=1",
91 ]
Jim Van Verth0c56bba2021-10-18 12:15:47 -040092 if (skia_enable_graphite) {
93 defines += [ "GRAPHITE_TEST_UTILS=1" ]
94 }
mtklein88a7ac02016-09-14 11:16:49 -070095 }
Brian Salomon789e25e2016-09-30 13:41:03 -040096 libs = []
97 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040098 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050099 defines += [ "SK_ANGLE" ]
100 }
Greg Danielb16beb92020-04-27 14:26:21 +0000101 if (skia_use_vma) {
102 defines += [ "SK_USE_VMA" ]
103 }
James Clarkeb8c0dab2021-02-09 06:22:41 -0800104 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -0800105 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800106 }
107}
108
mtkleinc04ff472016-06-23 10:29:30 -0700109# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
110config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600111 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000112 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700113}
114
115skia_library_configs = [
116 ":skia_public",
117 ":skia_private",
118 ":skia_library",
119]
120
mtklein9b8583d2016-08-24 17:32:30 -0700121# Use for CPU-specific Skia code that needs particular compiler flags.
122template("opts") {
123 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400124 skia_source_set(target_name) {
125 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500126 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400127 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700128 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400129 if (defined(invoker.configs)) {
130 configs += invoker.configs
131 }
mtklein9b8583d2016-08-24 17:32:30 -0700132 }
133 } else {
134 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400135 skia_source_set(target_name) {
136 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500137 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700138 forward_variables_from(invoker,
139 "*",
140 [
141 "sources",
142 "cflags",
143 ])
144 }
145 }
anmittala7eaf2e2016-08-17 13:57:26 -0700146}
147
mtklein422310d2016-08-16 18:28:43 -0700148is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700149
mtklein7d6fb2c2016-08-25 14:50:44 -0700150opts("none") {
151 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700152 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700153 cflags = []
154}
155
mtklein7d6fb2c2016-08-25 14:50:44 -0700156opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700157 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700158 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700159 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700160}
161
162opts("arm64") {
163 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700164 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700165 cflags = []
166}
167
168opts("crc32") {
169 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700170 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700171 cflags = [ "-march=armv8-a+crc" ]
172}
173
mtklein9b8583d2016-08-24 17:32:30 -0700174opts("sse2") {
175 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700176 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400177 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400178 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
179 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400180 cflags = [ "-msse2" ]
181 }
mtklein9b8583d2016-08-24 17:32:30 -0700182}
mtkleinc04ff472016-06-23 10:29:30 -0700183
mtklein9b8583d2016-08-24 17:32:30 -0700184opts("ssse3") {
185 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700186 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400187 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400188 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
189 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400190 cflags = [ "-mssse3" ]
191 }
mtklein9b8583d2016-08-24 17:32:30 -0700192}
mtkleinc04ff472016-06-23 10:29:30 -0700193
mtklein9b8583d2016-08-24 17:32:30 -0700194opts("sse41") {
195 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700196 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400197 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400198 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
199 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400200 cflags = [ "-msse4.1" ]
201 }
mtklein9b8583d2016-08-24 17:32:30 -0700202}
mtklein4e976072016-08-08 09:06:27 -0700203
mtklein9b8583d2016-08-24 17:32:30 -0700204opts("sse42") {
205 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700206 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400207 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400208 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
209 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400210 cflags = [ "-msse4.2" ]
211 }
mtklein9b8583d2016-08-24 17:32:30 -0700212}
213
214opts("avx") {
215 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700216 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400217 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000218 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400219 } else {
220 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500221 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500222 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500223 }
Mike Klein3eb71212016-10-11 17:08:53 -0400224 }
mtkleinc04ff472016-06-23 10:29:30 -0700225}
226
Mike Klein1b9b7d52018-02-27 10:37:40 -0500227opts("hsw") {
228 enabled = is_x86
229 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400230 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500231 cflags = [ "/arch:AVX2" ]
232 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000233 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600234 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500235 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600236 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500237 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500238}
239
Mike Kleinad56c4c2020-06-05 06:57:30 -0500240opts("skx") {
241 enabled = is_x86
242 sources = skia_opts.skx_sources
243 if (is_win) {
244 cflags = [ "/arch:AVX512" ]
245 } else {
246 cflags = [ "-march=skylake-avx512" ]
247 if (is_mac && is_debug) {
248 cflags += [ "-fno-stack-check" ] # Work around skia:9709
249 }
250 }
251}
252
mtkleinc095df52016-08-24 12:23:52 -0700253# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700254template("optional") {
255 if (invoker.enabled) {
256 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700257 if (defined(invoker.public_defines)) {
258 defines = invoker.public_defines
259 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600260 if (defined(invoker.public_configs)) {
261 configs = invoker.public_configs
262 }
Hal Canary2dad9902019-11-20 16:01:31 -0500263 if (defined(invoker.public_include_dirs)) {
264 include_dirs = invoker.public_include_dirs
265 }
mtklein457b42a2016-08-23 13:56:37 -0700266 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400267 skia_source_set(target_name) {
268 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500269 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400270 configs = skia_library_configs
271
272 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700273 forward_variables_from(invoker,
274 "*",
275 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400276 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700277 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500278 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700279 "sources_when_disabled",
280 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400281 if (defined(invoker.configs)) {
282 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700283 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400284 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700285 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500286 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400287 skia_source_set(target_name + "_tests") {
288 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500289 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400290 configs = skia_library_configs
291
292 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500293 forward_variables_from(invoker,
294 "*",
295 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400296 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500297 "public_defines",
298 "sources",
299 "sources_for_tests",
300 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500301 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400302 if (defined(invoker.configs)) {
303 configs += invoker.configs
304 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500305 testonly = true
306 sources = invoker.sources_for_tests
307 if (!defined(deps)) {
308 deps = []
309 }
310 deps += [ ":test" ]
311 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500312 }
313 }
mtklein457b42a2016-08-23 13:56:37 -0700314 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400315 skia_source_set(target_name) {
316 visibility = [ ":*" ]
317 configs = skia_library_configs
318
319 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700320 forward_variables_from(invoker,
321 "*",
322 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400323 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400324 "public",
mtklein457b42a2016-08-23 13:56:37 -0700325 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400326 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700327 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700328 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400329 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700330 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500331 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700332 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700333 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400334 if (defined(invoker.configs)) {
335 configs += invoker.configs
336 }
mtkleincd01b032016-08-31 04:58:19 -0700337 if (defined(invoker.sources_when_disabled)) {
338 sources = invoker.sources_when_disabled
339 }
mtklein457b42a2016-08-23 13:56:37 -0700340 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500341 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400342 skia_source_set(target_name + "_tests") {
343 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500344 }
345 }
mtkleineb3c4252016-08-23 07:38:09 -0700346 }
mtklein457b42a2016-08-23 13:56:37 -0700347}
mtklein457b42a2016-08-23 13:56:37 -0700348
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400349optional("android_utils") {
350 enabled = skia_enable_android_utils
351
Leon Scroggins III87caae62020-05-04 10:02:45 -0400352 public = [
353 "client_utils/android/BRDAllocator.h",
354 "client_utils/android/BitmapRegionDecoder.h",
355 "client_utils/android/FrontBufferedStream.h",
356 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400357 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400358 sources = [
359 "client_utils/android/BitmapRegionDecoder.cpp",
360 "client_utils/android/FrontBufferedStream.cpp",
361 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400362}
363
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400364group("fontmgr_factory") {
365 public_deps = [ skia_fontmgr_factory ]
366}
367
368optional("fontmgr_empty_factory") {
369 enabled = true
370 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400371}
372
mtkleina45be612016-08-29 15:22:10 -0700373optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500374 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700375
376 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500377 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700378 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700379 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400380 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700381 sources = [
382 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700383 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400384 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700385 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500386 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700387}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400388optional("fontmgr_android_factory") {
389 enabled = skia_enable_fontmgr_android
390 deps = [ ":fontmgr_android" ]
391 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
392}
mtkleina45be612016-08-29 15:22:10 -0700393
mtkleind2e39db2016-09-07 07:52:55 -0700394optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400395 enabled =
396 skia_enable_fontmgr_custom_directory ||
397 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700398
Mike Kleina01c6b02020-04-01 13:47:34 -0500399 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400400 public = [ "src/ports/SkFontMgr_custom.h" ]
401 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
402}
403
404optional("fontmgr_custom_directory") {
405 enabled = skia_enable_fontmgr_custom_directory
406
407 deps = [
408 ":fontmgr_custom",
409 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700410 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400411 public = [ "include/ports/SkFontMgr_directory.h" ]
412 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
413}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400414optional("fontmgr_custom_directory_factory") {
415 enabled = skia_enable_fontmgr_custom_directory
416 deps = [ ":fontmgr_custom_directory" ]
417 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
418}
Ben Wagner75626e42020-06-03 13:20:37 -0400419
420optional("fontmgr_custom_embedded") {
421 enabled = skia_enable_fontmgr_custom_embedded
422
423 deps = [
424 ":fontmgr_custom",
425 ":typeface_freetype",
426 ]
427 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700428}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400429optional("fontmgr_custom_embedded_factory") {
430 enabled = skia_enable_fontmgr_custom_embedded
431 deps = [ ":fontmgr_custom_embedded" ]
432 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
433}
mtkleind2e39db2016-09-07 07:52:55 -0700434
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500435optional("fontmgr_custom_empty") {
436 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500437
Ben Wagner75626e42020-06-03 13:20:37 -0400438 deps = [
439 ":fontmgr_custom",
440 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800441 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400442 public = [ "include/ports/SkFontMgr_empty.h" ]
443 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500444}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400445optional("fontmgr_custom_empty_factory") {
446 enabled = skia_enable_fontmgr_custom_empty
447 deps = [ ":fontmgr_custom_empty" ]
448 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
449}
Hal Canaryff2742e2018-01-30 11:35:47 -0500450
mtklein3cc22182016-08-29 13:26:14 -0700451optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400452 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700453
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400454 # The public header includes fontconfig.h and uses FcConfig*
455 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400456 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400457 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400458 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500459 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400460}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400461optional("fontmgr_fontconfig_factory") {
462 enabled = skia_enable_fontmgr_fontconfig
463 deps = [ ":fontmgr_fontconfig" ]
464 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
465}
Ben Wagner75626e42020-06-03 13:20:37 -0400466
467optional("fontmgr_FontConfigInterface") {
468 enabled = skia_enable_fontmgr_FontConfigInterface
469
470 deps = [
471 ":typeface_freetype",
472 "//third_party:fontconfig",
473 ]
474 public = [
475 "include/ports/SkFontConfigInterface.h",
476 "include/ports/SkFontMgr_FontConfigInterface.h",
477 ]
mtklein3cc22182016-08-29 13:26:14 -0700478 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700479 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700480 "src/ports/SkFontConfigInterface_direct.cpp",
481 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400482 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700483 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700484 ]
485}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400486optional("fontmgr_FontConfigInterface_factory") {
487 enabled = skia_enable_fontmgr_FontConfigInterface
488 deps = [ ":fontmgr_FontConfigInterface" ]
489 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
490}
mtklein3cc22182016-08-29 13:26:14 -0700491
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500492optional("fontmgr_fuchsia") {
493 enabled = skia_enable_fontmgr_fuchsia
494
Chinmay Garde89820762019-05-06 16:44:06 -0700495 deps = []
496
497 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700498 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700499 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500500 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700501 }
Ben Wagner75626e42020-06-03 13:20:37 -0400502 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
503 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500504}
505
Ben Wagner75626e42020-06-03 13:20:37 -0400506optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400507 enabled = skia_use_fonthost_mac
508
Ben Wagner75626e42020-06-03 13:20:37 -0400509 public = [
510 "include/ports/SkFontMgr_mac_ct.h",
511 "include/ports/SkTypeface_mac.h",
512 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400513 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400514 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400515 "src/ports/SkScalerContext_mac_ct.cpp",
516 "src/ports/SkScalerContext_mac_ct.h",
517 "src/ports/SkTypeface_mac_ct.cpp",
518 "src/ports/SkTypeface_mac_ct.h",
519 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000520 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400521
522 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400523 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400524 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
525 "AppKit.framework",
526 "ApplicationServices.framework",
527 ]
528 }
529
530 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400531 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400532 "CoreFoundation.framework",
533 "CoreGraphics.framework",
534 "CoreText.framework",
535
536 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
537 "UIKit.framework",
538 ]
539 }
540}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400541optional("fontmgr_mac_ct_factory") {
542 enabled = skia_use_fonthost_mac
543 deps = [ ":fontmgr_mac_ct" ]
544 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
545}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400546
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500547optional("fontmgr_win") {
548 enabled = skia_enable_fontmgr_win
549
Ben Wagner75626e42020-06-03 13:20:37 -0400550 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500551 sources = [
552 "src/fonts/SkFontMgr_indirect.cpp",
553 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500554 "src/ports/SkScalerContext_win_dw.cpp",
555 "src/ports/SkTypeface_win_dw.cpp",
556 ]
557}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400558optional("fontmgr_win_factory") {
559 enabled = skia_enable_fontmgr_win
560 deps = [ ":fontmgr_win" ]
561 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
562}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500563
564optional("fontmgr_win_gdi") {
565 enabled = skia_enable_fontmgr_win_gdi
566
Ben Wagner75626e42020-06-03 13:20:37 -0400567 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500568 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500569 libs = [ "Gdi32.lib" ]
570}
571
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700572if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400573 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400574 sources = [
John Stiles97d9e472021-10-20 12:40:03 -0400575 "src/sksl/lex/DFA.h",
576 "src/sksl/lex/DFAState.h",
577 "src/sksl/lex/LexUtil.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400578 "src/sksl/lex/Main.cpp",
579 "src/sksl/lex/NFA.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400580 "src/sksl/lex/NFA.h",
581 "src/sksl/lex/NFAState.h",
582 "src/sksl/lex/NFAtoDFA.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400583 "src/sksl/lex/RegexNode.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400584 "src/sksl/lex/RegexNode.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400585 "src/sksl/lex/RegexParser.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400586 "src/sksl/lex/RegexParser.h",
587 "src/sksl/lex/TransitionTable.cpp",
588 "src/sksl/lex/TransitionTable.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400589 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500590 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400591 }
592
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700593 action("run_sksllex") {
594 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500595 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
596 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700597
598 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
599 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
600 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500601 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700602 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
603 # confused due to the same file being named by two different paths
604 ]
605 sksllex_path = "$root_out_dir/"
606 sksllex_path += "sksllex"
607 if (host_os == "win") {
608 sksllex_path += ".exe"
609 }
610 args = [
611 rebase_path(sksllex_path),
612 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400613 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700614 rebase_path("src"),
615 ]
616 }
617} else {
618 group("run_sksllex") {
619 }
620}
621
Brian Osmaned5181e2021-07-01 13:54:20 -0400622# `Compile SkSL Tests` relies on skslc.
623if (skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400624 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500625 defines = [
626 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500627 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500628 "SK_ENABLE_SPIRV_VALIDATION",
629 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400630 sources = [
Michael Ludwigc1ed11d2021-08-24 11:49:55 -0400631 "src/core/SkBlockAllocator.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500632 "src/core/SkCpu.cpp",
633 "src/core/SkData.cpp",
634 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400635 "src/core/SkMalloc.cpp",
636 "src/core/SkMath.cpp",
John Stilesfbd9fae2021-06-22 09:34:14 -0400637 "src/core/SkMatrixInvert.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400638 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500639 "src/core/SkStream.cpp",
640 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500641 "src/core/SkStringUtils.cpp",
Ethan Nicholasd2e09602021-06-10 11:21:59 -0400642 "src/core/SkStringView.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400643 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500644 "src/core/SkUtils.cpp",
645 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400646 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500647 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400648 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500649 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400650 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500651 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400652 ]
Brian Osman47726a12020-12-17 16:02:08 -0500653 if (is_win) {
654 sources += [ "src/ports/SkOSFile_win.cpp" ]
655 } else {
656 sources += [ "src/ports/SkOSFile_posix.cpp" ]
657 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400658 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400659 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500660 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400661 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500662 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100663 "//third_party/externals/spirv-tools:spvtools",
664 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400665 ]
666 }
667
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400668 skslc_path = "$root_out_dir/"
669 if (host_toolchain != default_toolchain_name) {
670 skslc_path += "$host_toolchain/"
671 }
672 skslc_path += "skslc"
673 if (host_os == "win") {
674 skslc_path += ".exe"
675 }
676
Brian Osmandd496172020-08-08 08:17:18 -0400677 copy("sksl_pre_includes") {
678 sources = [
679 "src/sksl/sksl_frag.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400680 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500681 "src/sksl/sksl_public.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400682 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400683 "src/sksl/sksl_vert.sksl",
684 ]
685 outputs = [ "$root_out_dir/{{source_file_part}}" ]
686 }
687
688 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400689
690 dehydrate_sksl_outputs = []
691 foreach(src, dehydrate_sksl_sources) {
692 name = get_path_info(src, "name")
693
694 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
695 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
696 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
697 "src/sksl/generated/$name.dehydrated.sksl",
698 target_out_dir) ]
699 }
700
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400701 action("dehydrate_sksl") {
702 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400703 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400704 ":sksl_pre_includes",
705 ":skslc(//gn/toolchain:$host_toolchain)",
706 ]
707 sources = dehydrate_sksl_sources
708 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000709 args = [
710 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400711 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000712 ]
Brian Osmandd496172020-08-08 08:17:18 -0400713 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400714 }
John Stilesd836f842020-09-14 10:21:44 -0400715} else {
716 group("dehydrate_sksl") {
717 }
718}
719
John Stilesd836f842020-09-14 10:21:44 -0400720if (skia_compile_sksl_tests) {
721 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400722
John Stiles7e248712020-09-24 16:42:09 -0400723 template("compile_sksl") {
724 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
725 action("compile_sksl_${target_name}") {
726 script = "gn/compile_sksl_tests.py"
727 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400728 ":sksl_pre_includes",
729 ":skslc(//gn/toolchain:$host_toolchain)",
730 ]
John Stilesda57fc02021-01-22 11:54:30 -0500731 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400732 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500733 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500734 args = [
735 rebase_path(skslc_path),
736 invoker.lang,
737 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500738 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500739 ]
740
John Stilesbfc9be02021-01-22 11:55:48 -0500741 testsDir = get_path_info("tests", "abspath")
742 resourcesDir = get_path_info("resources", "abspath")
743
744 foreach(partialPath, invoker.sources) {
745 dst = testsDir + partialPath
746 src = resourcesDir + partialPath
747
748 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400749
750 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
751 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
752 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
753 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
754 nameTmp = get_path_info(dst, "name")
755 name = get_path_info(nameTmp, "name")
756 ext = get_path_info(nameTmp, "extension")
757 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500758 response_file_contents += rebase_path([
759 src,
760 dir,
761 ])
John Stilesda57fc02021-01-22 11:54:30 -0500762 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500763
John Stilesda57fc02021-01-22 11:54:30 -0500764 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400765 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400766 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500767 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500768 }
John Stilesbfc9be02021-01-22 11:55:48 -0500769 outputs +=
770 [ target_out_dir + "/" +
771 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400772 }
773 }
John Stiles7e248712020-09-24 16:42:09 -0400774 }
John Stilesd836f842020-09-14 10:21:44 -0400775 }
John Stiles7e248712020-09-24 16:42:09 -0400776 compile_sksl("glsl_tests") {
777 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500778 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400779 lang = "--glsl"
780 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400781 }
John Stiles7e248712020-09-24 16:42:09 -0400782 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400783 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500784 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400785 lang = "--glsl"
786 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400787 }
John Stilesaeae3a52020-09-25 13:35:58 -0400788 compile_sksl("metal_tests") {
789 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500790 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400791 lang = "--metal"
792 settings = "--settings"
793 }
Brian Osman977feec2020-12-22 11:28:59 -0500794 compile_sksl("skvm_tests") {
795 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500796 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500797 lang = "--skvm"
798 settings = "--settings"
799 }
Brian Osman62b039b2021-02-08 13:49:53 -0500800 compile_sksl("stage_tests") {
801 sources = sksl_stage_tests_sources
802 outExtensions = [ ".stage" ]
803 lang = "--stage"
804 settings = "--settings"
805 }
John Stilesdda1d312020-11-20 16:28:50 -0500806 compile_sksl("spirv_tests") {
807 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500808 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500809 lang = "--spirv"
810 settings = "--settings"
811 }
John Stilesd836f842020-09-14 10:21:44 -0400812} else {
John Stiles7e248712020-09-24 16:42:09 -0400813 group("compile_sksl_glsl_tests") {
814 }
815 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400816 }
John Stilesaeae3a52020-09-25 13:35:58 -0400817 group("compile_sksl_metal_tests") {
818 }
Brian Osman977feec2020-12-22 11:28:59 -0500819 group("compile_sksl_skvm_tests") {
820 }
John Stilesdda1d312020-11-20 16:28:50 -0500821 group("compile_sksl_spirv_tests") {
822 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400823}
824
Greg Daniel292bbb12021-11-03 16:25:41 -0400825optional("gpu_shared") {
826 enabled = skia_enable_gpu || skia_enable_graphite
827
828 sources = skia_shared_gpu_sources
829}
830
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500831optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700832 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400833 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400834 ":compile_sksl_glsl_nosettings_tests",
835 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400836 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500837 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500838 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400839 ":dehydrate_sksl",
Greg Daniel292bbb12021-11-03 16:25:41 -0400840 ":gpu_shared",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700841 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400842 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700843 if (skia_generate_workarounds) {
844 deps += [ ":workaround_list" ]
845 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800846 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600847 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400848 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700849
Greg Daniel292bbb12021-11-03 16:25:41 -0400850 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400851 if (!skia_enable_skgpu_v1) {
852 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400853 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400854
Mike Klein703cf5a2016-10-13 17:18:04 -0400855 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400856 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700857
John Rosascoa9b348f2019-11-08 13:18:15 -0800858 if (skia_use_gl) {
859 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400860 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500861 sources += [
862 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
863 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
864 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400865
866 # this lib is required to link against AHardwareBuffer
867 if (defined(ndk_api) && ndk_api >= 26) {
868 libs += [ "android" ]
869 }
870 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500871 sources += [
872 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
873 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
874 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400875 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400876 } else if (skia_use_webgl) {
877 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400878 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500879 sources += [
880 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
881 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
882 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400883 libs += [ "GL" ]
884 } else if (is_mac) {
885 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
886 } else if (is_ios) {
887 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800888 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400889 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
890 if (target_cpu != "arm64") {
891 libs += [ "OpenGL32.lib" ]
892 }
893 } else {
894 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
895 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800896 sources += skia_gl_gpu_sources
897 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400898
mtkleine9fb3d52016-09-20 15:11:46 -0700899 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400900 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000901 if (skia_use_vma) {
902 deps += [ "third_party/vulkanmemoryallocator" ]
903 }
mtkleine9fb3d52016-09-20 15:11:46 -0700904 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700905 if (skia_enable_vulkan_debug_layers) {
906 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
907 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800908 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800909 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700910 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
911 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400912 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700913 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800914 }
mtkleine9fb3d52016-09-20 15:11:46 -0700915 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400916
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400917 if (is_android && (skia_use_gl || skia_use_vulkan)) {
918 # this lib is required to link against AHardwareBuffer
919 if (defined(ndk_api) && ndk_api >= 26) {
920 libs += [ "android" ]
921 }
922 }
923
Stephen White0d70b712019-07-10 15:51:30 -0400924 if (skia_use_dawn) {
925 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400926 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700927 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400928 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700929 "//third_party/externals/dawn/src/dawn:dawn_proc",
930 "//third_party/externals/dawn/src/dawn:dawncpp",
931 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400932 ]
933 if (dawn_enable_d3d12) {
934 libs += [
935 "d3d12.lib",
936 "dxgi.lib",
937 "d3dcompiler.lib",
938 ]
939 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400940 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400941 }
942 }
943
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500944 if (skia_use_direct3d) {
945 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400946 deps += [
947 "//third_party/d3d12allocator",
948 "//third_party/spirv-cross:spirv_cross",
949 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500950 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500951 if (skia_enable_direct3d_debug_layer) {
952 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
953 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500954 libs += [
955 "d3d12.lib",
956 "dxgi.lib",
957 "d3dcompiler.lib",
958 ]
959 }
960
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400961 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400962 if (skia_use_metal) {
963 public_defines += [ "SK_METAL" ]
964 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400965 if (skia_enable_metal_debug_info) {
966 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
967 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400968 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400969 frameworks += [ "Foundation.framework" ]
Jim Van Vertha8d38072021-11-04 09:22:22 -0400970 if (is_ios) {
971 frameworks += [ "UIKit.framework" ]
972 }
Jim Van Verth36b86af2020-08-24 17:16:46 +0000973 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400974 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500975
Kevin Lubickf4def342018-10-04 12:52:50 -0400976 if (is_debug) {
977 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
978 }
mtklein06c35c02016-09-20 12:28:12 -0700979}
980
Leon Scroggins III41169202019-01-29 09:29:57 -0500981optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500982 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500983 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
984 if ("True" ==
985 exec_script("gn/checkpath.py",
986 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
987 "trim string")) {
988 public_defines = [ "SK_USE_LIBGIFCODEC" ]
989 public_include_dirs = [
990 ".",
991 skia_libgifcodec_path,
992 ]
993 include_dirs = public_include_dirs
994 import(_libgifcodec_gni_path)
995 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
996 ".",
997 skia_libgifcodec_path)
998 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500999}
1000
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001001optional("heif") {
1002 enabled = skia_use_libheif
1003 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1004
1005 deps = []
1006
Mike Kleina01c6b02020-04-01 13:47:34 -05001007 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001008}
1009
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001010optional("jpeg_decode") {
1011 enabled = skia_use_libjpeg_turbo_decode
1012 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1013
Mike Kleina01c6b02020-04-01 13:47:34 -05001014 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001015 sources = [
1016 "src/codec/SkJpegCodec.cpp",
1017 "src/codec/SkJpegDecoderMgr.cpp",
1018 "src/codec/SkJpegUtility.cpp",
1019 ]
1020}
1021
1022optional("jpeg_encode") {
1023 enabled = skia_use_libjpeg_turbo_encode
1024 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001025
Mike Kleina01c6b02020-04-01 13:47:34 -05001026 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1027 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001028 sources = [
mtklein63213812016-08-24 09:55:56 -07001029 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001030 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001031 ]
1032}
1033
Leon Scroggins III326b9892020-08-05 16:51:10 -04001034optional("ndk_images") {
1035 enabled = skia_use_ndk_images
1036 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1037 sources = [
1038 "src/ports/SkImageEncoder_NDK.cpp",
1039 "src/ports/SkImageGeneratorNDK.cpp",
1040 "src/ports/SkNDKConversions.cpp",
1041 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001042 libs = [ "jnigraphics" ]
1043}
1044
Robert Phillips755e00e2021-09-21 11:59:57 -04001045optional("graphite") {
Jim Van Verthff733b32021-09-24 16:46:36 -04001046 libs = []
1047 frameworks = []
1048
Robert Phillips755e00e2021-09-21 11:59:57 -04001049 enabled = skia_enable_graphite
Greg Daniel292bbb12021-11-03 16:25:41 -04001050 deps = [ ":gpu_shared" ]
Robert Phillips755e00e2021-09-21 11:59:57 -04001051 public_defines = [ "SK_GRAPHITE_ENABLED" ]
1052 public = skia_graphite_public
Greg Danielf0b283e2021-11-04 08:37:59 -04001053 sources = skia_graphite_sources
Jim Van Verthff733b32021-09-24 16:46:36 -04001054 if (skia_use_metal) {
1055 public_defines += [ "SK_METAL" ]
1056 sources += skia_graphite_mtl_sources
1057 if (skia_enable_metal_debug_info) {
1058 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
1059 }
1060 frameworks += [ "Metal.framework" ]
1061 frameworks += [ "Foundation.framework" ]
1062 }
Robert Phillips1a4080a2021-09-21 09:57:43 -04001063}
1064
mtklein63213812016-08-24 09:55:56 -07001065optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001066 enabled = skia_use_zlib && skia_enable_pdf
1067 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001068
Mike Kleina01c6b02020-04-01 13:47:34 -05001069 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001070 if (skia_use_libjpeg_turbo_decode) {
1071 deps += [ ":jpeg_decode" ]
1072 }
1073 if (skia_use_libjpeg_turbo_encode) {
1074 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001075 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001076 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001077 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001078 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001079 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1080 deps += [ "//third_party/harfbuzz" ]
1081 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1082 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001083 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001084 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001085 }
1086}
1087
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001088optional("xps") {
1089 enabled = skia_use_xps && is_win
1090 public_defines = [ "SK_SUPPORT_XPS" ]
1091 public = skia_xps_public
1092 sources = skia_xps_sources
1093}
1094
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001095optional("png_decode") {
1096 enabled = skia_use_libpng_decode
1097 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001098
Mike Kleina01c6b02020-04-01 13:47:34 -05001099 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001100 sources = [
1101 "src/codec/SkIcoCodec.cpp",
1102 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001103 ]
1104}
1105
1106optional("png_encode") {
1107 enabled = skia_use_libpng_encode
1108 public_defines = [ "SK_ENCODE_PNG" ]
1109
Mike Kleina01c6b02020-04-01 13:47:34 -05001110 deps = [ "//third_party/libpng" ]
1111 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001112}
1113
scroggof84ad642016-10-31 09:02:57 -07001114optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001115 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001116 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1117
1118 deps = [
1119 "//third_party/dng_sdk",
1120 "//third_party/libjpeg-turbo:libjpeg",
1121 "//third_party/piex",
1122 ]
1123
1124 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1125 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001126 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001127
Mike Kleina01c6b02020-04-01 13:47:34 -05001128 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001129}
1130
Mike Klein852a8cb2018-05-15 10:46:58 -04001131import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001132skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001133 cflags = []
1134 if (!is_win || is_clang) {
1135 cflags += [
1136 "-w",
1137 "-std=c11",
1138 ]
1139 }
1140
Mike Kleina01c6b02020-04-01 13:47:34 -05001141 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001142 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001143 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1144}
1145
mtklein3cc22182016-08-29 13:26:14 -07001146optional("typeface_freetype") {
1147 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001148
Mike Kleina01c6b02020-04-01 13:47:34 -05001149 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001150 sources = [
1151 "src/ports/SkFontHost_FreeType.cpp",
1152 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001153 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001154 ]
1155}
1156
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001157optional("webp_decode") {
1158 enabled = skia_use_libwebp_decode
1159 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001160
Mike Kleina01c6b02020-04-01 13:47:34 -05001161 deps = [ "//third_party/libwebp" ]
1162 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001163}
1164
1165optional("webp_encode") {
1166 enabled = skia_use_libwebp_encode
1167 public_defines = [ "SK_ENCODE_WEBP" ]
1168
Mike Kleina01c6b02020-04-01 13:47:34 -05001169 deps = [ "//third_party/libwebp" ]
1170 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001171}
1172
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001173optional("wuffs") {
1174 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001175 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001176
Mike Kleina01c6b02020-04-01 13:47:34 -05001177 deps = [ "//third_party/wuffs" ]
1178 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001179}
1180
mtklein63213812016-08-24 09:55:56 -07001181optional("xml") {
1182 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001183 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001184
Mike Kleina01c6b02020-04-01 13:47:34 -05001185 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001186 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001187 "src/svg/SkSVGCanvas.cpp",
1188 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001189 "src/xml/SkDOM.cpp",
1190 "src/xml/SkXMLParser.cpp",
1191 "src/xml/SkXMLWriter.cpp",
1192 ]
1193}
1194
Mike Klein613ad382019-06-06 11:42:02 -05001195optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001196 enabled = skia_enable_skvm_jit_when_possible
1197 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001198 if (skia_vtune_path != "") {
1199 public_defines += [ "SKVM_JIT_VTUNE" ]
1200 public_include_dirs = [ "$skia_vtune_path/include" ]
1201 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1202 }
Mike Klein613ad382019-06-06 11:42:02 -05001203}
1204
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001205if (skia_enable_gpu && skia_generate_workarounds) {
1206 action("workaround_list") {
1207 script = "tools/build_workaround_header.py"
1208
Mike Kleina01c6b02020-04-01 13:47:34 -05001209 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001210
Brian Osmaned5181e2021-07-01 13:54:20 -04001211 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1212 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001213 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001214 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001215
Mike Kleina01c6b02020-04-01 13:47:34 -05001216 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001217 args = [
1218 "--output-file",
1219 "$output_file",
1220 ]
1221
1222 foreach(file, inputs) {
1223 args += [ rebase_path(file, root_build_dir) ]
1224 }
1225 }
1226}
1227
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001228skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001229 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001230 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001231
Mike Klein607b0a72018-11-07 16:17:34 -05001232 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001233 ":fontmgr_FontConfigInterface",
1234 ":fontmgr_android",
1235 ":fontmgr_custom_directory",
1236 ":fontmgr_custom_embedded",
1237 ":fontmgr_custom_empty",
1238 ":fontmgr_fontconfig",
1239 ":fontmgr_fuchsia",
1240 ":fontmgr_mac_ct",
1241 ":fontmgr_win",
1242 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001243 ":gpu",
Robert Phillips755e00e2021-09-21 11:59:57 -04001244 ":graphite",
Mike Klein607b0a72018-11-07 16:17:34 -05001245 ":pdf",
1246 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001247 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001248 ]
1249
mtkleinc04ff472016-06-23 10:29:30 -07001250 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001251 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001252 ":arm64",
1253 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001254 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001255 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001256 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001257 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001258 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001259 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001260 ":jpeg_decode",
1261 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001262 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001263 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001264 ":png_decode",
1265 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001266 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001267 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001268 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001269 ":sse2",
1270 ":sse41",
1271 ":sse42",
1272 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001273 ":webp_decode",
1274 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001275 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001276 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001277 ]
1278
Hal Canaryc25f4e92019-02-26 11:54:25 -05001279 public = skia_core_public
1280 public += skia_utils_public
1281 public += skia_effects_public
1282 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001283
mtkleinc04ff472016-06-23 10:29:30 -07001284 sources = []
brettwb9447282016-09-01 14:24:39 -07001285 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001286 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001287 sources += skia_effects_sources
1288 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001289 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001290 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001291 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001292 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001293 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001294 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001295 "src/codec/SkBmpCodec.cpp",
1296 "src/codec/SkBmpMaskCodec.cpp",
1297 "src/codec/SkBmpRLECodec.cpp",
1298 "src/codec/SkBmpStandardCodec.cpp",
1299 "src/codec/SkCodec.cpp",
1300 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001301 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001302 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001303 "src/codec/SkMaskSwizzler.cpp",
1304 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001305 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001306 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001307 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001308 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001309 "src/codec/SkSwizzler.cpp",
1310 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001311 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001312 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001313 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001314 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001315 "src/ports/SkMemory_malloc.cpp",
1316 "src/ports/SkOSFile_stdio.cpp",
1317 "src/sfnt/SkOTTable_name.cpp",
1318 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001319 ]
brettwb9447282016-09-01 14:24:39 -07001320
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001321 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001322 libs = []
1323
Brian Osman946a4cb2021-07-12 17:02:21 -04001324 if (skia_enable_sksl) {
1325 deps += [ ":dehydrate_sksl" ]
1326 sources += skia_sksl_sources
1327 }
1328
mtkleinc04ff472016-06-23 10:29:30 -07001329 if (is_win) {
1330 sources += [
1331 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001332 "src/ports/SkImageEncoder_WIC.cpp",
1333 "src/ports/SkImageGeneratorWIC.cpp",
1334 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001335 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001336 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001337 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001338 "Ole32.lib",
1339 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001340 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001341
1342 if (!skia_enable_winuwp) {
1343 libs += [
1344 "FontSub.lib",
1345 "User32.lib",
1346 "Usp10.lib",
1347 ]
1348 }
mtkleinc04ff472016-06-23 10:29:30 -07001349 } else {
1350 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001351 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001352 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001353 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001354 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001355 }
1356
mtklein7d6fb2c2016-08-25 14:50:44 -07001357 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001358 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001359 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001360 deps += [ "//third_party/cpu-features" ]
1361 }
mtklein06c35c02016-09-20 12:28:12 -07001362 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001363 libs += [
1364 "EGL",
1365 "GLESv2",
1366 "log",
1367 ]
1368 }
1369
Kevin Lubick217056c2018-09-20 17:39:31 -04001370 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001371 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001372 if (skia_use_egl) {
1373 libs += [ "GLESv2" ]
1374 }
mtkleinc04ff472016-06-23 10:29:30 -07001375 }
1376
1377 if (is_mac) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001378 public += [ "include/ports/SkCFObject.h" ]
mtkleinc04ff472016-06-23 10:29:30 -07001379 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001380 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001381 "src/ports/SkImageEncoder_CG.cpp",
1382 "src/ports/SkImageGeneratorCG.cpp",
1383 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001384 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001385 "ApplicationServices.framework",
1386 "OpenGL.framework",
1387 ]
mtkleinc04ff472016-06-23 10:29:30 -07001388 }
abarth6fc8ff02016-07-15 15:15:15 -07001389
Mike Klein7d302882016-11-03 14:06:31 -04001390 if (is_ios) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001391 public += [ "include/ports/SkCFObject.h" ]
Mike Klein7d302882016-11-03 14:06:31 -04001392 sources += [
1393 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001394 "src/ports/SkImageEncoder_CG.cpp",
1395 "src/ports/SkImageGeneratorCG.cpp",
1396 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001397 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001398 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001399 "ImageIO.framework",
1400 "MobileCoreServices.framework",
1401 ]
1402 }
1403
abarth6fc8ff02016-07-15 15:15:15 -07001404 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001405 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001406 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001407
1408 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001409 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001410 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1411 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001412
1413 if (skia_include_multiframe_procs) {
1414 sources += [ "tools/SkSharingProc.cpp" ]
1415 }
mtkleinc04ff472016-06-23 10:29:30 -07001416}
1417
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001418# DebugCanvas used in experimental/wasm-skp-debugger
1419if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001420 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001421 public_configs = [ ":skia_public" ]
1422
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001423 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001424 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001425 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001426 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001427 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001428 "tools/debugger/DrawCommand.cpp",
1429 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001430 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001431 }
1432}
1433
Ben Wagner25eb5342021-03-22 14:07:15 -04001434skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001435 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001436 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001437 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001438
1439 deps = [
1440 ":arm64",
1441 ":armv7",
1442 ":avx",
1443 ":crc32",
1444 ":hsw",
1445 ":none",
1446 ":sse2",
1447 ":sse41",
1448 ":sse42",
1449 ":ssse3",
1450 ]
1451
Kevin Lubickcbcff382018-10-02 09:02:18 -04001452 sources = []
1453 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001454 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001455 sources += [
1456 "src/core/SkAnalyticEdge.cpp",
1457 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001458 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001459 "src/core/SkCubicMap.cpp",
1460 "src/core/SkEdge.cpp",
1461 "src/core/SkEdgeBuilder.cpp",
1462 "src/core/SkEdgeClipper.cpp",
1463 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001464 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001465 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001466 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001467 "src/core/SkMallocPixelRef.cpp",
1468 "src/core/SkMath.cpp",
1469 "src/core/SkMatrix.cpp",
1470 "src/core/SkOpts.cpp",
1471 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001472 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001473 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001474 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001475 "src/core/SkPathEffect.cpp",
1476 "src/core/SkPathMeasure.cpp",
1477 "src/core/SkPathRef.cpp",
1478 "src/core/SkPoint.cpp",
1479 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001480 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001481 "src/core/SkRect.cpp",
1482 "src/core/SkSemaphore.cpp",
1483 "src/core/SkStream.cpp",
1484 "src/core/SkString.cpp",
1485 "src/core/SkStringUtils.cpp",
1486 "src/core/SkStroke.cpp",
1487 "src/core/SkStrokeRec.cpp",
1488 "src/core/SkStrokerPriv.cpp",
1489 "src/core/SkThreadID.cpp",
1490 "src/core/SkUtils.cpp",
1491 "src/effects/SkDashPathEffect.cpp",
1492 "src/effects/SkTrimPathEffect.cpp",
1493 "src/ports/SkDebug_stdio.cpp",
1494 "src/ports/SkMemory_malloc.cpp",
1495 "src/utils/SkDashPath.cpp",
1496 "src/utils/SkParse.cpp",
1497 "src/utils/SkParsePath.cpp",
1498 "src/utils/SkUTF.cpp",
1499 ]
1500}
1501
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001502group("modules") {
1503 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001504 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001505 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001506 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001507 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001508 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001509 ]
1510}
1511
Julia Lavrova9f6e4632021-09-17 15:19:02 -04001512group("experimental") {
1513 deps = [ "experimental/sktext" ]
1514}
1515
Brian Osmancd28fa62020-07-07 16:01:26 -04001516config("our_vulkan_headers") {
1517 include_dirs = [ "include/third_party/vulkan" ]
1518}
1519
mtkleinc095df52016-08-24 12:23:52 -07001520# Targets guarded by skia_enable_tools may use //third_party freely.
1521if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001522 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001523 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001524 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001525 "include/c",
1526 "include/codec",
1527 "include/config",
1528 "include/core",
1529 "include/docs",
1530 "include/effects",
1531 "include/encode",
1532 "include/gpu",
1533 "include/pathops",
1534 "include/ports",
1535 "include/svg",
1536 "include/utils",
1537 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001538 "modules/particles/include",
1539 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001540 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001541 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001542 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001543 ]
1544
Mike Klein308b5ac2016-12-06 16:03:52 -05001545 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001546 skia_source_set("public") {
1547 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001548 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001549 }
1550
Mike Kleinc36dedf2016-11-18 09:35:28 -05001551 config("skia.h_config") {
1552 include_dirs = [ "$target_gen_dir" ]
1553 }
1554 action("skia.h") {
1555 public_configs = [ ":skia.h_config" ]
1556 skia_h = "$target_gen_dir/skia.h"
1557 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001558
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001559 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1560 [ rebase_path(skia_h, root_build_dir) ] +
1561 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001562 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001563 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001564 }
1565
Brian Osmanc9a42472018-05-31 13:17:12 -04001566 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001567 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001568 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001569 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001570 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001571 "tools/fiddle/draw.cpp",
1572 "tools/fiddle/fiddle_main.cpp",
1573 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001574
1575 if (skia_use_egl) {
1576 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001577 } else {
1578 sources += [ "tools/fiddle/null_context.cpp" ]
1579 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001580 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001581 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001582 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001583 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001584 ":skia",
1585 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001586 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001587 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001588 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001589 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001590 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001591 ]
1592 }
1593 }
1594
Mike Kleine5463e62020-06-11 13:53:53 -05001595 config("cpp14") {
1596 if (is_win) {
1597 cflags_cc = [ "/std:c++14" ]
1598 } else {
1599 cflags_cc = [ "-std=c++14" ]
1600 }
1601 }
1602
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001603 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001604 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001605 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001606 ":our_vulkan_headers",
1607 ":cpp14",
1608 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001609 if (defined(skia_header_target_default_configs)) {
1610 configs += skia_header_target_default_configs
1611 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001612 deps = [
1613 ":skia",
1614 ":skia.h",
1615 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001616 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001617 ]
Stephen White0d70b712019-07-10 15:51:30 -04001618
1619 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001620 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001621 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001622 }
1623
mtkleinc095df52016-08-24 12:23:52 -07001624 template("test_lib") {
1625 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001626 if (defined(invoker.public_defines)) {
1627 defines = invoker.public_defines
1628 }
mtklein25c81d42016-07-27 13:55:26 -07001629 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001630 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001631 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001632 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001633 public_configs = [
1634 ":" + target_name + "_config",
1635 ":skia_private",
1636 ]
1637
1638 if (!defined(deps)) {
1639 deps = []
1640 }
1641 deps += [ ":skia" ]
1642 testonly = true
1643 }
mtklein25c81d42016-07-27 13:55:26 -07001644 }
mtklein25c81d42016-07-27 13:55:26 -07001645
Mike Kleine6682eb2017-01-05 10:54:57 -05001646 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001647 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001648 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001649 forward_variables_from(invoker,
1650 "*",
1651 [
1652 "output_name",
1653 "visibility",
1654 "is_shared_library",
1655 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001656 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001657 extra_configs = [ ":skia_private" ]
1658 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1659 data_sources = [ "resources" ]
1660 if ("True" == exec_script("//gn/checkdir.py",
1661 [ rebase_path("skps", root_build_dir) ],
1662 "trim string")) {
1663 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001664 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001665 if ("True" == exec_script("//gn/checkdir.py",
1666 [ rebase_path("mskps", root_build_dir) ],
1667 "trim string")) {
1668 data_sources += [ "mskps" ]
1669 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001670 }
1671 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001672 # !is_ios
1673
1674 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001675 skia_shared_library("lib" + target_name) {
1676 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001677 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001678 if (!defined(configs)) {
1679 configs = []
1680 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001681 configs += [ ":skia_private" ]
1682 testonly = true
1683 }
1684 } else {
1685 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001686 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001687 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001688 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001689 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001690 if (!defined(configs)) {
1691 configs = []
1692 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001693 configs += [ ":skia_private" ]
1694 testonly = true
1695 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001696 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001697 if (is_android && skia_android_serial != "" && defined(_executable)) {
1698 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001699 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001700 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001701 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001702 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001703 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001704 args = [
1705 rebase_path("$root_build_dir/$_executable"),
1706 skia_android_serial,
1707 rebase_path(_stamp),
1708 ]
1709 testonly = true
1710 }
Mike Klein7d921032017-01-05 12:20:41 -05001711 }
1712 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001713 }
1714
mtkleinc095df52016-08-24 12:23:52 -07001715 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001716 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001717
Mike Klein9e25bb92019-04-29 09:46:36 -05001718 # Bots and even devs may not have Vulkan headers, so put
1719 # include/third_party/vulkan on our path so they're always available.
1720 all_dependent_configs = [ ":our_vulkan_headers" ]
1721
Mike Klein333fb452019-04-24 08:48:11 -05001722 defines = []
1723 if (skia_enable_discrete_gpu) {
1724 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1725 }
1726
Brian Osmanc9a42472018-05-31 13:17:12 -04001727 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001728 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001729 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001730 "tools/gpu/BackendSurfaceFactory.cpp",
1731 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001732 "tools/gpu/BackendTextureImageFactory.cpp",
1733 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001734 "tools/gpu/FlushFinishTracker.cpp",
1735 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001736 "tools/gpu/GrContextFactory.cpp",
1737 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001738 "tools/gpu/ManagedBackendTexture.cpp",
1739 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001740 "tools/gpu/MemoryCache.cpp",
1741 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001742 "tools/gpu/ProxyUtils.cpp",
1743 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001744 "tools/gpu/TestOps.cpp",
1745 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001746 "tools/gpu/YUVUtils.cpp",
1747 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001748 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1749 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001750 "tools/gpu/mock/MockTestContext.cpp",
1751 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001752
1753 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001754 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001755
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001756 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001757 sources +=
1758 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001759 if (is_ios) {
1760 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001761 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001762 } else if (is_mac) {
1763 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001764 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001765 if (skia_use_angle) {
1766 deps += [ "//third_party/angle2" ]
1767 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1768 }
Brian Salomon1171d312020-03-19 08:47:44 -04001769 }
1770
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001771 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1772 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001773 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001774 if (is_android || skia_use_egl) {
1775 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1776 libs += [ "EGL" ]
1777 } else if (is_linux) {
1778 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1779 libs += [
1780 "GLU",
1781 "GL",
1782 "X11",
1783 ]
1784 } else if (is_win) {
1785 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1786 libs += [ "Gdi32.lib" ]
1787 if (target_cpu != "arm64") {
1788 libs += [ "OpenGL32.lib" ]
1789 }
1790 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001791 }
Greg Daniel54200e42018-12-11 17:03:39 -05001792
Brian Osmanc9a42472018-05-31 13:17:12 -04001793 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001794 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001795 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001796 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1797 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001798 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001799 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001800 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1801 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001802 }
1803 if (skia_use_metal) {
1804 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001805 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001806 if (skia_use_direct3d) {
1807 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001808 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001809 }
Stephen White985741a2019-07-18 11:43:45 -04001810 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001811 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001812 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001813 if (is_clang) {
1814 cflags_cc = [ "-Wno-microsoft-cast" ]
1815 }
Stephen White985741a2019-07-18 11:43:45 -04001816 }
Robert Phillips72354b02021-07-06 13:43:56 -04001817 if (!skia_enable_skgpu_v1) {
1818 sources -= [ "tools/gpu/GrTest.cpp" ]
1819 sources -= [ "tools/gpu/TestOps.cpp" ]
1820 sources -= [ "tools/gpu/TestOps.h" ]
1821 }
Robert Phillipsd034db72021-09-29 14:29:32 -04001822 if (skia_enable_graphite) {
Robert Phillips091694f2021-09-30 11:41:16 -04001823 sources += [ "tools/graphite/ContextFactory.h" ]
1824 sources += [ "tools/graphite/ContextFactory.cpp" ]
Robert Phillipsd034db72021-09-29 14:29:32 -04001825 sources += [ "tools/graphite/GraphiteTestContext.h" ]
1826 sources += [ "tools/graphite/GraphiteTestContext.cpp" ]
1827 if (skia_use_metal) {
1828 sources += [ "tools/graphite/mtl/GraphiteMtlTestContext.h" ]
1829 sources += [ "tools/graphite/mtl/MtlTestContext.mm" ]
1830 }
1831 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001832
1833 if (is_fuchsia && using_fuchsia_sdk) {
1834 libs +=
1835 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1836 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001837 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001838
mtkleinc095df52016-08-24 12:23:52 -07001839 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001840 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001841 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001842
1843 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001844 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1845 deps = [ ":flags" ]
1846 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001847 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001848 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001849 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1850 deps = [ ":flags" ]
1851 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001852 }
1853 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001854 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1855 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001856 }
Kevin Lubick237dd2d2021-10-14 08:24:22 -04001857 test_lib("common_flags_fontmgr") {
1858 sources = [ "tools/flags/CommonFlagsFontMgr.cpp" ]
1859 deps = [ ":flags" ]
1860 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001861 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001862 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1863 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001864 }
mtklein25c81d42016-07-27 13:55:26 -07001865
Mike Klein499f0ac2019-03-25 13:00:12 -05001866 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001867 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001868 sources = [
1869 "tools/trace/ChromeTracingTracer.cpp",
1870 "tools/trace/ChromeTracingTracer.h",
1871 "tools/trace/EventTracingPriv.cpp",
1872 "tools/trace/EventTracingPriv.h",
1873 "tools/trace/SkDebugfTracer.cpp",
1874 "tools/trace/SkDebugfTracer.h",
1875 ]
1876 }
1877
mtkleinc095df52016-08-24 12:23:52 -07001878 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001879 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001880 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001881 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001882 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001883 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001884 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001885 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001886 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001887 "tools/MSKPPlayer.cpp",
1888 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001889 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001890 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001891 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001892 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001893 "tools/RuntimeBlendUtils.cpp",
1894 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001895 "tools/SkMetaData.cpp",
1896 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001897 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001898 "tools/SkSharingProc.h",
1899 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001900 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001901 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001902 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001903 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001904 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001905 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001906 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001907 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001908 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001909 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001910 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001911 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001912 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001913 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001914 "tools/fonts/TestEmptyTypeface.h",
1915 "tools/fonts/TestFontMgr.cpp",
1916 "tools/fonts/TestFontMgr.h",
1917 "tools/fonts/TestSVGTypeface.cpp",
1918 "tools/fonts/TestSVGTypeface.h",
1919 "tools/fonts/TestTypeface.cpp",
1920 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001921 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001922 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001923 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001924 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001925 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001926 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001927 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001928 if (target_cpu != "wasm") {
1929 sources += [ "tools/CrashHandler.cpp" ]
1930 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001931 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001932 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001933 if (is_ios) {
1934 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001935 sources += [ "tools/ios_utils.h" ]
1936 if (skia_use_metal) {
1937 sources += [ "tools/AutoreleasePool.mm" ]
1938 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001939 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001940 } else if (is_mac) {
1941 if (skia_use_metal) {
1942 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001943 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001944 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001945 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001946 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001947 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001948
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001949 defines = []
1950 if (skia_tools_require_resources) {
1951 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1952 }
mtkleinc095df52016-08-24 12:23:52 -07001953 deps = [
1954 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001955 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001956 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001957 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001958 }
mtklein25c81d42016-07-27 13:55:26 -07001959
Mike Kleine11e5c12019-04-24 12:46:06 -05001960 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001961 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001962 }
1963
Mike Klein6e744122016-10-27 12:21:40 -04001964 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001965 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001966 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001967 if (skia_use_gl) {
1968 sources += gl_gm_sources
1969 }
Robert Phillips024668c2021-07-01 12:12:52 -04001970 if (!skia_enable_skgpu_v1) {
1971 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04001972 }
mtkleinc095df52016-08-24 12:23:52 -07001973 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001974 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001975 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001976 ":skia",
1977 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001978 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001979 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001980 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001981 "modules/skparagraph",
1982 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001983 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001984 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001985 if (is_skia_dev_build) {
1986 sources += [ "gm/fiddle.cpp" ]
1987 deps += [ ":skia.h" ]
1988 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001989 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001990
1991 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001992 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001993 sources += [ "gm/video_decoder.cpp" ]
1994 }
mtkleinc095df52016-08-24 12:23:52 -07001995 }
mtklein25c81d42016-07-27 13:55:26 -07001996
Ben Wagnerbded42a2021-02-17 22:14:34 -05001997 test_lib("test") {
1998 sources = [
1999 "tests/Test.cpp",
2000 "tests/Test.h",
2001 "tests/TestUtils.cpp",
2002 "tests/TestUtils.h",
2003 ]
2004 deps = [
2005 ":flags",
2006 ":skia",
2007 ":tool_utils",
2008 ]
2009 public_deps = [
2010 ":gpu_tool_utils", # Test.h #includes headers from this target.
2011 ]
2012 }
2013
Mike Klein6e744122016-10-27 12:21:40 -04002014 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002015 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002016 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002017 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002018 if (skia_use_metal) {
2019 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002020 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002021 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002022 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002023 if (skia_use_gl) {
2024 sources += gl_tests_sources
2025 }
Robert Phillips30627592021-10-11 11:28:21 -04002026 if (skia_enable_graphite) {
2027 sources += graphite_tests_sources
2028 }
Robert Phillips024668c2021-07-01 12:12:52 -04002029 if (!skia_enable_skgpu_v1) {
2030 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04002031 }
mtkleinc095df52016-08-24 12:23:52 -07002032 deps = [
2033 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002034 ":fontmgr_android_tests",
2035 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002036 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002037 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002038 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002039 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002040 "experimental/skrive:tests",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002041 "experimental/sktext:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002042 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002043 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002044 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002045 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002046 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002047 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002048 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002049 "//third_party/zlib",
2050 ]
2051 }
mtklein2f3416d2016-08-02 16:02:05 -07002052
Mike Klein6e744122016-10-27 12:21:40 -04002053 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002054 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002055 sources = bench_sources
Chris Dalton2fceb212021-10-19 13:04:41 -06002056 if (skia_enable_graphite) {
2057 sources += graphite_bench_sources
2058 }
Robert Phillips04f22ea2021-07-22 15:11:03 -04002059 if (!skia_enable_skgpu_v1) {
2060 sources -= skgpu_v1_bench_sources
2061 }
mtkleinc095df52016-08-24 12:23:52 -07002062 deps = [
2063 ":flags",
2064 ":gm",
2065 ":gpu_tool_utils",
2066 ":skia",
2067 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002068 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002069 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002070 ]
2071 }
mtklein2b6870c2016-07-28 14:17:33 -07002072
Mike Reedd62d4062019-06-12 10:20:44 -04002073 test_lib("experimental_xform") {
2074 sources = [
2075 "experimental/xform/SkShape.cpp",
2076 "experimental/xform/SkXform.cpp",
2077 "experimental/xform/XContext.cpp",
2078 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002079 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002080 }
2081
Florin Malitabfe876a2018-09-02 12:33:59 -04002082 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002083 if (skia_enable_skottie) {
2084 test_app("skottie_tool") {
2085 deps = [ "modules/skottie:tool" ]
2086 }
Florin Malita79725d32018-06-05 16:16:57 -04002087 }
Florin Malitab3418102020-10-15 18:10:29 -04002088 test_app("svg_tool") {
2089 deps = [ "modules/svg:tool" ]
2090 }
Florin Malita79725d32018-06-05 16:16:57 -04002091 }
2092
Hal Canary5b39dc82019-04-17 13:29:46 -04002093 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002094 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2095 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002096 }
2097
Chris Dalton2b598902020-03-25 10:50:35 -06002098 import("gn/samples.gni")
2099 test_lib("samples") {
2100 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002101 if (!skia_enable_skgpu_v1) {
2102 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002103 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002104 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002105 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002106 ":flags",
2107 ":gpu_tool_utils",
2108 ":xml",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002109 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002110 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002111 "modules/skparagraph:samples",
2112 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002113 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002114 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002115 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002116 }
Kevin Lubick00398742020-10-08 10:05:07 -04002117 test_lib("hash_and_encode") {
2118 sources = [
2119 "tools/HashAndEncode.cpp",
2120 "tools/HashAndEncode.h",
2121 ]
2122 deps = [
2123 ":flags",
2124 ":skia",
2125 "//third_party/libpng",
2126 ]
2127 }
Chris Dalton2b598902020-03-25 10:50:35 -06002128 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002129 test_app("convert-to-nia") {
2130 sources = [ "tools/convert-to-nia.cpp" ]
2131 deps = [ ":skia" ]
2132 }
Mike Klein7af351a2018-07-27 09:54:43 -04002133 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002134 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002135 deps = [
2136 ":skcms",
2137 ":skia",
2138 ]
2139 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002140 test_app("fm") {
2141 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002142 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002143 "tools/fm/fm.cpp",
2144 ]
2145 deps = [
2146 ":common_flags_aa",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002147 ":common_flags_fontmgr",
Mike Klein735c7ba2019-03-25 12:57:58 -05002148 ":common_flags_gpu",
2149 ":flags",
2150 ":gm",
2151 ":gpu_tool_utils",
2152 ":hash_and_encode",
2153 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002154 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002155 ":tool_utils",
2156 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002157 "modules/skottie",
2158 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002159 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002160 ]
2161 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002162 test_app("dm") {
2163 sources = [
2164 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002165 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002166 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002167 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002168 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002169 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002170 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002171 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002172 ":common_flags_aa",
2173 ":common_flags_config",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002174 ":common_flags_fontmgr",
Mike Kleinc6142d82019-03-25 10:54:59 -05002175 ":common_flags_gpu",
2176 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002177 ":flags",
2178 ":gm",
2179 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002180 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002181 ":skia",
2182 ":tests",
2183 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002184 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002185 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002186 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002187 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002188 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002189 ]
2190 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002191 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002192 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002193 "experimental/sorttoy/Cmds.cpp",
2194 "experimental/sorttoy/Cmds.h",
2195 "experimental/sorttoy/Fake.cpp",
2196 "experimental/sorttoy/Fake.h",
2197 "experimental/sorttoy/SortKey.h",
2198 "experimental/sorttoy/sorttoy.cpp",
2199 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002200 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002201 deps = [
2202 ":flags",
2203 ":skia",
2204 ":tool_utils",
2205 ]
2206 }
Michael Ludwig30217952020-12-04 12:58:35 -05002207
2208 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002209 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002210 sources = [
2211 "tests/CanvasStateHelpers.cpp",
2212 "tests/CanvasStateHelpers.h",
2213 ]
2214 deps = [ ":skia" ]
2215 }
Brian Osman16adfa32016-10-18 14:42:44 -04002216 }
2217
Mike Kleina8a51ce2018-01-09 12:34:11 -05002218 if (!is_win) {
2219 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002220 sources = [ "tools/remote_demo.cpp" ]
2221 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002222 }
2223 }
2224
Hal Canarye107faa2019-10-23 12:52:33 -04002225 if (!is_win) {
2226 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002227 sources = [ "tools/blob_cache_sim.cpp" ]
2228 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002229 }
2230 }
2231
Mike Kleine6682eb2017-01-05 10:54:57 -05002232 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002233 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002234 deps = [
2235 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002236 ":common_flags_aa",
2237 ":common_flags_config",
2238 ":common_flags_gpu",
2239 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002240 ":flags",
2241 ":gm",
2242 ":gpu_tool_utils",
2243 ":skia",
2244 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002245 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002246 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002247 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002248 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002249 ]
mtklein2b6870c2016-07-28 14:17:33 -07002250 }
halcanary19a97202016-08-03 15:08:04 -07002251
Ravi Mistry10d36c52017-01-31 09:49:18 -05002252 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002253 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002254 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002255 deps = [
2256 ":flags",
2257 ":skia",
2258 ]
2259 }
2260
Mike Reedc0ee21f2019-05-28 16:11:03 -04002261 if (skia_use_ffmpeg) {
2262 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002263 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002264 deps = [
2265 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002266 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002267 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002268 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002269 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002270 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002271 ]
2272 }
2273 }
2274
Brian Osmanc9a42472018-05-31 13:17:12 -04002275 test_app("skpbench") {
Kevin Lubickf541ddf2021-10-13 16:02:56 -04002276 sources = [
2277 "bench/BigPath.cpp",
2278 "tools/skpbench/skpbench.cpp",
2279 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002280 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002281 ":common_flags_config",
2282 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002283 ":flags",
2284 ":gpu_tool_utils",
2285 ":skia",
2286 ":tool_utils",
2287 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002288 }
2289
Mike Kleine6682eb2017-01-05 10:54:57 -05002290 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002291 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002292 deps = [
2293 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002294 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002295 ]
halcanary3eee9d92016-09-10 07:01:53 -07002296 }
mtklein046cb562016-09-16 10:23:12 -07002297
Ben Wagner219f3622017-07-17 15:32:25 -04002298 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002299 sources = [ "tools/fonts/create_test_font.cpp" ]
2300 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002301 assert_no_deps = [
2302 # tool_utils requires the output of this app.
2303 ":tool_utils",
2304 ]
2305 }
2306
Florin Malita5d3ff432018-07-31 16:38:43 -04002307 if (skia_use_expat) {
2308 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002309 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002310 deps = [
2311 ":flags",
2312 ":skia",
2313 ":tool_utils",
2314 ]
2315 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002316 }
2317
Mike Kleine6682eb2017-01-05 10:54:57 -05002318 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002319 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002320 deps = [
2321 ":flags",
2322 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002323 ]
mtklein046cb562016-09-16 10:23:12 -07002324 }
mtkleinecbc5262016-09-22 11:51:24 -07002325
Brian Osman6788a542018-12-10 11:56:01 -05002326 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002327 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002328 sources = [
2329 "tools/skiaserve/Request.cpp",
2330 "tools/skiaserve/Response.cpp",
2331 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002332 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2333 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2334 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2335 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2336 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2337 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2338 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2339 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2340 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002341 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2342 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002343 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2344 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2345 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2346 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2347 ]
2348 deps = [
2349 ":flags",
2350 ":gpu_tool_utils",
2351 ":skia",
2352 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002353 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002354 ]
Mike Klein7d302882016-11-03 14:06:31 -04002355 }
mtkleinecbc5262016-09-22 11:51:24 -07002356 }
kjlubick14f984b2016-10-03 11:49:45 -07002357
Mike Kleine6682eb2017-01-05 10:54:57 -05002358 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002359 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002360 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002361 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002362 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002363 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002364 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002365 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002366 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002367 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002368 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002369 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002370 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002371 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002372 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002373 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002374 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002375 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002376 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002377 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002378 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002379 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2380 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002381 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002382 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002383 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002384 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002385 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2386 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002387 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002388 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2389 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002390 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002391 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002392 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002393 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002394 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002395 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002396 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002397 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002398 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002399 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002400 "tools/debugger/DrawCommand.cpp",
2401 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002402 ]
2403 deps = [
2404 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002405 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002406 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002407 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002408 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002409 ]
kjlubick14f984b2016-10-03 11:49:45 -07002410 }
Mike Klein38312422016-10-05 15:41:01 -04002411
Mike Kleine6682eb2017-01-05 10:54:57 -05002412 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002413 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002414 rebase_path("tests/skia_test.cpp"),
2415 rebase_path("tests/Test.cpp"),
2416 ]
caryclark9feb6322016-10-25 08:58:26 -07002417 deps = [
2418 ":flags",
2419 ":gpu_tool_utils",
2420 ":skia",
2421 ":tool_utils",
2422 ]
caryclark9feb6322016-10-25 08:58:26 -07002423 }
2424
Mike Kleine6682eb2017-01-05 10:54:57 -05002425 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002426 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002427 deps = [
2428 ":flags",
2429 ":skia",
2430 ]
Mike Klein38312422016-10-05 15:41:01 -04002431 }
bungemanfe917272016-10-13 17:36:40 -04002432
Mike Kleine6682eb2017-01-05 10:54:57 -05002433 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002434 sources = [
2435 "tools/skdiff/skdiff.cpp",
2436 "tools/skdiff/skdiff_html.cpp",
2437 "tools/skdiff/skdiff_main.cpp",
2438 "tools/skdiff/skdiff_utils.cpp",
2439 ]
2440 deps = [
2441 ":skia",
2442 ":tool_utils",
2443 ]
bungemanfe917272016-10-13 17:36:40 -04002444 }
halcanarya73d76a2016-10-17 13:19:02 -07002445
Mike Kleine6682eb2017-01-05 10:54:57 -05002446 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002447 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002448 deps = [
2449 ":skia",
2450 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002451 ]
halcanarya73d76a2016-10-17 13:19:02 -07002452 }
Brian Osman16adfa32016-10-18 14:42:44 -04002453
Brian Osmanc9a42472018-05-31 13:17:12 -04002454 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002455 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002456 check_includes = false
2457 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002458 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002459 defines =
2460 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002461 sources = [
2462 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002463 "tools/skqp/src/skqp.cpp",
2464 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002465 ]
2466 deps = [
2467 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002468 ":skia",
2469 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002470 ":tool_utils",
2471 ]
2472 }
2473 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002474 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002475 include_dirs = [ "//" ]
2476 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002477 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002478 }
2479 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002480 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002481 deps = [
2482 ":gm",
2483 ":skia",
2484 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002485 ]
2486 }
2487 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002488 if (is_fuchsia) {
2489 # Build a package repository for skqp on Fuchsia.
2490 group("skqp_repo") {
2491 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002492 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002493 }
2494 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002495 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002496 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002497 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002498 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002499 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002500 deps = [
2501 ":skia",
2502 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002503 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002504 ]
2505 libs = [ "android" ]
2506 }
2507 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002508 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002509 test_app("skottie_android") {
2510 is_shared_library = true
2511
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002512 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002513 libs = []
2514
Stan Iliev93151722018-08-02 11:10:52 -04002515 deps = [
2516 ":skia",
2517 "modules/skottie",
2518 ]
2519 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002520
2521 test_app("androidkit") {
2522 is_shared_library = true
2523
Florin Malita2a650cc2021-04-12 13:38:44 -04002524 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002525 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002526 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002527 "modules/androidkit/src/ColorFilters.cpp",
Jorge Betancourt151a6f32021-09-07 16:50:21 -04002528 "modules/androidkit/src/Font.cpp",
Jorge Betancourtaa9656d2021-10-14 14:02:08 -04002529 "modules/androidkit/src/FontChainAdapter.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002530 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002531 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002532 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002533 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002534 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002535 "modules/androidkit/src/Path.cpp",
2536 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002537 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2538 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002539 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002540 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002541 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002542 "modules/androidkit/src/SurfaceThread.cpp",
2543 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002544 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002545 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002546 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002547 libs = [
2548 "android",
2549 "jnigraphics",
2550 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002551
Florin Malita2cc65382021-04-26 21:59:35 -04002552 deps = [
2553 ":sk_app",
2554 ":skia",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002555 "experimental/sktext:sktext",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002556 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002557 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002558 }
Stan Iliev93151722018-08-02 11:10:52 -04002559 }
Hal Canary75427132017-10-11 16:00:31 -04002560
Hal Canarya9de7602018-01-19 13:08:23 -05002561 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002562 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002563 deps = [
2564 ":gm",
2565 ":skia",
2566 ]
2567 }
2568 test_app("list_gpu_unit_tests") {
2569 sources = [
2570 "dm/DMGpuTestProcs.cpp",
2571 "tools/list_gpu_unit_tests.cpp",
2572 ]
2573 deps = [
2574 ":skia",
2575 ":tests",
2576 ]
2577 }
2578
Brian Osmanc9a42472018-05-31 13:17:12 -04002579 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002580 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002581 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002582 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002583 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002584 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002585 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002586 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002587 "tools/sk_app/CommandSet.h",
2588 "tools/sk_app/DisplayParams.h",
2589 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002590 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002591 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002592 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002593 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002594 ]
2595 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002596 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002597
2598 if (is_android) {
2599 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002600 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002601 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002602 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002603 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002604 "tools/sk_app/android/main_android.cpp",
2605 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002606 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002607 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002608 libs += [ "android" ]
2609 } else if (is_linux) {
2610 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002611 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002612 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002613 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002614 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002615 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002616 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002617 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002618 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002619 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002620 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002621 "X11",
2622 ]
2623 } else if (is_win) {
2624 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002625 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002626 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002627 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002628 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002629 "tools/sk_app/win/main_win.cpp",
2630 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002631 } else if (is_mac) {
2632 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002633 "tools/sk_app/mac/WindowContextFactory_mac.h",
2634 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002635 "tools/sk_app/mac/Window_mac.mm",
2636 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002637 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002638 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002639 "QuartzCore.framework",
2640 "Cocoa.framework",
2641 "Foundation.framework",
2642 ]
2643 } else if (is_ios) {
2644 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002645 "tools/sk_app/ios/WindowContextFactory_ios.h",
2646 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002647 "tools/sk_app/ios/Window_ios.mm",
2648 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002649 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002650 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002651 }
2652
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002653 if (skia_use_gl) {
2654 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002655 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002656 if (is_android) {
2657 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2658 } else if (is_linux) {
2659 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2660 } else if (is_win) {
2661 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2662 if (skia_use_angle) {
2663 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2664 }
2665 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002666 sources += [
2667 "tools/sk_app/mac/GLWindowContext_mac.mm",
2668 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2669 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002670 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002671 sources += [
2672 "tools/sk_app/ios/GLWindowContext_ios.mm",
2673 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2674 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002675 }
2676 }
2677
Brian Osmanc9a42472018-05-31 13:17:12 -04002678 if (skia_use_vulkan) {
2679 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002680 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002681 if (is_android) {
2682 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2683 } else if (is_linux) {
2684 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2685 libs += [ "X11-xcb" ]
2686 } else if (is_win) {
2687 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2688 }
2689 }
2690
Jim Van Verthbe39f712019-02-08 15:36:14 -05002691 if (skia_use_metal) {
2692 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002693 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002694 if (skia_enable_graphite) {
2695 sources += [ "tools/sk_app/GraphiteMetalWindowContext.mm" ]
2696 sources += [ "tools/sk_app/GraphiteMetalWindowContext.h" ]
2697 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002698 if (is_mac) {
2699 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002700 if (skia_enable_graphite) {
2701 sources += [ "tools/sk_app/mac/GraphiteMetalWindowContext_mac.mm" ]
2702 }
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002703 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002704 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002705 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002706 }
2707
Jim Van Verth682a2f42020-05-13 16:54:09 -04002708 if (skia_use_direct3d) {
2709 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2710 }
2711
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002712 if (skia_use_dawn) {
2713 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002714 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002715 if (is_linux) {
2716 if (dawn_enable_vulkan) {
2717 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2718 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2719 libs += [ "X11-xcb" ]
2720 }
2721 } else if (is_win) {
2722 if (dawn_enable_d3d12) {
2723 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2724 }
2725 } else if (is_mac) {
2726 if (dawn_enable_metal) {
2727 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2728 }
2729 }
2730 }
2731
Mike Kleina01c6b02020-04-01 13:47:34 -05002732 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002733 if (is_android) {
2734 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002735 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002736 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002737 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002738 }
Brian Osman16adfa32016-10-18 14:42:44 -04002739 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002740
Hal Canary87515122019-03-15 14:22:51 -04002741 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2742 test_app("fiddle_examples") {
2743 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002744 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002745 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002746 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002747 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002748 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002749 cflags = [
2750 "/wd4756", # Overflow in constant arithmetic
2751 "/wd4305", # truncation from 'double' to 'float'
2752 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002753 }
Hal Canary87515122019-03-15 14:22:51 -04002754 deps = [
2755 ":skia",
2756 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002757 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002758 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002759 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002760 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002761 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002762 ]
2763 }
2764 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002765
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002766 # sk_app can work without GL but viewer always runs raster through a GL window context.
2767 if (skia_use_gl) {
2768 test_app("viewer") {
2769 is_shared_library = is_android
2770 sources = [
2771 "tools/viewer/AnimTimer.h",
2772 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002773 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002774 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002775 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002776 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002777 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002778 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002779 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002780 "tools/viewer/MSKPSlide.cpp",
2781 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002782 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002783 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002784 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002785 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002786 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002787 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002788 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002789 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002790 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002791 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002792 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002793 "tools/viewer/SkottieSlide.h",
2794 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002795 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002796 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002797 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002798 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002799 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002800 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002801 "tools/viewer/TouchGesture.cpp",
2802 "tools/viewer/TouchGesture.h",
2803 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002804 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002805 ]
2806 libs = []
2807
2808 deps = [
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002809 ":common_flags_fontmgr",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002810 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002811 ":flags",
2812 ":gm",
2813 ":gpu_tool_utils",
2814 ":samples",
2815 ":sk_app",
2816 ":skia",
2817 ":tool_utils",
2818 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002819 "experimental/skrive",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002820 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002821 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002822 "modules/particles",
2823 "modules/skottie",
2824 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002825 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002826 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002827 "//third_party/imgui",
2828 ]
2829 if (skia_use_experimental_xform) {
2830 deps += [ ":experimental_xform" ]
2831 sources += [ "gm/xform.cpp" ]
2832 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002833 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002834 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002835 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002836
Corentin Wallez89d6e792021-03-08 15:25:34 +01002837 #spvtools depends on this but doesn't deps it in.
2838 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002839 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002840 }
Mike Reedd62d4062019-06-12 10:20:44 -04002841 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002842 }
2843
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002844 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002845 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002846 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002847 libs = []
2848
Brian Osmaneff04b52017-11-21 13:18:02 -05002849 deps = [
2850 ":flags",
2851 ":gpu_tool_utils",
2852 ":sk_app",
2853 ":skia",
2854 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002855 ]
2856 }
2857 }
2858
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002859 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2860 action_foreach("generate_mocs") {
2861 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002862 sources = [ "tools/mdbviz/MainWindow.h" ]
2863 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002864 args = [
2865 "$skia_qt_path" + "/bin/moc",
2866 "{{source}}",
2867 "-o",
2868 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2869 ]
2870 }
2871 action_foreach("generate_resources") {
2872 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002873 sources = [ "tools/mdbviz/resources.qrc" ]
2874 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002875 args = [
2876 "$skia_qt_path" + "/bin/rcc",
2877 "{{source}}",
2878 "-o",
2879 "gen/mdbviz/{{source_name_part}}_res.cpp",
2880 ]
2881 }
2882 test_app("mdbviz") {
2883 if (is_win) {
2884 # on Windows we need to disable some exception handling warnings due to the Qt headers
2885 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2886 }
2887 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002888 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002889 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002890 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002891 "tools/debugger/DrawCommand.cpp",
2892 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002893 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002894 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002895 "tools/mdbviz/main.cpp",
2896
2897 # generated files
2898 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2899 "$target_gen_dir/mdbviz/resources_res.cpp",
2900 ]
2901 lib_dirs = [ "$skia_qt_path/lib" ]
2902 libs = [
2903 "Qt5Core.lib",
2904 "Qt5Gui.lib",
2905 "Qt5Widgets.lib",
2906 ]
2907 include_dirs = [
2908 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002909 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002910 "$skia_qt_path/include/QtWidgets",
2911 ]
2912 deps = [
2913 ":generate_mocs",
2914 ":generate_resources",
2915 ":skia",
2916 ]
2917 }
2918 }
2919
Mike Kleine459afd2017-03-03 09:21:30 -05002920 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002921 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002922 sources = [ "$ndk/$ndk_gdbserver" ]
2923 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002924 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002925 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002926
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002927 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002928 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002929 deps = [
2930 ":skia",
2931 "modules/particles",
2932 ]
2933 }
2934
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002935 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002936 test_app("editor") {
2937 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002938 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002939 }
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002940 test_app("text_editor") {
2941 is_shared_library = is_android
2942 deps = [ "experimental/sktext:text_editor" ]
2943 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002944 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002945
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002946 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002947 sources = [ "tools/image_diff_metric.cpp" ]
2948 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002949 }
Chris Dalton2b598902020-03-25 10:50:35 -06002950
2951 group("modules_testonly") {
2952 testonly = true
2953 deps = []
2954 if (target_cpu == "wasm") {
2955 deps += [ "modules/canvaskit:viewer_wasm" ]
2956 }
2957 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002958
2959 if (skia_build_fuzzers) {
2960 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002961 skia_executable(target_name) {
2962 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002963 check_includes = false
2964 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002965 if (!defined(configs)) {
2966 configs = []
2967 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002968 configs += [ ":skia_private" ]
2969 sources += [
2970 "fuzz/Fuzz.cpp",
2971 "fuzz/FuzzCommon.cpp",
2972 ]
2973 deps += [
2974 ":flags",
2975 ":gpu_tool_utils",
2976 ":skia",
2977 ]
2978 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2979 if (skia_use_libfuzzer_defaults) {
2980 cflags = [ "-fsanitize=fuzzer" ]
2981 ldflags = [ "-fsanitize=fuzzer" ]
2982 }
2983 testonly = true
2984 }
2985 }
2986
2987 libfuzzer_app("region_deserialize") {
2988 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2989 deps = []
2990 }
2991
2992 libfuzzer_app("image_filter_deserialize") {
2993 include_dirs = [
2994 "tools",
2995 "tools/fonts",
2996 ]
2997 sources = [
2998 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2999 "tools/Resources.cpp",
3000 "tools/fonts/TestFontMgr.cpp",
3001 "tools/fonts/TestSVGTypeface.cpp",
3002 "tools/fonts/TestTypeface.cpp",
3003 ]
Florin Malitab3418102020-10-15 18:10:29 -04003004 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003005 }
3006
3007 libfuzzer_app("region_set_path") {
3008 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
3009 deps = []
3010 }
3011
3012 libfuzzer_app("textblob_deserialize") {
3013 include_dirs = [
3014 "tools",
3015 "tools/fonts",
3016 ]
3017 sources = [
3018 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
3019 "tools/Resources.cpp",
3020 "tools/fonts/TestFontMgr.cpp",
3021 "tools/fonts/TestSVGTypeface.cpp",
3022 "tools/fonts/TestTypeface.cpp",
3023 ]
Florin Malitab3418102020-10-15 18:10:29 -04003024 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003025 }
3026
3027 libfuzzer_app("path_deserialize") {
3028 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
3029 deps = []
3030 }
3031
3032 libfuzzer_app("image_decode") {
3033 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3034 deps = []
3035 }
3036
3037 libfuzzer_app("animated_image_decode") {
3038 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3039 deps = []
3040 }
3041
3042 libfuzzer_app("api_create_ddl") {
3043 include_dirs = [
3044 "include",
3045 "include/gpu",
3046 ]
3047 sources = [
3048 "fuzz/FuzzCreateDDL.cpp",
3049 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3050 "tools/Resources.cpp",
3051 "tools/UrlDataManager.cpp",
3052 "tools/debugger/DebugCanvas.cpp",
3053 "tools/debugger/DebugLayerManager.cpp",
3054 "tools/debugger/DrawCommand.cpp",
3055 "tools/debugger/JsonWriteBuffer.cpp",
3056 "tools/fonts/TestFontMgr.cpp",
3057 "tools/fonts/TestSVGTypeface.cpp",
3058 "tools/fonts/TestTypeface.cpp",
3059 ]
3060 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003061 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003062 "//third_party/libpng",
3063 ]
3064 }
3065
3066 libfuzzer_app("api_draw_functions") {
3067 sources = [
3068 "fuzz/FuzzDrawFunctions.cpp",
3069 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3070 ]
3071 deps = []
3072 }
3073
Adlai Hollerccb68662021-02-25 10:28:44 -05003074 libfuzzer_app("api_ddl_threading") {
3075 sources = [
3076 "fuzz/FuzzDDLThreading.cpp",
3077 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3078 ]
3079 deps = []
3080 }
3081
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003082 libfuzzer_app("api_gradients") {
3083 sources = [
3084 "fuzz/FuzzGradients.cpp",
3085 "fuzz/oss_fuzz/FuzzGradients.cpp",
3086 ]
3087 deps = []
3088 }
3089
3090 libfuzzer_app("api_image_filter") {
3091 include_dirs = [
3092 "tools",
3093 "tools/debugger",
3094 ]
3095 sources = [
3096 "fuzz/FuzzCanvas.cpp",
3097 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3098 "tools/UrlDataManager.cpp",
3099 "tools/debugger/DebugCanvas.cpp",
3100 "tools/debugger/DebugLayerManager.cpp",
3101 "tools/debugger/DrawCommand.cpp",
3102 "tools/debugger/JsonWriteBuffer.cpp",
3103 ]
3104 deps = [ "//third_party/libpng" ]
3105 }
3106
3107 libfuzzer_app("api_path_measure") {
3108 sources = [
3109 "fuzz/FuzzPathMeasure.cpp",
3110 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3111 ]
3112 deps = []
3113 }
3114
3115 libfuzzer_app("api_pathop") {
3116 sources = [
3117 "fuzz/FuzzPathop.cpp",
3118 "fuzz/oss_fuzz/FuzzPathop.cpp",
3119 ]
3120 deps = []
3121 }
3122
Robert Phillips98b066c2021-04-22 10:51:58 -04003123 libfuzzer_app("api_triangulation") {
3124 sources = [
3125 "fuzz/FuzzTriangulation.cpp",
3126 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3127 ]
3128 deps = []
3129 }
3130
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003131 libfuzzer_app("api_raster_n32_canvas") {
3132 include_dirs = [
3133 "tools",
3134 "tools/debugger",
3135 "tools/fonts",
3136 ]
3137 sources = [
3138 "fuzz/FuzzCanvas.cpp",
3139 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3140 "tools/Resources.cpp",
3141 "tools/UrlDataManager.cpp",
3142 "tools/debugger/DebugCanvas.cpp",
3143 "tools/debugger/DebugLayerManager.cpp",
3144 "tools/debugger/DrawCommand.cpp",
3145 "tools/debugger/JsonWriteBuffer.cpp",
3146 "tools/fonts/TestFontMgr.cpp",
3147 "tools/fonts/TestSVGTypeface.cpp",
3148 "tools/fonts/TestTypeface.cpp",
3149 ]
3150 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003151 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003152 "//third_party/libpng",
3153 ]
3154 }
3155
Kevin Lubick7845b972021-03-29 08:07:32 -04003156 libfuzzer_app("api_regionop") {
3157 sources = [
3158 "fuzz/FuzzRegionOp.cpp",
3159 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3160 ]
3161 deps = []
3162 }
3163
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003164 if (skia_use_gl) {
3165 libfuzzer_app("api_mock_gpu_canvas") {
3166 include_dirs = [
3167 "tools",
3168 "tools/debugger",
3169 "tools/fonts",
3170 ]
3171 sources = [
3172 "fuzz/FuzzCanvas.cpp",
3173 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3174 "tools/LsanSuppressions.cpp",
3175 "tools/Resources.cpp",
3176 "tools/UrlDataManager.cpp",
3177 "tools/debugger/DebugCanvas.cpp",
3178 "tools/debugger/DebugLayerManager.cpp",
3179 "tools/debugger/DrawCommand.cpp",
3180 "tools/debugger/JsonWriteBuffer.cpp",
3181 "tools/fonts/TestFontMgr.cpp",
3182 "tools/fonts/TestSVGTypeface.cpp",
3183 "tools/fonts/TestTypeface.cpp",
3184 ]
3185 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003186 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003187 "//third_party/libpng",
3188 ]
3189 }
3190 }
3191
3192 libfuzzer_app("api_null_canvas") {
3193 include_dirs = [
3194 "tools",
3195 "tools/debugger",
3196 "tools/fonts",
3197 ]
3198 sources = [
3199 "fuzz/FuzzCanvas.cpp",
3200 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3201 "tools/Resources.cpp",
3202 "tools/UrlDataManager.cpp",
3203 "tools/debugger/DebugCanvas.cpp",
3204 "tools/debugger/DebugLayerManager.cpp",
3205 "tools/debugger/DrawCommand.cpp",
3206 "tools/debugger/JsonWriteBuffer.cpp",
3207 "tools/fonts/TestFontMgr.cpp",
3208 "tools/fonts/TestSVGTypeface.cpp",
3209 "tools/fonts/TestTypeface.cpp",
3210 ]
3211 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003212 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003213 "//third_party/libpng",
3214 ]
3215 }
3216
Weston Tracey1a771fe2021-02-04 11:09:59 -05003217 libfuzzer_app("api_skparagraph") {
3218 sources = [
3219 "fuzz/FuzzSkParagraph.cpp",
3220 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3221 "tools/Resources.cpp",
3222 ]
3223 deps = [ "modules/skparagraph" ]
3224 }
3225
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003226 libfuzzer_app("api_svg_canvas") {
3227 include_dirs = [
3228 "include",
3229 "include/svg",
3230 ]
3231 sources = [
3232 "fuzz/FuzzCanvas.cpp",
3233 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3234 "tools/Resources.cpp",
3235 "tools/UrlDataManager.cpp",
3236 "tools/debugger/DebugCanvas.cpp",
3237 "tools/debugger/DebugLayerManager.cpp",
3238 "tools/debugger/DrawCommand.cpp",
3239 "tools/debugger/JsonWriteBuffer.cpp",
3240 "tools/fonts/TestFontMgr.cpp",
3241 "tools/fonts/TestSVGTypeface.cpp",
3242 "tools/fonts/TestTypeface.cpp",
3243 ]
3244 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003245 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003246 "//third_party/libpng",
3247 ]
3248 }
3249
3250 libfuzzer_app("png_encoder") {
3251 sources = [
3252 "fuzz/FuzzEncoders.cpp",
3253 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3254 ]
3255 deps = []
3256 }
3257
3258 libfuzzer_app("jpeg_encoder") {
3259 sources = [
3260 "fuzz/FuzzEncoders.cpp",
3261 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3262 ]
3263 deps = []
3264 }
3265
3266 libfuzzer_app("webp_encoder") {
3267 sources = [
3268 "fuzz/FuzzEncoders.cpp",
3269 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3270 ]
3271 deps = []
3272 }
3273
3274 libfuzzer_app("skottie_json") {
3275 sources = [
3276 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3277 "tools/Resources.cpp",
3278 "tools/fonts/TestFontMgr.cpp",
3279 "tools/fonts/TestSVGTypeface.cpp",
3280 "tools/fonts/TestTypeface.cpp",
3281 ]
3282 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003283 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003284 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003285 ]
3286 }
3287
3288 libfuzzer_app("skjson") {
3289 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3290 deps = []
3291 }
3292
3293 libfuzzer_app("api_polyutils") {
3294 sources = [
3295 "fuzz/FuzzPolyUtils.cpp",
3296 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3297 ]
3298 deps = [ ":skia" ]
3299 }
3300
3301 libfuzzer_app("android_codec") {
3302 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3303 deps = []
3304 }
3305
3306 libfuzzer_app("image_decode_incremental") {
3307 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3308 deps = []
3309 }
3310
3311 libfuzzer_app("sksl2glsl") {
3312 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3313 deps = []
3314 }
3315
3316 libfuzzer_app("sksl2spirv") {
3317 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3318 deps = []
3319 }
3320
3321 libfuzzer_app("sksl2metal") {
3322 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3323 deps = []
3324 }
3325
3326 libfuzzer_app("sksl2pipeline") {
3327 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3328 deps = []
3329 }
3330
3331 libfuzzer_app("skdescriptor_deserialize") {
3332 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3333 deps = []
3334 }
3335
3336 libfuzzer_app("svg_dom") {
3337 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003338 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003339 }
3340
3341 libfuzzer_app("skruntimeeffect") {
3342 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3343 deps = []
3344 }
3345
3346 libfuzzer_app("skp") {
3347 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3348 deps = []
3349 }
3350 }
mtklein25c81d42016-07-27 13:55:26 -07003351}
Hal Canary932a2c02019-09-17 10:43:18 -04003352
Greg Daniel391f9412021-10-28 12:44:43 -04003353if (is_ios && skia_use_metal && skia_enable_gpu &&
3354 !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003355 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003356 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003357 }
Hal Canary27483062019-12-06 15:01:08 -05003358}
3359
Hal Canary60ff6512020-01-21 12:39:20 -05003360if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003361 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003362 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003363 }
3364}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003365
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003366skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003367 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3368 include_dirs = [ "." ]
3369 deps = [ ":skia" ]
3370}