blob: 525febd229186ef06913a94b9d0d0ad7bebaac18 [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 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070057
58 # Some older versions of the Clang toolchain change the visibility of
59 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
60 # toolchains suppress the use of this macro till toolchain updates are made.
61 if (is_mac || is_ios) {
62 if (skia_enable_api_available_macro) {
63 defines += [ "SK_ENABLE_API_AVAILABLE" ]
64 } else {
65 cflags_objcc += [ "-Wno-unguarded-availability" ]
66 }
67 }
mtkleinc04ff472016-06-23 10:29:30 -070068}
69
70# Skia internal APIs, used by Skia itself and a few test tools.
71config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060072 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070073
Mike Reeda9e241d2017-05-03 10:52:00 -040074 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050075 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070076 defines += [
77 "SK_GAMMA_EXPONENT=1.4",
78 "SK_GAMMA_CONTRAST=0.0",
79 ]
80 }
Mike Kleinb45d8622019-04-24 14:04:01 -050081 if (is_skia_dev_build) {
82 defines += [
83 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
84 "GR_TEST_UTILS=1",
85 ]
mtklein88a7ac02016-09-14 11:16:49 -070086 }
Brian Salomon789e25e2016-09-30 13:41:03 -040087 libs = []
88 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040089 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050090 defines += [ "SK_ANGLE" ]
91 }
Greg Danielb16beb92020-04-27 14:26:21 +000092 if (skia_use_vma) {
93 defines += [ "SK_USE_VMA" ]
94 }
James Clarkeb8c0dab2021-02-09 06:22:41 -080095 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -080096 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -080097 }
98}
99
mtkleinc04ff472016-06-23 10:29:30 -0700100# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
101config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600102 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000103 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700104}
105
106skia_library_configs = [
107 ":skia_public",
108 ":skia_private",
109 ":skia_library",
110]
111
mtklein9b8583d2016-08-24 17:32:30 -0700112# Use for CPU-specific Skia code that needs particular compiler flags.
113template("opts") {
114 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400115 skia_source_set(target_name) {
116 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500117 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400118 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700119 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400120 if (defined(invoker.configs)) {
121 configs += invoker.configs
122 }
mtklein9b8583d2016-08-24 17:32:30 -0700123 }
124 } else {
125 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400126 skia_source_set(target_name) {
127 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500128 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700129 forward_variables_from(invoker,
130 "*",
131 [
132 "sources",
133 "cflags",
134 ])
135 }
136 }
anmittala7eaf2e2016-08-17 13:57:26 -0700137}
138
mtklein422310d2016-08-16 18:28:43 -0700139is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700140
mtklein7d6fb2c2016-08-25 14:50:44 -0700141opts("none") {
142 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700143 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700144 cflags = []
145}
146
mtklein7d6fb2c2016-08-25 14:50:44 -0700147opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700148 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700149 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700150 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700151}
152
153opts("arm64") {
154 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700156 cflags = []
157}
158
159opts("crc32") {
160 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700162 cflags = [ "-march=armv8-a+crc" ]
163}
164
mtklein9b8583d2016-08-24 17:32:30 -0700165opts("sse2") {
166 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400168 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400169 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
170 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400171 cflags = [ "-msse2" ]
172 }
mtklein9b8583d2016-08-24 17:32:30 -0700173}
mtkleinc04ff472016-06-23 10:29:30 -0700174
mtklein9b8583d2016-08-24 17:32:30 -0700175opts("ssse3") {
176 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700177 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400178 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400179 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
180 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400181 cflags = [ "-mssse3" ]
182 }
mtklein9b8583d2016-08-24 17:32:30 -0700183}
mtkleinc04ff472016-06-23 10:29:30 -0700184
mtklein9b8583d2016-08-24 17:32:30 -0700185opts("sse41") {
186 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700187 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400188 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400189 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
190 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400191 cflags = [ "-msse4.1" ]
192 }
mtklein9b8583d2016-08-24 17:32:30 -0700193}
mtklein4e976072016-08-08 09:06:27 -0700194
mtklein9b8583d2016-08-24 17:32:30 -0700195opts("sse42") {
196 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700197 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400198 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400199 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
200 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400201 cflags = [ "-msse4.2" ]
202 }
mtklein9b8583d2016-08-24 17:32:30 -0700203}
204
205opts("avx") {
206 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400208 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000209 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400210 } else {
211 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500212 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500213 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500214 }
Mike Klein3eb71212016-10-11 17:08:53 -0400215 }
mtkleinc04ff472016-06-23 10:29:30 -0700216}
217
Mike Klein1b9b7d52018-02-27 10:37:40 -0500218opts("hsw") {
219 enabled = is_x86
220 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400221 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500222 cflags = [ "/arch:AVX2" ]
223 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000224 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600225 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500226 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600227 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500228 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500229}
230
Mike Kleinad56c4c2020-06-05 06:57:30 -0500231opts("skx") {
232 enabled = is_x86
233 sources = skia_opts.skx_sources
234 if (is_win) {
235 cflags = [ "/arch:AVX512" ]
236 } else {
237 cflags = [ "-march=skylake-avx512" ]
238 if (is_mac && is_debug) {
239 cflags += [ "-fno-stack-check" ] # Work around skia:9709
240 }
241 }
242}
243
mtkleinc095df52016-08-24 12:23:52 -0700244# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700245template("optional") {
246 if (invoker.enabled) {
247 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700248 if (defined(invoker.public_defines)) {
249 defines = invoker.public_defines
250 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600251 if (defined(invoker.public_configs)) {
252 configs = invoker.public_configs
253 }
Hal Canary2dad9902019-11-20 16:01:31 -0500254 if (defined(invoker.public_include_dirs)) {
255 include_dirs = invoker.public_include_dirs
256 }
mtklein457b42a2016-08-23 13:56:37 -0700257 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400258 skia_source_set(target_name) {
259 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500260 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400261 configs = skia_library_configs
262
263 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700264 forward_variables_from(invoker,
265 "*",
266 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400267 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700268 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500269 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700270 "sources_when_disabled",
271 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400272 if (defined(invoker.configs)) {
273 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700274 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400275 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700276 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500277 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400278 skia_source_set(target_name + "_tests") {
279 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500280 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400281 configs = skia_library_configs
282
283 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500284 forward_variables_from(invoker,
285 "*",
286 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400287 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500288 "public_defines",
289 "sources",
290 "sources_for_tests",
291 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500292 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400293 if (defined(invoker.configs)) {
294 configs += invoker.configs
295 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500296 testonly = true
297 sources = invoker.sources_for_tests
298 if (!defined(deps)) {
299 deps = []
300 }
301 deps += [ ":test" ]
302 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500303 }
304 }
mtklein457b42a2016-08-23 13:56:37 -0700305 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400306 skia_source_set(target_name) {
307 visibility = [ ":*" ]
308 configs = skia_library_configs
309
310 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700311 forward_variables_from(invoker,
312 "*",
313 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400314 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400315 "public",
mtklein457b42a2016-08-23 13:56:37 -0700316 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400317 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700318 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700319 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400320 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700321 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500322 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700323 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700324 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400325 if (defined(invoker.configs)) {
326 configs += invoker.configs
327 }
mtkleincd01b032016-08-31 04:58:19 -0700328 if (defined(invoker.sources_when_disabled)) {
329 sources = invoker.sources_when_disabled
330 }
mtklein457b42a2016-08-23 13:56:37 -0700331 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500332 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400333 skia_source_set(target_name + "_tests") {
334 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500335 }
336 }
mtkleineb3c4252016-08-23 07:38:09 -0700337 }
mtklein457b42a2016-08-23 13:56:37 -0700338}
mtklein457b42a2016-08-23 13:56:37 -0700339
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400340optional("android_utils") {
341 enabled = skia_enable_android_utils
342
Leon Scroggins III87caae62020-05-04 10:02:45 -0400343 public = [
344 "client_utils/android/BRDAllocator.h",
345 "client_utils/android/BitmapRegionDecoder.h",
346 "client_utils/android/FrontBufferedStream.h",
347 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400348 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400349 sources = [
350 "client_utils/android/BitmapRegionDecoder.cpp",
351 "client_utils/android/FrontBufferedStream.cpp",
352 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400353}
354
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400355group("fontmgr_factory") {
356 public_deps = [ skia_fontmgr_factory ]
357}
358
359optional("fontmgr_empty_factory") {
360 enabled = true
361 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400362}
363
mtkleina45be612016-08-29 15:22:10 -0700364optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500365 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700366
367 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500368 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700369 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700370 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400371 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700372 sources = [
373 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700374 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400375 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700376 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500377 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700378}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400379optional("fontmgr_android_factory") {
380 enabled = skia_enable_fontmgr_android
381 deps = [ ":fontmgr_android" ]
382 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
383}
mtkleina45be612016-08-29 15:22:10 -0700384
mtkleind2e39db2016-09-07 07:52:55 -0700385optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400386 enabled =
387 skia_enable_fontmgr_custom_directory ||
388 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700389
Mike Kleina01c6b02020-04-01 13:47:34 -0500390 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400391 public = [ "src/ports/SkFontMgr_custom.h" ]
392 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
393}
394
395optional("fontmgr_custom_directory") {
396 enabled = skia_enable_fontmgr_custom_directory
397
398 deps = [
399 ":fontmgr_custom",
400 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700401 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400402 public = [ "include/ports/SkFontMgr_directory.h" ]
403 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
404}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400405optional("fontmgr_custom_directory_factory") {
406 enabled = skia_enable_fontmgr_custom_directory
407 deps = [ ":fontmgr_custom_directory" ]
408 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
409}
Ben Wagner75626e42020-06-03 13:20:37 -0400410
411optional("fontmgr_custom_embedded") {
412 enabled = skia_enable_fontmgr_custom_embedded
413
414 deps = [
415 ":fontmgr_custom",
416 ":typeface_freetype",
417 ]
418 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700419}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400420optional("fontmgr_custom_embedded_factory") {
421 enabled = skia_enable_fontmgr_custom_embedded
422 deps = [ ":fontmgr_custom_embedded" ]
423 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
424}
mtkleind2e39db2016-09-07 07:52:55 -0700425
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500426optional("fontmgr_custom_empty") {
427 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500428
Ben Wagner75626e42020-06-03 13:20:37 -0400429 deps = [
430 ":fontmgr_custom",
431 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800432 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400433 public = [ "include/ports/SkFontMgr_empty.h" ]
434 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500435}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400436optional("fontmgr_custom_empty_factory") {
437 enabled = skia_enable_fontmgr_custom_empty
438 deps = [ ":fontmgr_custom_empty" ]
439 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
440}
Hal Canaryff2742e2018-01-30 11:35:47 -0500441
mtklein3cc22182016-08-29 13:26:14 -0700442optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400443 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700444
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400445 # The public header includes fontconfig.h and uses FcConfig*
446 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400447 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400448 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400449 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500450 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400451}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400452optional("fontmgr_fontconfig_factory") {
453 enabled = skia_enable_fontmgr_fontconfig
454 deps = [ ":fontmgr_fontconfig" ]
455 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
456}
Ben Wagner75626e42020-06-03 13:20:37 -0400457
458optional("fontmgr_FontConfigInterface") {
459 enabled = skia_enable_fontmgr_FontConfigInterface
460
461 deps = [
462 ":typeface_freetype",
463 "//third_party:fontconfig",
464 ]
465 public = [
466 "include/ports/SkFontConfigInterface.h",
467 "include/ports/SkFontMgr_FontConfigInterface.h",
468 ]
mtklein3cc22182016-08-29 13:26:14 -0700469 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700470 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700471 "src/ports/SkFontConfigInterface_direct.cpp",
472 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400473 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700474 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700475 ]
476}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400477optional("fontmgr_FontConfigInterface_factory") {
478 enabled = skia_enable_fontmgr_FontConfigInterface
479 deps = [ ":fontmgr_FontConfigInterface" ]
480 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
481}
mtklein3cc22182016-08-29 13:26:14 -0700482
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500483optional("fontmgr_fuchsia") {
484 enabled = skia_enable_fontmgr_fuchsia
485
Chinmay Garde89820762019-05-06 16:44:06 -0700486 deps = []
487
488 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700489 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700490 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500491 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700492 }
Ben Wagner75626e42020-06-03 13:20:37 -0400493 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
494 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500495}
496
Ben Wagner75626e42020-06-03 13:20:37 -0400497optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400498 enabled = skia_use_fonthost_mac
499
Ben Wagner75626e42020-06-03 13:20:37 -0400500 public = [
501 "include/ports/SkFontMgr_mac_ct.h",
502 "include/ports/SkTypeface_mac.h",
503 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400504 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400505 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400506 "src/ports/SkScalerContext_mac_ct.cpp",
507 "src/ports/SkScalerContext_mac_ct.h",
508 "src/ports/SkTypeface_mac_ct.cpp",
509 "src/ports/SkTypeface_mac_ct.h",
510 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000511 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400512
513 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400514 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400515 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
516 "AppKit.framework",
517 "ApplicationServices.framework",
518 ]
519 }
520
521 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400522 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400523 "CoreFoundation.framework",
524 "CoreGraphics.framework",
525 "CoreText.framework",
526
527 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
528 "UIKit.framework",
529 ]
530 }
531}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400532optional("fontmgr_mac_ct_factory") {
533 enabled = skia_use_fonthost_mac
534 deps = [ ":fontmgr_mac_ct" ]
535 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
536}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400537
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500538optional("fontmgr_win") {
539 enabled = skia_enable_fontmgr_win
540
Ben Wagner75626e42020-06-03 13:20:37 -0400541 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500542 sources = [
543 "src/fonts/SkFontMgr_indirect.cpp",
544 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500545 "src/ports/SkScalerContext_win_dw.cpp",
546 "src/ports/SkTypeface_win_dw.cpp",
547 ]
548}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400549optional("fontmgr_win_factory") {
550 enabled = skia_enable_fontmgr_win
551 deps = [ ":fontmgr_win" ]
552 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
553}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500554
555optional("fontmgr_win_gdi") {
556 enabled = skia_enable_fontmgr_win_gdi
557
Ben Wagner75626e42020-06-03 13:20:37 -0400558 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500559 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500560 libs = [ "Gdi32.lib" ]
561}
562
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700563if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400564 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400565 sources = [
566 "src/sksl/lex/Main.cpp",
567 "src/sksl/lex/NFA.cpp",
568 "src/sksl/lex/RegexNode.cpp",
569 "src/sksl/lex/RegexParser.cpp",
570 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500571 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400572 }
573
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700574 action("run_sksllex") {
575 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500576 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
577 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700578
579 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
580 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
581 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500582 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700583 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
584 # confused due to the same file being named by two different paths
585 ]
586 sksllex_path = "$root_out_dir/"
587 sksllex_path += "sksllex"
588 if (host_os == "win") {
589 sksllex_path += ".exe"
590 }
591 args = [
592 rebase_path(sksllex_path),
593 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400594 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700595 rebase_path("src"),
596 ]
597 }
598} else {
599 group("run_sksllex") {
600 }
601}
602
John Stilesd836f842020-09-14 10:21:44 -0400603# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
604if (skia_compile_processors || skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400605 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500606 defines = [
607 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500608 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500609 "SK_ENABLE_SPIRV_VALIDATION",
610 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400611 sources = [
Brian Osman47726a12020-12-17 16:02:08 -0500612 "src/core/SkCpu.cpp",
613 "src/core/SkData.cpp",
614 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400615 "src/core/SkMalloc.cpp",
616 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400617 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500618 "src/core/SkStream.cpp",
619 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500620 "src/core/SkStringUtils.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400621 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500622 "src/core/SkUtils.cpp",
623 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400624 "src/gpu/GrBlockAllocator.cpp",
625 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500626 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400627 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500628 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400629 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500630 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400631 ]
Brian Osman47726a12020-12-17 16:02:08 -0500632 if (is_win) {
633 sources += [ "src/ports/SkOSFile_win.cpp" ]
634 } else {
635 sources += [ "src/ports/SkOSFile_posix.cpp" ]
636 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400637 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400638 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500639 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400640 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500641 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100642 "//third_party/externals/spirv-tools:spvtools",
643 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400644 ]
645 }
646
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400647 skslc_path = "$root_out_dir/"
648 if (host_toolchain != default_toolchain_name) {
649 skslc_path += "$host_toolchain/"
650 }
651 skslc_path += "skslc"
652 if (host_os == "win") {
653 skslc_path += ".exe"
654 }
655
Brian Osmandd496172020-08-08 08:17:18 -0400656 action("create_sksl_fp") {
657 script = "gn/create_sksl_fp.py"
658 sources = [
659 "include/private/GrSharedEnums.h",
660 "src/sksl/sksl_fp_raw.sksl",
661 ]
662 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
663 args = [
664 rebase_path(sources[0]),
665 rebase_path(sources[1]),
666 rebase_path(outputs[0]),
667 ]
668 }
669
670 copy("sksl_pre_includes") {
671 sources = [
672 "src/sksl/sksl_frag.sksl",
673 "src/sksl/sksl_geom.sksl",
674 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500675 "src/sksl/sksl_public.sksl",
Brian Osman91946752020-12-21 13:20:40 -0500676 "src/sksl/sksl_runtime.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400677 "src/sksl/sksl_vert.sksl",
678 ]
679 outputs = [ "$root_out_dir/{{source_file_part}}" ]
680 }
681
682 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
683 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
684
685 dehydrate_sksl_outputs = []
686 foreach(src, dehydrate_sksl_sources) {
687 name = get_path_info(src, "name")
688
689 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
690 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
691 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
692 "src/sksl/generated/$name.dehydrated.sksl",
693 target_out_dir) ]
694 }
695
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400696 action("dehydrate_sksl") {
697 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400698 deps = [
699 ":create_sksl_fp",
700 ":sksl_pre_includes",
701 ":skslc(//gn/toolchain:$host_toolchain)",
702 ]
703 sources = dehydrate_sksl_sources
704 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000705 args = [
706 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400707 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000708 ]
Brian Osmandd496172020-08-08 08:17:18 -0400709 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400710 }
John Stilesd836f842020-09-14 10:21:44 -0400711} else {
712 group("dehydrate_sksl") {
713 }
714}
715
716skia_gpu_processor_outputs = []
717if (skia_compile_processors) {
718 foreach(src, skia_gpu_processor_sources) {
719 dir = get_path_info(src, "dir")
720 name = get_path_info(src, "name")
721
722 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
723 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
724 skia_gpu_processor_outputs += [
725 "$target_out_dir/" +
726 rebase_path("$dir/generated/$name.h", target_out_dir),
727 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
728 # confused due to the same file being named by two different paths
729 ]
730 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400731
Ethan Nicholas762466e2017-06-29 10:03:38 -0400732 action("compile_processors") {
733 script = "gn/compile_processors.py"
734 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400735 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400736 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400737 ":skslc(//gn/toolchain:$host_toolchain)",
738 ]
739 sources = skia_gpu_processor_sources
740 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400741 args = [
742 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400743 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400744 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400745 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400746 args += rebase_path(skia_gpu_processor_sources)
747 }
748} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400749 group("compile_processors") {
750 }
John Stilesd836f842020-09-14 10:21:44 -0400751}
752
753if (skia_compile_sksl_tests) {
754 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400755
John Stiles7e248712020-09-24 16:42:09 -0400756 template("compile_sksl") {
757 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
758 action("compile_sksl_${target_name}") {
759 script = "gn/compile_sksl_tests.py"
760 deps = [
761 ":create_sksl_fp",
762 ":sksl_pre_includes",
763 ":skslc(//gn/toolchain:$host_toolchain)",
764 ]
John Stilesda57fc02021-01-22 11:54:30 -0500765 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400766 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500767 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500768 args = [
769 rebase_path(skslc_path),
770 invoker.lang,
771 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500772 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500773 ]
774
John Stilesbfc9be02021-01-22 11:55:48 -0500775 testsDir = get_path_info("tests", "abspath")
776 resourcesDir = get_path_info("resources", "abspath")
777
778 foreach(partialPath, invoker.sources) {
779 dst = testsDir + partialPath
780 src = resourcesDir + partialPath
781
782 dir = get_path_info(dst, "dir")
783 name = get_path_info(dst, "name")
784 ext = get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500785 response_file_contents += rebase_path([
786 src,
787 dir,
788 ])
John Stilesda57fc02021-01-22 11:54:30 -0500789 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500790
John Stilesda57fc02021-01-22 11:54:30 -0500791 foreach(outExtension, invoker.outExtensions) {
John Stilesc3012182020-12-08 15:07:00 -0500792 # SPIR-V uses separate extensions for .vert and .geom shaders.
793 if (outExtension == ".asm.frag" && ext == "vert") {
794 outExtension = ".asm.vert"
795 } else if (outExtension == ".asm.frag" && ext == "geom") {
796 outExtension = ".asm.geom"
797 }
John Stilesbfc9be02021-01-22 11:55:48 -0500798 outputs +=
799 [ target_out_dir + "/" +
800 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400801 }
802 }
John Stiles7e248712020-09-24 16:42:09 -0400803 }
John Stilesd836f842020-09-14 10:21:44 -0400804 }
John Stiles7e248712020-09-24 16:42:09 -0400805 compile_sksl("fp_tests") {
806 sources = sksl_fp_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500807 outExtensions = [
808 ".cpp",
809 ".h",
John Stiles7e248712020-09-24 16:42:09 -0400810 ]
811 lang = "--fp"
812 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400813 }
John Stiles7e248712020-09-24 16:42:09 -0400814 compile_sksl("glsl_tests") {
815 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500816 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400817 lang = "--glsl"
818 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400819 }
John Stiles7e248712020-09-24 16:42:09 -0400820 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400821 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500822 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400823 lang = "--glsl"
824 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400825 }
John Stilesaeae3a52020-09-25 13:35:58 -0400826 compile_sksl("metal_tests") {
827 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500828 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400829 lang = "--metal"
830 settings = "--settings"
831 }
Brian Osman977feec2020-12-22 11:28:59 -0500832 compile_sksl("skvm_tests") {
833 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500834 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500835 lang = "--skvm"
836 settings = "--settings"
837 }
Brian Osman62b039b2021-02-08 13:49:53 -0500838 compile_sksl("stage_tests") {
839 sources = sksl_stage_tests_sources
840 outExtensions = [ ".stage" ]
841 lang = "--stage"
842 settings = "--settings"
843 }
John Stilesdda1d312020-11-20 16:28:50 -0500844 compile_sksl("spirv_tests") {
845 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500846 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500847 lang = "--spirv"
848 settings = "--settings"
849 }
John Stilesd836f842020-09-14 10:21:44 -0400850} else {
John Stiles7e248712020-09-24 16:42:09 -0400851 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400852 }
John Stiles7e248712020-09-24 16:42:09 -0400853 group("compile_sksl_glsl_tests") {
854 }
855 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400856 }
John Stilesaeae3a52020-09-25 13:35:58 -0400857 group("compile_sksl_metal_tests") {
858 }
Brian Osman977feec2020-12-22 11:28:59 -0500859 group("compile_sksl_skvm_tests") {
860 }
John Stilesdda1d312020-11-20 16:28:50 -0500861 group("compile_sksl_spirv_tests") {
862 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400863}
864
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500865optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700866 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400867 deps = [
868 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400869 ":compile_sksl_fp_tests",
870 ":compile_sksl_glsl_nosettings_tests",
871 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400872 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500873 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500874 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400875 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700876 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400877 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700878 if (skia_generate_workarounds) {
879 deps += [ ":workaround_list" ]
880 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800881 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600882 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400883 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700884
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400885 sources =
886 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400887 if (!skia_enable_ccpr) {
888 sources -= skia_ccpr_sources
889 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
890 }
mtklein06c35c02016-09-20 12:28:12 -0700891
Mike Klein703cf5a2016-10-13 17:18:04 -0400892 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400893 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700894
John Rosascoa9b348f2019-11-08 13:18:15 -0800895 if (skia_use_gl) {
896 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400897 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500898 sources += [
899 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
900 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
901 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400902
903 # this lib is required to link against AHardwareBuffer
904 if (defined(ndk_api) && ndk_api >= 26) {
905 libs += [ "android" ]
906 }
907 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500908 sources += [
909 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
910 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
911 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400912 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400913 } else if (skia_use_webgl) {
914 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400915 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500916 sources += [
917 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
918 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
919 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400920 libs += [ "GL" ]
921 } else if (is_mac) {
922 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
923 } else if (is_ios) {
924 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800925 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400926 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
927 if (target_cpu != "arm64") {
928 libs += [ "OpenGL32.lib" ]
929 }
930 } else {
931 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
932 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800933 sources += skia_gl_gpu_sources
934 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400935
mtkleine9fb3d52016-09-20 15:11:46 -0700936 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400937 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000938 if (skia_use_vma) {
939 deps += [ "third_party/vulkanmemoryallocator" ]
940 }
mtkleine9fb3d52016-09-20 15:11:46 -0700941 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700942 if (skia_enable_vulkan_debug_layers) {
943 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
944 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800945 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800946 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700947 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
948 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400949 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700950 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800951 }
mtkleine9fb3d52016-09-20 15:11:46 -0700952 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400953
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400954 if (is_android && (skia_use_gl || skia_use_vulkan)) {
955 # this lib is required to link against AHardwareBuffer
956 if (defined(ndk_api) && ndk_api >= 26) {
957 libs += [ "android" ]
958 }
959 }
960
Stephen White0d70b712019-07-10 15:51:30 -0400961 if (skia_use_dawn) {
962 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400963 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700964 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400965 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700966 "//third_party/externals/dawn/src/dawn:dawn_proc",
967 "//third_party/externals/dawn/src/dawn:dawncpp",
968 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400969 ]
970 if (dawn_enable_d3d12) {
971 libs += [
972 "d3d12.lib",
973 "dxgi.lib",
974 "d3dcompiler.lib",
975 ]
976 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400977 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400978 }
979 }
980
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500981 if (skia_use_direct3d) {
982 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400983 deps += [
984 "//third_party/d3d12allocator",
985 "//third_party/spirv-cross:spirv_cross",
986 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500987 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500988 if (skia_enable_direct3d_debug_layer) {
989 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
990 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500991 libs += [
992 "d3d12.lib",
993 "dxgi.lib",
994 "d3dcompiler.lib",
995 ]
996 }
997
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400998 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400999 if (skia_use_metal) {
1000 public_defines += [ "SK_METAL" ]
1001 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -04001002 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001003 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +00001004 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -04001005 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001006
Kevin Lubickf4def342018-10-04 12:52:50 -04001007 if (is_debug) {
1008 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
1009 }
mtklein06c35c02016-09-20 12:28:12 -07001010}
1011
Leon Scroggins III41169202019-01-29 09:29:57 -05001012optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -05001013 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -05001014 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
1015 if ("True" ==
1016 exec_script("gn/checkpath.py",
1017 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
1018 "trim string")) {
1019 public_defines = [ "SK_USE_LIBGIFCODEC" ]
1020 public_include_dirs = [
1021 ".",
1022 skia_libgifcodec_path,
1023 ]
1024 include_dirs = public_include_dirs
1025 import(_libgifcodec_gni_path)
1026 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1027 ".",
1028 skia_libgifcodec_path)
1029 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001030}
1031
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001032optional("heif") {
1033 enabled = skia_use_libheif
1034 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1035
1036 deps = []
1037
Mike Kleina01c6b02020-04-01 13:47:34 -05001038 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001039}
1040
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001041optional("jpeg_decode") {
1042 enabled = skia_use_libjpeg_turbo_decode
1043 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1044
Mike Kleina01c6b02020-04-01 13:47:34 -05001045 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001046 sources = [
1047 "src/codec/SkJpegCodec.cpp",
1048 "src/codec/SkJpegDecoderMgr.cpp",
1049 "src/codec/SkJpegUtility.cpp",
1050 ]
1051}
1052
1053optional("jpeg_encode") {
1054 enabled = skia_use_libjpeg_turbo_encode
1055 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001056
Mike Kleina01c6b02020-04-01 13:47:34 -05001057 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1058 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001059 sources = [
mtklein63213812016-08-24 09:55:56 -07001060 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001061 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001062 ]
1063}
1064
Leon Scroggins III326b9892020-08-05 16:51:10 -04001065optional("ndk_images") {
1066 enabled = skia_use_ndk_images
1067 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1068 sources = [
1069 "src/ports/SkImageEncoder_NDK.cpp",
1070 "src/ports/SkImageGeneratorNDK.cpp",
1071 "src/ports/SkNDKConversions.cpp",
1072 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001073 libs = [ "jnigraphics" ]
1074}
1075
mtklein63213812016-08-24 09:55:56 -07001076optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001077 enabled = skia_use_zlib && skia_enable_pdf
1078 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001079
Mike Kleina01c6b02020-04-01 13:47:34 -05001080 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001081 if (skia_use_libjpeg_turbo_decode) {
1082 deps += [ ":jpeg_decode" ]
1083 }
1084 if (skia_use_libjpeg_turbo_encode) {
1085 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001086 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001087 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001088 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001089 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001090 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1091 deps += [ "//third_party/harfbuzz" ]
1092 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1093 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001094 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001095 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001096 }
1097}
1098
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001099optional("xps") {
1100 enabled = skia_use_xps && is_win
1101 public_defines = [ "SK_SUPPORT_XPS" ]
1102 public = skia_xps_public
1103 sources = skia_xps_sources
1104}
1105
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001106optional("png_decode") {
1107 enabled = skia_use_libpng_decode
1108 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001109
Mike Kleina01c6b02020-04-01 13:47:34 -05001110 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001111 sources = [
1112 "src/codec/SkIcoCodec.cpp",
1113 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001114 ]
1115}
1116
1117optional("png_encode") {
1118 enabled = skia_use_libpng_encode
1119 public_defines = [ "SK_ENCODE_PNG" ]
1120
Mike Kleina01c6b02020-04-01 13:47:34 -05001121 deps = [ "//third_party/libpng" ]
1122 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001123}
1124
scroggof84ad642016-10-31 09:02:57 -07001125optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001126 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001127 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1128
1129 deps = [
1130 "//third_party/dng_sdk",
1131 "//third_party/libjpeg-turbo:libjpeg",
1132 "//third_party/piex",
1133 ]
1134
1135 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1136 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001137 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001138
Mike Kleina01c6b02020-04-01 13:47:34 -05001139 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001140}
1141
Mike Klein852a8cb2018-05-15 10:46:58 -04001142import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001143skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001144 cflags = []
1145 if (!is_win || is_clang) {
1146 cflags += [
1147 "-w",
1148 "-std=c11",
1149 ]
1150 }
1151
Mike Kleina01c6b02020-04-01 13:47:34 -05001152 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001153 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001154 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1155}
1156
mtklein3cc22182016-08-29 13:26:14 -07001157optional("typeface_freetype") {
1158 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001159
Mike Kleina01c6b02020-04-01 13:47:34 -05001160 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001161 sources = [
1162 "src/ports/SkFontHost_FreeType.cpp",
1163 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001164 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001165 ]
1166}
1167
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001168optional("webp_decode") {
1169 enabled = skia_use_libwebp_decode
1170 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001171
Mike Kleina01c6b02020-04-01 13:47:34 -05001172 deps = [ "//third_party/libwebp" ]
1173 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001174}
1175
1176optional("webp_encode") {
1177 enabled = skia_use_libwebp_encode
1178 public_defines = [ "SK_ENCODE_WEBP" ]
1179
Mike Kleina01c6b02020-04-01 13:47:34 -05001180 deps = [ "//third_party/libwebp" ]
1181 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001182}
1183
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001184optional("wuffs") {
1185 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001186 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001187
Mike Kleina01c6b02020-04-01 13:47:34 -05001188 deps = [ "//third_party/wuffs" ]
1189 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001190}
1191
mtklein63213812016-08-24 09:55:56 -07001192optional("xml") {
1193 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001194 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001195
Mike Kleina01c6b02020-04-01 13:47:34 -05001196 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001197 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001198 "src/svg/SkSVGCanvas.cpp",
1199 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001200 "src/xml/SkDOM.cpp",
1201 "src/xml/SkXMLParser.cpp",
1202 "src/xml/SkXMLWriter.cpp",
1203 ]
1204}
1205
Mike Klein613ad382019-06-06 11:42:02 -05001206optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001207 enabled = skia_enable_skvm_jit_when_possible
1208 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001209 if (skia_vtune_path != "") {
1210 public_defines += [ "SKVM_JIT_VTUNE" ]
1211 public_include_dirs = [ "$skia_vtune_path/include" ]
1212 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1213 }
Mike Klein613ad382019-06-06 11:42:02 -05001214}
1215
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001216if (skia_enable_gpu && skia_generate_workarounds) {
1217 action("workaround_list") {
1218 script = "tools/build_workaround_header.py"
1219
Mike Kleina01c6b02020-04-01 13:47:34 -05001220 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001221
1222 # see comments in skia_compile_processors about out dir path shenanigans.
1223 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001224 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001225
Mike Kleina01c6b02020-04-01 13:47:34 -05001226 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001227 args = [
1228 "--output-file",
1229 "$output_file",
1230 ]
1231
1232 foreach(file, inputs) {
1233 args += [ rebase_path(file, root_build_dir) ]
1234 }
1235 }
1236}
1237
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001238skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001239 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001240 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001241
Mike Klein607b0a72018-11-07 16:17:34 -05001242 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001243 ":fontmgr_FontConfigInterface",
1244 ":fontmgr_android",
1245 ":fontmgr_custom_directory",
1246 ":fontmgr_custom_embedded",
1247 ":fontmgr_custom_empty",
1248 ":fontmgr_fontconfig",
1249 ":fontmgr_fuchsia",
1250 ":fontmgr_mac_ct",
1251 ":fontmgr_win",
1252 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001253 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001254 ":pdf",
1255 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001256 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001257 ]
1258
mtkleinc04ff472016-06-23 10:29:30 -07001259 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001260 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001261 ":arm64",
1262 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001263 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001264 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001265 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001266 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001267 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001268 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001269 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001270 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001271 ":jpeg_decode",
1272 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001273 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001274 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001275 ":png_decode",
1276 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001277 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001278 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001279 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001280 ":sse2",
1281 ":sse41",
1282 ":sse42",
1283 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001284 ":webp_decode",
1285 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001286 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001287 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001288 ]
1289
Hal Canaryc25f4e92019-02-26 11:54:25 -05001290 public = skia_core_public
1291 public += skia_utils_public
1292 public += skia_effects_public
1293 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001294
mtkleinc04ff472016-06-23 10:29:30 -07001295 sources = []
brettwb9447282016-09-01 14:24:39 -07001296 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001297 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001298 sources += skia_effects_sources
1299 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001300 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001301 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001302 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001303 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001304 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001305 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001306 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001307 "src/codec/SkBmpCodec.cpp",
1308 "src/codec/SkBmpMaskCodec.cpp",
1309 "src/codec/SkBmpRLECodec.cpp",
1310 "src/codec/SkBmpStandardCodec.cpp",
1311 "src/codec/SkCodec.cpp",
1312 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001313 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001314 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001315 "src/codec/SkMaskSwizzler.cpp",
1316 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001317 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001318 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001319 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001320 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001321 "src/codec/SkSwizzler.cpp",
1322 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001323 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001324 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001325 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001326 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001327 "src/ports/SkMemory_malloc.cpp",
1328 "src/ports/SkOSFile_stdio.cpp",
1329 "src/sfnt/SkOTTable_name.cpp",
1330 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001331 ]
brettwb9447282016-09-01 14:24:39 -07001332
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001333 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001334 libs = []
1335
mtkleinc04ff472016-06-23 10:29:30 -07001336 if (is_win) {
1337 sources += [
1338 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001339 "src/ports/SkImageEncoder_WIC.cpp",
1340 "src/ports/SkImageGeneratorWIC.cpp",
1341 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001342 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001343 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001344 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001345 "Ole32.lib",
1346 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001347 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001348
1349 if (!skia_enable_winuwp) {
1350 libs += [
1351 "FontSub.lib",
1352 "User32.lib",
1353 "Usp10.lib",
1354 ]
1355 }
mtkleinc04ff472016-06-23 10:29:30 -07001356 } else {
1357 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001358 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001359 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001360 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001361 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001362 }
1363
mtklein7d6fb2c2016-08-25 14:50:44 -07001364 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001365 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001366 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001367 deps += [ "//third_party/cpu-features" ]
1368 }
mtklein06c35c02016-09-20 12:28:12 -07001369 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001370 libs += [
1371 "EGL",
1372 "GLESv2",
1373 "log",
1374 ]
1375 }
1376
Kevin Lubick217056c2018-09-20 17:39:31 -04001377 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001378 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001379 if (skia_use_egl) {
1380 libs += [ "GLESv2" ]
1381 }
mtkleinc04ff472016-06-23 10:29:30 -07001382 }
1383
1384 if (is_mac) {
1385 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001386 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001387 "src/ports/SkImageEncoder_CG.cpp",
1388 "src/ports/SkImageGeneratorCG.cpp",
1389 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001390 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001391 "ApplicationServices.framework",
1392 "OpenGL.framework",
1393 ]
mtkleinc04ff472016-06-23 10:29:30 -07001394 }
abarth6fc8ff02016-07-15 15:15:15 -07001395
Mike Klein7d302882016-11-03 14:06:31 -04001396 if (is_ios) {
1397 sources += [
1398 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001399 "src/ports/SkImageEncoder_CG.cpp",
1400 "src/ports/SkImageGeneratorCG.cpp",
1401 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001402 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001403 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001404 "ImageIO.framework",
1405 "MobileCoreServices.framework",
1406 ]
1407 }
1408
abarth6fc8ff02016-07-15 15:15:15 -07001409 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001410 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001411 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001412
1413 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001414 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001415 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1416 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001417
1418 if (skia_include_multiframe_procs) {
1419 sources += [ "tools/SkSharingProc.cpp" ]
1420 }
mtkleinc04ff472016-06-23 10:29:30 -07001421}
1422
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001423# DebugCanvas used in experimental/wasm-skp-debugger
1424if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001425 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001426 public_configs = [ ":skia_public" ]
1427
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001428 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001429 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001430 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001431 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001432 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001433 "tools/debugger/DrawCommand.cpp",
1434 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001435 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001436 }
1437}
1438
Ben Wagner25eb5342021-03-22 14:07:15 -04001439skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001440 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001441 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001442 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001443
1444 deps = [
1445 ":arm64",
1446 ":armv7",
1447 ":avx",
1448 ":crc32",
1449 ":hsw",
1450 ":none",
1451 ":sse2",
1452 ":sse41",
1453 ":sse42",
1454 ":ssse3",
1455 ]
1456
Kevin Lubickcbcff382018-10-02 09:02:18 -04001457 sources = []
1458 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001459 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001460 sources += [
1461 "src/core/SkAnalyticEdge.cpp",
1462 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001463 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001464 "src/core/SkCubicMap.cpp",
1465 "src/core/SkEdge.cpp",
1466 "src/core/SkEdgeBuilder.cpp",
1467 "src/core/SkEdgeClipper.cpp",
1468 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001469 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001470 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001471 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001472 "src/core/SkMallocPixelRef.cpp",
1473 "src/core/SkMath.cpp",
1474 "src/core/SkMatrix.cpp",
1475 "src/core/SkOpts.cpp",
1476 "src/core/SkPaint.cpp",
1477 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001478 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001479 "src/core/SkPathEffect.cpp",
1480 "src/core/SkPathMeasure.cpp",
1481 "src/core/SkPathRef.cpp",
1482 "src/core/SkPoint.cpp",
1483 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001484 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001485 "src/core/SkRect.cpp",
1486 "src/core/SkSemaphore.cpp",
1487 "src/core/SkStream.cpp",
1488 "src/core/SkString.cpp",
1489 "src/core/SkStringUtils.cpp",
1490 "src/core/SkStroke.cpp",
1491 "src/core/SkStrokeRec.cpp",
1492 "src/core/SkStrokerPriv.cpp",
1493 "src/core/SkThreadID.cpp",
1494 "src/core/SkUtils.cpp",
1495 "src/effects/SkDashPathEffect.cpp",
1496 "src/effects/SkTrimPathEffect.cpp",
1497 "src/ports/SkDebug_stdio.cpp",
1498 "src/ports/SkMemory_malloc.cpp",
1499 "src/utils/SkDashPath.cpp",
1500 "src/utils/SkParse.cpp",
1501 "src/utils/SkParsePath.cpp",
1502 "src/utils/SkUTF.cpp",
1503 ]
1504}
1505
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001506group("modules") {
1507 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001508 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001509 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001510 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001511 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001512 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001513 ]
1514}
1515
Brian Osmancd28fa62020-07-07 16:01:26 -04001516config("our_vulkan_headers") {
1517 include_dirs = [ "include/third_party/vulkan" ]
1518}
1519
mtkleinc095df52016-08-24 12:23:52 -07001520# Targets guarded by skia_enable_tools may use //third_party freely.
1521if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001522 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001523 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001524 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001525 "include/c",
1526 "include/codec",
1527 "include/config",
1528 "include/core",
1529 "include/docs",
1530 "include/effects",
1531 "include/encode",
1532 "include/gpu",
1533 "include/pathops",
1534 "include/ports",
1535 "include/svg",
1536 "include/utils",
1537 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001538 "modules/particles/include",
1539 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001540 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001541 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001542 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001543 ]
1544
Mike Klein308b5ac2016-12-06 16:03:52 -05001545 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001546 skia_source_set("public") {
1547 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001548 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001549 }
1550
Mike Kleinc36dedf2016-11-18 09:35:28 -05001551 config("skia.h_config") {
1552 include_dirs = [ "$target_gen_dir" ]
1553 }
1554 action("skia.h") {
1555 public_configs = [ ":skia.h_config" ]
1556 skia_h = "$target_gen_dir/skia.h"
1557 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001558
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001559 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1560 [ rebase_path(skia_h, root_build_dir) ] +
1561 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001562 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001563 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001564 }
1565
Brian Osmanc9a42472018-05-31 13:17:12 -04001566 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001567 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001568 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001569 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001570 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001571 "tools/fiddle/draw.cpp",
1572 "tools/fiddle/fiddle_main.cpp",
1573 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001574
1575 if (skia_use_egl) {
1576 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001577 } else {
1578 sources += [ "tools/fiddle/null_context.cpp" ]
1579 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001580 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001581 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001582 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001583 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001584 ":skia",
1585 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001586 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001587 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001588 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001589 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001590 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001591 ]
1592 }
1593 }
1594
Mike Kleine5463e62020-06-11 13:53:53 -05001595 config("cpp14") {
1596 if (is_win) {
1597 cflags_cc = [ "/std:c++14" ]
1598 } else {
1599 cflags_cc = [ "-std=c++14" ]
1600 }
1601 }
1602
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001603 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001604 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001605 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001606 ":our_vulkan_headers",
1607 ":cpp14",
1608 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001609 if (defined(skia_header_target_default_configs)) {
1610 configs += skia_header_target_default_configs
1611 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001612 deps = [
1613 ":skia",
1614 ":skia.h",
1615 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001616 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001617 ]
Stephen White0d70b712019-07-10 15:51:30 -04001618
1619 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001620 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001621 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001622 }
1623
mtkleinc095df52016-08-24 12:23:52 -07001624 template("test_lib") {
1625 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001626 if (defined(invoker.public_defines)) {
1627 defines = invoker.public_defines
1628 }
mtklein25c81d42016-07-27 13:55:26 -07001629 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001630 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001631 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001632 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001633 public_configs = [
1634 ":" + target_name + "_config",
1635 ":skia_private",
1636 ]
1637
1638 if (!defined(deps)) {
1639 deps = []
1640 }
1641 deps += [ ":skia" ]
1642 testonly = true
1643 }
mtklein25c81d42016-07-27 13:55:26 -07001644 }
mtklein25c81d42016-07-27 13:55:26 -07001645
Mike Kleine6682eb2017-01-05 10:54:57 -05001646 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001647 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001648 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001649 forward_variables_from(invoker,
1650 "*",
1651 [
1652 "output_name",
1653 "visibility",
1654 "is_shared_library",
1655 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001656 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001657 extra_configs = [ ":skia_private" ]
1658 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1659 data_sources = [ "resources" ]
1660 if ("True" == exec_script("//gn/checkdir.py",
1661 [ rebase_path("skps", root_build_dir) ],
1662 "trim string")) {
1663 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001664 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001665 }
1666 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001667 # !is_ios
1668
1669 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001670 skia_shared_library("lib" + target_name) {
1671 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001672 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001673 if (!defined(configs)) {
1674 configs = []
1675 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001676 configs += [ ":skia_private" ]
1677 testonly = true
1678 }
1679 } else {
1680 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001681 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001682 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001683 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001684 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001685 if (!defined(configs)) {
1686 configs = []
1687 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001688 configs += [ ":skia_private" ]
1689 testonly = true
1690 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001691 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001692 if (is_android && skia_android_serial != "" && defined(_executable)) {
1693 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001694 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001695 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001696 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001697 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001698 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001699 args = [
1700 rebase_path("$root_build_dir/$_executable"),
1701 skia_android_serial,
1702 rebase_path(_stamp),
1703 ]
1704 testonly = true
1705 }
Mike Klein7d921032017-01-05 12:20:41 -05001706 }
1707 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001708 }
1709
mtkleinc095df52016-08-24 12:23:52 -07001710 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001711 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001712
Mike Klein9e25bb92019-04-29 09:46:36 -05001713 # Bots and even devs may not have Vulkan headers, so put
1714 # include/third_party/vulkan on our path so they're always available.
1715 all_dependent_configs = [ ":our_vulkan_headers" ]
1716
Mike Klein333fb452019-04-24 08:48:11 -05001717 defines = []
1718 if (skia_enable_discrete_gpu) {
1719 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1720 }
1721
Brian Osmanc9a42472018-05-31 13:17:12 -04001722 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001723 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001724 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001725 "tools/gpu/BackendSurfaceFactory.cpp",
1726 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001727 "tools/gpu/BackendTextureImageFactory.cpp",
1728 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001729 "tools/gpu/FlushFinishTracker.cpp",
1730 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001731 "tools/gpu/GrContextFactory.cpp",
1732 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001733 "tools/gpu/ManagedBackendTexture.cpp",
1734 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001735 "tools/gpu/MemoryCache.cpp",
1736 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001737 "tools/gpu/ProxyUtils.cpp",
1738 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001739 "tools/gpu/TestOps.cpp",
1740 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001741 "tools/gpu/YUVUtils.cpp",
1742 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001743 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1744 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001745 "tools/gpu/mock/MockTestContext.cpp",
1746 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001747
1748 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001749 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001750
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001751 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001752 sources +=
1753 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001754 if (is_ios) {
1755 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001756 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001757 } else if (is_mac) {
1758 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001759 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001760 if (skia_use_angle) {
1761 deps += [ "//third_party/angle2" ]
1762 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1763 }
Brian Salomon1171d312020-03-19 08:47:44 -04001764 }
1765
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001766 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1767 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001768 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001769 if (is_android || skia_use_egl) {
1770 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1771 libs += [ "EGL" ]
1772 } else if (is_linux) {
1773 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1774 libs += [
1775 "GLU",
1776 "GL",
1777 "X11",
1778 ]
1779 } else if (is_win) {
1780 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1781 libs += [ "Gdi32.lib" ]
1782 if (target_cpu != "arm64") {
1783 libs += [ "OpenGL32.lib" ]
1784 }
1785 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001786 }
Greg Daniel54200e42018-12-11 17:03:39 -05001787
Brian Osmanc9a42472018-05-31 13:17:12 -04001788 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001789 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001790 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001791 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1792 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001793 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001794 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001795 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1796 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001797 }
1798 if (skia_use_metal) {
1799 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001800 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001801 if (skia_use_direct3d) {
1802 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001803 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001804 }
Stephen White985741a2019-07-18 11:43:45 -04001805 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001806 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001807 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001808 if (is_clang) {
1809 cflags_cc = [ "-Wno-microsoft-cast" ]
1810 }
Stephen White985741a2019-07-18 11:43:45 -04001811 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001812
1813 if (is_fuchsia && using_fuchsia_sdk) {
1814 libs +=
1815 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1816 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001817 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001818
mtkleinc095df52016-08-24 12:23:52 -07001819 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001820 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001821 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001822
1823 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001824 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1825 deps = [ ":flags" ]
1826 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001827 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001828 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001829 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1830 deps = [ ":flags" ]
1831 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001832 }
1833 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001834 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1835 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001836 }
1837 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001838 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1839 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001840 }
mtklein25c81d42016-07-27 13:55:26 -07001841
Mike Klein499f0ac2019-03-25 13:00:12 -05001842 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001843 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001844 sources = [
1845 "tools/trace/ChromeTracingTracer.cpp",
1846 "tools/trace/ChromeTracingTracer.h",
1847 "tools/trace/EventTracingPriv.cpp",
1848 "tools/trace/EventTracingPriv.h",
1849 "tools/trace/SkDebugfTracer.cpp",
1850 "tools/trace/SkDebugfTracer.h",
1851 ]
1852 }
1853
mtkleinc095df52016-08-24 12:23:52 -07001854 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001855 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001856 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001857 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001858 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001859 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001860 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001861 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001862 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001863 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001864 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001865 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001866 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001867 "tools/SkMetaData.cpp",
1868 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001869 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001870 "tools/SkSharingProc.h",
1871 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001872 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001873 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001874 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001875 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001876 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001877 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001878 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001879 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001880 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001881 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001882 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001883 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001884 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001885 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001886 "tools/fonts/TestEmptyTypeface.h",
1887 "tools/fonts/TestFontMgr.cpp",
1888 "tools/fonts/TestFontMgr.h",
1889 "tools/fonts/TestSVGTypeface.cpp",
1890 "tools/fonts/TestSVGTypeface.h",
1891 "tools/fonts/TestTypeface.cpp",
1892 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001893 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001894 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001895 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001896 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001897 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001898 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001899 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001900 if (target_cpu != "wasm") {
1901 sources += [ "tools/CrashHandler.cpp" ]
1902 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001903 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001904 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001905 if (is_ios) {
1906 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001907 sources += [ "tools/ios_utils.h" ]
1908 if (skia_use_metal) {
1909 sources += [ "tools/AutoreleasePool.mm" ]
1910 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001911 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001912 } else if (is_mac) {
1913 if (skia_use_metal) {
1914 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001915 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001916 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001917 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001918 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001919 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001920
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001921 defines = []
1922 if (skia_tools_require_resources) {
1923 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1924 }
mtkleinc095df52016-08-24 12:23:52 -07001925 deps = [
1926 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001927 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001928 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001929 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001930 }
mtklein25c81d42016-07-27 13:55:26 -07001931
Mike Kleine11e5c12019-04-24 12:46:06 -05001932 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001933 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001934 }
1935
Mike Klein6e744122016-10-27 12:21:40 -04001936 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001937 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001938 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001939 if (skia_use_gl) {
1940 sources += gl_gm_sources
1941 }
mtkleinc095df52016-08-24 12:23:52 -07001942 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001943 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001944 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001945 ":skia",
1946 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001947 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001948 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001949 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001950 "modules/skparagraph",
1951 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001952 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001953 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001954 if (is_skia_dev_build) {
1955 sources += [ "gm/fiddle.cpp" ]
1956 deps += [ ":skia.h" ]
1957 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001958 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001959
1960 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001961 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001962 sources += [ "gm/video_decoder.cpp" ]
1963 }
mtkleinc095df52016-08-24 12:23:52 -07001964 }
mtklein25c81d42016-07-27 13:55:26 -07001965
Ben Wagnerbded42a2021-02-17 22:14:34 -05001966 test_lib("test") {
1967 sources = [
1968 "tests/Test.cpp",
1969 "tests/Test.h",
1970 "tests/TestUtils.cpp",
1971 "tests/TestUtils.h",
1972 ]
1973 deps = [
1974 ":flags",
1975 ":skia",
1976 ":tool_utils",
1977 ]
1978 public_deps = [
1979 ":gpu_tool_utils", # Test.h #includes headers from this target.
1980 ]
1981 }
1982
Mike Klein6e744122016-10-27 12:21:40 -04001983 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001984 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001985 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001986 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001987 if (skia_use_metal) {
1988 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001989 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001990 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001991 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001992 if (skia_use_gl) {
1993 sources += gl_tests_sources
1994 }
mtkleinc095df52016-08-24 12:23:52 -07001995 deps = [
1996 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05001997 ":fontmgr_android_tests",
1998 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00001999 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002000 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002001 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002002 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002003 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002004 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002005 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002006 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002007 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002008 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002009 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002010 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002011 "//third_party/zlib",
2012 ]
2013 }
mtklein2f3416d2016-08-02 16:02:05 -07002014
Mike Klein6e744122016-10-27 12:21:40 -04002015 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002016 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002017 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07002018 deps = [
2019 ":flags",
2020 ":gm",
2021 ":gpu_tool_utils",
2022 ":skia",
2023 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002024 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002025 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002026 ]
2027 }
mtklein2b6870c2016-07-28 14:17:33 -07002028
Mike Reedd62d4062019-06-12 10:20:44 -04002029 test_lib("experimental_xform") {
2030 sources = [
2031 "experimental/xform/SkShape.cpp",
2032 "experimental/xform/SkXform.cpp",
2033 "experimental/xform/XContext.cpp",
2034 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002035 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002036 }
2037
Florin Malitabfe876a2018-09-02 12:33:59 -04002038 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04002039 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002040 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04002041 }
Florin Malitab3418102020-10-15 18:10:29 -04002042 test_app("svg_tool") {
2043 deps = [ "modules/svg:tool" ]
2044 }
Florin Malita79725d32018-06-05 16:16:57 -04002045 }
2046
Hal Canary5b39dc82019-04-17 13:29:46 -04002047 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002048 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2049 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002050 }
2051
Chris Dalton2b598902020-03-25 10:50:35 -06002052 import("gn/samples.gni")
2053 test_lib("samples") {
2054 sources = samples_sources
Mike Kleina01c6b02020-04-01 13:47:34 -05002055 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002056 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002057 ":flags",
2058 ":gpu_tool_utils",
2059 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002060 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002061 "modules/skparagraph:samples",
2062 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002063 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002064 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002065 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002066 }
Kevin Lubick00398742020-10-08 10:05:07 -04002067 test_lib("hash_and_encode") {
2068 sources = [
2069 "tools/HashAndEncode.cpp",
2070 "tools/HashAndEncode.h",
2071 ]
2072 deps = [
2073 ":flags",
2074 ":skia",
2075 "//third_party/libpng",
2076 ]
2077 }
Chris Dalton2b598902020-03-25 10:50:35 -06002078 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002079 test_app("convert-to-nia") {
2080 sources = [ "tools/convert-to-nia.cpp" ]
2081 deps = [ ":skia" ]
2082 }
Mike Klein7af351a2018-07-27 09:54:43 -04002083 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002084 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002085 deps = [
2086 ":skcms",
2087 ":skia",
2088 ]
2089 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002090 test_app("fm") {
2091 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002092 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002093 "tools/fm/fm.cpp",
2094 ]
2095 deps = [
2096 ":common_flags_aa",
2097 ":common_flags_gpu",
2098 ":flags",
2099 ":gm",
2100 ":gpu_tool_utils",
2101 ":hash_and_encode",
2102 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002103 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002104 ":tool_utils",
2105 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002106 "modules/skottie",
2107 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002108 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002109 ]
2110 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002111 test_app("dm") {
2112 sources = [
2113 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002114 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002115 "dm/DMJsonWriter.cpp",
2116 "dm/DMSrcSink.cpp",
2117 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002118 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002119 ":common_flags_aa",
2120 ":common_flags_config",
2121 ":common_flags_gpu",
2122 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002123 ":flags",
2124 ":gm",
2125 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002126 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002127 ":skia",
2128 ":tests",
2129 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002130 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002131 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002132 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002133 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002134 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002135 ]
2136 }
Robert Phillipscd1e3972021-02-22 17:24:22 -05002137 test_app("ddlbench") {
2138 sources = [ "experimental/ddlbench/ddlbench.cpp" ]
2139 deps = [
2140 ":flags",
2141 ":skia",
2142 ":tool_utils",
2143 ]
2144 }
Michael Ludwig30217952020-12-04 12:58:35 -05002145
2146 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002147 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002148 sources = [
2149 "tests/CanvasStateHelpers.cpp",
2150 "tests/CanvasStateHelpers.h",
2151 ]
2152 deps = [ ":skia" ]
2153 }
Brian Osman16adfa32016-10-18 14:42:44 -04002154 }
2155
Mike Kleina8a51ce2018-01-09 12:34:11 -05002156 if (!is_win) {
2157 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002158 sources = [ "tools/remote_demo.cpp" ]
2159 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002160 }
2161 }
2162
Hal Canarye107faa2019-10-23 12:52:33 -04002163 if (!is_win) {
2164 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002165 sources = [ "tools/blob_cache_sim.cpp" ]
2166 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002167 }
2168 }
2169
Mike Kleine6682eb2017-01-05 10:54:57 -05002170 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002171 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002172 deps = [
2173 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002174 ":common_flags_aa",
2175 ":common_flags_config",
2176 ":common_flags_gpu",
2177 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002178 ":flags",
2179 ":gm",
2180 ":gpu_tool_utils",
2181 ":skia",
2182 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002183 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002184 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002185 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002186 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002187 ]
mtklein2b6870c2016-07-28 14:17:33 -07002188 }
halcanary19a97202016-08-03 15:08:04 -07002189
Ravi Mistry10d36c52017-01-31 09:49:18 -05002190 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002191 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002192 deps = [
2193 ":flags",
2194 ":skia",
2195 ]
2196 }
2197
Mike Reedc0ee21f2019-05-28 16:11:03 -04002198 if (skia_use_ffmpeg) {
2199 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002200 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002201 deps = [
2202 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002203 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002204 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002205 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002206 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002207 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002208 ]
2209 }
2210 }
2211
Brian Osmanc9a42472018-05-31 13:17:12 -04002212 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002213 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002214 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002215 ":common_flags_config",
2216 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002217 ":flags",
2218 ":gpu_tool_utils",
2219 ":skia",
2220 ":tool_utils",
2221 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002222 }
2223
Mike Kleine6682eb2017-01-05 10:54:57 -05002224 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002225 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002226 deps = [
2227 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002228 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002229 ]
halcanary3eee9d92016-09-10 07:01:53 -07002230 }
mtklein046cb562016-09-16 10:23:12 -07002231
Ben Wagner219f3622017-07-17 15:32:25 -04002232 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002233 sources = [ "tools/fonts/create_test_font.cpp" ]
2234 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002235 assert_no_deps = [
2236 # tool_utils requires the output of this app.
2237 ":tool_utils",
2238 ]
2239 }
2240
Florin Malita5d3ff432018-07-31 16:38:43 -04002241 if (skia_use_expat) {
2242 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002243 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002244 deps = [
2245 ":flags",
2246 ":skia",
2247 ":tool_utils",
2248 ]
2249 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002250 }
2251
Mike Kleine6682eb2017-01-05 10:54:57 -05002252 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002253 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002254 deps = [
2255 ":flags",
2256 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002257 ]
mtklein046cb562016-09-16 10:23:12 -07002258 }
mtkleinecbc5262016-09-22 11:51:24 -07002259
Brian Osman6788a542018-12-10 11:56:01 -05002260 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002261 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002262 sources = [
2263 "tools/skiaserve/Request.cpp",
2264 "tools/skiaserve/Response.cpp",
2265 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002266 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2267 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2268 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2269 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2270 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2271 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2272 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2273 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2274 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002275 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2276 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002277 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2278 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2279 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2280 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2281 ]
2282 deps = [
2283 ":flags",
2284 ":gpu_tool_utils",
2285 ":skia",
2286 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002287 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002288 ]
Mike Klein7d302882016-11-03 14:06:31 -04002289 }
mtkleinecbc5262016-09-22 11:51:24 -07002290 }
kjlubick14f984b2016-10-03 11:49:45 -07002291
Mike Kleine6682eb2017-01-05 10:54:57 -05002292 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002293 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002294 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002295 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002296 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002297 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002298 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002299 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002300 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002301 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002302 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002303 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002304 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002305 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002306 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002307 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002308 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002309 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002310 "fuzz/FuzzSkParagraph.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002311 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002312 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2313 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002314 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002315 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002316 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002317 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002318 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2319 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002320 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002321 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2322 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002323 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002324 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002325 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002326 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002327 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002328 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002329 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002330 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002331 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002332 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002333 "tools/debugger/DrawCommand.cpp",
2334 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002335 ]
2336 deps = [
2337 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002338 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002339 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002340 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002341 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002342 ]
kjlubick14f984b2016-10-03 11:49:45 -07002343 }
Mike Klein38312422016-10-05 15:41:01 -04002344
Mike Kleine6682eb2017-01-05 10:54:57 -05002345 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002346 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002347 rebase_path("tests/skia_test.cpp"),
2348 rebase_path("tests/Test.cpp"),
2349 ]
caryclark9feb6322016-10-25 08:58:26 -07002350 deps = [
2351 ":flags",
2352 ":gpu_tool_utils",
2353 ":skia",
2354 ":tool_utils",
2355 ]
caryclark9feb6322016-10-25 08:58:26 -07002356 }
2357
Mike Kleine6682eb2017-01-05 10:54:57 -05002358 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002359 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002360 deps = [
2361 ":flags",
2362 ":skia",
2363 ]
Mike Klein38312422016-10-05 15:41:01 -04002364 }
bungemanfe917272016-10-13 17:36:40 -04002365
Mike Kleine6682eb2017-01-05 10:54:57 -05002366 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002367 sources = [
2368 "tools/skdiff/skdiff.cpp",
2369 "tools/skdiff/skdiff_html.cpp",
2370 "tools/skdiff/skdiff_main.cpp",
2371 "tools/skdiff/skdiff_utils.cpp",
2372 ]
2373 deps = [
2374 ":skia",
2375 ":tool_utils",
2376 ]
bungemanfe917272016-10-13 17:36:40 -04002377 }
halcanarya73d76a2016-10-17 13:19:02 -07002378
Mike Kleine6682eb2017-01-05 10:54:57 -05002379 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002380 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002381 deps = [
2382 ":skia",
2383 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002384 ]
halcanarya73d76a2016-10-17 13:19:02 -07002385 }
Brian Osman16adfa32016-10-18 14:42:44 -04002386
Brian Osmanc9a42472018-05-31 13:17:12 -04002387 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002388 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002389 check_includes = false
2390 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002391 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002392 defines =
2393 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002394 sources = [
2395 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002396 "tools/skqp/src/skqp.cpp",
2397 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002398 ]
2399 deps = [
2400 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002401 ":skia",
2402 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002403 ":tool_utils",
2404 ]
2405 }
2406 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002407 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002408 include_dirs = [ "//" ]
2409 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002410 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002411 }
2412 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002413 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002414 deps = [
2415 ":gm",
2416 ":skia",
2417 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002418 ]
2419 }
2420 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002421 if (is_fuchsia) {
2422 # Build a package repository for skqp on Fuchsia.
2423 group("skqp_repo") {
2424 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002425 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002426 }
2427 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002428 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002429 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002430 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002431 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002432 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002433 deps = [
2434 ":skia",
2435 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002436 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002437 ]
2438 libs = [ "android" ]
2439 }
2440 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002441 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002442 test_app("skottie_android") {
2443 is_shared_library = true
2444
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002445 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002446 libs = []
2447
Stan Iliev93151722018-08-02 11:10:52 -04002448 deps = [
2449 ":skia",
2450 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002451 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002452 ]
2453 }
2454 }
Hal Canary75427132017-10-11 16:00:31 -04002455
Hal Canarya9de7602018-01-19 13:08:23 -05002456 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002457 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002458 deps = [
2459 ":gm",
2460 ":skia",
2461 ]
2462 }
2463 test_app("list_gpu_unit_tests") {
2464 sources = [
2465 "dm/DMGpuTestProcs.cpp",
2466 "tools/list_gpu_unit_tests.cpp",
2467 ]
2468 deps = [
2469 ":skia",
2470 ":tests",
2471 ]
2472 }
2473
Brian Osmanc9a42472018-05-31 13:17:12 -04002474 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002475 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002476 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002477 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002478 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002479 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002480 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002481 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002482 "tools/sk_app/CommandSet.h",
2483 "tools/sk_app/DisplayParams.h",
2484 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002485 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002486 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002487 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002488 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002489 ]
2490 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002491 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002492
2493 if (is_android) {
2494 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002495 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002496 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002497 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002498 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002499 "tools/sk_app/android/main_android.cpp",
2500 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002501 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002502 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002503 libs += [ "android" ]
2504 } else if (is_linux) {
2505 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002506 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002507 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002508 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002509 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002510 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002511 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002512 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002513 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002514 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002515 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002516 "X11",
2517 ]
2518 } else if (is_win) {
2519 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002520 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002521 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002522 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002523 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002524 "tools/sk_app/win/main_win.cpp",
2525 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002526 } else if (is_mac) {
2527 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002528 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002529 "tools/sk_app/mac/WindowContextFactory_mac.h",
2530 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002531 "tools/sk_app/mac/Window_mac.mm",
2532 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002533 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002534 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002535 "QuartzCore.framework",
2536 "Cocoa.framework",
2537 "Foundation.framework",
2538 ]
2539 } else if (is_ios) {
2540 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002541 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002542 "tools/sk_app/ios/WindowContextFactory_ios.h",
2543 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002544 "tools/sk_app/ios/Window_ios.mm",
2545 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002546 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002547 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002548 }
2549
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002550 if (skia_use_gl) {
2551 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002552 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002553 if (is_android) {
2554 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2555 } else if (is_linux) {
2556 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2557 } else if (is_win) {
2558 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2559 if (skia_use_angle) {
2560 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2561 }
2562 } else if (is_mac) {
2563 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2564 } else if (is_ios) {
2565 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2566 }
2567 }
2568
Brian Osmanc9a42472018-05-31 13:17:12 -04002569 if (skia_use_vulkan) {
2570 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002571 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002572 if (is_android) {
2573 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2574 } else if (is_linux) {
2575 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2576 libs += [ "X11-xcb" ]
2577 } else if (is_win) {
2578 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2579 }
2580 }
2581
Jim Van Verthbe39f712019-02-08 15:36:14 -05002582 if (skia_use_metal) {
2583 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002584 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002585 if (is_mac) {
2586 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002587 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002588 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002589 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002590 }
2591
Jim Van Verth682a2f42020-05-13 16:54:09 -04002592 if (skia_use_direct3d) {
2593 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2594 }
2595
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002596 if (skia_use_dawn) {
2597 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002598 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002599 if (is_linux) {
2600 if (dawn_enable_vulkan) {
2601 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2602 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2603 libs += [ "X11-xcb" ]
2604 }
2605 } else if (is_win) {
2606 if (dawn_enable_d3d12) {
2607 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2608 }
2609 } else if (is_mac) {
2610 if (dawn_enable_metal) {
2611 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2612 }
2613 }
2614 }
2615
Mike Kleina01c6b02020-04-01 13:47:34 -05002616 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002617 if (is_android) {
2618 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002619 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002620 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002621 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002622 }
Brian Osman16adfa32016-10-18 14:42:44 -04002623 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002624
Hal Canary87515122019-03-15 14:22:51 -04002625 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2626 test_app("fiddle_examples") {
2627 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002628 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002629 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002630 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002631 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002632 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002633 cflags = [
2634 "/wd4756", # Overflow in constant arithmetic
2635 "/wd4305", # truncation from 'double' to 'float'
2636 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002637 }
Hal Canary87515122019-03-15 14:22:51 -04002638 deps = [
2639 ":skia",
2640 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002641 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002642 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002643 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002644 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002645 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002646 ]
2647 }
2648 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002649
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002650 # sk_app can work without GL but viewer always runs raster through a GL window context.
2651 if (skia_use_gl) {
2652 test_app("viewer") {
2653 is_shared_library = is_android
2654 sources = [
2655 "tools/viewer/AnimTimer.h",
2656 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002657 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002658 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002659 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002660 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002661 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002662 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002663 "tools/viewer/ImageSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002664 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002665 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002666 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002667 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002668 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002669 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002670 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002671 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002672 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002673 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002674 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002675 "tools/viewer/SkottieSlide.h",
2676 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002677 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002678 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002679 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002680 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002681 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002682 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002683 "tools/viewer/TouchGesture.cpp",
2684 "tools/viewer/TouchGesture.h",
2685 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002686 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002687 ]
2688 libs = []
2689
2690 deps = [
2691 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002692 ":flags",
2693 ":gm",
2694 ":gpu_tool_utils",
2695 ":samples",
2696 ":sk_app",
2697 ":skia",
2698 ":tool_utils",
2699 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002700 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002701 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002702 "modules/particles",
2703 "modules/skottie",
2704 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002705 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002706 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002707 "//third_party/imgui",
2708 ]
2709 if (skia_use_experimental_xform) {
2710 deps += [ ":experimental_xform" ]
2711 sources += [ "gm/xform.cpp" ]
2712 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002713 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002714 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002715 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002716
Corentin Wallez89d6e792021-03-08 15:25:34 +01002717 #spvtools depends on this but doesn't deps it in.
2718 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002719 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002720 }
Mike Reedd62d4062019-06-12 10:20:44 -04002721 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002722 }
2723
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002724 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002725 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002726 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002727 libs = []
2728
Brian Osmaneff04b52017-11-21 13:18:02 -05002729 deps = [
2730 ":flags",
2731 ":gpu_tool_utils",
2732 ":sk_app",
2733 ":skia",
2734 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002735 ]
2736 }
2737 }
2738
Mike Klein9f6468f2020-05-19 13:14:40 -05002739 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002740 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002741 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002742 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002743 deps = [
2744 ":gpu_tool_utils",
2745 ":skia",
2746 "//third_party/libsdl",
2747 ]
2748 }
2749 }
2750
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002751 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2752 action_foreach("generate_mocs") {
2753 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002754 sources = [ "tools/mdbviz/MainWindow.h" ]
2755 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002756 args = [
2757 "$skia_qt_path" + "/bin/moc",
2758 "{{source}}",
2759 "-o",
2760 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2761 ]
2762 }
2763 action_foreach("generate_resources") {
2764 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002765 sources = [ "tools/mdbviz/resources.qrc" ]
2766 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002767 args = [
2768 "$skia_qt_path" + "/bin/rcc",
2769 "{{source}}",
2770 "-o",
2771 "gen/mdbviz/{{source_name_part}}_res.cpp",
2772 ]
2773 }
2774 test_app("mdbviz") {
2775 if (is_win) {
2776 # on Windows we need to disable some exception handling warnings due to the Qt headers
2777 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2778 }
2779 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002780 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002781 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002782 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002783 "tools/debugger/DrawCommand.cpp",
2784 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002785 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002786 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002787 "tools/mdbviz/main.cpp",
2788
2789 # generated files
2790 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2791 "$target_gen_dir/mdbviz/resources_res.cpp",
2792 ]
2793 lib_dirs = [ "$skia_qt_path/lib" ]
2794 libs = [
2795 "Qt5Core.lib",
2796 "Qt5Gui.lib",
2797 "Qt5Widgets.lib",
2798 ]
2799 include_dirs = [
2800 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002801 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002802 "$skia_qt_path/include/QtWidgets",
2803 ]
2804 deps = [
2805 ":generate_mocs",
2806 ":generate_resources",
2807 ":skia",
2808 ]
2809 }
2810 }
2811
Mike Kleine459afd2017-03-03 09:21:30 -05002812 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002813 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002814 sources = [ "$ndk/$ndk_gdbserver" ]
2815 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002816 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002817 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002818
2819 if (skia_use_opencl) {
2820 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002821 sources = [ "tools/hello-opencl.cpp" ]
2822 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002823 }
2824 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002825
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002826 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002827 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002828 deps = [
2829 ":skia",
2830 "modules/particles",
2831 ]
2832 }
2833
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002834 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002835 test_app("editor") {
2836 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002837 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002838 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002839 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002840
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002841 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002842 sources = [ "tools/image_diff_metric.cpp" ]
2843 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002844 }
Chris Dalton2b598902020-03-25 10:50:35 -06002845
2846 group("modules_testonly") {
2847 testonly = true
2848 deps = []
2849 if (target_cpu == "wasm") {
2850 deps += [ "modules/canvaskit:viewer_wasm" ]
2851 }
2852 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002853
2854 if (skia_build_fuzzers) {
2855 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002856 skia_executable(target_name) {
2857 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002858 check_includes = false
2859 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002860 if (!defined(configs)) {
2861 configs = []
2862 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002863 configs += [ ":skia_private" ]
2864 sources += [
2865 "fuzz/Fuzz.cpp",
2866 "fuzz/FuzzCommon.cpp",
2867 ]
2868 deps += [
2869 ":flags",
2870 ":gpu_tool_utils",
2871 ":skia",
2872 ]
2873 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2874 if (skia_use_libfuzzer_defaults) {
2875 cflags = [ "-fsanitize=fuzzer" ]
2876 ldflags = [ "-fsanitize=fuzzer" ]
2877 }
2878 testonly = true
2879 }
2880 }
2881
2882 libfuzzer_app("region_deserialize") {
2883 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2884 deps = []
2885 }
2886
2887 libfuzzer_app("image_filter_deserialize") {
2888 include_dirs = [
2889 "tools",
2890 "tools/fonts",
2891 ]
2892 sources = [
2893 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2894 "tools/Resources.cpp",
2895 "tools/fonts/TestFontMgr.cpp",
2896 "tools/fonts/TestSVGTypeface.cpp",
2897 "tools/fonts/TestTypeface.cpp",
2898 ]
Florin Malitab3418102020-10-15 18:10:29 -04002899 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002900 }
2901
2902 libfuzzer_app("region_set_path") {
2903 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2904 deps = []
2905 }
2906
2907 libfuzzer_app("textblob_deserialize") {
2908 include_dirs = [
2909 "tools",
2910 "tools/fonts",
2911 ]
2912 sources = [
2913 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2914 "tools/Resources.cpp",
2915 "tools/fonts/TestFontMgr.cpp",
2916 "tools/fonts/TestSVGTypeface.cpp",
2917 "tools/fonts/TestTypeface.cpp",
2918 ]
Florin Malitab3418102020-10-15 18:10:29 -04002919 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002920 }
2921
2922 libfuzzer_app("path_deserialize") {
2923 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2924 deps = []
2925 }
2926
2927 libfuzzer_app("image_decode") {
2928 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2929 deps = []
2930 }
2931
2932 libfuzzer_app("animated_image_decode") {
2933 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2934 deps = []
2935 }
2936
2937 libfuzzer_app("api_create_ddl") {
2938 include_dirs = [
2939 "include",
2940 "include/gpu",
2941 ]
2942 sources = [
2943 "fuzz/FuzzCreateDDL.cpp",
2944 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2945 "tools/Resources.cpp",
2946 "tools/UrlDataManager.cpp",
2947 "tools/debugger/DebugCanvas.cpp",
2948 "tools/debugger/DebugLayerManager.cpp",
2949 "tools/debugger/DrawCommand.cpp",
2950 "tools/debugger/JsonWriteBuffer.cpp",
2951 "tools/fonts/TestFontMgr.cpp",
2952 "tools/fonts/TestSVGTypeface.cpp",
2953 "tools/fonts/TestTypeface.cpp",
2954 ]
2955 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002956 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002957 "//third_party/libpng",
2958 ]
2959 }
2960
2961 libfuzzer_app("api_draw_functions") {
2962 sources = [
2963 "fuzz/FuzzDrawFunctions.cpp",
2964 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2965 ]
2966 deps = []
2967 }
2968
Adlai Hollerccb68662021-02-25 10:28:44 -05002969 libfuzzer_app("api_ddl_threading") {
2970 sources = [
2971 "fuzz/FuzzDDLThreading.cpp",
2972 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
2973 ]
2974 deps = []
2975 }
2976
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002977 libfuzzer_app("api_gradients") {
2978 sources = [
2979 "fuzz/FuzzGradients.cpp",
2980 "fuzz/oss_fuzz/FuzzGradients.cpp",
2981 ]
2982 deps = []
2983 }
2984
2985 libfuzzer_app("api_image_filter") {
2986 include_dirs = [
2987 "tools",
2988 "tools/debugger",
2989 ]
2990 sources = [
2991 "fuzz/FuzzCanvas.cpp",
2992 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2993 "tools/UrlDataManager.cpp",
2994 "tools/debugger/DebugCanvas.cpp",
2995 "tools/debugger/DebugLayerManager.cpp",
2996 "tools/debugger/DrawCommand.cpp",
2997 "tools/debugger/JsonWriteBuffer.cpp",
2998 ]
2999 deps = [ "//third_party/libpng" ]
3000 }
3001
3002 libfuzzer_app("api_path_measure") {
3003 sources = [
3004 "fuzz/FuzzPathMeasure.cpp",
3005 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3006 ]
3007 deps = []
3008 }
3009
3010 libfuzzer_app("api_pathop") {
3011 sources = [
3012 "fuzz/FuzzPathop.cpp",
3013 "fuzz/oss_fuzz/FuzzPathop.cpp",
3014 ]
3015 deps = []
3016 }
3017
3018 libfuzzer_app("api_raster_n32_canvas") {
3019 include_dirs = [
3020 "tools",
3021 "tools/debugger",
3022 "tools/fonts",
3023 ]
3024 sources = [
3025 "fuzz/FuzzCanvas.cpp",
3026 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3027 "tools/Resources.cpp",
3028 "tools/UrlDataManager.cpp",
3029 "tools/debugger/DebugCanvas.cpp",
3030 "tools/debugger/DebugLayerManager.cpp",
3031 "tools/debugger/DrawCommand.cpp",
3032 "tools/debugger/JsonWriteBuffer.cpp",
3033 "tools/fonts/TestFontMgr.cpp",
3034 "tools/fonts/TestSVGTypeface.cpp",
3035 "tools/fonts/TestTypeface.cpp",
3036 ]
3037 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003038 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003039 "//third_party/libpng",
3040 ]
3041 }
3042
Kevin Lubick7845b972021-03-29 08:07:32 -04003043 libfuzzer_app("api_regionop") {
3044 sources = [
3045 "fuzz/FuzzRegionOp.cpp",
3046 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3047 ]
3048 deps = []
3049 }
3050
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003051 if (skia_use_gl) {
3052 libfuzzer_app("api_mock_gpu_canvas") {
3053 include_dirs = [
3054 "tools",
3055 "tools/debugger",
3056 "tools/fonts",
3057 ]
3058 sources = [
3059 "fuzz/FuzzCanvas.cpp",
3060 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3061 "tools/LsanSuppressions.cpp",
3062 "tools/Resources.cpp",
3063 "tools/UrlDataManager.cpp",
3064 "tools/debugger/DebugCanvas.cpp",
3065 "tools/debugger/DebugLayerManager.cpp",
3066 "tools/debugger/DrawCommand.cpp",
3067 "tools/debugger/JsonWriteBuffer.cpp",
3068 "tools/fonts/TestFontMgr.cpp",
3069 "tools/fonts/TestSVGTypeface.cpp",
3070 "tools/fonts/TestTypeface.cpp",
3071 ]
3072 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003073 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003074 "//third_party/libpng",
3075 ]
3076 }
3077 }
3078
3079 libfuzzer_app("api_null_canvas") {
3080 include_dirs = [
3081 "tools",
3082 "tools/debugger",
3083 "tools/fonts",
3084 ]
3085 sources = [
3086 "fuzz/FuzzCanvas.cpp",
3087 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3088 "tools/Resources.cpp",
3089 "tools/UrlDataManager.cpp",
3090 "tools/debugger/DebugCanvas.cpp",
3091 "tools/debugger/DebugLayerManager.cpp",
3092 "tools/debugger/DrawCommand.cpp",
3093 "tools/debugger/JsonWriteBuffer.cpp",
3094 "tools/fonts/TestFontMgr.cpp",
3095 "tools/fonts/TestSVGTypeface.cpp",
3096 "tools/fonts/TestTypeface.cpp",
3097 ]
3098 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003099 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003100 "//third_party/libpng",
3101 ]
3102 }
3103
Weston Tracey1a771fe2021-02-04 11:09:59 -05003104 libfuzzer_app("api_skparagraph") {
3105 sources = [
3106 "fuzz/FuzzSkParagraph.cpp",
3107 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3108 "tools/Resources.cpp",
3109 ]
3110 deps = [ "modules/skparagraph" ]
3111 }
3112
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003113 libfuzzer_app("api_svg_canvas") {
3114 include_dirs = [
3115 "include",
3116 "include/svg",
3117 ]
3118 sources = [
3119 "fuzz/FuzzCanvas.cpp",
3120 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3121 "tools/Resources.cpp",
3122 "tools/UrlDataManager.cpp",
3123 "tools/debugger/DebugCanvas.cpp",
3124 "tools/debugger/DebugLayerManager.cpp",
3125 "tools/debugger/DrawCommand.cpp",
3126 "tools/debugger/JsonWriteBuffer.cpp",
3127 "tools/fonts/TestFontMgr.cpp",
3128 "tools/fonts/TestSVGTypeface.cpp",
3129 "tools/fonts/TestTypeface.cpp",
3130 ]
3131 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003132 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003133 "//third_party/libpng",
3134 ]
3135 }
3136
3137 libfuzzer_app("png_encoder") {
3138 sources = [
3139 "fuzz/FuzzEncoders.cpp",
3140 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3141 ]
3142 deps = []
3143 }
3144
3145 libfuzzer_app("jpeg_encoder") {
3146 sources = [
3147 "fuzz/FuzzEncoders.cpp",
3148 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3149 ]
3150 deps = []
3151 }
3152
3153 libfuzzer_app("webp_encoder") {
3154 sources = [
3155 "fuzz/FuzzEncoders.cpp",
3156 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3157 ]
3158 deps = []
3159 }
3160
3161 libfuzzer_app("skottie_json") {
3162 sources = [
3163 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3164 "tools/Resources.cpp",
3165 "tools/fonts/TestFontMgr.cpp",
3166 "tools/fonts/TestSVGTypeface.cpp",
3167 "tools/fonts/TestTypeface.cpp",
3168 ]
3169 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003170 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003171 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003172 ]
3173 }
3174
3175 libfuzzer_app("skjson") {
3176 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3177 deps = []
3178 }
3179
3180 libfuzzer_app("api_polyutils") {
3181 sources = [
3182 "fuzz/FuzzPolyUtils.cpp",
3183 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3184 ]
3185 deps = [ ":skia" ]
3186 }
3187
3188 libfuzzer_app("android_codec") {
3189 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3190 deps = []
3191 }
3192
3193 libfuzzer_app("image_decode_incremental") {
3194 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3195 deps = []
3196 }
3197
3198 libfuzzer_app("sksl2glsl") {
3199 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3200 deps = []
3201 }
3202
3203 libfuzzer_app("sksl2spirv") {
3204 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3205 deps = []
3206 }
3207
3208 libfuzzer_app("sksl2metal") {
3209 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3210 deps = []
3211 }
3212
3213 libfuzzer_app("sksl2pipeline") {
3214 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3215 deps = []
3216 }
3217
3218 libfuzzer_app("skdescriptor_deserialize") {
3219 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3220 deps = []
3221 }
3222
3223 libfuzzer_app("svg_dom") {
3224 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003225 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003226 }
3227
3228 libfuzzer_app("skruntimeeffect") {
3229 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3230 deps = []
3231 }
3232
3233 libfuzzer_app("skp") {
3234 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3235 deps = []
3236 }
3237 }
mtklein25c81d42016-07-27 13:55:26 -07003238}
Hal Canary932a2c02019-09-17 10:43:18 -04003239
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003240if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003241 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003242 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003243 }
Hal Canary27483062019-12-06 15:01:08 -05003244}
3245
Hal Canary60ff6512020-01-21 12:39:20 -05003246if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003247 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003248 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003249 }
3250}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003251
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003252skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003253 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3254 include_dirs = [ "." ]
3255 deps = [ ":skia" ]
3256}