blob: 8017657286cec875bc10bf49abe672993443822e [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) {
Brian Salomonc3915f72021-11-15 19:08:02 +000017 import("//third_party/externals/dawn/scripts/dawn_features.gni")
Stephen White0d70b712019-07-10 15:51:30 -040018}
19
Adam Barth54ef74a2017-10-13 10:59:38 -070020if (defined(skia_settings)) {
21 import(skia_settings)
22}
23
Hal Canary3388c1a2019-09-16 12:53:17 -040024import("gn/ios.gni")
25
mtkleinc04ff472016-06-23 10:29:30 -070026# Skia public API, generally provided by :skia.
27config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050028 include_dirs = [ "." ]
29
Mike Kleinae7e6712016-10-11 17:49:33 -040030 defines = []
Chinmay Gardef832c0a2020-03-18 14:37:23 -070031 cflags_objcc = []
Mike Kleinae7e6712016-10-11 17:49:33 -040032 if (is_component_build) {
33 defines += [ "SKIA_DLL" ]
34 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040035 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050036 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070037 }
Brian Osmanf2c90142017-07-13 15:50:03 -040038 if (skia_enable_flutter_defines) {
39 defines += flutter_defines
40 }
mtklein06c35c02016-09-20 12:28:12 -070041 if (!skia_enable_gpu) {
42 defines += [ "SK_SUPPORT_GPU=0" ]
43 }
Brian Osman946a4cb2021-07-12 17:02:21 -040044 if (skia_enable_sksl) {
45 defines += [ "SK_ENABLE_SKSL" ]
46 }
Mike Reed025f7832018-11-12 09:27:05 -050047 if (is_fuchsia) {
48 defines += fuchsia_defines
49 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040050 if (skia_gl_standard == "gles") {
51 defines += [ "SK_ASSUME_GL_ES=1" ]
52 } else if (skia_gl_standard == "gl") {
53 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040054 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040055 defines += [
56 "SK_ASSUME_WEBGL=1",
57 "SK_USE_WEBGL",
58 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040059 }
Robert Phillips024668c2021-07-01 12:12:52 -040060 if (!skia_enable_skgpu_v1) {
Robert Phillips7cef6782021-07-01 13:21:37 -040061 defines += [ "SK_GPU_V1=0" ]
Robert Phillips3b97aa22021-05-03 11:42:40 -040062 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070063
64 # Some older versions of the Clang toolchain change the visibility of
65 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
66 # toolchains suppress the use of this macro till toolchain updates are made.
67 if (is_mac || is_ios) {
68 if (skia_enable_api_available_macro) {
69 defines += [ "SK_ENABLE_API_AVAILABLE" ]
70 } else {
71 cflags_objcc += [ "-Wno-unguarded-availability" ]
72 }
73 }
mtkleinc04ff472016-06-23 10:29:30 -070074}
75
76# Skia internal APIs, used by Skia itself and a few test tools.
77config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060078 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070079
Mike Reeda9e241d2017-05-03 10:52:00 -040080 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050081 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070082 defines += [
83 "SK_GAMMA_EXPONENT=1.4",
84 "SK_GAMMA_CONTRAST=0.0",
85 ]
86 }
Mike Kleinb45d8622019-04-24 14:04:01 -050087 if (is_skia_dev_build) {
88 defines += [
89 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
90 "GR_TEST_UTILS=1",
91 ]
Jim Van Verth0c56bba2021-10-18 12:15:47 -040092 if (skia_enable_graphite) {
93 defines += [ "GRAPHITE_TEST_UTILS=1" ]
94 }
mtklein88a7ac02016-09-14 11:16:49 -070095 }
Brian Salomon789e25e2016-09-30 13:41:03 -040096 libs = []
97 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040098 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050099 defines += [ "SK_ANGLE" ]
100 }
Greg Danielb16beb92020-04-27 14:26:21 +0000101 if (skia_use_vma) {
102 defines += [ "SK_USE_VMA" ]
103 }
James Clarkeb8c0dab2021-02-09 06:22:41 -0800104 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -0800105 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800106 }
107}
108
mtkleinc04ff472016-06-23 10:29:30 -0700109# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
110config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600111 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000112 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700113}
114
115skia_library_configs = [
116 ":skia_public",
117 ":skia_private",
118 ":skia_library",
119]
120
mtklein9b8583d2016-08-24 17:32:30 -0700121# Use for CPU-specific Skia code that needs particular compiler flags.
122template("opts") {
123 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400124 skia_source_set(target_name) {
125 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500126 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400127 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700128 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400129 if (defined(invoker.configs)) {
130 configs += invoker.configs
131 }
mtklein9b8583d2016-08-24 17:32:30 -0700132 }
133 } else {
134 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400135 skia_source_set(target_name) {
136 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500137 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700138 forward_variables_from(invoker,
139 "*",
140 [
141 "sources",
142 "cflags",
143 ])
144 }
145 }
anmittala7eaf2e2016-08-17 13:57:26 -0700146}
147
mtklein422310d2016-08-16 18:28:43 -0700148is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700149
mtklein7d6fb2c2016-08-25 14:50:44 -0700150opts("none") {
151 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700152 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700153 cflags = []
154}
155
mtklein7d6fb2c2016-08-25 14:50:44 -0700156opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700157 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700158 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700159 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700160}
161
162opts("arm64") {
163 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700164 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700165 cflags = []
166}
167
168opts("crc32") {
169 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700170 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700171 cflags = [ "-march=armv8-a+crc" ]
172}
173
mtklein9b8583d2016-08-24 17:32:30 -0700174opts("sse2") {
175 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700176 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400177 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400178 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
179 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400180 cflags = [ "-msse2" ]
181 }
mtklein9b8583d2016-08-24 17:32:30 -0700182}
mtkleinc04ff472016-06-23 10:29:30 -0700183
mtklein9b8583d2016-08-24 17:32:30 -0700184opts("ssse3") {
185 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700186 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400187 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400188 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
189 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400190 cflags = [ "-mssse3" ]
191 }
mtklein9b8583d2016-08-24 17:32:30 -0700192}
mtkleinc04ff472016-06-23 10:29:30 -0700193
mtklein9b8583d2016-08-24 17:32:30 -0700194opts("sse41") {
195 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700196 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400197 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400198 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
199 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400200 cflags = [ "-msse4.1" ]
201 }
mtklein9b8583d2016-08-24 17:32:30 -0700202}
mtklein4e976072016-08-08 09:06:27 -0700203
mtklein9b8583d2016-08-24 17:32:30 -0700204opts("sse42") {
205 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700206 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400207 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400208 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
209 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400210 cflags = [ "-msse4.2" ]
211 }
mtklein9b8583d2016-08-24 17:32:30 -0700212}
213
214opts("avx") {
215 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700216 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400217 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000218 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400219 } else {
220 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500221 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500222 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500223 }
Mike Klein3eb71212016-10-11 17:08:53 -0400224 }
mtkleinc04ff472016-06-23 10:29:30 -0700225}
226
Mike Klein1b9b7d52018-02-27 10:37:40 -0500227opts("hsw") {
228 enabled = is_x86
229 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400230 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500231 cflags = [ "/arch:AVX2" ]
232 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000233 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600234 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500235 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600236 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500237 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500238}
239
Mike Kleinad56c4c2020-06-05 06:57:30 -0500240opts("skx") {
241 enabled = is_x86
242 sources = skia_opts.skx_sources
243 if (is_win) {
244 cflags = [ "/arch:AVX512" ]
245 } else {
246 cflags = [ "-march=skylake-avx512" ]
247 if (is_mac && is_debug) {
248 cflags += [ "-fno-stack-check" ] # Work around skia:9709
249 }
250 }
251}
252
mtkleinc095df52016-08-24 12:23:52 -0700253# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700254template("optional") {
255 if (invoker.enabled) {
256 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700257 if (defined(invoker.public_defines)) {
258 defines = invoker.public_defines
259 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600260 if (defined(invoker.public_configs)) {
261 configs = invoker.public_configs
262 }
Hal Canary2dad9902019-11-20 16:01:31 -0500263 if (defined(invoker.public_include_dirs)) {
264 include_dirs = invoker.public_include_dirs
265 }
mtklein457b42a2016-08-23 13:56:37 -0700266 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400267 skia_source_set(target_name) {
268 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500269 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400270 configs = skia_library_configs
271
272 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700273 forward_variables_from(invoker,
274 "*",
275 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400276 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700277 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500278 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700279 "sources_when_disabled",
280 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400281 if (defined(invoker.configs)) {
282 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700283 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400284 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700285 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500286 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400287 skia_source_set(target_name + "_tests") {
288 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500289 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400290 configs = skia_library_configs
291
292 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500293 forward_variables_from(invoker,
294 "*",
295 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400296 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500297 "public_defines",
298 "sources",
299 "sources_for_tests",
300 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500301 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400302 if (defined(invoker.configs)) {
303 configs += invoker.configs
304 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500305 testonly = true
306 sources = invoker.sources_for_tests
307 if (!defined(deps)) {
308 deps = []
309 }
310 deps += [ ":test" ]
311 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500312 }
313 }
mtklein457b42a2016-08-23 13:56:37 -0700314 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400315 skia_source_set(target_name) {
316 visibility = [ ":*" ]
317 configs = skia_library_configs
318
319 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700320 forward_variables_from(invoker,
321 "*",
322 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400323 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400324 "public",
mtklein457b42a2016-08-23 13:56:37 -0700325 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400326 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700327 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700328 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400329 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700330 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500331 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700332 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700333 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400334 if (defined(invoker.configs)) {
335 configs += invoker.configs
336 }
mtkleincd01b032016-08-31 04:58:19 -0700337 if (defined(invoker.sources_when_disabled)) {
338 sources = invoker.sources_when_disabled
339 }
mtklein457b42a2016-08-23 13:56:37 -0700340 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500341 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400342 skia_source_set(target_name + "_tests") {
343 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500344 }
345 }
mtkleineb3c4252016-08-23 07:38:09 -0700346 }
mtklein457b42a2016-08-23 13:56:37 -0700347}
mtklein457b42a2016-08-23 13:56:37 -0700348
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400349optional("android_utils") {
350 enabled = skia_enable_android_utils
351
Leon Scroggins III87caae62020-05-04 10:02:45 -0400352 public = [
353 "client_utils/android/BRDAllocator.h",
354 "client_utils/android/BitmapRegionDecoder.h",
355 "client_utils/android/FrontBufferedStream.h",
356 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400357 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400358 sources = [
359 "client_utils/android/BitmapRegionDecoder.cpp",
360 "client_utils/android/FrontBufferedStream.cpp",
361 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400362}
363
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400364group("fontmgr_factory") {
365 public_deps = [ skia_fontmgr_factory ]
366}
367
368optional("fontmgr_empty_factory") {
369 enabled = true
370 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400371}
372
mtkleina45be612016-08-29 15:22:10 -0700373optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500374 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700375
376 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500377 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700378 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700379 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400380 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700381 sources = [
382 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700383 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400384 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700385 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500386 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700387}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400388optional("fontmgr_android_factory") {
389 enabled = skia_enable_fontmgr_android
390 deps = [ ":fontmgr_android" ]
391 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
392}
mtkleina45be612016-08-29 15:22:10 -0700393
mtkleind2e39db2016-09-07 07:52:55 -0700394optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400395 enabled =
396 skia_enable_fontmgr_custom_directory ||
397 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700398
Mike Kleina01c6b02020-04-01 13:47:34 -0500399 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400400 public = [ "src/ports/SkFontMgr_custom.h" ]
401 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
402}
403
404optional("fontmgr_custom_directory") {
405 enabled = skia_enable_fontmgr_custom_directory
406
407 deps = [
408 ":fontmgr_custom",
409 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700410 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400411 public = [ "include/ports/SkFontMgr_directory.h" ]
412 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
413}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400414optional("fontmgr_custom_directory_factory") {
415 enabled = skia_enable_fontmgr_custom_directory
416 deps = [ ":fontmgr_custom_directory" ]
417 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
418}
Ben Wagner75626e42020-06-03 13:20:37 -0400419
420optional("fontmgr_custom_embedded") {
421 enabled = skia_enable_fontmgr_custom_embedded
422
423 deps = [
424 ":fontmgr_custom",
425 ":typeface_freetype",
426 ]
427 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700428}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400429optional("fontmgr_custom_embedded_factory") {
430 enabled = skia_enable_fontmgr_custom_embedded
431 deps = [ ":fontmgr_custom_embedded" ]
432 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
433}
mtkleind2e39db2016-09-07 07:52:55 -0700434
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500435optional("fontmgr_custom_empty") {
436 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500437
Ben Wagner75626e42020-06-03 13:20:37 -0400438 deps = [
439 ":fontmgr_custom",
440 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800441 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400442 public = [ "include/ports/SkFontMgr_empty.h" ]
443 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500444}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400445optional("fontmgr_custom_empty_factory") {
446 enabled = skia_enable_fontmgr_custom_empty
447 deps = [ ":fontmgr_custom_empty" ]
448 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
449}
Hal Canaryff2742e2018-01-30 11:35:47 -0500450
mtklein3cc22182016-08-29 13:26:14 -0700451optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400452 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700453
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400454 # The public header includes fontconfig.h and uses FcConfig*
455 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400456 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400457 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400458 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500459 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400460}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400461optional("fontmgr_fontconfig_factory") {
462 enabled = skia_enable_fontmgr_fontconfig
463 deps = [ ":fontmgr_fontconfig" ]
464 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
465}
Ben Wagner75626e42020-06-03 13:20:37 -0400466
467optional("fontmgr_FontConfigInterface") {
468 enabled = skia_enable_fontmgr_FontConfigInterface
469
470 deps = [
471 ":typeface_freetype",
472 "//third_party:fontconfig",
473 ]
474 public = [
475 "include/ports/SkFontConfigInterface.h",
476 "include/ports/SkFontMgr_FontConfigInterface.h",
477 ]
mtklein3cc22182016-08-29 13:26:14 -0700478 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700479 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700480 "src/ports/SkFontConfigInterface_direct.cpp",
481 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400482 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700483 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700484 ]
485}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400486optional("fontmgr_FontConfigInterface_factory") {
487 enabled = skia_enable_fontmgr_FontConfigInterface
488 deps = [ ":fontmgr_FontConfigInterface" ]
489 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
490}
mtklein3cc22182016-08-29 13:26:14 -0700491
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500492optional("fontmgr_fuchsia") {
493 enabled = skia_enable_fontmgr_fuchsia
494
Chinmay Garde89820762019-05-06 16:44:06 -0700495 deps = []
496
497 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700498 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700499 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500500 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700501 }
Ben Wagner75626e42020-06-03 13:20:37 -0400502 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
503 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500504}
505
Ben Wagner75626e42020-06-03 13:20:37 -0400506optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400507 enabled = skia_use_fonthost_mac
508
Ben Wagner75626e42020-06-03 13:20:37 -0400509 public = [
510 "include/ports/SkFontMgr_mac_ct.h",
511 "include/ports/SkTypeface_mac.h",
512 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400513 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400514 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400515 "src/ports/SkScalerContext_mac_ct.cpp",
516 "src/ports/SkScalerContext_mac_ct.h",
517 "src/ports/SkTypeface_mac_ct.cpp",
518 "src/ports/SkTypeface_mac_ct.h",
519 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000520 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400521
522 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400523 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400524 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
525 "AppKit.framework",
526 "ApplicationServices.framework",
527 ]
528 }
529
530 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400531 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400532 "CoreFoundation.framework",
533 "CoreGraphics.framework",
534 "CoreText.framework",
535
536 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
537 "UIKit.framework",
538 ]
539 }
540}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400541optional("fontmgr_mac_ct_factory") {
542 enabled = skia_use_fonthost_mac
543 deps = [ ":fontmgr_mac_ct" ]
544 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
545}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400546
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500547optional("fontmgr_win") {
548 enabled = skia_enable_fontmgr_win
549
Ben Wagner75626e42020-06-03 13:20:37 -0400550 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500551 sources = [
552 "src/fonts/SkFontMgr_indirect.cpp",
553 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500554 "src/ports/SkScalerContext_win_dw.cpp",
Ben Wagner66899512021-12-01 17:27:08 -0500555 "src/ports/SkScalerContext_win_dw.h",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500556 "src/ports/SkTypeface_win_dw.cpp",
Ben Wagner66899512021-12-01 17:27:08 -0500557 "src/ports/SkTypeface_win_dw.h",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500558 ]
559}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400560optional("fontmgr_win_factory") {
561 enabled = skia_enable_fontmgr_win
562 deps = [ ":fontmgr_win" ]
563 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
564}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500565
566optional("fontmgr_win_gdi") {
567 enabled = skia_enable_fontmgr_win_gdi
568
Ben Wagner75626e42020-06-03 13:20:37 -0400569 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500570 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500571 libs = [ "Gdi32.lib" ]
572}
573
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700574if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400575 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400576 sources = [
John Stiles97d9e472021-10-20 12:40:03 -0400577 "src/sksl/lex/DFA.h",
578 "src/sksl/lex/DFAState.h",
579 "src/sksl/lex/LexUtil.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400580 "src/sksl/lex/Main.cpp",
581 "src/sksl/lex/NFA.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400582 "src/sksl/lex/NFA.h",
583 "src/sksl/lex/NFAState.h",
584 "src/sksl/lex/NFAtoDFA.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400585 "src/sksl/lex/RegexNode.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400586 "src/sksl/lex/RegexNode.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400587 "src/sksl/lex/RegexParser.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400588 "src/sksl/lex/RegexParser.h",
589 "src/sksl/lex/TransitionTable.cpp",
590 "src/sksl/lex/TransitionTable.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400591 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500592 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400593 }
594
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700595 action("run_sksllex") {
596 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500597 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
598 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700599
600 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
601 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
602 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500603 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700604 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
605 # confused due to the same file being named by two different paths
606 ]
607 sksllex_path = "$root_out_dir/"
608 sksllex_path += "sksllex"
609 if (host_os == "win") {
610 sksllex_path += ".exe"
611 }
612 args = [
613 rebase_path(sksllex_path),
614 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400615 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700616 rebase_path("src"),
617 ]
618 }
619} else {
620 group("run_sksllex") {
621 }
622}
623
Brian Osmaned5181e2021-07-01 13:54:20 -0400624# `Compile SkSL Tests` relies on skslc.
625if (skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400626 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500627 defines = [
628 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500629 "SK_DISABLE_TRACING",
Arman Ugurayb58bab12021-12-09 12:24:51 -0800630 "SK_ENABLE_SPIRV_CROSS",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500631 "SK_ENABLE_SPIRV_VALIDATION",
632 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400633 sources = [
John Stiles24e7ec72021-11-16 08:41:11 -0500634 "src/core/SkArenaAlloc.cpp",
Michael Ludwigc1ed11d2021-08-24 11:49:55 -0400635 "src/core/SkBlockAllocator.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500636 "src/core/SkCpu.cpp",
637 "src/core/SkData.cpp",
638 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400639 "src/core/SkMalloc.cpp",
640 "src/core/SkMath.cpp",
John Stilesfbd9fae2021-06-22 09:34:14 -0400641 "src/core/SkMatrixInvert.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400642 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500643 "src/core/SkStream.cpp",
644 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500645 "src/core/SkStringUtils.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400646 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500647 "src/core/SkUtils.cpp",
648 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400649 "src/gpu/GrMemoryPool.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400650 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500651 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400652 "src/sksl/SkSLMain.cpp",
John Stiles24e7ec72021-11-16 08:41:11 -0500653 "src/utils/SkJSON.cpp",
654 "src/utils/SkJSONWriter.cpp",
655 "src/utils/SkParse.cpp",
Jim Van Verthdb9f95c2021-12-10 17:27:10 -0500656 "src/utils/SkShaderUtils.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500657 "src/utils/SkUTF.cpp",
Julia Lavrova20187a22021-12-21 14:33:35 +0000658 "src/utils/SkVMVisualizer.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400659 ]
Julia Lavrova20187a22021-12-21 14:33:35 +0000660 libs = []
Brian Osman47726a12020-12-17 16:02:08 -0500661 if (is_win) {
662 sources += [ "src/ports/SkOSFile_win.cpp" ]
663 } else {
664 sources += [ "src/ports/SkOSFile_posix.cpp" ]
Julia Lavrova20187a22021-12-21 14:33:35 +0000665 libs += [ "dl" ]
Brian Osman47726a12020-12-17 16:02:08 -0500666 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400667 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400668 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500669 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400670 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500671 ":run_sksllex",
Julia Lavrova20187a22021-12-21 14:33:35 +0000672 ":skvm_jit",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100673 "//third_party/externals/spirv-tools:spvtools",
674 "//third_party/externals/spirv-tools:spvtools_val",
Arman Ugurayb58bab12021-12-09 12:24:51 -0800675 "//third_party/spirv-cross:spirv_cross",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400676 ]
677 }
678
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400679 skslc_path = "$root_out_dir/"
680 if (host_toolchain != default_toolchain_name) {
681 skslc_path += "$host_toolchain/"
682 }
683 skslc_path += "skslc"
684 if (host_os == "win") {
685 skslc_path += ".exe"
686 }
687
Brian Osmandd496172020-08-08 08:17:18 -0400688 copy("sksl_pre_includes") {
689 sources = [
690 "src/sksl/sksl_frag.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400691 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500692 "src/sksl/sksl_public.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400693 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400694 "src/sksl/sksl_vert.sksl",
695 ]
696 outputs = [ "$root_out_dir/{{source_file_part}}" ]
697 }
698
699 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400700
701 dehydrate_sksl_outputs = []
702 foreach(src, dehydrate_sksl_sources) {
703 name = get_path_info(src, "name")
704
705 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
706 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
707 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
708 "src/sksl/generated/$name.dehydrated.sksl",
709 target_out_dir) ]
710 }
711
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400712 action("dehydrate_sksl") {
713 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400714 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400715 ":sksl_pre_includes",
716 ":skslc(//gn/toolchain:$host_toolchain)",
717 ]
718 sources = dehydrate_sksl_sources
719 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000720 args = [
721 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400722 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000723 ]
Brian Osmandd496172020-08-08 08:17:18 -0400724 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400725 }
John Stilesd836f842020-09-14 10:21:44 -0400726} else {
727 group("dehydrate_sksl") {
728 }
729}
730
John Stilesd836f842020-09-14 10:21:44 -0400731if (skia_compile_sksl_tests) {
732 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400733
John Stiles7e248712020-09-24 16:42:09 -0400734 template("compile_sksl") {
735 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
736 action("compile_sksl_${target_name}") {
737 script = "gn/compile_sksl_tests.py"
738 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400739 ":sksl_pre_includes",
740 ":skslc(//gn/toolchain:$host_toolchain)",
741 ]
John Stilesda57fc02021-01-22 11:54:30 -0500742 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400743 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500744 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500745 args = [
746 rebase_path(skslc_path),
747 invoker.lang,
748 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500749 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500750 ]
751
John Stilesbfc9be02021-01-22 11:55:48 -0500752 testsDir = get_path_info("tests", "abspath")
753 resourcesDir = get_path_info("resources", "abspath")
754
755 foreach(partialPath, invoker.sources) {
756 dst = testsDir + partialPath
757 src = resourcesDir + partialPath
758
759 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400760
761 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
762 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
763 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
764 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
765 nameTmp = get_path_info(dst, "name")
766 name = get_path_info(nameTmp, "name")
767 ext = get_path_info(nameTmp, "extension")
768 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500769 response_file_contents += rebase_path([
770 src,
771 dir,
772 ])
John Stilesda57fc02021-01-22 11:54:30 -0500773 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500774
John Stilesda57fc02021-01-22 11:54:30 -0500775 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400776 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400777 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500778 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500779 }
John Stilesbfc9be02021-01-22 11:55:48 -0500780 outputs +=
781 [ target_out_dir + "/" +
782 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400783 }
784 }
John Stiles7e248712020-09-24 16:42:09 -0400785 }
John Stilesd836f842020-09-14 10:21:44 -0400786 }
John Stiles7e248712020-09-24 16:42:09 -0400787 compile_sksl("glsl_tests") {
788 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500789 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400790 lang = "--glsl"
791 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400792 }
John Stiles7e248712020-09-24 16:42:09 -0400793 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400794 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500795 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400796 lang = "--glsl"
797 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400798 }
John Stilesaeae3a52020-09-25 13:35:58 -0400799 compile_sksl("metal_tests") {
800 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500801 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400802 lang = "--metal"
803 settings = "--settings"
804 }
Brian Osman977feec2020-12-22 11:28:59 -0500805 compile_sksl("skvm_tests") {
806 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500807 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500808 lang = "--skvm"
809 settings = "--settings"
810 }
Brian Osman62b039b2021-02-08 13:49:53 -0500811 compile_sksl("stage_tests") {
812 sources = sksl_stage_tests_sources
813 outExtensions = [ ".stage" ]
814 lang = "--stage"
815 settings = "--settings"
816 }
John Stilesdda1d312020-11-20 16:28:50 -0500817 compile_sksl("spirv_tests") {
818 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500819 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500820 lang = "--spirv"
821 settings = "--settings"
822 }
John Stilesd836f842020-09-14 10:21:44 -0400823} else {
John Stiles7e248712020-09-24 16:42:09 -0400824 group("compile_sksl_glsl_tests") {
825 }
826 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400827 }
John Stilesaeae3a52020-09-25 13:35:58 -0400828 group("compile_sksl_metal_tests") {
829 }
Brian Osman977feec2020-12-22 11:28:59 -0500830 group("compile_sksl_skvm_tests") {
831 }
John Stilesdda1d312020-11-20 16:28:50 -0500832 group("compile_sksl_spirv_tests") {
833 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400834}
835
Greg Daniel292bbb12021-11-03 16:25:41 -0400836optional("gpu_shared") {
837 enabled = skia_enable_gpu || skia_enable_graphite
838
839 sources = skia_shared_gpu_sources
840}
841
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500842optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700843 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400844 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400845 ":compile_sksl_glsl_nosettings_tests",
846 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400847 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500848 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500849 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400850 ":dehydrate_sksl",
Greg Daniel292bbb12021-11-03 16:25:41 -0400851 ":gpu_shared",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700852 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400853 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700854 if (skia_generate_workarounds) {
855 deps += [ ":workaround_list" ]
856 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800857 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600858 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400859 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700860
Greg Daniel292bbb12021-11-03 16:25:41 -0400861 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400862 if (!skia_enable_skgpu_v1) {
863 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400864 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400865
Mike Klein703cf5a2016-10-13 17:18:04 -0400866 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400867 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700868
John Rosascoa9b348f2019-11-08 13:18:15 -0800869 if (skia_use_gl) {
870 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400871 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500872 sources += [
873 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
874 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
875 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400876
877 # this lib is required to link against AHardwareBuffer
878 if (defined(ndk_api) && ndk_api >= 26) {
879 libs += [ "android" ]
880 }
881 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500882 sources += [
883 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
884 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
885 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400886 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400887 } else if (skia_use_webgl) {
888 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400889 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500890 sources += [
891 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
892 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
893 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400894 libs += [ "GL" ]
895 } else if (is_mac) {
896 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
897 } else if (is_ios) {
898 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800899 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400900 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
901 if (target_cpu != "arm64") {
902 libs += [ "OpenGL32.lib" ]
903 }
904 } else {
905 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
906 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800907 sources += skia_gl_gpu_sources
908 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400909
mtkleine9fb3d52016-09-20 15:11:46 -0700910 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400911 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000912 if (skia_use_vma) {
913 deps += [ "third_party/vulkanmemoryallocator" ]
914 }
mtkleine9fb3d52016-09-20 15:11:46 -0700915 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700916 if (skia_enable_vulkan_debug_layers) {
917 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
918 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800919 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800920 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700921 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
922 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400923 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700924 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800925 }
mtkleine9fb3d52016-09-20 15:11:46 -0700926 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400927
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400928 if (is_android && (skia_use_gl || skia_use_vulkan)) {
929 # this lib is required to link against AHardwareBuffer
930 if (defined(ndk_api) && ndk_api >= 26) {
931 libs += [ "android" ]
932 }
933 }
934
Stephen White0d70b712019-07-10 15:51:30 -0400935 if (skia_use_dawn) {
936 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400937 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700938 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400939 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700940 "//third_party/externals/dawn/src/dawn:dawn_proc",
941 "//third_party/externals/dawn/src/dawn:dawncpp",
Stephen White0d70b712019-07-10 15:51:30 -0400942 ]
Brian Salomonc3915f72021-11-15 19:08:02 +0000943 if (dawn_enable_d3d12 || dawn_enable_desktop_gl || dawn_enable_metal ||
944 dawn_enable_opengles || dawn_enable_vulkan) {
945 deps += [ "//third_party/externals/dawn/src/dawn_native" ]
946 }
Stephen White0d70b712019-07-10 15:51:30 -0400947 if (dawn_enable_d3d12) {
948 libs += [
949 "d3d12.lib",
950 "dxgi.lib",
951 "d3dcompiler.lib",
952 ]
953 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400954 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400955 }
956 }
957
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500958 if (skia_use_direct3d) {
Arman Ugurayb58bab12021-12-09 12:24:51 -0800959 public_defines += [
960 "SK_DIRECT3D",
961 "SK_ENABLE_SPIRV_CROSS",
962 ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400963 deps += [
964 "//third_party/d3d12allocator",
965 "//third_party/spirv-cross:spirv_cross",
966 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500967 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500968 if (skia_enable_direct3d_debug_layer) {
969 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
970 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500971 libs += [
972 "d3d12.lib",
973 "dxgi.lib",
974 "d3dcompiler.lib",
975 ]
976 }
977
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400978 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400979 if (skia_use_metal) {
980 public_defines += [ "SK_METAL" ]
981 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400982 if (skia_enable_metal_debug_info) {
983 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
984 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400985 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400986 frameworks += [ "Foundation.framework" ]
Jim Van Vertha8d38072021-11-04 09:22:22 -0400987 if (is_ios) {
988 frameworks += [ "UIKit.framework" ]
989 }
Jim Van Verth36b86af2020-08-24 17:16:46 +0000990 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400991 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500992
Kevin Lubickf4def342018-10-04 12:52:50 -0400993 if (is_debug) {
994 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
995 }
mtklein06c35c02016-09-20 12:28:12 -0700996}
997
Leon Scroggins III41169202019-01-29 09:29:57 -0500998optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500999 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -05001000 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
1001 if ("True" ==
1002 exec_script("gn/checkpath.py",
1003 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
1004 "trim string")) {
1005 public_defines = [ "SK_USE_LIBGIFCODEC" ]
1006 public_include_dirs = [
1007 ".",
1008 skia_libgifcodec_path,
1009 ]
1010 include_dirs = public_include_dirs
1011 import(_libgifcodec_gni_path)
1012 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1013 ".",
1014 skia_libgifcodec_path)
1015 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001016}
1017
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001018optional("heif") {
1019 enabled = skia_use_libheif
1020 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1021
Kevin Lubick8ed49ea2021-11-11 12:50:02 -05001022 # This HEIF decoding functionality is a part of the Android Framework.
1023 # https://android.googlesource.com/platform/frameworks/av/+/master/media/libheif/include/HeifDecoderAPI.h
1024 # There isn't a way to compile that library outside of it, so we just link against
1025 # the library. This feature is not supported on other platforms (and we haven't
1026 # yet tried something like https://github.com/strukturag/libheif/tree/master/libheif).
1027 # The dependency for Android is set in gn_to_bp.py.
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001028 deps = []
1029
Mike Kleina01c6b02020-04-01 13:47:34 -05001030 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001031}
1032
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001033optional("jpeg_decode") {
1034 enabled = skia_use_libjpeg_turbo_decode
1035 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1036
Mike Kleina01c6b02020-04-01 13:47:34 -05001037 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001038 sources = [
1039 "src/codec/SkJpegCodec.cpp",
1040 "src/codec/SkJpegDecoderMgr.cpp",
1041 "src/codec/SkJpegUtility.cpp",
1042 ]
1043}
1044
1045optional("jpeg_encode") {
1046 enabled = skia_use_libjpeg_turbo_encode
1047 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001048
Mike Kleina01c6b02020-04-01 13:47:34 -05001049 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1050 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001051 sources = [
mtklein63213812016-08-24 09:55:56 -07001052 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001053 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001054 ]
1055}
1056
Leon Scroggins III326b9892020-08-05 16:51:10 -04001057optional("ndk_images") {
1058 enabled = skia_use_ndk_images
1059 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1060 sources = [
1061 "src/ports/SkImageEncoder_NDK.cpp",
1062 "src/ports/SkImageGeneratorNDK.cpp",
1063 "src/ports/SkNDKConversions.cpp",
1064 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001065 libs = [ "jnigraphics" ]
1066}
1067
Robert Phillips755e00e2021-09-21 11:59:57 -04001068optional("graphite") {
Jim Van Verthff733b32021-09-24 16:46:36 -04001069 libs = []
1070 frameworks = []
1071
Robert Phillips755e00e2021-09-21 11:59:57 -04001072 enabled = skia_enable_graphite
Greg Daniel292bbb12021-11-03 16:25:41 -04001073 deps = [ ":gpu_shared" ]
Robert Phillips755e00e2021-09-21 11:59:57 -04001074 public_defines = [ "SK_GRAPHITE_ENABLED" ]
1075 public = skia_graphite_public
Greg Danielf0b283e2021-11-04 08:37:59 -04001076 sources = skia_graphite_sources
Jim Van Verthff733b32021-09-24 16:46:36 -04001077 if (skia_use_metal) {
1078 public_defines += [ "SK_METAL" ]
1079 sources += skia_graphite_mtl_sources
1080 if (skia_enable_metal_debug_info) {
1081 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
1082 }
1083 frameworks += [ "Metal.framework" ]
1084 frameworks += [ "Foundation.framework" ]
Jim Van Verth09828fb2021-12-16 10:50:01 -05001085 if (is_ios) {
1086 frameworks += [ "UIKit.framework" ]
1087 }
Jim Van Verthff733b32021-09-24 16:46:36 -04001088 }
Robert Phillips1a4080a2021-09-21 09:57:43 -04001089}
1090
mtklein63213812016-08-24 09:55:56 -07001091optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001092 enabled = skia_use_zlib && skia_enable_pdf
1093 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001094
Mike Kleina01c6b02020-04-01 13:47:34 -05001095 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001096 if (skia_use_libjpeg_turbo_decode) {
1097 deps += [ ":jpeg_decode" ]
1098 }
1099 if (skia_use_libjpeg_turbo_encode) {
1100 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001101 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001102 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001103 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001104 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001105 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1106 deps += [ "//third_party/harfbuzz" ]
1107 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1108 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001109 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001110 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001111 }
1112}
1113
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001114optional("xps") {
1115 enabled = skia_use_xps && is_win
1116 public_defines = [ "SK_SUPPORT_XPS" ]
1117 public = skia_xps_public
1118 sources = skia_xps_sources
1119}
1120
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001121optional("png_decode") {
1122 enabled = skia_use_libpng_decode
1123 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001124
Mike Kleina01c6b02020-04-01 13:47:34 -05001125 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001126 sources = [
1127 "src/codec/SkIcoCodec.cpp",
1128 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001129 ]
1130}
1131
1132optional("png_encode") {
1133 enabled = skia_use_libpng_encode
1134 public_defines = [ "SK_ENCODE_PNG" ]
1135
Mike Kleina01c6b02020-04-01 13:47:34 -05001136 deps = [ "//third_party/libpng" ]
1137 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001138}
1139
scroggof84ad642016-10-31 09:02:57 -07001140optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001141 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001142 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1143
1144 deps = [
1145 "//third_party/dng_sdk",
1146 "//third_party/libjpeg-turbo:libjpeg",
1147 "//third_party/piex",
1148 ]
1149
1150 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1151 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001152 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001153
Mike Kleina01c6b02020-04-01 13:47:34 -05001154 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001155}
1156
Mike Klein852a8cb2018-05-15 10:46:58 -04001157import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001158skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001159 cflags = []
1160 if (!is_win || is_clang) {
1161 cflags += [
1162 "-w",
1163 "-std=c11",
1164 ]
1165 }
1166
Mike Kleina01c6b02020-04-01 13:47:34 -05001167 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001168 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001169 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1170}
1171
mtklein3cc22182016-08-29 13:26:14 -07001172optional("typeface_freetype") {
1173 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001174
Mike Kleina01c6b02020-04-01 13:47:34 -05001175 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001176 sources = [
1177 "src/ports/SkFontHost_FreeType.cpp",
1178 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001179 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001180 ]
1181}
1182
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001183optional("webp_decode") {
1184 enabled = skia_use_libwebp_decode
1185 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001186
Mike Kleina01c6b02020-04-01 13:47:34 -05001187 deps = [ "//third_party/libwebp" ]
1188 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001189}
1190
1191optional("webp_encode") {
1192 enabled = skia_use_libwebp_encode
1193 public_defines = [ "SK_ENCODE_WEBP" ]
1194
Mike Kleina01c6b02020-04-01 13:47:34 -05001195 deps = [ "//third_party/libwebp" ]
1196 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001197}
1198
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001199optional("wuffs") {
1200 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001201 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001202
Mike Kleina01c6b02020-04-01 13:47:34 -05001203 deps = [ "//third_party/wuffs" ]
1204 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001205}
1206
mtklein63213812016-08-24 09:55:56 -07001207optional("xml") {
1208 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001209 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001210
Mike Kleina01c6b02020-04-01 13:47:34 -05001211 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001212 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001213 "src/svg/SkSVGCanvas.cpp",
1214 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001215 "src/xml/SkDOM.cpp",
1216 "src/xml/SkXMLParser.cpp",
1217 "src/xml/SkXMLWriter.cpp",
1218 ]
1219}
1220
Mike Klein613ad382019-06-06 11:42:02 -05001221optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001222 enabled = skia_enable_skvm_jit_when_possible
1223 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001224 if (skia_vtune_path != "") {
1225 public_defines += [ "SKVM_JIT_VTUNE" ]
1226 public_include_dirs = [ "$skia_vtune_path/include" ]
1227 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1228 }
Mike Klein613ad382019-06-06 11:42:02 -05001229}
1230
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001231if (skia_enable_gpu && skia_generate_workarounds) {
1232 action("workaround_list") {
1233 script = "tools/build_workaround_header.py"
1234
Mike Kleina01c6b02020-04-01 13:47:34 -05001235 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001236
Brian Osmaned5181e2021-07-01 13:54:20 -04001237 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1238 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001239 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001240 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001241
Mike Kleina01c6b02020-04-01 13:47:34 -05001242 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001243 args = [
1244 "--output-file",
1245 "$output_file",
1246 ]
1247
1248 foreach(file, inputs) {
1249 args += [ rebase_path(file, root_build_dir) ]
1250 }
1251 }
1252}
1253
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001254skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001255 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001256 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001257
Mike Klein607b0a72018-11-07 16:17:34 -05001258 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001259 ":fontmgr_FontConfigInterface",
1260 ":fontmgr_android",
1261 ":fontmgr_custom_directory",
1262 ":fontmgr_custom_embedded",
1263 ":fontmgr_custom_empty",
1264 ":fontmgr_fontconfig",
1265 ":fontmgr_fuchsia",
1266 ":fontmgr_mac_ct",
1267 ":fontmgr_win",
1268 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001269 ":gpu",
Robert Phillips755e00e2021-09-21 11:59:57 -04001270 ":graphite",
Mike Klein607b0a72018-11-07 16:17:34 -05001271 ":pdf",
1272 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001273 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001274 ]
1275
mtkleinc04ff472016-06-23 10:29:30 -07001276 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001277 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001278 ":arm64",
1279 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001280 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001281 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001282 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001283 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001284 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001285 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001286 ":jpeg_decode",
1287 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001288 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001289 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001290 ":png_decode",
1291 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001292 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001293 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001294 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001295 ":sse2",
1296 ":sse41",
1297 ":sse42",
1298 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001299 ":webp_decode",
1300 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001301 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001302 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001303 ]
1304
Hal Canaryc25f4e92019-02-26 11:54:25 -05001305 public = skia_core_public
1306 public += skia_utils_public
1307 public += skia_effects_public
1308 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001309
mtkleinc04ff472016-06-23 10:29:30 -07001310 sources = []
brettwb9447282016-09-01 14:24:39 -07001311 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001312 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001313 sources += skia_effects_sources
1314 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001315 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001316 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001317 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001318 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001319 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001320 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001321 "src/codec/SkBmpCodec.cpp",
1322 "src/codec/SkBmpMaskCodec.cpp",
1323 "src/codec/SkBmpRLECodec.cpp",
1324 "src/codec/SkBmpStandardCodec.cpp",
1325 "src/codec/SkCodec.cpp",
1326 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001327 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001328 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001329 "src/codec/SkMaskSwizzler.cpp",
1330 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001331 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001332 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001333 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001334 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001335 "src/codec/SkSwizzler.cpp",
1336 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001337 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001338 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001339 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001340 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001341 "src/ports/SkMemory_malloc.cpp",
1342 "src/ports/SkOSFile_stdio.cpp",
1343 "src/sfnt/SkOTTable_name.cpp",
1344 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001345 ]
brettwb9447282016-09-01 14:24:39 -07001346
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001347 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001348 libs = []
1349
Brian Osman946a4cb2021-07-12 17:02:21 -04001350 if (skia_enable_sksl) {
1351 deps += [ ":dehydrate_sksl" ]
1352 sources += skia_sksl_sources
1353 }
1354
mtkleinc04ff472016-06-23 10:29:30 -07001355 if (is_win) {
1356 sources += [
1357 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001358 "src/ports/SkImageEncoder_WIC.cpp",
1359 "src/ports/SkImageGeneratorWIC.cpp",
1360 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001361 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001362 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001363 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001364 "Ole32.lib",
1365 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001366 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001367
1368 if (!skia_enable_winuwp) {
1369 libs += [
1370 "FontSub.lib",
1371 "User32.lib",
1372 "Usp10.lib",
1373 ]
1374 }
mtkleinc04ff472016-06-23 10:29:30 -07001375 } else {
1376 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001377 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001378 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001379 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001380 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001381 }
1382
mtklein7d6fb2c2016-08-25 14:50:44 -07001383 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001384 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001385 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001386 deps += [ "//third_party/cpu-features" ]
1387 }
mtklein06c35c02016-09-20 12:28:12 -07001388 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001389 libs += [
1390 "EGL",
1391 "GLESv2",
1392 "log",
1393 ]
1394 }
1395
Kevin Lubick217056c2018-09-20 17:39:31 -04001396 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001397 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001398 if (skia_use_egl) {
1399 libs += [ "GLESv2" ]
1400 }
mtkleinc04ff472016-06-23 10:29:30 -07001401 }
1402
1403 if (is_mac) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001404 public += [ "include/ports/SkCFObject.h" ]
mtkleinc04ff472016-06-23 10:29:30 -07001405 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001406 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001407 "src/ports/SkImageEncoder_CG.cpp",
1408 "src/ports/SkImageGeneratorCG.cpp",
1409 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001410 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001411 "ApplicationServices.framework",
1412 "OpenGL.framework",
1413 ]
mtkleinc04ff472016-06-23 10:29:30 -07001414 }
abarth6fc8ff02016-07-15 15:15:15 -07001415
Mike Klein7d302882016-11-03 14:06:31 -04001416 if (is_ios) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001417 public += [ "include/ports/SkCFObject.h" ]
Mike Klein7d302882016-11-03 14:06:31 -04001418 sources += [
1419 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001420 "src/ports/SkImageEncoder_CG.cpp",
1421 "src/ports/SkImageGeneratorCG.cpp",
1422 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001423 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001424 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001425 "ImageIO.framework",
1426 "MobileCoreServices.framework",
1427 ]
1428 }
1429
abarth6fc8ff02016-07-15 15:15:15 -07001430 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001431 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001432 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001433
1434 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001435 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001436 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1437 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001438
1439 if (skia_include_multiframe_procs) {
1440 sources += [ "tools/SkSharingProc.cpp" ]
1441 }
mtkleinc04ff472016-06-23 10:29:30 -07001442}
1443
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001444# DebugCanvas used in experimental/wasm-skp-debugger
1445if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001446 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001447 public_configs = [ ":skia_public" ]
1448
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001449 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001450 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001451 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001452 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001453 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001454 "tools/debugger/DrawCommand.cpp",
1455 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001456 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001457 }
1458}
1459
Ben Wagner25eb5342021-03-22 14:07:15 -04001460skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001461 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001462 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001463 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001464
1465 deps = [
1466 ":arm64",
1467 ":armv7",
1468 ":avx",
1469 ":crc32",
1470 ":hsw",
1471 ":none",
1472 ":sse2",
1473 ":sse41",
1474 ":sse42",
1475 ":ssse3",
1476 ]
1477
Kevin Lubickcbcff382018-10-02 09:02:18 -04001478 sources = []
1479 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001480 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001481 sources += [
1482 "src/core/SkAnalyticEdge.cpp",
1483 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001484 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001485 "src/core/SkCubicMap.cpp",
1486 "src/core/SkEdge.cpp",
1487 "src/core/SkEdgeBuilder.cpp",
1488 "src/core/SkEdgeClipper.cpp",
1489 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001490 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001491 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001492 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001493 "src/core/SkMallocPixelRef.cpp",
1494 "src/core/SkMath.cpp",
1495 "src/core/SkMatrix.cpp",
1496 "src/core/SkOpts.cpp",
1497 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001498 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001499 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001500 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001501 "src/core/SkPathEffect.cpp",
1502 "src/core/SkPathMeasure.cpp",
1503 "src/core/SkPathRef.cpp",
1504 "src/core/SkPoint.cpp",
1505 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001506 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001507 "src/core/SkRect.cpp",
1508 "src/core/SkSemaphore.cpp",
1509 "src/core/SkStream.cpp",
1510 "src/core/SkString.cpp",
1511 "src/core/SkStringUtils.cpp",
1512 "src/core/SkStroke.cpp",
1513 "src/core/SkStrokeRec.cpp",
1514 "src/core/SkStrokerPriv.cpp",
1515 "src/core/SkThreadID.cpp",
1516 "src/core/SkUtils.cpp",
1517 "src/effects/SkDashPathEffect.cpp",
1518 "src/effects/SkTrimPathEffect.cpp",
1519 "src/ports/SkDebug_stdio.cpp",
1520 "src/ports/SkMemory_malloc.cpp",
1521 "src/utils/SkDashPath.cpp",
1522 "src/utils/SkParse.cpp",
1523 "src/utils/SkParsePath.cpp",
1524 "src/utils/SkUTF.cpp",
1525 ]
1526}
1527
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001528group("modules") {
1529 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001530 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001531 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001532 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001533 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001534 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001535 ]
1536}
1537
Julia Lavrova9f6e4632021-09-17 15:19:02 -04001538group("experimental") {
1539 deps = [ "experimental/sktext" ]
1540}
1541
Brian Osmancd28fa62020-07-07 16:01:26 -04001542config("our_vulkan_headers") {
1543 include_dirs = [ "include/third_party/vulkan" ]
1544}
1545
mtkleinc095df52016-08-24 12:23:52 -07001546# Targets guarded by skia_enable_tools may use //third_party freely.
1547if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001548 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001549 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001550 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001551 "include/c",
1552 "include/codec",
1553 "include/config",
1554 "include/core",
1555 "include/docs",
1556 "include/effects",
1557 "include/encode",
1558 "include/gpu",
1559 "include/pathops",
1560 "include/ports",
1561 "include/svg",
1562 "include/utils",
1563 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001564 "modules/particles/include",
1565 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001566 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001567 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001568 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001569 ]
1570
Mike Klein308b5ac2016-12-06 16:03:52 -05001571 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001572 skia_source_set("public") {
1573 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001574 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001575 }
1576
Mike Kleinc36dedf2016-11-18 09:35:28 -05001577 config("skia.h_config") {
1578 include_dirs = [ "$target_gen_dir" ]
1579 }
1580 action("skia.h") {
1581 public_configs = [ ":skia.h_config" ]
1582 skia_h = "$target_gen_dir/skia.h"
1583 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001584
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001585 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1586 [ rebase_path(skia_h, root_build_dir) ] +
1587 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001588 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001589 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001590 }
1591
Brian Osmanc9a42472018-05-31 13:17:12 -04001592 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001593 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001594 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001595 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001596 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001597 "tools/fiddle/draw.cpp",
1598 "tools/fiddle/fiddle_main.cpp",
1599 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001600
1601 if (skia_use_egl) {
1602 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001603 } else {
1604 sources += [ "tools/fiddle/null_context.cpp" ]
1605 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001606 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001607 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001608 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001609 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001610 ":skia",
1611 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001612 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001613 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001614 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001615 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001616 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001617 ]
1618 }
1619 }
1620
John Stiles2cf48632022-01-26 21:36:51 -05001621 config("cpp17") {
Mike Kleine5463e62020-06-11 13:53:53 -05001622 if (is_win) {
John Stiles2cf48632022-01-26 21:36:51 -05001623 cflags_cc = [ "/std:c++17" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001624 } else {
John Stiles2cf48632022-01-26 21:36:51 -05001625 cflags_cc = [ "-std=c++17" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001626 }
1627 }
1628
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001629 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001630 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001631 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001632 ":our_vulkan_headers",
John Stiles2cf48632022-01-26 21:36:51 -05001633 ":cpp17",
Mike Kleine5463e62020-06-11 13:53:53 -05001634 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001635 if (defined(skia_header_target_default_configs)) {
1636 configs += skia_header_target_default_configs
1637 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001638 deps = [
1639 ":skia",
1640 ":skia.h",
1641 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001642 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001643 ]
Stephen White0d70b712019-07-10 15:51:30 -04001644
1645 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001646 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001647 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001648 }
1649
mtkleinc095df52016-08-24 12:23:52 -07001650 template("test_lib") {
1651 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001652 if (defined(invoker.public_defines)) {
1653 defines = invoker.public_defines
1654 }
mtklein25c81d42016-07-27 13:55:26 -07001655 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001656 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001657 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001658 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001659 public_configs = [
1660 ":" + target_name + "_config",
1661 ":skia_private",
1662 ]
1663
1664 if (!defined(deps)) {
1665 deps = []
1666 }
1667 deps += [ ":skia" ]
1668 testonly = true
1669 }
mtklein25c81d42016-07-27 13:55:26 -07001670 }
mtklein25c81d42016-07-27 13:55:26 -07001671
Mike Kleine6682eb2017-01-05 10:54:57 -05001672 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001673 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001674 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001675 forward_variables_from(invoker,
1676 "*",
1677 [
1678 "output_name",
1679 "visibility",
1680 "is_shared_library",
1681 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001682 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001683 extra_configs = [ ":skia_private" ]
1684 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1685 data_sources = [ "resources" ]
1686 if ("True" == exec_script("//gn/checkdir.py",
1687 [ rebase_path("skps", root_build_dir) ],
1688 "trim string")) {
1689 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001690 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001691 if ("True" == exec_script("//gn/checkdir.py",
1692 [ rebase_path("mskps", root_build_dir) ],
1693 "trim string")) {
1694 data_sources += [ "mskps" ]
1695 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001696 }
1697 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001698 # !is_ios
1699
1700 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001701 skia_shared_library("lib" + target_name) {
1702 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001703 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001704 if (!defined(configs)) {
1705 configs = []
1706 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001707 configs += [ ":skia_private" ]
1708 testonly = true
1709 }
1710 } else {
1711 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001712 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001713 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001714 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001715 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001716 if (!defined(configs)) {
1717 configs = []
1718 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001719 configs += [ ":skia_private" ]
1720 testonly = true
1721 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001722 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001723 if (is_android && skia_android_serial != "" && defined(_executable)) {
1724 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001725 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001726 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001727 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001728 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001729 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001730 args = [
1731 rebase_path("$root_build_dir/$_executable"),
1732 skia_android_serial,
1733 rebase_path(_stamp),
1734 ]
1735 testonly = true
1736 }
Mike Klein7d921032017-01-05 12:20:41 -05001737 }
1738 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001739 }
1740
mtkleinc095df52016-08-24 12:23:52 -07001741 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001742 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001743
Mike Klein9e25bb92019-04-29 09:46:36 -05001744 # Bots and even devs may not have Vulkan headers, so put
1745 # include/third_party/vulkan on our path so they're always available.
1746 all_dependent_configs = [ ":our_vulkan_headers" ]
1747
Mike Klein333fb452019-04-24 08:48:11 -05001748 defines = []
1749 if (skia_enable_discrete_gpu) {
1750 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1751 }
1752
Brian Osmanc9a42472018-05-31 13:17:12 -04001753 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001754 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001755 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001756 "tools/gpu/BackendSurfaceFactory.cpp",
1757 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001758 "tools/gpu/BackendTextureImageFactory.cpp",
1759 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001760 "tools/gpu/FlushFinishTracker.cpp",
1761 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001762 "tools/gpu/GrContextFactory.cpp",
1763 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001764 "tools/gpu/ManagedBackendTexture.cpp",
1765 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001766 "tools/gpu/MemoryCache.cpp",
1767 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001768 "tools/gpu/ProxyUtils.cpp",
1769 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001770 "tools/gpu/TestOps.cpp",
1771 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001772 "tools/gpu/YUVUtils.cpp",
1773 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001774 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1775 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001776 "tools/gpu/mock/MockTestContext.cpp",
1777 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001778
1779 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001780 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001781
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001782 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001783 sources +=
1784 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001785 if (is_ios) {
1786 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001787 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001788 } else if (is_mac) {
1789 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001790 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001791 if (skia_use_angle) {
1792 deps += [ "//third_party/angle2" ]
1793 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1794 }
Brian Salomon1171d312020-03-19 08:47:44 -04001795 }
1796
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001797 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1798 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001799 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001800 if (is_android || skia_use_egl) {
1801 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1802 libs += [ "EGL" ]
1803 } else if (is_linux) {
1804 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1805 libs += [
1806 "GLU",
1807 "GL",
1808 "X11",
1809 ]
1810 } else if (is_win) {
1811 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1812 libs += [ "Gdi32.lib" ]
1813 if (target_cpu != "arm64") {
1814 libs += [ "OpenGL32.lib" ]
1815 }
1816 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001817 }
Greg Daniel54200e42018-12-11 17:03:39 -05001818
Brian Osmanc9a42472018-05-31 13:17:12 -04001819 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001820 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001821 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001822 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1823 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001824 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001825 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001826 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1827 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001828 }
1829 if (skia_use_metal) {
1830 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001831 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001832 if (skia_use_direct3d) {
1833 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001834 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001835 }
Stephen White985741a2019-07-18 11:43:45 -04001836 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001837 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001838 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001839 if (is_clang) {
1840 cflags_cc = [ "-Wno-microsoft-cast" ]
1841 }
Stephen White985741a2019-07-18 11:43:45 -04001842 }
Robert Phillips72354b02021-07-06 13:43:56 -04001843 if (!skia_enable_skgpu_v1) {
1844 sources -= [ "tools/gpu/GrTest.cpp" ]
1845 sources -= [ "tools/gpu/TestOps.cpp" ]
1846 sources -= [ "tools/gpu/TestOps.h" ]
1847 }
Robert Phillipsd034db72021-09-29 14:29:32 -04001848 if (skia_enable_graphite) {
Robert Phillips091694f2021-09-30 11:41:16 -04001849 sources += [ "tools/graphite/ContextFactory.h" ]
1850 sources += [ "tools/graphite/ContextFactory.cpp" ]
Robert Phillipsd034db72021-09-29 14:29:32 -04001851 sources += [ "tools/graphite/GraphiteTestContext.h" ]
1852 sources += [ "tools/graphite/GraphiteTestContext.cpp" ]
1853 if (skia_use_metal) {
1854 sources += [ "tools/graphite/mtl/GraphiteMtlTestContext.h" ]
1855 sources += [ "tools/graphite/mtl/MtlTestContext.mm" ]
1856 }
1857 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001858
1859 if (is_fuchsia && using_fuchsia_sdk) {
1860 libs +=
1861 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1862 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001863 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001864
mtkleinc095df52016-08-24 12:23:52 -07001865 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001866 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001867 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001868
1869 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001870 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1871 deps = [ ":flags" ]
1872 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001873 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001874 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001875 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1876 deps = [ ":flags" ]
1877 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001878 }
1879 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001880 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1881 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001882 }
Kevin Lubick237dd2d2021-10-14 08:24:22 -04001883 test_lib("common_flags_fontmgr") {
1884 sources = [ "tools/flags/CommonFlagsFontMgr.cpp" ]
1885 deps = [ ":flags" ]
1886 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001887 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001888 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1889 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001890 }
mtklein25c81d42016-07-27 13:55:26 -07001891
Mike Klein499f0ac2019-03-25 13:00:12 -05001892 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001893 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001894 sources = [
1895 "tools/trace/ChromeTracingTracer.cpp",
1896 "tools/trace/ChromeTracingTracer.h",
1897 "tools/trace/EventTracingPriv.cpp",
1898 "tools/trace/EventTracingPriv.h",
1899 "tools/trace/SkDebugfTracer.cpp",
1900 "tools/trace/SkDebugfTracer.h",
1901 ]
1902 }
1903
mtkleinc095df52016-08-24 12:23:52 -07001904 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001905 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001906 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001907 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001908 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001909 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001910 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001911 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001912 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001913 "tools/MSKPPlayer.cpp",
1914 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001915 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001916 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001917 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001918 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001919 "tools/RuntimeBlendUtils.cpp",
1920 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001921 "tools/SkMetaData.cpp",
1922 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001923 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001924 "tools/SkSharingProc.h",
1925 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001926 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001927 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001928 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001929 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001930 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001931 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001932 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001933 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001934 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001935 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001936 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001937 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001938 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001939 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001940 "tools/fonts/TestEmptyTypeface.h",
1941 "tools/fonts/TestFontMgr.cpp",
1942 "tools/fonts/TestFontMgr.h",
1943 "tools/fonts/TestSVGTypeface.cpp",
1944 "tools/fonts/TestSVGTypeface.h",
1945 "tools/fonts/TestTypeface.cpp",
1946 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001947 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001948 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001949 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001950 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001951 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001952 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001953 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001954 if (target_cpu != "wasm") {
1955 sources += [ "tools/CrashHandler.cpp" ]
1956 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001957 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001958 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001959 if (is_ios) {
1960 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001961 sources += [ "tools/ios_utils.h" ]
1962 if (skia_use_metal) {
1963 sources += [ "tools/AutoreleasePool.mm" ]
1964 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001965 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001966 } else if (is_mac) {
1967 if (skia_use_metal) {
1968 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001969 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001970 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001971 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001972 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001973 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001974
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001975 defines = []
1976 if (skia_tools_require_resources) {
1977 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1978 }
mtkleinc095df52016-08-24 12:23:52 -07001979 deps = [
1980 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001981 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001982 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001983 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001984 }
mtklein25c81d42016-07-27 13:55:26 -07001985
Mike Kleine11e5c12019-04-24 12:46:06 -05001986 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001987 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001988 }
1989
Mike Klein6e744122016-10-27 12:21:40 -04001990 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001991 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001992 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001993 if (skia_use_gl) {
1994 sources += gl_gm_sources
1995 }
Robert Phillips024668c2021-07-01 12:12:52 -04001996 if (!skia_enable_skgpu_v1) {
1997 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04001998 }
mtkleinc095df52016-08-24 12:23:52 -07001999 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05002000 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07002001 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07002002 ":skia",
2003 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05002004 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04002005 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04002006 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04002007 "modules/skparagraph",
2008 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002009 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002010 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04002011 if (is_skia_dev_build) {
2012 sources += [ "gm/fiddle.cpp" ]
2013 deps += [ ":skia.h" ]
2014 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002015 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04002016
2017 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04002018 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04002019 sources += [ "gm/video_decoder.cpp" ]
2020 }
mtkleinc095df52016-08-24 12:23:52 -07002021 }
mtklein25c81d42016-07-27 13:55:26 -07002022
Ben Wagnerbded42a2021-02-17 22:14:34 -05002023 test_lib("test") {
2024 sources = [
2025 "tests/Test.cpp",
2026 "tests/Test.h",
2027 "tests/TestUtils.cpp",
2028 "tests/TestUtils.h",
2029 ]
2030 deps = [
2031 ":flags",
2032 ":skia",
2033 ":tool_utils",
2034 ]
2035 public_deps = [
2036 ":gpu_tool_utils", # Test.h #includes headers from this target.
2037 ]
2038 }
2039
Mike Klein6e744122016-10-27 12:21:40 -04002040 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002041 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002042 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002043 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002044 if (skia_use_metal) {
2045 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002046 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002047 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002048 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002049 if (skia_use_gl) {
2050 sources += gl_tests_sources
2051 }
Robert Phillips30627592021-10-11 11:28:21 -04002052 if (skia_enable_graphite) {
2053 sources += graphite_tests_sources
Greg Daniel5e0950e2021-11-30 12:02:30 -05002054 if (skia_use_metal) {
2055 sources += graphite_metal_tests_sources
2056 }
Robert Phillips30627592021-10-11 11:28:21 -04002057 }
Robert Phillips024668c2021-07-01 12:12:52 -04002058 if (!skia_enable_skgpu_v1) {
2059 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04002060 }
mtkleinc095df52016-08-24 12:23:52 -07002061 deps = [
2062 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002063 ":fontmgr_android_tests",
2064 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002065 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002066 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002067 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002068 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002069 "experimental/skrive:tests",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002070 "experimental/sktext:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002071 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002072 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002073 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002074 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002075 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002076 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002077 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002078 "//third_party/zlib",
2079 ]
2080 }
mtklein2f3416d2016-08-02 16:02:05 -07002081
Mike Klein6e744122016-10-27 12:21:40 -04002082 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002083 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002084 sources = bench_sources
Chris Dalton2fceb212021-10-19 13:04:41 -06002085 if (skia_enable_graphite) {
2086 sources += graphite_bench_sources
2087 }
Robert Phillips04f22ea2021-07-22 15:11:03 -04002088 if (!skia_enable_skgpu_v1) {
2089 sources -= skgpu_v1_bench_sources
2090 }
mtkleinc095df52016-08-24 12:23:52 -07002091 deps = [
2092 ":flags",
2093 ":gm",
2094 ":gpu_tool_utils",
2095 ":skia",
2096 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002097 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002098 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002099 ]
2100 }
mtklein2b6870c2016-07-28 14:17:33 -07002101
Mike Reedd62d4062019-06-12 10:20:44 -04002102 test_lib("experimental_xform") {
2103 sources = [
2104 "experimental/xform/SkShape.cpp",
2105 "experimental/xform/SkXform.cpp",
2106 "experimental/xform/XContext.cpp",
2107 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002108 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002109 }
2110
Florin Malitabfe876a2018-09-02 12:33:59 -04002111 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002112 if (skia_enable_skottie) {
2113 test_app("skottie_tool") {
2114 deps = [ "modules/skottie:tool" ]
2115 }
Florin Malita79725d32018-06-05 16:16:57 -04002116 }
Florin Malitab3418102020-10-15 18:10:29 -04002117 test_app("svg_tool") {
2118 deps = [ "modules/svg:tool" ]
2119 }
Florin Malita79725d32018-06-05 16:16:57 -04002120 }
2121
Chris Dalton2b598902020-03-25 10:50:35 -06002122 import("gn/samples.gni")
2123 test_lib("samples") {
2124 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002125 if (!skia_enable_skgpu_v1) {
2126 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002127 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002128 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002129 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002130 ":flags",
2131 ":gpu_tool_utils",
2132 ":xml",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002133 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002134 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002135 "modules/skparagraph:samples",
2136 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002137 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002138 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002139 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002140 }
Kevin Lubick00398742020-10-08 10:05:07 -04002141 test_lib("hash_and_encode") {
2142 sources = [
2143 "tools/HashAndEncode.cpp",
2144 "tools/HashAndEncode.h",
2145 ]
2146 deps = [
2147 ":flags",
2148 ":skia",
2149 "//third_party/libpng",
2150 ]
2151 }
Chris Dalton2b598902020-03-25 10:50:35 -06002152 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002153 test_app("convert-to-nia") {
2154 sources = [ "tools/convert-to-nia.cpp" ]
2155 deps = [ ":skia" ]
2156 }
Mike Klein7af351a2018-07-27 09:54:43 -04002157 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002158 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002159 deps = [
2160 ":skcms",
2161 ":skia",
2162 ]
2163 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002164 test_app("fm") {
2165 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002166 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002167 "tools/fm/fm.cpp",
2168 ]
2169 deps = [
2170 ":common_flags_aa",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002171 ":common_flags_fontmgr",
Mike Klein735c7ba2019-03-25 12:57:58 -05002172 ":common_flags_gpu",
2173 ":flags",
2174 ":gm",
2175 ":gpu_tool_utils",
2176 ":hash_and_encode",
2177 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002178 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002179 ":tool_utils",
2180 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002181 "modules/skottie",
2182 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002183 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002184 ]
2185 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002186 test_app("dm") {
2187 sources = [
2188 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002189 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002190 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002191 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002192 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002193 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002194 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002195 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002196 ":common_flags_aa",
2197 ":common_flags_config",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002198 ":common_flags_fontmgr",
Mike Kleinc6142d82019-03-25 10:54:59 -05002199 ":common_flags_gpu",
2200 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002201 ":flags",
2202 ":gm",
2203 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002204 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002205 ":skia",
2206 ":tests",
2207 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002208 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002209 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002210 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002211 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002212 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002213 ]
2214 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002215 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002216 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002217 "experimental/sorttoy/Cmds.cpp",
2218 "experimental/sorttoy/Cmds.h",
2219 "experimental/sorttoy/Fake.cpp",
2220 "experimental/sorttoy/Fake.h",
2221 "experimental/sorttoy/SortKey.h",
2222 "experimental/sorttoy/sorttoy.cpp",
2223 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002224 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002225 deps = [
2226 ":flags",
2227 ":skia",
2228 ":tool_utils",
2229 ]
2230 }
Michael Ludwig30217952020-12-04 12:58:35 -05002231
2232 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002233 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002234 sources = [
2235 "tests/CanvasStateHelpers.cpp",
2236 "tests/CanvasStateHelpers.h",
2237 ]
2238 deps = [ ":skia" ]
2239 }
Brian Osman16adfa32016-10-18 14:42:44 -04002240 }
2241
Mike Kleina8a51ce2018-01-09 12:34:11 -05002242 if (!is_win) {
2243 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002244 sources = [ "tools/remote_demo.cpp" ]
2245 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002246 }
2247 }
2248
Hal Canarye107faa2019-10-23 12:52:33 -04002249 if (!is_win) {
2250 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002251 sources = [ "tools/blob_cache_sim.cpp" ]
2252 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002253 }
2254 }
2255
Mike Kleine6682eb2017-01-05 10:54:57 -05002256 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002257 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002258 deps = [
2259 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002260 ":common_flags_aa",
2261 ":common_flags_config",
2262 ":common_flags_gpu",
2263 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002264 ":flags",
2265 ":gm",
2266 ":gpu_tool_utils",
2267 ":skia",
2268 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002269 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002270 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002271 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002272 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002273 ]
mtklein2b6870c2016-07-28 14:17:33 -07002274 }
halcanary19a97202016-08-03 15:08:04 -07002275
Ravi Mistry10d36c52017-01-31 09:49:18 -05002276 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002277 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002278 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002279 deps = [
2280 ":flags",
2281 ":skia",
2282 ]
2283 }
2284
Mike Reedc0ee21f2019-05-28 16:11:03 -04002285 if (skia_use_ffmpeg) {
2286 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002287 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002288 deps = [
2289 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002290 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002291 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002292 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002293 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002294 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002295 ]
2296 }
2297 }
2298
Brian Osmanc9a42472018-05-31 13:17:12 -04002299 test_app("skpbench") {
Kevin Lubickf541ddf2021-10-13 16:02:56 -04002300 sources = [
2301 "bench/BigPath.cpp",
2302 "tools/skpbench/skpbench.cpp",
2303 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002304 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002305 ":common_flags_config",
2306 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002307 ":flags",
2308 ":gpu_tool_utils",
2309 ":skia",
2310 ":tool_utils",
2311 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002312 }
2313
Mike Kleine6682eb2017-01-05 10:54:57 -05002314 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002315 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002316 deps = [
2317 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002318 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002319 ]
halcanary3eee9d92016-09-10 07:01:53 -07002320 }
mtklein046cb562016-09-16 10:23:12 -07002321
Ben Wagner219f3622017-07-17 15:32:25 -04002322 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002323 sources = [ "tools/fonts/create_test_font.cpp" ]
2324 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002325 assert_no_deps = [
2326 # tool_utils requires the output of this app.
2327 ":tool_utils",
2328 ]
2329 }
2330
Florin Malita5d3ff432018-07-31 16:38:43 -04002331 if (skia_use_expat) {
2332 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002333 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002334 deps = [
2335 ":flags",
2336 ":skia",
2337 ":tool_utils",
2338 ]
2339 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002340 }
2341
Mike Kleine6682eb2017-01-05 10:54:57 -05002342 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002343 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002344 deps = [
2345 ":flags",
2346 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002347 ]
mtklein046cb562016-09-16 10:23:12 -07002348 }
mtkleinecbc5262016-09-22 11:51:24 -07002349
Brian Osman6788a542018-12-10 11:56:01 -05002350 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002351 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002352 sources = [
2353 "tools/skiaserve/Request.cpp",
2354 "tools/skiaserve/Response.cpp",
2355 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002356 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2357 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2358 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2359 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2360 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2361 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2362 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2363 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2364 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002365 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2366 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002367 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2368 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2369 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2370 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2371 ]
2372 deps = [
2373 ":flags",
2374 ":gpu_tool_utils",
2375 ":skia",
2376 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002377 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002378 ]
Mike Klein7d302882016-11-03 14:06:31 -04002379 }
mtkleinecbc5262016-09-22 11:51:24 -07002380 }
kjlubick14f984b2016-10-03 11:49:45 -07002381
Mike Kleine6682eb2017-01-05 10:54:57 -05002382 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002383 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002384 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002385 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002386 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002387 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002388 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002389 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002390 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002391 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002392 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002393 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002394 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002395 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002396 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002397 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002398 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002399 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002400 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002401 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002402 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002403 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2404 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002405 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002406 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002407 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002408 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002409 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2410 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002411 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002412 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2413 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002414 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002415 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002416 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002417 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002418 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002419 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002420 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002421 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002422 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002423 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002424 "tools/debugger/DrawCommand.cpp",
2425 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002426 ]
2427 deps = [
2428 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002429 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002430 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002431 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002432 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002433 ]
kjlubick14f984b2016-10-03 11:49:45 -07002434 }
Mike Klein38312422016-10-05 15:41:01 -04002435
Mike Kleine6682eb2017-01-05 10:54:57 -05002436 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002437 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002438 rebase_path("tests/skia_test.cpp"),
2439 rebase_path("tests/Test.cpp"),
2440 ]
caryclark9feb6322016-10-25 08:58:26 -07002441 deps = [
2442 ":flags",
2443 ":gpu_tool_utils",
2444 ":skia",
2445 ":tool_utils",
2446 ]
caryclark9feb6322016-10-25 08:58:26 -07002447 }
2448
Mike Kleine6682eb2017-01-05 10:54:57 -05002449 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002450 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002451 deps = [
2452 ":flags",
2453 ":skia",
2454 ]
Mike Klein38312422016-10-05 15:41:01 -04002455 }
bungemanfe917272016-10-13 17:36:40 -04002456
Mike Kleine6682eb2017-01-05 10:54:57 -05002457 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002458 sources = [
2459 "tools/skdiff/skdiff.cpp",
2460 "tools/skdiff/skdiff_html.cpp",
2461 "tools/skdiff/skdiff_main.cpp",
2462 "tools/skdiff/skdiff_utils.cpp",
2463 ]
2464 deps = [
2465 ":skia",
2466 ":tool_utils",
2467 ]
bungemanfe917272016-10-13 17:36:40 -04002468 }
halcanarya73d76a2016-10-17 13:19:02 -07002469
Mike Kleine6682eb2017-01-05 10:54:57 -05002470 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002471 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002472 deps = [
2473 ":skia",
2474 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002475 ]
halcanarya73d76a2016-10-17 13:19:02 -07002476 }
Brian Osman16adfa32016-10-18 14:42:44 -04002477
Brian Osmanc9a42472018-05-31 13:17:12 -04002478 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002479 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002480 check_includes = false
2481 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002482 public_configs = [ ":skia_private" ]
Hal Canary75427132017-10-11 16:00:31 -04002483 sources = [
2484 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002485 "tools/skqp/src/skqp.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002486 ]
2487 deps = [
2488 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002489 ":skia",
2490 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002491 ":tool_utils",
2492 ]
2493 }
2494 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002495 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002496 include_dirs = [ "//" ]
2497 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002498 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002499 }
Hal Canary75427132017-10-11 16:00:31 -04002500 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002501 if (is_fuchsia) {
2502 # Build a package repository for skqp on Fuchsia.
2503 group("skqp_repo") {
2504 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002505 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002506 }
2507 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002508 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002509 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002510 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002511 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002512 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002513 deps = [
2514 ":skia",
2515 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002516 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002517 ]
2518 libs = [ "android" ]
2519 }
2520 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002521 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002522 test_app("skottie_android") {
2523 is_shared_library = true
2524
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002525 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002526 libs = []
2527
Stan Iliev93151722018-08-02 11:10:52 -04002528 deps = [
2529 ":skia",
2530 "modules/skottie",
2531 ]
2532 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002533
2534 test_app("androidkit") {
2535 is_shared_library = true
2536
Florin Malita2a650cc2021-04-12 13:38:44 -04002537 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002538 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002539 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002540 "modules/androidkit/src/ColorFilters.cpp",
Jorge Betancourt151a6f32021-09-07 16:50:21 -04002541 "modules/androidkit/src/Font.cpp",
Jorge Betancourtaa9656d2021-10-14 14:02:08 -04002542 "modules/androidkit/src/FontChainAdapter.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002543 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002544 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002545 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002546 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002547 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002548 "modules/androidkit/src/Path.cpp",
2549 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002550 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2551 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002552 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002553 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002554 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002555 "modules/androidkit/src/SurfaceThread.cpp",
2556 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002557 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002558 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002559 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002560 libs = [
2561 "android",
2562 "jnigraphics",
2563 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002564
Florin Malita2cc65382021-04-26 21:59:35 -04002565 deps = [
2566 ":sk_app",
2567 ":skia",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002568 "experimental/sktext:sktext",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002569 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002570 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002571 }
Stan Iliev93151722018-08-02 11:10:52 -04002572 }
Hal Canary75427132017-10-11 16:00:31 -04002573
Hal Canarya9de7602018-01-19 13:08:23 -05002574 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002575 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002576 deps = [
2577 ":gm",
2578 ":skia",
2579 ]
2580 }
2581 test_app("list_gpu_unit_tests") {
2582 sources = [
2583 "dm/DMGpuTestProcs.cpp",
2584 "tools/list_gpu_unit_tests.cpp",
2585 ]
2586 deps = [
2587 ":skia",
2588 ":tests",
2589 ]
2590 }
2591
Brian Osmanc9a42472018-05-31 13:17:12 -04002592 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002593 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002594 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002595 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002596 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002597 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002598 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002599 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002600 "tools/sk_app/CommandSet.h",
2601 "tools/sk_app/DisplayParams.h",
2602 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002603 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002604 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002605 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002606 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002607 ]
2608 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002609 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002610
2611 if (is_android) {
2612 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002613 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002614 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002615 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002616 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002617 "tools/sk_app/android/main_android.cpp",
2618 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002619 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002620 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002621 libs += [ "android" ]
2622 } else if (is_linux) {
2623 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002624 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002625 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002626 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002627 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002628 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002629 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002630 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002631 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002632 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002633 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002634 "X11",
2635 ]
2636 } else if (is_win) {
2637 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002638 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002639 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002640 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002641 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002642 "tools/sk_app/win/main_win.cpp",
2643 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002644 } else if (is_mac) {
2645 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002646 "tools/sk_app/mac/WindowContextFactory_mac.h",
2647 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002648 "tools/sk_app/mac/Window_mac.mm",
2649 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002650 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002651 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002652 "QuartzCore.framework",
2653 "Cocoa.framework",
2654 "Foundation.framework",
2655 ]
2656 } else if (is_ios) {
2657 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002658 "tools/sk_app/ios/WindowContextFactory_ios.h",
2659 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002660 "tools/sk_app/ios/Window_ios.mm",
2661 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002662 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002663 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002664 }
2665
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002666 if (skia_use_gl) {
2667 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002668 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002669 if (is_android) {
2670 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2671 } else if (is_linux) {
2672 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2673 } else if (is_win) {
2674 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2675 if (skia_use_angle) {
2676 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2677 }
2678 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002679 sources += [
2680 "tools/sk_app/mac/GLWindowContext_mac.mm",
2681 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2682 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002683 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002684 sources += [
2685 "tools/sk_app/ios/GLWindowContext_ios.mm",
2686 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2687 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002688 }
2689 }
2690
Brian Osmanc9a42472018-05-31 13:17:12 -04002691 if (skia_use_vulkan) {
2692 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002693 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002694 if (is_android) {
2695 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2696 } else if (is_linux) {
2697 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2698 libs += [ "X11-xcb" ]
2699 } else if (is_win) {
2700 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2701 }
2702 }
2703
Jim Van Verthbe39f712019-02-08 15:36:14 -05002704 if (skia_use_metal) {
2705 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002706 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002707 if (skia_enable_graphite) {
2708 sources += [ "tools/sk_app/GraphiteMetalWindowContext.mm" ]
2709 sources += [ "tools/sk_app/GraphiteMetalWindowContext.h" ]
2710 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002711 if (is_mac) {
2712 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002713 if (skia_enable_graphite) {
2714 sources += [ "tools/sk_app/mac/GraphiteMetalWindowContext_mac.mm" ]
2715 }
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002716 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002717 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002718 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002719 }
2720
Jim Van Verth682a2f42020-05-13 16:54:09 -04002721 if (skia_use_direct3d) {
2722 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2723 }
2724
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002725 if (skia_use_dawn) {
2726 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002727 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002728 if (is_linux) {
2729 if (dawn_enable_vulkan) {
2730 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2731 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2732 libs += [ "X11-xcb" ]
2733 }
2734 } else if (is_win) {
2735 if (dawn_enable_d3d12) {
2736 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2737 }
2738 } else if (is_mac) {
2739 if (dawn_enable_metal) {
2740 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2741 }
2742 }
2743 }
2744
Mike Kleina01c6b02020-04-01 13:47:34 -05002745 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002746 if (is_android) {
2747 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002748 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002749 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002750 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002751 }
Brian Osman16adfa32016-10-18 14:42:44 -04002752 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002753
Hal Canary87515122019-03-15 14:22:51 -04002754 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2755 test_app("fiddle_examples") {
2756 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002757 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002758 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002759 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002760 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002761 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002762 cflags = [
2763 "/wd4756", # Overflow in constant arithmetic
2764 "/wd4305", # truncation from 'double' to 'float'
2765 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002766 }
Hal Canary87515122019-03-15 14:22:51 -04002767 deps = [
2768 ":skia",
2769 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002770 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002771 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002772 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002773 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002774 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002775 ]
2776 }
2777 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002778
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002779 # sk_app can work without GL but viewer always runs raster through a GL window context.
2780 if (skia_use_gl) {
2781 test_app("viewer") {
2782 is_shared_library = is_android
2783 sources = [
2784 "tools/viewer/AnimTimer.h",
2785 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002786 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002787 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002788 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002789 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002790 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002791 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002792 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002793 "tools/viewer/MSKPSlide.cpp",
2794 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002795 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002796 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002797 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002798 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002799 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002800 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002801 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002802 "tools/viewer/SkRiveSlide.h",
John Stiles00b3fcc2021-12-10 19:53:57 -05002803 "tools/viewer/SkSLDebuggerSlide.cpp",
2804 "tools/viewer/SkSLDebuggerSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002805 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002806 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002807 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002808 "tools/viewer/SkottieSlide.h",
2809 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002810 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002811 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002812 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002813 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002814 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002815 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002816 "tools/viewer/TouchGesture.cpp",
2817 "tools/viewer/TouchGesture.h",
2818 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002819 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002820 ]
2821 libs = []
2822
2823 deps = [
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002824 ":common_flags_fontmgr",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002825 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002826 ":flags",
2827 ":gm",
2828 ":gpu_tool_utils",
2829 ":samples",
2830 ":sk_app",
2831 ":skia",
2832 ":tool_utils",
2833 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002834 "experimental/skrive",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002835 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002836 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002837 "modules/particles",
2838 "modules/skottie",
2839 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002840 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002841 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002842 "//third_party/imgui",
2843 ]
2844 if (skia_use_experimental_xform) {
2845 deps += [ ":experimental_xform" ]
2846 sources += [ "gm/xform.cpp" ]
2847 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002848 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002849 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002850 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002851
Corentin Wallez89d6e792021-03-08 15:25:34 +01002852 #spvtools depends on this but doesn't deps it in.
2853 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002854 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002855 }
Mike Reedd62d4062019-06-12 10:20:44 -04002856 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002857 }
2858
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002859 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002860 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002861 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002862 libs = []
2863
Brian Osmaneff04b52017-11-21 13:18:02 -05002864 deps = [
2865 ":flags",
2866 ":gpu_tool_utils",
2867 ":sk_app",
2868 ":skia",
2869 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002870 ]
2871 }
2872 }
2873
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002874 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2875 action_foreach("generate_mocs") {
2876 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002877 sources = [ "tools/mdbviz/MainWindow.h" ]
2878 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002879 args = [
2880 "$skia_qt_path" + "/bin/moc",
2881 "{{source}}",
2882 "-o",
2883 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2884 ]
2885 }
2886 action_foreach("generate_resources") {
2887 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002888 sources = [ "tools/mdbviz/resources.qrc" ]
2889 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002890 args = [
2891 "$skia_qt_path" + "/bin/rcc",
2892 "{{source}}",
2893 "-o",
2894 "gen/mdbviz/{{source_name_part}}_res.cpp",
2895 ]
2896 }
2897 test_app("mdbviz") {
2898 if (is_win) {
2899 # on Windows we need to disable some exception handling warnings due to the Qt headers
2900 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2901 }
2902 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002903 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002904 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002905 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002906 "tools/debugger/DrawCommand.cpp",
2907 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002908 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002909 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002910 "tools/mdbviz/main.cpp",
2911
2912 # generated files
2913 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2914 "$target_gen_dir/mdbviz/resources_res.cpp",
2915 ]
2916 lib_dirs = [ "$skia_qt_path/lib" ]
2917 libs = [
2918 "Qt5Core.lib",
2919 "Qt5Gui.lib",
2920 "Qt5Widgets.lib",
2921 ]
2922 include_dirs = [
2923 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002924 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002925 "$skia_qt_path/include/QtWidgets",
2926 ]
2927 deps = [
2928 ":generate_mocs",
2929 ":generate_resources",
2930 ":skia",
2931 ]
2932 }
2933 }
2934
Mike Kleine459afd2017-03-03 09:21:30 -05002935 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002936 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002937 sources = [ "$ndk/$ndk_gdbserver" ]
2938 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002939 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002940 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002941
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002942 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002943 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002944 deps = [
2945 ":skia",
2946 "modules/particles",
2947 ]
2948 }
2949
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002950 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002951 test_app("editor") {
2952 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002953 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002954 }
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002955 test_app("text_editor") {
2956 is_shared_library = is_android
2957 deps = [ "experimental/sktext:text_editor" ]
2958 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002959 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002960
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002961 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002962 sources = [ "tools/image_diff_metric.cpp" ]
2963 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002964 }
Chris Dalton2b598902020-03-25 10:50:35 -06002965
2966 group("modules_testonly") {
2967 testonly = true
2968 deps = []
2969 if (target_cpu == "wasm") {
2970 deps += [ "modules/canvaskit:viewer_wasm" ]
2971 }
2972 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002973
2974 if (skia_build_fuzzers) {
2975 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002976 skia_executable(target_name) {
2977 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002978 check_includes = false
2979 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002980 if (!defined(configs)) {
2981 configs = []
2982 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002983 configs += [ ":skia_private" ]
2984 sources += [
2985 "fuzz/Fuzz.cpp",
2986 "fuzz/FuzzCommon.cpp",
2987 ]
2988 deps += [
2989 ":flags",
2990 ":gpu_tool_utils",
2991 ":skia",
2992 ]
2993 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2994 if (skia_use_libfuzzer_defaults) {
2995 cflags = [ "-fsanitize=fuzzer" ]
2996 ldflags = [ "-fsanitize=fuzzer" ]
2997 }
2998 testonly = true
2999 }
3000 }
3001
3002 libfuzzer_app("region_deserialize") {
3003 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
3004 deps = []
3005 }
3006
3007 libfuzzer_app("image_filter_deserialize") {
3008 include_dirs = [
3009 "tools",
3010 "tools/fonts",
3011 ]
3012 sources = [
3013 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
3014 "tools/Resources.cpp",
3015 "tools/fonts/TestFontMgr.cpp",
3016 "tools/fonts/TestSVGTypeface.cpp",
3017 "tools/fonts/TestTypeface.cpp",
3018 ]
Florin Malitab3418102020-10-15 18:10:29 -04003019 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003020 }
3021
3022 libfuzzer_app("region_set_path") {
3023 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
3024 deps = []
3025 }
3026
3027 libfuzzer_app("textblob_deserialize") {
3028 include_dirs = [
3029 "tools",
3030 "tools/fonts",
3031 ]
3032 sources = [
3033 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
3034 "tools/Resources.cpp",
3035 "tools/fonts/TestFontMgr.cpp",
3036 "tools/fonts/TestSVGTypeface.cpp",
3037 "tools/fonts/TestTypeface.cpp",
3038 ]
Florin Malitab3418102020-10-15 18:10:29 -04003039 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003040 }
3041
3042 libfuzzer_app("path_deserialize") {
3043 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
3044 deps = []
3045 }
3046
3047 libfuzzer_app("image_decode") {
3048 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3049 deps = []
3050 }
3051
3052 libfuzzer_app("animated_image_decode") {
3053 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3054 deps = []
3055 }
3056
3057 libfuzzer_app("api_create_ddl") {
3058 include_dirs = [
3059 "include",
3060 "include/gpu",
3061 ]
3062 sources = [
3063 "fuzz/FuzzCreateDDL.cpp",
3064 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3065 "tools/Resources.cpp",
3066 "tools/UrlDataManager.cpp",
3067 "tools/debugger/DebugCanvas.cpp",
3068 "tools/debugger/DebugLayerManager.cpp",
3069 "tools/debugger/DrawCommand.cpp",
3070 "tools/debugger/JsonWriteBuffer.cpp",
3071 "tools/fonts/TestFontMgr.cpp",
3072 "tools/fonts/TestSVGTypeface.cpp",
3073 "tools/fonts/TestTypeface.cpp",
3074 ]
3075 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003076 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003077 "//third_party/libpng",
3078 ]
3079 }
3080
3081 libfuzzer_app("api_draw_functions") {
3082 sources = [
3083 "fuzz/FuzzDrawFunctions.cpp",
3084 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3085 ]
3086 deps = []
3087 }
3088
Adlai Hollerccb68662021-02-25 10:28:44 -05003089 libfuzzer_app("api_ddl_threading") {
3090 sources = [
3091 "fuzz/FuzzDDLThreading.cpp",
3092 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3093 ]
3094 deps = []
3095 }
3096
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003097 libfuzzer_app("api_gradients") {
3098 sources = [
3099 "fuzz/FuzzGradients.cpp",
3100 "fuzz/oss_fuzz/FuzzGradients.cpp",
3101 ]
3102 deps = []
3103 }
3104
3105 libfuzzer_app("api_image_filter") {
3106 include_dirs = [
3107 "tools",
3108 "tools/debugger",
3109 ]
3110 sources = [
3111 "fuzz/FuzzCanvas.cpp",
3112 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3113 "tools/UrlDataManager.cpp",
3114 "tools/debugger/DebugCanvas.cpp",
3115 "tools/debugger/DebugLayerManager.cpp",
3116 "tools/debugger/DrawCommand.cpp",
3117 "tools/debugger/JsonWriteBuffer.cpp",
3118 ]
3119 deps = [ "//third_party/libpng" ]
3120 }
3121
3122 libfuzzer_app("api_path_measure") {
3123 sources = [
3124 "fuzz/FuzzPathMeasure.cpp",
3125 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3126 ]
3127 deps = []
3128 }
3129
3130 libfuzzer_app("api_pathop") {
3131 sources = [
3132 "fuzz/FuzzPathop.cpp",
3133 "fuzz/oss_fuzz/FuzzPathop.cpp",
3134 ]
3135 deps = []
3136 }
3137
Robert Phillips98b066c2021-04-22 10:51:58 -04003138 libfuzzer_app("api_triangulation") {
3139 sources = [
3140 "fuzz/FuzzTriangulation.cpp",
3141 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3142 ]
3143 deps = []
3144 }
3145
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003146 libfuzzer_app("api_raster_n32_canvas") {
3147 include_dirs = [
3148 "tools",
3149 "tools/debugger",
3150 "tools/fonts",
3151 ]
3152 sources = [
3153 "fuzz/FuzzCanvas.cpp",
3154 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3155 "tools/Resources.cpp",
3156 "tools/UrlDataManager.cpp",
3157 "tools/debugger/DebugCanvas.cpp",
3158 "tools/debugger/DebugLayerManager.cpp",
3159 "tools/debugger/DrawCommand.cpp",
3160 "tools/debugger/JsonWriteBuffer.cpp",
3161 "tools/fonts/TestFontMgr.cpp",
3162 "tools/fonts/TestSVGTypeface.cpp",
3163 "tools/fonts/TestTypeface.cpp",
3164 ]
3165 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003166 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003167 "//third_party/libpng",
3168 ]
3169 }
3170
Kevin Lubick7845b972021-03-29 08:07:32 -04003171 libfuzzer_app("api_regionop") {
3172 sources = [
3173 "fuzz/FuzzRegionOp.cpp",
3174 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3175 ]
3176 deps = []
3177 }
3178
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003179 if (skia_use_gl) {
3180 libfuzzer_app("api_mock_gpu_canvas") {
3181 include_dirs = [
3182 "tools",
3183 "tools/debugger",
3184 "tools/fonts",
3185 ]
3186 sources = [
3187 "fuzz/FuzzCanvas.cpp",
3188 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3189 "tools/LsanSuppressions.cpp",
3190 "tools/Resources.cpp",
3191 "tools/UrlDataManager.cpp",
3192 "tools/debugger/DebugCanvas.cpp",
3193 "tools/debugger/DebugLayerManager.cpp",
3194 "tools/debugger/DrawCommand.cpp",
3195 "tools/debugger/JsonWriteBuffer.cpp",
3196 "tools/fonts/TestFontMgr.cpp",
3197 "tools/fonts/TestSVGTypeface.cpp",
3198 "tools/fonts/TestTypeface.cpp",
3199 ]
3200 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003201 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003202 "//third_party/libpng",
3203 ]
3204 }
3205 }
3206
3207 libfuzzer_app("api_null_canvas") {
3208 include_dirs = [
3209 "tools",
3210 "tools/debugger",
3211 "tools/fonts",
3212 ]
3213 sources = [
3214 "fuzz/FuzzCanvas.cpp",
3215 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3216 "tools/Resources.cpp",
3217 "tools/UrlDataManager.cpp",
3218 "tools/debugger/DebugCanvas.cpp",
3219 "tools/debugger/DebugLayerManager.cpp",
3220 "tools/debugger/DrawCommand.cpp",
3221 "tools/debugger/JsonWriteBuffer.cpp",
3222 "tools/fonts/TestFontMgr.cpp",
3223 "tools/fonts/TestSVGTypeface.cpp",
3224 "tools/fonts/TestTypeface.cpp",
3225 ]
3226 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003227 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003228 "//third_party/libpng",
3229 ]
3230 }
3231
Weston Tracey1a771fe2021-02-04 11:09:59 -05003232 libfuzzer_app("api_skparagraph") {
3233 sources = [
3234 "fuzz/FuzzSkParagraph.cpp",
3235 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3236 "tools/Resources.cpp",
3237 ]
3238 deps = [ "modules/skparagraph" ]
3239 }
3240
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003241 libfuzzer_app("api_svg_canvas") {
3242 include_dirs = [
3243 "include",
3244 "include/svg",
3245 ]
3246 sources = [
3247 "fuzz/FuzzCanvas.cpp",
3248 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3249 "tools/Resources.cpp",
3250 "tools/UrlDataManager.cpp",
3251 "tools/debugger/DebugCanvas.cpp",
3252 "tools/debugger/DebugLayerManager.cpp",
3253 "tools/debugger/DrawCommand.cpp",
3254 "tools/debugger/JsonWriteBuffer.cpp",
3255 "tools/fonts/TestFontMgr.cpp",
3256 "tools/fonts/TestSVGTypeface.cpp",
3257 "tools/fonts/TestTypeface.cpp",
3258 ]
3259 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003260 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003261 "//third_party/libpng",
3262 ]
3263 }
3264
3265 libfuzzer_app("png_encoder") {
3266 sources = [
3267 "fuzz/FuzzEncoders.cpp",
3268 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3269 ]
3270 deps = []
3271 }
3272
3273 libfuzzer_app("jpeg_encoder") {
3274 sources = [
3275 "fuzz/FuzzEncoders.cpp",
3276 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3277 ]
3278 deps = []
3279 }
3280
3281 libfuzzer_app("webp_encoder") {
3282 sources = [
3283 "fuzz/FuzzEncoders.cpp",
3284 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3285 ]
3286 deps = []
3287 }
3288
3289 libfuzzer_app("skottie_json") {
3290 sources = [
3291 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3292 "tools/Resources.cpp",
3293 "tools/fonts/TestFontMgr.cpp",
3294 "tools/fonts/TestSVGTypeface.cpp",
3295 "tools/fonts/TestTypeface.cpp",
3296 ]
3297 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003298 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003299 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003300 ]
3301 }
3302
3303 libfuzzer_app("skjson") {
3304 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3305 deps = []
3306 }
3307
3308 libfuzzer_app("api_polyutils") {
3309 sources = [
3310 "fuzz/FuzzPolyUtils.cpp",
3311 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3312 ]
3313 deps = [ ":skia" ]
3314 }
3315
3316 libfuzzer_app("android_codec") {
3317 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3318 deps = []
3319 }
3320
3321 libfuzzer_app("image_decode_incremental") {
3322 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3323 deps = []
3324 }
3325
3326 libfuzzer_app("sksl2glsl") {
3327 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3328 deps = []
3329 }
3330
3331 libfuzzer_app("sksl2spirv") {
3332 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3333 deps = []
3334 }
3335
3336 libfuzzer_app("sksl2metal") {
3337 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3338 deps = []
3339 }
3340
3341 libfuzzer_app("sksl2pipeline") {
3342 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3343 deps = []
3344 }
3345
3346 libfuzzer_app("skdescriptor_deserialize") {
3347 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3348 deps = []
3349 }
3350
3351 libfuzzer_app("svg_dom") {
3352 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003353 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003354 }
3355
3356 libfuzzer_app("skruntimeeffect") {
3357 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3358 deps = []
3359 }
3360
3361 libfuzzer_app("skp") {
3362 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3363 deps = []
3364 }
3365 }
mtklein25c81d42016-07-27 13:55:26 -07003366}
Hal Canary932a2c02019-09-17 10:43:18 -04003367
Greg Daniel391f9412021-10-28 12:44:43 -04003368if (is_ios && skia_use_metal && skia_enable_gpu &&
3369 !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003370 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003371 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003372 }
Hal Canary27483062019-12-06 15:01:08 -05003373}
3374
Hal Canary60ff6512020-01-21 12:39:20 -05003375if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003376 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003377 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003378 }
3379}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003380
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003381skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003382 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3383 include_dirs = [ "." ]
3384 deps = [ ":skia" ]
3385}