blob: 3237af733133f9202b0d34dba4caee36f3ece6fc [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_v2) {
Robert Phillips7cef6782021-07-01 13:21:37 -040061 defines += [ "SK_GPU_V2=1" ]
Robert Phillips7b931f82021-06-09 14:04:05 -040062 }
Robert Phillips024668c2021-07-01 12:12:52 -040063 if (!skia_enable_skgpu_v1) {
Robert Phillips7cef6782021-07-01 13:21:37 -040064 defines += [ "SK_GPU_V1=0" ]
Robert Phillips3b97aa22021-05-03 11:42:40 -040065 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070066
67 # Some older versions of the Clang toolchain change the visibility of
68 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
69 # toolchains suppress the use of this macro till toolchain updates are made.
70 if (is_mac || is_ios) {
71 if (skia_enable_api_available_macro) {
72 defines += [ "SK_ENABLE_API_AVAILABLE" ]
73 } else {
74 cflags_objcc += [ "-Wno-unguarded-availability" ]
75 }
76 }
mtkleinc04ff472016-06-23 10:29:30 -070077}
78
79# Skia internal APIs, used by Skia itself and a few test tools.
80config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060081 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070082
Mike Reeda9e241d2017-05-03 10:52:00 -040083 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050084 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070085 defines += [
86 "SK_GAMMA_EXPONENT=1.4",
87 "SK_GAMMA_CONTRAST=0.0",
88 ]
89 }
Mike Kleinb45d8622019-04-24 14:04:01 -050090 if (is_skia_dev_build) {
91 defines += [
92 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
93 "GR_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 = [
575 "src/sksl/lex/Main.cpp",
576 "src/sksl/lex/NFA.cpp",
577 "src/sksl/lex/RegexNode.cpp",
578 "src/sksl/lex/RegexParser.cpp",
579 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500580 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400581 }
582
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700583 action("run_sksllex") {
584 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500585 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
586 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700587
588 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
589 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
590 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500591 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700592 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
593 # confused due to the same file being named by two different paths
594 ]
595 sksllex_path = "$root_out_dir/"
596 sksllex_path += "sksllex"
597 if (host_os == "win") {
598 sksllex_path += ".exe"
599 }
600 args = [
601 rebase_path(sksllex_path),
602 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400603 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700604 rebase_path("src"),
605 ]
606 }
607} else {
608 group("run_sksllex") {
609 }
610}
611
Brian Osmaned5181e2021-07-01 13:54:20 -0400612# `Compile SkSL Tests` relies on skslc.
613if (skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400614 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500615 defines = [
616 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500617 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500618 "SK_ENABLE_SPIRV_VALIDATION",
619 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400620 sources = [
Michael Ludwigc1ed11d2021-08-24 11:49:55 -0400621 "src/core/SkBlockAllocator.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500622 "src/core/SkCpu.cpp",
623 "src/core/SkData.cpp",
624 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400625 "src/core/SkMalloc.cpp",
626 "src/core/SkMath.cpp",
John Stilesfbd9fae2021-06-22 09:34:14 -0400627 "src/core/SkMatrixInvert.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400628 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500629 "src/core/SkStream.cpp",
630 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500631 "src/core/SkStringUtils.cpp",
Ethan Nicholasd2e09602021-06-10 11:21:59 -0400632 "src/core/SkStringView.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400633 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500634 "src/core/SkUtils.cpp",
635 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400636 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500637 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400638 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500639 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400640 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500641 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400642 ]
Brian Osman47726a12020-12-17 16:02:08 -0500643 if (is_win) {
644 sources += [ "src/ports/SkOSFile_win.cpp" ]
645 } else {
646 sources += [ "src/ports/SkOSFile_posix.cpp" ]
647 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400648 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400649 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500650 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400651 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500652 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100653 "//third_party/externals/spirv-tools:spvtools",
654 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400655 ]
656 }
657
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400658 skslc_path = "$root_out_dir/"
659 if (host_toolchain != default_toolchain_name) {
660 skslc_path += "$host_toolchain/"
661 }
662 skslc_path += "skslc"
663 if (host_os == "win") {
664 skslc_path += ".exe"
665 }
666
Brian Osmandd496172020-08-08 08:17:18 -0400667 copy("sksl_pre_includes") {
668 sources = [
669 "src/sksl/sksl_frag.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400670 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500671 "src/sksl/sksl_public.sksl",
John Stilesf7f36ae2021-06-08 14:06:22 -0400672 "src/sksl/sksl_rt_blend.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400673 "src/sksl/sksl_rt_colorfilter.sksl",
674 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400675 "src/sksl/sksl_vert.sksl",
676 ]
677 outputs = [ "$root_out_dir/{{source_file_part}}" ]
678 }
679
680 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400681
682 dehydrate_sksl_outputs = []
683 foreach(src, dehydrate_sksl_sources) {
684 name = get_path_info(src, "name")
685
686 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
687 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
688 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
689 "src/sksl/generated/$name.dehydrated.sksl",
690 target_out_dir) ]
691 }
692
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400693 action("dehydrate_sksl") {
694 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400695 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400696 ":sksl_pre_includes",
697 ":skslc(//gn/toolchain:$host_toolchain)",
698 ]
699 sources = dehydrate_sksl_sources
700 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000701 args = [
702 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400703 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000704 ]
Brian Osmandd496172020-08-08 08:17:18 -0400705 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400706 }
John Stilesd836f842020-09-14 10:21:44 -0400707} else {
708 group("dehydrate_sksl") {
709 }
710}
711
John Stilesd836f842020-09-14 10:21:44 -0400712if (skia_compile_sksl_tests) {
713 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400714
John Stiles7e248712020-09-24 16:42:09 -0400715 template("compile_sksl") {
716 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
717 action("compile_sksl_${target_name}") {
718 script = "gn/compile_sksl_tests.py"
719 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400720 ":sksl_pre_includes",
721 ":skslc(//gn/toolchain:$host_toolchain)",
722 ]
John Stilesda57fc02021-01-22 11:54:30 -0500723 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400724 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500725 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500726 args = [
727 rebase_path(skslc_path),
728 invoker.lang,
729 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500730 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500731 ]
732
John Stilesbfc9be02021-01-22 11:55:48 -0500733 testsDir = get_path_info("tests", "abspath")
734 resourcesDir = get_path_info("resources", "abspath")
735
736 foreach(partialPath, invoker.sources) {
737 dst = testsDir + partialPath
738 src = resourcesDir + partialPath
739
740 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400741
742 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
743 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
744 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
745 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
746 nameTmp = get_path_info(dst, "name")
747 name = get_path_info(nameTmp, "name")
748 ext = get_path_info(nameTmp, "extension")
749 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500750 response_file_contents += rebase_path([
751 src,
752 dir,
753 ])
John Stilesda57fc02021-01-22 11:54:30 -0500754 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500755
John Stilesda57fc02021-01-22 11:54:30 -0500756 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400757 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400758 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500759 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500760 }
John Stilesbfc9be02021-01-22 11:55:48 -0500761 outputs +=
762 [ target_out_dir + "/" +
763 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400764 }
765 }
John Stiles7e248712020-09-24 16:42:09 -0400766 }
John Stilesd836f842020-09-14 10:21:44 -0400767 }
John Stiles7e248712020-09-24 16:42:09 -0400768 compile_sksl("glsl_tests") {
769 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500770 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400771 lang = "--glsl"
772 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400773 }
John Stiles7e248712020-09-24 16:42:09 -0400774 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400775 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500776 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400777 lang = "--glsl"
778 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400779 }
John Stilesaeae3a52020-09-25 13:35:58 -0400780 compile_sksl("metal_tests") {
781 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500782 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400783 lang = "--metal"
784 settings = "--settings"
785 }
Brian Osman977feec2020-12-22 11:28:59 -0500786 compile_sksl("skvm_tests") {
787 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500788 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500789 lang = "--skvm"
790 settings = "--settings"
791 }
Brian Osman62b039b2021-02-08 13:49:53 -0500792 compile_sksl("stage_tests") {
793 sources = sksl_stage_tests_sources
794 outExtensions = [ ".stage" ]
795 lang = "--stage"
796 settings = "--settings"
797 }
John Stilesdda1d312020-11-20 16:28:50 -0500798 compile_sksl("spirv_tests") {
799 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500800 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500801 lang = "--spirv"
802 settings = "--settings"
803 }
John Stilesd836f842020-09-14 10:21:44 -0400804} else {
John Stiles7e248712020-09-24 16:42:09 -0400805 group("compile_sksl_glsl_tests") {
806 }
807 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400808 }
John Stilesaeae3a52020-09-25 13:35:58 -0400809 group("compile_sksl_metal_tests") {
810 }
Brian Osman977feec2020-12-22 11:28:59 -0500811 group("compile_sksl_skvm_tests") {
812 }
John Stilesdda1d312020-11-20 16:28:50 -0500813 group("compile_sksl_spirv_tests") {
814 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400815}
816
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500817optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700818 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400819 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400820 ":compile_sksl_glsl_nosettings_tests",
821 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400822 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500823 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500824 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400825 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700826 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400827 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700828 if (skia_generate_workarounds) {
829 deps += [ ":workaround_list" ]
830 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800831 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600832 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400833 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700834
Brian Osmaned5181e2021-07-01 13:54:20 -0400835 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400836 if (skia_enable_skgpu_v2) {
837 sources += skia_skgpu_v2_sources
Robert Phillips3b97aa22021-05-03 11:42:40 -0400838 }
Robert Phillips024668c2021-07-01 12:12:52 -0400839 if (!skia_enable_skgpu_v1) {
840 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400841 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400842
Mike Klein703cf5a2016-10-13 17:18:04 -0400843 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400844 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700845
John Rosascoa9b348f2019-11-08 13:18:15 -0800846 if (skia_use_gl) {
847 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400848 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500849 sources += [
850 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
851 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
852 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400853
854 # this lib is required to link against AHardwareBuffer
855 if (defined(ndk_api) && ndk_api >= 26) {
856 libs += [ "android" ]
857 }
858 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500859 sources += [
860 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
861 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
862 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400863 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400864 } else if (skia_use_webgl) {
865 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400866 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500867 sources += [
868 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
869 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
870 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400871 libs += [ "GL" ]
872 } else if (is_mac) {
873 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
874 } else if (is_ios) {
875 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800876 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400877 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
878 if (target_cpu != "arm64") {
879 libs += [ "OpenGL32.lib" ]
880 }
881 } else {
882 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
883 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800884 sources += skia_gl_gpu_sources
885 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400886
mtkleine9fb3d52016-09-20 15:11:46 -0700887 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400888 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000889 if (skia_use_vma) {
890 deps += [ "third_party/vulkanmemoryallocator" ]
891 }
mtkleine9fb3d52016-09-20 15:11:46 -0700892 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700893 if (skia_enable_vulkan_debug_layers) {
894 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
895 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800896 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800897 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700898 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
899 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400900 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700901 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800902 }
mtkleine9fb3d52016-09-20 15:11:46 -0700903 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400904
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400905 if (is_android && (skia_use_gl || skia_use_vulkan)) {
906 # this lib is required to link against AHardwareBuffer
907 if (defined(ndk_api) && ndk_api >= 26) {
908 libs += [ "android" ]
909 }
910 }
911
Stephen White0d70b712019-07-10 15:51:30 -0400912 if (skia_use_dawn) {
913 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400914 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700915 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400916 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700917 "//third_party/externals/dawn/src/dawn:dawn_proc",
918 "//third_party/externals/dawn/src/dawn:dawncpp",
919 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400920 ]
921 if (dawn_enable_d3d12) {
922 libs += [
923 "d3d12.lib",
924 "dxgi.lib",
925 "d3dcompiler.lib",
926 ]
927 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400928 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400929 }
930 }
931
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500932 if (skia_use_direct3d) {
933 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400934 deps += [
935 "//third_party/d3d12allocator",
936 "//third_party/spirv-cross:spirv_cross",
937 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500938 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500939 if (skia_enable_direct3d_debug_layer) {
940 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
941 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500942 libs += [
943 "d3d12.lib",
944 "dxgi.lib",
945 "d3dcompiler.lib",
946 ]
947 }
948
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400949 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400950 if (skia_use_metal) {
951 public_defines += [ "SK_METAL" ]
952 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400953 if (skia_enable_metal_debug_info) {
954 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
955 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400956 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400957 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000958 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400959 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500960
Kevin Lubickf4def342018-10-04 12:52:50 -0400961 if (is_debug) {
962 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
963 }
mtklein06c35c02016-09-20 12:28:12 -0700964}
965
Leon Scroggins III41169202019-01-29 09:29:57 -0500966optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500967 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500968 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
969 if ("True" ==
970 exec_script("gn/checkpath.py",
971 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
972 "trim string")) {
973 public_defines = [ "SK_USE_LIBGIFCODEC" ]
974 public_include_dirs = [
975 ".",
976 skia_libgifcodec_path,
977 ]
978 include_dirs = public_include_dirs
979 import(_libgifcodec_gni_path)
980 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
981 ".",
982 skia_libgifcodec_path)
983 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500984}
985
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400986optional("heif") {
987 enabled = skia_use_libheif
988 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
989
990 deps = []
991
Mike Kleina01c6b02020-04-01 13:47:34 -0500992 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400993}
994
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400995optional("jpeg_decode") {
996 enabled = skia_use_libjpeg_turbo_decode
997 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
998
Mike Kleina01c6b02020-04-01 13:47:34 -0500999 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001000 sources = [
1001 "src/codec/SkJpegCodec.cpp",
1002 "src/codec/SkJpegDecoderMgr.cpp",
1003 "src/codec/SkJpegUtility.cpp",
1004 ]
1005}
1006
1007optional("jpeg_encode") {
1008 enabled = skia_use_libjpeg_turbo_encode
1009 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001010
Mike Kleina01c6b02020-04-01 13:47:34 -05001011 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1012 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001013 sources = [
mtklein63213812016-08-24 09:55:56 -07001014 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001015 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001016 ]
1017}
1018
Leon Scroggins III326b9892020-08-05 16:51:10 -04001019optional("ndk_images") {
1020 enabled = skia_use_ndk_images
1021 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1022 sources = [
1023 "src/ports/SkImageEncoder_NDK.cpp",
1024 "src/ports/SkImageGeneratorNDK.cpp",
1025 "src/ports/SkNDKConversions.cpp",
1026 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001027 libs = [ "jnigraphics" ]
1028}
1029
mtklein63213812016-08-24 09:55:56 -07001030optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001031 enabled = skia_use_zlib && skia_enable_pdf
1032 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001033
Mike Kleina01c6b02020-04-01 13:47:34 -05001034 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001035 if (skia_use_libjpeg_turbo_decode) {
1036 deps += [ ":jpeg_decode" ]
1037 }
1038 if (skia_use_libjpeg_turbo_encode) {
1039 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001040 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001041 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001042 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001043 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001044 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1045 deps += [ "//third_party/harfbuzz" ]
1046 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1047 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001048 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001049 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001050 }
1051}
1052
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001053optional("xps") {
1054 enabled = skia_use_xps && is_win
1055 public_defines = [ "SK_SUPPORT_XPS" ]
1056 public = skia_xps_public
1057 sources = skia_xps_sources
1058}
1059
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001060optional("png_decode") {
1061 enabled = skia_use_libpng_decode
1062 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001063
Mike Kleina01c6b02020-04-01 13:47:34 -05001064 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001065 sources = [
1066 "src/codec/SkIcoCodec.cpp",
1067 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001068 ]
1069}
1070
1071optional("png_encode") {
1072 enabled = skia_use_libpng_encode
1073 public_defines = [ "SK_ENCODE_PNG" ]
1074
Mike Kleina01c6b02020-04-01 13:47:34 -05001075 deps = [ "//third_party/libpng" ]
1076 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001077}
1078
scroggof84ad642016-10-31 09:02:57 -07001079optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001080 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001081 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1082
1083 deps = [
1084 "//third_party/dng_sdk",
1085 "//third_party/libjpeg-turbo:libjpeg",
1086 "//third_party/piex",
1087 ]
1088
1089 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1090 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001091 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001092
Mike Kleina01c6b02020-04-01 13:47:34 -05001093 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001094}
1095
Mike Klein852a8cb2018-05-15 10:46:58 -04001096import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001097skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001098 cflags = []
1099 if (!is_win || is_clang) {
1100 cflags += [
1101 "-w",
1102 "-std=c11",
1103 ]
1104 }
1105
Mike Kleina01c6b02020-04-01 13:47:34 -05001106 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001107 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001108 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1109}
1110
mtklein3cc22182016-08-29 13:26:14 -07001111optional("typeface_freetype") {
1112 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001113
Mike Kleina01c6b02020-04-01 13:47:34 -05001114 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001115 sources = [
1116 "src/ports/SkFontHost_FreeType.cpp",
1117 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001118 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001119 ]
1120}
1121
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001122optional("webp_decode") {
1123 enabled = skia_use_libwebp_decode
1124 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001125
Mike Kleina01c6b02020-04-01 13:47:34 -05001126 deps = [ "//third_party/libwebp" ]
1127 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001128}
1129
1130optional("webp_encode") {
1131 enabled = skia_use_libwebp_encode
1132 public_defines = [ "SK_ENCODE_WEBP" ]
1133
Mike Kleina01c6b02020-04-01 13:47:34 -05001134 deps = [ "//third_party/libwebp" ]
1135 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001136}
1137
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001138optional("wuffs") {
1139 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001140 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001141
Mike Kleina01c6b02020-04-01 13:47:34 -05001142 deps = [ "//third_party/wuffs" ]
1143 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001144}
1145
mtklein63213812016-08-24 09:55:56 -07001146optional("xml") {
1147 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001148 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001149
Mike Kleina01c6b02020-04-01 13:47:34 -05001150 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001151 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001152 "src/svg/SkSVGCanvas.cpp",
1153 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001154 "src/xml/SkDOM.cpp",
1155 "src/xml/SkXMLParser.cpp",
1156 "src/xml/SkXMLWriter.cpp",
1157 ]
1158}
1159
Mike Klein613ad382019-06-06 11:42:02 -05001160optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001161 enabled = skia_enable_skvm_jit_when_possible
1162 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001163 if (skia_vtune_path != "") {
1164 public_defines += [ "SKVM_JIT_VTUNE" ]
1165 public_include_dirs = [ "$skia_vtune_path/include" ]
1166 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1167 }
Mike Klein613ad382019-06-06 11:42:02 -05001168}
1169
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001170if (skia_enable_gpu && skia_generate_workarounds) {
1171 action("workaround_list") {
1172 script = "tools/build_workaround_header.py"
1173
Mike Kleina01c6b02020-04-01 13:47:34 -05001174 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001175
Brian Osmaned5181e2021-07-01 13:54:20 -04001176 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1177 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001178 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001179 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001180
Mike Kleina01c6b02020-04-01 13:47:34 -05001181 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001182 args = [
1183 "--output-file",
1184 "$output_file",
1185 ]
1186
1187 foreach(file, inputs) {
1188 args += [ rebase_path(file, root_build_dir) ]
1189 }
1190 }
1191}
1192
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001193skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001194 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001195 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001196
Mike Klein607b0a72018-11-07 16:17:34 -05001197 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001198 ":fontmgr_FontConfigInterface",
1199 ":fontmgr_android",
1200 ":fontmgr_custom_directory",
1201 ":fontmgr_custom_embedded",
1202 ":fontmgr_custom_empty",
1203 ":fontmgr_fontconfig",
1204 ":fontmgr_fuchsia",
1205 ":fontmgr_mac_ct",
1206 ":fontmgr_win",
1207 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001208 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001209 ":pdf",
1210 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001211 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001212 ]
1213
mtkleinc04ff472016-06-23 10:29:30 -07001214 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001215 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001216 ":arm64",
1217 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001218 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001219 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001220 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001221 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001222 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001223 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001224 ":jpeg_decode",
1225 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001226 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001227 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001228 ":png_decode",
1229 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001230 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001231 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001232 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001233 ":sse2",
1234 ":sse41",
1235 ":sse42",
1236 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001237 ":webp_decode",
1238 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001239 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001240 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001241 ]
1242
Hal Canaryc25f4e92019-02-26 11:54:25 -05001243 public = skia_core_public
1244 public += skia_utils_public
1245 public += skia_effects_public
1246 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001247
mtkleinc04ff472016-06-23 10:29:30 -07001248 sources = []
brettwb9447282016-09-01 14:24:39 -07001249 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001250 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001251 sources += skia_effects_sources
1252 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001253 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001254 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001255 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001256 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001257 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001258 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001259 "src/codec/SkBmpCodec.cpp",
1260 "src/codec/SkBmpMaskCodec.cpp",
1261 "src/codec/SkBmpRLECodec.cpp",
1262 "src/codec/SkBmpStandardCodec.cpp",
1263 "src/codec/SkCodec.cpp",
1264 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001265 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001266 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001267 "src/codec/SkMaskSwizzler.cpp",
1268 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001269 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001270 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001271 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001272 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001273 "src/codec/SkSwizzler.cpp",
1274 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001275 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001276 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001277 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001278 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001279 "src/ports/SkMemory_malloc.cpp",
1280 "src/ports/SkOSFile_stdio.cpp",
1281 "src/sfnt/SkOTTable_name.cpp",
1282 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001283 ]
brettwb9447282016-09-01 14:24:39 -07001284
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001285 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001286 libs = []
1287
Brian Osman946a4cb2021-07-12 17:02:21 -04001288 if (skia_enable_sksl) {
1289 deps += [ ":dehydrate_sksl" ]
1290 sources += skia_sksl_sources
1291 }
1292
mtkleinc04ff472016-06-23 10:29:30 -07001293 if (is_win) {
1294 sources += [
1295 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001296 "src/ports/SkImageEncoder_WIC.cpp",
1297 "src/ports/SkImageGeneratorWIC.cpp",
1298 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001299 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001300 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001301 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001302 "Ole32.lib",
1303 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001304 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001305
1306 if (!skia_enable_winuwp) {
1307 libs += [
1308 "FontSub.lib",
1309 "User32.lib",
1310 "Usp10.lib",
1311 ]
1312 }
mtkleinc04ff472016-06-23 10:29:30 -07001313 } else {
1314 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001315 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001316 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001317 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001318 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001319 }
1320
mtklein7d6fb2c2016-08-25 14:50:44 -07001321 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001322 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001323 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001324 deps += [ "//third_party/cpu-features" ]
1325 }
mtklein06c35c02016-09-20 12:28:12 -07001326 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001327 libs += [
1328 "EGL",
1329 "GLESv2",
1330 "log",
1331 ]
1332 }
1333
Kevin Lubick217056c2018-09-20 17:39:31 -04001334 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001335 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001336 if (skia_use_egl) {
1337 libs += [ "GLESv2" ]
1338 }
mtkleinc04ff472016-06-23 10:29:30 -07001339 }
1340
1341 if (is_mac) {
1342 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001343 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001344 "src/ports/SkImageEncoder_CG.cpp",
1345 "src/ports/SkImageGeneratorCG.cpp",
1346 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001347 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001348 "ApplicationServices.framework",
1349 "OpenGL.framework",
1350 ]
mtkleinc04ff472016-06-23 10:29:30 -07001351 }
abarth6fc8ff02016-07-15 15:15:15 -07001352
Mike Klein7d302882016-11-03 14:06:31 -04001353 if (is_ios) {
1354 sources += [
1355 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001356 "src/ports/SkImageEncoder_CG.cpp",
1357 "src/ports/SkImageGeneratorCG.cpp",
1358 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001359 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001360 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001361 "ImageIO.framework",
1362 "MobileCoreServices.framework",
1363 ]
1364 }
1365
abarth6fc8ff02016-07-15 15:15:15 -07001366 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001367 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001368 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001369
1370 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001371 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001372 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1373 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001374
1375 if (skia_include_multiframe_procs) {
1376 sources += [ "tools/SkSharingProc.cpp" ]
1377 }
mtkleinc04ff472016-06-23 10:29:30 -07001378}
1379
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001380# DebugCanvas used in experimental/wasm-skp-debugger
1381if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001382 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001383 public_configs = [ ":skia_public" ]
1384
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001385 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001386 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001387 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001388 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001389 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001390 "tools/debugger/DrawCommand.cpp",
1391 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001392 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001393 }
1394}
1395
Ben Wagner25eb5342021-03-22 14:07:15 -04001396skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001397 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001398 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001399 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001400
1401 deps = [
1402 ":arm64",
1403 ":armv7",
1404 ":avx",
1405 ":crc32",
1406 ":hsw",
1407 ":none",
1408 ":sse2",
1409 ":sse41",
1410 ":sse42",
1411 ":ssse3",
1412 ]
1413
Kevin Lubickcbcff382018-10-02 09:02:18 -04001414 sources = []
1415 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001416 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001417 sources += [
1418 "src/core/SkAnalyticEdge.cpp",
1419 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001420 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001421 "src/core/SkCubicMap.cpp",
1422 "src/core/SkEdge.cpp",
1423 "src/core/SkEdgeBuilder.cpp",
1424 "src/core/SkEdgeClipper.cpp",
1425 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001426 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001427 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001428 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001429 "src/core/SkMallocPixelRef.cpp",
1430 "src/core/SkMath.cpp",
1431 "src/core/SkMatrix.cpp",
1432 "src/core/SkOpts.cpp",
1433 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001434 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001435 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001436 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001437 "src/core/SkPathEffect.cpp",
1438 "src/core/SkPathMeasure.cpp",
1439 "src/core/SkPathRef.cpp",
1440 "src/core/SkPoint.cpp",
1441 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001442 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001443 "src/core/SkRect.cpp",
1444 "src/core/SkSemaphore.cpp",
1445 "src/core/SkStream.cpp",
1446 "src/core/SkString.cpp",
1447 "src/core/SkStringUtils.cpp",
1448 "src/core/SkStroke.cpp",
1449 "src/core/SkStrokeRec.cpp",
1450 "src/core/SkStrokerPriv.cpp",
1451 "src/core/SkThreadID.cpp",
1452 "src/core/SkUtils.cpp",
1453 "src/effects/SkDashPathEffect.cpp",
1454 "src/effects/SkTrimPathEffect.cpp",
1455 "src/ports/SkDebug_stdio.cpp",
1456 "src/ports/SkMemory_malloc.cpp",
1457 "src/utils/SkDashPath.cpp",
1458 "src/utils/SkParse.cpp",
1459 "src/utils/SkParsePath.cpp",
1460 "src/utils/SkUTF.cpp",
1461 ]
1462}
1463
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001464group("modules") {
1465 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001466 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001467 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001468 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001469 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001470 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001471 ]
1472}
1473
Julia Lavrova159fd842021-02-24 12:15:08 -05001474group("experimental") {
1475 deps = [ "experimental/sktext" ]
1476}
1477
Brian Osmancd28fa62020-07-07 16:01:26 -04001478config("our_vulkan_headers") {
1479 include_dirs = [ "include/third_party/vulkan" ]
1480}
1481
mtkleinc095df52016-08-24 12:23:52 -07001482# Targets guarded by skia_enable_tools may use //third_party freely.
1483if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001484 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001485 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001486 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001487 "include/c",
1488 "include/codec",
1489 "include/config",
1490 "include/core",
1491 "include/docs",
1492 "include/effects",
1493 "include/encode",
1494 "include/gpu",
1495 "include/pathops",
1496 "include/ports",
1497 "include/svg",
1498 "include/utils",
1499 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001500 "modules/particles/include",
1501 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001502 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001503 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001504 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001505 ]
1506
Mike Klein308b5ac2016-12-06 16:03:52 -05001507 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001508 skia_source_set("public") {
1509 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001510 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001511 }
1512
Mike Kleinc36dedf2016-11-18 09:35:28 -05001513 config("skia.h_config") {
1514 include_dirs = [ "$target_gen_dir" ]
1515 }
1516 action("skia.h") {
1517 public_configs = [ ":skia.h_config" ]
1518 skia_h = "$target_gen_dir/skia.h"
1519 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001520
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001521 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1522 [ rebase_path(skia_h, root_build_dir) ] +
1523 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001524 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001525 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001526 }
1527
Brian Osmanc9a42472018-05-31 13:17:12 -04001528 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001529 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001530 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001531 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001532 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001533 "tools/fiddle/draw.cpp",
1534 "tools/fiddle/fiddle_main.cpp",
1535 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001536
1537 if (skia_use_egl) {
1538 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001539 } else {
1540 sources += [ "tools/fiddle/null_context.cpp" ]
1541 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001542 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001543 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001544 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001545 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001546 ":skia",
1547 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001548 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001549 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001550 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001551 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001552 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001553 ]
1554 }
1555 }
1556
Mike Kleine5463e62020-06-11 13:53:53 -05001557 config("cpp14") {
1558 if (is_win) {
1559 cflags_cc = [ "/std:c++14" ]
1560 } else {
1561 cflags_cc = [ "-std=c++14" ]
1562 }
1563 }
1564
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001565 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001566 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001567 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001568 ":our_vulkan_headers",
1569 ":cpp14",
1570 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001571 if (defined(skia_header_target_default_configs)) {
1572 configs += skia_header_target_default_configs
1573 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001574 deps = [
1575 ":skia",
1576 ":skia.h",
1577 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001578 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001579 ]
Stephen White0d70b712019-07-10 15:51:30 -04001580
1581 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001582 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001583 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001584 }
1585
mtkleinc095df52016-08-24 12:23:52 -07001586 template("test_lib") {
1587 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001588 if (defined(invoker.public_defines)) {
1589 defines = invoker.public_defines
1590 }
mtklein25c81d42016-07-27 13:55:26 -07001591 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001592 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001593 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001594 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001595 public_configs = [
1596 ":" + target_name + "_config",
1597 ":skia_private",
1598 ]
1599
1600 if (!defined(deps)) {
1601 deps = []
1602 }
1603 deps += [ ":skia" ]
1604 testonly = true
1605 }
mtklein25c81d42016-07-27 13:55:26 -07001606 }
mtklein25c81d42016-07-27 13:55:26 -07001607
Mike Kleine6682eb2017-01-05 10:54:57 -05001608 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001609 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001610 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001611 forward_variables_from(invoker,
1612 "*",
1613 [
1614 "output_name",
1615 "visibility",
1616 "is_shared_library",
1617 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001619 extra_configs = [ ":skia_private" ]
1620 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1621 data_sources = [ "resources" ]
1622 if ("True" == exec_script("//gn/checkdir.py",
1623 [ rebase_path("skps", root_build_dir) ],
1624 "trim string")) {
1625 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001626 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001627 if ("True" == exec_script("//gn/checkdir.py",
1628 [ rebase_path("mskps", root_build_dir) ],
1629 "trim string")) {
1630 data_sources += [ "mskps" ]
1631 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001632 }
1633 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001634 # !is_ios
1635
1636 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001637 skia_shared_library("lib" + target_name) {
1638 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001639 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001640 if (!defined(configs)) {
1641 configs = []
1642 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001643 configs += [ ":skia_private" ]
1644 testonly = true
1645 }
1646 } else {
1647 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001648 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001649 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001650 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001651 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001652 if (!defined(configs)) {
1653 configs = []
1654 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001655 configs += [ ":skia_private" ]
1656 testonly = true
1657 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001658 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001659 if (is_android && skia_android_serial != "" && defined(_executable)) {
1660 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001661 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001662 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001663 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001664 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001665 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001666 args = [
1667 rebase_path("$root_build_dir/$_executable"),
1668 skia_android_serial,
1669 rebase_path(_stamp),
1670 ]
1671 testonly = true
1672 }
Mike Klein7d921032017-01-05 12:20:41 -05001673 }
1674 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001675 }
1676
mtkleinc095df52016-08-24 12:23:52 -07001677 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001678 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001679
Mike Klein9e25bb92019-04-29 09:46:36 -05001680 # Bots and even devs may not have Vulkan headers, so put
1681 # include/third_party/vulkan on our path so they're always available.
1682 all_dependent_configs = [ ":our_vulkan_headers" ]
1683
Mike Klein333fb452019-04-24 08:48:11 -05001684 defines = []
1685 if (skia_enable_discrete_gpu) {
1686 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1687 }
1688
Brian Osmanc9a42472018-05-31 13:17:12 -04001689 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001690 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001691 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001692 "tools/gpu/BackendSurfaceFactory.cpp",
1693 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001694 "tools/gpu/BackendTextureImageFactory.cpp",
1695 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001696 "tools/gpu/FlushFinishTracker.cpp",
1697 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001698 "tools/gpu/GrContextFactory.cpp",
1699 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001700 "tools/gpu/ManagedBackendTexture.cpp",
1701 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001702 "tools/gpu/MemoryCache.cpp",
1703 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001704 "tools/gpu/ProxyUtils.cpp",
1705 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001706 "tools/gpu/TestOps.cpp",
1707 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001708 "tools/gpu/YUVUtils.cpp",
1709 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001710 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1711 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001712 "tools/gpu/mock/MockTestContext.cpp",
1713 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001714
1715 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001716 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001717
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001718 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001719 sources +=
1720 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001721 if (is_ios) {
1722 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001723 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001724 } else if (is_mac) {
1725 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001726 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001727 if (skia_use_angle) {
1728 deps += [ "//third_party/angle2" ]
1729 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1730 }
Brian Salomon1171d312020-03-19 08:47:44 -04001731 }
1732
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001733 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1734 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001735 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001736 if (is_android || skia_use_egl) {
1737 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1738 libs += [ "EGL" ]
1739 } else if (is_linux) {
1740 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1741 libs += [
1742 "GLU",
1743 "GL",
1744 "X11",
1745 ]
1746 } else if (is_win) {
1747 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1748 libs += [ "Gdi32.lib" ]
1749 if (target_cpu != "arm64") {
1750 libs += [ "OpenGL32.lib" ]
1751 }
1752 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001753 }
Greg Daniel54200e42018-12-11 17:03:39 -05001754
Brian Osmanc9a42472018-05-31 13:17:12 -04001755 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001756 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001757 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001758 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1759 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001760 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001761 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001762 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1763 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001764 }
1765 if (skia_use_metal) {
1766 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001767 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001768 if (skia_use_direct3d) {
1769 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001770 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001771 }
Stephen White985741a2019-07-18 11:43:45 -04001772 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001773 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001774 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001775 if (is_clang) {
1776 cflags_cc = [ "-Wno-microsoft-cast" ]
1777 }
Stephen White985741a2019-07-18 11:43:45 -04001778 }
Robert Phillips72354b02021-07-06 13:43:56 -04001779 if (!skia_enable_skgpu_v1) {
1780 sources -= [ "tools/gpu/GrTest.cpp" ]
1781 sources -= [ "tools/gpu/TestOps.cpp" ]
1782 sources -= [ "tools/gpu/TestOps.h" ]
1783 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001784
1785 if (is_fuchsia && using_fuchsia_sdk) {
1786 libs +=
1787 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1788 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001789 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001790
mtkleinc095df52016-08-24 12:23:52 -07001791 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001792 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001793 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001794
1795 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001796 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1797 deps = [ ":flags" ]
1798 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001799 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001800 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001801 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1802 deps = [ ":flags" ]
1803 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001804 }
1805 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001806 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1807 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001808 }
1809 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001810 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1811 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001812 }
mtklein25c81d42016-07-27 13:55:26 -07001813
Mike Klein499f0ac2019-03-25 13:00:12 -05001814 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001815 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001816 sources = [
1817 "tools/trace/ChromeTracingTracer.cpp",
1818 "tools/trace/ChromeTracingTracer.h",
1819 "tools/trace/EventTracingPriv.cpp",
1820 "tools/trace/EventTracingPriv.h",
1821 "tools/trace/SkDebugfTracer.cpp",
1822 "tools/trace/SkDebugfTracer.h",
1823 ]
1824 }
1825
mtkleinc095df52016-08-24 12:23:52 -07001826 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001827 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001828 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001829 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001830 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001831 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001832 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001833 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001834 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001835 "tools/MSKPPlayer.cpp",
1836 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001837 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001838 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001839 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001840 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001841 "tools/RuntimeBlendUtils.cpp",
1842 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001843 "tools/SkMetaData.cpp",
1844 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001845 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001846 "tools/SkSharingProc.h",
1847 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001848 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001849 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001850 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001851 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001852 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001853 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001854 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001855 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001856 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001857 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001858 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001859 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001860 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001861 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001862 "tools/fonts/TestEmptyTypeface.h",
1863 "tools/fonts/TestFontMgr.cpp",
1864 "tools/fonts/TestFontMgr.h",
1865 "tools/fonts/TestSVGTypeface.cpp",
1866 "tools/fonts/TestSVGTypeface.h",
1867 "tools/fonts/TestTypeface.cpp",
1868 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001869 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001870 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001871 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001872 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001873 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001874 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001875 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001876 if (target_cpu != "wasm") {
1877 sources += [ "tools/CrashHandler.cpp" ]
1878 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001879 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001880 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001881 if (is_ios) {
1882 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001883 sources += [ "tools/ios_utils.h" ]
1884 if (skia_use_metal) {
1885 sources += [ "tools/AutoreleasePool.mm" ]
1886 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001887 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001888 } else if (is_mac) {
1889 if (skia_use_metal) {
1890 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001891 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001892 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001893 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001894 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001895 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001896
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001897 defines = []
1898 if (skia_tools_require_resources) {
1899 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1900 }
mtkleinc095df52016-08-24 12:23:52 -07001901 deps = [
1902 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001903 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001904 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001905 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001906 }
mtklein25c81d42016-07-27 13:55:26 -07001907
Mike Kleine11e5c12019-04-24 12:46:06 -05001908 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001909 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001910 }
1911
Mike Klein6e744122016-10-27 12:21:40 -04001912 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001913 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001914 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001915 if (skia_use_gl) {
1916 sources += gl_gm_sources
1917 }
Robert Phillips024668c2021-07-01 12:12:52 -04001918 if (!skia_enable_skgpu_v1) {
1919 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04001920 }
mtkleinc095df52016-08-24 12:23:52 -07001921 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001922 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001923 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001924 ":skia",
1925 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001926 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001927 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001928 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001929 "modules/skparagraph",
1930 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001931 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001932 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001933 if (is_skia_dev_build) {
1934 sources += [ "gm/fiddle.cpp" ]
1935 deps += [ ":skia.h" ]
1936 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001937 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001938
1939 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001940 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001941 sources += [ "gm/video_decoder.cpp" ]
1942 }
mtkleinc095df52016-08-24 12:23:52 -07001943 }
mtklein25c81d42016-07-27 13:55:26 -07001944
Ben Wagnerbded42a2021-02-17 22:14:34 -05001945 test_lib("test") {
1946 sources = [
1947 "tests/Test.cpp",
1948 "tests/Test.h",
1949 "tests/TestUtils.cpp",
1950 "tests/TestUtils.h",
1951 ]
1952 deps = [
1953 ":flags",
1954 ":skia",
1955 ":tool_utils",
1956 ]
1957 public_deps = [
1958 ":gpu_tool_utils", # Test.h #includes headers from this target.
1959 ]
1960 }
1961
Mike Klein6e744122016-10-27 12:21:40 -04001962 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001963 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001964 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001965 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001966 if (skia_use_metal) {
1967 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001968 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001969 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001970 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001971 if (skia_use_gl) {
1972 sources += gl_tests_sources
1973 }
Robert Phillips024668c2021-07-01 12:12:52 -04001974 if (!skia_enable_skgpu_v1) {
1975 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04001976 }
mtkleinc095df52016-08-24 12:23:52 -07001977 deps = [
1978 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05001979 ":fontmgr_android_tests",
1980 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00001981 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07001982 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05001983 ":test",
mtkleinc095df52016-08-24 12:23:52 -07001984 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001985 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001986 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001987 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001988 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001989 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05001990 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001991 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001992 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001993 "//third_party/zlib",
1994 ]
1995 }
mtklein2f3416d2016-08-02 16:02:05 -07001996
Mike Klein6e744122016-10-27 12:21:40 -04001997 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001998 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001999 sources = bench_sources
Robert Phillips04f22ea2021-07-22 15:11:03 -04002000 if (!skia_enable_skgpu_v1) {
2001 sources -= skgpu_v1_bench_sources
2002 }
mtkleinc095df52016-08-24 12:23:52 -07002003 deps = [
2004 ":flags",
2005 ":gm",
2006 ":gpu_tool_utils",
2007 ":skia",
2008 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002009 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002010 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002011 ]
2012 }
mtklein2b6870c2016-07-28 14:17:33 -07002013
Mike Reedd62d4062019-06-12 10:20:44 -04002014 test_lib("experimental_xform") {
2015 sources = [
2016 "experimental/xform/SkShape.cpp",
2017 "experimental/xform/SkXform.cpp",
2018 "experimental/xform/XContext.cpp",
2019 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002020 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002021 }
2022
Florin Malitabfe876a2018-09-02 12:33:59 -04002023 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002024 if (skia_enable_skottie) {
2025 test_app("skottie_tool") {
2026 deps = [ "modules/skottie:tool" ]
2027 }
Florin Malita79725d32018-06-05 16:16:57 -04002028 }
Florin Malitab3418102020-10-15 18:10:29 -04002029 test_app("svg_tool") {
2030 deps = [ "modules/svg:tool" ]
2031 }
Florin Malita79725d32018-06-05 16:16:57 -04002032 }
2033
Hal Canary5b39dc82019-04-17 13:29:46 -04002034 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002035 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2036 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002037 }
2038
Chris Dalton2b598902020-03-25 10:50:35 -06002039 import("gn/samples.gni")
2040 test_lib("samples") {
2041 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002042 if (!skia_enable_skgpu_v1) {
2043 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002044 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002045 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002046 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002047 ":flags",
2048 ":gpu_tool_utils",
2049 ":xml",
Julia Lavrova159fd842021-02-24 12:15:08 -05002050 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002051 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002052 "modules/skparagraph:samples",
2053 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002054 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002055 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002056 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002057 }
Kevin Lubick00398742020-10-08 10:05:07 -04002058 test_lib("hash_and_encode") {
2059 sources = [
2060 "tools/HashAndEncode.cpp",
2061 "tools/HashAndEncode.h",
2062 ]
2063 deps = [
2064 ":flags",
2065 ":skia",
2066 "//third_party/libpng",
2067 ]
2068 }
Chris Dalton2b598902020-03-25 10:50:35 -06002069 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002070 test_app("convert-to-nia") {
2071 sources = [ "tools/convert-to-nia.cpp" ]
2072 deps = [ ":skia" ]
2073 }
Mike Klein7af351a2018-07-27 09:54:43 -04002074 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002075 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002076 deps = [
2077 ":skcms",
2078 ":skia",
2079 ]
2080 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002081 test_app("fm") {
2082 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002083 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002084 "tools/fm/fm.cpp",
2085 ]
2086 deps = [
2087 ":common_flags_aa",
2088 ":common_flags_gpu",
2089 ":flags",
2090 ":gm",
2091 ":gpu_tool_utils",
2092 ":hash_and_encode",
2093 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002094 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002095 ":tool_utils",
2096 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002097 "modules/skottie",
2098 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002099 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002100 ]
2101 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002102 test_app("dm") {
2103 sources = [
2104 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002105 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002106 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002107 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002108 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002109 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002110 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002111 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002112 ":common_flags_aa",
2113 ":common_flags_config",
2114 ":common_flags_gpu",
2115 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002116 ":flags",
2117 ":gm",
2118 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002119 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002120 ":skia",
2121 ":tests",
2122 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002123 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002124 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002125 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002126 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002127 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002128 ]
2129 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002130 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002131 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002132 "experimental/sorttoy/Cmds.cpp",
2133 "experimental/sorttoy/Cmds.h",
2134 "experimental/sorttoy/Fake.cpp",
2135 "experimental/sorttoy/Fake.h",
2136 "experimental/sorttoy/SortKey.h",
2137 "experimental/sorttoy/sorttoy.cpp",
2138 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002139 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002140 deps = [
2141 ":flags",
2142 ":skia",
2143 ":tool_utils",
2144 ]
2145 }
Michael Ludwig30217952020-12-04 12:58:35 -05002146
2147 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002148 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002149 sources = [
2150 "tests/CanvasStateHelpers.cpp",
2151 "tests/CanvasStateHelpers.h",
2152 ]
2153 deps = [ ":skia" ]
2154 }
Brian Osman16adfa32016-10-18 14:42:44 -04002155 }
2156
Mike Kleina8a51ce2018-01-09 12:34:11 -05002157 if (!is_win) {
2158 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002159 sources = [ "tools/remote_demo.cpp" ]
2160 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002161 }
2162 }
2163
Hal Canarye107faa2019-10-23 12:52:33 -04002164 if (!is_win) {
2165 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002166 sources = [ "tools/blob_cache_sim.cpp" ]
2167 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002168 }
2169 }
2170
Mike Kleine6682eb2017-01-05 10:54:57 -05002171 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002172 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002173 deps = [
2174 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002175 ":common_flags_aa",
2176 ":common_flags_config",
2177 ":common_flags_gpu",
2178 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002179 ":flags",
2180 ":gm",
2181 ":gpu_tool_utils",
2182 ":skia",
2183 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002184 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002185 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002186 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002187 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002188 ]
mtklein2b6870c2016-07-28 14:17:33 -07002189 }
halcanary19a97202016-08-03 15:08:04 -07002190
Ravi Mistry10d36c52017-01-31 09:49:18 -05002191 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002192 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002193 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002194 deps = [
2195 ":flags",
2196 ":skia",
2197 ]
2198 }
2199
Mike Reedc0ee21f2019-05-28 16:11:03 -04002200 if (skia_use_ffmpeg) {
2201 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002202 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002203 deps = [
2204 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002205 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002206 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002207 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002208 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002209 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002210 ]
2211 }
2212 }
2213
Brian Osmanc9a42472018-05-31 13:17:12 -04002214 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002215 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002216 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002217 ":common_flags_config",
2218 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002219 ":flags",
2220 ":gpu_tool_utils",
2221 ":skia",
2222 ":tool_utils",
2223 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002224 }
2225
Mike Kleine6682eb2017-01-05 10:54:57 -05002226 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002227 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002228 deps = [
2229 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002230 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002231 ]
halcanary3eee9d92016-09-10 07:01:53 -07002232 }
mtklein046cb562016-09-16 10:23:12 -07002233
Ben Wagner219f3622017-07-17 15:32:25 -04002234 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002235 sources = [ "tools/fonts/create_test_font.cpp" ]
2236 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002237 assert_no_deps = [
2238 # tool_utils requires the output of this app.
2239 ":tool_utils",
2240 ]
2241 }
2242
Florin Malita5d3ff432018-07-31 16:38:43 -04002243 if (skia_use_expat) {
2244 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002245 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002246 deps = [
2247 ":flags",
2248 ":skia",
2249 ":tool_utils",
2250 ]
2251 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002252 }
2253
Mike Kleine6682eb2017-01-05 10:54:57 -05002254 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002255 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002256 deps = [
2257 ":flags",
2258 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002259 ]
mtklein046cb562016-09-16 10:23:12 -07002260 }
mtkleinecbc5262016-09-22 11:51:24 -07002261
Brian Osman6788a542018-12-10 11:56:01 -05002262 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002263 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002264 sources = [
2265 "tools/skiaserve/Request.cpp",
2266 "tools/skiaserve/Response.cpp",
2267 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002268 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2269 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2270 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2271 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2272 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2273 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2274 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2275 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2276 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002277 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2278 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002279 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2280 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2281 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2282 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2283 ]
2284 deps = [
2285 ":flags",
2286 ":gpu_tool_utils",
2287 ":skia",
2288 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002289 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002290 ]
Mike Klein7d302882016-11-03 14:06:31 -04002291 }
mtkleinecbc5262016-09-22 11:51:24 -07002292 }
kjlubick14f984b2016-10-03 11:49:45 -07002293
Mike Kleine6682eb2017-01-05 10:54:57 -05002294 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002295 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002296 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002297 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002298 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002299 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002300 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002301 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002302 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002303 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002304 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002305 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002306 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002307 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002308 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002309 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002310 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002311 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002312 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002313 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002314 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002315 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2316 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002317 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002318 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002319 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002320 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002321 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2322 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002323 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002324 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2325 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002326 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002327 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002328 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002329 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002330 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002331 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002332 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002333 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002334 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002335 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002336 "tools/debugger/DrawCommand.cpp",
2337 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002338 ]
2339 deps = [
2340 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002341 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002342 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002343 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002344 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002345 ]
kjlubick14f984b2016-10-03 11:49:45 -07002346 }
Mike Klein38312422016-10-05 15:41:01 -04002347
Mike Kleine6682eb2017-01-05 10:54:57 -05002348 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002349 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002350 rebase_path("tests/skia_test.cpp"),
2351 rebase_path("tests/Test.cpp"),
2352 ]
caryclark9feb6322016-10-25 08:58:26 -07002353 deps = [
2354 ":flags",
2355 ":gpu_tool_utils",
2356 ":skia",
2357 ":tool_utils",
2358 ]
caryclark9feb6322016-10-25 08:58:26 -07002359 }
2360
Mike Kleine6682eb2017-01-05 10:54:57 -05002361 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002362 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002363 deps = [
2364 ":flags",
2365 ":skia",
2366 ]
Mike Klein38312422016-10-05 15:41:01 -04002367 }
bungemanfe917272016-10-13 17:36:40 -04002368
Mike Kleine6682eb2017-01-05 10:54:57 -05002369 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002370 sources = [
2371 "tools/skdiff/skdiff.cpp",
2372 "tools/skdiff/skdiff_html.cpp",
2373 "tools/skdiff/skdiff_main.cpp",
2374 "tools/skdiff/skdiff_utils.cpp",
2375 ]
2376 deps = [
2377 ":skia",
2378 ":tool_utils",
2379 ]
bungemanfe917272016-10-13 17:36:40 -04002380 }
halcanarya73d76a2016-10-17 13:19:02 -07002381
Mike Kleine6682eb2017-01-05 10:54:57 -05002382 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002383 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002384 deps = [
2385 ":skia",
2386 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002387 ]
halcanarya73d76a2016-10-17 13:19:02 -07002388 }
Brian Osman16adfa32016-10-18 14:42:44 -04002389
Brian Osmanc9a42472018-05-31 13:17:12 -04002390 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002391 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002392 check_includes = false
2393 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002394 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002395 defines =
2396 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002397 sources = [
2398 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002399 "tools/skqp/src/skqp.cpp",
2400 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002401 ]
2402 deps = [
2403 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002404 ":skia",
2405 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002406 ":tool_utils",
2407 ]
2408 }
2409 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002410 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002411 include_dirs = [ "//" ]
2412 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002413 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002414 }
2415 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002416 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002417 deps = [
2418 ":gm",
2419 ":skia",
2420 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002421 ]
2422 }
2423 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002424 if (is_fuchsia) {
2425 # Build a package repository for skqp on Fuchsia.
2426 group("skqp_repo") {
2427 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002428 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002429 }
2430 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002431 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002432 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002433 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002434 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002435 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002436 deps = [
2437 ":skia",
2438 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002439 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002440 ]
2441 libs = [ "android" ]
2442 }
2443 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002444 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002445 test_app("skottie_android") {
2446 is_shared_library = true
2447
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002448 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002449 libs = []
2450
Stan Iliev93151722018-08-02 11:10:52 -04002451 deps = [
2452 ":skia",
2453 "modules/skottie",
2454 ]
2455 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002456
2457 test_app("androidkit") {
2458 is_shared_library = true
2459
Florin Malita2a650cc2021-04-12 13:38:44 -04002460 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002461 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002462 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002463 "modules/androidkit/src/ColorFilters.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002464 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002465 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002466 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002467 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002468 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002469 "modules/androidkit/src/Path.cpp",
2470 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002471 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2472 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002473 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002474 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002475 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002476 "modules/androidkit/src/SurfaceThread.cpp",
2477 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002478 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002479 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002480 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002481 libs = [
2482 "android",
2483 "jnigraphics",
2484 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002485
Florin Malita2cc65382021-04-26 21:59:35 -04002486 deps = [
2487 ":sk_app",
2488 ":skia",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002489 "experimental/sktext:sktext",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002490 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002491 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002492 }
Stan Iliev93151722018-08-02 11:10:52 -04002493 }
Hal Canary75427132017-10-11 16:00:31 -04002494
Hal Canarya9de7602018-01-19 13:08:23 -05002495 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002496 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002497 deps = [
2498 ":gm",
2499 ":skia",
2500 ]
2501 }
2502 test_app("list_gpu_unit_tests") {
2503 sources = [
2504 "dm/DMGpuTestProcs.cpp",
2505 "tools/list_gpu_unit_tests.cpp",
2506 ]
2507 deps = [
2508 ":skia",
2509 ":tests",
2510 ]
2511 }
2512
Brian Osmanc9a42472018-05-31 13:17:12 -04002513 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002514 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002515 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002516 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002517 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002518 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002519 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002520 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002521 "tools/sk_app/CommandSet.h",
2522 "tools/sk_app/DisplayParams.h",
2523 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002524 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002525 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002526 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002527 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002528 ]
2529 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002530 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002531
2532 if (is_android) {
2533 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002534 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002535 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002536 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002537 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002538 "tools/sk_app/android/main_android.cpp",
2539 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002540 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002541 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002542 libs += [ "android" ]
2543 } else if (is_linux) {
2544 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002545 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002546 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002547 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002548 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002549 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002550 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002551 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002552 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002553 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002554 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002555 "X11",
2556 ]
2557 } else if (is_win) {
2558 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002559 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002560 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002561 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002562 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002563 "tools/sk_app/win/main_win.cpp",
2564 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002565 } else if (is_mac) {
2566 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002567 "tools/sk_app/mac/WindowContextFactory_mac.h",
2568 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002569 "tools/sk_app/mac/Window_mac.mm",
2570 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002571 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002572 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002573 "QuartzCore.framework",
2574 "Cocoa.framework",
2575 "Foundation.framework",
2576 ]
2577 } else if (is_ios) {
2578 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002579 "tools/sk_app/ios/WindowContextFactory_ios.h",
2580 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002581 "tools/sk_app/ios/Window_ios.mm",
2582 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002583 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002584 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002585 }
2586
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002587 if (skia_use_gl) {
2588 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002589 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002590 if (is_android) {
2591 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2592 } else if (is_linux) {
2593 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2594 } else if (is_win) {
2595 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2596 if (skia_use_angle) {
2597 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2598 }
2599 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002600 sources += [
2601 "tools/sk_app/mac/GLWindowContext_mac.mm",
2602 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2603 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002604 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002605 sources += [
2606 "tools/sk_app/ios/GLWindowContext_ios.mm",
2607 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2608 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002609 }
2610 }
2611
Brian Osmanc9a42472018-05-31 13:17:12 -04002612 if (skia_use_vulkan) {
2613 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002614 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002615 if (is_android) {
2616 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2617 } else if (is_linux) {
2618 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2619 libs += [ "X11-xcb" ]
2620 } else if (is_win) {
2621 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2622 }
2623 }
2624
Jim Van Verthbe39f712019-02-08 15:36:14 -05002625 if (skia_use_metal) {
2626 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002627 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002628 if (is_mac) {
2629 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002630 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002631 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002632 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002633 }
2634
Jim Van Verth682a2f42020-05-13 16:54:09 -04002635 if (skia_use_direct3d) {
2636 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2637 }
2638
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002639 if (skia_use_dawn) {
2640 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002641 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002642 if (is_linux) {
2643 if (dawn_enable_vulkan) {
2644 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2645 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2646 libs += [ "X11-xcb" ]
2647 }
2648 } else if (is_win) {
2649 if (dawn_enable_d3d12) {
2650 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2651 }
2652 } else if (is_mac) {
2653 if (dawn_enable_metal) {
2654 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2655 }
2656 }
2657 }
2658
Mike Kleina01c6b02020-04-01 13:47:34 -05002659 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002660 if (is_android) {
2661 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002662 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002663 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002664 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002665 }
Brian Osman16adfa32016-10-18 14:42:44 -04002666 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002667
Hal Canary87515122019-03-15 14:22:51 -04002668 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2669 test_app("fiddle_examples") {
2670 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002671 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002672 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002673 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002674 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002675 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002676 cflags = [
2677 "/wd4756", # Overflow in constant arithmetic
2678 "/wd4305", # truncation from 'double' to 'float'
2679 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002680 }
Hal Canary87515122019-03-15 14:22:51 -04002681 deps = [
2682 ":skia",
2683 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002684 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002685 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002686 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002687 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002688 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002689 ]
2690 }
2691 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002692
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002693 # sk_app can work without GL but viewer always runs raster through a GL window context.
2694 if (skia_use_gl) {
2695 test_app("viewer") {
2696 is_shared_library = is_android
2697 sources = [
2698 "tools/viewer/AnimTimer.h",
2699 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002700 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002701 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002702 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002703 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002704 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002705 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002706 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002707 "tools/viewer/MSKPSlide.cpp",
2708 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002709 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002710 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002711 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002712 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002713 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002714 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002715 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002716 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002717 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002718 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002719 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002720 "tools/viewer/SkottieSlide.h",
2721 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002722 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002723 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002724 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002725 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002726 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002727 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002728 "tools/viewer/TouchGesture.cpp",
2729 "tools/viewer/TouchGesture.h",
2730 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002731 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002732 ]
2733 libs = []
2734
2735 deps = [
2736 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002737 ":flags",
2738 ":gm",
2739 ":gpu_tool_utils",
2740 ":samples",
2741 ":sk_app",
2742 ":skia",
2743 ":tool_utils",
2744 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002745 "experimental/skrive",
Julia Lavrova159fd842021-02-24 12:15:08 -05002746 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002747 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002748 "modules/particles",
2749 "modules/skottie",
2750 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002751 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002752 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002753 "//third_party/imgui",
2754 ]
2755 if (skia_use_experimental_xform) {
2756 deps += [ ":experimental_xform" ]
2757 sources += [ "gm/xform.cpp" ]
2758 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002759 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002760 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002761 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002762
Corentin Wallez89d6e792021-03-08 15:25:34 +01002763 #spvtools depends on this but doesn't deps it in.
2764 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002765 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002766 }
Mike Reedd62d4062019-06-12 10:20:44 -04002767 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002768 }
2769
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002770 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002771 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002772 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002773 libs = []
2774
Brian Osmaneff04b52017-11-21 13:18:02 -05002775 deps = [
2776 ":flags",
2777 ":gpu_tool_utils",
2778 ":sk_app",
2779 ":skia",
2780 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002781 ]
2782 }
2783 }
2784
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002785 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2786 action_foreach("generate_mocs") {
2787 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002788 sources = [ "tools/mdbviz/MainWindow.h" ]
2789 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002790 args = [
2791 "$skia_qt_path" + "/bin/moc",
2792 "{{source}}",
2793 "-o",
2794 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2795 ]
2796 }
2797 action_foreach("generate_resources") {
2798 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002799 sources = [ "tools/mdbviz/resources.qrc" ]
2800 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002801 args = [
2802 "$skia_qt_path" + "/bin/rcc",
2803 "{{source}}",
2804 "-o",
2805 "gen/mdbviz/{{source_name_part}}_res.cpp",
2806 ]
2807 }
2808 test_app("mdbviz") {
2809 if (is_win) {
2810 # on Windows we need to disable some exception handling warnings due to the Qt headers
2811 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2812 }
2813 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002814 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002815 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002816 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002817 "tools/debugger/DrawCommand.cpp",
2818 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002819 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002820 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002821 "tools/mdbviz/main.cpp",
2822
2823 # generated files
2824 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2825 "$target_gen_dir/mdbviz/resources_res.cpp",
2826 ]
2827 lib_dirs = [ "$skia_qt_path/lib" ]
2828 libs = [
2829 "Qt5Core.lib",
2830 "Qt5Gui.lib",
2831 "Qt5Widgets.lib",
2832 ]
2833 include_dirs = [
2834 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002835 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002836 "$skia_qt_path/include/QtWidgets",
2837 ]
2838 deps = [
2839 ":generate_mocs",
2840 ":generate_resources",
2841 ":skia",
2842 ]
2843 }
2844 }
2845
Mike Kleine459afd2017-03-03 09:21:30 -05002846 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002847 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002848 sources = [ "$ndk/$ndk_gdbserver" ]
2849 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002850 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002851 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002852
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002853 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002854 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002855 deps = [
2856 ":skia",
2857 "modules/particles",
2858 ]
2859 }
2860
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002861 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002862 test_app("editor") {
2863 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002864 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002865 }
Julia Lavrovaecc8e3b2021-06-10 10:26:36 -04002866 test_app("text_editor") {
2867 is_shared_library = is_android
2868 deps = [ "experimental/sktext:text_editor" ]
2869 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002870 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002871
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002872 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002873 sources = [ "tools/image_diff_metric.cpp" ]
2874 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002875 }
Chris Dalton2b598902020-03-25 10:50:35 -06002876
2877 group("modules_testonly") {
2878 testonly = true
2879 deps = []
2880 if (target_cpu == "wasm") {
2881 deps += [ "modules/canvaskit:viewer_wasm" ]
2882 }
2883 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002884
2885 if (skia_build_fuzzers) {
2886 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002887 skia_executable(target_name) {
2888 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002889 check_includes = false
2890 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002891 if (!defined(configs)) {
2892 configs = []
2893 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002894 configs += [ ":skia_private" ]
2895 sources += [
2896 "fuzz/Fuzz.cpp",
2897 "fuzz/FuzzCommon.cpp",
2898 ]
2899 deps += [
2900 ":flags",
2901 ":gpu_tool_utils",
2902 ":skia",
2903 ]
2904 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2905 if (skia_use_libfuzzer_defaults) {
2906 cflags = [ "-fsanitize=fuzzer" ]
2907 ldflags = [ "-fsanitize=fuzzer" ]
2908 }
2909 testonly = true
2910 }
2911 }
2912
2913 libfuzzer_app("region_deserialize") {
2914 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2915 deps = []
2916 }
2917
2918 libfuzzer_app("image_filter_deserialize") {
2919 include_dirs = [
2920 "tools",
2921 "tools/fonts",
2922 ]
2923 sources = [
2924 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2925 "tools/Resources.cpp",
2926 "tools/fonts/TestFontMgr.cpp",
2927 "tools/fonts/TestSVGTypeface.cpp",
2928 "tools/fonts/TestTypeface.cpp",
2929 ]
Florin Malitab3418102020-10-15 18:10:29 -04002930 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002931 }
2932
2933 libfuzzer_app("region_set_path") {
2934 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2935 deps = []
2936 }
2937
2938 libfuzzer_app("textblob_deserialize") {
2939 include_dirs = [
2940 "tools",
2941 "tools/fonts",
2942 ]
2943 sources = [
2944 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2945 "tools/Resources.cpp",
2946 "tools/fonts/TestFontMgr.cpp",
2947 "tools/fonts/TestSVGTypeface.cpp",
2948 "tools/fonts/TestTypeface.cpp",
2949 ]
Florin Malitab3418102020-10-15 18:10:29 -04002950 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002951 }
2952
2953 libfuzzer_app("path_deserialize") {
2954 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2955 deps = []
2956 }
2957
2958 libfuzzer_app("image_decode") {
2959 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2960 deps = []
2961 }
2962
2963 libfuzzer_app("animated_image_decode") {
2964 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2965 deps = []
2966 }
2967
2968 libfuzzer_app("api_create_ddl") {
2969 include_dirs = [
2970 "include",
2971 "include/gpu",
2972 ]
2973 sources = [
2974 "fuzz/FuzzCreateDDL.cpp",
2975 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2976 "tools/Resources.cpp",
2977 "tools/UrlDataManager.cpp",
2978 "tools/debugger/DebugCanvas.cpp",
2979 "tools/debugger/DebugLayerManager.cpp",
2980 "tools/debugger/DrawCommand.cpp",
2981 "tools/debugger/JsonWriteBuffer.cpp",
2982 "tools/fonts/TestFontMgr.cpp",
2983 "tools/fonts/TestSVGTypeface.cpp",
2984 "tools/fonts/TestTypeface.cpp",
2985 ]
2986 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002987 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002988 "//third_party/libpng",
2989 ]
2990 }
2991
2992 libfuzzer_app("api_draw_functions") {
2993 sources = [
2994 "fuzz/FuzzDrawFunctions.cpp",
2995 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2996 ]
2997 deps = []
2998 }
2999
Adlai Hollerccb68662021-02-25 10:28:44 -05003000 libfuzzer_app("api_ddl_threading") {
3001 sources = [
3002 "fuzz/FuzzDDLThreading.cpp",
3003 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3004 ]
3005 deps = []
3006 }
3007
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003008 libfuzzer_app("api_gradients") {
3009 sources = [
3010 "fuzz/FuzzGradients.cpp",
3011 "fuzz/oss_fuzz/FuzzGradients.cpp",
3012 ]
3013 deps = []
3014 }
3015
3016 libfuzzer_app("api_image_filter") {
3017 include_dirs = [
3018 "tools",
3019 "tools/debugger",
3020 ]
3021 sources = [
3022 "fuzz/FuzzCanvas.cpp",
3023 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3024 "tools/UrlDataManager.cpp",
3025 "tools/debugger/DebugCanvas.cpp",
3026 "tools/debugger/DebugLayerManager.cpp",
3027 "tools/debugger/DrawCommand.cpp",
3028 "tools/debugger/JsonWriteBuffer.cpp",
3029 ]
3030 deps = [ "//third_party/libpng" ]
3031 }
3032
3033 libfuzzer_app("api_path_measure") {
3034 sources = [
3035 "fuzz/FuzzPathMeasure.cpp",
3036 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3037 ]
3038 deps = []
3039 }
3040
3041 libfuzzer_app("api_pathop") {
3042 sources = [
3043 "fuzz/FuzzPathop.cpp",
3044 "fuzz/oss_fuzz/FuzzPathop.cpp",
3045 ]
3046 deps = []
3047 }
3048
Robert Phillips98b066c2021-04-22 10:51:58 -04003049 libfuzzer_app("api_triangulation") {
3050 sources = [
3051 "fuzz/FuzzTriangulation.cpp",
3052 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3053 ]
3054 deps = []
3055 }
3056
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003057 libfuzzer_app("api_raster_n32_canvas") {
3058 include_dirs = [
3059 "tools",
3060 "tools/debugger",
3061 "tools/fonts",
3062 ]
3063 sources = [
3064 "fuzz/FuzzCanvas.cpp",
3065 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3066 "tools/Resources.cpp",
3067 "tools/UrlDataManager.cpp",
3068 "tools/debugger/DebugCanvas.cpp",
3069 "tools/debugger/DebugLayerManager.cpp",
3070 "tools/debugger/DrawCommand.cpp",
3071 "tools/debugger/JsonWriteBuffer.cpp",
3072 "tools/fonts/TestFontMgr.cpp",
3073 "tools/fonts/TestSVGTypeface.cpp",
3074 "tools/fonts/TestTypeface.cpp",
3075 ]
3076 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003077 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003078 "//third_party/libpng",
3079 ]
3080 }
3081
Kevin Lubick7845b972021-03-29 08:07:32 -04003082 libfuzzer_app("api_regionop") {
3083 sources = [
3084 "fuzz/FuzzRegionOp.cpp",
3085 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3086 ]
3087 deps = []
3088 }
3089
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003090 if (skia_use_gl) {
3091 libfuzzer_app("api_mock_gpu_canvas") {
3092 include_dirs = [
3093 "tools",
3094 "tools/debugger",
3095 "tools/fonts",
3096 ]
3097 sources = [
3098 "fuzz/FuzzCanvas.cpp",
3099 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3100 "tools/LsanSuppressions.cpp",
3101 "tools/Resources.cpp",
3102 "tools/UrlDataManager.cpp",
3103 "tools/debugger/DebugCanvas.cpp",
3104 "tools/debugger/DebugLayerManager.cpp",
3105 "tools/debugger/DrawCommand.cpp",
3106 "tools/debugger/JsonWriteBuffer.cpp",
3107 "tools/fonts/TestFontMgr.cpp",
3108 "tools/fonts/TestSVGTypeface.cpp",
3109 "tools/fonts/TestTypeface.cpp",
3110 ]
3111 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003112 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003113 "//third_party/libpng",
3114 ]
3115 }
3116 }
3117
3118 libfuzzer_app("api_null_canvas") {
3119 include_dirs = [
3120 "tools",
3121 "tools/debugger",
3122 "tools/fonts",
3123 ]
3124 sources = [
3125 "fuzz/FuzzCanvas.cpp",
3126 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3127 "tools/Resources.cpp",
3128 "tools/UrlDataManager.cpp",
3129 "tools/debugger/DebugCanvas.cpp",
3130 "tools/debugger/DebugLayerManager.cpp",
3131 "tools/debugger/DrawCommand.cpp",
3132 "tools/debugger/JsonWriteBuffer.cpp",
3133 "tools/fonts/TestFontMgr.cpp",
3134 "tools/fonts/TestSVGTypeface.cpp",
3135 "tools/fonts/TestTypeface.cpp",
3136 ]
3137 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003138 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003139 "//third_party/libpng",
3140 ]
3141 }
3142
Weston Tracey1a771fe2021-02-04 11:09:59 -05003143 libfuzzer_app("api_skparagraph") {
3144 sources = [
3145 "fuzz/FuzzSkParagraph.cpp",
3146 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3147 "tools/Resources.cpp",
3148 ]
3149 deps = [ "modules/skparagraph" ]
3150 }
3151
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003152 libfuzzer_app("api_svg_canvas") {
3153 include_dirs = [
3154 "include",
3155 "include/svg",
3156 ]
3157 sources = [
3158 "fuzz/FuzzCanvas.cpp",
3159 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3160 "tools/Resources.cpp",
3161 "tools/UrlDataManager.cpp",
3162 "tools/debugger/DebugCanvas.cpp",
3163 "tools/debugger/DebugLayerManager.cpp",
3164 "tools/debugger/DrawCommand.cpp",
3165 "tools/debugger/JsonWriteBuffer.cpp",
3166 "tools/fonts/TestFontMgr.cpp",
3167 "tools/fonts/TestSVGTypeface.cpp",
3168 "tools/fonts/TestTypeface.cpp",
3169 ]
3170 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003171 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003172 "//third_party/libpng",
3173 ]
3174 }
3175
3176 libfuzzer_app("png_encoder") {
3177 sources = [
3178 "fuzz/FuzzEncoders.cpp",
3179 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3180 ]
3181 deps = []
3182 }
3183
3184 libfuzzer_app("jpeg_encoder") {
3185 sources = [
3186 "fuzz/FuzzEncoders.cpp",
3187 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3188 ]
3189 deps = []
3190 }
3191
3192 libfuzzer_app("webp_encoder") {
3193 sources = [
3194 "fuzz/FuzzEncoders.cpp",
3195 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3196 ]
3197 deps = []
3198 }
3199
3200 libfuzzer_app("skottie_json") {
3201 sources = [
3202 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3203 "tools/Resources.cpp",
3204 "tools/fonts/TestFontMgr.cpp",
3205 "tools/fonts/TestSVGTypeface.cpp",
3206 "tools/fonts/TestTypeface.cpp",
3207 ]
3208 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003209 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003210 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003211 ]
3212 }
3213
3214 libfuzzer_app("skjson") {
3215 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3216 deps = []
3217 }
3218
3219 libfuzzer_app("api_polyutils") {
3220 sources = [
3221 "fuzz/FuzzPolyUtils.cpp",
3222 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3223 ]
3224 deps = [ ":skia" ]
3225 }
3226
3227 libfuzzer_app("android_codec") {
3228 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3229 deps = []
3230 }
3231
3232 libfuzzer_app("image_decode_incremental") {
3233 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3234 deps = []
3235 }
3236
3237 libfuzzer_app("sksl2glsl") {
3238 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3239 deps = []
3240 }
3241
3242 libfuzzer_app("sksl2spirv") {
3243 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3244 deps = []
3245 }
3246
3247 libfuzzer_app("sksl2metal") {
3248 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3249 deps = []
3250 }
3251
3252 libfuzzer_app("sksl2pipeline") {
3253 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3254 deps = []
3255 }
3256
3257 libfuzzer_app("skdescriptor_deserialize") {
3258 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3259 deps = []
3260 }
3261
3262 libfuzzer_app("svg_dom") {
3263 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003264 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003265 }
3266
3267 libfuzzer_app("skruntimeeffect") {
3268 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3269 deps = []
3270 }
3271
3272 libfuzzer_app("skp") {
3273 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3274 deps = []
3275 }
3276 }
mtklein25c81d42016-07-27 13:55:26 -07003277}
Hal Canary932a2c02019-09-17 10:43:18 -04003278
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003279if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003280 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003281 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003282 }
Hal Canary27483062019-12-06 15:01:08 -05003283}
3284
Hal Canary60ff6512020-01-21 12:39:20 -05003285if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003286 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003287 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003288 }
3289}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003290
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003291skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003292 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3293 include_dirs = [ "." ]
3294 deps = [ ":skia" ]
3295}