blob: 393e5c5adcb8901d38ab59026a9a96887b4de4c8 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary45812a12019-09-04 08:58:59 -04009import("gn/skia.gni")
10
John Rosasco24cbdab2019-09-25 14:14:35 -070011if (is_fuchsia) {
12 import("//build/fuchsia/sdk.gni")
13 import("build/fuchsia/fuchsia_download_sdk.gni")
14}
15
Stephen White0d70b712019-07-10 15:51:30 -040016if (skia_use_dawn) {
17 import("third_party/externals/dawn/scripts/dawn_features.gni")
18}
19
Adam Barth54ef74a2017-10-13 10:59:38 -070020if (defined(skia_settings)) {
21 import(skia_settings)
22}
23
Hal Canary3388c1a2019-09-16 12:53:17 -040024import("gn/ios.gni")
25
mtkleinc04ff472016-06-23 10:29:30 -070026# Skia public API, generally provided by :skia.
27config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050028 include_dirs = [ "." ]
29
Mike Kleinae7e6712016-10-11 17:49:33 -040030 defines = []
Chinmay Gardef832c0a2020-03-18 14:37:23 -070031 cflags_objcc = []
Mike Kleinae7e6712016-10-11 17:49:33 -040032 if (is_component_build) {
33 defines += [ "SKIA_DLL" ]
34 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040035 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050036 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070037 }
Brian Osmanf2c90142017-07-13 15:50:03 -040038 if (skia_enable_flutter_defines) {
39 defines += flutter_defines
40 }
mtklein06c35c02016-09-20 12:28:12 -070041 if (!skia_enable_gpu) {
42 defines += [ "SK_SUPPORT_GPU=0" ]
43 }
Brian Osman946a4cb2021-07-12 17:02:21 -040044 if (skia_enable_sksl) {
45 defines += [ "SK_ENABLE_SKSL" ]
46 }
Mike Reed025f7832018-11-12 09:27:05 -050047 if (is_fuchsia) {
48 defines += fuchsia_defines
49 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040050 if (skia_gl_standard == "gles") {
51 defines += [ "SK_ASSUME_GL_ES=1" ]
52 } else if (skia_gl_standard == "gl") {
53 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040054 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040055 defines += [
56 "SK_ASSUME_WEBGL=1",
57 "SK_USE_WEBGL",
58 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040059 }
Robert Phillips024668c2021-07-01 12:12:52 -040060 if (skia_enable_skgpu_v2) {
Robert Phillips7cef6782021-07-01 13:21:37 -040061 defines += [ "SK_GPU_V2=1" ]
Robert Phillips7b931f82021-06-09 14:04:05 -040062 }
Robert Phillips024668c2021-07-01 12:12:52 -040063 if (!skia_enable_skgpu_v1) {
Robert Phillips7cef6782021-07-01 13:21:37 -040064 defines += [ "SK_GPU_V1=0" ]
Robert Phillips3b97aa22021-05-03 11:42:40 -040065 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070066
67 # Some older versions of the Clang toolchain change the visibility of
68 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
69 # toolchains suppress the use of this macro till toolchain updates are made.
70 if (is_mac || is_ios) {
71 if (skia_enable_api_available_macro) {
72 defines += [ "SK_ENABLE_API_AVAILABLE" ]
73 } else {
74 cflags_objcc += [ "-Wno-unguarded-availability" ]
75 }
76 }
mtkleinc04ff472016-06-23 10:29:30 -070077}
78
79# Skia internal APIs, used by Skia itself and a few test tools.
80config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060081 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070082
Mike Reeda9e241d2017-05-03 10:52:00 -040083 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050084 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070085 defines += [
86 "SK_GAMMA_EXPONENT=1.4",
87 "SK_GAMMA_CONTRAST=0.0",
88 ]
89 }
Mike Kleinb45d8622019-04-24 14:04:01 -050090 if (is_skia_dev_build) {
91 defines += [
92 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
93 "GR_TEST_UTILS=1",
94 ]
Jim Van Verth0c56bba2021-10-18 12:15:47 -040095 if (skia_enable_graphite) {
96 defines += [ "GRAPHITE_TEST_UTILS=1" ]
97 }
mtklein88a7ac02016-09-14 11:16:49 -070098 }
Brian Salomon789e25e2016-09-30 13:41:03 -040099 libs = []
100 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400101 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -0500102 defines += [ "SK_ANGLE" ]
103 }
Greg Danielb16beb92020-04-27 14:26:21 +0000104 if (skia_use_vma) {
105 defines += [ "SK_USE_VMA" ]
106 }
James Clarkeb8c0dab2021-02-09 06:22:41 -0800107 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -0800108 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800109 }
110}
111
mtkleinc04ff472016-06-23 10:29:30 -0700112# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
113config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600114 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000115 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700116}
117
118skia_library_configs = [
119 ":skia_public",
120 ":skia_private",
121 ":skia_library",
122]
123
mtklein9b8583d2016-08-24 17:32:30 -0700124# Use for CPU-specific Skia code that needs particular compiler flags.
125template("opts") {
126 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400127 skia_source_set(target_name) {
128 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500129 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400130 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700131 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400132 if (defined(invoker.configs)) {
133 configs += invoker.configs
134 }
mtklein9b8583d2016-08-24 17:32:30 -0700135 }
136 } else {
137 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400138 skia_source_set(target_name) {
139 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500140 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700141 forward_variables_from(invoker,
142 "*",
143 [
144 "sources",
145 "cflags",
146 ])
147 }
148 }
anmittala7eaf2e2016-08-17 13:57:26 -0700149}
150
mtklein422310d2016-08-16 18:28:43 -0700151is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700152
mtklein7d6fb2c2016-08-25 14:50:44 -0700153opts("none") {
154 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700156 cflags = []
157}
158
mtklein7d6fb2c2016-08-25 14:50:44 -0700159opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700160 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700162 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700163}
164
165opts("arm64") {
166 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700168 cflags = []
169}
170
171opts("crc32") {
172 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700174 cflags = [ "-march=armv8-a+crc" ]
175}
176
mtklein9b8583d2016-08-24 17:32:30 -0700177opts("sse2") {
178 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700179 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400180 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400181 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
182 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400183 cflags = [ "-msse2" ]
184 }
mtklein9b8583d2016-08-24 17:32:30 -0700185}
mtkleinc04ff472016-06-23 10:29:30 -0700186
mtklein9b8583d2016-08-24 17:32:30 -0700187opts("ssse3") {
188 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700189 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400190 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400191 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
192 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400193 cflags = [ "-mssse3" ]
194 }
mtklein9b8583d2016-08-24 17:32:30 -0700195}
mtkleinc04ff472016-06-23 10:29:30 -0700196
mtklein9b8583d2016-08-24 17:32:30 -0700197opts("sse41") {
198 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700199 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400200 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400201 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
202 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400203 cflags = [ "-msse4.1" ]
204 }
mtklein9b8583d2016-08-24 17:32:30 -0700205}
mtklein4e976072016-08-08 09:06:27 -0700206
mtklein9b8583d2016-08-24 17:32:30 -0700207opts("sse42") {
208 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700209 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400210 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400211 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
212 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400213 cflags = [ "-msse4.2" ]
214 }
mtklein9b8583d2016-08-24 17:32:30 -0700215}
216
217opts("avx") {
218 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700219 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400220 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000221 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400222 } else {
223 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500224 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500225 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500226 }
Mike Klein3eb71212016-10-11 17:08:53 -0400227 }
mtkleinc04ff472016-06-23 10:29:30 -0700228}
229
Mike Klein1b9b7d52018-02-27 10:37:40 -0500230opts("hsw") {
231 enabled = is_x86
232 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400233 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500234 cflags = [ "/arch:AVX2" ]
235 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000236 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600237 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500238 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600239 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500240 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500241}
242
Mike Kleinad56c4c2020-06-05 06:57:30 -0500243opts("skx") {
244 enabled = is_x86
245 sources = skia_opts.skx_sources
246 if (is_win) {
247 cflags = [ "/arch:AVX512" ]
248 } else {
249 cflags = [ "-march=skylake-avx512" ]
250 if (is_mac && is_debug) {
251 cflags += [ "-fno-stack-check" ] # Work around skia:9709
252 }
253 }
254}
255
mtkleinc095df52016-08-24 12:23:52 -0700256# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700257template("optional") {
258 if (invoker.enabled) {
259 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700260 if (defined(invoker.public_defines)) {
261 defines = invoker.public_defines
262 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600263 if (defined(invoker.public_configs)) {
264 configs = invoker.public_configs
265 }
Hal Canary2dad9902019-11-20 16:01:31 -0500266 if (defined(invoker.public_include_dirs)) {
267 include_dirs = invoker.public_include_dirs
268 }
mtklein457b42a2016-08-23 13:56:37 -0700269 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400270 skia_source_set(target_name) {
271 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500272 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400273 configs = skia_library_configs
274
275 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700276 forward_variables_from(invoker,
277 "*",
278 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400279 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700280 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500281 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700282 "sources_when_disabled",
283 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400284 if (defined(invoker.configs)) {
285 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700286 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400287 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700288 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500289 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400290 skia_source_set(target_name + "_tests") {
291 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500292 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400293 configs = skia_library_configs
294
295 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500296 forward_variables_from(invoker,
297 "*",
298 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400299 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500300 "public_defines",
301 "sources",
302 "sources_for_tests",
303 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500304 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400305 if (defined(invoker.configs)) {
306 configs += invoker.configs
307 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500308 testonly = true
309 sources = invoker.sources_for_tests
310 if (!defined(deps)) {
311 deps = []
312 }
313 deps += [ ":test" ]
314 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500315 }
316 }
mtklein457b42a2016-08-23 13:56:37 -0700317 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400318 skia_source_set(target_name) {
319 visibility = [ ":*" ]
320 configs = skia_library_configs
321
322 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700323 forward_variables_from(invoker,
324 "*",
325 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400326 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400327 "public",
mtklein457b42a2016-08-23 13:56:37 -0700328 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400329 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700330 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700331 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400332 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700333 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500334 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700335 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700336 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400337 if (defined(invoker.configs)) {
338 configs += invoker.configs
339 }
mtkleincd01b032016-08-31 04:58:19 -0700340 if (defined(invoker.sources_when_disabled)) {
341 sources = invoker.sources_when_disabled
342 }
mtklein457b42a2016-08-23 13:56:37 -0700343 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500344 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400345 skia_source_set(target_name + "_tests") {
346 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500347 }
348 }
mtkleineb3c4252016-08-23 07:38:09 -0700349 }
mtklein457b42a2016-08-23 13:56:37 -0700350}
mtklein457b42a2016-08-23 13:56:37 -0700351
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400352optional("android_utils") {
353 enabled = skia_enable_android_utils
354
Leon Scroggins III87caae62020-05-04 10:02:45 -0400355 public = [
356 "client_utils/android/BRDAllocator.h",
357 "client_utils/android/BitmapRegionDecoder.h",
358 "client_utils/android/FrontBufferedStream.h",
359 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400360 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400361 sources = [
362 "client_utils/android/BitmapRegionDecoder.cpp",
363 "client_utils/android/FrontBufferedStream.cpp",
364 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400365}
366
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400367group("fontmgr_factory") {
368 public_deps = [ skia_fontmgr_factory ]
369}
370
371optional("fontmgr_empty_factory") {
372 enabled = true
373 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400374}
375
mtkleina45be612016-08-29 15:22:10 -0700376optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500377 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700378
379 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500380 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700381 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700382 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400383 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700384 sources = [
385 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700386 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400387 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700388 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500389 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700390}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400391optional("fontmgr_android_factory") {
392 enabled = skia_enable_fontmgr_android
393 deps = [ ":fontmgr_android" ]
394 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
395}
mtkleina45be612016-08-29 15:22:10 -0700396
mtkleind2e39db2016-09-07 07:52:55 -0700397optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400398 enabled =
399 skia_enable_fontmgr_custom_directory ||
400 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700401
Mike Kleina01c6b02020-04-01 13:47:34 -0500402 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400403 public = [ "src/ports/SkFontMgr_custom.h" ]
404 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
405}
406
407optional("fontmgr_custom_directory") {
408 enabled = skia_enable_fontmgr_custom_directory
409
410 deps = [
411 ":fontmgr_custom",
412 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700413 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400414 public = [ "include/ports/SkFontMgr_directory.h" ]
415 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
416}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400417optional("fontmgr_custom_directory_factory") {
418 enabled = skia_enable_fontmgr_custom_directory
419 deps = [ ":fontmgr_custom_directory" ]
420 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
421}
Ben Wagner75626e42020-06-03 13:20:37 -0400422
423optional("fontmgr_custom_embedded") {
424 enabled = skia_enable_fontmgr_custom_embedded
425
426 deps = [
427 ":fontmgr_custom",
428 ":typeface_freetype",
429 ]
430 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700431}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400432optional("fontmgr_custom_embedded_factory") {
433 enabled = skia_enable_fontmgr_custom_embedded
434 deps = [ ":fontmgr_custom_embedded" ]
435 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
436}
mtkleind2e39db2016-09-07 07:52:55 -0700437
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500438optional("fontmgr_custom_empty") {
439 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500440
Ben Wagner75626e42020-06-03 13:20:37 -0400441 deps = [
442 ":fontmgr_custom",
443 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800444 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400445 public = [ "include/ports/SkFontMgr_empty.h" ]
446 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500447}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400448optional("fontmgr_custom_empty_factory") {
449 enabled = skia_enable_fontmgr_custom_empty
450 deps = [ ":fontmgr_custom_empty" ]
451 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
452}
Hal Canaryff2742e2018-01-30 11:35:47 -0500453
mtklein3cc22182016-08-29 13:26:14 -0700454optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400455 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700456
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400457 # The public header includes fontconfig.h and uses FcConfig*
458 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400459 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400460 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400461 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500462 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400463}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400464optional("fontmgr_fontconfig_factory") {
465 enabled = skia_enable_fontmgr_fontconfig
466 deps = [ ":fontmgr_fontconfig" ]
467 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
468}
Ben Wagner75626e42020-06-03 13:20:37 -0400469
470optional("fontmgr_FontConfigInterface") {
471 enabled = skia_enable_fontmgr_FontConfigInterface
472
473 deps = [
474 ":typeface_freetype",
475 "//third_party:fontconfig",
476 ]
477 public = [
478 "include/ports/SkFontConfigInterface.h",
479 "include/ports/SkFontMgr_FontConfigInterface.h",
480 ]
mtklein3cc22182016-08-29 13:26:14 -0700481 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700482 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700483 "src/ports/SkFontConfigInterface_direct.cpp",
484 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400485 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700486 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700487 ]
488}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400489optional("fontmgr_FontConfigInterface_factory") {
490 enabled = skia_enable_fontmgr_FontConfigInterface
491 deps = [ ":fontmgr_FontConfigInterface" ]
492 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
493}
mtklein3cc22182016-08-29 13:26:14 -0700494
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500495optional("fontmgr_fuchsia") {
496 enabled = skia_enable_fontmgr_fuchsia
497
Chinmay Garde89820762019-05-06 16:44:06 -0700498 deps = []
499
500 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700501 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700502 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500503 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700504 }
Ben Wagner75626e42020-06-03 13:20:37 -0400505 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
506 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500507}
508
Ben Wagner75626e42020-06-03 13:20:37 -0400509optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400510 enabled = skia_use_fonthost_mac
511
Ben Wagner75626e42020-06-03 13:20:37 -0400512 public = [
513 "include/ports/SkFontMgr_mac_ct.h",
514 "include/ports/SkTypeface_mac.h",
515 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400516 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400517 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400518 "src/ports/SkScalerContext_mac_ct.cpp",
519 "src/ports/SkScalerContext_mac_ct.h",
520 "src/ports/SkTypeface_mac_ct.cpp",
521 "src/ports/SkTypeface_mac_ct.h",
522 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000523 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400524
525 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400526 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400527 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
528 "AppKit.framework",
529 "ApplicationServices.framework",
530 ]
531 }
532
533 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400534 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400535 "CoreFoundation.framework",
536 "CoreGraphics.framework",
537 "CoreText.framework",
538
539 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
540 "UIKit.framework",
541 ]
542 }
543}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400544optional("fontmgr_mac_ct_factory") {
545 enabled = skia_use_fonthost_mac
546 deps = [ ":fontmgr_mac_ct" ]
547 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
548}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400549
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500550optional("fontmgr_win") {
551 enabled = skia_enable_fontmgr_win
552
Ben Wagner75626e42020-06-03 13:20:37 -0400553 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500554 sources = [
555 "src/fonts/SkFontMgr_indirect.cpp",
556 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500557 "src/ports/SkScalerContext_win_dw.cpp",
558 "src/ports/SkTypeface_win_dw.cpp",
559 ]
560}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400561optional("fontmgr_win_factory") {
562 enabled = skia_enable_fontmgr_win
563 deps = [ ":fontmgr_win" ]
564 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
565}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500566
567optional("fontmgr_win_gdi") {
568 enabled = skia_enable_fontmgr_win_gdi
569
Ben Wagner75626e42020-06-03 13:20:37 -0400570 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500571 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500572 libs = [ "Gdi32.lib" ]
573}
574
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700575if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400576 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400577 sources = [
John Stiles97d9e472021-10-20 12:40:03 -0400578 "src/sksl/lex/DFA.h",
579 "src/sksl/lex/DFAState.h",
580 "src/sksl/lex/LexUtil.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400581 "src/sksl/lex/Main.cpp",
582 "src/sksl/lex/NFA.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400583 "src/sksl/lex/NFA.h",
584 "src/sksl/lex/NFAState.h",
585 "src/sksl/lex/NFAtoDFA.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400586 "src/sksl/lex/RegexNode.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400587 "src/sksl/lex/RegexNode.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400588 "src/sksl/lex/RegexParser.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400589 "src/sksl/lex/RegexParser.h",
590 "src/sksl/lex/TransitionTable.cpp",
591 "src/sksl/lex/TransitionTable.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400592 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500593 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400594 }
595
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700596 action("run_sksllex") {
597 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500598 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
599 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700600
601 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
602 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
603 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500604 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700605 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
606 # confused due to the same file being named by two different paths
607 ]
608 sksllex_path = "$root_out_dir/"
609 sksllex_path += "sksllex"
610 if (host_os == "win") {
611 sksllex_path += ".exe"
612 }
613 args = [
614 rebase_path(sksllex_path),
615 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400616 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700617 rebase_path("src"),
618 ]
619 }
620} else {
621 group("run_sksllex") {
622 }
623}
624
Brian Osmaned5181e2021-07-01 13:54:20 -0400625# `Compile SkSL Tests` relies on skslc.
626if (skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400627 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500628 defines = [
629 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500630 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500631 "SK_ENABLE_SPIRV_VALIDATION",
632 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400633 sources = [
Michael Ludwigc1ed11d2021-08-24 11:49:55 -0400634 "src/core/SkBlockAllocator.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500635 "src/core/SkCpu.cpp",
636 "src/core/SkData.cpp",
637 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400638 "src/core/SkMalloc.cpp",
639 "src/core/SkMath.cpp",
John Stilesfbd9fae2021-06-22 09:34:14 -0400640 "src/core/SkMatrixInvert.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400641 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500642 "src/core/SkStream.cpp",
643 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500644 "src/core/SkStringUtils.cpp",
Ethan Nicholasd2e09602021-06-10 11:21:59 -0400645 "src/core/SkStringView.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 Osman62b039b2021-02-08 13:49:53 -0500650 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400651 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500652 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400653 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500654 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400655 ]
Brian Osman47726a12020-12-17 16:02:08 -0500656 if (is_win) {
657 sources += [ "src/ports/SkOSFile_win.cpp" ]
658 } else {
659 sources += [ "src/ports/SkOSFile_posix.cpp" ]
660 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400661 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400662 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500663 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400664 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500665 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100666 "//third_party/externals/spirv-tools:spvtools",
667 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400668 ]
669 }
670
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400671 skslc_path = "$root_out_dir/"
672 if (host_toolchain != default_toolchain_name) {
673 skslc_path += "$host_toolchain/"
674 }
675 skslc_path += "skslc"
676 if (host_os == "win") {
677 skslc_path += ".exe"
678 }
679
Brian Osmandd496172020-08-08 08:17:18 -0400680 copy("sksl_pre_includes") {
681 sources = [
682 "src/sksl/sksl_frag.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400683 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500684 "src/sksl/sksl_public.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400685 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400686 "src/sksl/sksl_vert.sksl",
687 ]
688 outputs = [ "$root_out_dir/{{source_file_part}}" ]
689 }
690
691 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400692
693 dehydrate_sksl_outputs = []
694 foreach(src, dehydrate_sksl_sources) {
695 name = get_path_info(src, "name")
696
697 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
698 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
699 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
700 "src/sksl/generated/$name.dehydrated.sksl",
701 target_out_dir) ]
702 }
703
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400704 action("dehydrate_sksl") {
705 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400706 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400707 ":sksl_pre_includes",
708 ":skslc(//gn/toolchain:$host_toolchain)",
709 ]
710 sources = dehydrate_sksl_sources
711 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000712 args = [
713 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400714 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000715 ]
Brian Osmandd496172020-08-08 08:17:18 -0400716 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400717 }
John Stilesd836f842020-09-14 10:21:44 -0400718} else {
719 group("dehydrate_sksl") {
720 }
721}
722
John Stilesd836f842020-09-14 10:21:44 -0400723if (skia_compile_sksl_tests) {
724 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400725
John Stiles7e248712020-09-24 16:42:09 -0400726 template("compile_sksl") {
727 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
728 action("compile_sksl_${target_name}") {
729 script = "gn/compile_sksl_tests.py"
730 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400731 ":sksl_pre_includes",
732 ":skslc(//gn/toolchain:$host_toolchain)",
733 ]
John Stilesda57fc02021-01-22 11:54:30 -0500734 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400735 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500736 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500737 args = [
738 rebase_path(skslc_path),
739 invoker.lang,
740 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500741 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500742 ]
743
John Stilesbfc9be02021-01-22 11:55:48 -0500744 testsDir = get_path_info("tests", "abspath")
745 resourcesDir = get_path_info("resources", "abspath")
746
747 foreach(partialPath, invoker.sources) {
748 dst = testsDir + partialPath
749 src = resourcesDir + partialPath
750
751 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400752
753 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
754 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
755 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
756 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
757 nameTmp = get_path_info(dst, "name")
758 name = get_path_info(nameTmp, "name")
759 ext = get_path_info(nameTmp, "extension")
760 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500761 response_file_contents += rebase_path([
762 src,
763 dir,
764 ])
John Stilesda57fc02021-01-22 11:54:30 -0500765 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500766
John Stilesda57fc02021-01-22 11:54:30 -0500767 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400768 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400769 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500770 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500771 }
John Stilesbfc9be02021-01-22 11:55:48 -0500772 outputs +=
773 [ target_out_dir + "/" +
774 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400775 }
776 }
John Stiles7e248712020-09-24 16:42:09 -0400777 }
John Stilesd836f842020-09-14 10:21:44 -0400778 }
John Stiles7e248712020-09-24 16:42:09 -0400779 compile_sksl("glsl_tests") {
780 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500781 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400782 lang = "--glsl"
783 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400784 }
John Stiles7e248712020-09-24 16:42:09 -0400785 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400786 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500787 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400788 lang = "--glsl"
789 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400790 }
John Stilesaeae3a52020-09-25 13:35:58 -0400791 compile_sksl("metal_tests") {
792 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500793 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400794 lang = "--metal"
795 settings = "--settings"
796 }
Brian Osman977feec2020-12-22 11:28:59 -0500797 compile_sksl("skvm_tests") {
798 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500799 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500800 lang = "--skvm"
801 settings = "--settings"
802 }
Brian Osman62b039b2021-02-08 13:49:53 -0500803 compile_sksl("stage_tests") {
804 sources = sksl_stage_tests_sources
805 outExtensions = [ ".stage" ]
806 lang = "--stage"
807 settings = "--settings"
808 }
John Stilesdda1d312020-11-20 16:28:50 -0500809 compile_sksl("spirv_tests") {
810 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500811 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500812 lang = "--spirv"
813 settings = "--settings"
814 }
John Stilesd836f842020-09-14 10:21:44 -0400815} else {
John Stiles7e248712020-09-24 16:42:09 -0400816 group("compile_sksl_glsl_tests") {
817 }
818 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400819 }
John Stilesaeae3a52020-09-25 13:35:58 -0400820 group("compile_sksl_metal_tests") {
821 }
Brian Osman977feec2020-12-22 11:28:59 -0500822 group("compile_sksl_skvm_tests") {
823 }
John Stilesdda1d312020-11-20 16:28:50 -0500824 group("compile_sksl_spirv_tests") {
825 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400826}
827
Greg Daniel292bbb12021-11-03 16:25:41 -0400828optional("gpu_shared") {
829 enabled = skia_enable_gpu || skia_enable_graphite
830
831 sources = skia_shared_gpu_sources
832}
833
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500834optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700835 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400836 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400837 ":compile_sksl_glsl_nosettings_tests",
838 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400839 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500840 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500841 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400842 ":dehydrate_sksl",
Greg Daniel292bbb12021-11-03 16:25:41 -0400843 ":gpu_shared",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700844 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400845 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700846 if (skia_generate_workarounds) {
847 deps += [ ":workaround_list" ]
848 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800849 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600850 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400851 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700852
Greg Daniel292bbb12021-11-03 16:25:41 -0400853 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400854 if (skia_enable_skgpu_v2) {
855 sources += skia_skgpu_v2_sources
Robert Phillips3b97aa22021-05-03 11:42:40 -0400856 }
Robert Phillips024668c2021-07-01 12:12:52 -0400857 if (!skia_enable_skgpu_v1) {
858 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400859 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400860
Mike Klein703cf5a2016-10-13 17:18:04 -0400861 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400862 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700863
John Rosascoa9b348f2019-11-08 13:18:15 -0800864 if (skia_use_gl) {
865 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400866 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500867 sources += [
868 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
869 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
870 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400871
872 # this lib is required to link against AHardwareBuffer
873 if (defined(ndk_api) && ndk_api >= 26) {
874 libs += [ "android" ]
875 }
876 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500877 sources += [
878 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
879 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
880 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400881 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400882 } else if (skia_use_webgl) {
883 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400884 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500885 sources += [
886 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
887 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
888 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400889 libs += [ "GL" ]
890 } else if (is_mac) {
891 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
892 } else if (is_ios) {
893 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800894 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400895 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
896 if (target_cpu != "arm64") {
897 libs += [ "OpenGL32.lib" ]
898 }
899 } else {
900 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
901 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800902 sources += skia_gl_gpu_sources
903 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400904
mtkleine9fb3d52016-09-20 15:11:46 -0700905 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400906 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000907 if (skia_use_vma) {
908 deps += [ "third_party/vulkanmemoryallocator" ]
909 }
mtkleine9fb3d52016-09-20 15:11:46 -0700910 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700911 if (skia_enable_vulkan_debug_layers) {
912 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
913 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800914 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800915 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700916 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
917 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400918 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700919 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800920 }
mtkleine9fb3d52016-09-20 15:11:46 -0700921 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400922
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400923 if (is_android && (skia_use_gl || skia_use_vulkan)) {
924 # this lib is required to link against AHardwareBuffer
925 if (defined(ndk_api) && ndk_api >= 26) {
926 libs += [ "android" ]
927 }
928 }
929
Stephen White0d70b712019-07-10 15:51:30 -0400930 if (skia_use_dawn) {
931 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400932 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700933 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400934 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700935 "//third_party/externals/dawn/src/dawn:dawn_proc",
936 "//third_party/externals/dawn/src/dawn:dawncpp",
937 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400938 ]
939 if (dawn_enable_d3d12) {
940 libs += [
941 "d3d12.lib",
942 "dxgi.lib",
943 "d3dcompiler.lib",
944 ]
945 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400946 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400947 }
948 }
949
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500950 if (skia_use_direct3d) {
951 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400952 deps += [
953 "//third_party/d3d12allocator",
954 "//third_party/spirv-cross:spirv_cross",
955 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500956 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500957 if (skia_enable_direct3d_debug_layer) {
958 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
959 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500960 libs += [
961 "d3d12.lib",
962 "dxgi.lib",
963 "d3dcompiler.lib",
964 ]
965 }
966
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400967 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400968 if (skia_use_metal) {
969 public_defines += [ "SK_METAL" ]
970 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400971 if (skia_enable_metal_debug_info) {
972 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
973 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400974 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400975 frameworks += [ "Foundation.framework" ]
Jim Van Vertha8d38072021-11-04 09:22:22 -0400976 if (is_ios) {
977 frameworks += [ "UIKit.framework" ]
978 }
Jim Van Verth36b86af2020-08-24 17:16:46 +0000979 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400980 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500981
Kevin Lubickf4def342018-10-04 12:52:50 -0400982 if (is_debug) {
983 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
984 }
mtklein06c35c02016-09-20 12:28:12 -0700985}
986
Leon Scroggins III41169202019-01-29 09:29:57 -0500987optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500988 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500989 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
990 if ("True" ==
991 exec_script("gn/checkpath.py",
992 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
993 "trim string")) {
994 public_defines = [ "SK_USE_LIBGIFCODEC" ]
995 public_include_dirs = [
996 ".",
997 skia_libgifcodec_path,
998 ]
999 include_dirs = public_include_dirs
1000 import(_libgifcodec_gni_path)
1001 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1002 ".",
1003 skia_libgifcodec_path)
1004 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001005}
1006
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001007optional("heif") {
1008 enabled = skia_use_libheif
1009 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1010
1011 deps = []
1012
Mike Kleina01c6b02020-04-01 13:47:34 -05001013 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001014}
1015
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001016optional("jpeg_decode") {
1017 enabled = skia_use_libjpeg_turbo_decode
1018 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1019
Mike Kleina01c6b02020-04-01 13:47:34 -05001020 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001021 sources = [
1022 "src/codec/SkJpegCodec.cpp",
1023 "src/codec/SkJpegDecoderMgr.cpp",
1024 "src/codec/SkJpegUtility.cpp",
1025 ]
1026}
1027
1028optional("jpeg_encode") {
1029 enabled = skia_use_libjpeg_turbo_encode
1030 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001031
Mike Kleina01c6b02020-04-01 13:47:34 -05001032 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1033 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001034 sources = [
mtklein63213812016-08-24 09:55:56 -07001035 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001036 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001037 ]
1038}
1039
Leon Scroggins III326b9892020-08-05 16:51:10 -04001040optional("ndk_images") {
1041 enabled = skia_use_ndk_images
1042 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1043 sources = [
1044 "src/ports/SkImageEncoder_NDK.cpp",
1045 "src/ports/SkImageGeneratorNDK.cpp",
1046 "src/ports/SkNDKConversions.cpp",
1047 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001048 libs = [ "jnigraphics" ]
1049}
1050
Robert Phillips755e00e2021-09-21 11:59:57 -04001051optional("graphite") {
Jim Van Verthff733b32021-09-24 16:46:36 -04001052 libs = []
1053 frameworks = []
1054
Robert Phillips755e00e2021-09-21 11:59:57 -04001055 enabled = skia_enable_graphite
Greg Daniel292bbb12021-11-03 16:25:41 -04001056 deps = [ ":gpu_shared" ]
Robert Phillips755e00e2021-09-21 11:59:57 -04001057 public_defines = [ "SK_GRAPHITE_ENABLED" ]
1058 public = skia_graphite_public
Greg Danielf0b283e2021-11-04 08:37:59 -04001059 sources = skia_graphite_sources
Jim Van Verthff733b32021-09-24 16:46:36 -04001060 if (skia_use_metal) {
1061 public_defines += [ "SK_METAL" ]
1062 sources += skia_graphite_mtl_sources
1063 if (skia_enable_metal_debug_info) {
1064 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
1065 }
1066 frameworks += [ "Metal.framework" ]
1067 frameworks += [ "Foundation.framework" ]
1068 }
Robert Phillips1a4080a2021-09-21 09:57:43 -04001069}
1070
mtklein63213812016-08-24 09:55:56 -07001071optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001072 enabled = skia_use_zlib && skia_enable_pdf
1073 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001074
Mike Kleina01c6b02020-04-01 13:47:34 -05001075 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001076 if (skia_use_libjpeg_turbo_decode) {
1077 deps += [ ":jpeg_decode" ]
1078 }
1079 if (skia_use_libjpeg_turbo_encode) {
1080 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001081 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001082 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001083 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001084 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001085 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1086 deps += [ "//third_party/harfbuzz" ]
1087 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1088 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001089 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001090 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001091 }
1092}
1093
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001094optional("xps") {
1095 enabled = skia_use_xps && is_win
1096 public_defines = [ "SK_SUPPORT_XPS" ]
1097 public = skia_xps_public
1098 sources = skia_xps_sources
1099}
1100
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001101optional("png_decode") {
1102 enabled = skia_use_libpng_decode
1103 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001104
Mike Kleina01c6b02020-04-01 13:47:34 -05001105 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001106 sources = [
1107 "src/codec/SkIcoCodec.cpp",
1108 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001109 ]
1110}
1111
1112optional("png_encode") {
1113 enabled = skia_use_libpng_encode
1114 public_defines = [ "SK_ENCODE_PNG" ]
1115
Mike Kleina01c6b02020-04-01 13:47:34 -05001116 deps = [ "//third_party/libpng" ]
1117 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001118}
1119
scroggof84ad642016-10-31 09:02:57 -07001120optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001121 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001122 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1123
1124 deps = [
1125 "//third_party/dng_sdk",
1126 "//third_party/libjpeg-turbo:libjpeg",
1127 "//third_party/piex",
1128 ]
1129
1130 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1131 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001132 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001133
Mike Kleina01c6b02020-04-01 13:47:34 -05001134 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001135}
1136
Mike Klein852a8cb2018-05-15 10:46:58 -04001137import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001138skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001139 cflags = []
1140 if (!is_win || is_clang) {
1141 cflags += [
1142 "-w",
1143 "-std=c11",
1144 ]
1145 }
1146
Mike Kleina01c6b02020-04-01 13:47:34 -05001147 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001148 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001149 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1150}
1151
mtklein3cc22182016-08-29 13:26:14 -07001152optional("typeface_freetype") {
1153 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001154
Mike Kleina01c6b02020-04-01 13:47:34 -05001155 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001156 sources = [
1157 "src/ports/SkFontHost_FreeType.cpp",
1158 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001159 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001160 ]
1161}
1162
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001163optional("webp_decode") {
1164 enabled = skia_use_libwebp_decode
1165 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001166
Mike Kleina01c6b02020-04-01 13:47:34 -05001167 deps = [ "//third_party/libwebp" ]
1168 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001169}
1170
1171optional("webp_encode") {
1172 enabled = skia_use_libwebp_encode
1173 public_defines = [ "SK_ENCODE_WEBP" ]
1174
Mike Kleina01c6b02020-04-01 13:47:34 -05001175 deps = [ "//third_party/libwebp" ]
1176 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001177}
1178
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001179optional("wuffs") {
1180 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001181 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001182
Mike Kleina01c6b02020-04-01 13:47:34 -05001183 deps = [ "//third_party/wuffs" ]
1184 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001185}
1186
mtklein63213812016-08-24 09:55:56 -07001187optional("xml") {
1188 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001189 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001190
Mike Kleina01c6b02020-04-01 13:47:34 -05001191 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001192 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001193 "src/svg/SkSVGCanvas.cpp",
1194 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001195 "src/xml/SkDOM.cpp",
1196 "src/xml/SkXMLParser.cpp",
1197 "src/xml/SkXMLWriter.cpp",
1198 ]
1199}
1200
Mike Klein613ad382019-06-06 11:42:02 -05001201optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001202 enabled = skia_enable_skvm_jit_when_possible
1203 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001204 if (skia_vtune_path != "") {
1205 public_defines += [ "SKVM_JIT_VTUNE" ]
1206 public_include_dirs = [ "$skia_vtune_path/include" ]
1207 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1208 }
Mike Klein613ad382019-06-06 11:42:02 -05001209}
1210
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001211if (skia_enable_gpu && skia_generate_workarounds) {
1212 action("workaround_list") {
1213 script = "tools/build_workaround_header.py"
1214
Mike Kleina01c6b02020-04-01 13:47:34 -05001215 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001216
Brian Osmaned5181e2021-07-01 13:54:20 -04001217 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1218 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001219 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001220 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001221
Mike Kleina01c6b02020-04-01 13:47:34 -05001222 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001223 args = [
1224 "--output-file",
1225 "$output_file",
1226 ]
1227
1228 foreach(file, inputs) {
1229 args += [ rebase_path(file, root_build_dir) ]
1230 }
1231 }
1232}
1233
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001234skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001235 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001236 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001237
Mike Klein607b0a72018-11-07 16:17:34 -05001238 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001239 ":fontmgr_FontConfigInterface",
1240 ":fontmgr_android",
1241 ":fontmgr_custom_directory",
1242 ":fontmgr_custom_embedded",
1243 ":fontmgr_custom_empty",
1244 ":fontmgr_fontconfig",
1245 ":fontmgr_fuchsia",
1246 ":fontmgr_mac_ct",
1247 ":fontmgr_win",
1248 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001249 ":gpu",
Robert Phillips755e00e2021-09-21 11:59:57 -04001250 ":graphite",
Mike Klein607b0a72018-11-07 16:17:34 -05001251 ":pdf",
1252 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001253 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001254 ]
1255
mtkleinc04ff472016-06-23 10:29:30 -07001256 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001257 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001258 ":arm64",
1259 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001260 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001261 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001262 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001263 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001264 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001265 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001266 ":jpeg_decode",
1267 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001268 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001269 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001270 ":png_decode",
1271 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001272 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001273 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001274 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001275 ":sse2",
1276 ":sse41",
1277 ":sse42",
1278 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001279 ":webp_decode",
1280 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001281 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001282 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001283 ]
1284
Hal Canaryc25f4e92019-02-26 11:54:25 -05001285 public = skia_core_public
1286 public += skia_utils_public
1287 public += skia_effects_public
1288 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001289
mtkleinc04ff472016-06-23 10:29:30 -07001290 sources = []
brettwb9447282016-09-01 14:24:39 -07001291 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001292 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001293 sources += skia_effects_sources
1294 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001295 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001296 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001297 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001298 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001299 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001300 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001301 "src/codec/SkBmpCodec.cpp",
1302 "src/codec/SkBmpMaskCodec.cpp",
1303 "src/codec/SkBmpRLECodec.cpp",
1304 "src/codec/SkBmpStandardCodec.cpp",
1305 "src/codec/SkCodec.cpp",
1306 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001307 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001308 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001309 "src/codec/SkMaskSwizzler.cpp",
1310 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001311 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001312 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001313 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001314 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001315 "src/codec/SkSwizzler.cpp",
1316 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001317 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001318 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001319 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001320 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001321 "src/ports/SkMemory_malloc.cpp",
1322 "src/ports/SkOSFile_stdio.cpp",
1323 "src/sfnt/SkOTTable_name.cpp",
1324 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001325 ]
brettwb9447282016-09-01 14:24:39 -07001326
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001327 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001328 libs = []
1329
Brian Osman946a4cb2021-07-12 17:02:21 -04001330 if (skia_enable_sksl) {
1331 deps += [ ":dehydrate_sksl" ]
1332 sources += skia_sksl_sources
1333 }
1334
mtkleinc04ff472016-06-23 10:29:30 -07001335 if (is_win) {
1336 sources += [
1337 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001338 "src/ports/SkImageEncoder_WIC.cpp",
1339 "src/ports/SkImageGeneratorWIC.cpp",
1340 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001341 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001342 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001343 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001344 "Ole32.lib",
1345 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001346 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001347
1348 if (!skia_enable_winuwp) {
1349 libs += [
1350 "FontSub.lib",
1351 "User32.lib",
1352 "Usp10.lib",
1353 ]
1354 }
mtkleinc04ff472016-06-23 10:29:30 -07001355 } else {
1356 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001357 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001358 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001359 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001360 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001361 }
1362
mtklein7d6fb2c2016-08-25 14:50:44 -07001363 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001364 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001365 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001366 deps += [ "//third_party/cpu-features" ]
1367 }
mtklein06c35c02016-09-20 12:28:12 -07001368 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001369 libs += [
1370 "EGL",
1371 "GLESv2",
1372 "log",
1373 ]
1374 }
1375
Kevin Lubick217056c2018-09-20 17:39:31 -04001376 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001377 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001378 if (skia_use_egl) {
1379 libs += [ "GLESv2" ]
1380 }
mtkleinc04ff472016-06-23 10:29:30 -07001381 }
1382
1383 if (is_mac) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001384 public += [ "include/ports/SkCFObject.h" ]
mtkleinc04ff472016-06-23 10:29:30 -07001385 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001386 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001387 "src/ports/SkImageEncoder_CG.cpp",
1388 "src/ports/SkImageGeneratorCG.cpp",
1389 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001390 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001391 "ApplicationServices.framework",
1392 "OpenGL.framework",
1393 ]
mtkleinc04ff472016-06-23 10:29:30 -07001394 }
abarth6fc8ff02016-07-15 15:15:15 -07001395
Mike Klein7d302882016-11-03 14:06:31 -04001396 if (is_ios) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001397 public += [ "include/ports/SkCFObject.h" ]
Mike Klein7d302882016-11-03 14:06:31 -04001398 sources += [
1399 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001400 "src/ports/SkImageEncoder_CG.cpp",
1401 "src/ports/SkImageGeneratorCG.cpp",
1402 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001403 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001404 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001405 "ImageIO.framework",
1406 "MobileCoreServices.framework",
1407 ]
1408 }
1409
abarth6fc8ff02016-07-15 15:15:15 -07001410 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001411 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001412 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001413
1414 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001415 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001416 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1417 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001418
1419 if (skia_include_multiframe_procs) {
1420 sources += [ "tools/SkSharingProc.cpp" ]
1421 }
mtkleinc04ff472016-06-23 10:29:30 -07001422}
1423
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001424# DebugCanvas used in experimental/wasm-skp-debugger
1425if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001426 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001427 public_configs = [ ":skia_public" ]
1428
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001429 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001430 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001431 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001432 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001433 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001434 "tools/debugger/DrawCommand.cpp",
1435 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001436 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001437 }
1438}
1439
Ben Wagner25eb5342021-03-22 14:07:15 -04001440skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001441 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001442 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001443 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001444
1445 deps = [
1446 ":arm64",
1447 ":armv7",
1448 ":avx",
1449 ":crc32",
1450 ":hsw",
1451 ":none",
1452 ":sse2",
1453 ":sse41",
1454 ":sse42",
1455 ":ssse3",
1456 ]
1457
Kevin Lubickcbcff382018-10-02 09:02:18 -04001458 sources = []
1459 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001460 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001461 sources += [
1462 "src/core/SkAnalyticEdge.cpp",
1463 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001464 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001465 "src/core/SkCubicMap.cpp",
1466 "src/core/SkEdge.cpp",
1467 "src/core/SkEdgeBuilder.cpp",
1468 "src/core/SkEdgeClipper.cpp",
1469 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001470 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001471 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001472 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001473 "src/core/SkMallocPixelRef.cpp",
1474 "src/core/SkMath.cpp",
1475 "src/core/SkMatrix.cpp",
1476 "src/core/SkOpts.cpp",
1477 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001478 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001479 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001480 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001481 "src/core/SkPathEffect.cpp",
1482 "src/core/SkPathMeasure.cpp",
1483 "src/core/SkPathRef.cpp",
1484 "src/core/SkPoint.cpp",
1485 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001486 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001487 "src/core/SkRect.cpp",
1488 "src/core/SkSemaphore.cpp",
1489 "src/core/SkStream.cpp",
1490 "src/core/SkString.cpp",
1491 "src/core/SkStringUtils.cpp",
1492 "src/core/SkStroke.cpp",
1493 "src/core/SkStrokeRec.cpp",
1494 "src/core/SkStrokerPriv.cpp",
1495 "src/core/SkThreadID.cpp",
1496 "src/core/SkUtils.cpp",
1497 "src/effects/SkDashPathEffect.cpp",
1498 "src/effects/SkTrimPathEffect.cpp",
1499 "src/ports/SkDebug_stdio.cpp",
1500 "src/ports/SkMemory_malloc.cpp",
1501 "src/utils/SkDashPath.cpp",
1502 "src/utils/SkParse.cpp",
1503 "src/utils/SkParsePath.cpp",
1504 "src/utils/SkUTF.cpp",
1505 ]
1506}
1507
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001508group("modules") {
1509 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001510 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001511 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001512 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001513 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001514 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001515 ]
1516}
1517
Julia Lavrova9f6e4632021-09-17 15:19:02 -04001518group("experimental") {
1519 deps = [ "experimental/sktext" ]
1520}
1521
Brian Osmancd28fa62020-07-07 16:01:26 -04001522config("our_vulkan_headers") {
1523 include_dirs = [ "include/third_party/vulkan" ]
1524}
1525
mtkleinc095df52016-08-24 12:23:52 -07001526# Targets guarded by skia_enable_tools may use //third_party freely.
1527if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001528 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001529 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001530 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001531 "include/c",
1532 "include/codec",
1533 "include/config",
1534 "include/core",
1535 "include/docs",
1536 "include/effects",
1537 "include/encode",
1538 "include/gpu",
1539 "include/pathops",
1540 "include/ports",
1541 "include/svg",
1542 "include/utils",
1543 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001544 "modules/particles/include",
1545 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001546 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001547 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001548 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001549 ]
1550
Mike Klein308b5ac2016-12-06 16:03:52 -05001551 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001552 skia_source_set("public") {
1553 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001554 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001555 }
1556
Mike Kleinc36dedf2016-11-18 09:35:28 -05001557 config("skia.h_config") {
1558 include_dirs = [ "$target_gen_dir" ]
1559 }
1560 action("skia.h") {
1561 public_configs = [ ":skia.h_config" ]
1562 skia_h = "$target_gen_dir/skia.h"
1563 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001564
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001565 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1566 [ rebase_path(skia_h, root_build_dir) ] +
1567 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001568 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001569 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001570 }
1571
Brian Osmanc9a42472018-05-31 13:17:12 -04001572 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001573 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001574 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001575 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001576 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001577 "tools/fiddle/draw.cpp",
1578 "tools/fiddle/fiddle_main.cpp",
1579 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001580
1581 if (skia_use_egl) {
1582 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001583 } else {
1584 sources += [ "tools/fiddle/null_context.cpp" ]
1585 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001586 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001587 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001588 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001589 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001590 ":skia",
1591 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001592 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001593 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001594 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001595 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001596 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001597 ]
1598 }
1599 }
1600
Mike Kleine5463e62020-06-11 13:53:53 -05001601 config("cpp14") {
1602 if (is_win) {
1603 cflags_cc = [ "/std:c++14" ]
1604 } else {
1605 cflags_cc = [ "-std=c++14" ]
1606 }
1607 }
1608
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001609 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001610 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001611 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001612 ":our_vulkan_headers",
1613 ":cpp14",
1614 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001615 if (defined(skia_header_target_default_configs)) {
1616 configs += skia_header_target_default_configs
1617 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001618 deps = [
1619 ":skia",
1620 ":skia.h",
1621 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001622 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001623 ]
Stephen White0d70b712019-07-10 15:51:30 -04001624
1625 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001626 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001627 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001628 }
1629
mtkleinc095df52016-08-24 12:23:52 -07001630 template("test_lib") {
1631 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001632 if (defined(invoker.public_defines)) {
1633 defines = invoker.public_defines
1634 }
mtklein25c81d42016-07-27 13:55:26 -07001635 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001636 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001637 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001638 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001639 public_configs = [
1640 ":" + target_name + "_config",
1641 ":skia_private",
1642 ]
1643
1644 if (!defined(deps)) {
1645 deps = []
1646 }
1647 deps += [ ":skia" ]
1648 testonly = true
1649 }
mtklein25c81d42016-07-27 13:55:26 -07001650 }
mtklein25c81d42016-07-27 13:55:26 -07001651
Mike Kleine6682eb2017-01-05 10:54:57 -05001652 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001653 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001654 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001655 forward_variables_from(invoker,
1656 "*",
1657 [
1658 "output_name",
1659 "visibility",
1660 "is_shared_library",
1661 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001662 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001663 extra_configs = [ ":skia_private" ]
1664 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1665 data_sources = [ "resources" ]
1666 if ("True" == exec_script("//gn/checkdir.py",
1667 [ rebase_path("skps", root_build_dir) ],
1668 "trim string")) {
1669 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001670 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001671 if ("True" == exec_script("//gn/checkdir.py",
1672 [ rebase_path("mskps", root_build_dir) ],
1673 "trim string")) {
1674 data_sources += [ "mskps" ]
1675 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001676 }
1677 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001678 # !is_ios
1679
1680 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001681 skia_shared_library("lib" + target_name) {
1682 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001683 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001684 if (!defined(configs)) {
1685 configs = []
1686 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001687 configs += [ ":skia_private" ]
1688 testonly = true
1689 }
1690 } else {
1691 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001692 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001693 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001694 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001695 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001696 if (!defined(configs)) {
1697 configs = []
1698 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001699 configs += [ ":skia_private" ]
1700 testonly = true
1701 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001702 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001703 if (is_android && skia_android_serial != "" && defined(_executable)) {
1704 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001705 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001706 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001707 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001708 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001709 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001710 args = [
1711 rebase_path("$root_build_dir/$_executable"),
1712 skia_android_serial,
1713 rebase_path(_stamp),
1714 ]
1715 testonly = true
1716 }
Mike Klein7d921032017-01-05 12:20:41 -05001717 }
1718 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001719 }
1720
mtkleinc095df52016-08-24 12:23:52 -07001721 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001722 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001723
Mike Klein9e25bb92019-04-29 09:46:36 -05001724 # Bots and even devs may not have Vulkan headers, so put
1725 # include/third_party/vulkan on our path so they're always available.
1726 all_dependent_configs = [ ":our_vulkan_headers" ]
1727
Mike Klein333fb452019-04-24 08:48:11 -05001728 defines = []
1729 if (skia_enable_discrete_gpu) {
1730 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1731 }
1732
Brian Osmanc9a42472018-05-31 13:17:12 -04001733 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001734 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001735 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001736 "tools/gpu/BackendSurfaceFactory.cpp",
1737 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001738 "tools/gpu/BackendTextureImageFactory.cpp",
1739 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001740 "tools/gpu/FlushFinishTracker.cpp",
1741 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001742 "tools/gpu/GrContextFactory.cpp",
1743 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001744 "tools/gpu/ManagedBackendTexture.cpp",
1745 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001746 "tools/gpu/MemoryCache.cpp",
1747 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001748 "tools/gpu/ProxyUtils.cpp",
1749 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001750 "tools/gpu/TestOps.cpp",
1751 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001752 "tools/gpu/YUVUtils.cpp",
1753 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001754 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1755 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001756 "tools/gpu/mock/MockTestContext.cpp",
1757 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001758
1759 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001760 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001761
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001762 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001763 sources +=
1764 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001765 if (is_ios) {
1766 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001767 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001768 } else if (is_mac) {
1769 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001770 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001771 if (skia_use_angle) {
1772 deps += [ "//third_party/angle2" ]
1773 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1774 }
Brian Salomon1171d312020-03-19 08:47:44 -04001775 }
1776
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001777 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1778 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001779 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001780 if (is_android || skia_use_egl) {
1781 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1782 libs += [ "EGL" ]
1783 } else if (is_linux) {
1784 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1785 libs += [
1786 "GLU",
1787 "GL",
1788 "X11",
1789 ]
1790 } else if (is_win) {
1791 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1792 libs += [ "Gdi32.lib" ]
1793 if (target_cpu != "arm64") {
1794 libs += [ "OpenGL32.lib" ]
1795 }
1796 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001797 }
Greg Daniel54200e42018-12-11 17:03:39 -05001798
Brian Osmanc9a42472018-05-31 13:17:12 -04001799 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001800 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001801 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001802 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1803 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001804 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001805 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001806 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1807 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001808 }
1809 if (skia_use_metal) {
1810 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001811 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001812 if (skia_use_direct3d) {
1813 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001814 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001815 }
Stephen White985741a2019-07-18 11:43:45 -04001816 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001817 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001818 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001819 if (is_clang) {
1820 cflags_cc = [ "-Wno-microsoft-cast" ]
1821 }
Stephen White985741a2019-07-18 11:43:45 -04001822 }
Robert Phillips72354b02021-07-06 13:43:56 -04001823 if (!skia_enable_skgpu_v1) {
1824 sources -= [ "tools/gpu/GrTest.cpp" ]
1825 sources -= [ "tools/gpu/TestOps.cpp" ]
1826 sources -= [ "tools/gpu/TestOps.h" ]
1827 }
Robert Phillipsd034db72021-09-29 14:29:32 -04001828 if (skia_enable_graphite) {
Robert Phillips091694f2021-09-30 11:41:16 -04001829 sources += [ "tools/graphite/ContextFactory.h" ]
1830 sources += [ "tools/graphite/ContextFactory.cpp" ]
Robert Phillipsd034db72021-09-29 14:29:32 -04001831 sources += [ "tools/graphite/GraphiteTestContext.h" ]
1832 sources += [ "tools/graphite/GraphiteTestContext.cpp" ]
1833 if (skia_use_metal) {
1834 sources += [ "tools/graphite/mtl/GraphiteMtlTestContext.h" ]
1835 sources += [ "tools/graphite/mtl/MtlTestContext.mm" ]
1836 }
1837 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001838
1839 if (is_fuchsia && using_fuchsia_sdk) {
1840 libs +=
1841 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1842 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001843 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001844
mtkleinc095df52016-08-24 12:23:52 -07001845 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001846 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001847 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001848
1849 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001850 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1851 deps = [ ":flags" ]
1852 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001853 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001854 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001855 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1856 deps = [ ":flags" ]
1857 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001858 }
1859 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001860 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1861 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001862 }
Kevin Lubick237dd2d2021-10-14 08:24:22 -04001863 test_lib("common_flags_fontmgr") {
1864 sources = [ "tools/flags/CommonFlagsFontMgr.cpp" ]
1865 deps = [ ":flags" ]
1866 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001867 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001868 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1869 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001870 }
mtklein25c81d42016-07-27 13:55:26 -07001871
Mike Klein499f0ac2019-03-25 13:00:12 -05001872 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001873 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001874 sources = [
1875 "tools/trace/ChromeTracingTracer.cpp",
1876 "tools/trace/ChromeTracingTracer.h",
1877 "tools/trace/EventTracingPriv.cpp",
1878 "tools/trace/EventTracingPriv.h",
1879 "tools/trace/SkDebugfTracer.cpp",
1880 "tools/trace/SkDebugfTracer.h",
1881 ]
1882 }
1883
mtkleinc095df52016-08-24 12:23:52 -07001884 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001885 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001886 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001887 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001888 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001889 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001890 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001891 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001892 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001893 "tools/MSKPPlayer.cpp",
1894 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001895 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001896 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001897 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001898 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001899 "tools/RuntimeBlendUtils.cpp",
1900 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001901 "tools/SkMetaData.cpp",
1902 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001903 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001904 "tools/SkSharingProc.h",
1905 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001906 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001907 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001908 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001909 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001910 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001911 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001912 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001913 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001914 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001915 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001916 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001917 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001918 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001919 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001920 "tools/fonts/TestEmptyTypeface.h",
1921 "tools/fonts/TestFontMgr.cpp",
1922 "tools/fonts/TestFontMgr.h",
1923 "tools/fonts/TestSVGTypeface.cpp",
1924 "tools/fonts/TestSVGTypeface.h",
1925 "tools/fonts/TestTypeface.cpp",
1926 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001927 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001928 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001929 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001930 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001931 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001932 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001933 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001934 if (target_cpu != "wasm") {
1935 sources += [ "tools/CrashHandler.cpp" ]
1936 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001937 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001938 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001939 if (is_ios) {
1940 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001941 sources += [ "tools/ios_utils.h" ]
1942 if (skia_use_metal) {
1943 sources += [ "tools/AutoreleasePool.mm" ]
1944 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001945 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001946 } else if (is_mac) {
1947 if (skia_use_metal) {
1948 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001949 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001950 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001951 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001952 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001953 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001954
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001955 defines = []
1956 if (skia_tools_require_resources) {
1957 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1958 }
mtkleinc095df52016-08-24 12:23:52 -07001959 deps = [
1960 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001961 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001962 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001963 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001964 }
mtklein25c81d42016-07-27 13:55:26 -07001965
Mike Kleine11e5c12019-04-24 12:46:06 -05001966 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001967 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001968 }
1969
Mike Klein6e744122016-10-27 12:21:40 -04001970 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001971 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001972 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001973 if (skia_use_gl) {
1974 sources += gl_gm_sources
1975 }
Robert Phillips024668c2021-07-01 12:12:52 -04001976 if (!skia_enable_skgpu_v1) {
1977 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04001978 }
mtkleinc095df52016-08-24 12:23:52 -07001979 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001980 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001981 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001982 ":skia",
1983 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001984 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001985 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001986 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001987 "modules/skparagraph",
1988 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001989 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001990 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001991 if (is_skia_dev_build) {
1992 sources += [ "gm/fiddle.cpp" ]
1993 deps += [ ":skia.h" ]
1994 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001995 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001996
1997 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001998 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001999 sources += [ "gm/video_decoder.cpp" ]
2000 }
mtkleinc095df52016-08-24 12:23:52 -07002001 }
mtklein25c81d42016-07-27 13:55:26 -07002002
Ben Wagnerbded42a2021-02-17 22:14:34 -05002003 test_lib("test") {
2004 sources = [
2005 "tests/Test.cpp",
2006 "tests/Test.h",
2007 "tests/TestUtils.cpp",
2008 "tests/TestUtils.h",
2009 ]
2010 deps = [
2011 ":flags",
2012 ":skia",
2013 ":tool_utils",
2014 ]
2015 public_deps = [
2016 ":gpu_tool_utils", # Test.h #includes headers from this target.
2017 ]
2018 }
2019
Mike Klein6e744122016-10-27 12:21:40 -04002020 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002021 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002022 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002023 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002024 if (skia_use_metal) {
2025 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002026 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002027 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002028 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002029 if (skia_use_gl) {
2030 sources += gl_tests_sources
2031 }
Robert Phillips30627592021-10-11 11:28:21 -04002032 if (skia_enable_graphite) {
2033 sources += graphite_tests_sources
2034 }
Robert Phillips024668c2021-07-01 12:12:52 -04002035 if (!skia_enable_skgpu_v1) {
2036 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04002037 }
mtkleinc095df52016-08-24 12:23:52 -07002038 deps = [
2039 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002040 ":fontmgr_android_tests",
2041 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002042 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002043 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002044 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002045 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002046 "experimental/skrive:tests",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002047 "experimental/sktext:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002048 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002049 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002050 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002051 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002052 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002053 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002054 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002055 "//third_party/zlib",
2056 ]
2057 }
mtklein2f3416d2016-08-02 16:02:05 -07002058
Mike Klein6e744122016-10-27 12:21:40 -04002059 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002060 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002061 sources = bench_sources
Chris Dalton2fceb212021-10-19 13:04:41 -06002062 if (skia_enable_graphite) {
2063 sources += graphite_bench_sources
2064 }
Robert Phillips04f22ea2021-07-22 15:11:03 -04002065 if (!skia_enable_skgpu_v1) {
2066 sources -= skgpu_v1_bench_sources
2067 }
mtkleinc095df52016-08-24 12:23:52 -07002068 deps = [
2069 ":flags",
2070 ":gm",
2071 ":gpu_tool_utils",
2072 ":skia",
2073 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002074 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002075 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002076 ]
2077 }
mtklein2b6870c2016-07-28 14:17:33 -07002078
Mike Reedd62d4062019-06-12 10:20:44 -04002079 test_lib("experimental_xform") {
2080 sources = [
2081 "experimental/xform/SkShape.cpp",
2082 "experimental/xform/SkXform.cpp",
2083 "experimental/xform/XContext.cpp",
2084 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002085 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002086 }
2087
Florin Malitabfe876a2018-09-02 12:33:59 -04002088 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002089 if (skia_enable_skottie) {
2090 test_app("skottie_tool") {
2091 deps = [ "modules/skottie:tool" ]
2092 }
Florin Malita79725d32018-06-05 16:16:57 -04002093 }
Florin Malitab3418102020-10-15 18:10:29 -04002094 test_app("svg_tool") {
2095 deps = [ "modules/svg:tool" ]
2096 }
Florin Malita79725d32018-06-05 16:16:57 -04002097 }
2098
Hal Canary5b39dc82019-04-17 13:29:46 -04002099 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002100 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2101 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002102 }
2103
Chris Dalton2b598902020-03-25 10:50:35 -06002104 import("gn/samples.gni")
2105 test_lib("samples") {
2106 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002107 if (!skia_enable_skgpu_v1) {
2108 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002109 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002110 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002111 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002112 ":flags",
2113 ":gpu_tool_utils",
2114 ":xml",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002115 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002116 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002117 "modules/skparagraph:samples",
2118 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002119 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002120 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002121 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002122 }
Kevin Lubick00398742020-10-08 10:05:07 -04002123 test_lib("hash_and_encode") {
2124 sources = [
2125 "tools/HashAndEncode.cpp",
2126 "tools/HashAndEncode.h",
2127 ]
2128 deps = [
2129 ":flags",
2130 ":skia",
2131 "//third_party/libpng",
2132 ]
2133 }
Chris Dalton2b598902020-03-25 10:50:35 -06002134 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002135 test_app("convert-to-nia") {
2136 sources = [ "tools/convert-to-nia.cpp" ]
2137 deps = [ ":skia" ]
2138 }
Mike Klein7af351a2018-07-27 09:54:43 -04002139 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002140 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002141 deps = [
2142 ":skcms",
2143 ":skia",
2144 ]
2145 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002146 test_app("fm") {
2147 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002148 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002149 "tools/fm/fm.cpp",
2150 ]
2151 deps = [
2152 ":common_flags_aa",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002153 ":common_flags_fontmgr",
Mike Klein735c7ba2019-03-25 12:57:58 -05002154 ":common_flags_gpu",
2155 ":flags",
2156 ":gm",
2157 ":gpu_tool_utils",
2158 ":hash_and_encode",
2159 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002160 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002161 ":tool_utils",
2162 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002163 "modules/skottie",
2164 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002165 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002166 ]
2167 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002168 test_app("dm") {
2169 sources = [
2170 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002171 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002172 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002173 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002174 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002175 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002176 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002177 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002178 ":common_flags_aa",
2179 ":common_flags_config",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002180 ":common_flags_fontmgr",
Mike Kleinc6142d82019-03-25 10:54:59 -05002181 ":common_flags_gpu",
2182 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002183 ":flags",
2184 ":gm",
2185 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002186 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002187 ":skia",
2188 ":tests",
2189 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002190 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002191 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002192 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002193 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002194 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002195 ]
2196 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002197 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002198 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002199 "experimental/sorttoy/Cmds.cpp",
2200 "experimental/sorttoy/Cmds.h",
2201 "experimental/sorttoy/Fake.cpp",
2202 "experimental/sorttoy/Fake.h",
2203 "experimental/sorttoy/SortKey.h",
2204 "experimental/sorttoy/sorttoy.cpp",
2205 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002206 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002207 deps = [
2208 ":flags",
2209 ":skia",
2210 ":tool_utils",
2211 ]
2212 }
Michael Ludwig30217952020-12-04 12:58:35 -05002213
2214 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002215 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002216 sources = [
2217 "tests/CanvasStateHelpers.cpp",
2218 "tests/CanvasStateHelpers.h",
2219 ]
2220 deps = [ ":skia" ]
2221 }
Brian Osman16adfa32016-10-18 14:42:44 -04002222 }
2223
Mike Kleina8a51ce2018-01-09 12:34:11 -05002224 if (!is_win) {
2225 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002226 sources = [ "tools/remote_demo.cpp" ]
2227 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002228 }
2229 }
2230
Hal Canarye107faa2019-10-23 12:52:33 -04002231 if (!is_win) {
2232 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002233 sources = [ "tools/blob_cache_sim.cpp" ]
2234 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002235 }
2236 }
2237
Mike Kleine6682eb2017-01-05 10:54:57 -05002238 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002239 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002240 deps = [
2241 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002242 ":common_flags_aa",
2243 ":common_flags_config",
2244 ":common_flags_gpu",
2245 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002246 ":flags",
2247 ":gm",
2248 ":gpu_tool_utils",
2249 ":skia",
2250 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002251 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002252 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002253 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002254 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002255 ]
mtklein2b6870c2016-07-28 14:17:33 -07002256 }
halcanary19a97202016-08-03 15:08:04 -07002257
Ravi Mistry10d36c52017-01-31 09:49:18 -05002258 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002259 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002260 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002261 deps = [
2262 ":flags",
2263 ":skia",
2264 ]
2265 }
2266
Mike Reedc0ee21f2019-05-28 16:11:03 -04002267 if (skia_use_ffmpeg) {
2268 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002269 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002270 deps = [
2271 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002272 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002273 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002274 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002275 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002276 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002277 ]
2278 }
2279 }
2280
Brian Osmanc9a42472018-05-31 13:17:12 -04002281 test_app("skpbench") {
Kevin Lubickf541ddf2021-10-13 16:02:56 -04002282 sources = [
2283 "bench/BigPath.cpp",
2284 "tools/skpbench/skpbench.cpp",
2285 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002286 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002287 ":common_flags_config",
2288 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002289 ":flags",
2290 ":gpu_tool_utils",
2291 ":skia",
2292 ":tool_utils",
2293 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002294 }
2295
Mike Kleine6682eb2017-01-05 10:54:57 -05002296 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002297 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002298 deps = [
2299 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002300 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002301 ]
halcanary3eee9d92016-09-10 07:01:53 -07002302 }
mtklein046cb562016-09-16 10:23:12 -07002303
Ben Wagner219f3622017-07-17 15:32:25 -04002304 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002305 sources = [ "tools/fonts/create_test_font.cpp" ]
2306 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002307 assert_no_deps = [
2308 # tool_utils requires the output of this app.
2309 ":tool_utils",
2310 ]
2311 }
2312
Florin Malita5d3ff432018-07-31 16:38:43 -04002313 if (skia_use_expat) {
2314 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002315 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002316 deps = [
2317 ":flags",
2318 ":skia",
2319 ":tool_utils",
2320 ]
2321 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002322 }
2323
Mike Kleine6682eb2017-01-05 10:54:57 -05002324 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002325 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002326 deps = [
2327 ":flags",
2328 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002329 ]
mtklein046cb562016-09-16 10:23:12 -07002330 }
mtkleinecbc5262016-09-22 11:51:24 -07002331
Brian Osman6788a542018-12-10 11:56:01 -05002332 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002333 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002334 sources = [
2335 "tools/skiaserve/Request.cpp",
2336 "tools/skiaserve/Response.cpp",
2337 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002338 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2339 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2340 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2341 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2342 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2343 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2344 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2345 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2346 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002347 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2348 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002349 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2350 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2351 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2352 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2353 ]
2354 deps = [
2355 ":flags",
2356 ":gpu_tool_utils",
2357 ":skia",
2358 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002359 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002360 ]
Mike Klein7d302882016-11-03 14:06:31 -04002361 }
mtkleinecbc5262016-09-22 11:51:24 -07002362 }
kjlubick14f984b2016-10-03 11:49:45 -07002363
Mike Kleine6682eb2017-01-05 10:54:57 -05002364 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002365 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002366 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002367 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002368 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002369 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002370 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002371 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002372 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002373 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002374 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002375 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002376 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002377 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002378 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002379 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002380 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002381 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002382 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002383 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002384 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002385 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2386 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002387 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002388 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002389 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002390 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002391 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2392 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002393 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002394 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2395 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002396 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002397 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002398 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002399 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002400 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002401 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002402 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002403 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002404 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002405 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002406 "tools/debugger/DrawCommand.cpp",
2407 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002408 ]
2409 deps = [
2410 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002411 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002412 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002413 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002414 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002415 ]
kjlubick14f984b2016-10-03 11:49:45 -07002416 }
Mike Klein38312422016-10-05 15:41:01 -04002417
Mike Kleine6682eb2017-01-05 10:54:57 -05002418 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002419 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002420 rebase_path("tests/skia_test.cpp"),
2421 rebase_path("tests/Test.cpp"),
2422 ]
caryclark9feb6322016-10-25 08:58:26 -07002423 deps = [
2424 ":flags",
2425 ":gpu_tool_utils",
2426 ":skia",
2427 ":tool_utils",
2428 ]
caryclark9feb6322016-10-25 08:58:26 -07002429 }
2430
Mike Kleine6682eb2017-01-05 10:54:57 -05002431 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002432 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002433 deps = [
2434 ":flags",
2435 ":skia",
2436 ]
Mike Klein38312422016-10-05 15:41:01 -04002437 }
bungemanfe917272016-10-13 17:36:40 -04002438
Mike Kleine6682eb2017-01-05 10:54:57 -05002439 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002440 sources = [
2441 "tools/skdiff/skdiff.cpp",
2442 "tools/skdiff/skdiff_html.cpp",
2443 "tools/skdiff/skdiff_main.cpp",
2444 "tools/skdiff/skdiff_utils.cpp",
2445 ]
2446 deps = [
2447 ":skia",
2448 ":tool_utils",
2449 ]
bungemanfe917272016-10-13 17:36:40 -04002450 }
halcanarya73d76a2016-10-17 13:19:02 -07002451
Mike Kleine6682eb2017-01-05 10:54:57 -05002452 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002453 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002454 deps = [
2455 ":skia",
2456 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002457 ]
halcanarya73d76a2016-10-17 13:19:02 -07002458 }
Brian Osman16adfa32016-10-18 14:42:44 -04002459
Brian Osmanc9a42472018-05-31 13:17:12 -04002460 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002461 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002462 check_includes = false
2463 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002464 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002465 defines =
2466 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002467 sources = [
2468 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002469 "tools/skqp/src/skqp.cpp",
2470 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002471 ]
2472 deps = [
2473 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002474 ":skia",
2475 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002476 ":tool_utils",
2477 ]
2478 }
2479 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002480 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002481 include_dirs = [ "//" ]
2482 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002483 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002484 }
2485 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002486 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002487 deps = [
2488 ":gm",
2489 ":skia",
2490 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002491 ]
2492 }
2493 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002494 if (is_fuchsia) {
2495 # Build a package repository for skqp on Fuchsia.
2496 group("skqp_repo") {
2497 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002498 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002499 }
2500 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002501 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002502 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002503 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002504 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002505 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002506 deps = [
2507 ":skia",
2508 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002509 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002510 ]
2511 libs = [ "android" ]
2512 }
2513 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002514 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002515 test_app("skottie_android") {
2516 is_shared_library = true
2517
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002518 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002519 libs = []
2520
Stan Iliev93151722018-08-02 11:10:52 -04002521 deps = [
2522 ":skia",
2523 "modules/skottie",
2524 ]
2525 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002526
2527 test_app("androidkit") {
2528 is_shared_library = true
2529
Florin Malita2a650cc2021-04-12 13:38:44 -04002530 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002531 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002532 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002533 "modules/androidkit/src/ColorFilters.cpp",
Jorge Betancourt151a6f32021-09-07 16:50:21 -04002534 "modules/androidkit/src/Font.cpp",
Jorge Betancourtaa9656d2021-10-14 14:02:08 -04002535 "modules/androidkit/src/FontChainAdapter.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002536 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002537 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002538 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002539 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002540 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002541 "modules/androidkit/src/Path.cpp",
2542 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002543 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2544 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002545 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002546 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002547 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002548 "modules/androidkit/src/SurfaceThread.cpp",
2549 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002550 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002551 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002552 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002553 libs = [
2554 "android",
2555 "jnigraphics",
2556 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002557
Florin Malita2cc65382021-04-26 21:59:35 -04002558 deps = [
2559 ":sk_app",
2560 ":skia",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002561 "experimental/sktext:sktext",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002562 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002563 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002564 }
Stan Iliev93151722018-08-02 11:10:52 -04002565 }
Hal Canary75427132017-10-11 16:00:31 -04002566
Hal Canarya9de7602018-01-19 13:08:23 -05002567 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002568 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002569 deps = [
2570 ":gm",
2571 ":skia",
2572 ]
2573 }
2574 test_app("list_gpu_unit_tests") {
2575 sources = [
2576 "dm/DMGpuTestProcs.cpp",
2577 "tools/list_gpu_unit_tests.cpp",
2578 ]
2579 deps = [
2580 ":skia",
2581 ":tests",
2582 ]
2583 }
2584
Brian Osmanc9a42472018-05-31 13:17:12 -04002585 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002586 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002587 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002588 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002589 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002590 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002591 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002592 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002593 "tools/sk_app/CommandSet.h",
2594 "tools/sk_app/DisplayParams.h",
2595 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002596 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002597 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002598 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002599 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002600 ]
2601 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002602 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002603
2604 if (is_android) {
2605 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002606 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002607 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002608 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002609 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002610 "tools/sk_app/android/main_android.cpp",
2611 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002612 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002613 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002614 libs += [ "android" ]
2615 } else if (is_linux) {
2616 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002617 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002618 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002619 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002620 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002621 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002622 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002623 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002624 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002625 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002626 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002627 "X11",
2628 ]
2629 } else if (is_win) {
2630 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002631 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002632 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002633 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002634 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002635 "tools/sk_app/win/main_win.cpp",
2636 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002637 } else if (is_mac) {
2638 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002639 "tools/sk_app/mac/WindowContextFactory_mac.h",
2640 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002641 "tools/sk_app/mac/Window_mac.mm",
2642 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002643 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002644 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002645 "QuartzCore.framework",
2646 "Cocoa.framework",
2647 "Foundation.framework",
2648 ]
2649 } else if (is_ios) {
2650 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002651 "tools/sk_app/ios/WindowContextFactory_ios.h",
2652 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002653 "tools/sk_app/ios/Window_ios.mm",
2654 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002655 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002656 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002657 }
2658
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002659 if (skia_use_gl) {
2660 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002661 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002662 if (is_android) {
2663 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2664 } else if (is_linux) {
2665 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2666 } else if (is_win) {
2667 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2668 if (skia_use_angle) {
2669 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2670 }
2671 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002672 sources += [
2673 "tools/sk_app/mac/GLWindowContext_mac.mm",
2674 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2675 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002676 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002677 sources += [
2678 "tools/sk_app/ios/GLWindowContext_ios.mm",
2679 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2680 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002681 }
2682 }
2683
Brian Osmanc9a42472018-05-31 13:17:12 -04002684 if (skia_use_vulkan) {
2685 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002686 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002687 if (is_android) {
2688 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2689 } else if (is_linux) {
2690 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2691 libs += [ "X11-xcb" ]
2692 } else if (is_win) {
2693 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2694 }
2695 }
2696
Jim Van Verthbe39f712019-02-08 15:36:14 -05002697 if (skia_use_metal) {
2698 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002699 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002700 if (skia_enable_graphite) {
2701 sources += [ "tools/sk_app/GraphiteMetalWindowContext.mm" ]
2702 sources += [ "tools/sk_app/GraphiteMetalWindowContext.h" ]
2703 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002704 if (is_mac) {
2705 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002706 if (skia_enable_graphite) {
2707 sources += [ "tools/sk_app/mac/GraphiteMetalWindowContext_mac.mm" ]
2708 }
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002709 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002710 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002711 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002712 }
2713
Jim Van Verth682a2f42020-05-13 16:54:09 -04002714 if (skia_use_direct3d) {
2715 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2716 }
2717
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002718 if (skia_use_dawn) {
2719 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002720 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002721 if (is_linux) {
2722 if (dawn_enable_vulkan) {
2723 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2724 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2725 libs += [ "X11-xcb" ]
2726 }
2727 } else if (is_win) {
2728 if (dawn_enable_d3d12) {
2729 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2730 }
2731 } else if (is_mac) {
2732 if (dawn_enable_metal) {
2733 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2734 }
2735 }
2736 }
2737
Mike Kleina01c6b02020-04-01 13:47:34 -05002738 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002739 if (is_android) {
2740 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002741 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002742 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002743 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002744 }
Brian Osman16adfa32016-10-18 14:42:44 -04002745 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002746
Hal Canary87515122019-03-15 14:22:51 -04002747 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2748 test_app("fiddle_examples") {
2749 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002750 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002751 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002752 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002753 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002754 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002755 cflags = [
2756 "/wd4756", # Overflow in constant arithmetic
2757 "/wd4305", # truncation from 'double' to 'float'
2758 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002759 }
Hal Canary87515122019-03-15 14:22:51 -04002760 deps = [
2761 ":skia",
2762 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002763 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002764 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002765 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002766 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002767 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002768 ]
2769 }
2770 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002771
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002772 # sk_app can work without GL but viewer always runs raster through a GL window context.
2773 if (skia_use_gl) {
2774 test_app("viewer") {
2775 is_shared_library = is_android
2776 sources = [
2777 "tools/viewer/AnimTimer.h",
2778 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002779 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002780 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002781 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002782 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002783 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002784 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002785 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002786 "tools/viewer/MSKPSlide.cpp",
2787 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002788 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002789 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002790 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002791 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002792 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002793 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002794 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002795 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002796 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002797 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002798 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002799 "tools/viewer/SkottieSlide.h",
2800 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002801 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002802 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002803 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002804 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002805 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002806 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002807 "tools/viewer/TouchGesture.cpp",
2808 "tools/viewer/TouchGesture.h",
2809 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002810 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002811 ]
2812 libs = []
2813
2814 deps = [
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002815 ":common_flags_fontmgr",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002816 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002817 ":flags",
2818 ":gm",
2819 ":gpu_tool_utils",
2820 ":samples",
2821 ":sk_app",
2822 ":skia",
2823 ":tool_utils",
2824 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002825 "experimental/skrive",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002826 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002827 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002828 "modules/particles",
2829 "modules/skottie",
2830 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002831 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002832 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002833 "//third_party/imgui",
2834 ]
2835 if (skia_use_experimental_xform) {
2836 deps += [ ":experimental_xform" ]
2837 sources += [ "gm/xform.cpp" ]
2838 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002839 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002840 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002841 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002842
Corentin Wallez89d6e792021-03-08 15:25:34 +01002843 #spvtools depends on this but doesn't deps it in.
2844 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002845 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002846 }
Mike Reedd62d4062019-06-12 10:20:44 -04002847 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002848 }
2849
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002850 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002851 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002852 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002853 libs = []
2854
Brian Osmaneff04b52017-11-21 13:18:02 -05002855 deps = [
2856 ":flags",
2857 ":gpu_tool_utils",
2858 ":sk_app",
2859 ":skia",
2860 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002861 ]
2862 }
2863 }
2864
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002865 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2866 action_foreach("generate_mocs") {
2867 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002868 sources = [ "tools/mdbviz/MainWindow.h" ]
2869 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002870 args = [
2871 "$skia_qt_path" + "/bin/moc",
2872 "{{source}}",
2873 "-o",
2874 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2875 ]
2876 }
2877 action_foreach("generate_resources") {
2878 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002879 sources = [ "tools/mdbviz/resources.qrc" ]
2880 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002881 args = [
2882 "$skia_qt_path" + "/bin/rcc",
2883 "{{source}}",
2884 "-o",
2885 "gen/mdbviz/{{source_name_part}}_res.cpp",
2886 ]
2887 }
2888 test_app("mdbviz") {
2889 if (is_win) {
2890 # on Windows we need to disable some exception handling warnings due to the Qt headers
2891 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2892 }
2893 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002894 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002895 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002896 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002897 "tools/debugger/DrawCommand.cpp",
2898 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002899 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002900 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002901 "tools/mdbviz/main.cpp",
2902
2903 # generated files
2904 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2905 "$target_gen_dir/mdbviz/resources_res.cpp",
2906 ]
2907 lib_dirs = [ "$skia_qt_path/lib" ]
2908 libs = [
2909 "Qt5Core.lib",
2910 "Qt5Gui.lib",
2911 "Qt5Widgets.lib",
2912 ]
2913 include_dirs = [
2914 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002915 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002916 "$skia_qt_path/include/QtWidgets",
2917 ]
2918 deps = [
2919 ":generate_mocs",
2920 ":generate_resources",
2921 ":skia",
2922 ]
2923 }
2924 }
2925
Mike Kleine459afd2017-03-03 09:21:30 -05002926 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002927 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002928 sources = [ "$ndk/$ndk_gdbserver" ]
2929 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002930 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002931 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002932
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002933 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002934 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002935 deps = [
2936 ":skia",
2937 "modules/particles",
2938 ]
2939 }
2940
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002941 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002942 test_app("editor") {
2943 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002944 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002945 }
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002946 test_app("text_editor") {
2947 is_shared_library = is_android
2948 deps = [ "experimental/sktext:text_editor" ]
2949 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002950 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002951
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002952 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002953 sources = [ "tools/image_diff_metric.cpp" ]
2954 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002955 }
Chris Dalton2b598902020-03-25 10:50:35 -06002956
2957 group("modules_testonly") {
2958 testonly = true
2959 deps = []
2960 if (target_cpu == "wasm") {
2961 deps += [ "modules/canvaskit:viewer_wasm" ]
2962 }
2963 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002964
2965 if (skia_build_fuzzers) {
2966 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002967 skia_executable(target_name) {
2968 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002969 check_includes = false
2970 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002971 if (!defined(configs)) {
2972 configs = []
2973 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002974 configs += [ ":skia_private" ]
2975 sources += [
2976 "fuzz/Fuzz.cpp",
2977 "fuzz/FuzzCommon.cpp",
2978 ]
2979 deps += [
2980 ":flags",
2981 ":gpu_tool_utils",
2982 ":skia",
2983 ]
2984 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2985 if (skia_use_libfuzzer_defaults) {
2986 cflags = [ "-fsanitize=fuzzer" ]
2987 ldflags = [ "-fsanitize=fuzzer" ]
2988 }
2989 testonly = true
2990 }
2991 }
2992
2993 libfuzzer_app("region_deserialize") {
2994 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2995 deps = []
2996 }
2997
2998 libfuzzer_app("image_filter_deserialize") {
2999 include_dirs = [
3000 "tools",
3001 "tools/fonts",
3002 ]
3003 sources = [
3004 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
3005 "tools/Resources.cpp",
3006 "tools/fonts/TestFontMgr.cpp",
3007 "tools/fonts/TestSVGTypeface.cpp",
3008 "tools/fonts/TestTypeface.cpp",
3009 ]
Florin Malitab3418102020-10-15 18:10:29 -04003010 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003011 }
3012
3013 libfuzzer_app("region_set_path") {
3014 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
3015 deps = []
3016 }
3017
3018 libfuzzer_app("textblob_deserialize") {
3019 include_dirs = [
3020 "tools",
3021 "tools/fonts",
3022 ]
3023 sources = [
3024 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
3025 "tools/Resources.cpp",
3026 "tools/fonts/TestFontMgr.cpp",
3027 "tools/fonts/TestSVGTypeface.cpp",
3028 "tools/fonts/TestTypeface.cpp",
3029 ]
Florin Malitab3418102020-10-15 18:10:29 -04003030 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003031 }
3032
3033 libfuzzer_app("path_deserialize") {
3034 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
3035 deps = []
3036 }
3037
3038 libfuzzer_app("image_decode") {
3039 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3040 deps = []
3041 }
3042
3043 libfuzzer_app("animated_image_decode") {
3044 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3045 deps = []
3046 }
3047
3048 libfuzzer_app("api_create_ddl") {
3049 include_dirs = [
3050 "include",
3051 "include/gpu",
3052 ]
3053 sources = [
3054 "fuzz/FuzzCreateDDL.cpp",
3055 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3056 "tools/Resources.cpp",
3057 "tools/UrlDataManager.cpp",
3058 "tools/debugger/DebugCanvas.cpp",
3059 "tools/debugger/DebugLayerManager.cpp",
3060 "tools/debugger/DrawCommand.cpp",
3061 "tools/debugger/JsonWriteBuffer.cpp",
3062 "tools/fonts/TestFontMgr.cpp",
3063 "tools/fonts/TestSVGTypeface.cpp",
3064 "tools/fonts/TestTypeface.cpp",
3065 ]
3066 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003067 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003068 "//third_party/libpng",
3069 ]
3070 }
3071
3072 libfuzzer_app("api_draw_functions") {
3073 sources = [
3074 "fuzz/FuzzDrawFunctions.cpp",
3075 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3076 ]
3077 deps = []
3078 }
3079
Adlai Hollerccb68662021-02-25 10:28:44 -05003080 libfuzzer_app("api_ddl_threading") {
3081 sources = [
3082 "fuzz/FuzzDDLThreading.cpp",
3083 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3084 ]
3085 deps = []
3086 }
3087
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003088 libfuzzer_app("api_gradients") {
3089 sources = [
3090 "fuzz/FuzzGradients.cpp",
3091 "fuzz/oss_fuzz/FuzzGradients.cpp",
3092 ]
3093 deps = []
3094 }
3095
3096 libfuzzer_app("api_image_filter") {
3097 include_dirs = [
3098 "tools",
3099 "tools/debugger",
3100 ]
3101 sources = [
3102 "fuzz/FuzzCanvas.cpp",
3103 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3104 "tools/UrlDataManager.cpp",
3105 "tools/debugger/DebugCanvas.cpp",
3106 "tools/debugger/DebugLayerManager.cpp",
3107 "tools/debugger/DrawCommand.cpp",
3108 "tools/debugger/JsonWriteBuffer.cpp",
3109 ]
3110 deps = [ "//third_party/libpng" ]
3111 }
3112
3113 libfuzzer_app("api_path_measure") {
3114 sources = [
3115 "fuzz/FuzzPathMeasure.cpp",
3116 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3117 ]
3118 deps = []
3119 }
3120
3121 libfuzzer_app("api_pathop") {
3122 sources = [
3123 "fuzz/FuzzPathop.cpp",
3124 "fuzz/oss_fuzz/FuzzPathop.cpp",
3125 ]
3126 deps = []
3127 }
3128
Robert Phillips98b066c2021-04-22 10:51:58 -04003129 libfuzzer_app("api_triangulation") {
3130 sources = [
3131 "fuzz/FuzzTriangulation.cpp",
3132 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3133 ]
3134 deps = []
3135 }
3136
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003137 libfuzzer_app("api_raster_n32_canvas") {
3138 include_dirs = [
3139 "tools",
3140 "tools/debugger",
3141 "tools/fonts",
3142 ]
3143 sources = [
3144 "fuzz/FuzzCanvas.cpp",
3145 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3146 "tools/Resources.cpp",
3147 "tools/UrlDataManager.cpp",
3148 "tools/debugger/DebugCanvas.cpp",
3149 "tools/debugger/DebugLayerManager.cpp",
3150 "tools/debugger/DrawCommand.cpp",
3151 "tools/debugger/JsonWriteBuffer.cpp",
3152 "tools/fonts/TestFontMgr.cpp",
3153 "tools/fonts/TestSVGTypeface.cpp",
3154 "tools/fonts/TestTypeface.cpp",
3155 ]
3156 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003157 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003158 "//third_party/libpng",
3159 ]
3160 }
3161
Kevin Lubick7845b972021-03-29 08:07:32 -04003162 libfuzzer_app("api_regionop") {
3163 sources = [
3164 "fuzz/FuzzRegionOp.cpp",
3165 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3166 ]
3167 deps = []
3168 }
3169
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003170 if (skia_use_gl) {
3171 libfuzzer_app("api_mock_gpu_canvas") {
3172 include_dirs = [
3173 "tools",
3174 "tools/debugger",
3175 "tools/fonts",
3176 ]
3177 sources = [
3178 "fuzz/FuzzCanvas.cpp",
3179 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3180 "tools/LsanSuppressions.cpp",
3181 "tools/Resources.cpp",
3182 "tools/UrlDataManager.cpp",
3183 "tools/debugger/DebugCanvas.cpp",
3184 "tools/debugger/DebugLayerManager.cpp",
3185 "tools/debugger/DrawCommand.cpp",
3186 "tools/debugger/JsonWriteBuffer.cpp",
3187 "tools/fonts/TestFontMgr.cpp",
3188 "tools/fonts/TestSVGTypeface.cpp",
3189 "tools/fonts/TestTypeface.cpp",
3190 ]
3191 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003192 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003193 "//third_party/libpng",
3194 ]
3195 }
3196 }
3197
3198 libfuzzer_app("api_null_canvas") {
3199 include_dirs = [
3200 "tools",
3201 "tools/debugger",
3202 "tools/fonts",
3203 ]
3204 sources = [
3205 "fuzz/FuzzCanvas.cpp",
3206 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3207 "tools/Resources.cpp",
3208 "tools/UrlDataManager.cpp",
3209 "tools/debugger/DebugCanvas.cpp",
3210 "tools/debugger/DebugLayerManager.cpp",
3211 "tools/debugger/DrawCommand.cpp",
3212 "tools/debugger/JsonWriteBuffer.cpp",
3213 "tools/fonts/TestFontMgr.cpp",
3214 "tools/fonts/TestSVGTypeface.cpp",
3215 "tools/fonts/TestTypeface.cpp",
3216 ]
3217 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003218 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003219 "//third_party/libpng",
3220 ]
3221 }
3222
Weston Tracey1a771fe2021-02-04 11:09:59 -05003223 libfuzzer_app("api_skparagraph") {
3224 sources = [
3225 "fuzz/FuzzSkParagraph.cpp",
3226 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3227 "tools/Resources.cpp",
3228 ]
3229 deps = [ "modules/skparagraph" ]
3230 }
3231
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003232 libfuzzer_app("api_svg_canvas") {
3233 include_dirs = [
3234 "include",
3235 "include/svg",
3236 ]
3237 sources = [
3238 "fuzz/FuzzCanvas.cpp",
3239 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3240 "tools/Resources.cpp",
3241 "tools/UrlDataManager.cpp",
3242 "tools/debugger/DebugCanvas.cpp",
3243 "tools/debugger/DebugLayerManager.cpp",
3244 "tools/debugger/DrawCommand.cpp",
3245 "tools/debugger/JsonWriteBuffer.cpp",
3246 "tools/fonts/TestFontMgr.cpp",
3247 "tools/fonts/TestSVGTypeface.cpp",
3248 "tools/fonts/TestTypeface.cpp",
3249 ]
3250 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003251 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003252 "//third_party/libpng",
3253 ]
3254 }
3255
3256 libfuzzer_app("png_encoder") {
3257 sources = [
3258 "fuzz/FuzzEncoders.cpp",
3259 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3260 ]
3261 deps = []
3262 }
3263
3264 libfuzzer_app("jpeg_encoder") {
3265 sources = [
3266 "fuzz/FuzzEncoders.cpp",
3267 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3268 ]
3269 deps = []
3270 }
3271
3272 libfuzzer_app("webp_encoder") {
3273 sources = [
3274 "fuzz/FuzzEncoders.cpp",
3275 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3276 ]
3277 deps = []
3278 }
3279
3280 libfuzzer_app("skottie_json") {
3281 sources = [
3282 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3283 "tools/Resources.cpp",
3284 "tools/fonts/TestFontMgr.cpp",
3285 "tools/fonts/TestSVGTypeface.cpp",
3286 "tools/fonts/TestTypeface.cpp",
3287 ]
3288 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003289 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003290 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003291 ]
3292 }
3293
3294 libfuzzer_app("skjson") {
3295 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3296 deps = []
3297 }
3298
3299 libfuzzer_app("api_polyutils") {
3300 sources = [
3301 "fuzz/FuzzPolyUtils.cpp",
3302 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3303 ]
3304 deps = [ ":skia" ]
3305 }
3306
3307 libfuzzer_app("android_codec") {
3308 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3309 deps = []
3310 }
3311
3312 libfuzzer_app("image_decode_incremental") {
3313 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3314 deps = []
3315 }
3316
3317 libfuzzer_app("sksl2glsl") {
3318 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3319 deps = []
3320 }
3321
3322 libfuzzer_app("sksl2spirv") {
3323 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3324 deps = []
3325 }
3326
3327 libfuzzer_app("sksl2metal") {
3328 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3329 deps = []
3330 }
3331
3332 libfuzzer_app("sksl2pipeline") {
3333 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3334 deps = []
3335 }
3336
3337 libfuzzer_app("skdescriptor_deserialize") {
3338 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3339 deps = []
3340 }
3341
3342 libfuzzer_app("svg_dom") {
3343 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003344 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003345 }
3346
3347 libfuzzer_app("skruntimeeffect") {
3348 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3349 deps = []
3350 }
3351
3352 libfuzzer_app("skp") {
3353 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3354 deps = []
3355 }
3356 }
mtklein25c81d42016-07-27 13:55:26 -07003357}
Hal Canary932a2c02019-09-17 10:43:18 -04003358
Greg Daniel391f9412021-10-28 12:44:43 -04003359if (is_ios && skia_use_metal && skia_enable_gpu &&
3360 !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003361 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003362 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003363 }
Hal Canary27483062019-12-06 15:01:08 -05003364}
3365
Hal Canary60ff6512020-01-21 12:39:20 -05003366if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003367 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003368 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003369 }
3370}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003371
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003372skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003373 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3374 include_dirs = [ "." ]
3375 deps = [ ":skia" ]
3376}