blob: 37335b34c79cc6b8cbbbf84027ca7f8346059c83 [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 }
Mike Reed025f7832018-11-12 09:27:05 -050044 if (is_fuchsia) {
45 defines += fuchsia_defines
46 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040047 if (skia_gl_standard == "gles") {
48 defines += [ "SK_ASSUME_GL_ES=1" ]
49 } else if (skia_gl_standard == "gl") {
50 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040051 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040052 defines += [
53 "SK_ASSUME_WEBGL=1",
54 "SK_USE_WEBGL",
55 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040056 }
Robert Phillips3b97aa22021-05-03 11:42:40 -040057 if (skia_enable_nga) {
Robert Phillips7b931f82021-06-09 14:04:05 -040058 defines += [ "GR_NGA=1" ]
59 }
60 if (!skia_enable_oga) {
61 defines += [ "GR_OGA=0" ]
Robert Phillips3b97aa22021-05-03 11:42:40 -040062 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070063
64 # Some older versions of the Clang toolchain change the visibility of
65 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
66 # toolchains suppress the use of this macro till toolchain updates are made.
67 if (is_mac || is_ios) {
68 if (skia_enable_api_available_macro) {
69 defines += [ "SK_ENABLE_API_AVAILABLE" ]
70 } else {
71 cflags_objcc += [ "-Wno-unguarded-availability" ]
72 }
73 }
mtkleinc04ff472016-06-23 10:29:30 -070074}
75
76# Skia internal APIs, used by Skia itself and a few test tools.
77config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060078 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070079
Mike Reeda9e241d2017-05-03 10:52:00 -040080 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050081 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070082 defines += [
83 "SK_GAMMA_EXPONENT=1.4",
84 "SK_GAMMA_CONTRAST=0.0",
85 ]
86 }
Mike Kleinb45d8622019-04-24 14:04:01 -050087 if (is_skia_dev_build) {
88 defines += [
89 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
90 "GR_TEST_UTILS=1",
91 ]
mtklein88a7ac02016-09-14 11:16:49 -070092 }
Brian Salomon789e25e2016-09-30 13:41:03 -040093 libs = []
94 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040095 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050096 defines += [ "SK_ANGLE" ]
97 }
Greg Danielb16beb92020-04-27 14:26:21 +000098 if (skia_use_vma) {
99 defines += [ "SK_USE_VMA" ]
100 }
James Clarkeb8c0dab2021-02-09 06:22:41 -0800101 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -0800102 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800103 }
104}
105
mtkleinc04ff472016-06-23 10:29:30 -0700106# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
107config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600108 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000109 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700110}
111
112skia_library_configs = [
113 ":skia_public",
114 ":skia_private",
115 ":skia_library",
116]
117
mtklein9b8583d2016-08-24 17:32:30 -0700118# Use for CPU-specific Skia code that needs particular compiler flags.
119template("opts") {
120 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400121 skia_source_set(target_name) {
122 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500123 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400124 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700125 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400126 if (defined(invoker.configs)) {
127 configs += invoker.configs
128 }
mtklein9b8583d2016-08-24 17:32:30 -0700129 }
130 } else {
131 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400132 skia_source_set(target_name) {
133 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500134 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700135 forward_variables_from(invoker,
136 "*",
137 [
138 "sources",
139 "cflags",
140 ])
141 }
142 }
anmittala7eaf2e2016-08-17 13:57:26 -0700143}
144
mtklein422310d2016-08-16 18:28:43 -0700145is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700146
mtklein7d6fb2c2016-08-25 14:50:44 -0700147opts("none") {
148 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700149 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700150 cflags = []
151}
152
mtklein7d6fb2c2016-08-25 14:50:44 -0700153opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700154 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700156 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700157}
158
159opts("arm64") {
160 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700162 cflags = []
163}
164
165opts("crc32") {
166 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700168 cflags = [ "-march=armv8-a+crc" ]
169}
170
mtklein9b8583d2016-08-24 17:32:30 -0700171opts("sse2") {
172 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400174 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400175 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
176 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400177 cflags = [ "-msse2" ]
178 }
mtklein9b8583d2016-08-24 17:32:30 -0700179}
mtkleinc04ff472016-06-23 10:29:30 -0700180
mtklein9b8583d2016-08-24 17:32:30 -0700181opts("ssse3") {
182 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700183 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400184 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400185 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
186 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400187 cflags = [ "-mssse3" ]
188 }
mtklein9b8583d2016-08-24 17:32:30 -0700189}
mtkleinc04ff472016-06-23 10:29:30 -0700190
mtklein9b8583d2016-08-24 17:32:30 -0700191opts("sse41") {
192 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700193 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400194 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400195 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
196 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400197 cflags = [ "-msse4.1" ]
198 }
mtklein9b8583d2016-08-24 17:32:30 -0700199}
mtklein4e976072016-08-08 09:06:27 -0700200
mtklein9b8583d2016-08-24 17:32:30 -0700201opts("sse42") {
202 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700203 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400204 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400205 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
206 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400207 cflags = [ "-msse4.2" ]
208 }
mtklein9b8583d2016-08-24 17:32:30 -0700209}
210
211opts("avx") {
212 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700213 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400214 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000215 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400216 } else {
217 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500218 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500219 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500220 }
Mike Klein3eb71212016-10-11 17:08:53 -0400221 }
mtkleinc04ff472016-06-23 10:29:30 -0700222}
223
Mike Klein1b9b7d52018-02-27 10:37:40 -0500224opts("hsw") {
225 enabled = is_x86
226 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400227 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500228 cflags = [ "/arch:AVX2" ]
229 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000230 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600231 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500232 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600233 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500234 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500235}
236
Mike Kleinad56c4c2020-06-05 06:57:30 -0500237opts("skx") {
238 enabled = is_x86
239 sources = skia_opts.skx_sources
240 if (is_win) {
241 cflags = [ "/arch:AVX512" ]
242 } else {
243 cflags = [ "-march=skylake-avx512" ]
244 if (is_mac && is_debug) {
245 cflags += [ "-fno-stack-check" ] # Work around skia:9709
246 }
247 }
248}
249
mtkleinc095df52016-08-24 12:23:52 -0700250# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700251template("optional") {
252 if (invoker.enabled) {
253 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700254 if (defined(invoker.public_defines)) {
255 defines = invoker.public_defines
256 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600257 if (defined(invoker.public_configs)) {
258 configs = invoker.public_configs
259 }
Hal Canary2dad9902019-11-20 16:01:31 -0500260 if (defined(invoker.public_include_dirs)) {
261 include_dirs = invoker.public_include_dirs
262 }
mtklein457b42a2016-08-23 13:56:37 -0700263 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400264 skia_source_set(target_name) {
265 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500266 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400267 configs = skia_library_configs
268
269 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700270 forward_variables_from(invoker,
271 "*",
272 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400273 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700274 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500275 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700276 "sources_when_disabled",
277 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400278 if (defined(invoker.configs)) {
279 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700280 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400281 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700282 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500283 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400284 skia_source_set(target_name + "_tests") {
285 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500286 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400287 configs = skia_library_configs
288
289 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500290 forward_variables_from(invoker,
291 "*",
292 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400293 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500294 "public_defines",
295 "sources",
296 "sources_for_tests",
297 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500298 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400299 if (defined(invoker.configs)) {
300 configs += invoker.configs
301 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500302 testonly = true
303 sources = invoker.sources_for_tests
304 if (!defined(deps)) {
305 deps = []
306 }
307 deps += [ ":test" ]
308 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500309 }
310 }
mtklein457b42a2016-08-23 13:56:37 -0700311 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400312 skia_source_set(target_name) {
313 visibility = [ ":*" ]
314 configs = skia_library_configs
315
316 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700317 forward_variables_from(invoker,
318 "*",
319 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400320 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400321 "public",
mtklein457b42a2016-08-23 13:56:37 -0700322 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400323 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700324 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700325 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400326 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700327 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500328 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700329 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700330 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400331 if (defined(invoker.configs)) {
332 configs += invoker.configs
333 }
mtkleincd01b032016-08-31 04:58:19 -0700334 if (defined(invoker.sources_when_disabled)) {
335 sources = invoker.sources_when_disabled
336 }
mtklein457b42a2016-08-23 13:56:37 -0700337 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500338 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400339 skia_source_set(target_name + "_tests") {
340 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500341 }
342 }
mtkleineb3c4252016-08-23 07:38:09 -0700343 }
mtklein457b42a2016-08-23 13:56:37 -0700344}
mtklein457b42a2016-08-23 13:56:37 -0700345
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400346optional("android_utils") {
347 enabled = skia_enable_android_utils
348
Leon Scroggins III87caae62020-05-04 10:02:45 -0400349 public = [
350 "client_utils/android/BRDAllocator.h",
351 "client_utils/android/BitmapRegionDecoder.h",
352 "client_utils/android/FrontBufferedStream.h",
353 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400354 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400355 sources = [
356 "client_utils/android/BitmapRegionDecoder.cpp",
357 "client_utils/android/FrontBufferedStream.cpp",
358 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400359}
360
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400361group("fontmgr_factory") {
362 public_deps = [ skia_fontmgr_factory ]
363}
364
365optional("fontmgr_empty_factory") {
366 enabled = true
367 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400368}
369
mtkleina45be612016-08-29 15:22:10 -0700370optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500371 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700372
373 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500374 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700375 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700376 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400377 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700378 sources = [
379 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700380 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400381 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700382 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500383 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700384}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400385optional("fontmgr_android_factory") {
386 enabled = skia_enable_fontmgr_android
387 deps = [ ":fontmgr_android" ]
388 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
389}
mtkleina45be612016-08-29 15:22:10 -0700390
mtkleind2e39db2016-09-07 07:52:55 -0700391optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400392 enabled =
393 skia_enable_fontmgr_custom_directory ||
394 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700395
Mike Kleina01c6b02020-04-01 13:47:34 -0500396 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400397 public = [ "src/ports/SkFontMgr_custom.h" ]
398 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
399}
400
401optional("fontmgr_custom_directory") {
402 enabled = skia_enable_fontmgr_custom_directory
403
404 deps = [
405 ":fontmgr_custom",
406 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700407 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400408 public = [ "include/ports/SkFontMgr_directory.h" ]
409 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
410}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400411optional("fontmgr_custom_directory_factory") {
412 enabled = skia_enable_fontmgr_custom_directory
413 deps = [ ":fontmgr_custom_directory" ]
414 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
415}
Ben Wagner75626e42020-06-03 13:20:37 -0400416
417optional("fontmgr_custom_embedded") {
418 enabled = skia_enable_fontmgr_custom_embedded
419
420 deps = [
421 ":fontmgr_custom",
422 ":typeface_freetype",
423 ]
424 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700425}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400426optional("fontmgr_custom_embedded_factory") {
427 enabled = skia_enable_fontmgr_custom_embedded
428 deps = [ ":fontmgr_custom_embedded" ]
429 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
430}
mtkleind2e39db2016-09-07 07:52:55 -0700431
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500432optional("fontmgr_custom_empty") {
433 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500434
Ben Wagner75626e42020-06-03 13:20:37 -0400435 deps = [
436 ":fontmgr_custom",
437 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800438 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400439 public = [ "include/ports/SkFontMgr_empty.h" ]
440 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500441}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400442optional("fontmgr_custom_empty_factory") {
443 enabled = skia_enable_fontmgr_custom_empty
444 deps = [ ":fontmgr_custom_empty" ]
445 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
446}
Hal Canaryff2742e2018-01-30 11:35:47 -0500447
mtklein3cc22182016-08-29 13:26:14 -0700448optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400449 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700450
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400451 # The public header includes fontconfig.h and uses FcConfig*
452 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400453 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400454 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400455 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500456 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400457}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400458optional("fontmgr_fontconfig_factory") {
459 enabled = skia_enable_fontmgr_fontconfig
460 deps = [ ":fontmgr_fontconfig" ]
461 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
462}
Ben Wagner75626e42020-06-03 13:20:37 -0400463
464optional("fontmgr_FontConfigInterface") {
465 enabled = skia_enable_fontmgr_FontConfigInterface
466
467 deps = [
468 ":typeface_freetype",
469 "//third_party:fontconfig",
470 ]
471 public = [
472 "include/ports/SkFontConfigInterface.h",
473 "include/ports/SkFontMgr_FontConfigInterface.h",
474 ]
mtklein3cc22182016-08-29 13:26:14 -0700475 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700476 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700477 "src/ports/SkFontConfigInterface_direct.cpp",
478 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400479 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700480 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700481 ]
482}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400483optional("fontmgr_FontConfigInterface_factory") {
484 enabled = skia_enable_fontmgr_FontConfigInterface
485 deps = [ ":fontmgr_FontConfigInterface" ]
486 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
487}
mtklein3cc22182016-08-29 13:26:14 -0700488
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500489optional("fontmgr_fuchsia") {
490 enabled = skia_enable_fontmgr_fuchsia
491
Chinmay Garde89820762019-05-06 16:44:06 -0700492 deps = []
493
494 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700495 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700496 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500497 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700498 }
Ben Wagner75626e42020-06-03 13:20:37 -0400499 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
500 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500501}
502
Ben Wagner75626e42020-06-03 13:20:37 -0400503optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400504 enabled = skia_use_fonthost_mac
505
Ben Wagner75626e42020-06-03 13:20:37 -0400506 public = [
507 "include/ports/SkFontMgr_mac_ct.h",
508 "include/ports/SkTypeface_mac.h",
509 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400510 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400511 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400512 "src/ports/SkScalerContext_mac_ct.cpp",
513 "src/ports/SkScalerContext_mac_ct.h",
514 "src/ports/SkTypeface_mac_ct.cpp",
515 "src/ports/SkTypeface_mac_ct.h",
516 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000517 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400518
519 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400520 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400521 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
522 "AppKit.framework",
523 "ApplicationServices.framework",
524 ]
525 }
526
527 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400528 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400529 "CoreFoundation.framework",
530 "CoreGraphics.framework",
531 "CoreText.framework",
532
533 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
534 "UIKit.framework",
535 ]
536 }
537}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400538optional("fontmgr_mac_ct_factory") {
539 enabled = skia_use_fonthost_mac
540 deps = [ ":fontmgr_mac_ct" ]
541 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
542}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400543
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500544optional("fontmgr_win") {
545 enabled = skia_enable_fontmgr_win
546
Ben Wagner75626e42020-06-03 13:20:37 -0400547 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500548 sources = [
549 "src/fonts/SkFontMgr_indirect.cpp",
550 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500551 "src/ports/SkScalerContext_win_dw.cpp",
552 "src/ports/SkTypeface_win_dw.cpp",
553 ]
554}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400555optional("fontmgr_win_factory") {
556 enabled = skia_enable_fontmgr_win
557 deps = [ ":fontmgr_win" ]
558 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
559}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500560
561optional("fontmgr_win_gdi") {
562 enabled = skia_enable_fontmgr_win_gdi
563
Ben Wagner75626e42020-06-03 13:20:37 -0400564 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500565 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500566 libs = [ "Gdi32.lib" ]
567}
568
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700569if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400570 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400571 sources = [
572 "src/sksl/lex/Main.cpp",
573 "src/sksl/lex/NFA.cpp",
574 "src/sksl/lex/RegexNode.cpp",
575 "src/sksl/lex/RegexParser.cpp",
576 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500577 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400578 }
579
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700580 action("run_sksllex") {
581 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500582 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
583 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700584
585 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
586 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
587 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500588 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700589 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
590 # confused due to the same file being named by two different paths
591 ]
592 sksllex_path = "$root_out_dir/"
593 sksllex_path += "sksllex"
594 if (host_os == "win") {
595 sksllex_path += ".exe"
596 }
597 args = [
598 rebase_path(sksllex_path),
599 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400600 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700601 rebase_path("src"),
602 ]
603 }
604} else {
605 group("run_sksllex") {
606 }
607}
608
John Stilesd836f842020-09-14 10:21:44 -0400609# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
610if (skia_compile_processors || skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400611 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500612 defines = [
613 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500614 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500615 "SK_ENABLE_SPIRV_VALIDATION",
616 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400617 sources = [
Brian Osman47726a12020-12-17 16:02:08 -0500618 "src/core/SkCpu.cpp",
619 "src/core/SkData.cpp",
620 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400621 "src/core/SkMalloc.cpp",
622 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400623 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500624 "src/core/SkStream.cpp",
625 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500626 "src/core/SkStringUtils.cpp",
Ethan Nicholasd2e09602021-06-10 11:21:59 -0400627 "src/core/SkStringView.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400628 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500629 "src/core/SkUtils.cpp",
630 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400631 "src/gpu/GrBlockAllocator.cpp",
632 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500633 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400634 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500635 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400636 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500637 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400638 ]
Brian Osman47726a12020-12-17 16:02:08 -0500639 if (is_win) {
640 sources += [ "src/ports/SkOSFile_win.cpp" ]
641 } else {
642 sources += [ "src/ports/SkOSFile_posix.cpp" ]
643 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400644 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400645 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500646 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400647 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500648 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100649 "//third_party/externals/spirv-tools:spvtools",
650 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400651 ]
652 }
653
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400654 skslc_path = "$root_out_dir/"
655 if (host_toolchain != default_toolchain_name) {
656 skslc_path += "$host_toolchain/"
657 }
658 skslc_path += "skslc"
659 if (host_os == "win") {
660 skslc_path += ".exe"
661 }
662
Brian Osmandd496172020-08-08 08:17:18 -0400663 action("create_sksl_fp") {
664 script = "gn/create_sksl_fp.py"
665 sources = [
666 "include/private/GrSharedEnums.h",
667 "src/sksl/sksl_fp_raw.sksl",
668 ]
669 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
670 args = [
671 rebase_path(sources[0]),
672 rebase_path(sources[1]),
673 rebase_path(outputs[0]),
674 ]
675 }
676
677 copy("sksl_pre_includes") {
678 sources = [
679 "src/sksl/sksl_frag.sksl",
680 "src/sksl/sksl_geom.sksl",
681 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500682 "src/sksl/sksl_public.sksl",
John Stilesf7f36ae2021-06-08 14:06:22 -0400683 "src/sksl/sksl_rt_blend.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400684 "src/sksl/sksl_rt_colorfilter.sksl",
685 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400686 "src/sksl/sksl_vert.sksl",
687 ]
688 outputs = [ "$root_out_dir/{{source_file_part}}" ]
689 }
690
691 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
692 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
693
694 dehydrate_sksl_outputs = []
695 foreach(src, dehydrate_sksl_sources) {
696 name = get_path_info(src, "name")
697
698 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
699 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
700 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
701 "src/sksl/generated/$name.dehydrated.sksl",
702 target_out_dir) ]
703 }
704
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400705 action("dehydrate_sksl") {
706 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400707 deps = [
708 ":create_sksl_fp",
709 ":sksl_pre_includes",
710 ":skslc(//gn/toolchain:$host_toolchain)",
711 ]
712 sources = dehydrate_sksl_sources
713 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000714 args = [
715 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400716 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000717 ]
Brian Osmandd496172020-08-08 08:17:18 -0400718 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400719 }
John Stilesd836f842020-09-14 10:21:44 -0400720} else {
721 group("dehydrate_sksl") {
722 }
723}
724
725skia_gpu_processor_outputs = []
726if (skia_compile_processors) {
727 foreach(src, skia_gpu_processor_sources) {
728 dir = get_path_info(src, "dir")
729 name = get_path_info(src, "name")
730
731 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
732 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
733 skia_gpu_processor_outputs += [
734 "$target_out_dir/" +
735 rebase_path("$dir/generated/$name.h", target_out_dir),
736 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
737 # confused due to the same file being named by two different paths
738 ]
739 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400740
Ethan Nicholas762466e2017-06-29 10:03:38 -0400741 action("compile_processors") {
742 script = "gn/compile_processors.py"
743 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400744 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400745 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400746 ":skslc(//gn/toolchain:$host_toolchain)",
747 ]
748 sources = skia_gpu_processor_sources
749 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400750 args = [
751 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400752 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400753 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400754 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400755 args += rebase_path(skia_gpu_processor_sources)
756 }
757} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400758 group("compile_processors") {
759 }
John Stilesd836f842020-09-14 10:21:44 -0400760}
761
762if (skia_compile_sksl_tests) {
763 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400764
John Stiles7e248712020-09-24 16:42:09 -0400765 template("compile_sksl") {
766 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
767 action("compile_sksl_${target_name}") {
768 script = "gn/compile_sksl_tests.py"
769 deps = [
770 ":create_sksl_fp",
771 ":sksl_pre_includes",
772 ":skslc(//gn/toolchain:$host_toolchain)",
773 ]
John Stilesda57fc02021-01-22 11:54:30 -0500774 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400775 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500776 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500777 args = [
778 rebase_path(skslc_path),
779 invoker.lang,
780 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500781 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500782 ]
783
John Stilesbfc9be02021-01-22 11:55:48 -0500784 testsDir = get_path_info("tests", "abspath")
785 resourcesDir = get_path_info("resources", "abspath")
786
787 foreach(partialPath, invoker.sources) {
788 dst = testsDir + partialPath
789 src = resourcesDir + partialPath
790
791 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400792
793 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
794 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
795 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
796 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
797 nameTmp = get_path_info(dst, "name")
798 name = get_path_info(nameTmp, "name")
799 ext = get_path_info(nameTmp, "extension")
800 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500801 response_file_contents += rebase_path([
802 src,
803 dir,
804 ])
John Stilesda57fc02021-01-22 11:54:30 -0500805 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500806
John Stilesda57fc02021-01-22 11:54:30 -0500807 foreach(outExtension, invoker.outExtensions) {
John Stilesc3012182020-12-08 15:07:00 -0500808 # SPIR-V uses separate extensions for .vert and .geom shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400809 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500810 outExtension = ".asm.vert"
John Stiles82ab3402021-04-13 17:13:03 -0400811 } else if (ext == "geom" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500812 outExtension = ".asm.geom"
813 }
John Stilesbfc9be02021-01-22 11:55:48 -0500814 outputs +=
815 [ target_out_dir + "/" +
816 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400817 }
818 }
John Stiles7e248712020-09-24 16:42:09 -0400819 }
John Stilesd836f842020-09-14 10:21:44 -0400820 }
John Stiles7e248712020-09-24 16:42:09 -0400821 compile_sksl("fp_tests") {
822 sources = sksl_fp_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500823 outExtensions = [
824 ".cpp",
825 ".h",
John Stiles7e248712020-09-24 16:42:09 -0400826 ]
827 lang = "--fp"
828 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400829 }
John Stiles82ab3402021-04-13 17:13:03 -0400830 compile_sksl("dsl_fp_tests") {
831 sources = sksl_dsl_fp_tests_sources
832 outExtensions = [
John Stiles0a0a50a2021-04-14 09:35:24 -0400833 ".dsl.cpp",
John Stiles82ab3402021-04-13 17:13:03 -0400834 ".h",
835 ]
836 lang = "--dslfp"
837 settings = "--settings"
838 }
John Stiles7e248712020-09-24 16:42:09 -0400839 compile_sksl("glsl_tests") {
840 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500841 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400842 lang = "--glsl"
843 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400844 }
John Stiles7e248712020-09-24 16:42:09 -0400845 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400846 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500847 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400848 lang = "--glsl"
849 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400850 }
John Stilesaeae3a52020-09-25 13:35:58 -0400851 compile_sksl("metal_tests") {
852 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500853 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400854 lang = "--metal"
855 settings = "--settings"
856 }
Brian Osman977feec2020-12-22 11:28:59 -0500857 compile_sksl("skvm_tests") {
858 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500859 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500860 lang = "--skvm"
861 settings = "--settings"
862 }
Brian Osman62b039b2021-02-08 13:49:53 -0500863 compile_sksl("stage_tests") {
864 sources = sksl_stage_tests_sources
865 outExtensions = [ ".stage" ]
866 lang = "--stage"
867 settings = "--settings"
868 }
John Stilesdda1d312020-11-20 16:28:50 -0500869 compile_sksl("spirv_tests") {
870 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500871 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500872 lang = "--spirv"
873 settings = "--settings"
874 }
John Stilesd836f842020-09-14 10:21:44 -0400875} else {
John Stiles7e248712020-09-24 16:42:09 -0400876 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400877 }
John Stiles7e248712020-09-24 16:42:09 -0400878 group("compile_sksl_glsl_tests") {
879 }
880 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400881 }
John Stilesaeae3a52020-09-25 13:35:58 -0400882 group("compile_sksl_metal_tests") {
883 }
Brian Osman977feec2020-12-22 11:28:59 -0500884 group("compile_sksl_skvm_tests") {
885 }
John Stilesdda1d312020-11-20 16:28:50 -0500886 group("compile_sksl_spirv_tests") {
887 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400888}
889
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500890optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700891 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400892 deps = [
893 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400894 ":compile_sksl_fp_tests",
895 ":compile_sksl_glsl_nosettings_tests",
896 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400897 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500898 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500899 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400900 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700901 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400902 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700903 if (skia_generate_workarounds) {
904 deps += [ ":workaround_list" ]
905 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800906 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600907 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400908 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700909
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400910 sources =
911 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400912 if (!skia_enable_ccpr) {
913 sources -= skia_ccpr_sources
914 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
915 }
mtklein06c35c02016-09-20 12:28:12 -0700916
Robert Phillips3b97aa22021-05-03 11:42:40 -0400917 if (skia_enable_nga) {
918 sources += skia_nga_sources
919 }
Robert Phillips7b931f82021-06-09 14:04:05 -0400920 if (!skia_enable_oga) {
921 sources -= skia_oga_sources
922 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400923
Mike Klein703cf5a2016-10-13 17:18:04 -0400924 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400925 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700926
John Rosascoa9b348f2019-11-08 13:18:15 -0800927 if (skia_use_gl) {
928 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400929 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500930 sources += [
931 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
932 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
933 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400934
935 # this lib is required to link against AHardwareBuffer
936 if (defined(ndk_api) && ndk_api >= 26) {
937 libs += [ "android" ]
938 }
939 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500940 sources += [
941 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
942 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
943 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400944 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400945 } else if (skia_use_webgl) {
946 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400947 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500948 sources += [
949 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
950 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
951 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400952 libs += [ "GL" ]
953 } else if (is_mac) {
954 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
955 } else if (is_ios) {
956 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800957 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400958 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
959 if (target_cpu != "arm64") {
960 libs += [ "OpenGL32.lib" ]
961 }
962 } else {
963 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
964 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800965 sources += skia_gl_gpu_sources
966 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400967
mtkleine9fb3d52016-09-20 15:11:46 -0700968 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400969 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000970 if (skia_use_vma) {
971 deps += [ "third_party/vulkanmemoryallocator" ]
972 }
mtkleine9fb3d52016-09-20 15:11:46 -0700973 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700974 if (skia_enable_vulkan_debug_layers) {
975 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
976 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800977 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800978 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700979 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
980 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400981 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700982 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800983 }
mtkleine9fb3d52016-09-20 15:11:46 -0700984 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400985
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400986 if (is_android && (skia_use_gl || skia_use_vulkan)) {
987 # this lib is required to link against AHardwareBuffer
988 if (defined(ndk_api) && ndk_api >= 26) {
989 libs += [ "android" ]
990 }
991 }
992
Stephen White0d70b712019-07-10 15:51:30 -0400993 if (skia_use_dawn) {
994 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400995 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700996 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400997 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700998 "//third_party/externals/dawn/src/dawn:dawn_proc",
999 "//third_party/externals/dawn/src/dawn:dawncpp",
1000 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -04001001 ]
1002 if (dawn_enable_d3d12) {
1003 libs += [
1004 "d3d12.lib",
1005 "dxgi.lib",
1006 "d3dcompiler.lib",
1007 ]
1008 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -04001009 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -04001010 }
1011 }
1012
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001013 if (skia_use_direct3d) {
1014 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -04001015 deps += [
1016 "//third_party/d3d12allocator",
1017 "//third_party/spirv-cross:spirv_cross",
1018 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001019 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001020 if (skia_enable_direct3d_debug_layer) {
1021 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
1022 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001023 libs += [
1024 "d3d12.lib",
1025 "dxgi.lib",
1026 "d3dcompiler.lib",
1027 ]
1028 }
1029
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001030 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -04001031 if (skia_use_metal) {
1032 public_defines += [ "SK_METAL" ]
1033 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -04001034 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001035 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +00001036 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -04001037 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001038
Kevin Lubickf4def342018-10-04 12:52:50 -04001039 if (is_debug) {
1040 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
1041 }
mtklein06c35c02016-09-20 12:28:12 -07001042}
1043
Leon Scroggins III41169202019-01-29 09:29:57 -05001044optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -05001045 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -05001046 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
1047 if ("True" ==
1048 exec_script("gn/checkpath.py",
1049 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
1050 "trim string")) {
1051 public_defines = [ "SK_USE_LIBGIFCODEC" ]
1052 public_include_dirs = [
1053 ".",
1054 skia_libgifcodec_path,
1055 ]
1056 include_dirs = public_include_dirs
1057 import(_libgifcodec_gni_path)
1058 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1059 ".",
1060 skia_libgifcodec_path)
1061 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001062}
1063
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001064optional("heif") {
1065 enabled = skia_use_libheif
1066 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1067
1068 deps = []
1069
Mike Kleina01c6b02020-04-01 13:47:34 -05001070 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001071}
1072
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001073optional("jpeg_decode") {
1074 enabled = skia_use_libjpeg_turbo_decode
1075 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1076
Mike Kleina01c6b02020-04-01 13:47:34 -05001077 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001078 sources = [
1079 "src/codec/SkJpegCodec.cpp",
1080 "src/codec/SkJpegDecoderMgr.cpp",
1081 "src/codec/SkJpegUtility.cpp",
1082 ]
1083}
1084
1085optional("jpeg_encode") {
1086 enabled = skia_use_libjpeg_turbo_encode
1087 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001088
Mike Kleina01c6b02020-04-01 13:47:34 -05001089 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1090 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001091 sources = [
mtklein63213812016-08-24 09:55:56 -07001092 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001093 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001094 ]
1095}
1096
Leon Scroggins III326b9892020-08-05 16:51:10 -04001097optional("ndk_images") {
1098 enabled = skia_use_ndk_images
1099 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1100 sources = [
1101 "src/ports/SkImageEncoder_NDK.cpp",
1102 "src/ports/SkImageGeneratorNDK.cpp",
1103 "src/ports/SkNDKConversions.cpp",
1104 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001105 libs = [ "jnigraphics" ]
1106}
1107
mtklein63213812016-08-24 09:55:56 -07001108optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001109 enabled = skia_use_zlib && skia_enable_pdf
1110 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001111
Mike Kleina01c6b02020-04-01 13:47:34 -05001112 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001113 if (skia_use_libjpeg_turbo_decode) {
1114 deps += [ ":jpeg_decode" ]
1115 }
1116 if (skia_use_libjpeg_turbo_encode) {
1117 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001118 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001119 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001120 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001121 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001122 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1123 deps += [ "//third_party/harfbuzz" ]
1124 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1125 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001126 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001127 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001128 }
1129}
1130
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001131optional("xps") {
1132 enabled = skia_use_xps && is_win
1133 public_defines = [ "SK_SUPPORT_XPS" ]
1134 public = skia_xps_public
1135 sources = skia_xps_sources
1136}
1137
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001138optional("png_decode") {
1139 enabled = skia_use_libpng_decode
1140 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001141
Mike Kleina01c6b02020-04-01 13:47:34 -05001142 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001143 sources = [
1144 "src/codec/SkIcoCodec.cpp",
1145 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001146 ]
1147}
1148
1149optional("png_encode") {
1150 enabled = skia_use_libpng_encode
1151 public_defines = [ "SK_ENCODE_PNG" ]
1152
Mike Kleina01c6b02020-04-01 13:47:34 -05001153 deps = [ "//third_party/libpng" ]
1154 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001155}
1156
scroggof84ad642016-10-31 09:02:57 -07001157optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001158 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001159 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1160
1161 deps = [
1162 "//third_party/dng_sdk",
1163 "//third_party/libjpeg-turbo:libjpeg",
1164 "//third_party/piex",
1165 ]
1166
1167 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1168 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001169 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001170
Mike Kleina01c6b02020-04-01 13:47:34 -05001171 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001172}
1173
Mike Klein852a8cb2018-05-15 10:46:58 -04001174import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001175skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001176 cflags = []
1177 if (!is_win || is_clang) {
1178 cflags += [
1179 "-w",
1180 "-std=c11",
1181 ]
1182 }
1183
Mike Kleina01c6b02020-04-01 13:47:34 -05001184 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001185 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001186 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1187}
1188
mtklein3cc22182016-08-29 13:26:14 -07001189optional("typeface_freetype") {
1190 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001191
Mike Kleina01c6b02020-04-01 13:47:34 -05001192 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001193 sources = [
1194 "src/ports/SkFontHost_FreeType.cpp",
1195 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001196 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001197 ]
1198}
1199
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001200optional("webp_decode") {
1201 enabled = skia_use_libwebp_decode
1202 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001203
Mike Kleina01c6b02020-04-01 13:47:34 -05001204 deps = [ "//third_party/libwebp" ]
1205 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001206}
1207
1208optional("webp_encode") {
1209 enabled = skia_use_libwebp_encode
1210 public_defines = [ "SK_ENCODE_WEBP" ]
1211
Mike Kleina01c6b02020-04-01 13:47:34 -05001212 deps = [ "//third_party/libwebp" ]
1213 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001214}
1215
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001216optional("wuffs") {
1217 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001218 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001219
Mike Kleina01c6b02020-04-01 13:47:34 -05001220 deps = [ "//third_party/wuffs" ]
1221 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001222}
1223
mtklein63213812016-08-24 09:55:56 -07001224optional("xml") {
1225 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001226 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001227
Mike Kleina01c6b02020-04-01 13:47:34 -05001228 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001229 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001230 "src/svg/SkSVGCanvas.cpp",
1231 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001232 "src/xml/SkDOM.cpp",
1233 "src/xml/SkXMLParser.cpp",
1234 "src/xml/SkXMLWriter.cpp",
1235 ]
1236}
1237
Mike Klein613ad382019-06-06 11:42:02 -05001238optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001239 enabled = skia_enable_skvm_jit_when_possible
1240 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001241 if (skia_vtune_path != "") {
1242 public_defines += [ "SKVM_JIT_VTUNE" ]
1243 public_include_dirs = [ "$skia_vtune_path/include" ]
1244 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1245 }
Mike Klein613ad382019-06-06 11:42:02 -05001246}
1247
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001248if (skia_enable_gpu && skia_generate_workarounds) {
1249 action("workaround_list") {
1250 script = "tools/build_workaround_header.py"
1251
Mike Kleina01c6b02020-04-01 13:47:34 -05001252 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001253
1254 # see comments in skia_compile_processors about out dir path shenanigans.
1255 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001256 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001257
Mike Kleina01c6b02020-04-01 13:47:34 -05001258 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001259 args = [
1260 "--output-file",
1261 "$output_file",
1262 ]
1263
1264 foreach(file, inputs) {
1265 args += [ rebase_path(file, root_build_dir) ]
1266 }
1267 }
1268}
1269
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001270skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001271 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001272 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001273
Mike Klein607b0a72018-11-07 16:17:34 -05001274 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001275 ":fontmgr_FontConfigInterface",
1276 ":fontmgr_android",
1277 ":fontmgr_custom_directory",
1278 ":fontmgr_custom_embedded",
1279 ":fontmgr_custom_empty",
1280 ":fontmgr_fontconfig",
1281 ":fontmgr_fuchsia",
1282 ":fontmgr_mac_ct",
1283 ":fontmgr_win",
1284 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001285 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001286 ":pdf",
1287 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001288 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001289 ]
1290
mtkleinc04ff472016-06-23 10:29:30 -07001291 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001292 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001293 ":arm64",
1294 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001295 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001296 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001297 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001298 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001299 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001300 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001301 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001302 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001303 ":jpeg_decode",
1304 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001305 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001306 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001307 ":png_decode",
1308 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001309 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001310 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001311 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001312 ":sse2",
1313 ":sse41",
1314 ":sse42",
1315 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001316 ":webp_decode",
1317 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001318 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001319 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001320 ]
1321
Hal Canaryc25f4e92019-02-26 11:54:25 -05001322 public = skia_core_public
1323 public += skia_utils_public
1324 public += skia_effects_public
1325 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001326
mtkleinc04ff472016-06-23 10:29:30 -07001327 sources = []
brettwb9447282016-09-01 14:24:39 -07001328 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001329 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001330 sources += skia_effects_sources
1331 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001332 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001333 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001334 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001335 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001336 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001337 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001338 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001339 "src/codec/SkBmpCodec.cpp",
1340 "src/codec/SkBmpMaskCodec.cpp",
1341 "src/codec/SkBmpRLECodec.cpp",
1342 "src/codec/SkBmpStandardCodec.cpp",
1343 "src/codec/SkCodec.cpp",
1344 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001345 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001346 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001347 "src/codec/SkMaskSwizzler.cpp",
1348 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001349 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001350 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001351 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001352 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001353 "src/codec/SkSwizzler.cpp",
1354 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001355 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001356 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001357 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001358 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001359 "src/ports/SkMemory_malloc.cpp",
1360 "src/ports/SkOSFile_stdio.cpp",
1361 "src/sfnt/SkOTTable_name.cpp",
1362 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001363 ]
brettwb9447282016-09-01 14:24:39 -07001364
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001365 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001366 libs = []
1367
mtkleinc04ff472016-06-23 10:29:30 -07001368 if (is_win) {
1369 sources += [
1370 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001371 "src/ports/SkImageEncoder_WIC.cpp",
1372 "src/ports/SkImageGeneratorWIC.cpp",
1373 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001374 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001375 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001376 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001377 "Ole32.lib",
1378 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001379 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001380
1381 if (!skia_enable_winuwp) {
1382 libs += [
1383 "FontSub.lib",
1384 "User32.lib",
1385 "Usp10.lib",
1386 ]
1387 }
mtkleinc04ff472016-06-23 10:29:30 -07001388 } else {
1389 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001390 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001391 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001392 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001393 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001394 }
1395
mtklein7d6fb2c2016-08-25 14:50:44 -07001396 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001397 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001398 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001399 deps += [ "//third_party/cpu-features" ]
1400 }
mtklein06c35c02016-09-20 12:28:12 -07001401 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001402 libs += [
1403 "EGL",
1404 "GLESv2",
1405 "log",
1406 ]
1407 }
1408
Kevin Lubick217056c2018-09-20 17:39:31 -04001409 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001410 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001411 if (skia_use_egl) {
1412 libs += [ "GLESv2" ]
1413 }
mtkleinc04ff472016-06-23 10:29:30 -07001414 }
1415
1416 if (is_mac) {
1417 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001418 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001419 "src/ports/SkImageEncoder_CG.cpp",
1420 "src/ports/SkImageGeneratorCG.cpp",
1421 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001422 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001423 "ApplicationServices.framework",
1424 "OpenGL.framework",
1425 ]
mtkleinc04ff472016-06-23 10:29:30 -07001426 }
abarth6fc8ff02016-07-15 15:15:15 -07001427
Mike Klein7d302882016-11-03 14:06:31 -04001428 if (is_ios) {
1429 sources += [
1430 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001431 "src/ports/SkImageEncoder_CG.cpp",
1432 "src/ports/SkImageGeneratorCG.cpp",
1433 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001434 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001435 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001436 "ImageIO.framework",
1437 "MobileCoreServices.framework",
1438 ]
1439 }
1440
abarth6fc8ff02016-07-15 15:15:15 -07001441 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001442 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001443 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001444
1445 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001446 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001447 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1448 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001449
1450 if (skia_include_multiframe_procs) {
1451 sources += [ "tools/SkSharingProc.cpp" ]
1452 }
mtkleinc04ff472016-06-23 10:29:30 -07001453}
1454
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001455# DebugCanvas used in experimental/wasm-skp-debugger
1456if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001457 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001458 public_configs = [ ":skia_public" ]
1459
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001460 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001461 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001462 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001463 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001464 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001465 "tools/debugger/DrawCommand.cpp",
1466 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001467 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001468 }
1469}
1470
Ben Wagner25eb5342021-03-22 14:07:15 -04001471skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001472 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001473 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001474 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001475
1476 deps = [
1477 ":arm64",
1478 ":armv7",
1479 ":avx",
1480 ":crc32",
1481 ":hsw",
1482 ":none",
1483 ":sse2",
1484 ":sse41",
1485 ":sse42",
1486 ":ssse3",
1487 ]
1488
Kevin Lubickcbcff382018-10-02 09:02:18 -04001489 sources = []
1490 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001491 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001492 sources += [
1493 "src/core/SkAnalyticEdge.cpp",
1494 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001495 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001496 "src/core/SkCubicMap.cpp",
1497 "src/core/SkEdge.cpp",
1498 "src/core/SkEdgeBuilder.cpp",
1499 "src/core/SkEdgeClipper.cpp",
1500 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001501 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001502 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001503 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001504 "src/core/SkMallocPixelRef.cpp",
1505 "src/core/SkMath.cpp",
1506 "src/core/SkMatrix.cpp",
1507 "src/core/SkOpts.cpp",
1508 "src/core/SkPaint.cpp",
1509 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001510 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001511 "src/core/SkPathEffect.cpp",
1512 "src/core/SkPathMeasure.cpp",
1513 "src/core/SkPathRef.cpp",
1514 "src/core/SkPoint.cpp",
1515 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001516 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001517 "src/core/SkRect.cpp",
1518 "src/core/SkSemaphore.cpp",
1519 "src/core/SkStream.cpp",
1520 "src/core/SkString.cpp",
1521 "src/core/SkStringUtils.cpp",
1522 "src/core/SkStroke.cpp",
1523 "src/core/SkStrokeRec.cpp",
1524 "src/core/SkStrokerPriv.cpp",
1525 "src/core/SkThreadID.cpp",
1526 "src/core/SkUtils.cpp",
1527 "src/effects/SkDashPathEffect.cpp",
1528 "src/effects/SkTrimPathEffect.cpp",
1529 "src/ports/SkDebug_stdio.cpp",
1530 "src/ports/SkMemory_malloc.cpp",
1531 "src/utils/SkDashPath.cpp",
1532 "src/utils/SkParse.cpp",
1533 "src/utils/SkParsePath.cpp",
1534 "src/utils/SkUTF.cpp",
1535 ]
1536}
1537
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001538group("modules") {
1539 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001540 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001541 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001542 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001543 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001544 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001545 ]
1546}
1547
Julia Lavrova159fd842021-02-24 12:15:08 -05001548group("experimental") {
1549 deps = [ "experimental/sktext" ]
1550}
1551
Brian Osmancd28fa62020-07-07 16:01:26 -04001552config("our_vulkan_headers") {
1553 include_dirs = [ "include/third_party/vulkan" ]
1554}
1555
mtkleinc095df52016-08-24 12:23:52 -07001556# Targets guarded by skia_enable_tools may use //third_party freely.
1557if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001558 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001559 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001560 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001561 "include/c",
1562 "include/codec",
1563 "include/config",
1564 "include/core",
1565 "include/docs",
1566 "include/effects",
1567 "include/encode",
1568 "include/gpu",
1569 "include/pathops",
1570 "include/ports",
1571 "include/svg",
1572 "include/utils",
1573 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001574 "modules/particles/include",
1575 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001576 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001577 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001578 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001579 ]
1580
Mike Klein308b5ac2016-12-06 16:03:52 -05001581 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001582 skia_source_set("public") {
1583 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001584 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001585 }
1586
Mike Kleinc36dedf2016-11-18 09:35:28 -05001587 config("skia.h_config") {
1588 include_dirs = [ "$target_gen_dir" ]
1589 }
1590 action("skia.h") {
1591 public_configs = [ ":skia.h_config" ]
1592 skia_h = "$target_gen_dir/skia.h"
1593 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001594
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001595 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1596 [ rebase_path(skia_h, root_build_dir) ] +
1597 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001598 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001599 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001600 }
1601
Brian Osmanc9a42472018-05-31 13:17:12 -04001602 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001603 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001604 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001605 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001606 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001607 "tools/fiddle/draw.cpp",
1608 "tools/fiddle/fiddle_main.cpp",
1609 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001610
1611 if (skia_use_egl) {
1612 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001613 } else {
1614 sources += [ "tools/fiddle/null_context.cpp" ]
1615 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001616 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001617 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001618 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001619 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001620 ":skia",
1621 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001622 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001623 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001624 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001625 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001626 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001627 ]
1628 }
1629 }
1630
Mike Kleine5463e62020-06-11 13:53:53 -05001631 config("cpp14") {
1632 if (is_win) {
1633 cflags_cc = [ "/std:c++14" ]
1634 } else {
1635 cflags_cc = [ "-std=c++14" ]
1636 }
1637 }
1638
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001639 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001640 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001641 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001642 ":our_vulkan_headers",
1643 ":cpp14",
1644 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001645 if (defined(skia_header_target_default_configs)) {
1646 configs += skia_header_target_default_configs
1647 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001648 deps = [
1649 ":skia",
1650 ":skia.h",
1651 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001652 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001653 ]
Stephen White0d70b712019-07-10 15:51:30 -04001654
1655 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001656 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001657 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001658 }
1659
mtkleinc095df52016-08-24 12:23:52 -07001660 template("test_lib") {
1661 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001662 if (defined(invoker.public_defines)) {
1663 defines = invoker.public_defines
1664 }
mtklein25c81d42016-07-27 13:55:26 -07001665 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001666 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001667 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001668 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001669 public_configs = [
1670 ":" + target_name + "_config",
1671 ":skia_private",
1672 ]
1673
1674 if (!defined(deps)) {
1675 deps = []
1676 }
1677 deps += [ ":skia" ]
1678 testonly = true
1679 }
mtklein25c81d42016-07-27 13:55:26 -07001680 }
mtklein25c81d42016-07-27 13:55:26 -07001681
Mike Kleine6682eb2017-01-05 10:54:57 -05001682 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001683 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001684 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001685 forward_variables_from(invoker,
1686 "*",
1687 [
1688 "output_name",
1689 "visibility",
1690 "is_shared_library",
1691 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001692 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001693 extra_configs = [ ":skia_private" ]
1694 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1695 data_sources = [ "resources" ]
1696 if ("True" == exec_script("//gn/checkdir.py",
1697 [ rebase_path("skps", root_build_dir) ],
1698 "trim string")) {
1699 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001700 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001701 if ("True" == exec_script("//gn/checkdir.py",
1702 [ rebase_path("mskps", root_build_dir) ],
1703 "trim string")) {
1704 data_sources += [ "mskps" ]
1705 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001706 }
1707 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001708 # !is_ios
1709
1710 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001711 skia_shared_library("lib" + target_name) {
1712 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001713 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001714 if (!defined(configs)) {
1715 configs = []
1716 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001717 configs += [ ":skia_private" ]
1718 testonly = true
1719 }
1720 } else {
1721 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001722 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001723 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001724 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001725 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001726 if (!defined(configs)) {
1727 configs = []
1728 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001729 configs += [ ":skia_private" ]
1730 testonly = true
1731 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001732 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001733 if (is_android && skia_android_serial != "" && defined(_executable)) {
1734 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001735 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001736 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001737 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001738 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001739 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001740 args = [
1741 rebase_path("$root_build_dir/$_executable"),
1742 skia_android_serial,
1743 rebase_path(_stamp),
1744 ]
1745 testonly = true
1746 }
Mike Klein7d921032017-01-05 12:20:41 -05001747 }
1748 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001749 }
1750
mtkleinc095df52016-08-24 12:23:52 -07001751 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001752 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001753
Mike Klein9e25bb92019-04-29 09:46:36 -05001754 # Bots and even devs may not have Vulkan headers, so put
1755 # include/third_party/vulkan on our path so they're always available.
1756 all_dependent_configs = [ ":our_vulkan_headers" ]
1757
Mike Klein333fb452019-04-24 08:48:11 -05001758 defines = []
1759 if (skia_enable_discrete_gpu) {
1760 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1761 }
1762
Brian Osmanc9a42472018-05-31 13:17:12 -04001763 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001764 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001765 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001766 "tools/gpu/BackendSurfaceFactory.cpp",
1767 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001768 "tools/gpu/BackendTextureImageFactory.cpp",
1769 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001770 "tools/gpu/FlushFinishTracker.cpp",
1771 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001772 "tools/gpu/GrContextFactory.cpp",
1773 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001774 "tools/gpu/ManagedBackendTexture.cpp",
1775 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001776 "tools/gpu/MemoryCache.cpp",
1777 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001778 "tools/gpu/ProxyUtils.cpp",
1779 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001780 "tools/gpu/TestOps.cpp",
1781 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001782 "tools/gpu/YUVUtils.cpp",
1783 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001784 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1785 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001786 "tools/gpu/mock/MockTestContext.cpp",
1787 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001788
1789 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001790 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001791
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001792 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001793 sources +=
1794 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001795 if (is_ios) {
1796 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001797 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001798 } else if (is_mac) {
1799 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001800 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001801 if (skia_use_angle) {
1802 deps += [ "//third_party/angle2" ]
1803 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1804 }
Brian Salomon1171d312020-03-19 08:47:44 -04001805 }
1806
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001807 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1808 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001809 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001810 if (is_android || skia_use_egl) {
1811 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1812 libs += [ "EGL" ]
1813 } else if (is_linux) {
1814 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1815 libs += [
1816 "GLU",
1817 "GL",
1818 "X11",
1819 ]
1820 } else if (is_win) {
1821 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1822 libs += [ "Gdi32.lib" ]
1823 if (target_cpu != "arm64") {
1824 libs += [ "OpenGL32.lib" ]
1825 }
1826 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001827 }
Greg Daniel54200e42018-12-11 17:03:39 -05001828
Brian Osmanc9a42472018-05-31 13:17:12 -04001829 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001830 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001831 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001832 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1833 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001834 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001835 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001836 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1837 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001838 }
1839 if (skia_use_metal) {
1840 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001841 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001842 if (skia_use_direct3d) {
1843 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001844 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001845 }
Stephen White985741a2019-07-18 11:43:45 -04001846 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001847 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001848 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001849 if (is_clang) {
1850 cflags_cc = [ "-Wno-microsoft-cast" ]
1851 }
Stephen White985741a2019-07-18 11:43:45 -04001852 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001853
1854 if (is_fuchsia && using_fuchsia_sdk) {
1855 libs +=
1856 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1857 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001858 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001859
mtkleinc095df52016-08-24 12:23:52 -07001860 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001861 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001862 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001863
1864 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001865 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1866 deps = [ ":flags" ]
1867 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001868 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001869 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001870 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1871 deps = [ ":flags" ]
1872 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001873 }
1874 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001875 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1876 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001877 }
1878 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001879 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1880 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001881 }
mtklein25c81d42016-07-27 13:55:26 -07001882
Mike Klein499f0ac2019-03-25 13:00:12 -05001883 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001884 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001885 sources = [
1886 "tools/trace/ChromeTracingTracer.cpp",
1887 "tools/trace/ChromeTracingTracer.h",
1888 "tools/trace/EventTracingPriv.cpp",
1889 "tools/trace/EventTracingPriv.h",
1890 "tools/trace/SkDebugfTracer.cpp",
1891 "tools/trace/SkDebugfTracer.h",
1892 ]
1893 }
1894
mtkleinc095df52016-08-24 12:23:52 -07001895 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001896 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001897 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001898 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001899 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001900 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001901 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001902 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001903 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001904 "tools/MSKPPlayer.cpp",
1905 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001906 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001907 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001908 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001909 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001910 "tools/SkMetaData.cpp",
1911 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001912 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001913 "tools/SkSharingProc.h",
1914 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001915 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001916 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001917 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001918 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001919 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001920 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001921 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001922 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001923 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001924 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001925 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001926 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001927 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001928 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001929 "tools/fonts/TestEmptyTypeface.h",
1930 "tools/fonts/TestFontMgr.cpp",
1931 "tools/fonts/TestFontMgr.h",
1932 "tools/fonts/TestSVGTypeface.cpp",
1933 "tools/fonts/TestSVGTypeface.h",
1934 "tools/fonts/TestTypeface.cpp",
1935 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001936 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001937 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001938 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001939 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001940 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001941 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001942 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001943 if (target_cpu != "wasm") {
1944 sources += [ "tools/CrashHandler.cpp" ]
1945 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001946 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001947 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001948 if (is_ios) {
1949 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001950 sources += [ "tools/ios_utils.h" ]
1951 if (skia_use_metal) {
1952 sources += [ "tools/AutoreleasePool.mm" ]
1953 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001954 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001955 } else if (is_mac) {
1956 if (skia_use_metal) {
1957 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001958 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001959 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001960 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001961 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001962 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001963
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001964 defines = []
1965 if (skia_tools_require_resources) {
1966 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1967 }
mtkleinc095df52016-08-24 12:23:52 -07001968 deps = [
1969 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001970 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001971 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001972 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001973 }
mtklein25c81d42016-07-27 13:55:26 -07001974
Mike Kleine11e5c12019-04-24 12:46:06 -05001975 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001976 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001977 }
1978
Mike Klein6e744122016-10-27 12:21:40 -04001979 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001980 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001981 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001982 if (skia_use_gl) {
1983 sources += gl_gm_sources
1984 }
Robert Phillips3674f582021-06-16 12:05:54 -04001985 if (!skia_enable_oga) {
1986 sources -= oga_gm_sources
1987 }
mtkleinc095df52016-08-24 12:23:52 -07001988 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001989 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001990 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001991 ":skia",
1992 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001993 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001994 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001995 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001996 "modules/skparagraph",
1997 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001998 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001999 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04002000 if (is_skia_dev_build) {
2001 sources += [ "gm/fiddle.cpp" ]
2002 deps += [ ":skia.h" ]
2003 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002004 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04002005
2006 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04002007 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04002008 sources += [ "gm/video_decoder.cpp" ]
2009 }
mtkleinc095df52016-08-24 12:23:52 -07002010 }
mtklein25c81d42016-07-27 13:55:26 -07002011
Ben Wagnerbded42a2021-02-17 22:14:34 -05002012 test_lib("test") {
2013 sources = [
2014 "tests/Test.cpp",
2015 "tests/Test.h",
2016 "tests/TestUtils.cpp",
2017 "tests/TestUtils.h",
2018 ]
2019 deps = [
2020 ":flags",
2021 ":skia",
2022 ":tool_utils",
2023 ]
2024 public_deps = [
2025 ":gpu_tool_utils", # Test.h #includes headers from this target.
2026 ]
2027 }
2028
Mike Klein6e744122016-10-27 12:21:40 -04002029 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002030 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002031 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002032 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002033 if (skia_use_metal) {
2034 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002035 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002036 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002037 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002038 if (skia_use_gl) {
2039 sources += gl_tests_sources
2040 }
Robert Phillips1ca0da42021-06-14 15:27:19 -04002041 if (!skia_enable_oga) {
2042 sources -= oga_tests_sources
2043 }
mtkleinc095df52016-08-24 12:23:52 -07002044 deps = [
2045 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002046 ":fontmgr_android_tests",
2047 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002048 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002049 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002050 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002051 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002052 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002053 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002054 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002055 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002056 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002057 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002058 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002059 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002060 "//third_party/zlib",
2061 ]
2062 }
mtklein2f3416d2016-08-02 16:02:05 -07002063
Mike Klein6e744122016-10-27 12:21:40 -04002064 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002065 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002066 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07002067 deps = [
2068 ":flags",
2069 ":gm",
2070 ":gpu_tool_utils",
2071 ":skia",
2072 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002073 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002074 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002075 ]
2076 }
mtklein2b6870c2016-07-28 14:17:33 -07002077
Mike Reedd62d4062019-06-12 10:20:44 -04002078 test_lib("experimental_xform") {
2079 sources = [
2080 "experimental/xform/SkShape.cpp",
2081 "experimental/xform/SkXform.cpp",
2082 "experimental/xform/XContext.cpp",
2083 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002084 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002085 }
2086
Florin Malitabfe876a2018-09-02 12:33:59 -04002087 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002088 if (skia_enable_skottie) {
2089 test_app("skottie_tool") {
2090 deps = [ "modules/skottie:tool" ]
2091 }
Florin Malita79725d32018-06-05 16:16:57 -04002092 }
Florin Malitab3418102020-10-15 18:10:29 -04002093 test_app("svg_tool") {
2094 deps = [ "modules/svg:tool" ]
2095 }
Florin Malita79725d32018-06-05 16:16:57 -04002096 }
2097
Hal Canary5b39dc82019-04-17 13:29:46 -04002098 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002099 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2100 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002101 }
2102
Chris Dalton2b598902020-03-25 10:50:35 -06002103 import("gn/samples.gni")
2104 test_lib("samples") {
2105 sources = samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002106 if (!skia_enable_oga) {
2107 sources -= oga_samples_sources
2108 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002109 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002110 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002111 ":flags",
2112 ":gpu_tool_utils",
2113 ":xml",
Julia Lavrova159fd842021-02-24 12:15:08 -05002114 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002115 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002116 "modules/skparagraph:samples",
2117 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002118 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002119 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002120 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002121 }
Kevin Lubick00398742020-10-08 10:05:07 -04002122 test_lib("hash_and_encode") {
2123 sources = [
2124 "tools/HashAndEncode.cpp",
2125 "tools/HashAndEncode.h",
2126 ]
2127 deps = [
2128 ":flags",
2129 ":skia",
2130 "//third_party/libpng",
2131 ]
2132 }
Chris Dalton2b598902020-03-25 10:50:35 -06002133 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002134 test_app("convert-to-nia") {
2135 sources = [ "tools/convert-to-nia.cpp" ]
2136 deps = [ ":skia" ]
2137 }
Mike Klein7af351a2018-07-27 09:54:43 -04002138 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002139 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002140 deps = [
2141 ":skcms",
2142 ":skia",
2143 ]
2144 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002145 test_app("fm") {
2146 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002147 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002148 "tools/fm/fm.cpp",
2149 ]
2150 deps = [
2151 ":common_flags_aa",
2152 ":common_flags_gpu",
2153 ":flags",
2154 ":gm",
2155 ":gpu_tool_utils",
2156 ":hash_and_encode",
2157 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002158 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002159 ":tool_utils",
2160 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002161 "modules/skottie",
2162 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002163 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002164 ]
2165 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002166 test_app("dm") {
2167 sources = [
2168 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002169 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002170 "dm/DMJsonWriter.cpp",
2171 "dm/DMSrcSink.cpp",
2172 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002173 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002174 ":common_flags_aa",
2175 ":common_flags_config",
2176 ":common_flags_gpu",
2177 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002178 ":flags",
2179 ":gm",
2180 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002181 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002182 ":skia",
2183 ":tests",
2184 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002185 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002186 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002187 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002188 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002189 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002190 ]
2191 }
Robert Phillips4b732282021-05-20 09:45:10 -04002192 test_app("ngatoy") {
2193 sources = [
2194 "experimental/ngatoy/Cmds.cpp",
2195 "experimental/ngatoy/Cmds.h",
2196 "experimental/ngatoy/Fake.cpp",
2197 "experimental/ngatoy/Fake.h",
2198 "experimental/ngatoy/SortKey.h",
2199 "experimental/ngatoy/ngatoy.cpp",
Robert Phillips1f6ca3a2021-06-09 14:11:00 -04002200 "experimental/ngatoy/ngatypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002201 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002202 deps = [
2203 ":flags",
2204 ":skia",
2205 ":tool_utils",
2206 ]
2207 }
Michael Ludwig30217952020-12-04 12:58:35 -05002208
2209 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002210 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002211 sources = [
2212 "tests/CanvasStateHelpers.cpp",
2213 "tests/CanvasStateHelpers.h",
2214 ]
2215 deps = [ ":skia" ]
2216 }
Brian Osman16adfa32016-10-18 14:42:44 -04002217 }
2218
Mike Kleina8a51ce2018-01-09 12:34:11 -05002219 if (!is_win) {
2220 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002221 sources = [ "tools/remote_demo.cpp" ]
2222 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002223 }
2224 }
2225
Hal Canarye107faa2019-10-23 12:52:33 -04002226 if (!is_win) {
2227 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002228 sources = [ "tools/blob_cache_sim.cpp" ]
2229 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002230 }
2231 }
2232
Mike Kleine6682eb2017-01-05 10:54:57 -05002233 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002234 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002235 deps = [
2236 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002237 ":common_flags_aa",
2238 ":common_flags_config",
2239 ":common_flags_gpu",
2240 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002241 ":flags",
2242 ":gm",
2243 ":gpu_tool_utils",
2244 ":skia",
2245 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002246 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002247 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002248 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002249 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002250 ]
mtklein2b6870c2016-07-28 14:17:33 -07002251 }
halcanary19a97202016-08-03 15:08:04 -07002252
Ravi Mistry10d36c52017-01-31 09:49:18 -05002253 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002254 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002255 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002256 deps = [
2257 ":flags",
2258 ":skia",
2259 ]
2260 }
2261
Mike Reedc0ee21f2019-05-28 16:11:03 -04002262 if (skia_use_ffmpeg) {
2263 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002264 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002265 deps = [
2266 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002267 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002268 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002269 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002270 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002271 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002272 ]
2273 }
2274 }
2275
Brian Osmanc9a42472018-05-31 13:17:12 -04002276 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002277 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002278 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002279 ":common_flags_config",
2280 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002281 ":flags",
2282 ":gpu_tool_utils",
2283 ":skia",
2284 ":tool_utils",
2285 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002286 }
2287
Mike Kleine6682eb2017-01-05 10:54:57 -05002288 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002289 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002290 deps = [
2291 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002292 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002293 ]
halcanary3eee9d92016-09-10 07:01:53 -07002294 }
mtklein046cb562016-09-16 10:23:12 -07002295
Ben Wagner219f3622017-07-17 15:32:25 -04002296 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002297 sources = [ "tools/fonts/create_test_font.cpp" ]
2298 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002299 assert_no_deps = [
2300 # tool_utils requires the output of this app.
2301 ":tool_utils",
2302 ]
2303 }
2304
Florin Malita5d3ff432018-07-31 16:38:43 -04002305 if (skia_use_expat) {
2306 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002307 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002308 deps = [
2309 ":flags",
2310 ":skia",
2311 ":tool_utils",
2312 ]
2313 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002314 }
2315
Mike Kleine6682eb2017-01-05 10:54:57 -05002316 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002317 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002318 deps = [
2319 ":flags",
2320 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002321 ]
mtklein046cb562016-09-16 10:23:12 -07002322 }
mtkleinecbc5262016-09-22 11:51:24 -07002323
Brian Osman6788a542018-12-10 11:56:01 -05002324 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002325 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002326 sources = [
2327 "tools/skiaserve/Request.cpp",
2328 "tools/skiaserve/Response.cpp",
2329 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002330 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2331 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2332 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2333 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2334 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2335 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2336 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2337 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2338 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002339 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2340 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002341 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2342 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2343 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2344 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2345 ]
2346 deps = [
2347 ":flags",
2348 ":gpu_tool_utils",
2349 ":skia",
2350 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002351 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002352 ]
Mike Klein7d302882016-11-03 14:06:31 -04002353 }
mtkleinecbc5262016-09-22 11:51:24 -07002354 }
kjlubick14f984b2016-10-03 11:49:45 -07002355
Mike Kleine6682eb2017-01-05 10:54:57 -05002356 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002357 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002358 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002359 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002360 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002361 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002362 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002363 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002364 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002365 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002366 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002367 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002368 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002369 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002370 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002371 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002372 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002373 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002374 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002375 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002376 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002377 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2378 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002379 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002380 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002381 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002382 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002383 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2384 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002385 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002386 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2387 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002388 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002389 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002390 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002391 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002392 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002393 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002394 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002395 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002396 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002397 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002398 "tools/debugger/DrawCommand.cpp",
2399 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002400 ]
2401 deps = [
2402 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002403 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002404 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002405 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002406 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002407 ]
kjlubick14f984b2016-10-03 11:49:45 -07002408 }
Mike Klein38312422016-10-05 15:41:01 -04002409
Mike Kleine6682eb2017-01-05 10:54:57 -05002410 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002411 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002412 rebase_path("tests/skia_test.cpp"),
2413 rebase_path("tests/Test.cpp"),
2414 ]
caryclark9feb6322016-10-25 08:58:26 -07002415 deps = [
2416 ":flags",
2417 ":gpu_tool_utils",
2418 ":skia",
2419 ":tool_utils",
2420 ]
caryclark9feb6322016-10-25 08:58:26 -07002421 }
2422
Mike Kleine6682eb2017-01-05 10:54:57 -05002423 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002424 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002425 deps = [
2426 ":flags",
2427 ":skia",
2428 ]
Mike Klein38312422016-10-05 15:41:01 -04002429 }
bungemanfe917272016-10-13 17:36:40 -04002430
Mike Kleine6682eb2017-01-05 10:54:57 -05002431 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002432 sources = [
2433 "tools/skdiff/skdiff.cpp",
2434 "tools/skdiff/skdiff_html.cpp",
2435 "tools/skdiff/skdiff_main.cpp",
2436 "tools/skdiff/skdiff_utils.cpp",
2437 ]
2438 deps = [
2439 ":skia",
2440 ":tool_utils",
2441 ]
bungemanfe917272016-10-13 17:36:40 -04002442 }
halcanarya73d76a2016-10-17 13:19:02 -07002443
Mike Kleine6682eb2017-01-05 10:54:57 -05002444 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002445 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002446 deps = [
2447 ":skia",
2448 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002449 ]
halcanarya73d76a2016-10-17 13:19:02 -07002450 }
Brian Osman16adfa32016-10-18 14:42:44 -04002451
Brian Osmanc9a42472018-05-31 13:17:12 -04002452 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002453 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002454 check_includes = false
2455 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002456 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002457 defines =
2458 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002459 sources = [
2460 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002461 "tools/skqp/src/skqp.cpp",
2462 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002463 ]
2464 deps = [
2465 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002466 ":skia",
2467 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002468 ":tool_utils",
2469 ]
2470 }
2471 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002472 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002473 include_dirs = [ "//" ]
2474 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002475 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002476 }
2477 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002478 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002479 deps = [
2480 ":gm",
2481 ":skia",
2482 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002483 ]
2484 }
2485 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002486 if (is_fuchsia) {
2487 # Build a package repository for skqp on Fuchsia.
2488 group("skqp_repo") {
2489 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002490 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002491 }
2492 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002493 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002494 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002495 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002496 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002497 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002498 deps = [
2499 ":skia",
2500 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002501 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002502 ]
2503 libs = [ "android" ]
2504 }
2505 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002506 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002507 test_app("skottie_android") {
2508 is_shared_library = true
2509
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002510 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002511 libs = []
2512
Stan Iliev93151722018-08-02 11:10:52 -04002513 deps = [
2514 ":skia",
2515 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002516 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002517 ]
2518 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002519
2520 test_app("androidkit") {
2521 is_shared_library = true
2522
Florin Malita2a650cc2021-04-12 13:38:44 -04002523 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002524 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002525 "modules/androidkit/src/Canvas.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002526 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002527 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002528 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002529 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002530 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002531 "modules/androidkit/src/Path.cpp",
2532 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002533 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2534 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002535 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002536 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002537 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002538 "modules/androidkit/src/SurfaceThread.cpp",
2539 "modules/androidkit/src/SurfaceThread.h",
Florin Malita50cc5d42021-05-21 08:23:32 -04002540 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002541 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002542 libs = [
2543 "android",
2544 "jnigraphics",
2545 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002546
Florin Malita2cc65382021-04-26 21:59:35 -04002547 deps = [
2548 ":sk_app",
2549 ":skia",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002550 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002551 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002552 }
Stan Iliev93151722018-08-02 11:10:52 -04002553 }
Hal Canary75427132017-10-11 16:00:31 -04002554
Hal Canarya9de7602018-01-19 13:08:23 -05002555 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002556 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002557 deps = [
2558 ":gm",
2559 ":skia",
2560 ]
2561 }
2562 test_app("list_gpu_unit_tests") {
2563 sources = [
2564 "dm/DMGpuTestProcs.cpp",
2565 "tools/list_gpu_unit_tests.cpp",
2566 ]
2567 deps = [
2568 ":skia",
2569 ":tests",
2570 ]
2571 }
2572
Brian Osmanc9a42472018-05-31 13:17:12 -04002573 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002574 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002575 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002576 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002577 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002578 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002579 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002580 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002581 "tools/sk_app/CommandSet.h",
2582 "tools/sk_app/DisplayParams.h",
2583 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002584 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002585 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002586 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002587 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002588 ]
2589 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002590 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002591
2592 if (is_android) {
2593 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002594 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002595 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002596 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002597 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002598 "tools/sk_app/android/main_android.cpp",
2599 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002600 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002601 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002602 libs += [ "android" ]
2603 } else if (is_linux) {
2604 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002605 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002606 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002607 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002608 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002609 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002610 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002611 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002612 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002613 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002614 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002615 "X11",
2616 ]
2617 } else if (is_win) {
2618 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002619 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002620 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002621 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002622 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002623 "tools/sk_app/win/main_win.cpp",
2624 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002625 } else if (is_mac) {
2626 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002627 "tools/sk_app/mac/WindowContextFactory_mac.h",
2628 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002629 "tools/sk_app/mac/Window_mac.mm",
2630 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002631 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002632 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002633 "QuartzCore.framework",
2634 "Cocoa.framework",
2635 "Foundation.framework",
2636 ]
2637 } else if (is_ios) {
2638 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002639 "tools/sk_app/ios/WindowContextFactory_ios.h",
2640 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002641 "tools/sk_app/ios/Window_ios.mm",
2642 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002643 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002644 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002645 }
2646
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002647 if (skia_use_gl) {
2648 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002649 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002650 if (is_android) {
2651 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2652 } else if (is_linux) {
2653 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2654 } else if (is_win) {
2655 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2656 if (skia_use_angle) {
2657 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2658 }
2659 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002660 sources += [
2661 "tools/sk_app/mac/GLWindowContext_mac.mm",
2662 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2663 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002664 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002665 sources += [
2666 "tools/sk_app/ios/GLWindowContext_ios.mm",
2667 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2668 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002669 }
2670 }
2671
Brian Osmanc9a42472018-05-31 13:17:12 -04002672 if (skia_use_vulkan) {
2673 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002674 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002675 if (is_android) {
2676 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2677 } else if (is_linux) {
2678 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2679 libs += [ "X11-xcb" ]
2680 } else if (is_win) {
2681 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2682 }
2683 }
2684
Jim Van Verthbe39f712019-02-08 15:36:14 -05002685 if (skia_use_metal) {
2686 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002687 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002688 if (is_mac) {
2689 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002690 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002691 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002692 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002693 }
2694
Jim Van Verth682a2f42020-05-13 16:54:09 -04002695 if (skia_use_direct3d) {
2696 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2697 }
2698
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002699 if (skia_use_dawn) {
2700 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002701 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002702 if (is_linux) {
2703 if (dawn_enable_vulkan) {
2704 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2705 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2706 libs += [ "X11-xcb" ]
2707 }
2708 } else if (is_win) {
2709 if (dawn_enable_d3d12) {
2710 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2711 }
2712 } else if (is_mac) {
2713 if (dawn_enable_metal) {
2714 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2715 }
2716 }
2717 }
2718
Mike Kleina01c6b02020-04-01 13:47:34 -05002719 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002720 if (is_android) {
2721 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002722 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002723 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002724 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002725 }
Brian Osman16adfa32016-10-18 14:42:44 -04002726 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002727
Hal Canary87515122019-03-15 14:22:51 -04002728 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2729 test_app("fiddle_examples") {
2730 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002731 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002732 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002733 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002734 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002735 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002736 cflags = [
2737 "/wd4756", # Overflow in constant arithmetic
2738 "/wd4305", # truncation from 'double' to 'float'
2739 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002740 }
Hal Canary87515122019-03-15 14:22:51 -04002741 deps = [
2742 ":skia",
2743 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002744 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002745 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002746 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002747 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002748 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002749 ]
2750 }
2751 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002752
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002753 # sk_app can work without GL but viewer always runs raster through a GL window context.
2754 if (skia_use_gl) {
2755 test_app("viewer") {
2756 is_shared_library = is_android
2757 sources = [
2758 "tools/viewer/AnimTimer.h",
2759 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002760 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002761 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002762 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002763 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002764 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002765 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002766 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002767 "tools/viewer/MSKPSlide.cpp",
2768 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002769 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002770 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002771 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002772 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002773 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002774 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002775 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002776 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002777 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002778 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002779 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002780 "tools/viewer/SkottieSlide.h",
2781 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002782 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002783 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002784 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002785 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002786 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002787 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002788 "tools/viewer/TouchGesture.cpp",
2789 "tools/viewer/TouchGesture.h",
2790 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002791 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002792 ]
2793 libs = []
2794
2795 deps = [
2796 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002797 ":flags",
2798 ":gm",
2799 ":gpu_tool_utils",
2800 ":samples",
2801 ":sk_app",
2802 ":skia",
2803 ":tool_utils",
2804 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002805 "experimental/skrive",
Julia Lavrova159fd842021-02-24 12:15:08 -05002806 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002807 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002808 "modules/particles",
2809 "modules/skottie",
2810 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002811 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002812 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002813 "//third_party/imgui",
2814 ]
2815 if (skia_use_experimental_xform) {
2816 deps += [ ":experimental_xform" ]
2817 sources += [ "gm/xform.cpp" ]
2818 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002819 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002820 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002821 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002822
Corentin Wallez89d6e792021-03-08 15:25:34 +01002823 #spvtools depends on this but doesn't deps it in.
2824 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002825 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002826 }
Mike Reedd62d4062019-06-12 10:20:44 -04002827 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002828 }
2829
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002830 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002831 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002832 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002833 libs = []
2834
Brian Osmaneff04b52017-11-21 13:18:02 -05002835 deps = [
2836 ":flags",
2837 ":gpu_tool_utils",
2838 ":sk_app",
2839 ":skia",
2840 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002841 ]
2842 }
2843 }
2844
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002845 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2846 action_foreach("generate_mocs") {
2847 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002848 sources = [ "tools/mdbviz/MainWindow.h" ]
2849 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002850 args = [
2851 "$skia_qt_path" + "/bin/moc",
2852 "{{source}}",
2853 "-o",
2854 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2855 ]
2856 }
2857 action_foreach("generate_resources") {
2858 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002859 sources = [ "tools/mdbviz/resources.qrc" ]
2860 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002861 args = [
2862 "$skia_qt_path" + "/bin/rcc",
2863 "{{source}}",
2864 "-o",
2865 "gen/mdbviz/{{source_name_part}}_res.cpp",
2866 ]
2867 }
2868 test_app("mdbviz") {
2869 if (is_win) {
2870 # on Windows we need to disable some exception handling warnings due to the Qt headers
2871 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2872 }
2873 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002874 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002875 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002876 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002877 "tools/debugger/DrawCommand.cpp",
2878 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002879 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002880 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002881 "tools/mdbviz/main.cpp",
2882
2883 # generated files
2884 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2885 "$target_gen_dir/mdbviz/resources_res.cpp",
2886 ]
2887 lib_dirs = [ "$skia_qt_path/lib" ]
2888 libs = [
2889 "Qt5Core.lib",
2890 "Qt5Gui.lib",
2891 "Qt5Widgets.lib",
2892 ]
2893 include_dirs = [
2894 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002895 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002896 "$skia_qt_path/include/QtWidgets",
2897 ]
2898 deps = [
2899 ":generate_mocs",
2900 ":generate_resources",
2901 ":skia",
2902 ]
2903 }
2904 }
2905
Mike Kleine459afd2017-03-03 09:21:30 -05002906 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002907 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002908 sources = [ "$ndk/$ndk_gdbserver" ]
2909 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002910 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002911 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002912
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002913 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002914 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002915 deps = [
2916 ":skia",
2917 "modules/particles",
2918 ]
2919 }
2920
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002921 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002922 test_app("editor") {
2923 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002924 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002925 }
Julia Lavrovaecc8e3b2021-06-10 10:26:36 -04002926 test_app("text_editor") {
2927 is_shared_library = is_android
2928 deps = [ "experimental/sktext:text_editor" ]
2929 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002930 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002931
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002932 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002933 sources = [ "tools/image_diff_metric.cpp" ]
2934 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002935 }
Chris Dalton2b598902020-03-25 10:50:35 -06002936
2937 group("modules_testonly") {
2938 testonly = true
2939 deps = []
2940 if (target_cpu == "wasm") {
2941 deps += [ "modules/canvaskit:viewer_wasm" ]
2942 }
2943 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002944
2945 if (skia_build_fuzzers) {
2946 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002947 skia_executable(target_name) {
2948 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002949 check_includes = false
2950 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002951 if (!defined(configs)) {
2952 configs = []
2953 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002954 configs += [ ":skia_private" ]
2955 sources += [
2956 "fuzz/Fuzz.cpp",
2957 "fuzz/FuzzCommon.cpp",
2958 ]
2959 deps += [
2960 ":flags",
2961 ":gpu_tool_utils",
2962 ":skia",
2963 ]
2964 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2965 if (skia_use_libfuzzer_defaults) {
2966 cflags = [ "-fsanitize=fuzzer" ]
2967 ldflags = [ "-fsanitize=fuzzer" ]
2968 }
2969 testonly = true
2970 }
2971 }
2972
2973 libfuzzer_app("region_deserialize") {
2974 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2975 deps = []
2976 }
2977
2978 libfuzzer_app("image_filter_deserialize") {
2979 include_dirs = [
2980 "tools",
2981 "tools/fonts",
2982 ]
2983 sources = [
2984 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2985 "tools/Resources.cpp",
2986 "tools/fonts/TestFontMgr.cpp",
2987 "tools/fonts/TestSVGTypeface.cpp",
2988 "tools/fonts/TestTypeface.cpp",
2989 ]
Florin Malitab3418102020-10-15 18:10:29 -04002990 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002991 }
2992
2993 libfuzzer_app("region_set_path") {
2994 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2995 deps = []
2996 }
2997
2998 libfuzzer_app("textblob_deserialize") {
2999 include_dirs = [
3000 "tools",
3001 "tools/fonts",
3002 ]
3003 sources = [
3004 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
3005 "tools/Resources.cpp",
3006 "tools/fonts/TestFontMgr.cpp",
3007 "tools/fonts/TestSVGTypeface.cpp",
3008 "tools/fonts/TestTypeface.cpp",
3009 ]
Florin Malitab3418102020-10-15 18:10:29 -04003010 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003011 }
3012
3013 libfuzzer_app("path_deserialize") {
3014 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
3015 deps = []
3016 }
3017
3018 libfuzzer_app("image_decode") {
3019 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3020 deps = []
3021 }
3022
3023 libfuzzer_app("animated_image_decode") {
3024 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3025 deps = []
3026 }
3027
3028 libfuzzer_app("api_create_ddl") {
3029 include_dirs = [
3030 "include",
3031 "include/gpu",
3032 ]
3033 sources = [
3034 "fuzz/FuzzCreateDDL.cpp",
3035 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3036 "tools/Resources.cpp",
3037 "tools/UrlDataManager.cpp",
3038 "tools/debugger/DebugCanvas.cpp",
3039 "tools/debugger/DebugLayerManager.cpp",
3040 "tools/debugger/DrawCommand.cpp",
3041 "tools/debugger/JsonWriteBuffer.cpp",
3042 "tools/fonts/TestFontMgr.cpp",
3043 "tools/fonts/TestSVGTypeface.cpp",
3044 "tools/fonts/TestTypeface.cpp",
3045 ]
3046 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003047 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003048 "//third_party/libpng",
3049 ]
3050 }
3051
3052 libfuzzer_app("api_draw_functions") {
3053 sources = [
3054 "fuzz/FuzzDrawFunctions.cpp",
3055 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3056 ]
3057 deps = []
3058 }
3059
Adlai Hollerccb68662021-02-25 10:28:44 -05003060 libfuzzer_app("api_ddl_threading") {
3061 sources = [
3062 "fuzz/FuzzDDLThreading.cpp",
3063 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3064 ]
3065 deps = []
3066 }
3067
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003068 libfuzzer_app("api_gradients") {
3069 sources = [
3070 "fuzz/FuzzGradients.cpp",
3071 "fuzz/oss_fuzz/FuzzGradients.cpp",
3072 ]
3073 deps = []
3074 }
3075
3076 libfuzzer_app("api_image_filter") {
3077 include_dirs = [
3078 "tools",
3079 "tools/debugger",
3080 ]
3081 sources = [
3082 "fuzz/FuzzCanvas.cpp",
3083 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3084 "tools/UrlDataManager.cpp",
3085 "tools/debugger/DebugCanvas.cpp",
3086 "tools/debugger/DebugLayerManager.cpp",
3087 "tools/debugger/DrawCommand.cpp",
3088 "tools/debugger/JsonWriteBuffer.cpp",
3089 ]
3090 deps = [ "//third_party/libpng" ]
3091 }
3092
3093 libfuzzer_app("api_path_measure") {
3094 sources = [
3095 "fuzz/FuzzPathMeasure.cpp",
3096 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3097 ]
3098 deps = []
3099 }
3100
3101 libfuzzer_app("api_pathop") {
3102 sources = [
3103 "fuzz/FuzzPathop.cpp",
3104 "fuzz/oss_fuzz/FuzzPathop.cpp",
3105 ]
3106 deps = []
3107 }
3108
Robert Phillips98b066c2021-04-22 10:51:58 -04003109 libfuzzer_app("api_triangulation") {
3110 sources = [
3111 "fuzz/FuzzTriangulation.cpp",
3112 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3113 ]
3114 deps = []
3115 }
3116
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003117 libfuzzer_app("api_raster_n32_canvas") {
3118 include_dirs = [
3119 "tools",
3120 "tools/debugger",
3121 "tools/fonts",
3122 ]
3123 sources = [
3124 "fuzz/FuzzCanvas.cpp",
3125 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3126 "tools/Resources.cpp",
3127 "tools/UrlDataManager.cpp",
3128 "tools/debugger/DebugCanvas.cpp",
3129 "tools/debugger/DebugLayerManager.cpp",
3130 "tools/debugger/DrawCommand.cpp",
3131 "tools/debugger/JsonWriteBuffer.cpp",
3132 "tools/fonts/TestFontMgr.cpp",
3133 "tools/fonts/TestSVGTypeface.cpp",
3134 "tools/fonts/TestTypeface.cpp",
3135 ]
3136 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003137 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003138 "//third_party/libpng",
3139 ]
3140 }
3141
Kevin Lubick7845b972021-03-29 08:07:32 -04003142 libfuzzer_app("api_regionop") {
3143 sources = [
3144 "fuzz/FuzzRegionOp.cpp",
3145 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3146 ]
3147 deps = []
3148 }
3149
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003150 if (skia_use_gl) {
3151 libfuzzer_app("api_mock_gpu_canvas") {
3152 include_dirs = [
3153 "tools",
3154 "tools/debugger",
3155 "tools/fonts",
3156 ]
3157 sources = [
3158 "fuzz/FuzzCanvas.cpp",
3159 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3160 "tools/LsanSuppressions.cpp",
3161 "tools/Resources.cpp",
3162 "tools/UrlDataManager.cpp",
3163 "tools/debugger/DebugCanvas.cpp",
3164 "tools/debugger/DebugLayerManager.cpp",
3165 "tools/debugger/DrawCommand.cpp",
3166 "tools/debugger/JsonWriteBuffer.cpp",
3167 "tools/fonts/TestFontMgr.cpp",
3168 "tools/fonts/TestSVGTypeface.cpp",
3169 "tools/fonts/TestTypeface.cpp",
3170 ]
3171 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003172 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003173 "//third_party/libpng",
3174 ]
3175 }
3176 }
3177
3178 libfuzzer_app("api_null_canvas") {
3179 include_dirs = [
3180 "tools",
3181 "tools/debugger",
3182 "tools/fonts",
3183 ]
3184 sources = [
3185 "fuzz/FuzzCanvas.cpp",
3186 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3187 "tools/Resources.cpp",
3188 "tools/UrlDataManager.cpp",
3189 "tools/debugger/DebugCanvas.cpp",
3190 "tools/debugger/DebugLayerManager.cpp",
3191 "tools/debugger/DrawCommand.cpp",
3192 "tools/debugger/JsonWriteBuffer.cpp",
3193 "tools/fonts/TestFontMgr.cpp",
3194 "tools/fonts/TestSVGTypeface.cpp",
3195 "tools/fonts/TestTypeface.cpp",
3196 ]
3197 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003198 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003199 "//third_party/libpng",
3200 ]
3201 }
3202
Weston Tracey1a771fe2021-02-04 11:09:59 -05003203 libfuzzer_app("api_skparagraph") {
3204 sources = [
3205 "fuzz/FuzzSkParagraph.cpp",
3206 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3207 "tools/Resources.cpp",
3208 ]
3209 deps = [ "modules/skparagraph" ]
3210 }
3211
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003212 libfuzzer_app("api_svg_canvas") {
3213 include_dirs = [
3214 "include",
3215 "include/svg",
3216 ]
3217 sources = [
3218 "fuzz/FuzzCanvas.cpp",
3219 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3220 "tools/Resources.cpp",
3221 "tools/UrlDataManager.cpp",
3222 "tools/debugger/DebugCanvas.cpp",
3223 "tools/debugger/DebugLayerManager.cpp",
3224 "tools/debugger/DrawCommand.cpp",
3225 "tools/debugger/JsonWriteBuffer.cpp",
3226 "tools/fonts/TestFontMgr.cpp",
3227 "tools/fonts/TestSVGTypeface.cpp",
3228 "tools/fonts/TestTypeface.cpp",
3229 ]
3230 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003231 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003232 "//third_party/libpng",
3233 ]
3234 }
3235
3236 libfuzzer_app("png_encoder") {
3237 sources = [
3238 "fuzz/FuzzEncoders.cpp",
3239 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3240 ]
3241 deps = []
3242 }
3243
3244 libfuzzer_app("jpeg_encoder") {
3245 sources = [
3246 "fuzz/FuzzEncoders.cpp",
3247 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3248 ]
3249 deps = []
3250 }
3251
3252 libfuzzer_app("webp_encoder") {
3253 sources = [
3254 "fuzz/FuzzEncoders.cpp",
3255 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3256 ]
3257 deps = []
3258 }
3259
3260 libfuzzer_app("skottie_json") {
3261 sources = [
3262 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3263 "tools/Resources.cpp",
3264 "tools/fonts/TestFontMgr.cpp",
3265 "tools/fonts/TestSVGTypeface.cpp",
3266 "tools/fonts/TestTypeface.cpp",
3267 ]
3268 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003269 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003270 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003271 ]
3272 }
3273
3274 libfuzzer_app("skjson") {
3275 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3276 deps = []
3277 }
3278
3279 libfuzzer_app("api_polyutils") {
3280 sources = [
3281 "fuzz/FuzzPolyUtils.cpp",
3282 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3283 ]
3284 deps = [ ":skia" ]
3285 }
3286
3287 libfuzzer_app("android_codec") {
3288 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3289 deps = []
3290 }
3291
3292 libfuzzer_app("image_decode_incremental") {
3293 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3294 deps = []
3295 }
3296
3297 libfuzzer_app("sksl2glsl") {
3298 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3299 deps = []
3300 }
3301
3302 libfuzzer_app("sksl2spirv") {
3303 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3304 deps = []
3305 }
3306
3307 libfuzzer_app("sksl2metal") {
3308 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3309 deps = []
3310 }
3311
3312 libfuzzer_app("sksl2pipeline") {
3313 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3314 deps = []
3315 }
3316
3317 libfuzzer_app("skdescriptor_deserialize") {
3318 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3319 deps = []
3320 }
3321
3322 libfuzzer_app("svg_dom") {
3323 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003324 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003325 }
3326
3327 libfuzzer_app("skruntimeeffect") {
3328 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3329 deps = []
3330 }
3331
3332 libfuzzer_app("skp") {
3333 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3334 deps = []
3335 }
3336 }
mtklein25c81d42016-07-27 13:55:26 -07003337}
Hal Canary932a2c02019-09-17 10:43:18 -04003338
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003339if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003340 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003341 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003342 }
Hal Canary27483062019-12-06 15:01:08 -05003343}
3344
Hal Canary60ff6512020-01-21 12:39:20 -05003345if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003346 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003347 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003348 }
3349}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003350
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003351skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003352 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3353 include_dirs = [ "." ]
3354 deps = [ ":skia" ]
3355}