blob: 24f1ea2b8ef79116f0e5a65ec280b64783018711 [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 = [
578 "src/sksl/lex/Main.cpp",
579 "src/sksl/lex/NFA.cpp",
580 "src/sksl/lex/RegexNode.cpp",
581 "src/sksl/lex/RegexParser.cpp",
582 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500583 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400584 }
585
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700586 action("run_sksllex") {
587 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500588 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
589 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700590
591 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
592 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
593 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500594 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700595 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
596 # confused due to the same file being named by two different paths
597 ]
598 sksllex_path = "$root_out_dir/"
599 sksllex_path += "sksllex"
600 if (host_os == "win") {
601 sksllex_path += ".exe"
602 }
603 args = [
604 rebase_path(sksllex_path),
605 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400606 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700607 rebase_path("src"),
608 ]
609 }
610} else {
611 group("run_sksllex") {
612 }
613}
614
Brian Osmaned5181e2021-07-01 13:54:20 -0400615# `Compile SkSL Tests` relies on skslc.
616if (skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400617 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500618 defines = [
619 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500620 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500621 "SK_ENABLE_SPIRV_VALIDATION",
622 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400623 sources = [
Michael Ludwigc1ed11d2021-08-24 11:49:55 -0400624 "src/core/SkBlockAllocator.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500625 "src/core/SkCpu.cpp",
626 "src/core/SkData.cpp",
627 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400628 "src/core/SkMalloc.cpp",
629 "src/core/SkMath.cpp",
John Stilesfbd9fae2021-06-22 09:34:14 -0400630 "src/core/SkMatrixInvert.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400631 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500632 "src/core/SkStream.cpp",
633 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500634 "src/core/SkStringUtils.cpp",
Ethan Nicholasd2e09602021-06-10 11:21:59 -0400635 "src/core/SkStringView.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400636 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500637 "src/core/SkUtils.cpp",
638 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400639 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500640 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400641 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500642 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400643 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500644 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400645 ]
Brian Osman47726a12020-12-17 16:02:08 -0500646 if (is_win) {
647 sources += [ "src/ports/SkOSFile_win.cpp" ]
648 } else {
649 sources += [ "src/ports/SkOSFile_posix.cpp" ]
650 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400651 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400652 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500653 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400654 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500655 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100656 "//third_party/externals/spirv-tools:spvtools",
657 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400658 ]
659 }
660
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400661 skslc_path = "$root_out_dir/"
662 if (host_toolchain != default_toolchain_name) {
663 skslc_path += "$host_toolchain/"
664 }
665 skslc_path += "skslc"
666 if (host_os == "win") {
667 skslc_path += ".exe"
668 }
669
Brian Osmandd496172020-08-08 08:17:18 -0400670 copy("sksl_pre_includes") {
671 sources = [
672 "src/sksl/sksl_frag.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400673 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500674 "src/sksl/sksl_public.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400675 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400676 "src/sksl/sksl_vert.sksl",
677 ]
678 outputs = [ "$root_out_dir/{{source_file_part}}" ]
679 }
680
681 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400682
683 dehydrate_sksl_outputs = []
684 foreach(src, dehydrate_sksl_sources) {
685 name = get_path_info(src, "name")
686
687 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
688 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
689 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
690 "src/sksl/generated/$name.dehydrated.sksl",
691 target_out_dir) ]
692 }
693
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400694 action("dehydrate_sksl") {
695 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400696 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400697 ":sksl_pre_includes",
698 ":skslc(//gn/toolchain:$host_toolchain)",
699 ]
700 sources = dehydrate_sksl_sources
701 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000702 args = [
703 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400704 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000705 ]
Brian Osmandd496172020-08-08 08:17:18 -0400706 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400707 }
John Stilesd836f842020-09-14 10:21:44 -0400708} else {
709 group("dehydrate_sksl") {
710 }
711}
712
John Stilesd836f842020-09-14 10:21:44 -0400713if (skia_compile_sksl_tests) {
714 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400715
John Stiles7e248712020-09-24 16:42:09 -0400716 template("compile_sksl") {
717 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
718 action("compile_sksl_${target_name}") {
719 script = "gn/compile_sksl_tests.py"
720 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400721 ":sksl_pre_includes",
722 ":skslc(//gn/toolchain:$host_toolchain)",
723 ]
John Stilesda57fc02021-01-22 11:54:30 -0500724 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400725 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500726 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500727 args = [
728 rebase_path(skslc_path),
729 invoker.lang,
730 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500731 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500732 ]
733
John Stilesbfc9be02021-01-22 11:55:48 -0500734 testsDir = get_path_info("tests", "abspath")
735 resourcesDir = get_path_info("resources", "abspath")
736
737 foreach(partialPath, invoker.sources) {
738 dst = testsDir + partialPath
739 src = resourcesDir + partialPath
740
741 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400742
743 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
744 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
745 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
746 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
747 nameTmp = get_path_info(dst, "name")
748 name = get_path_info(nameTmp, "name")
749 ext = get_path_info(nameTmp, "extension")
750 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500751 response_file_contents += rebase_path([
752 src,
753 dir,
754 ])
John Stilesda57fc02021-01-22 11:54:30 -0500755 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500756
John Stilesda57fc02021-01-22 11:54:30 -0500757 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400758 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400759 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500760 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500761 }
John Stilesbfc9be02021-01-22 11:55:48 -0500762 outputs +=
763 [ target_out_dir + "/" +
764 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400765 }
766 }
John Stiles7e248712020-09-24 16:42:09 -0400767 }
John Stilesd836f842020-09-14 10:21:44 -0400768 }
John Stiles7e248712020-09-24 16:42:09 -0400769 compile_sksl("glsl_tests") {
770 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500771 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400772 lang = "--glsl"
773 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400774 }
John Stiles7e248712020-09-24 16:42:09 -0400775 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400776 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500777 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400778 lang = "--glsl"
779 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400780 }
John Stilesaeae3a52020-09-25 13:35:58 -0400781 compile_sksl("metal_tests") {
782 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500783 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400784 lang = "--metal"
785 settings = "--settings"
786 }
Brian Osman977feec2020-12-22 11:28:59 -0500787 compile_sksl("skvm_tests") {
788 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500789 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500790 lang = "--skvm"
791 settings = "--settings"
792 }
Brian Osman62b039b2021-02-08 13:49:53 -0500793 compile_sksl("stage_tests") {
794 sources = sksl_stage_tests_sources
795 outExtensions = [ ".stage" ]
796 lang = "--stage"
797 settings = "--settings"
798 }
John Stilesdda1d312020-11-20 16:28:50 -0500799 compile_sksl("spirv_tests") {
800 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500801 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500802 lang = "--spirv"
803 settings = "--settings"
804 }
John Stilesd836f842020-09-14 10:21:44 -0400805} else {
John Stiles7e248712020-09-24 16:42:09 -0400806 group("compile_sksl_glsl_tests") {
807 }
808 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400809 }
John Stilesaeae3a52020-09-25 13:35:58 -0400810 group("compile_sksl_metal_tests") {
811 }
Brian Osman977feec2020-12-22 11:28:59 -0500812 group("compile_sksl_skvm_tests") {
813 }
John Stilesdda1d312020-11-20 16:28:50 -0500814 group("compile_sksl_spirv_tests") {
815 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400816}
817
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500818optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700819 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400820 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400821 ":compile_sksl_glsl_nosettings_tests",
822 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400823 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500824 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500825 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400826 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700827 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400828 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700829 if (skia_generate_workarounds) {
830 deps += [ ":workaround_list" ]
831 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800832 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600833 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400834 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700835
Brian Osmaned5181e2021-07-01 13:54:20 -0400836 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400837 if (skia_enable_skgpu_v2) {
838 sources += skia_skgpu_v2_sources
Robert Phillips3b97aa22021-05-03 11:42:40 -0400839 }
Robert Phillips024668c2021-07-01 12:12:52 -0400840 if (!skia_enable_skgpu_v1) {
841 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400842 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400843
Mike Klein703cf5a2016-10-13 17:18:04 -0400844 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400845 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700846
John Rosascoa9b348f2019-11-08 13:18:15 -0800847 if (skia_use_gl) {
848 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400849 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500850 sources += [
851 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
852 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
853 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400854
855 # this lib is required to link against AHardwareBuffer
856 if (defined(ndk_api) && ndk_api >= 26) {
857 libs += [ "android" ]
858 }
859 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500860 sources += [
861 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
862 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
863 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400864 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400865 } else if (skia_use_webgl) {
866 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400867 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500868 sources += [
869 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
870 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
871 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400872 libs += [ "GL" ]
873 } else if (is_mac) {
874 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
875 } else if (is_ios) {
876 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800877 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400878 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
879 if (target_cpu != "arm64") {
880 libs += [ "OpenGL32.lib" ]
881 }
882 } else {
883 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
884 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800885 sources += skia_gl_gpu_sources
886 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400887
mtkleine9fb3d52016-09-20 15:11:46 -0700888 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400889 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000890 if (skia_use_vma) {
891 deps += [ "third_party/vulkanmemoryallocator" ]
892 }
mtkleine9fb3d52016-09-20 15:11:46 -0700893 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700894 if (skia_enable_vulkan_debug_layers) {
895 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
896 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800897 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800898 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700899 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
900 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400901 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700902 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800903 }
mtkleine9fb3d52016-09-20 15:11:46 -0700904 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400905
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400906 if (is_android && (skia_use_gl || skia_use_vulkan)) {
907 # this lib is required to link against AHardwareBuffer
908 if (defined(ndk_api) && ndk_api >= 26) {
909 libs += [ "android" ]
910 }
911 }
912
Stephen White0d70b712019-07-10 15:51:30 -0400913 if (skia_use_dawn) {
914 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400915 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700916 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400917 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700918 "//third_party/externals/dawn/src/dawn:dawn_proc",
919 "//third_party/externals/dawn/src/dawn:dawncpp",
920 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400921 ]
922 if (dawn_enable_d3d12) {
923 libs += [
924 "d3d12.lib",
925 "dxgi.lib",
926 "d3dcompiler.lib",
927 ]
928 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400929 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400930 }
931 }
932
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500933 if (skia_use_direct3d) {
934 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400935 deps += [
936 "//third_party/d3d12allocator",
937 "//third_party/spirv-cross:spirv_cross",
938 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500939 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500940 if (skia_enable_direct3d_debug_layer) {
941 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
942 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500943 libs += [
944 "d3d12.lib",
945 "dxgi.lib",
946 "d3dcompiler.lib",
947 ]
948 }
949
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400950 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400951 if (skia_use_metal) {
952 public_defines += [ "SK_METAL" ]
953 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400954 if (skia_enable_metal_debug_info) {
955 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
956 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400957 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400958 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000959 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400960 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500961
Kevin Lubickf4def342018-10-04 12:52:50 -0400962 if (is_debug) {
963 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
964 }
mtklein06c35c02016-09-20 12:28:12 -0700965}
966
Leon Scroggins III41169202019-01-29 09:29:57 -0500967optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500968 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500969 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
970 if ("True" ==
971 exec_script("gn/checkpath.py",
972 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
973 "trim string")) {
974 public_defines = [ "SK_USE_LIBGIFCODEC" ]
975 public_include_dirs = [
976 ".",
977 skia_libgifcodec_path,
978 ]
979 include_dirs = public_include_dirs
980 import(_libgifcodec_gni_path)
981 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
982 ".",
983 skia_libgifcodec_path)
984 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500985}
986
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400987optional("heif") {
988 enabled = skia_use_libheif
989 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
990
991 deps = []
992
Mike Kleina01c6b02020-04-01 13:47:34 -0500993 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400994}
995
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400996optional("jpeg_decode") {
997 enabled = skia_use_libjpeg_turbo_decode
998 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
999
Mike Kleina01c6b02020-04-01 13:47:34 -05001000 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001001 sources = [
1002 "src/codec/SkJpegCodec.cpp",
1003 "src/codec/SkJpegDecoderMgr.cpp",
1004 "src/codec/SkJpegUtility.cpp",
1005 ]
1006}
1007
1008optional("jpeg_encode") {
1009 enabled = skia_use_libjpeg_turbo_encode
1010 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001011
Mike Kleina01c6b02020-04-01 13:47:34 -05001012 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1013 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001014 sources = [
mtklein63213812016-08-24 09:55:56 -07001015 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001016 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001017 ]
1018}
1019
Leon Scroggins III326b9892020-08-05 16:51:10 -04001020optional("ndk_images") {
1021 enabled = skia_use_ndk_images
1022 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1023 sources = [
1024 "src/ports/SkImageEncoder_NDK.cpp",
1025 "src/ports/SkImageGeneratorNDK.cpp",
1026 "src/ports/SkNDKConversions.cpp",
1027 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001028 libs = [ "jnigraphics" ]
1029}
1030
Robert Phillips755e00e2021-09-21 11:59:57 -04001031optional("graphite") {
Jim Van Verthff733b32021-09-24 16:46:36 -04001032 libs = []
1033 frameworks = []
1034
Robert Phillips755e00e2021-09-21 11:59:57 -04001035 enabled = skia_enable_graphite
1036 public_defines = [ "SK_GRAPHITE_ENABLED" ]
1037 public = skia_graphite_public
1038 sources = skia_graphite_sources
Jim Van Verthff733b32021-09-24 16:46:36 -04001039 if (skia_use_metal) {
1040 public_defines += [ "SK_METAL" ]
1041 sources += skia_graphite_mtl_sources
1042 if (skia_enable_metal_debug_info) {
1043 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
1044 }
1045 frameworks += [ "Metal.framework" ]
1046 frameworks += [ "Foundation.framework" ]
1047 }
Robert Phillips1a4080a2021-09-21 09:57:43 -04001048}
1049
mtklein63213812016-08-24 09:55:56 -07001050optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001051 enabled = skia_use_zlib && skia_enable_pdf
1052 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001053
Mike Kleina01c6b02020-04-01 13:47:34 -05001054 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001055 if (skia_use_libjpeg_turbo_decode) {
1056 deps += [ ":jpeg_decode" ]
1057 }
1058 if (skia_use_libjpeg_turbo_encode) {
1059 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001060 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001061 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001062 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001063 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001064 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1065 deps += [ "//third_party/harfbuzz" ]
1066 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1067 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001068 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001069 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001070 }
1071}
1072
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001073optional("xps") {
1074 enabled = skia_use_xps && is_win
1075 public_defines = [ "SK_SUPPORT_XPS" ]
1076 public = skia_xps_public
1077 sources = skia_xps_sources
1078}
1079
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001080optional("png_decode") {
1081 enabled = skia_use_libpng_decode
1082 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001083
Mike Kleina01c6b02020-04-01 13:47:34 -05001084 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001085 sources = [
1086 "src/codec/SkIcoCodec.cpp",
1087 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001088 ]
1089}
1090
1091optional("png_encode") {
1092 enabled = skia_use_libpng_encode
1093 public_defines = [ "SK_ENCODE_PNG" ]
1094
Mike Kleina01c6b02020-04-01 13:47:34 -05001095 deps = [ "//third_party/libpng" ]
1096 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001097}
1098
scroggof84ad642016-10-31 09:02:57 -07001099optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001100 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001101 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1102
1103 deps = [
1104 "//third_party/dng_sdk",
1105 "//third_party/libjpeg-turbo:libjpeg",
1106 "//third_party/piex",
1107 ]
1108
1109 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1110 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001111 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001112
Mike Kleina01c6b02020-04-01 13:47:34 -05001113 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001114}
1115
Mike Klein852a8cb2018-05-15 10:46:58 -04001116import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001117skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001118 cflags = []
1119 if (!is_win || is_clang) {
1120 cflags += [
1121 "-w",
1122 "-std=c11",
1123 ]
1124 }
1125
Mike Kleina01c6b02020-04-01 13:47:34 -05001126 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001127 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001128 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1129}
1130
mtklein3cc22182016-08-29 13:26:14 -07001131optional("typeface_freetype") {
1132 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001133
Mike Kleina01c6b02020-04-01 13:47:34 -05001134 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001135 sources = [
1136 "src/ports/SkFontHost_FreeType.cpp",
1137 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001138 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001139 ]
1140}
1141
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001142optional("webp_decode") {
1143 enabled = skia_use_libwebp_decode
1144 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001145
Mike Kleina01c6b02020-04-01 13:47:34 -05001146 deps = [ "//third_party/libwebp" ]
1147 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001148}
1149
1150optional("webp_encode") {
1151 enabled = skia_use_libwebp_encode
1152 public_defines = [ "SK_ENCODE_WEBP" ]
1153
Mike Kleina01c6b02020-04-01 13:47:34 -05001154 deps = [ "//third_party/libwebp" ]
1155 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001156}
1157
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001158optional("wuffs") {
1159 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001160 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001161
Mike Kleina01c6b02020-04-01 13:47:34 -05001162 deps = [ "//third_party/wuffs" ]
1163 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001164}
1165
mtklein63213812016-08-24 09:55:56 -07001166optional("xml") {
1167 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001168 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001169
Mike Kleina01c6b02020-04-01 13:47:34 -05001170 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001171 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001172 "src/svg/SkSVGCanvas.cpp",
1173 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001174 "src/xml/SkDOM.cpp",
1175 "src/xml/SkXMLParser.cpp",
1176 "src/xml/SkXMLWriter.cpp",
1177 ]
1178}
1179
Mike Klein613ad382019-06-06 11:42:02 -05001180optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001181 enabled = skia_enable_skvm_jit_when_possible
1182 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001183 if (skia_vtune_path != "") {
1184 public_defines += [ "SKVM_JIT_VTUNE" ]
1185 public_include_dirs = [ "$skia_vtune_path/include" ]
1186 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1187 }
Mike Klein613ad382019-06-06 11:42:02 -05001188}
1189
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001190if (skia_enable_gpu && skia_generate_workarounds) {
1191 action("workaround_list") {
1192 script = "tools/build_workaround_header.py"
1193
Mike Kleina01c6b02020-04-01 13:47:34 -05001194 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001195
Brian Osmaned5181e2021-07-01 13:54:20 -04001196 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1197 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001198 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001199 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001200
Mike Kleina01c6b02020-04-01 13:47:34 -05001201 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001202 args = [
1203 "--output-file",
1204 "$output_file",
1205 ]
1206
1207 foreach(file, inputs) {
1208 args += [ rebase_path(file, root_build_dir) ]
1209 }
1210 }
1211}
1212
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001213skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001214 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001215 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001216
Mike Klein607b0a72018-11-07 16:17:34 -05001217 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001218 ":fontmgr_FontConfigInterface",
1219 ":fontmgr_android",
1220 ":fontmgr_custom_directory",
1221 ":fontmgr_custom_embedded",
1222 ":fontmgr_custom_empty",
1223 ":fontmgr_fontconfig",
1224 ":fontmgr_fuchsia",
1225 ":fontmgr_mac_ct",
1226 ":fontmgr_win",
1227 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001228 ":gpu",
Robert Phillips755e00e2021-09-21 11:59:57 -04001229 ":graphite",
Mike Klein607b0a72018-11-07 16:17:34 -05001230 ":pdf",
1231 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001232 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001233 ]
1234
mtkleinc04ff472016-06-23 10:29:30 -07001235 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001236 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001237 ":arm64",
1238 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001239 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001240 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001241 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001242 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001243 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001244 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001245 ":jpeg_decode",
1246 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001247 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001248 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001249 ":png_decode",
1250 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001251 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001252 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001253 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001254 ":sse2",
1255 ":sse41",
1256 ":sse42",
1257 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001258 ":webp_decode",
1259 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001260 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001261 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001262 ]
1263
Hal Canaryc25f4e92019-02-26 11:54:25 -05001264 public = skia_core_public
1265 public += skia_utils_public
1266 public += skia_effects_public
1267 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001268
mtkleinc04ff472016-06-23 10:29:30 -07001269 sources = []
brettwb9447282016-09-01 14:24:39 -07001270 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001271 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001272 sources += skia_effects_sources
1273 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001274 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001275 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001276 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001277 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001278 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001279 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001280 "src/codec/SkBmpCodec.cpp",
1281 "src/codec/SkBmpMaskCodec.cpp",
1282 "src/codec/SkBmpRLECodec.cpp",
1283 "src/codec/SkBmpStandardCodec.cpp",
1284 "src/codec/SkCodec.cpp",
1285 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001286 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001287 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001288 "src/codec/SkMaskSwizzler.cpp",
1289 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001290 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001291 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001292 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001293 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001294 "src/codec/SkSwizzler.cpp",
1295 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001296 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001297 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001298 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001299 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001300 "src/ports/SkMemory_malloc.cpp",
1301 "src/ports/SkOSFile_stdio.cpp",
1302 "src/sfnt/SkOTTable_name.cpp",
1303 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001304 ]
brettwb9447282016-09-01 14:24:39 -07001305
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001306 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001307 libs = []
1308
Brian Osman946a4cb2021-07-12 17:02:21 -04001309 if (skia_enable_sksl) {
1310 deps += [ ":dehydrate_sksl" ]
1311 sources += skia_sksl_sources
1312 }
1313
mtkleinc04ff472016-06-23 10:29:30 -07001314 if (is_win) {
1315 sources += [
1316 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001317 "src/ports/SkImageEncoder_WIC.cpp",
1318 "src/ports/SkImageGeneratorWIC.cpp",
1319 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001320 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001321 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001322 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001323 "Ole32.lib",
1324 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001325 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001326
1327 if (!skia_enable_winuwp) {
1328 libs += [
1329 "FontSub.lib",
1330 "User32.lib",
1331 "Usp10.lib",
1332 ]
1333 }
mtkleinc04ff472016-06-23 10:29:30 -07001334 } else {
1335 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001336 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001337 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001338 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001339 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001340 }
1341
mtklein7d6fb2c2016-08-25 14:50:44 -07001342 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001343 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001344 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001345 deps += [ "//third_party/cpu-features" ]
1346 }
mtklein06c35c02016-09-20 12:28:12 -07001347 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001348 libs += [
1349 "EGL",
1350 "GLESv2",
1351 "log",
1352 ]
1353 }
1354
Kevin Lubick217056c2018-09-20 17:39:31 -04001355 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001356 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001357 if (skia_use_egl) {
1358 libs += [ "GLESv2" ]
1359 }
mtkleinc04ff472016-06-23 10:29:30 -07001360 }
1361
1362 if (is_mac) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001363 public += [ "include/ports/SkCFObject.h" ]
mtkleinc04ff472016-06-23 10:29:30 -07001364 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001365 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001366 "src/ports/SkImageEncoder_CG.cpp",
1367 "src/ports/SkImageGeneratorCG.cpp",
1368 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001369 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001370 "ApplicationServices.framework",
1371 "OpenGL.framework",
1372 ]
mtkleinc04ff472016-06-23 10:29:30 -07001373 }
abarth6fc8ff02016-07-15 15:15:15 -07001374
Mike Klein7d302882016-11-03 14:06:31 -04001375 if (is_ios) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001376 public += [ "include/ports/SkCFObject.h" ]
Mike Klein7d302882016-11-03 14:06:31 -04001377 sources += [
1378 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001379 "src/ports/SkImageEncoder_CG.cpp",
1380 "src/ports/SkImageGeneratorCG.cpp",
1381 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001382 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001383 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001384 "ImageIO.framework",
1385 "MobileCoreServices.framework",
1386 ]
1387 }
1388
abarth6fc8ff02016-07-15 15:15:15 -07001389 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001390 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001391 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001392
1393 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001394 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001395 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1396 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001397
1398 if (skia_include_multiframe_procs) {
1399 sources += [ "tools/SkSharingProc.cpp" ]
1400 }
mtkleinc04ff472016-06-23 10:29:30 -07001401}
1402
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001403# DebugCanvas used in experimental/wasm-skp-debugger
1404if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001405 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001406 public_configs = [ ":skia_public" ]
1407
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001408 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001409 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001410 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001411 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001412 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001413 "tools/debugger/DrawCommand.cpp",
1414 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001415 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001416 }
1417}
1418
Ben Wagner25eb5342021-03-22 14:07:15 -04001419skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001420 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001421 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001422 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001423
1424 deps = [
1425 ":arm64",
1426 ":armv7",
1427 ":avx",
1428 ":crc32",
1429 ":hsw",
1430 ":none",
1431 ":sse2",
1432 ":sse41",
1433 ":sse42",
1434 ":ssse3",
1435 ]
1436
Kevin Lubickcbcff382018-10-02 09:02:18 -04001437 sources = []
1438 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001439 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001440 sources += [
1441 "src/core/SkAnalyticEdge.cpp",
1442 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001443 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001444 "src/core/SkCubicMap.cpp",
1445 "src/core/SkEdge.cpp",
1446 "src/core/SkEdgeBuilder.cpp",
1447 "src/core/SkEdgeClipper.cpp",
1448 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001449 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001450 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001451 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001452 "src/core/SkMallocPixelRef.cpp",
1453 "src/core/SkMath.cpp",
1454 "src/core/SkMatrix.cpp",
1455 "src/core/SkOpts.cpp",
1456 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001457 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001458 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001459 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001460 "src/core/SkPathEffect.cpp",
1461 "src/core/SkPathMeasure.cpp",
1462 "src/core/SkPathRef.cpp",
1463 "src/core/SkPoint.cpp",
1464 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001465 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001466 "src/core/SkRect.cpp",
1467 "src/core/SkSemaphore.cpp",
1468 "src/core/SkStream.cpp",
1469 "src/core/SkString.cpp",
1470 "src/core/SkStringUtils.cpp",
1471 "src/core/SkStroke.cpp",
1472 "src/core/SkStrokeRec.cpp",
1473 "src/core/SkStrokerPriv.cpp",
1474 "src/core/SkThreadID.cpp",
1475 "src/core/SkUtils.cpp",
1476 "src/effects/SkDashPathEffect.cpp",
1477 "src/effects/SkTrimPathEffect.cpp",
1478 "src/ports/SkDebug_stdio.cpp",
1479 "src/ports/SkMemory_malloc.cpp",
1480 "src/utils/SkDashPath.cpp",
1481 "src/utils/SkParse.cpp",
1482 "src/utils/SkParsePath.cpp",
1483 "src/utils/SkUTF.cpp",
1484 ]
1485}
1486
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001487group("modules") {
1488 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001489 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001490 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001491 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001492 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001493 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001494 ]
1495}
1496
Julia Lavrova9f6e4632021-09-17 15:19:02 -04001497group("experimental") {
1498 deps = [ "experimental/sktext" ]
1499}
1500
Brian Osmancd28fa62020-07-07 16:01:26 -04001501config("our_vulkan_headers") {
1502 include_dirs = [ "include/third_party/vulkan" ]
1503}
1504
mtkleinc095df52016-08-24 12:23:52 -07001505# Targets guarded by skia_enable_tools may use //third_party freely.
1506if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001507 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001508 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001509 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001510 "include/c",
1511 "include/codec",
1512 "include/config",
1513 "include/core",
1514 "include/docs",
1515 "include/effects",
1516 "include/encode",
1517 "include/gpu",
1518 "include/pathops",
1519 "include/ports",
1520 "include/svg",
1521 "include/utils",
1522 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001523 "modules/particles/include",
1524 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001525 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001526 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001527 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001528 ]
1529
Mike Klein308b5ac2016-12-06 16:03:52 -05001530 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001531 skia_source_set("public") {
1532 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001533 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001534 }
1535
Mike Kleinc36dedf2016-11-18 09:35:28 -05001536 config("skia.h_config") {
1537 include_dirs = [ "$target_gen_dir" ]
1538 }
1539 action("skia.h") {
1540 public_configs = [ ":skia.h_config" ]
1541 skia_h = "$target_gen_dir/skia.h"
1542 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001543
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001544 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1545 [ rebase_path(skia_h, root_build_dir) ] +
1546 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001547 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001548 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001549 }
1550
Brian Osmanc9a42472018-05-31 13:17:12 -04001551 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001552 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001553 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001554 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001555 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001556 "tools/fiddle/draw.cpp",
1557 "tools/fiddle/fiddle_main.cpp",
1558 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001559
1560 if (skia_use_egl) {
1561 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001562 } else {
1563 sources += [ "tools/fiddle/null_context.cpp" ]
1564 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001565 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001566 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001567 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001568 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001569 ":skia",
1570 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001571 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001572 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001573 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001574 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001575 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001576 ]
1577 }
1578 }
1579
Mike Kleine5463e62020-06-11 13:53:53 -05001580 config("cpp14") {
1581 if (is_win) {
1582 cflags_cc = [ "/std:c++14" ]
1583 } else {
1584 cflags_cc = [ "-std=c++14" ]
1585 }
1586 }
1587
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001588 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001589 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001590 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001591 ":our_vulkan_headers",
1592 ":cpp14",
1593 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001594 if (defined(skia_header_target_default_configs)) {
1595 configs += skia_header_target_default_configs
1596 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001597 deps = [
1598 ":skia",
1599 ":skia.h",
1600 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001601 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001602 ]
Stephen White0d70b712019-07-10 15:51:30 -04001603
1604 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001605 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001606 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001607 }
1608
mtkleinc095df52016-08-24 12:23:52 -07001609 template("test_lib") {
1610 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001611 if (defined(invoker.public_defines)) {
1612 defines = invoker.public_defines
1613 }
mtklein25c81d42016-07-27 13:55:26 -07001614 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001615 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001616 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001617 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001618 public_configs = [
1619 ":" + target_name + "_config",
1620 ":skia_private",
1621 ]
1622
1623 if (!defined(deps)) {
1624 deps = []
1625 }
1626 deps += [ ":skia" ]
1627 testonly = true
1628 }
mtklein25c81d42016-07-27 13:55:26 -07001629 }
mtklein25c81d42016-07-27 13:55:26 -07001630
Mike Kleine6682eb2017-01-05 10:54:57 -05001631 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001632 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001633 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001634 forward_variables_from(invoker,
1635 "*",
1636 [
1637 "output_name",
1638 "visibility",
1639 "is_shared_library",
1640 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001641 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001642 extra_configs = [ ":skia_private" ]
1643 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1644 data_sources = [ "resources" ]
1645 if ("True" == exec_script("//gn/checkdir.py",
1646 [ rebase_path("skps", root_build_dir) ],
1647 "trim string")) {
1648 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001649 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001650 if ("True" == exec_script("//gn/checkdir.py",
1651 [ rebase_path("mskps", root_build_dir) ],
1652 "trim string")) {
1653 data_sources += [ "mskps" ]
1654 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001655 }
1656 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001657 # !is_ios
1658
1659 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001660 skia_shared_library("lib" + target_name) {
1661 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001662 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001663 if (!defined(configs)) {
1664 configs = []
1665 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001666 configs += [ ":skia_private" ]
1667 testonly = true
1668 }
1669 } else {
1670 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001671 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001672 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001673 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001674 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001675 if (!defined(configs)) {
1676 configs = []
1677 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001678 configs += [ ":skia_private" ]
1679 testonly = true
1680 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001681 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001682 if (is_android && skia_android_serial != "" && defined(_executable)) {
1683 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001684 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001685 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001686 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001687 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001688 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001689 args = [
1690 rebase_path("$root_build_dir/$_executable"),
1691 skia_android_serial,
1692 rebase_path(_stamp),
1693 ]
1694 testonly = true
1695 }
Mike Klein7d921032017-01-05 12:20:41 -05001696 }
1697 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001698 }
1699
mtkleinc095df52016-08-24 12:23:52 -07001700 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001701 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001702
Mike Klein9e25bb92019-04-29 09:46:36 -05001703 # Bots and even devs may not have Vulkan headers, so put
1704 # include/third_party/vulkan on our path so they're always available.
1705 all_dependent_configs = [ ":our_vulkan_headers" ]
1706
Mike Klein333fb452019-04-24 08:48:11 -05001707 defines = []
1708 if (skia_enable_discrete_gpu) {
1709 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1710 }
1711
Brian Osmanc9a42472018-05-31 13:17:12 -04001712 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001713 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001714 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001715 "tools/gpu/BackendSurfaceFactory.cpp",
1716 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001717 "tools/gpu/BackendTextureImageFactory.cpp",
1718 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001719 "tools/gpu/FlushFinishTracker.cpp",
1720 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001721 "tools/gpu/GrContextFactory.cpp",
1722 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001723 "tools/gpu/ManagedBackendTexture.cpp",
1724 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001725 "tools/gpu/MemoryCache.cpp",
1726 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001727 "tools/gpu/ProxyUtils.cpp",
1728 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001729 "tools/gpu/TestOps.cpp",
1730 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001731 "tools/gpu/YUVUtils.cpp",
1732 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001733 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1734 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001735 "tools/gpu/mock/MockTestContext.cpp",
1736 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001737
1738 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001739 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001740
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001741 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001742 sources +=
1743 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001744 if (is_ios) {
1745 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001746 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001747 } else if (is_mac) {
1748 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001749 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001750 if (skia_use_angle) {
1751 deps += [ "//third_party/angle2" ]
1752 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1753 }
Brian Salomon1171d312020-03-19 08:47:44 -04001754 }
1755
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001756 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1757 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001758 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001759 if (is_android || skia_use_egl) {
1760 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1761 libs += [ "EGL" ]
1762 } else if (is_linux) {
1763 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1764 libs += [
1765 "GLU",
1766 "GL",
1767 "X11",
1768 ]
1769 } else if (is_win) {
1770 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1771 libs += [ "Gdi32.lib" ]
1772 if (target_cpu != "arm64") {
1773 libs += [ "OpenGL32.lib" ]
1774 }
1775 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001776 }
Greg Daniel54200e42018-12-11 17:03:39 -05001777
Brian Osmanc9a42472018-05-31 13:17:12 -04001778 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001779 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001780 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001781 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1782 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001783 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001784 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001785 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1786 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001787 }
1788 if (skia_use_metal) {
1789 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001790 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001791 if (skia_use_direct3d) {
1792 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001793 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001794 }
Stephen White985741a2019-07-18 11:43:45 -04001795 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001796 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001797 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001798 if (is_clang) {
1799 cflags_cc = [ "-Wno-microsoft-cast" ]
1800 }
Stephen White985741a2019-07-18 11:43:45 -04001801 }
Robert Phillips72354b02021-07-06 13:43:56 -04001802 if (!skia_enable_skgpu_v1) {
1803 sources -= [ "tools/gpu/GrTest.cpp" ]
1804 sources -= [ "tools/gpu/TestOps.cpp" ]
1805 sources -= [ "tools/gpu/TestOps.h" ]
1806 }
Robert Phillipsd034db72021-09-29 14:29:32 -04001807 if (skia_enable_graphite) {
Robert Phillips091694f2021-09-30 11:41:16 -04001808 sources += [ "tools/graphite/ContextFactory.h" ]
1809 sources += [ "tools/graphite/ContextFactory.cpp" ]
Robert Phillipsd034db72021-09-29 14:29:32 -04001810 sources += [ "tools/graphite/GraphiteTestContext.h" ]
1811 sources += [ "tools/graphite/GraphiteTestContext.cpp" ]
1812 if (skia_use_metal) {
1813 sources += [ "tools/graphite/mtl/GraphiteMtlTestContext.h" ]
1814 sources += [ "tools/graphite/mtl/MtlTestContext.mm" ]
1815 }
1816 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001817
1818 if (is_fuchsia && using_fuchsia_sdk) {
1819 libs +=
1820 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1821 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001822 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001823
mtkleinc095df52016-08-24 12:23:52 -07001824 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001825 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001826 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001827
1828 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001829 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1830 deps = [ ":flags" ]
1831 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001832 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001833 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001834 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1835 deps = [ ":flags" ]
1836 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001837 }
1838 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001839 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1840 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001841 }
Kevin Lubick237dd2d2021-10-14 08:24:22 -04001842 test_lib("common_flags_fontmgr") {
1843 sources = [ "tools/flags/CommonFlagsFontMgr.cpp" ]
1844 deps = [ ":flags" ]
1845 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001846 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001847 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1848 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001849 }
mtklein25c81d42016-07-27 13:55:26 -07001850
Mike Klein499f0ac2019-03-25 13:00:12 -05001851 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001852 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001853 sources = [
1854 "tools/trace/ChromeTracingTracer.cpp",
1855 "tools/trace/ChromeTracingTracer.h",
1856 "tools/trace/EventTracingPriv.cpp",
1857 "tools/trace/EventTracingPriv.h",
1858 "tools/trace/SkDebugfTracer.cpp",
1859 "tools/trace/SkDebugfTracer.h",
1860 ]
1861 }
1862
mtkleinc095df52016-08-24 12:23:52 -07001863 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001864 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001865 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001866 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001867 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001868 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001869 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001870 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001871 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001872 "tools/MSKPPlayer.cpp",
1873 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001874 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001875 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001876 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001877 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001878 "tools/RuntimeBlendUtils.cpp",
1879 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001880 "tools/SkMetaData.cpp",
1881 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001882 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001883 "tools/SkSharingProc.h",
1884 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001885 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001886 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001887 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001888 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001889 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001890 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001891 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001892 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001893 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001894 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001895 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001896 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001897 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001898 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001899 "tools/fonts/TestEmptyTypeface.h",
1900 "tools/fonts/TestFontMgr.cpp",
1901 "tools/fonts/TestFontMgr.h",
1902 "tools/fonts/TestSVGTypeface.cpp",
1903 "tools/fonts/TestSVGTypeface.h",
1904 "tools/fonts/TestTypeface.cpp",
1905 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001906 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001907 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001908 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001909 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001910 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001911 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001912 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001913 if (target_cpu != "wasm") {
1914 sources += [ "tools/CrashHandler.cpp" ]
1915 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001916 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001917 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001918 if (is_ios) {
1919 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001920 sources += [ "tools/ios_utils.h" ]
1921 if (skia_use_metal) {
1922 sources += [ "tools/AutoreleasePool.mm" ]
1923 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001924 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001925 } else if (is_mac) {
1926 if (skia_use_metal) {
1927 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001928 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001929 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001930 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001931 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001932 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001933
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001934 defines = []
1935 if (skia_tools_require_resources) {
1936 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1937 }
mtkleinc095df52016-08-24 12:23:52 -07001938 deps = [
1939 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001940 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001941 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001942 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001943 }
mtklein25c81d42016-07-27 13:55:26 -07001944
Mike Kleine11e5c12019-04-24 12:46:06 -05001945 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001946 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001947 }
1948
Mike Klein6e744122016-10-27 12:21:40 -04001949 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001950 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001951 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001952 if (skia_use_gl) {
1953 sources += gl_gm_sources
1954 }
Robert Phillips024668c2021-07-01 12:12:52 -04001955 if (!skia_enable_skgpu_v1) {
1956 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04001957 }
mtkleinc095df52016-08-24 12:23:52 -07001958 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001959 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001960 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001961 ":skia",
1962 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001963 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001964 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001965 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001966 "modules/skparagraph",
1967 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001968 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001969 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001970 if (is_skia_dev_build) {
1971 sources += [ "gm/fiddle.cpp" ]
1972 deps += [ ":skia.h" ]
1973 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001974 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001975
1976 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001977 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001978 sources += [ "gm/video_decoder.cpp" ]
1979 }
mtkleinc095df52016-08-24 12:23:52 -07001980 }
mtklein25c81d42016-07-27 13:55:26 -07001981
Ben Wagnerbded42a2021-02-17 22:14:34 -05001982 test_lib("test") {
1983 sources = [
1984 "tests/Test.cpp",
1985 "tests/Test.h",
1986 "tests/TestUtils.cpp",
1987 "tests/TestUtils.h",
1988 ]
1989 deps = [
1990 ":flags",
1991 ":skia",
1992 ":tool_utils",
1993 ]
1994 public_deps = [
1995 ":gpu_tool_utils", # Test.h #includes headers from this target.
1996 ]
1997 }
1998
Mike Klein6e744122016-10-27 12:21:40 -04001999 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002000 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002001 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002002 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002003 if (skia_use_metal) {
2004 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002005 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002006 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002007 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002008 if (skia_use_gl) {
2009 sources += gl_tests_sources
2010 }
Robert Phillips30627592021-10-11 11:28:21 -04002011 if (skia_enable_graphite) {
2012 sources += graphite_tests_sources
2013 }
Robert Phillips024668c2021-07-01 12:12:52 -04002014 if (!skia_enable_skgpu_v1) {
2015 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04002016 }
mtkleinc095df52016-08-24 12:23:52 -07002017 deps = [
2018 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002019 ":fontmgr_android_tests",
2020 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002021 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002022 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002023 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002024 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002025 "experimental/skrive:tests",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002026 "experimental/sktext:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002027 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002028 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002029 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002030 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002031 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002032 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002033 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002034 "//third_party/zlib",
2035 ]
2036 }
mtklein2f3416d2016-08-02 16:02:05 -07002037
Mike Klein6e744122016-10-27 12:21:40 -04002038 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002039 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002040 sources = bench_sources
Robert Phillips04f22ea2021-07-22 15:11:03 -04002041 if (!skia_enable_skgpu_v1) {
2042 sources -= skgpu_v1_bench_sources
2043 }
mtkleinc095df52016-08-24 12:23:52 -07002044 deps = [
2045 ":flags",
2046 ":gm",
2047 ":gpu_tool_utils",
2048 ":skia",
2049 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002050 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002051 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002052 ]
2053 }
mtklein2b6870c2016-07-28 14:17:33 -07002054
Mike Reedd62d4062019-06-12 10:20:44 -04002055 test_lib("experimental_xform") {
2056 sources = [
2057 "experimental/xform/SkShape.cpp",
2058 "experimental/xform/SkXform.cpp",
2059 "experimental/xform/XContext.cpp",
2060 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002061 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002062 }
2063
Florin Malitabfe876a2018-09-02 12:33:59 -04002064 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002065 if (skia_enable_skottie) {
2066 test_app("skottie_tool") {
2067 deps = [ "modules/skottie:tool" ]
2068 }
Florin Malita79725d32018-06-05 16:16:57 -04002069 }
Florin Malitab3418102020-10-15 18:10:29 -04002070 test_app("svg_tool") {
2071 deps = [ "modules/svg:tool" ]
2072 }
Florin Malita79725d32018-06-05 16:16:57 -04002073 }
2074
Hal Canary5b39dc82019-04-17 13:29:46 -04002075 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002076 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2077 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002078 }
2079
Chris Dalton2b598902020-03-25 10:50:35 -06002080 import("gn/samples.gni")
2081 test_lib("samples") {
2082 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002083 if (!skia_enable_skgpu_v1) {
2084 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002085 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002086 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002087 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002088 ":flags",
2089 ":gpu_tool_utils",
2090 ":xml",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002091 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002092 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002093 "modules/skparagraph:samples",
2094 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002095 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002096 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002097 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002098 }
Kevin Lubick00398742020-10-08 10:05:07 -04002099 test_lib("hash_and_encode") {
2100 sources = [
2101 "tools/HashAndEncode.cpp",
2102 "tools/HashAndEncode.h",
2103 ]
2104 deps = [
2105 ":flags",
2106 ":skia",
2107 "//third_party/libpng",
2108 ]
2109 }
Chris Dalton2b598902020-03-25 10:50:35 -06002110 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002111 test_app("convert-to-nia") {
2112 sources = [ "tools/convert-to-nia.cpp" ]
2113 deps = [ ":skia" ]
2114 }
Mike Klein7af351a2018-07-27 09:54:43 -04002115 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002116 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002117 deps = [
2118 ":skcms",
2119 ":skia",
2120 ]
2121 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002122 test_app("fm") {
2123 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002124 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002125 "tools/fm/fm.cpp",
2126 ]
2127 deps = [
2128 ":common_flags_aa",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002129 ":common_flags_fontmgr",
Mike Klein735c7ba2019-03-25 12:57:58 -05002130 ":common_flags_gpu",
2131 ":flags",
2132 ":gm",
2133 ":gpu_tool_utils",
2134 ":hash_and_encode",
2135 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002136 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002137 ":tool_utils",
2138 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002139 "modules/skottie",
2140 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002141 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002142 ]
2143 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002144 test_app("dm") {
2145 sources = [
2146 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002147 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002148 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002149 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002150 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002151 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002152 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002153 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002154 ":common_flags_aa",
2155 ":common_flags_config",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002156 ":common_flags_fontmgr",
Mike Kleinc6142d82019-03-25 10:54:59 -05002157 ":common_flags_gpu",
2158 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002159 ":flags",
2160 ":gm",
2161 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002162 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002163 ":skia",
2164 ":tests",
2165 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002166 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002167 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002168 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002169 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002170 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002171 ]
2172 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002173 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002174 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002175 "experimental/sorttoy/Cmds.cpp",
2176 "experimental/sorttoy/Cmds.h",
2177 "experimental/sorttoy/Fake.cpp",
2178 "experimental/sorttoy/Fake.h",
2179 "experimental/sorttoy/SortKey.h",
2180 "experimental/sorttoy/sorttoy.cpp",
2181 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002182 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002183 deps = [
2184 ":flags",
2185 ":skia",
2186 ":tool_utils",
2187 ]
2188 }
Michael Ludwig30217952020-12-04 12:58:35 -05002189
2190 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002191 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002192 sources = [
2193 "tests/CanvasStateHelpers.cpp",
2194 "tests/CanvasStateHelpers.h",
2195 ]
2196 deps = [ ":skia" ]
2197 }
Brian Osman16adfa32016-10-18 14:42:44 -04002198 }
2199
Mike Kleina8a51ce2018-01-09 12:34:11 -05002200 if (!is_win) {
2201 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002202 sources = [ "tools/remote_demo.cpp" ]
2203 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002204 }
2205 }
2206
Hal Canarye107faa2019-10-23 12:52:33 -04002207 if (!is_win) {
2208 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002209 sources = [ "tools/blob_cache_sim.cpp" ]
2210 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002211 }
2212 }
2213
Mike Kleine6682eb2017-01-05 10:54:57 -05002214 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002215 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002216 deps = [
2217 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002218 ":common_flags_aa",
2219 ":common_flags_config",
2220 ":common_flags_gpu",
2221 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002222 ":flags",
2223 ":gm",
2224 ":gpu_tool_utils",
2225 ":skia",
2226 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002227 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002228 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002229 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002230 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002231 ]
mtklein2b6870c2016-07-28 14:17:33 -07002232 }
halcanary19a97202016-08-03 15:08:04 -07002233
Ravi Mistry10d36c52017-01-31 09:49:18 -05002234 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002235 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002236 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002237 deps = [
2238 ":flags",
2239 ":skia",
2240 ]
2241 }
2242
Mike Reedc0ee21f2019-05-28 16:11:03 -04002243 if (skia_use_ffmpeg) {
2244 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002245 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002246 deps = [
2247 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002248 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002249 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002250 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002251 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002252 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002253 ]
2254 }
2255 }
2256
Brian Osmanc9a42472018-05-31 13:17:12 -04002257 test_app("skpbench") {
Kevin Lubickf541ddf2021-10-13 16:02:56 -04002258 sources = [
2259 "bench/BigPath.cpp",
2260 "tools/skpbench/skpbench.cpp",
2261 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002262 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002263 ":common_flags_config",
2264 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002265 ":flags",
2266 ":gpu_tool_utils",
2267 ":skia",
2268 ":tool_utils",
2269 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002270 }
2271
Mike Kleine6682eb2017-01-05 10:54:57 -05002272 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002273 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002274 deps = [
2275 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002276 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002277 ]
halcanary3eee9d92016-09-10 07:01:53 -07002278 }
mtklein046cb562016-09-16 10:23:12 -07002279
Ben Wagner219f3622017-07-17 15:32:25 -04002280 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002281 sources = [ "tools/fonts/create_test_font.cpp" ]
2282 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002283 assert_no_deps = [
2284 # tool_utils requires the output of this app.
2285 ":tool_utils",
2286 ]
2287 }
2288
Florin Malita5d3ff432018-07-31 16:38:43 -04002289 if (skia_use_expat) {
2290 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002291 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002292 deps = [
2293 ":flags",
2294 ":skia",
2295 ":tool_utils",
2296 ]
2297 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002298 }
2299
Mike Kleine6682eb2017-01-05 10:54:57 -05002300 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002301 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002302 deps = [
2303 ":flags",
2304 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002305 ]
mtklein046cb562016-09-16 10:23:12 -07002306 }
mtkleinecbc5262016-09-22 11:51:24 -07002307
Brian Osman6788a542018-12-10 11:56:01 -05002308 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002309 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002310 sources = [
2311 "tools/skiaserve/Request.cpp",
2312 "tools/skiaserve/Response.cpp",
2313 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002314 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2315 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2316 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2317 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2318 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2319 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2320 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2321 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2322 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002323 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2324 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002325 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2326 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2327 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2328 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2329 ]
2330 deps = [
2331 ":flags",
2332 ":gpu_tool_utils",
2333 ":skia",
2334 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002335 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002336 ]
Mike Klein7d302882016-11-03 14:06:31 -04002337 }
mtkleinecbc5262016-09-22 11:51:24 -07002338 }
kjlubick14f984b2016-10-03 11:49:45 -07002339
Mike Kleine6682eb2017-01-05 10:54:57 -05002340 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002341 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002342 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002343 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002344 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002345 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002346 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002347 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002348 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002349 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002350 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002351 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002352 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002353 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002354 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002355 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002356 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002357 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002358 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002359 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002360 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002361 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2362 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002363 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002364 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002365 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002366 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002367 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2368 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002369 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002370 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2371 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002372 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002373 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002374 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002375 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002376 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002377 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002378 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002379 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002380 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002381 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002382 "tools/debugger/DrawCommand.cpp",
2383 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002384 ]
2385 deps = [
2386 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002387 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002388 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002389 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002390 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002391 ]
kjlubick14f984b2016-10-03 11:49:45 -07002392 }
Mike Klein38312422016-10-05 15:41:01 -04002393
Mike Kleine6682eb2017-01-05 10:54:57 -05002394 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002395 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002396 rebase_path("tests/skia_test.cpp"),
2397 rebase_path("tests/Test.cpp"),
2398 ]
caryclark9feb6322016-10-25 08:58:26 -07002399 deps = [
2400 ":flags",
2401 ":gpu_tool_utils",
2402 ":skia",
2403 ":tool_utils",
2404 ]
caryclark9feb6322016-10-25 08:58:26 -07002405 }
2406
Mike Kleine6682eb2017-01-05 10:54:57 -05002407 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002408 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002409 deps = [
2410 ":flags",
2411 ":skia",
2412 ]
Mike Klein38312422016-10-05 15:41:01 -04002413 }
bungemanfe917272016-10-13 17:36:40 -04002414
Mike Kleine6682eb2017-01-05 10:54:57 -05002415 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002416 sources = [
2417 "tools/skdiff/skdiff.cpp",
2418 "tools/skdiff/skdiff_html.cpp",
2419 "tools/skdiff/skdiff_main.cpp",
2420 "tools/skdiff/skdiff_utils.cpp",
2421 ]
2422 deps = [
2423 ":skia",
2424 ":tool_utils",
2425 ]
bungemanfe917272016-10-13 17:36:40 -04002426 }
halcanarya73d76a2016-10-17 13:19:02 -07002427
Mike Kleine6682eb2017-01-05 10:54:57 -05002428 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002429 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002430 deps = [
2431 ":skia",
2432 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002433 ]
halcanarya73d76a2016-10-17 13:19:02 -07002434 }
Brian Osman16adfa32016-10-18 14:42:44 -04002435
Brian Osmanc9a42472018-05-31 13:17:12 -04002436 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002437 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002438 check_includes = false
2439 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002440 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002441 defines =
2442 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002443 sources = [
2444 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002445 "tools/skqp/src/skqp.cpp",
2446 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002447 ]
2448 deps = [
2449 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002450 ":skia",
2451 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002452 ":tool_utils",
2453 ]
2454 }
2455 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002456 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002457 include_dirs = [ "//" ]
2458 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002459 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002460 }
2461 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002462 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002463 deps = [
2464 ":gm",
2465 ":skia",
2466 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002467 ]
2468 }
2469 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002470 if (is_fuchsia) {
2471 # Build a package repository for skqp on Fuchsia.
2472 group("skqp_repo") {
2473 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002474 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002475 }
2476 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002477 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002478 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002479 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002480 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002481 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002482 deps = [
2483 ":skia",
2484 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002485 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002486 ]
2487 libs = [ "android" ]
2488 }
2489 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002490 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002491 test_app("skottie_android") {
2492 is_shared_library = true
2493
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002494 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002495 libs = []
2496
Stan Iliev93151722018-08-02 11:10:52 -04002497 deps = [
2498 ":skia",
2499 "modules/skottie",
2500 ]
2501 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002502
2503 test_app("androidkit") {
2504 is_shared_library = true
2505
Florin Malita2a650cc2021-04-12 13:38:44 -04002506 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002507 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002508 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002509 "modules/androidkit/src/ColorFilters.cpp",
Jorge Betancourt151a6f32021-09-07 16:50:21 -04002510 "modules/androidkit/src/Font.cpp",
Jorge Betancourtaa9656d2021-10-14 14:02:08 -04002511 "modules/androidkit/src/FontChainAdapter.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002512 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002513 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002514 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002515 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002516 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002517 "modules/androidkit/src/Path.cpp",
2518 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002519 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2520 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002521 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002522 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002523 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002524 "modules/androidkit/src/SurfaceThread.cpp",
2525 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002526 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002527 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002528 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002529 libs = [
2530 "android",
2531 "jnigraphics",
2532 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002533
Florin Malita2cc65382021-04-26 21:59:35 -04002534 deps = [
2535 ":sk_app",
2536 ":skia",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002537 "experimental/sktext:sktext",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002538 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002539 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002540 }
Stan Iliev93151722018-08-02 11:10:52 -04002541 }
Hal Canary75427132017-10-11 16:00:31 -04002542
Hal Canarya9de7602018-01-19 13:08:23 -05002543 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002544 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002545 deps = [
2546 ":gm",
2547 ":skia",
2548 ]
2549 }
2550 test_app("list_gpu_unit_tests") {
2551 sources = [
2552 "dm/DMGpuTestProcs.cpp",
2553 "tools/list_gpu_unit_tests.cpp",
2554 ]
2555 deps = [
2556 ":skia",
2557 ":tests",
2558 ]
2559 }
2560
Brian Osmanc9a42472018-05-31 13:17:12 -04002561 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002562 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002563 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002564 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002565 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002566 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002567 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002568 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002569 "tools/sk_app/CommandSet.h",
2570 "tools/sk_app/DisplayParams.h",
2571 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002572 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002573 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002574 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002575 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002576 ]
2577 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002578 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002579
2580 if (is_android) {
2581 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002582 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002583 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002584 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002585 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002586 "tools/sk_app/android/main_android.cpp",
2587 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002588 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002589 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002590 libs += [ "android" ]
2591 } else if (is_linux) {
2592 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002593 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002594 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002595 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002596 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002597 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002598 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002599 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002600 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002601 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002602 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002603 "X11",
2604 ]
2605 } else if (is_win) {
2606 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002607 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002608 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002609 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002610 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002611 "tools/sk_app/win/main_win.cpp",
2612 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002613 } else if (is_mac) {
2614 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002615 "tools/sk_app/mac/WindowContextFactory_mac.h",
2616 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002617 "tools/sk_app/mac/Window_mac.mm",
2618 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002619 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002620 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002621 "QuartzCore.framework",
2622 "Cocoa.framework",
2623 "Foundation.framework",
2624 ]
2625 } else if (is_ios) {
2626 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002627 "tools/sk_app/ios/WindowContextFactory_ios.h",
2628 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002629 "tools/sk_app/ios/Window_ios.mm",
2630 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002631 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002632 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002633 }
2634
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002635 if (skia_use_gl) {
2636 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002637 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002638 if (is_android) {
2639 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2640 } else if (is_linux) {
2641 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2642 } else if (is_win) {
2643 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2644 if (skia_use_angle) {
2645 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2646 }
2647 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002648 sources += [
2649 "tools/sk_app/mac/GLWindowContext_mac.mm",
2650 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2651 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002652 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002653 sources += [
2654 "tools/sk_app/ios/GLWindowContext_ios.mm",
2655 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2656 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002657 }
2658 }
2659
Brian Osmanc9a42472018-05-31 13:17:12 -04002660 if (skia_use_vulkan) {
2661 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002662 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002663 if (is_android) {
2664 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2665 } else if (is_linux) {
2666 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2667 libs += [ "X11-xcb" ]
2668 } else if (is_win) {
2669 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2670 }
2671 }
2672
Jim Van Verthbe39f712019-02-08 15:36:14 -05002673 if (skia_use_metal) {
2674 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002675 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002676 if (skia_enable_graphite) {
2677 sources += [ "tools/sk_app/GraphiteMetalWindowContext.mm" ]
2678 sources += [ "tools/sk_app/GraphiteMetalWindowContext.h" ]
2679 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002680 if (is_mac) {
2681 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002682 if (skia_enable_graphite) {
2683 sources += [ "tools/sk_app/mac/GraphiteMetalWindowContext_mac.mm" ]
2684 }
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002685 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002686 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002687 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002688 }
2689
Jim Van Verth682a2f42020-05-13 16:54:09 -04002690 if (skia_use_direct3d) {
2691 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2692 }
2693
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002694 if (skia_use_dawn) {
2695 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002696 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002697 if (is_linux) {
2698 if (dawn_enable_vulkan) {
2699 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2700 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2701 libs += [ "X11-xcb" ]
2702 }
2703 } else if (is_win) {
2704 if (dawn_enable_d3d12) {
2705 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2706 }
2707 } else if (is_mac) {
2708 if (dawn_enable_metal) {
2709 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2710 }
2711 }
2712 }
2713
Mike Kleina01c6b02020-04-01 13:47:34 -05002714 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002715 if (is_android) {
2716 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002717 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002718 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002719 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002720 }
Brian Osman16adfa32016-10-18 14:42:44 -04002721 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002722
Hal Canary87515122019-03-15 14:22:51 -04002723 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2724 test_app("fiddle_examples") {
2725 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002726 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002727 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002728 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002729 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002730 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002731 cflags = [
2732 "/wd4756", # Overflow in constant arithmetic
2733 "/wd4305", # truncation from 'double' to 'float'
2734 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002735 }
Hal Canary87515122019-03-15 14:22:51 -04002736 deps = [
2737 ":skia",
2738 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002739 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002740 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002741 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002742 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002743 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002744 ]
2745 }
2746 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002747
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002748 # sk_app can work without GL but viewer always runs raster through a GL window context.
2749 if (skia_use_gl) {
2750 test_app("viewer") {
2751 is_shared_library = is_android
2752 sources = [
2753 "tools/viewer/AnimTimer.h",
2754 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002755 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002756 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002757 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002758 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002759 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002760 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002761 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002762 "tools/viewer/MSKPSlide.cpp",
2763 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002764 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002765 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002766 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002767 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002768 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002769 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002770 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002771 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002772 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002773 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002774 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002775 "tools/viewer/SkottieSlide.h",
2776 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002777 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002778 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002779 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002780 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002781 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002782 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002783 "tools/viewer/TouchGesture.cpp",
2784 "tools/viewer/TouchGesture.h",
2785 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002786 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002787 ]
2788 libs = []
2789
2790 deps = [
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002791 ":common_flags_fontmgr",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002792 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002793 ":flags",
2794 ":gm",
2795 ":gpu_tool_utils",
2796 ":samples",
2797 ":sk_app",
2798 ":skia",
2799 ":tool_utils",
2800 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002801 "experimental/skrive",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002802 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002803 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002804 "modules/particles",
2805 "modules/skottie",
2806 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002807 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002808 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002809 "//third_party/imgui",
2810 ]
2811 if (skia_use_experimental_xform) {
2812 deps += [ ":experimental_xform" ]
2813 sources += [ "gm/xform.cpp" ]
2814 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002815 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002816 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002817 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002818
Corentin Wallez89d6e792021-03-08 15:25:34 +01002819 #spvtools depends on this but doesn't deps it in.
2820 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002821 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002822 }
Mike Reedd62d4062019-06-12 10:20:44 -04002823 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002824 }
2825
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002826 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002827 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002828 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002829 libs = []
2830
Brian Osmaneff04b52017-11-21 13:18:02 -05002831 deps = [
2832 ":flags",
2833 ":gpu_tool_utils",
2834 ":sk_app",
2835 ":skia",
2836 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002837 ]
2838 }
2839 }
2840
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002841 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2842 action_foreach("generate_mocs") {
2843 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002844 sources = [ "tools/mdbviz/MainWindow.h" ]
2845 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002846 args = [
2847 "$skia_qt_path" + "/bin/moc",
2848 "{{source}}",
2849 "-o",
2850 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2851 ]
2852 }
2853 action_foreach("generate_resources") {
2854 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002855 sources = [ "tools/mdbviz/resources.qrc" ]
2856 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002857 args = [
2858 "$skia_qt_path" + "/bin/rcc",
2859 "{{source}}",
2860 "-o",
2861 "gen/mdbviz/{{source_name_part}}_res.cpp",
2862 ]
2863 }
2864 test_app("mdbviz") {
2865 if (is_win) {
2866 # on Windows we need to disable some exception handling warnings due to the Qt headers
2867 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2868 }
2869 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002870 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002871 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002872 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002873 "tools/debugger/DrawCommand.cpp",
2874 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002875 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002876 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002877 "tools/mdbviz/main.cpp",
2878
2879 # generated files
2880 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2881 "$target_gen_dir/mdbviz/resources_res.cpp",
2882 ]
2883 lib_dirs = [ "$skia_qt_path/lib" ]
2884 libs = [
2885 "Qt5Core.lib",
2886 "Qt5Gui.lib",
2887 "Qt5Widgets.lib",
2888 ]
2889 include_dirs = [
2890 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002891 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002892 "$skia_qt_path/include/QtWidgets",
2893 ]
2894 deps = [
2895 ":generate_mocs",
2896 ":generate_resources",
2897 ":skia",
2898 ]
2899 }
2900 }
2901
Mike Kleine459afd2017-03-03 09:21:30 -05002902 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002903 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002904 sources = [ "$ndk/$ndk_gdbserver" ]
2905 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002906 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002907 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002908
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002909 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002910 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002911 deps = [
2912 ":skia",
2913 "modules/particles",
2914 ]
2915 }
2916
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002917 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002918 test_app("editor") {
2919 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002920 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002921 }
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002922 test_app("text_editor") {
2923 is_shared_library = is_android
2924 deps = [ "experimental/sktext:text_editor" ]
2925 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002926 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002927
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002928 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002929 sources = [ "tools/image_diff_metric.cpp" ]
2930 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002931 }
Chris Dalton2b598902020-03-25 10:50:35 -06002932
2933 group("modules_testonly") {
2934 testonly = true
2935 deps = []
2936 if (target_cpu == "wasm") {
2937 deps += [ "modules/canvaskit:viewer_wasm" ]
2938 }
2939 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002940
2941 if (skia_build_fuzzers) {
2942 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002943 skia_executable(target_name) {
2944 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002945 check_includes = false
2946 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002947 if (!defined(configs)) {
2948 configs = []
2949 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002950 configs += [ ":skia_private" ]
2951 sources += [
2952 "fuzz/Fuzz.cpp",
2953 "fuzz/FuzzCommon.cpp",
2954 ]
2955 deps += [
2956 ":flags",
2957 ":gpu_tool_utils",
2958 ":skia",
2959 ]
2960 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2961 if (skia_use_libfuzzer_defaults) {
2962 cflags = [ "-fsanitize=fuzzer" ]
2963 ldflags = [ "-fsanitize=fuzzer" ]
2964 }
2965 testonly = true
2966 }
2967 }
2968
2969 libfuzzer_app("region_deserialize") {
2970 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2971 deps = []
2972 }
2973
2974 libfuzzer_app("image_filter_deserialize") {
2975 include_dirs = [
2976 "tools",
2977 "tools/fonts",
2978 ]
2979 sources = [
2980 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2981 "tools/Resources.cpp",
2982 "tools/fonts/TestFontMgr.cpp",
2983 "tools/fonts/TestSVGTypeface.cpp",
2984 "tools/fonts/TestTypeface.cpp",
2985 ]
Florin Malitab3418102020-10-15 18:10:29 -04002986 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002987 }
2988
2989 libfuzzer_app("region_set_path") {
2990 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2991 deps = []
2992 }
2993
2994 libfuzzer_app("textblob_deserialize") {
2995 include_dirs = [
2996 "tools",
2997 "tools/fonts",
2998 ]
2999 sources = [
3000 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
3001 "tools/Resources.cpp",
3002 "tools/fonts/TestFontMgr.cpp",
3003 "tools/fonts/TestSVGTypeface.cpp",
3004 "tools/fonts/TestTypeface.cpp",
3005 ]
Florin Malitab3418102020-10-15 18:10:29 -04003006 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003007 }
3008
3009 libfuzzer_app("path_deserialize") {
3010 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
3011 deps = []
3012 }
3013
3014 libfuzzer_app("image_decode") {
3015 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3016 deps = []
3017 }
3018
3019 libfuzzer_app("animated_image_decode") {
3020 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3021 deps = []
3022 }
3023
3024 libfuzzer_app("api_create_ddl") {
3025 include_dirs = [
3026 "include",
3027 "include/gpu",
3028 ]
3029 sources = [
3030 "fuzz/FuzzCreateDDL.cpp",
3031 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3032 "tools/Resources.cpp",
3033 "tools/UrlDataManager.cpp",
3034 "tools/debugger/DebugCanvas.cpp",
3035 "tools/debugger/DebugLayerManager.cpp",
3036 "tools/debugger/DrawCommand.cpp",
3037 "tools/debugger/JsonWriteBuffer.cpp",
3038 "tools/fonts/TestFontMgr.cpp",
3039 "tools/fonts/TestSVGTypeface.cpp",
3040 "tools/fonts/TestTypeface.cpp",
3041 ]
3042 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003043 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003044 "//third_party/libpng",
3045 ]
3046 }
3047
3048 libfuzzer_app("api_draw_functions") {
3049 sources = [
3050 "fuzz/FuzzDrawFunctions.cpp",
3051 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3052 ]
3053 deps = []
3054 }
3055
Adlai Hollerccb68662021-02-25 10:28:44 -05003056 libfuzzer_app("api_ddl_threading") {
3057 sources = [
3058 "fuzz/FuzzDDLThreading.cpp",
3059 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3060 ]
3061 deps = []
3062 }
3063
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003064 libfuzzer_app("api_gradients") {
3065 sources = [
3066 "fuzz/FuzzGradients.cpp",
3067 "fuzz/oss_fuzz/FuzzGradients.cpp",
3068 ]
3069 deps = []
3070 }
3071
3072 libfuzzer_app("api_image_filter") {
3073 include_dirs = [
3074 "tools",
3075 "tools/debugger",
3076 ]
3077 sources = [
3078 "fuzz/FuzzCanvas.cpp",
3079 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3080 "tools/UrlDataManager.cpp",
3081 "tools/debugger/DebugCanvas.cpp",
3082 "tools/debugger/DebugLayerManager.cpp",
3083 "tools/debugger/DrawCommand.cpp",
3084 "tools/debugger/JsonWriteBuffer.cpp",
3085 ]
3086 deps = [ "//third_party/libpng" ]
3087 }
3088
3089 libfuzzer_app("api_path_measure") {
3090 sources = [
3091 "fuzz/FuzzPathMeasure.cpp",
3092 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3093 ]
3094 deps = []
3095 }
3096
3097 libfuzzer_app("api_pathop") {
3098 sources = [
3099 "fuzz/FuzzPathop.cpp",
3100 "fuzz/oss_fuzz/FuzzPathop.cpp",
3101 ]
3102 deps = []
3103 }
3104
Robert Phillips98b066c2021-04-22 10:51:58 -04003105 libfuzzer_app("api_triangulation") {
3106 sources = [
3107 "fuzz/FuzzTriangulation.cpp",
3108 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3109 ]
3110 deps = []
3111 }
3112
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003113 libfuzzer_app("api_raster_n32_canvas") {
3114 include_dirs = [
3115 "tools",
3116 "tools/debugger",
3117 "tools/fonts",
3118 ]
3119 sources = [
3120 "fuzz/FuzzCanvas.cpp",
3121 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3122 "tools/Resources.cpp",
3123 "tools/UrlDataManager.cpp",
3124 "tools/debugger/DebugCanvas.cpp",
3125 "tools/debugger/DebugLayerManager.cpp",
3126 "tools/debugger/DrawCommand.cpp",
3127 "tools/debugger/JsonWriteBuffer.cpp",
3128 "tools/fonts/TestFontMgr.cpp",
3129 "tools/fonts/TestSVGTypeface.cpp",
3130 "tools/fonts/TestTypeface.cpp",
3131 ]
3132 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003133 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003134 "//third_party/libpng",
3135 ]
3136 }
3137
Kevin Lubick7845b972021-03-29 08:07:32 -04003138 libfuzzer_app("api_regionop") {
3139 sources = [
3140 "fuzz/FuzzRegionOp.cpp",
3141 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3142 ]
3143 deps = []
3144 }
3145
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003146 if (skia_use_gl) {
3147 libfuzzer_app("api_mock_gpu_canvas") {
3148 include_dirs = [
3149 "tools",
3150 "tools/debugger",
3151 "tools/fonts",
3152 ]
3153 sources = [
3154 "fuzz/FuzzCanvas.cpp",
3155 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3156 "tools/LsanSuppressions.cpp",
3157 "tools/Resources.cpp",
3158 "tools/UrlDataManager.cpp",
3159 "tools/debugger/DebugCanvas.cpp",
3160 "tools/debugger/DebugLayerManager.cpp",
3161 "tools/debugger/DrawCommand.cpp",
3162 "tools/debugger/JsonWriteBuffer.cpp",
3163 "tools/fonts/TestFontMgr.cpp",
3164 "tools/fonts/TestSVGTypeface.cpp",
3165 "tools/fonts/TestTypeface.cpp",
3166 ]
3167 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003168 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003169 "//third_party/libpng",
3170 ]
3171 }
3172 }
3173
3174 libfuzzer_app("api_null_canvas") {
3175 include_dirs = [
3176 "tools",
3177 "tools/debugger",
3178 "tools/fonts",
3179 ]
3180 sources = [
3181 "fuzz/FuzzCanvas.cpp",
3182 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3183 "tools/Resources.cpp",
3184 "tools/UrlDataManager.cpp",
3185 "tools/debugger/DebugCanvas.cpp",
3186 "tools/debugger/DebugLayerManager.cpp",
3187 "tools/debugger/DrawCommand.cpp",
3188 "tools/debugger/JsonWriteBuffer.cpp",
3189 "tools/fonts/TestFontMgr.cpp",
3190 "tools/fonts/TestSVGTypeface.cpp",
3191 "tools/fonts/TestTypeface.cpp",
3192 ]
3193 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003194 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003195 "//third_party/libpng",
3196 ]
3197 }
3198
Weston Tracey1a771fe2021-02-04 11:09:59 -05003199 libfuzzer_app("api_skparagraph") {
3200 sources = [
3201 "fuzz/FuzzSkParagraph.cpp",
3202 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3203 "tools/Resources.cpp",
3204 ]
3205 deps = [ "modules/skparagraph" ]
3206 }
3207
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003208 libfuzzer_app("api_svg_canvas") {
3209 include_dirs = [
3210 "include",
3211 "include/svg",
3212 ]
3213 sources = [
3214 "fuzz/FuzzCanvas.cpp",
3215 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3216 "tools/Resources.cpp",
3217 "tools/UrlDataManager.cpp",
3218 "tools/debugger/DebugCanvas.cpp",
3219 "tools/debugger/DebugLayerManager.cpp",
3220 "tools/debugger/DrawCommand.cpp",
3221 "tools/debugger/JsonWriteBuffer.cpp",
3222 "tools/fonts/TestFontMgr.cpp",
3223 "tools/fonts/TestSVGTypeface.cpp",
3224 "tools/fonts/TestTypeface.cpp",
3225 ]
3226 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003227 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003228 "//third_party/libpng",
3229 ]
3230 }
3231
3232 libfuzzer_app("png_encoder") {
3233 sources = [
3234 "fuzz/FuzzEncoders.cpp",
3235 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3236 ]
3237 deps = []
3238 }
3239
3240 libfuzzer_app("jpeg_encoder") {
3241 sources = [
3242 "fuzz/FuzzEncoders.cpp",
3243 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3244 ]
3245 deps = []
3246 }
3247
3248 libfuzzer_app("webp_encoder") {
3249 sources = [
3250 "fuzz/FuzzEncoders.cpp",
3251 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3252 ]
3253 deps = []
3254 }
3255
3256 libfuzzer_app("skottie_json") {
3257 sources = [
3258 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3259 "tools/Resources.cpp",
3260 "tools/fonts/TestFontMgr.cpp",
3261 "tools/fonts/TestSVGTypeface.cpp",
3262 "tools/fonts/TestTypeface.cpp",
3263 ]
3264 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003265 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003266 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003267 ]
3268 }
3269
3270 libfuzzer_app("skjson") {
3271 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3272 deps = []
3273 }
3274
3275 libfuzzer_app("api_polyutils") {
3276 sources = [
3277 "fuzz/FuzzPolyUtils.cpp",
3278 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3279 ]
3280 deps = [ ":skia" ]
3281 }
3282
3283 libfuzzer_app("android_codec") {
3284 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3285 deps = []
3286 }
3287
3288 libfuzzer_app("image_decode_incremental") {
3289 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3290 deps = []
3291 }
3292
3293 libfuzzer_app("sksl2glsl") {
3294 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3295 deps = []
3296 }
3297
3298 libfuzzer_app("sksl2spirv") {
3299 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3300 deps = []
3301 }
3302
3303 libfuzzer_app("sksl2metal") {
3304 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3305 deps = []
3306 }
3307
3308 libfuzzer_app("sksl2pipeline") {
3309 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3310 deps = []
3311 }
3312
3313 libfuzzer_app("skdescriptor_deserialize") {
3314 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3315 deps = []
3316 }
3317
3318 libfuzzer_app("svg_dom") {
3319 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003320 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003321 }
3322
3323 libfuzzer_app("skruntimeeffect") {
3324 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3325 deps = []
3326 }
3327
3328 libfuzzer_app("skp") {
3329 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3330 deps = []
3331 }
3332 }
mtklein25c81d42016-07-27 13:55:26 -07003333}
Hal Canary932a2c02019-09-17 10:43:18 -04003334
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003335if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003336 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003337 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003338 }
Hal Canary27483062019-12-06 15:01:08 -05003339}
3340
Hal Canary60ff6512020-01-21 12:39:20 -05003341if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003342 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003343 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003344 }
3345}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003346
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003347skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003348 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3349 include_dirs = [ "." ]
3350 deps = [ ":skia" ]
3351}