blob: c3770dfe09ecd46c7215113814ce8b0acaecd239 [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",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400672 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400673 "src/sksl/sksl_vert.sksl",
674 ]
675 outputs = [ "$root_out_dir/{{source_file_part}}" ]
676 }
677
678 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400679
680 dehydrate_sksl_outputs = []
681 foreach(src, dehydrate_sksl_sources) {
682 name = get_path_info(src, "name")
683
684 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
685 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
686 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
687 "src/sksl/generated/$name.dehydrated.sksl",
688 target_out_dir) ]
689 }
690
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400691 action("dehydrate_sksl") {
692 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400693 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400694 ":sksl_pre_includes",
695 ":skslc(//gn/toolchain:$host_toolchain)",
696 ]
697 sources = dehydrate_sksl_sources
698 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000699 args = [
700 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400701 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000702 ]
Brian Osmandd496172020-08-08 08:17:18 -0400703 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400704 }
John Stilesd836f842020-09-14 10:21:44 -0400705} else {
706 group("dehydrate_sksl") {
707 }
708}
709
John Stilesd836f842020-09-14 10:21:44 -0400710if (skia_compile_sksl_tests) {
711 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400712
John Stiles7e248712020-09-24 16:42:09 -0400713 template("compile_sksl") {
714 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
715 action("compile_sksl_${target_name}") {
716 script = "gn/compile_sksl_tests.py"
717 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400718 ":sksl_pre_includes",
719 ":skslc(//gn/toolchain:$host_toolchain)",
720 ]
John Stilesda57fc02021-01-22 11:54:30 -0500721 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400722 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500723 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500724 args = [
725 rebase_path(skslc_path),
726 invoker.lang,
727 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500728 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500729 ]
730
John Stilesbfc9be02021-01-22 11:55:48 -0500731 testsDir = get_path_info("tests", "abspath")
732 resourcesDir = get_path_info("resources", "abspath")
733
734 foreach(partialPath, invoker.sources) {
735 dst = testsDir + partialPath
736 src = resourcesDir + partialPath
737
738 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400739
740 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
741 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
742 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
743 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
744 nameTmp = get_path_info(dst, "name")
745 name = get_path_info(nameTmp, "name")
746 ext = get_path_info(nameTmp, "extension")
747 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500748 response_file_contents += rebase_path([
749 src,
750 dir,
751 ])
John Stilesda57fc02021-01-22 11:54:30 -0500752 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500753
John Stilesda57fc02021-01-22 11:54:30 -0500754 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400755 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400756 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500757 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500758 }
John Stilesbfc9be02021-01-22 11:55:48 -0500759 outputs +=
760 [ target_out_dir + "/" +
761 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400762 }
763 }
John Stiles7e248712020-09-24 16:42:09 -0400764 }
John Stilesd836f842020-09-14 10:21:44 -0400765 }
John Stiles7e248712020-09-24 16:42:09 -0400766 compile_sksl("glsl_tests") {
767 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500768 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400769 lang = "--glsl"
770 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400771 }
John Stiles7e248712020-09-24 16:42:09 -0400772 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400773 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500774 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400775 lang = "--glsl"
776 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400777 }
John Stilesaeae3a52020-09-25 13:35:58 -0400778 compile_sksl("metal_tests") {
779 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500780 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400781 lang = "--metal"
782 settings = "--settings"
783 }
Brian Osman977feec2020-12-22 11:28:59 -0500784 compile_sksl("skvm_tests") {
785 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500786 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500787 lang = "--skvm"
788 settings = "--settings"
789 }
Brian Osman62b039b2021-02-08 13:49:53 -0500790 compile_sksl("stage_tests") {
791 sources = sksl_stage_tests_sources
792 outExtensions = [ ".stage" ]
793 lang = "--stage"
794 settings = "--settings"
795 }
John Stilesdda1d312020-11-20 16:28:50 -0500796 compile_sksl("spirv_tests") {
797 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500798 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500799 lang = "--spirv"
800 settings = "--settings"
801 }
John Stilesd836f842020-09-14 10:21:44 -0400802} else {
John Stiles7e248712020-09-24 16:42:09 -0400803 group("compile_sksl_glsl_tests") {
804 }
805 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400806 }
John Stilesaeae3a52020-09-25 13:35:58 -0400807 group("compile_sksl_metal_tests") {
808 }
Brian Osman977feec2020-12-22 11:28:59 -0500809 group("compile_sksl_skvm_tests") {
810 }
John Stilesdda1d312020-11-20 16:28:50 -0500811 group("compile_sksl_spirv_tests") {
812 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400813}
814
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500815optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700816 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400817 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400818 ":compile_sksl_glsl_nosettings_tests",
819 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400820 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500821 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500822 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400823 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700824 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400825 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700826 if (skia_generate_workarounds) {
827 deps += [ ":workaround_list" ]
828 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800829 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600830 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400831 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700832
Brian Osmaned5181e2021-07-01 13:54:20 -0400833 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400834 if (skia_enable_skgpu_v2) {
835 sources += skia_skgpu_v2_sources
Robert Phillips3b97aa22021-05-03 11:42:40 -0400836 }
Robert Phillips024668c2021-07-01 12:12:52 -0400837 if (!skia_enable_skgpu_v1) {
838 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400839 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400840
Mike Klein703cf5a2016-10-13 17:18:04 -0400841 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400842 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700843
John Rosascoa9b348f2019-11-08 13:18:15 -0800844 if (skia_use_gl) {
845 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400846 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500847 sources += [
848 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
849 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
850 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400851
852 # this lib is required to link against AHardwareBuffer
853 if (defined(ndk_api) && ndk_api >= 26) {
854 libs += [ "android" ]
855 }
856 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500857 sources += [
858 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
859 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
860 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400861 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400862 } else if (skia_use_webgl) {
863 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400864 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500865 sources += [
866 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
867 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
868 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400869 libs += [ "GL" ]
870 } else if (is_mac) {
871 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
872 } else if (is_ios) {
873 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800874 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400875 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
876 if (target_cpu != "arm64") {
877 libs += [ "OpenGL32.lib" ]
878 }
879 } else {
880 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
881 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800882 sources += skia_gl_gpu_sources
883 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400884
mtkleine9fb3d52016-09-20 15:11:46 -0700885 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400886 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000887 if (skia_use_vma) {
888 deps += [ "third_party/vulkanmemoryallocator" ]
889 }
mtkleine9fb3d52016-09-20 15:11:46 -0700890 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700891 if (skia_enable_vulkan_debug_layers) {
892 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
893 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800894 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800895 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700896 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
897 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400898 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700899 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800900 }
mtkleine9fb3d52016-09-20 15:11:46 -0700901 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400902
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400903 if (is_android && (skia_use_gl || skia_use_vulkan)) {
904 # this lib is required to link against AHardwareBuffer
905 if (defined(ndk_api) && ndk_api >= 26) {
906 libs += [ "android" ]
907 }
908 }
909
Stephen White0d70b712019-07-10 15:51:30 -0400910 if (skia_use_dawn) {
911 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400912 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700913 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400914 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700915 "//third_party/externals/dawn/src/dawn:dawn_proc",
916 "//third_party/externals/dawn/src/dawn:dawncpp",
917 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400918 ]
919 if (dawn_enable_d3d12) {
920 libs += [
921 "d3d12.lib",
922 "dxgi.lib",
923 "d3dcompiler.lib",
924 ]
925 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400926 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400927 }
928 }
929
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500930 if (skia_use_direct3d) {
931 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400932 deps += [
933 "//third_party/d3d12allocator",
934 "//third_party/spirv-cross:spirv_cross",
935 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500936 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500937 if (skia_enable_direct3d_debug_layer) {
938 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
939 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500940 libs += [
941 "d3d12.lib",
942 "dxgi.lib",
943 "d3dcompiler.lib",
944 ]
945 }
946
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400947 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400948 if (skia_use_metal) {
949 public_defines += [ "SK_METAL" ]
950 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400951 if (skia_enable_metal_debug_info) {
952 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
953 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400954 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400955 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000956 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400957 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500958
Kevin Lubickf4def342018-10-04 12:52:50 -0400959 if (is_debug) {
960 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
961 }
mtklein06c35c02016-09-20 12:28:12 -0700962}
963
Leon Scroggins III41169202019-01-29 09:29:57 -0500964optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500965 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500966 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
967 if ("True" ==
968 exec_script("gn/checkpath.py",
969 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
970 "trim string")) {
971 public_defines = [ "SK_USE_LIBGIFCODEC" ]
972 public_include_dirs = [
973 ".",
974 skia_libgifcodec_path,
975 ]
976 include_dirs = public_include_dirs
977 import(_libgifcodec_gni_path)
978 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
979 ".",
980 skia_libgifcodec_path)
981 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500982}
983
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400984optional("heif") {
985 enabled = skia_use_libheif
986 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
987
988 deps = []
989
Mike Kleina01c6b02020-04-01 13:47:34 -0500990 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400991}
992
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400993optional("jpeg_decode") {
994 enabled = skia_use_libjpeg_turbo_decode
995 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
996
Mike Kleina01c6b02020-04-01 13:47:34 -0500997 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400998 sources = [
999 "src/codec/SkJpegCodec.cpp",
1000 "src/codec/SkJpegDecoderMgr.cpp",
1001 "src/codec/SkJpegUtility.cpp",
1002 ]
1003}
1004
1005optional("jpeg_encode") {
1006 enabled = skia_use_libjpeg_turbo_encode
1007 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001008
Mike Kleina01c6b02020-04-01 13:47:34 -05001009 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1010 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001011 sources = [
mtklein63213812016-08-24 09:55:56 -07001012 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001013 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001014 ]
1015}
1016
Leon Scroggins III326b9892020-08-05 16:51:10 -04001017optional("ndk_images") {
1018 enabled = skia_use_ndk_images
1019 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1020 sources = [
1021 "src/ports/SkImageEncoder_NDK.cpp",
1022 "src/ports/SkImageGeneratorNDK.cpp",
1023 "src/ports/SkNDKConversions.cpp",
1024 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001025 libs = [ "jnigraphics" ]
1026}
1027
mtklein63213812016-08-24 09:55:56 -07001028optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001029 enabled = skia_use_zlib && skia_enable_pdf
1030 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001031
Mike Kleina01c6b02020-04-01 13:47:34 -05001032 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001033 if (skia_use_libjpeg_turbo_decode) {
1034 deps += [ ":jpeg_decode" ]
1035 }
1036 if (skia_use_libjpeg_turbo_encode) {
1037 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001038 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001039 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001040 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001041 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001042 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1043 deps += [ "//third_party/harfbuzz" ]
1044 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1045 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001046 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001047 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001048 }
1049}
1050
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001051optional("xps") {
1052 enabled = skia_use_xps && is_win
1053 public_defines = [ "SK_SUPPORT_XPS" ]
1054 public = skia_xps_public
1055 sources = skia_xps_sources
1056}
1057
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001058optional("png_decode") {
1059 enabled = skia_use_libpng_decode
1060 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001061
Mike Kleina01c6b02020-04-01 13:47:34 -05001062 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001063 sources = [
1064 "src/codec/SkIcoCodec.cpp",
1065 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001066 ]
1067}
1068
1069optional("png_encode") {
1070 enabled = skia_use_libpng_encode
1071 public_defines = [ "SK_ENCODE_PNG" ]
1072
Mike Kleina01c6b02020-04-01 13:47:34 -05001073 deps = [ "//third_party/libpng" ]
1074 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001075}
1076
scroggof84ad642016-10-31 09:02:57 -07001077optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001078 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001079 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1080
1081 deps = [
1082 "//third_party/dng_sdk",
1083 "//third_party/libjpeg-turbo:libjpeg",
1084 "//third_party/piex",
1085 ]
1086
1087 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1088 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001089 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001090
Mike Kleina01c6b02020-04-01 13:47:34 -05001091 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001092}
1093
Mike Klein852a8cb2018-05-15 10:46:58 -04001094import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001095skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001096 cflags = []
1097 if (!is_win || is_clang) {
1098 cflags += [
1099 "-w",
1100 "-std=c11",
1101 ]
1102 }
1103
Mike Kleina01c6b02020-04-01 13:47:34 -05001104 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001105 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001106 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1107}
1108
mtklein3cc22182016-08-29 13:26:14 -07001109optional("typeface_freetype") {
1110 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001111
Mike Kleina01c6b02020-04-01 13:47:34 -05001112 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001113 sources = [
1114 "src/ports/SkFontHost_FreeType.cpp",
1115 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001116 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001117 ]
1118}
1119
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001120optional("webp_decode") {
1121 enabled = skia_use_libwebp_decode
1122 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001123
Mike Kleina01c6b02020-04-01 13:47:34 -05001124 deps = [ "//third_party/libwebp" ]
1125 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001126}
1127
1128optional("webp_encode") {
1129 enabled = skia_use_libwebp_encode
1130 public_defines = [ "SK_ENCODE_WEBP" ]
1131
Mike Kleina01c6b02020-04-01 13:47:34 -05001132 deps = [ "//third_party/libwebp" ]
1133 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001134}
1135
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001136optional("wuffs") {
1137 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001138 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001139
Mike Kleina01c6b02020-04-01 13:47:34 -05001140 deps = [ "//third_party/wuffs" ]
1141 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001142}
1143
mtklein63213812016-08-24 09:55:56 -07001144optional("xml") {
1145 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001146 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001147
Mike Kleina01c6b02020-04-01 13:47:34 -05001148 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001149 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001150 "src/svg/SkSVGCanvas.cpp",
1151 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001152 "src/xml/SkDOM.cpp",
1153 "src/xml/SkXMLParser.cpp",
1154 "src/xml/SkXMLWriter.cpp",
1155 ]
1156}
1157
Mike Klein613ad382019-06-06 11:42:02 -05001158optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001159 enabled = skia_enable_skvm_jit_when_possible
1160 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001161 if (skia_vtune_path != "") {
1162 public_defines += [ "SKVM_JIT_VTUNE" ]
1163 public_include_dirs = [ "$skia_vtune_path/include" ]
1164 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1165 }
Mike Klein613ad382019-06-06 11:42:02 -05001166}
1167
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001168if (skia_enable_gpu && skia_generate_workarounds) {
1169 action("workaround_list") {
1170 script = "tools/build_workaround_header.py"
1171
Mike Kleina01c6b02020-04-01 13:47:34 -05001172 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001173
Brian Osmaned5181e2021-07-01 13:54:20 -04001174 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1175 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001176 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001177 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001178
Mike Kleina01c6b02020-04-01 13:47:34 -05001179 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001180 args = [
1181 "--output-file",
1182 "$output_file",
1183 ]
1184
1185 foreach(file, inputs) {
1186 args += [ rebase_path(file, root_build_dir) ]
1187 }
1188 }
1189}
1190
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001191skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001192 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001193 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001194
Mike Klein607b0a72018-11-07 16:17:34 -05001195 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001196 ":fontmgr_FontConfigInterface",
1197 ":fontmgr_android",
1198 ":fontmgr_custom_directory",
1199 ":fontmgr_custom_embedded",
1200 ":fontmgr_custom_empty",
1201 ":fontmgr_fontconfig",
1202 ":fontmgr_fuchsia",
1203 ":fontmgr_mac_ct",
1204 ":fontmgr_win",
1205 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001206 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001207 ":pdf",
1208 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001209 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001210 ]
1211
mtkleinc04ff472016-06-23 10:29:30 -07001212 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001213 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001214 ":arm64",
1215 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001216 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001217 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001218 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001219 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001220 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001221 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001222 ":jpeg_decode",
1223 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001224 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001225 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001226 ":png_decode",
1227 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001228 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001229 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001230 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001231 ":sse2",
1232 ":sse41",
1233 ":sse42",
1234 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001235 ":webp_decode",
1236 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001237 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001238 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001239 ]
1240
Hal Canaryc25f4e92019-02-26 11:54:25 -05001241 public = skia_core_public
1242 public += skia_utils_public
1243 public += skia_effects_public
1244 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001245
mtkleinc04ff472016-06-23 10:29:30 -07001246 sources = []
brettwb9447282016-09-01 14:24:39 -07001247 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001248 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001249 sources += skia_effects_sources
1250 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001251 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001252 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001253 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001254 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001255 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001256 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001257 "src/codec/SkBmpCodec.cpp",
1258 "src/codec/SkBmpMaskCodec.cpp",
1259 "src/codec/SkBmpRLECodec.cpp",
1260 "src/codec/SkBmpStandardCodec.cpp",
1261 "src/codec/SkCodec.cpp",
1262 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001263 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001264 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001265 "src/codec/SkMaskSwizzler.cpp",
1266 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001267 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001268 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001269 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001270 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001271 "src/codec/SkSwizzler.cpp",
1272 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001273 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001274 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001275 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001276 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001277 "src/ports/SkMemory_malloc.cpp",
1278 "src/ports/SkOSFile_stdio.cpp",
1279 "src/sfnt/SkOTTable_name.cpp",
1280 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001281 ]
brettwb9447282016-09-01 14:24:39 -07001282
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001283 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001284 libs = []
1285
Brian Osman946a4cb2021-07-12 17:02:21 -04001286 if (skia_enable_sksl) {
1287 deps += [ ":dehydrate_sksl" ]
1288 sources += skia_sksl_sources
1289 }
1290
mtkleinc04ff472016-06-23 10:29:30 -07001291 if (is_win) {
1292 sources += [
1293 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001294 "src/ports/SkImageEncoder_WIC.cpp",
1295 "src/ports/SkImageGeneratorWIC.cpp",
1296 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001297 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001298 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001299 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001300 "Ole32.lib",
1301 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001302 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001303
1304 if (!skia_enable_winuwp) {
1305 libs += [
1306 "FontSub.lib",
1307 "User32.lib",
1308 "Usp10.lib",
1309 ]
1310 }
mtkleinc04ff472016-06-23 10:29:30 -07001311 } else {
1312 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001313 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001314 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001315 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001316 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001317 }
1318
mtklein7d6fb2c2016-08-25 14:50:44 -07001319 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001320 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001321 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001322 deps += [ "//third_party/cpu-features" ]
1323 }
mtklein06c35c02016-09-20 12:28:12 -07001324 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001325 libs += [
1326 "EGL",
1327 "GLESv2",
1328 "log",
1329 ]
1330 }
1331
Kevin Lubick217056c2018-09-20 17:39:31 -04001332 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001333 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001334 if (skia_use_egl) {
1335 libs += [ "GLESv2" ]
1336 }
mtkleinc04ff472016-06-23 10:29:30 -07001337 }
1338
1339 if (is_mac) {
1340 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001341 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001342 "src/ports/SkImageEncoder_CG.cpp",
1343 "src/ports/SkImageGeneratorCG.cpp",
1344 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001345 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001346 "ApplicationServices.framework",
1347 "OpenGL.framework",
1348 ]
mtkleinc04ff472016-06-23 10:29:30 -07001349 }
abarth6fc8ff02016-07-15 15:15:15 -07001350
Mike Klein7d302882016-11-03 14:06:31 -04001351 if (is_ios) {
1352 sources += [
1353 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001354 "src/ports/SkImageEncoder_CG.cpp",
1355 "src/ports/SkImageGeneratorCG.cpp",
1356 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001357 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001358 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001359 "ImageIO.framework",
1360 "MobileCoreServices.framework",
1361 ]
1362 }
1363
abarth6fc8ff02016-07-15 15:15:15 -07001364 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001365 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001366 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001367
1368 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001369 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001370 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1371 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001372
1373 if (skia_include_multiframe_procs) {
1374 sources += [ "tools/SkSharingProc.cpp" ]
1375 }
mtkleinc04ff472016-06-23 10:29:30 -07001376}
1377
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001378# DebugCanvas used in experimental/wasm-skp-debugger
1379if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001380 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001381 public_configs = [ ":skia_public" ]
1382
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001383 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001384 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001385 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001386 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001387 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001388 "tools/debugger/DrawCommand.cpp",
1389 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001390 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001391 }
1392}
1393
Ben Wagner25eb5342021-03-22 14:07:15 -04001394skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001395 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001396 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001397 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001398
1399 deps = [
1400 ":arm64",
1401 ":armv7",
1402 ":avx",
1403 ":crc32",
1404 ":hsw",
1405 ":none",
1406 ":sse2",
1407 ":sse41",
1408 ":sse42",
1409 ":ssse3",
1410 ]
1411
Kevin Lubickcbcff382018-10-02 09:02:18 -04001412 sources = []
1413 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001414 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001415 sources += [
1416 "src/core/SkAnalyticEdge.cpp",
1417 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001418 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001419 "src/core/SkCubicMap.cpp",
1420 "src/core/SkEdge.cpp",
1421 "src/core/SkEdgeBuilder.cpp",
1422 "src/core/SkEdgeClipper.cpp",
1423 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001424 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001425 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001426 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001427 "src/core/SkMallocPixelRef.cpp",
1428 "src/core/SkMath.cpp",
1429 "src/core/SkMatrix.cpp",
1430 "src/core/SkOpts.cpp",
1431 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001432 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001433 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001434 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001435 "src/core/SkPathEffect.cpp",
1436 "src/core/SkPathMeasure.cpp",
1437 "src/core/SkPathRef.cpp",
1438 "src/core/SkPoint.cpp",
1439 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001440 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001441 "src/core/SkRect.cpp",
1442 "src/core/SkSemaphore.cpp",
1443 "src/core/SkStream.cpp",
1444 "src/core/SkString.cpp",
1445 "src/core/SkStringUtils.cpp",
1446 "src/core/SkStroke.cpp",
1447 "src/core/SkStrokeRec.cpp",
1448 "src/core/SkStrokerPriv.cpp",
1449 "src/core/SkThreadID.cpp",
1450 "src/core/SkUtils.cpp",
1451 "src/effects/SkDashPathEffect.cpp",
1452 "src/effects/SkTrimPathEffect.cpp",
1453 "src/ports/SkDebug_stdio.cpp",
1454 "src/ports/SkMemory_malloc.cpp",
1455 "src/utils/SkDashPath.cpp",
1456 "src/utils/SkParse.cpp",
1457 "src/utils/SkParsePath.cpp",
1458 "src/utils/SkUTF.cpp",
1459 ]
1460}
1461
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001462group("modules") {
1463 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001464 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001465 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001466 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001467 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001468 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001469 ]
1470}
1471
Brian Osmancd28fa62020-07-07 16:01:26 -04001472config("our_vulkan_headers") {
1473 include_dirs = [ "include/third_party/vulkan" ]
1474}
1475
mtkleinc095df52016-08-24 12:23:52 -07001476# Targets guarded by skia_enable_tools may use //third_party freely.
1477if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001478 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001479 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001480 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001481 "include/c",
1482 "include/codec",
1483 "include/config",
1484 "include/core",
1485 "include/docs",
1486 "include/effects",
1487 "include/encode",
1488 "include/gpu",
1489 "include/pathops",
1490 "include/ports",
1491 "include/svg",
1492 "include/utils",
1493 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001494 "modules/particles/include",
1495 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001496 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001497 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001498 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001499 ]
1500
Mike Klein308b5ac2016-12-06 16:03:52 -05001501 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001502 skia_source_set("public") {
1503 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001504 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001505 }
1506
Mike Kleinc36dedf2016-11-18 09:35:28 -05001507 config("skia.h_config") {
1508 include_dirs = [ "$target_gen_dir" ]
1509 }
1510 action("skia.h") {
1511 public_configs = [ ":skia.h_config" ]
1512 skia_h = "$target_gen_dir/skia.h"
1513 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001514
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001515 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1516 [ rebase_path(skia_h, root_build_dir) ] +
1517 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001518 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001519 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001520 }
1521
Brian Osmanc9a42472018-05-31 13:17:12 -04001522 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001523 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001524 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001525 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001526 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001527 "tools/fiddle/draw.cpp",
1528 "tools/fiddle/fiddle_main.cpp",
1529 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001530
1531 if (skia_use_egl) {
1532 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001533 } else {
1534 sources += [ "tools/fiddle/null_context.cpp" ]
1535 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001536 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001537 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001538 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001539 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001540 ":skia",
1541 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001542 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001543 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001544 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001545 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001546 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001547 ]
1548 }
1549 }
1550
Mike Kleine5463e62020-06-11 13:53:53 -05001551 config("cpp14") {
1552 if (is_win) {
1553 cflags_cc = [ "/std:c++14" ]
1554 } else {
1555 cflags_cc = [ "-std=c++14" ]
1556 }
1557 }
1558
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001559 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001560 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001561 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001562 ":our_vulkan_headers",
1563 ":cpp14",
1564 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001565 if (defined(skia_header_target_default_configs)) {
1566 configs += skia_header_target_default_configs
1567 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001568 deps = [
1569 ":skia",
1570 ":skia.h",
1571 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001572 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001573 ]
Stephen White0d70b712019-07-10 15:51:30 -04001574
1575 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001576 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001577 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001578 }
1579
mtkleinc095df52016-08-24 12:23:52 -07001580 template("test_lib") {
1581 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001582 if (defined(invoker.public_defines)) {
1583 defines = invoker.public_defines
1584 }
mtklein25c81d42016-07-27 13:55:26 -07001585 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001586 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001587 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001588 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001589 public_configs = [
1590 ":" + target_name + "_config",
1591 ":skia_private",
1592 ]
1593
1594 if (!defined(deps)) {
1595 deps = []
1596 }
1597 deps += [ ":skia" ]
1598 testonly = true
1599 }
mtklein25c81d42016-07-27 13:55:26 -07001600 }
mtklein25c81d42016-07-27 13:55:26 -07001601
Mike Kleine6682eb2017-01-05 10:54:57 -05001602 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001603 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001604 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001605 forward_variables_from(invoker,
1606 "*",
1607 [
1608 "output_name",
1609 "visibility",
1610 "is_shared_library",
1611 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001612 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001613 extra_configs = [ ":skia_private" ]
1614 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1615 data_sources = [ "resources" ]
1616 if ("True" == exec_script("//gn/checkdir.py",
1617 [ rebase_path("skps", root_build_dir) ],
1618 "trim string")) {
1619 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001620 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001621 if ("True" == exec_script("//gn/checkdir.py",
1622 [ rebase_path("mskps", root_build_dir) ],
1623 "trim string")) {
1624 data_sources += [ "mskps" ]
1625 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001626 }
1627 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001628 # !is_ios
1629
1630 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001631 skia_shared_library("lib" + target_name) {
1632 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001633 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001634 if (!defined(configs)) {
1635 configs = []
1636 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001637 configs += [ ":skia_private" ]
1638 testonly = true
1639 }
1640 } else {
1641 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001642 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001643 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001644 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001645 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001646 if (!defined(configs)) {
1647 configs = []
1648 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001649 configs += [ ":skia_private" ]
1650 testonly = true
1651 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001652 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001653 if (is_android && skia_android_serial != "" && defined(_executable)) {
1654 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001655 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001656 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001657 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001658 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001659 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001660 args = [
1661 rebase_path("$root_build_dir/$_executable"),
1662 skia_android_serial,
1663 rebase_path(_stamp),
1664 ]
1665 testonly = true
1666 }
Mike Klein7d921032017-01-05 12:20:41 -05001667 }
1668 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001669 }
1670
mtkleinc095df52016-08-24 12:23:52 -07001671 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001672 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001673
Mike Klein9e25bb92019-04-29 09:46:36 -05001674 # Bots and even devs may not have Vulkan headers, so put
1675 # include/third_party/vulkan on our path so they're always available.
1676 all_dependent_configs = [ ":our_vulkan_headers" ]
1677
Mike Klein333fb452019-04-24 08:48:11 -05001678 defines = []
1679 if (skia_enable_discrete_gpu) {
1680 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1681 }
1682
Brian Osmanc9a42472018-05-31 13:17:12 -04001683 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001684 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001685 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001686 "tools/gpu/BackendSurfaceFactory.cpp",
1687 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001688 "tools/gpu/BackendTextureImageFactory.cpp",
1689 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001690 "tools/gpu/FlushFinishTracker.cpp",
1691 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001692 "tools/gpu/GrContextFactory.cpp",
1693 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001694 "tools/gpu/ManagedBackendTexture.cpp",
1695 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001696 "tools/gpu/MemoryCache.cpp",
1697 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001698 "tools/gpu/ProxyUtils.cpp",
1699 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001700 "tools/gpu/TestOps.cpp",
1701 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001702 "tools/gpu/YUVUtils.cpp",
1703 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001704 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1705 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001706 "tools/gpu/mock/MockTestContext.cpp",
1707 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001708
1709 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001710 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001711
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001712 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001713 sources +=
1714 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001715 if (is_ios) {
1716 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001717 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001718 } else if (is_mac) {
1719 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001720 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001721 if (skia_use_angle) {
1722 deps += [ "//third_party/angle2" ]
1723 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1724 }
Brian Salomon1171d312020-03-19 08:47:44 -04001725 }
1726
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001727 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1728 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001729 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001730 if (is_android || skia_use_egl) {
1731 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1732 libs += [ "EGL" ]
1733 } else if (is_linux) {
1734 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1735 libs += [
1736 "GLU",
1737 "GL",
1738 "X11",
1739 ]
1740 } else if (is_win) {
1741 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1742 libs += [ "Gdi32.lib" ]
1743 if (target_cpu != "arm64") {
1744 libs += [ "OpenGL32.lib" ]
1745 }
1746 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001747 }
Greg Daniel54200e42018-12-11 17:03:39 -05001748
Brian Osmanc9a42472018-05-31 13:17:12 -04001749 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001750 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001751 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001752 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1753 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001754 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001755 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001756 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1757 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001758 }
1759 if (skia_use_metal) {
1760 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001761 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001762 if (skia_use_direct3d) {
1763 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001764 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001765 }
Stephen White985741a2019-07-18 11:43:45 -04001766 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001767 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001768 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001769 if (is_clang) {
1770 cflags_cc = [ "-Wno-microsoft-cast" ]
1771 }
Stephen White985741a2019-07-18 11:43:45 -04001772 }
Robert Phillips72354b02021-07-06 13:43:56 -04001773 if (!skia_enable_skgpu_v1) {
1774 sources -= [ "tools/gpu/GrTest.cpp" ]
1775 sources -= [ "tools/gpu/TestOps.cpp" ]
1776 sources -= [ "tools/gpu/TestOps.h" ]
1777 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001778
1779 if (is_fuchsia && using_fuchsia_sdk) {
1780 libs +=
1781 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1782 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001783 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001784
mtkleinc095df52016-08-24 12:23:52 -07001785 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001786 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001787 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001788
1789 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001790 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1791 deps = [ ":flags" ]
1792 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001793 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001794 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001795 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1796 deps = [ ":flags" ]
1797 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001798 }
1799 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001800 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1801 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001802 }
1803 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001804 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1805 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001806 }
mtklein25c81d42016-07-27 13:55:26 -07001807
Mike Klein499f0ac2019-03-25 13:00:12 -05001808 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001809 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001810 sources = [
1811 "tools/trace/ChromeTracingTracer.cpp",
1812 "tools/trace/ChromeTracingTracer.h",
1813 "tools/trace/EventTracingPriv.cpp",
1814 "tools/trace/EventTracingPriv.h",
1815 "tools/trace/SkDebugfTracer.cpp",
1816 "tools/trace/SkDebugfTracer.h",
1817 ]
1818 }
1819
mtkleinc095df52016-08-24 12:23:52 -07001820 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001821 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001822 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001823 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001824 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001825 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001826 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001827 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001828 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001829 "tools/MSKPPlayer.cpp",
1830 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001831 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001832 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001833 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001834 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001835 "tools/RuntimeBlendUtils.cpp",
1836 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001837 "tools/SkMetaData.cpp",
1838 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001839 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001840 "tools/SkSharingProc.h",
1841 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001842 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001843 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001844 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001845 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001846 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001847 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001848 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001849 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001850 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001851 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001852 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001853 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001854 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001855 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001856 "tools/fonts/TestEmptyTypeface.h",
1857 "tools/fonts/TestFontMgr.cpp",
1858 "tools/fonts/TestFontMgr.h",
1859 "tools/fonts/TestSVGTypeface.cpp",
1860 "tools/fonts/TestSVGTypeface.h",
1861 "tools/fonts/TestTypeface.cpp",
1862 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001863 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001864 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001865 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001866 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001867 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001868 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001869 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001870 if (target_cpu != "wasm") {
1871 sources += [ "tools/CrashHandler.cpp" ]
1872 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001873 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001874 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001875 if (is_ios) {
1876 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001877 sources += [ "tools/ios_utils.h" ]
1878 if (skia_use_metal) {
1879 sources += [ "tools/AutoreleasePool.mm" ]
1880 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001881 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001882 } else if (is_mac) {
1883 if (skia_use_metal) {
1884 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001885 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001886 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001887 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001888 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001889 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001890
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001891 defines = []
1892 if (skia_tools_require_resources) {
1893 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1894 }
mtkleinc095df52016-08-24 12:23:52 -07001895 deps = [
1896 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001897 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001898 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001899 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001900 }
mtklein25c81d42016-07-27 13:55:26 -07001901
Mike Kleine11e5c12019-04-24 12:46:06 -05001902 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001903 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001904 }
1905
Mike Klein6e744122016-10-27 12:21:40 -04001906 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001907 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001908 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001909 if (skia_use_gl) {
1910 sources += gl_gm_sources
1911 }
Robert Phillips024668c2021-07-01 12:12:52 -04001912 if (!skia_enable_skgpu_v1) {
1913 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04001914 }
mtkleinc095df52016-08-24 12:23:52 -07001915 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001916 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001917 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001918 ":skia",
1919 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001920 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001921 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001922 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001923 "modules/skparagraph",
1924 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001925 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001926 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001927 if (is_skia_dev_build) {
1928 sources += [ "gm/fiddle.cpp" ]
1929 deps += [ ":skia.h" ]
1930 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001931 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001932
1933 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001934 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001935 sources += [ "gm/video_decoder.cpp" ]
1936 }
mtkleinc095df52016-08-24 12:23:52 -07001937 }
mtklein25c81d42016-07-27 13:55:26 -07001938
Ben Wagnerbded42a2021-02-17 22:14:34 -05001939 test_lib("test") {
1940 sources = [
1941 "tests/Test.cpp",
1942 "tests/Test.h",
1943 "tests/TestUtils.cpp",
1944 "tests/TestUtils.h",
1945 ]
1946 deps = [
1947 ":flags",
1948 ":skia",
1949 ":tool_utils",
1950 ]
1951 public_deps = [
1952 ":gpu_tool_utils", # Test.h #includes headers from this target.
1953 ]
1954 }
1955
Mike Klein6e744122016-10-27 12:21:40 -04001956 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001957 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001958 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001959 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001960 if (skia_use_metal) {
1961 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001962 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001963 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001964 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001965 if (skia_use_gl) {
1966 sources += gl_tests_sources
1967 }
Robert Phillips024668c2021-07-01 12:12:52 -04001968 if (!skia_enable_skgpu_v1) {
1969 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04001970 }
mtkleinc095df52016-08-24 12:23:52 -07001971 deps = [
1972 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05001973 ":fontmgr_android_tests",
1974 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00001975 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07001976 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05001977 ":test",
mtkleinc095df52016-08-24 12:23:52 -07001978 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001979 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001980 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001981 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001982 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001983 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05001984 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001985 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001986 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001987 "//third_party/zlib",
1988 ]
1989 }
mtklein2f3416d2016-08-02 16:02:05 -07001990
Mike Klein6e744122016-10-27 12:21:40 -04001991 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001992 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001993 sources = bench_sources
Robert Phillips04f22ea2021-07-22 15:11:03 -04001994 if (!skia_enable_skgpu_v1) {
1995 sources -= skgpu_v1_bench_sources
1996 }
mtkleinc095df52016-08-24 12:23:52 -07001997 deps = [
1998 ":flags",
1999 ":gm",
2000 ":gpu_tool_utils",
2001 ":skia",
2002 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002003 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002004 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002005 ]
2006 }
mtklein2b6870c2016-07-28 14:17:33 -07002007
Mike Reedd62d4062019-06-12 10:20:44 -04002008 test_lib("experimental_xform") {
2009 sources = [
2010 "experimental/xform/SkShape.cpp",
2011 "experimental/xform/SkXform.cpp",
2012 "experimental/xform/XContext.cpp",
2013 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002014 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002015 }
2016
Florin Malitabfe876a2018-09-02 12:33:59 -04002017 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002018 if (skia_enable_skottie) {
2019 test_app("skottie_tool") {
2020 deps = [ "modules/skottie:tool" ]
2021 }
Florin Malita79725d32018-06-05 16:16:57 -04002022 }
Florin Malitab3418102020-10-15 18:10:29 -04002023 test_app("svg_tool") {
2024 deps = [ "modules/svg:tool" ]
2025 }
Florin Malita79725d32018-06-05 16:16:57 -04002026 }
2027
Hal Canary5b39dc82019-04-17 13:29:46 -04002028 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002029 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2030 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002031 }
2032
Chris Dalton2b598902020-03-25 10:50:35 -06002033 import("gn/samples.gni")
2034 test_lib("samples") {
2035 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002036 if (!skia_enable_skgpu_v1) {
2037 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002038 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002039 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002040 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002041 ":flags",
2042 ":gpu_tool_utils",
2043 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002044 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002045 "modules/skparagraph:samples",
2046 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002047 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002048 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002049 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002050 }
Kevin Lubick00398742020-10-08 10:05:07 -04002051 test_lib("hash_and_encode") {
2052 sources = [
2053 "tools/HashAndEncode.cpp",
2054 "tools/HashAndEncode.h",
2055 ]
2056 deps = [
2057 ":flags",
2058 ":skia",
2059 "//third_party/libpng",
2060 ]
2061 }
Chris Dalton2b598902020-03-25 10:50:35 -06002062 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002063 test_app("convert-to-nia") {
2064 sources = [ "tools/convert-to-nia.cpp" ]
2065 deps = [ ":skia" ]
2066 }
Mike Klein7af351a2018-07-27 09:54:43 -04002067 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002068 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002069 deps = [
2070 ":skcms",
2071 ":skia",
2072 ]
2073 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002074 test_app("fm") {
2075 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002076 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002077 "tools/fm/fm.cpp",
2078 ]
2079 deps = [
2080 ":common_flags_aa",
2081 ":common_flags_gpu",
2082 ":flags",
2083 ":gm",
2084 ":gpu_tool_utils",
2085 ":hash_and_encode",
2086 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002087 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002088 ":tool_utils",
2089 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002090 "modules/skottie",
2091 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002092 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002093 ]
2094 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002095 test_app("dm") {
2096 sources = [
2097 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002098 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002099 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002100 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002101 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002102 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002103 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002104 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002105 ":common_flags_aa",
2106 ":common_flags_config",
2107 ":common_flags_gpu",
2108 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002109 ":flags",
2110 ":gm",
2111 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002112 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002113 ":skia",
2114 ":tests",
2115 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002116 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002117 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002118 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002119 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002120 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002121 ]
2122 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002123 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002124 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002125 "experimental/sorttoy/Cmds.cpp",
2126 "experimental/sorttoy/Cmds.h",
2127 "experimental/sorttoy/Fake.cpp",
2128 "experimental/sorttoy/Fake.h",
2129 "experimental/sorttoy/SortKey.h",
2130 "experimental/sorttoy/sorttoy.cpp",
2131 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002132 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002133 deps = [
2134 ":flags",
2135 ":skia",
2136 ":tool_utils",
2137 ]
2138 }
Michael Ludwig30217952020-12-04 12:58:35 -05002139
2140 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002141 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002142 sources = [
2143 "tests/CanvasStateHelpers.cpp",
2144 "tests/CanvasStateHelpers.h",
2145 ]
2146 deps = [ ":skia" ]
2147 }
Brian Osman16adfa32016-10-18 14:42:44 -04002148 }
2149
Mike Kleina8a51ce2018-01-09 12:34:11 -05002150 if (!is_win) {
2151 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002152 sources = [ "tools/remote_demo.cpp" ]
2153 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002154 }
2155 }
2156
Hal Canarye107faa2019-10-23 12:52:33 -04002157 if (!is_win) {
2158 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002159 sources = [ "tools/blob_cache_sim.cpp" ]
2160 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002161 }
2162 }
2163
Mike Kleine6682eb2017-01-05 10:54:57 -05002164 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002165 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002166 deps = [
2167 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002168 ":common_flags_aa",
2169 ":common_flags_config",
2170 ":common_flags_gpu",
2171 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002172 ":flags",
2173 ":gm",
2174 ":gpu_tool_utils",
2175 ":skia",
2176 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002177 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002178 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002179 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002180 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002181 ]
mtklein2b6870c2016-07-28 14:17:33 -07002182 }
halcanary19a97202016-08-03 15:08:04 -07002183
Ravi Mistry10d36c52017-01-31 09:49:18 -05002184 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002185 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002186 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002187 deps = [
2188 ":flags",
2189 ":skia",
2190 ]
2191 }
2192
Mike Reedc0ee21f2019-05-28 16:11:03 -04002193 if (skia_use_ffmpeg) {
2194 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002195 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002196 deps = [
2197 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002198 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002199 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002200 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002201 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002202 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002203 ]
2204 }
2205 }
2206
Brian Osmanc9a42472018-05-31 13:17:12 -04002207 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002208 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002209 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002210 ":common_flags_config",
2211 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002212 ":flags",
2213 ":gpu_tool_utils",
2214 ":skia",
2215 ":tool_utils",
2216 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002217 }
2218
Mike Kleine6682eb2017-01-05 10:54:57 -05002219 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002220 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002221 deps = [
2222 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002223 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002224 ]
halcanary3eee9d92016-09-10 07:01:53 -07002225 }
mtklein046cb562016-09-16 10:23:12 -07002226
Ben Wagner219f3622017-07-17 15:32:25 -04002227 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002228 sources = [ "tools/fonts/create_test_font.cpp" ]
2229 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002230 assert_no_deps = [
2231 # tool_utils requires the output of this app.
2232 ":tool_utils",
2233 ]
2234 }
2235
Florin Malita5d3ff432018-07-31 16:38:43 -04002236 if (skia_use_expat) {
2237 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002238 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002239 deps = [
2240 ":flags",
2241 ":skia",
2242 ":tool_utils",
2243 ]
2244 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002245 }
2246
Mike Kleine6682eb2017-01-05 10:54:57 -05002247 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002248 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002249 deps = [
2250 ":flags",
2251 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002252 ]
mtklein046cb562016-09-16 10:23:12 -07002253 }
mtkleinecbc5262016-09-22 11:51:24 -07002254
Brian Osman6788a542018-12-10 11:56:01 -05002255 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002256 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002257 sources = [
2258 "tools/skiaserve/Request.cpp",
2259 "tools/skiaserve/Response.cpp",
2260 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002261 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2262 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2263 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2264 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2265 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2266 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2267 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2268 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2269 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002270 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2271 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002272 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2273 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2274 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2275 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2276 ]
2277 deps = [
2278 ":flags",
2279 ":gpu_tool_utils",
2280 ":skia",
2281 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002282 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002283 ]
Mike Klein7d302882016-11-03 14:06:31 -04002284 }
mtkleinecbc5262016-09-22 11:51:24 -07002285 }
kjlubick14f984b2016-10-03 11:49:45 -07002286
Mike Kleine6682eb2017-01-05 10:54:57 -05002287 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002288 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002289 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002290 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002291 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002292 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002293 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002294 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002295 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002296 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002297 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002298 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002299 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002300 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002301 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002302 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002303 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002304 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002305 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002306 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002307 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002308 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2309 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002310 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002311 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002312 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002313 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002314 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2315 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002316 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002317 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2318 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002319 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002320 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002321 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002322 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002323 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002324 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002325 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002326 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002327 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002328 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002329 "tools/debugger/DrawCommand.cpp",
2330 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002331 ]
2332 deps = [
2333 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002334 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002335 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002336 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002337 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002338 ]
kjlubick14f984b2016-10-03 11:49:45 -07002339 }
Mike Klein38312422016-10-05 15:41:01 -04002340
Mike Kleine6682eb2017-01-05 10:54:57 -05002341 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002342 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002343 rebase_path("tests/skia_test.cpp"),
2344 rebase_path("tests/Test.cpp"),
2345 ]
caryclark9feb6322016-10-25 08:58:26 -07002346 deps = [
2347 ":flags",
2348 ":gpu_tool_utils",
2349 ":skia",
2350 ":tool_utils",
2351 ]
caryclark9feb6322016-10-25 08:58:26 -07002352 }
2353
Mike Kleine6682eb2017-01-05 10:54:57 -05002354 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002355 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002356 deps = [
2357 ":flags",
2358 ":skia",
2359 ]
Mike Klein38312422016-10-05 15:41:01 -04002360 }
bungemanfe917272016-10-13 17:36:40 -04002361
Mike Kleine6682eb2017-01-05 10:54:57 -05002362 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002363 sources = [
2364 "tools/skdiff/skdiff.cpp",
2365 "tools/skdiff/skdiff_html.cpp",
2366 "tools/skdiff/skdiff_main.cpp",
2367 "tools/skdiff/skdiff_utils.cpp",
2368 ]
2369 deps = [
2370 ":skia",
2371 ":tool_utils",
2372 ]
bungemanfe917272016-10-13 17:36:40 -04002373 }
halcanarya73d76a2016-10-17 13:19:02 -07002374
Mike Kleine6682eb2017-01-05 10:54:57 -05002375 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002376 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002377 deps = [
2378 ":skia",
2379 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002380 ]
halcanarya73d76a2016-10-17 13:19:02 -07002381 }
Brian Osman16adfa32016-10-18 14:42:44 -04002382
Brian Osmanc9a42472018-05-31 13:17:12 -04002383 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002384 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002385 check_includes = false
2386 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002387 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002388 defines =
2389 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002390 sources = [
2391 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002392 "tools/skqp/src/skqp.cpp",
2393 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002394 ]
2395 deps = [
2396 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002397 ":skia",
2398 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002399 ":tool_utils",
2400 ]
2401 }
2402 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002403 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002404 include_dirs = [ "//" ]
2405 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002406 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002407 }
2408 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002409 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002410 deps = [
2411 ":gm",
2412 ":skia",
2413 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002414 ]
2415 }
2416 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002417 if (is_fuchsia) {
2418 # Build a package repository for skqp on Fuchsia.
2419 group("skqp_repo") {
2420 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002421 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002422 }
2423 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002424 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002425 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002426 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002427 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002428 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002429 deps = [
2430 ":skia",
2431 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002432 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002433 ]
2434 libs = [ "android" ]
2435 }
2436 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002437 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002438 test_app("skottie_android") {
2439 is_shared_library = true
2440
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002441 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002442 libs = []
2443
Stan Iliev93151722018-08-02 11:10:52 -04002444 deps = [
2445 ":skia",
2446 "modules/skottie",
2447 ]
2448 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002449
2450 test_app("androidkit") {
2451 is_shared_library = true
2452
Florin Malita2a650cc2021-04-12 13:38:44 -04002453 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002454 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002455 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002456 "modules/androidkit/src/ColorFilters.cpp",
Jorge Betancourt151a6f32021-09-07 16:50:21 -04002457 "modules/androidkit/src/Font.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002458 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002459 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002460 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002461 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002462 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002463 "modules/androidkit/src/Path.cpp",
2464 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002465 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2466 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002467 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002468 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002469 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002470 "modules/androidkit/src/SurfaceThread.cpp",
2471 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002472 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002473 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002474 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002475 libs = [
2476 "android",
2477 "jnigraphics",
2478 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002479
Florin Malita2cc65382021-04-26 21:59:35 -04002480 deps = [
2481 ":sk_app",
2482 ":skia",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002483 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002484 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002485 }
Stan Iliev93151722018-08-02 11:10:52 -04002486 }
Hal Canary75427132017-10-11 16:00:31 -04002487
Hal Canarya9de7602018-01-19 13:08:23 -05002488 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002489 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002490 deps = [
2491 ":gm",
2492 ":skia",
2493 ]
2494 }
2495 test_app("list_gpu_unit_tests") {
2496 sources = [
2497 "dm/DMGpuTestProcs.cpp",
2498 "tools/list_gpu_unit_tests.cpp",
2499 ]
2500 deps = [
2501 ":skia",
2502 ":tests",
2503 ]
2504 }
2505
Brian Osmanc9a42472018-05-31 13:17:12 -04002506 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002507 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002508 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002509 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002510 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002511 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002512 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002513 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002514 "tools/sk_app/CommandSet.h",
2515 "tools/sk_app/DisplayParams.h",
2516 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002517 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002518 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002519 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002520 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002521 ]
2522 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002523 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002524
2525 if (is_android) {
2526 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002527 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002528 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002529 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002530 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002531 "tools/sk_app/android/main_android.cpp",
2532 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002533 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002534 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002535 libs += [ "android" ]
2536 } else if (is_linux) {
2537 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002538 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002539 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002540 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002541 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002542 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002543 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002544 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002545 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002546 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002547 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002548 "X11",
2549 ]
2550 } else if (is_win) {
2551 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002552 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002553 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002554 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002555 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002556 "tools/sk_app/win/main_win.cpp",
2557 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002558 } else if (is_mac) {
2559 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002560 "tools/sk_app/mac/WindowContextFactory_mac.h",
2561 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002562 "tools/sk_app/mac/Window_mac.mm",
2563 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002564 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002565 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002566 "QuartzCore.framework",
2567 "Cocoa.framework",
2568 "Foundation.framework",
2569 ]
2570 } else if (is_ios) {
2571 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002572 "tools/sk_app/ios/WindowContextFactory_ios.h",
2573 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002574 "tools/sk_app/ios/Window_ios.mm",
2575 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002576 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002577 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002578 }
2579
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002580 if (skia_use_gl) {
2581 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002582 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002583 if (is_android) {
2584 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2585 } else if (is_linux) {
2586 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2587 } else if (is_win) {
2588 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2589 if (skia_use_angle) {
2590 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2591 }
2592 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002593 sources += [
2594 "tools/sk_app/mac/GLWindowContext_mac.mm",
2595 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2596 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002597 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002598 sources += [
2599 "tools/sk_app/ios/GLWindowContext_ios.mm",
2600 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2601 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002602 }
2603 }
2604
Brian Osmanc9a42472018-05-31 13:17:12 -04002605 if (skia_use_vulkan) {
2606 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002607 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002608 if (is_android) {
2609 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2610 } else if (is_linux) {
2611 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2612 libs += [ "X11-xcb" ]
2613 } else if (is_win) {
2614 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2615 }
2616 }
2617
Jim Van Verthbe39f712019-02-08 15:36:14 -05002618 if (skia_use_metal) {
2619 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002620 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002621 if (is_mac) {
2622 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002623 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002624 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002625 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002626 }
2627
Jim Van Verth682a2f42020-05-13 16:54:09 -04002628 if (skia_use_direct3d) {
2629 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2630 }
2631
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002632 if (skia_use_dawn) {
2633 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002634 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002635 if (is_linux) {
2636 if (dawn_enable_vulkan) {
2637 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2638 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2639 libs += [ "X11-xcb" ]
2640 }
2641 } else if (is_win) {
2642 if (dawn_enable_d3d12) {
2643 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2644 }
2645 } else if (is_mac) {
2646 if (dawn_enable_metal) {
2647 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2648 }
2649 }
2650 }
2651
Mike Kleina01c6b02020-04-01 13:47:34 -05002652 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002653 if (is_android) {
2654 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002655 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002656 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002657 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002658 }
Brian Osman16adfa32016-10-18 14:42:44 -04002659 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002660
Hal Canary87515122019-03-15 14:22:51 -04002661 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2662 test_app("fiddle_examples") {
2663 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002664 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002665 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002666 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002667 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002668 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002669 cflags = [
2670 "/wd4756", # Overflow in constant arithmetic
2671 "/wd4305", # truncation from 'double' to 'float'
2672 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002673 }
Hal Canary87515122019-03-15 14:22:51 -04002674 deps = [
2675 ":skia",
2676 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002677 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002678 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002679 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002680 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002681 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002682 ]
2683 }
2684 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002685
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002686 # sk_app can work without GL but viewer always runs raster through a GL window context.
2687 if (skia_use_gl) {
2688 test_app("viewer") {
2689 is_shared_library = is_android
2690 sources = [
2691 "tools/viewer/AnimTimer.h",
2692 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002693 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002694 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002695 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002696 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002697 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002698 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002699 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002700 "tools/viewer/MSKPSlide.cpp",
2701 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002702 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002703 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002704 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002705 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002706 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002707 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002708 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002709 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002710 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002711 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002712 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002713 "tools/viewer/SkottieSlide.h",
2714 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002715 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002716 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002717 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002718 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002719 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002720 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002721 "tools/viewer/TouchGesture.cpp",
2722 "tools/viewer/TouchGesture.h",
2723 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002724 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002725 ]
2726 libs = []
2727
2728 deps = [
2729 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002730 ":flags",
2731 ":gm",
2732 ":gpu_tool_utils",
2733 ":samples",
2734 ":sk_app",
2735 ":skia",
2736 ":tool_utils",
2737 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002738 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002739 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002740 "modules/particles",
2741 "modules/skottie",
2742 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002743 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002744 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002745 "//third_party/imgui",
2746 ]
2747 if (skia_use_experimental_xform) {
2748 deps += [ ":experimental_xform" ]
2749 sources += [ "gm/xform.cpp" ]
2750 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002751 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002752 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002753 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002754
Corentin Wallez89d6e792021-03-08 15:25:34 +01002755 #spvtools depends on this but doesn't deps it in.
2756 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002757 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002758 }
Mike Reedd62d4062019-06-12 10:20:44 -04002759 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002760 }
2761
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002762 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002763 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002764 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002765 libs = []
2766
Brian Osmaneff04b52017-11-21 13:18:02 -05002767 deps = [
2768 ":flags",
2769 ":gpu_tool_utils",
2770 ":sk_app",
2771 ":skia",
2772 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002773 ]
2774 }
2775 }
2776
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002777 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2778 action_foreach("generate_mocs") {
2779 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002780 sources = [ "tools/mdbviz/MainWindow.h" ]
2781 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002782 args = [
2783 "$skia_qt_path" + "/bin/moc",
2784 "{{source}}",
2785 "-o",
2786 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2787 ]
2788 }
2789 action_foreach("generate_resources") {
2790 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002791 sources = [ "tools/mdbviz/resources.qrc" ]
2792 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002793 args = [
2794 "$skia_qt_path" + "/bin/rcc",
2795 "{{source}}",
2796 "-o",
2797 "gen/mdbviz/{{source_name_part}}_res.cpp",
2798 ]
2799 }
2800 test_app("mdbviz") {
2801 if (is_win) {
2802 # on Windows we need to disable some exception handling warnings due to the Qt headers
2803 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2804 }
2805 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002806 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002807 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002808 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002809 "tools/debugger/DrawCommand.cpp",
2810 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002811 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002812 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002813 "tools/mdbviz/main.cpp",
2814
2815 # generated files
2816 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2817 "$target_gen_dir/mdbviz/resources_res.cpp",
2818 ]
2819 lib_dirs = [ "$skia_qt_path/lib" ]
2820 libs = [
2821 "Qt5Core.lib",
2822 "Qt5Gui.lib",
2823 "Qt5Widgets.lib",
2824 ]
2825 include_dirs = [
2826 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002827 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002828 "$skia_qt_path/include/QtWidgets",
2829 ]
2830 deps = [
2831 ":generate_mocs",
2832 ":generate_resources",
2833 ":skia",
2834 ]
2835 }
2836 }
2837
Mike Kleine459afd2017-03-03 09:21:30 -05002838 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002839 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002840 sources = [ "$ndk/$ndk_gdbserver" ]
2841 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002842 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002843 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002844
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002845 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002846 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002847 deps = [
2848 ":skia",
2849 "modules/particles",
2850 ]
2851 }
2852
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002853 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002854 test_app("editor") {
2855 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002856 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002857 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002858 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002859
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002860 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002861 sources = [ "tools/image_diff_metric.cpp" ]
2862 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002863 }
Chris Dalton2b598902020-03-25 10:50:35 -06002864
2865 group("modules_testonly") {
2866 testonly = true
2867 deps = []
2868 if (target_cpu == "wasm") {
2869 deps += [ "modules/canvaskit:viewer_wasm" ]
2870 }
2871 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002872
2873 if (skia_build_fuzzers) {
2874 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002875 skia_executable(target_name) {
2876 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002877 check_includes = false
2878 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002879 if (!defined(configs)) {
2880 configs = []
2881 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002882 configs += [ ":skia_private" ]
2883 sources += [
2884 "fuzz/Fuzz.cpp",
2885 "fuzz/FuzzCommon.cpp",
2886 ]
2887 deps += [
2888 ":flags",
2889 ":gpu_tool_utils",
2890 ":skia",
2891 ]
2892 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2893 if (skia_use_libfuzzer_defaults) {
2894 cflags = [ "-fsanitize=fuzzer" ]
2895 ldflags = [ "-fsanitize=fuzzer" ]
2896 }
2897 testonly = true
2898 }
2899 }
2900
2901 libfuzzer_app("region_deserialize") {
2902 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2903 deps = []
2904 }
2905
2906 libfuzzer_app("image_filter_deserialize") {
2907 include_dirs = [
2908 "tools",
2909 "tools/fonts",
2910 ]
2911 sources = [
2912 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2913 "tools/Resources.cpp",
2914 "tools/fonts/TestFontMgr.cpp",
2915 "tools/fonts/TestSVGTypeface.cpp",
2916 "tools/fonts/TestTypeface.cpp",
2917 ]
Florin Malitab3418102020-10-15 18:10:29 -04002918 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002919 }
2920
2921 libfuzzer_app("region_set_path") {
2922 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2923 deps = []
2924 }
2925
2926 libfuzzer_app("textblob_deserialize") {
2927 include_dirs = [
2928 "tools",
2929 "tools/fonts",
2930 ]
2931 sources = [
2932 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2933 "tools/Resources.cpp",
2934 "tools/fonts/TestFontMgr.cpp",
2935 "tools/fonts/TestSVGTypeface.cpp",
2936 "tools/fonts/TestTypeface.cpp",
2937 ]
Florin Malitab3418102020-10-15 18:10:29 -04002938 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002939 }
2940
2941 libfuzzer_app("path_deserialize") {
2942 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2943 deps = []
2944 }
2945
2946 libfuzzer_app("image_decode") {
2947 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2948 deps = []
2949 }
2950
2951 libfuzzer_app("animated_image_decode") {
2952 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2953 deps = []
2954 }
2955
2956 libfuzzer_app("api_create_ddl") {
2957 include_dirs = [
2958 "include",
2959 "include/gpu",
2960 ]
2961 sources = [
2962 "fuzz/FuzzCreateDDL.cpp",
2963 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2964 "tools/Resources.cpp",
2965 "tools/UrlDataManager.cpp",
2966 "tools/debugger/DebugCanvas.cpp",
2967 "tools/debugger/DebugLayerManager.cpp",
2968 "tools/debugger/DrawCommand.cpp",
2969 "tools/debugger/JsonWriteBuffer.cpp",
2970 "tools/fonts/TestFontMgr.cpp",
2971 "tools/fonts/TestSVGTypeface.cpp",
2972 "tools/fonts/TestTypeface.cpp",
2973 ]
2974 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002975 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002976 "//third_party/libpng",
2977 ]
2978 }
2979
2980 libfuzzer_app("api_draw_functions") {
2981 sources = [
2982 "fuzz/FuzzDrawFunctions.cpp",
2983 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2984 ]
2985 deps = []
2986 }
2987
Adlai Hollerccb68662021-02-25 10:28:44 -05002988 libfuzzer_app("api_ddl_threading") {
2989 sources = [
2990 "fuzz/FuzzDDLThreading.cpp",
2991 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
2992 ]
2993 deps = []
2994 }
2995
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002996 libfuzzer_app("api_gradients") {
2997 sources = [
2998 "fuzz/FuzzGradients.cpp",
2999 "fuzz/oss_fuzz/FuzzGradients.cpp",
3000 ]
3001 deps = []
3002 }
3003
3004 libfuzzer_app("api_image_filter") {
3005 include_dirs = [
3006 "tools",
3007 "tools/debugger",
3008 ]
3009 sources = [
3010 "fuzz/FuzzCanvas.cpp",
3011 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3012 "tools/UrlDataManager.cpp",
3013 "tools/debugger/DebugCanvas.cpp",
3014 "tools/debugger/DebugLayerManager.cpp",
3015 "tools/debugger/DrawCommand.cpp",
3016 "tools/debugger/JsonWriteBuffer.cpp",
3017 ]
3018 deps = [ "//third_party/libpng" ]
3019 }
3020
3021 libfuzzer_app("api_path_measure") {
3022 sources = [
3023 "fuzz/FuzzPathMeasure.cpp",
3024 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3025 ]
3026 deps = []
3027 }
3028
3029 libfuzzer_app("api_pathop") {
3030 sources = [
3031 "fuzz/FuzzPathop.cpp",
3032 "fuzz/oss_fuzz/FuzzPathop.cpp",
3033 ]
3034 deps = []
3035 }
3036
Robert Phillips98b066c2021-04-22 10:51:58 -04003037 libfuzzer_app("api_triangulation") {
3038 sources = [
3039 "fuzz/FuzzTriangulation.cpp",
3040 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3041 ]
3042 deps = []
3043 }
3044
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003045 libfuzzer_app("api_raster_n32_canvas") {
3046 include_dirs = [
3047 "tools",
3048 "tools/debugger",
3049 "tools/fonts",
3050 ]
3051 sources = [
3052 "fuzz/FuzzCanvas.cpp",
3053 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3054 "tools/Resources.cpp",
3055 "tools/UrlDataManager.cpp",
3056 "tools/debugger/DebugCanvas.cpp",
3057 "tools/debugger/DebugLayerManager.cpp",
3058 "tools/debugger/DrawCommand.cpp",
3059 "tools/debugger/JsonWriteBuffer.cpp",
3060 "tools/fonts/TestFontMgr.cpp",
3061 "tools/fonts/TestSVGTypeface.cpp",
3062 "tools/fonts/TestTypeface.cpp",
3063 ]
3064 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003065 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003066 "//third_party/libpng",
3067 ]
3068 }
3069
Kevin Lubick7845b972021-03-29 08:07:32 -04003070 libfuzzer_app("api_regionop") {
3071 sources = [
3072 "fuzz/FuzzRegionOp.cpp",
3073 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3074 ]
3075 deps = []
3076 }
3077
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003078 if (skia_use_gl) {
3079 libfuzzer_app("api_mock_gpu_canvas") {
3080 include_dirs = [
3081 "tools",
3082 "tools/debugger",
3083 "tools/fonts",
3084 ]
3085 sources = [
3086 "fuzz/FuzzCanvas.cpp",
3087 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3088 "tools/LsanSuppressions.cpp",
3089 "tools/Resources.cpp",
3090 "tools/UrlDataManager.cpp",
3091 "tools/debugger/DebugCanvas.cpp",
3092 "tools/debugger/DebugLayerManager.cpp",
3093 "tools/debugger/DrawCommand.cpp",
3094 "tools/debugger/JsonWriteBuffer.cpp",
3095 "tools/fonts/TestFontMgr.cpp",
3096 "tools/fonts/TestSVGTypeface.cpp",
3097 "tools/fonts/TestTypeface.cpp",
3098 ]
3099 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003100 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003101 "//third_party/libpng",
3102 ]
3103 }
3104 }
3105
3106 libfuzzer_app("api_null_canvas") {
3107 include_dirs = [
3108 "tools",
3109 "tools/debugger",
3110 "tools/fonts",
3111 ]
3112 sources = [
3113 "fuzz/FuzzCanvas.cpp",
3114 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3115 "tools/Resources.cpp",
3116 "tools/UrlDataManager.cpp",
3117 "tools/debugger/DebugCanvas.cpp",
3118 "tools/debugger/DebugLayerManager.cpp",
3119 "tools/debugger/DrawCommand.cpp",
3120 "tools/debugger/JsonWriteBuffer.cpp",
3121 "tools/fonts/TestFontMgr.cpp",
3122 "tools/fonts/TestSVGTypeface.cpp",
3123 "tools/fonts/TestTypeface.cpp",
3124 ]
3125 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003126 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003127 "//third_party/libpng",
3128 ]
3129 }
3130
Weston Tracey1a771fe2021-02-04 11:09:59 -05003131 libfuzzer_app("api_skparagraph") {
3132 sources = [
3133 "fuzz/FuzzSkParagraph.cpp",
3134 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3135 "tools/Resources.cpp",
3136 ]
3137 deps = [ "modules/skparagraph" ]
3138 }
3139
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003140 libfuzzer_app("api_svg_canvas") {
3141 include_dirs = [
3142 "include",
3143 "include/svg",
3144 ]
3145 sources = [
3146 "fuzz/FuzzCanvas.cpp",
3147 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3148 "tools/Resources.cpp",
3149 "tools/UrlDataManager.cpp",
3150 "tools/debugger/DebugCanvas.cpp",
3151 "tools/debugger/DebugLayerManager.cpp",
3152 "tools/debugger/DrawCommand.cpp",
3153 "tools/debugger/JsonWriteBuffer.cpp",
3154 "tools/fonts/TestFontMgr.cpp",
3155 "tools/fonts/TestSVGTypeface.cpp",
3156 "tools/fonts/TestTypeface.cpp",
3157 ]
3158 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003159 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003160 "//third_party/libpng",
3161 ]
3162 }
3163
3164 libfuzzer_app("png_encoder") {
3165 sources = [
3166 "fuzz/FuzzEncoders.cpp",
3167 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3168 ]
3169 deps = []
3170 }
3171
3172 libfuzzer_app("jpeg_encoder") {
3173 sources = [
3174 "fuzz/FuzzEncoders.cpp",
3175 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3176 ]
3177 deps = []
3178 }
3179
3180 libfuzzer_app("webp_encoder") {
3181 sources = [
3182 "fuzz/FuzzEncoders.cpp",
3183 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3184 ]
3185 deps = []
3186 }
3187
3188 libfuzzer_app("skottie_json") {
3189 sources = [
3190 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3191 "tools/Resources.cpp",
3192 "tools/fonts/TestFontMgr.cpp",
3193 "tools/fonts/TestSVGTypeface.cpp",
3194 "tools/fonts/TestTypeface.cpp",
3195 ]
3196 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003197 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003198 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003199 ]
3200 }
3201
3202 libfuzzer_app("skjson") {
3203 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3204 deps = []
3205 }
3206
3207 libfuzzer_app("api_polyutils") {
3208 sources = [
3209 "fuzz/FuzzPolyUtils.cpp",
3210 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3211 ]
3212 deps = [ ":skia" ]
3213 }
3214
3215 libfuzzer_app("android_codec") {
3216 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3217 deps = []
3218 }
3219
3220 libfuzzer_app("image_decode_incremental") {
3221 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3222 deps = []
3223 }
3224
3225 libfuzzer_app("sksl2glsl") {
3226 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3227 deps = []
3228 }
3229
3230 libfuzzer_app("sksl2spirv") {
3231 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3232 deps = []
3233 }
3234
3235 libfuzzer_app("sksl2metal") {
3236 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3237 deps = []
3238 }
3239
3240 libfuzzer_app("sksl2pipeline") {
3241 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3242 deps = []
3243 }
3244
3245 libfuzzer_app("skdescriptor_deserialize") {
3246 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3247 deps = []
3248 }
3249
3250 libfuzzer_app("svg_dom") {
3251 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003252 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003253 }
3254
3255 libfuzzer_app("skruntimeeffect") {
3256 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3257 deps = []
3258 }
3259
3260 libfuzzer_app("skp") {
3261 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3262 deps = []
3263 }
3264 }
mtklein25c81d42016-07-27 13:55:26 -07003265}
Hal Canary932a2c02019-09-17 10:43:18 -04003266
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003267if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003268 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003269 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003270 }
Hal Canary27483062019-12-06 15:01:08 -05003271}
3272
Hal Canary60ff6512020-01-21 12:39:20 -05003273if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003274 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003275 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003276 }
3277}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003278
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003279skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003280 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3281 include_dirs = [ "." ]
3282 deps = [ ":skia" ]
3283}