blob: 0b72cde301ea68940eaba2e7189e41cfd1bcb6c5 [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")
Kevin Lubickc13cd642022-02-14 15:08:12 -050010import("gn/toolchain/wasm.gni")
Hal Canary45812a12019-09-04 08:58:59 -040011
John Rosasco24cbdab2019-09-25 14:14:35 -070012if (is_fuchsia) {
13 import("//build/fuchsia/sdk.gni")
14 import("build/fuchsia/fuchsia_download_sdk.gni")
15}
16
Stephen White0d70b712019-07-10 15:51:30 -040017if (skia_use_dawn) {
Brian Salomonc3915f72021-11-15 19:08:02 +000018 import("//third_party/externals/dawn/scripts/dawn_features.gni")
Stephen White0d70b712019-07-10 15:51:30 -040019}
20
Adam Barth54ef74a2017-10-13 10:59:38 -070021if (defined(skia_settings)) {
22 import(skia_settings)
23}
24
Hal Canary3388c1a2019-09-16 12:53:17 -040025import("gn/ios.gni")
26
mtkleinc04ff472016-06-23 10:29:30 -070027# Skia public API, generally provided by :skia.
28config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050029 include_dirs = [ "." ]
30
Mike Kleinae7e6712016-10-11 17:49:33 -040031 defines = []
Chinmay Gardef832c0a2020-03-18 14:37:23 -070032 cflags_objcc = []
Mike Kleinae7e6712016-10-11 17:49:33 -040033 if (is_component_build) {
34 defines += [ "SKIA_DLL" ]
35 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040036 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050037 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070038 }
Brian Osmanf2c90142017-07-13 15:50:03 -040039 if (skia_enable_flutter_defines) {
40 defines += flutter_defines
41 }
mtklein06c35c02016-09-20 12:28:12 -070042 if (!skia_enable_gpu) {
43 defines += [ "SK_SUPPORT_GPU=0" ]
44 }
Brian Osman946a4cb2021-07-12 17:02:21 -040045 if (skia_enable_sksl) {
46 defines += [ "SK_ENABLE_SKSL" ]
47 }
Mike Reed025f7832018-11-12 09:27:05 -050048 if (is_fuchsia) {
49 defines += fuchsia_defines
50 }
Kevin Lubickc13cd642022-02-14 15:08:12 -050051 if (is_wasm) {
52 defines += wasm_defines
53 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040054 if (skia_gl_standard == "gles") {
55 defines += [ "SK_ASSUME_GL_ES=1" ]
56 } else if (skia_gl_standard == "gl") {
57 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040058 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040059 defines += [
60 "SK_ASSUME_WEBGL=1",
61 "SK_USE_WEBGL",
62 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040063 }
Robert Phillips024668c2021-07-01 12:12:52 -040064 if (!skia_enable_skgpu_v1) {
Robert Phillips7cef6782021-07-01 13:21:37 -040065 defines += [ "SK_GPU_V1=0" ]
Robert Phillips3b97aa22021-05-03 11:42:40 -040066 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070067
68 # Some older versions of the Clang toolchain change the visibility of
69 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
70 # toolchains suppress the use of this macro till toolchain updates are made.
71 if (is_mac || is_ios) {
72 if (skia_enable_api_available_macro) {
73 defines += [ "SK_ENABLE_API_AVAILABLE" ]
74 } else {
75 cflags_objcc += [ "-Wno-unguarded-availability" ]
76 }
77 }
mtkleinc04ff472016-06-23 10:29:30 -070078}
79
80# Skia internal APIs, used by Skia itself and a few test tools.
81config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060082 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070083
Mike Reeda9e241d2017-05-03 10:52:00 -040084 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050085 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070086 defines += [
87 "SK_GAMMA_EXPONENT=1.4",
88 "SK_GAMMA_CONTRAST=0.0",
89 ]
90 }
Kevin Lubickc13cd642022-02-14 15:08:12 -050091 if (is_skia_dev_build && !is_wasm) {
Mike Kleinb45d8622019-04-24 14:04:01 -050092 defines += [
93 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
94 "GR_TEST_UTILS=1",
95 ]
Jim Van Verth0c56bba2021-10-18 12:15:47 -040096 if (skia_enable_graphite) {
97 defines += [ "GRAPHITE_TEST_UTILS=1" ]
98 }
mtklein88a7ac02016-09-14 11:16:49 -070099 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400100 libs = []
101 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400102 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -0500103 defines += [ "SK_ANGLE" ]
104 }
Greg Danielb16beb92020-04-27 14:26:21 +0000105 if (skia_use_vma) {
106 defines += [ "SK_USE_VMA" ]
107 }
James Clarkeb8c0dab2021-02-09 06:22:41 -0800108 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -0800109 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800110 }
111}
112
mtkleinc04ff472016-06-23 10:29:30 -0700113# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
114config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600115 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000116 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700117}
118
119skia_library_configs = [
120 ":skia_public",
121 ":skia_private",
122 ":skia_library",
123]
124
mtklein9b8583d2016-08-24 17:32:30 -0700125# Use for CPU-specific Skia code that needs particular compiler flags.
126template("opts") {
127 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400128 skia_source_set(target_name) {
129 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500130 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400131 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700132 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400133 if (defined(invoker.configs)) {
134 configs += invoker.configs
135 }
mtklein9b8583d2016-08-24 17:32:30 -0700136 }
137 } else {
138 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400139 skia_source_set(target_name) {
140 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500141 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700142 forward_variables_from(invoker,
143 "*",
144 [
145 "sources",
146 "cflags",
147 ])
148 }
149 }
anmittala7eaf2e2016-08-17 13:57:26 -0700150}
151
mtklein422310d2016-08-16 18:28:43 -0700152is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700153
mtklein7d6fb2c2016-08-25 14:50:44 -0700154opts("none") {
155 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700156 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700157 cflags = []
158}
159
mtklein7d6fb2c2016-08-25 14:50:44 -0700160opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700161 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700162 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700163 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700164}
165
166opts("arm64") {
167 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700168 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700169 cflags = []
170}
171
172opts("crc32") {
173 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700174 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700175 cflags = [ "-march=armv8-a+crc" ]
176}
177
mtklein9b8583d2016-08-24 17:32:30 -0700178opts("sse2") {
179 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400181 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400182 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
183 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400184 cflags = [ "-msse2" ]
185 }
mtklein9b8583d2016-08-24 17:32:30 -0700186}
mtkleinc04ff472016-06-23 10:29:30 -0700187
mtklein9b8583d2016-08-24 17:32:30 -0700188opts("ssse3") {
189 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700190 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400191 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400192 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
193 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400194 cflags = [ "-mssse3" ]
195 }
mtklein9b8583d2016-08-24 17:32:30 -0700196}
mtkleinc04ff472016-06-23 10:29:30 -0700197
mtklein9b8583d2016-08-24 17:32:30 -0700198opts("sse41") {
199 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700200 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400201 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400202 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
203 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400204 cflags = [ "-msse4.1" ]
205 }
mtklein9b8583d2016-08-24 17:32:30 -0700206}
mtklein4e976072016-08-08 09:06:27 -0700207
mtklein9b8583d2016-08-24 17:32:30 -0700208opts("sse42") {
209 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400211 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400212 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
213 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400214 cflags = [ "-msse4.2" ]
215 }
mtklein9b8583d2016-08-24 17:32:30 -0700216}
217
218opts("avx") {
219 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400221 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000222 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400223 } else {
224 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500225 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500226 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500227 }
Mike Klein3eb71212016-10-11 17:08:53 -0400228 }
mtkleinc04ff472016-06-23 10:29:30 -0700229}
230
Mike Klein1b9b7d52018-02-27 10:37:40 -0500231opts("hsw") {
232 enabled = is_x86
233 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400234 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500235 cflags = [ "/arch:AVX2" ]
236 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000237 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600238 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500239 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600240 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500241 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500242}
243
Mike Kleinad56c4c2020-06-05 06:57:30 -0500244opts("skx") {
245 enabled = is_x86
246 sources = skia_opts.skx_sources
247 if (is_win) {
248 cflags = [ "/arch:AVX512" ]
249 } else {
250 cflags = [ "-march=skylake-avx512" ]
251 if (is_mac && is_debug) {
252 cflags += [ "-fno-stack-check" ] # Work around skia:9709
253 }
254 }
255}
256
mtkleinc095df52016-08-24 12:23:52 -0700257# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700258template("optional") {
259 if (invoker.enabled) {
260 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700261 if (defined(invoker.public_defines)) {
262 defines = invoker.public_defines
263 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600264 if (defined(invoker.public_configs)) {
265 configs = invoker.public_configs
266 }
Hal Canary2dad9902019-11-20 16:01:31 -0500267 if (defined(invoker.public_include_dirs)) {
268 include_dirs = invoker.public_include_dirs
269 }
mtklein457b42a2016-08-23 13:56:37 -0700270 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400271 skia_source_set(target_name) {
272 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500273 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400274 configs = skia_library_configs
275
276 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700277 forward_variables_from(invoker,
278 "*",
279 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400280 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700281 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500282 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700283 "sources_when_disabled",
284 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400285 if (defined(invoker.configs)) {
286 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700287 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400288 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700289 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500290 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400291 skia_source_set(target_name + "_tests") {
292 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500293 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400294 configs = skia_library_configs
295
296 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500297 forward_variables_from(invoker,
298 "*",
299 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400300 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500301 "public_defines",
302 "sources",
303 "sources_for_tests",
304 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500305 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400306 if (defined(invoker.configs)) {
307 configs += invoker.configs
308 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500309 testonly = true
310 sources = invoker.sources_for_tests
311 if (!defined(deps)) {
312 deps = []
313 }
314 deps += [ ":test" ]
315 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500316 }
317 }
mtklein457b42a2016-08-23 13:56:37 -0700318 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400319 skia_source_set(target_name) {
320 visibility = [ ":*" ]
321 configs = skia_library_configs
322
323 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700324 forward_variables_from(invoker,
325 "*",
326 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400327 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400328 "public",
mtklein457b42a2016-08-23 13:56:37 -0700329 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400330 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700331 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700332 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400333 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700334 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500335 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700336 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700337 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400338 if (defined(invoker.configs)) {
339 configs += invoker.configs
340 }
mtkleincd01b032016-08-31 04:58:19 -0700341 if (defined(invoker.sources_when_disabled)) {
342 sources = invoker.sources_when_disabled
343 }
mtklein457b42a2016-08-23 13:56:37 -0700344 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500345 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400346 skia_source_set(target_name + "_tests") {
347 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500348 }
349 }
mtkleineb3c4252016-08-23 07:38:09 -0700350 }
mtklein457b42a2016-08-23 13:56:37 -0700351}
mtklein457b42a2016-08-23 13:56:37 -0700352
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400353optional("android_utils") {
354 enabled = skia_enable_android_utils
355
Leon Scroggins III87caae62020-05-04 10:02:45 -0400356 public = [
357 "client_utils/android/BRDAllocator.h",
358 "client_utils/android/BitmapRegionDecoder.h",
359 "client_utils/android/FrontBufferedStream.h",
360 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400361 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400362 sources = [
363 "client_utils/android/BitmapRegionDecoder.cpp",
364 "client_utils/android/FrontBufferedStream.cpp",
365 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400366}
367
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400368group("fontmgr_factory") {
369 public_deps = [ skia_fontmgr_factory ]
370}
371
372optional("fontmgr_empty_factory") {
373 enabled = true
374 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400375}
376
mtkleina45be612016-08-29 15:22:10 -0700377optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500378 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700382 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700383 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400384 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700385 sources = [
386 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700387 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400388 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700389 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500390 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700391}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400392optional("fontmgr_android_factory") {
393 enabled = skia_enable_fontmgr_android
394 deps = [ ":fontmgr_android" ]
395 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
396}
mtkleina45be612016-08-29 15:22:10 -0700397
mtkleind2e39db2016-09-07 07:52:55 -0700398optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400399 enabled =
400 skia_enable_fontmgr_custom_directory ||
401 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700402
Mike Kleina01c6b02020-04-01 13:47:34 -0500403 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400404 public = [ "src/ports/SkFontMgr_custom.h" ]
405 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
406}
407
408optional("fontmgr_custom_directory") {
409 enabled = skia_enable_fontmgr_custom_directory
410
411 deps = [
412 ":fontmgr_custom",
413 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700414 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400415 public = [ "include/ports/SkFontMgr_directory.h" ]
416 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
417}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400418optional("fontmgr_custom_directory_factory") {
419 enabled = skia_enable_fontmgr_custom_directory
420 deps = [ ":fontmgr_custom_directory" ]
421 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
422}
Ben Wagner75626e42020-06-03 13:20:37 -0400423
424optional("fontmgr_custom_embedded") {
425 enabled = skia_enable_fontmgr_custom_embedded
426
427 deps = [
428 ":fontmgr_custom",
429 ":typeface_freetype",
430 ]
431 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700432}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400433optional("fontmgr_custom_embedded_factory") {
434 enabled = skia_enable_fontmgr_custom_embedded
435 deps = [ ":fontmgr_custom_embedded" ]
436 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
437}
mtkleind2e39db2016-09-07 07:52:55 -0700438
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500439optional("fontmgr_custom_empty") {
440 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500441
Ben Wagner75626e42020-06-03 13:20:37 -0400442 deps = [
443 ":fontmgr_custom",
444 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800445 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400446 public = [ "include/ports/SkFontMgr_empty.h" ]
447 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500448}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400449optional("fontmgr_custom_empty_factory") {
450 enabled = skia_enable_fontmgr_custom_empty
451 deps = [ ":fontmgr_custom_empty" ]
452 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
453}
Hal Canaryff2742e2018-01-30 11:35:47 -0500454
mtklein3cc22182016-08-29 13:26:14 -0700455optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400456 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700457
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400458 # The public header includes fontconfig.h and uses FcConfig*
459 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400460 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400461 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400462 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500463 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400464}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400465optional("fontmgr_fontconfig_factory") {
466 enabled = skia_enable_fontmgr_fontconfig
467 deps = [ ":fontmgr_fontconfig" ]
468 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
469}
Ben Wagner75626e42020-06-03 13:20:37 -0400470
471optional("fontmgr_FontConfigInterface") {
472 enabled = skia_enable_fontmgr_FontConfigInterface
473
474 deps = [
475 ":typeface_freetype",
476 "//third_party:fontconfig",
477 ]
478 public = [
479 "include/ports/SkFontConfigInterface.h",
480 "include/ports/SkFontMgr_FontConfigInterface.h",
481 ]
mtklein3cc22182016-08-29 13:26:14 -0700482 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700483 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700484 "src/ports/SkFontConfigInterface_direct.cpp",
485 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400486 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700487 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700488 ]
489}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400490optional("fontmgr_FontConfigInterface_factory") {
491 enabled = skia_enable_fontmgr_FontConfigInterface
492 deps = [ ":fontmgr_FontConfigInterface" ]
493 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
494}
mtklein3cc22182016-08-29 13:26:14 -0700495
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500496optional("fontmgr_fuchsia") {
497 enabled = skia_enable_fontmgr_fuchsia
498
Chinmay Garde89820762019-05-06 16:44:06 -0700499 deps = []
500
501 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700502 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700503 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500504 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700505 }
Ben Wagner75626e42020-06-03 13:20:37 -0400506 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
507 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500508}
509
Ben Wagner75626e42020-06-03 13:20:37 -0400510optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400511 enabled = skia_use_fonthost_mac
512
Ben Wagner75626e42020-06-03 13:20:37 -0400513 public = [
514 "include/ports/SkFontMgr_mac_ct.h",
515 "include/ports/SkTypeface_mac.h",
516 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400517 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400518 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400519 "src/ports/SkScalerContext_mac_ct.cpp",
520 "src/ports/SkScalerContext_mac_ct.h",
521 "src/ports/SkTypeface_mac_ct.cpp",
522 "src/ports/SkTypeface_mac_ct.h",
523 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000524 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400525
526 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400527 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400528 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
529 "AppKit.framework",
530 "ApplicationServices.framework",
531 ]
532 }
533
534 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400535 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400536 "CoreFoundation.framework",
537 "CoreGraphics.framework",
538 "CoreText.framework",
539
540 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
541 "UIKit.framework",
542 ]
543 }
544}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400545optional("fontmgr_mac_ct_factory") {
546 enabled = skia_use_fonthost_mac
547 deps = [ ":fontmgr_mac_ct" ]
548 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
549}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400550
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500551optional("fontmgr_win") {
552 enabled = skia_enable_fontmgr_win
553
Ben Wagner75626e42020-06-03 13:20:37 -0400554 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500555 sources = [
556 "src/fonts/SkFontMgr_indirect.cpp",
557 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500558 "src/ports/SkScalerContext_win_dw.cpp",
Ben Wagner66899512021-12-01 17:27:08 -0500559 "src/ports/SkScalerContext_win_dw.h",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500560 "src/ports/SkTypeface_win_dw.cpp",
Ben Wagner66899512021-12-01 17:27:08 -0500561 "src/ports/SkTypeface_win_dw.h",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500562 ]
563}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400564optional("fontmgr_win_factory") {
565 enabled = skia_enable_fontmgr_win
566 deps = [ ":fontmgr_win" ]
567 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
568}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500569
570optional("fontmgr_win_gdi") {
571 enabled = skia_enable_fontmgr_win_gdi
572
Ben Wagner75626e42020-06-03 13:20:37 -0400573 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500574 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500575 libs = [ "Gdi32.lib" ]
576}
577
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700578if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400579 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400580 sources = [
John Stiles97d9e472021-10-20 12:40:03 -0400581 "src/sksl/lex/DFA.h",
582 "src/sksl/lex/DFAState.h",
583 "src/sksl/lex/LexUtil.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400584 "src/sksl/lex/Main.cpp",
585 "src/sksl/lex/NFA.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400586 "src/sksl/lex/NFA.h",
587 "src/sksl/lex/NFAState.h",
588 "src/sksl/lex/NFAtoDFA.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400589 "src/sksl/lex/RegexNode.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400590 "src/sksl/lex/RegexNode.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400591 "src/sksl/lex/RegexParser.cpp",
John Stiles97d9e472021-10-20 12:40:03 -0400592 "src/sksl/lex/RegexParser.h",
593 "src/sksl/lex/TransitionTable.cpp",
594 "src/sksl/lex/TransitionTable.h",
Ethan Nicholasca82a922017-09-07 09:39:50 -0400595 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500596 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400597 }
598
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700599 action("run_sksllex") {
600 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500601 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
602 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700603
604 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
605 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
606 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500607 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700608 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
609 # confused due to the same file being named by two different paths
610 ]
611 sksllex_path = "$root_out_dir/"
612 sksllex_path += "sksllex"
613 if (host_os == "win") {
614 sksllex_path += ".exe"
615 }
616 args = [
617 rebase_path(sksllex_path),
618 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400619 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700620 rebase_path("src"),
621 ]
622 }
623} else {
624 group("run_sksllex") {
625 }
626}
627
Brian Osmaned5181e2021-07-01 13:54:20 -0400628# `Compile SkSL Tests` relies on skslc.
629if (skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400630 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500631 defines = [
632 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500633 "SK_DISABLE_TRACING",
Arman Ugurayb58bab12021-12-09 12:24:51 -0800634 "SK_ENABLE_SPIRV_CROSS",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500635 "SK_ENABLE_SPIRV_VALIDATION",
636 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400637 sources = [
John Stiles24e7ec72021-11-16 08:41:11 -0500638 "src/core/SkArenaAlloc.cpp",
Michael Ludwigc1ed11d2021-08-24 11:49:55 -0400639 "src/core/SkBlockAllocator.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500640 "src/core/SkCpu.cpp",
641 "src/core/SkData.cpp",
642 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400643 "src/core/SkMalloc.cpp",
644 "src/core/SkMath.cpp",
John Stilesfbd9fae2021-06-22 09:34:14 -0400645 "src/core/SkMatrixInvert.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400646 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500647 "src/core/SkStream.cpp",
648 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500649 "src/core/SkStringUtils.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400650 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500651 "src/core/SkUtils.cpp",
652 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400653 "src/gpu/GrMemoryPool.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400654 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500655 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400656 "src/sksl/SkSLMain.cpp",
John Stiles24e7ec72021-11-16 08:41:11 -0500657 "src/utils/SkJSON.cpp",
658 "src/utils/SkJSONWriter.cpp",
659 "src/utils/SkParse.cpp",
Jim Van Verthdb9f95c2021-12-10 17:27:10 -0500660 "src/utils/SkShaderUtils.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500661 "src/utils/SkUTF.cpp",
Julia Lavrova20187a22021-12-21 14:33:35 +0000662 "src/utils/SkVMVisualizer.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400663 ]
Julia Lavrova20187a22021-12-21 14:33:35 +0000664 libs = []
Brian Osman47726a12020-12-17 16:02:08 -0500665 if (is_win) {
666 sources += [ "src/ports/SkOSFile_win.cpp" ]
667 } else {
668 sources += [ "src/ports/SkOSFile_posix.cpp" ]
Julia Lavrova20187a22021-12-21 14:33:35 +0000669 libs += [ "dl" ]
Brian Osman47726a12020-12-17 16:02:08 -0500670 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400671 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400672 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500673 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400674 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500675 ":run_sksllex",
Julia Lavrova20187a22021-12-21 14:33:35 +0000676 ":skvm_jit",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100677 "//third_party/externals/spirv-tools:spvtools",
678 "//third_party/externals/spirv-tools:spvtools_val",
Arman Ugurayb58bab12021-12-09 12:24:51 -0800679 "//third_party/spirv-cross:spirv_cross",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400680 ]
681 }
682
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400683 skslc_path = "$root_out_dir/"
684 if (host_toolchain != default_toolchain_name) {
685 skslc_path += "$host_toolchain/"
686 }
687 skslc_path += "skslc"
688 if (host_os == "win") {
689 skslc_path += ".exe"
690 }
691
Brian Osmandd496172020-08-08 08:17:18 -0400692 copy("sksl_pre_includes") {
693 sources = [
694 "src/sksl/sksl_frag.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400695 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500696 "src/sksl/sksl_public.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400697 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400698 "src/sksl/sksl_vert.sksl",
699 ]
700 outputs = [ "$root_out_dir/{{source_file_part}}" ]
701 }
702
703 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
Brian Osmandd496172020-08-08 08:17:18 -0400704
705 dehydrate_sksl_outputs = []
706 foreach(src, dehydrate_sksl_sources) {
707 name = get_path_info(src, "name")
708
709 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
710 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
711 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
712 "src/sksl/generated/$name.dehydrated.sksl",
713 target_out_dir) ]
714 }
715
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400716 action("dehydrate_sksl") {
717 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400718 deps = [
Brian Osmandd496172020-08-08 08:17:18 -0400719 ":sksl_pre_includes",
720 ":skslc(//gn/toolchain:$host_toolchain)",
721 ]
722 sources = dehydrate_sksl_sources
723 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000724 args = [
725 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400726 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000727 ]
Brian Osmandd496172020-08-08 08:17:18 -0400728 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400729 }
John Stilesd836f842020-09-14 10:21:44 -0400730} else {
731 group("dehydrate_sksl") {
732 }
733}
734
John Stilesd836f842020-09-14 10:21:44 -0400735if (skia_compile_sksl_tests) {
736 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400737
John Stiles7e248712020-09-24 16:42:09 -0400738 template("compile_sksl") {
739 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
740 action("compile_sksl_${target_name}") {
741 script = "gn/compile_sksl_tests.py"
742 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400743 ":sksl_pre_includes",
744 ":skslc(//gn/toolchain:$host_toolchain)",
745 ]
John Stilesda57fc02021-01-22 11:54:30 -0500746 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400747 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500748 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500749 args = [
750 rebase_path(skslc_path),
751 invoker.lang,
752 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500753 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500754 ]
755
John Stilesbfc9be02021-01-22 11:55:48 -0500756 testsDir = get_path_info("tests", "abspath")
757 resourcesDir = get_path_info("resources", "abspath")
758
759 foreach(partialPath, invoker.sources) {
760 dst = testsDir + partialPath
761 src = resourcesDir + partialPath
762
763 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400764
765 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
766 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
767 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
768 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
769 nameTmp = get_path_info(dst, "name")
770 name = get_path_info(nameTmp, "name")
771 ext = get_path_info(nameTmp, "extension")
772 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500773 response_file_contents += rebase_path([
774 src,
775 dir,
776 ])
John Stilesda57fc02021-01-22 11:54:30 -0500777 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500778
John Stilesda57fc02021-01-22 11:54:30 -0500779 foreach(outExtension, invoker.outExtensions) {
Brian Osman99ddd2a2021-08-27 11:21:12 -0400780 # SPIR-V uses separate extensions for .vert shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400781 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500782 outExtension = ".asm.vert"
John Stilesc3012182020-12-08 15:07:00 -0500783 }
John Stilesbfc9be02021-01-22 11:55:48 -0500784 outputs +=
785 [ target_out_dir + "/" +
786 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400787 }
788 }
John Stiles7e248712020-09-24 16:42:09 -0400789 }
John Stilesd836f842020-09-14 10:21:44 -0400790 }
John Stiles7e248712020-09-24 16:42:09 -0400791 compile_sksl("glsl_tests") {
792 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500793 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400794 lang = "--glsl"
795 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400796 }
John Stiles7e248712020-09-24 16:42:09 -0400797 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400798 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500799 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400800 lang = "--glsl"
801 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400802 }
John Stilesaeae3a52020-09-25 13:35:58 -0400803 compile_sksl("metal_tests") {
804 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500805 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400806 lang = "--metal"
807 settings = "--settings"
808 }
Brian Osman977feec2020-12-22 11:28:59 -0500809 compile_sksl("skvm_tests") {
810 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500811 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500812 lang = "--skvm"
813 settings = "--settings"
814 }
Brian Osman62b039b2021-02-08 13:49:53 -0500815 compile_sksl("stage_tests") {
816 sources = sksl_stage_tests_sources
817 outExtensions = [ ".stage" ]
818 lang = "--stage"
819 settings = "--settings"
820 }
John Stilesdda1d312020-11-20 16:28:50 -0500821 compile_sksl("spirv_tests") {
822 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500823 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500824 lang = "--spirv"
825 settings = "--settings"
826 }
John Stilesd836f842020-09-14 10:21:44 -0400827} else {
John Stiles7e248712020-09-24 16:42:09 -0400828 group("compile_sksl_glsl_tests") {
829 }
830 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400831 }
John Stilesaeae3a52020-09-25 13:35:58 -0400832 group("compile_sksl_metal_tests") {
833 }
Brian Osman977feec2020-12-22 11:28:59 -0500834 group("compile_sksl_skvm_tests") {
835 }
John Stilesdda1d312020-11-20 16:28:50 -0500836 group("compile_sksl_spirv_tests") {
837 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400838}
839
Greg Daniel292bbb12021-11-03 16:25:41 -0400840optional("gpu_shared") {
841 enabled = skia_enable_gpu || skia_enable_graphite
842
843 sources = skia_shared_gpu_sources
844}
845
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500846optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700847 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400848 deps = [
John Stiles7e248712020-09-24 16:42:09 -0400849 ":compile_sksl_glsl_nosettings_tests",
850 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400851 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500852 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500853 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400854 ":dehydrate_sksl",
Greg Daniel292bbb12021-11-03 16:25:41 -0400855 ":gpu_shared",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700856 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400857 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700858 if (skia_generate_workarounds) {
859 deps += [ ":workaround_list" ]
860 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800861 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600862 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400863 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700864
Greg Daniel292bbb12021-11-03 16:25:41 -0400865 sources = skia_gpu_sources + skia_sksl_gpu_sources
Robert Phillips024668c2021-07-01 12:12:52 -0400866 if (!skia_enable_skgpu_v1) {
867 sources -= skia_skgpu_v1_sources
Robert Phillips7b931f82021-06-09 14:04:05 -0400868 }
Robert Phillips3b97aa22021-05-03 11:42:40 -0400869
Mike Klein703cf5a2016-10-13 17:18:04 -0400870 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400871 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700872
John Rosascoa9b348f2019-11-08 13:18:15 -0800873 if (skia_use_gl) {
874 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400875 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500876 sources += [
877 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
878 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
879 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400880
881 # this lib is required to link against AHardwareBuffer
882 if (defined(ndk_api) && ndk_api >= 26) {
883 libs += [ "android" ]
884 }
885 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500886 sources += [
887 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
888 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
889 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400890 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400891 } else if (skia_use_webgl) {
892 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400893 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500894 sources += [
895 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
896 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
897 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400898 libs += [ "GL" ]
899 } else if (is_mac) {
900 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
901 } else if (is_ios) {
902 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800903 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400904 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
905 if (target_cpu != "arm64") {
906 libs += [ "OpenGL32.lib" ]
907 }
908 } else {
909 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
910 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800911 sources += skia_gl_gpu_sources
912 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400913
mtkleine9fb3d52016-09-20 15:11:46 -0700914 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400915 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000916 if (skia_use_vma) {
917 deps += [ "third_party/vulkanmemoryallocator" ]
918 }
mtkleine9fb3d52016-09-20 15:11:46 -0700919 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700920 if (skia_enable_vulkan_debug_layers) {
921 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
922 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800923 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800924 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700925 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
926 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400927 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700928 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800929 }
mtkleine9fb3d52016-09-20 15:11:46 -0700930 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400931
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400932 if (is_android && (skia_use_gl || skia_use_vulkan)) {
933 # this lib is required to link against AHardwareBuffer
934 if (defined(ndk_api) && ndk_api >= 26) {
935 libs += [ "android" ]
936 }
937 }
938
Stephen White0d70b712019-07-10 15:51:30 -0400939 if (skia_use_dawn) {
940 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400941 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700942 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400943 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700944 "//third_party/externals/dawn/src/dawn:dawn_proc",
945 "//third_party/externals/dawn/src/dawn:dawncpp",
Stephen White0d70b712019-07-10 15:51:30 -0400946 ]
Brian Salomonc3915f72021-11-15 19:08:02 +0000947 if (dawn_enable_d3d12 || dawn_enable_desktop_gl || dawn_enable_metal ||
948 dawn_enable_opengles || dawn_enable_vulkan) {
949 deps += [ "//third_party/externals/dawn/src/dawn_native" ]
950 }
Stephen White0d70b712019-07-10 15:51:30 -0400951 if (dawn_enable_d3d12) {
952 libs += [
953 "d3d12.lib",
954 "dxgi.lib",
955 "d3dcompiler.lib",
956 ]
957 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400958 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400959 }
960 }
961
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500962 if (skia_use_direct3d) {
Arman Ugurayb58bab12021-12-09 12:24:51 -0800963 public_defines += [
964 "SK_DIRECT3D",
965 "SK_ENABLE_SPIRV_CROSS",
966 ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400967 deps += [
968 "//third_party/d3d12allocator",
969 "//third_party/spirv-cross:spirv_cross",
970 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500971 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500972 if (skia_enable_direct3d_debug_layer) {
973 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
974 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500975 libs += [
976 "d3d12.lib",
977 "dxgi.lib",
978 "d3dcompiler.lib",
979 ]
980 }
981
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400982 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400983 if (skia_use_metal) {
984 public_defines += [ "SK_METAL" ]
985 sources += skia_metal_sources
Jim Van Verth758d81f2021-07-07 12:02:10 -0400986 if (skia_enable_metal_debug_info) {
987 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
988 }
Jim Van Verthef820be2020-08-12 10:45:00 -0400989 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400990 frameworks += [ "Foundation.framework" ]
Jim Van Vertha8d38072021-11-04 09:22:22 -0400991 if (is_ios) {
992 frameworks += [ "UIKit.framework" ]
993 }
Jim Van Verth36b86af2020-08-24 17:16:46 +0000994 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400995 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500996
Kevin Lubickf4def342018-10-04 12:52:50 -0400997 if (is_debug) {
998 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
999 }
mtklein06c35c02016-09-20 12:28:12 -07001000}
1001
Leon Scroggins III41169202019-01-29 09:29:57 -05001002optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -05001003 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -05001004 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
1005 if ("True" ==
1006 exec_script("gn/checkpath.py",
1007 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
1008 "trim string")) {
1009 public_defines = [ "SK_USE_LIBGIFCODEC" ]
1010 public_include_dirs = [
1011 ".",
1012 skia_libgifcodec_path,
1013 ]
1014 include_dirs = public_include_dirs
1015 import(_libgifcodec_gni_path)
1016 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1017 ".",
1018 skia_libgifcodec_path)
1019 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001020}
1021
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001022optional("heif") {
1023 enabled = skia_use_libheif
1024 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1025
Kevin Lubick8ed49ea2021-11-11 12:50:02 -05001026 # This HEIF decoding functionality is a part of the Android Framework.
1027 # https://android.googlesource.com/platform/frameworks/av/+/master/media/libheif/include/HeifDecoderAPI.h
1028 # There isn't a way to compile that library outside of it, so we just link against
1029 # the library. This feature is not supported on other platforms (and we haven't
1030 # yet tried something like https://github.com/strukturag/libheif/tree/master/libheif).
1031 # The dependency for Android is set in gn_to_bp.py.
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001032 deps = []
1033
Mike Kleina01c6b02020-04-01 13:47:34 -05001034 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001035}
1036
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001037optional("jpeg_decode") {
1038 enabled = skia_use_libjpeg_turbo_decode
1039 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1040
Mike Kleina01c6b02020-04-01 13:47:34 -05001041 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001042 sources = [
1043 "src/codec/SkJpegCodec.cpp",
1044 "src/codec/SkJpegDecoderMgr.cpp",
1045 "src/codec/SkJpegUtility.cpp",
1046 ]
1047}
1048
1049optional("jpeg_encode") {
1050 enabled = skia_use_libjpeg_turbo_encode
1051 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001052
Mike Kleina01c6b02020-04-01 13:47:34 -05001053 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1054 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001055 sources = [
mtklein63213812016-08-24 09:55:56 -07001056 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001057 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001058 ]
1059}
1060
Evgenii Kliuchnikov0dae2e82022-02-02 13:45:33 +00001061optional("jpegxl_decode") {
1062 enabled = skia_use_libjxl_decode
1063 public_defines = [ "SK_CODEC_DECODES_JPEGXL" ]
1064
1065 deps = [ "//third_party/libjxl" ]
1066 sources = [ "src/codec/SkJpegxlCodec.cpp" ]
1067}
1068
Leon Scroggins III326b9892020-08-05 16:51:10 -04001069optional("ndk_images") {
1070 enabled = skia_use_ndk_images
1071 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1072 sources = [
1073 "src/ports/SkImageEncoder_NDK.cpp",
1074 "src/ports/SkImageGeneratorNDK.cpp",
1075 "src/ports/SkNDKConversions.cpp",
1076 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001077 libs = [ "jnigraphics" ]
1078}
1079
Robert Phillips755e00e2021-09-21 11:59:57 -04001080optional("graphite") {
Jim Van Verthff733b32021-09-24 16:46:36 -04001081 libs = []
1082 frameworks = []
1083
Robert Phillips755e00e2021-09-21 11:59:57 -04001084 enabled = skia_enable_graphite
Greg Daniel292bbb12021-11-03 16:25:41 -04001085 deps = [ ":gpu_shared" ]
Robert Phillips755e00e2021-09-21 11:59:57 -04001086 public_defines = [ "SK_GRAPHITE_ENABLED" ]
1087 public = skia_graphite_public
Greg Danielf0b283e2021-11-04 08:37:59 -04001088 sources = skia_graphite_sources
Jim Van Verthff733b32021-09-24 16:46:36 -04001089 if (skia_use_metal) {
1090 public_defines += [ "SK_METAL" ]
1091 sources += skia_graphite_mtl_sources
1092 if (skia_enable_metal_debug_info) {
1093 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
1094 }
1095 frameworks += [ "Metal.framework" ]
1096 frameworks += [ "Foundation.framework" ]
Jim Van Verth09828fb2021-12-16 10:50:01 -05001097 if (is_ios) {
1098 frameworks += [ "UIKit.framework" ]
1099 }
Jim Van Verthff733b32021-09-24 16:46:36 -04001100 }
Robert Phillips1a4080a2021-09-21 09:57:43 -04001101}
1102
mtklein63213812016-08-24 09:55:56 -07001103optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001104 enabled = skia_use_zlib && skia_enable_pdf
1105 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001106
Mike Kleina01c6b02020-04-01 13:47:34 -05001107 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001108 if (skia_use_libjpeg_turbo_decode) {
1109 deps += [ ":jpeg_decode" ]
1110 }
1111 if (skia_use_libjpeg_turbo_encode) {
1112 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001113 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001114 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001115 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001116 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001117 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1118 deps += [ "//third_party/harfbuzz" ]
1119 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1120 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001121 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001122 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001123 }
1124}
1125
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001126optional("xps") {
1127 enabled = skia_use_xps && is_win
1128 public_defines = [ "SK_SUPPORT_XPS" ]
1129 public = skia_xps_public
1130 sources = skia_xps_sources
1131}
1132
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001133optional("png_decode") {
1134 enabled = skia_use_libpng_decode
1135 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001136
Mike Kleina01c6b02020-04-01 13:47:34 -05001137 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001138 sources = [
1139 "src/codec/SkIcoCodec.cpp",
1140 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001141 ]
1142}
1143
1144optional("png_encode") {
1145 enabled = skia_use_libpng_encode
1146 public_defines = [ "SK_ENCODE_PNG" ]
1147
Mike Kleina01c6b02020-04-01 13:47:34 -05001148 deps = [ "//third_party/libpng" ]
1149 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001150}
1151
scroggof84ad642016-10-31 09:02:57 -07001152optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001153 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001154 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1155
1156 deps = [
1157 "//third_party/dng_sdk",
1158 "//third_party/libjpeg-turbo:libjpeg",
1159 "//third_party/piex",
1160 ]
1161
1162 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1163 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001164 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001165
Mike Kleina01c6b02020-04-01 13:47:34 -05001166 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001167}
1168
Mike Klein852a8cb2018-05-15 10:46:58 -04001169import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001170skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001171 cflags = []
1172 if (!is_win || is_clang) {
1173 cflags += [
1174 "-w",
1175 "-std=c11",
1176 ]
1177 }
1178
Mike Kleina01c6b02020-04-01 13:47:34 -05001179 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001180 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001181 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1182}
1183
mtklein3cc22182016-08-29 13:26:14 -07001184optional("typeface_freetype") {
1185 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001186
Mike Kleina01c6b02020-04-01 13:47:34 -05001187 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001188 sources = [
1189 "src/ports/SkFontHost_FreeType.cpp",
1190 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001191 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001192 ]
1193}
1194
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001195optional("webp_decode") {
1196 enabled = skia_use_libwebp_decode
1197 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001198
Mike Kleina01c6b02020-04-01 13:47:34 -05001199 deps = [ "//third_party/libwebp" ]
1200 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001201}
1202
1203optional("webp_encode") {
1204 enabled = skia_use_libwebp_encode
1205 public_defines = [ "SK_ENCODE_WEBP" ]
1206
Mike Kleina01c6b02020-04-01 13:47:34 -05001207 deps = [ "//third_party/libwebp" ]
1208 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001209}
1210
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001211optional("wuffs") {
1212 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001213 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001214
Mike Kleina01c6b02020-04-01 13:47:34 -05001215 deps = [ "//third_party/wuffs" ]
1216 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001217}
1218
mtklein63213812016-08-24 09:55:56 -07001219optional("xml") {
1220 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001221 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001222
Mike Kleina01c6b02020-04-01 13:47:34 -05001223 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001224 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001225 "src/svg/SkSVGCanvas.cpp",
1226 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001227 "src/xml/SkDOM.cpp",
1228 "src/xml/SkXMLParser.cpp",
1229 "src/xml/SkXMLWriter.cpp",
1230 ]
1231}
1232
Mike Klein613ad382019-06-06 11:42:02 -05001233optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001234 enabled = skia_enable_skvm_jit_when_possible
1235 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001236 if (skia_vtune_path != "") {
1237 public_defines += [ "SKVM_JIT_VTUNE" ]
1238 public_include_dirs = [ "$skia_vtune_path/include" ]
1239 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1240 }
Mike Klein613ad382019-06-06 11:42:02 -05001241}
1242
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001243if (skia_enable_gpu && skia_generate_workarounds) {
1244 action("workaround_list") {
1245 script = "tools/build_workaround_header.py"
1246
Mike Kleina01c6b02020-04-01 13:47:34 -05001247 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001248
Brian Osmaned5181e2021-07-01 13:54:20 -04001249 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
1250 # path that starts with root_out_dir and then uses ".." to back up into the src dir.
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001251 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001252 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001253
Mike Kleina01c6b02020-04-01 13:47:34 -05001254 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001255 args = [
1256 "--output-file",
1257 "$output_file",
1258 ]
1259
1260 foreach(file, inputs) {
1261 args += [ rebase_path(file, root_build_dir) ]
1262 }
1263 }
1264}
1265
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001266skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001267 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001268 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001269
Mike Klein607b0a72018-11-07 16:17:34 -05001270 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001271 ":fontmgr_FontConfigInterface",
1272 ":fontmgr_android",
1273 ":fontmgr_custom_directory",
1274 ":fontmgr_custom_embedded",
1275 ":fontmgr_custom_empty",
1276 ":fontmgr_fontconfig",
1277 ":fontmgr_fuchsia",
1278 ":fontmgr_mac_ct",
1279 ":fontmgr_win",
1280 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001281 ":gpu",
Robert Phillips755e00e2021-09-21 11:59:57 -04001282 ":graphite",
Mike Klein607b0a72018-11-07 16:17:34 -05001283 ":pdf",
1284 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001285 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001286 ]
1287
mtkleinc04ff472016-06-23 10:29:30 -07001288 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001289 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001290 ":arm64",
1291 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001292 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -07001293 ":crc32",
Ben Wagner75626e42020-06-03 13:20:37 -04001294 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001295 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001296 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001297 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001298 ":jpeg_decode",
1299 ":jpeg_encode",
Evgenii Kliuchnikov0dae2e82022-02-02 13:45:33 +00001300 ":jpegxl_decode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001301 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001302 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001303 ":png_decode",
1304 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001305 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001306 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001307 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001308 ":sse2",
1309 ":sse41",
1310 ":sse42",
1311 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001312 ":webp_decode",
1313 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001314 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001315 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001316 ]
1317
Hal Canaryc25f4e92019-02-26 11:54:25 -05001318 public = skia_core_public
1319 public += skia_utils_public
1320 public += skia_effects_public
1321 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001322
mtkleinc04ff472016-06-23 10:29:30 -07001323 sources = []
brettwb9447282016-09-01 14:24:39 -07001324 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001325 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001326 sources += skia_effects_sources
1327 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -07001328 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001329 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001330 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001331 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001332 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001333 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001334 "src/codec/SkBmpCodec.cpp",
1335 "src/codec/SkBmpMaskCodec.cpp",
1336 "src/codec/SkBmpRLECodec.cpp",
1337 "src/codec/SkBmpStandardCodec.cpp",
1338 "src/codec/SkCodec.cpp",
1339 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001340 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001341 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001342 "src/codec/SkMaskSwizzler.cpp",
1343 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001344 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001345 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001346 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001347 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001348 "src/codec/SkSwizzler.cpp",
1349 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001350 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001351 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001352 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001353 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001354 "src/ports/SkMemory_malloc.cpp",
1355 "src/ports/SkOSFile_stdio.cpp",
1356 "src/sfnt/SkOTTable_name.cpp",
1357 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001358 ]
brettwb9447282016-09-01 14:24:39 -07001359
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001360 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001361 libs = []
1362
Brian Osman946a4cb2021-07-12 17:02:21 -04001363 if (skia_enable_sksl) {
1364 deps += [ ":dehydrate_sksl" ]
1365 sources += skia_sksl_sources
1366 }
1367
mtkleinc04ff472016-06-23 10:29:30 -07001368 if (is_win) {
1369 sources += [
1370 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001371 "src/ports/SkImageEncoder_WIC.cpp",
1372 "src/ports/SkImageGeneratorWIC.cpp",
1373 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001374 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001375 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001376 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001377 "Ole32.lib",
1378 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001379 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001380
1381 if (!skia_enable_winuwp) {
1382 libs += [
1383 "FontSub.lib",
1384 "User32.lib",
1385 "Usp10.lib",
1386 ]
1387 }
mtkleinc04ff472016-06-23 10:29:30 -07001388 } else {
1389 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001390 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001391 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001392 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001393 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001394 }
1395
mtklein7d6fb2c2016-08-25 14:50:44 -07001396 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001397 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001398 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001399 deps += [ "//third_party/cpu-features" ]
1400 }
mtklein06c35c02016-09-20 12:28:12 -07001401 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001402 libs += [
1403 "EGL",
1404 "GLESv2",
1405 "log",
1406 ]
1407 }
1408
Kevin Lubick217056c2018-09-20 17:39:31 -04001409 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001410 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001411 if (skia_use_egl) {
1412 libs += [ "GLESv2" ]
1413 }
mtkleinc04ff472016-06-23 10:29:30 -07001414 }
1415
1416 if (is_mac) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001417 public += [ "include/ports/SkCFObject.h" ]
mtkleinc04ff472016-06-23 10:29:30 -07001418 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001419 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001420 "src/ports/SkImageEncoder_CG.cpp",
1421 "src/ports/SkImageGeneratorCG.cpp",
1422 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001423 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001424 "ApplicationServices.framework",
1425 "OpenGL.framework",
1426 ]
mtkleinc04ff472016-06-23 10:29:30 -07001427 }
abarth6fc8ff02016-07-15 15:15:15 -07001428
Mike Klein7d302882016-11-03 14:06:31 -04001429 if (is_ios) {
Jim Van Verth37c49762021-10-05 14:22:02 -04001430 public += [ "include/ports/SkCFObject.h" ]
Mike Klein7d302882016-11-03 14:06:31 -04001431 sources += [
1432 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001433 "src/ports/SkImageEncoder_CG.cpp",
1434 "src/ports/SkImageGeneratorCG.cpp",
1435 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001436 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001437 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001438 "ImageIO.framework",
1439 "MobileCoreServices.framework",
1440 ]
1441 }
1442
abarth6fc8ff02016-07-15 15:15:15 -07001443 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001444 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001445 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001446
1447 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001448 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001449 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1450 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001451
1452 if (skia_include_multiframe_procs) {
1453 sources += [ "tools/SkSharingProc.cpp" ]
1454 }
mtkleinc04ff472016-06-23 10:29:30 -07001455}
1456
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001457# DebugCanvas used in experimental/wasm-skp-debugger
1458if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001459 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001460 public_configs = [ ":skia_public" ]
1461
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001462 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001463 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001464 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001465 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001466 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001467 "tools/debugger/DrawCommand.cpp",
1468 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001469 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001470 }
1471}
1472
Ben Wagner25eb5342021-03-22 14:07:15 -04001473skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001474 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001475 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001476 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001477
1478 deps = [
1479 ":arm64",
1480 ":armv7",
1481 ":avx",
1482 ":crc32",
1483 ":hsw",
1484 ":none",
1485 ":sse2",
1486 ":sse41",
1487 ":sse42",
1488 ":ssse3",
1489 ]
1490
Kevin Lubickcbcff382018-10-02 09:02:18 -04001491 sources = []
1492 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001493 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001494 sources += [
1495 "src/core/SkAnalyticEdge.cpp",
1496 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001497 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001498 "src/core/SkCubicMap.cpp",
1499 "src/core/SkEdge.cpp",
1500 "src/core/SkEdgeBuilder.cpp",
1501 "src/core/SkEdgeClipper.cpp",
1502 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001503 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001504 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001505 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001506 "src/core/SkMallocPixelRef.cpp",
1507 "src/core/SkMath.cpp",
1508 "src/core/SkMatrix.cpp",
1509 "src/core/SkOpts.cpp",
1510 "src/core/SkPaint.cpp",
Tyler Dennistonf8b7c1a2021-07-13 13:22:19 -04001511 "src/core/SkPaintPriv.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001512 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001513 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001514 "src/core/SkPathEffect.cpp",
1515 "src/core/SkPathMeasure.cpp",
1516 "src/core/SkPathRef.cpp",
1517 "src/core/SkPoint.cpp",
1518 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001519 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001520 "src/core/SkRect.cpp",
1521 "src/core/SkSemaphore.cpp",
1522 "src/core/SkStream.cpp",
1523 "src/core/SkString.cpp",
1524 "src/core/SkStringUtils.cpp",
1525 "src/core/SkStroke.cpp",
1526 "src/core/SkStrokeRec.cpp",
1527 "src/core/SkStrokerPriv.cpp",
1528 "src/core/SkThreadID.cpp",
1529 "src/core/SkUtils.cpp",
1530 "src/effects/SkDashPathEffect.cpp",
1531 "src/effects/SkTrimPathEffect.cpp",
1532 "src/ports/SkDebug_stdio.cpp",
1533 "src/ports/SkMemory_malloc.cpp",
1534 "src/utils/SkDashPath.cpp",
1535 "src/utils/SkParse.cpp",
1536 "src/utils/SkParsePath.cpp",
1537 "src/utils/SkUTF.cpp",
1538 ]
1539}
1540
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001541group("modules") {
1542 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001543 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001544 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001545 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001546 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001547 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001548 ]
Kevin Lubickc13cd642022-02-14 15:08:12 -05001549
1550 if (is_wasm) {
1551 deps += [ "modules/canvaskit" ]
1552 }
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001553}
1554
Julia Lavrova9f6e4632021-09-17 15:19:02 -04001555group("experimental") {
1556 deps = [ "experimental/sktext" ]
1557}
1558
Brian Osmancd28fa62020-07-07 16:01:26 -04001559config("our_vulkan_headers") {
1560 include_dirs = [ "include/third_party/vulkan" ]
1561}
1562
mtkleinc095df52016-08-24 12:23:52 -07001563# Targets guarded by skia_enable_tools may use //third_party freely.
1564if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001565 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001566 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001567 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001568 "include/c",
1569 "include/codec",
1570 "include/config",
1571 "include/core",
1572 "include/docs",
1573 "include/effects",
1574 "include/encode",
1575 "include/gpu",
1576 "include/pathops",
1577 "include/ports",
1578 "include/svg",
1579 "include/utils",
1580 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001581 "modules/particles/include",
1582 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001583 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001584 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001585 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001586 ]
1587
Mike Klein308b5ac2016-12-06 16:03:52 -05001588 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001589 skia_source_set("public") {
1590 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001591 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001592 }
1593
Mike Kleinc36dedf2016-11-18 09:35:28 -05001594 config("skia.h_config") {
1595 include_dirs = [ "$target_gen_dir" ]
1596 }
1597 action("skia.h") {
1598 public_configs = [ ":skia.h_config" ]
1599 skia_h = "$target_gen_dir/skia.h"
1600 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001601
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001602 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1603 [ rebase_path(skia_h, root_build_dir) ] +
1604 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001605 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001606 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001607 }
1608
Brian Osmanc9a42472018-05-31 13:17:12 -04001609 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001610 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001611 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001612 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001613 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001614 "tools/fiddle/draw.cpp",
1615 "tools/fiddle/fiddle_main.cpp",
1616 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001617
1618 if (skia_use_egl) {
1619 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001620 } else {
1621 sources += [ "tools/fiddle/null_context.cpp" ]
1622 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001623 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001624 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001625 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001626 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001627 ":skia",
1628 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001629 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001630 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001631 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001632 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001633 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001634 ]
1635 }
1636 }
1637
John Stiles2cf48632022-01-26 21:36:51 -05001638 config("cpp17") {
Mike Kleine5463e62020-06-11 13:53:53 -05001639 if (is_win) {
John Stiles2cf48632022-01-26 21:36:51 -05001640 cflags_cc = [ "/std:c++17" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001641 } else {
John Stiles2cf48632022-01-26 21:36:51 -05001642 cflags_cc = [ "-std=c++17" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001643 }
1644 }
1645
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001646 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001647 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001648 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001649 ":our_vulkan_headers",
John Stiles2cf48632022-01-26 21:36:51 -05001650 ":cpp17",
Mike Kleine5463e62020-06-11 13:53:53 -05001651 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001652 if (defined(skia_header_target_default_configs)) {
1653 configs += skia_header_target_default_configs
1654 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001655 deps = [
1656 ":skia",
1657 ":skia.h",
1658 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001659 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001660 ]
Stephen White0d70b712019-07-10 15:51:30 -04001661
1662 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001663 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001664 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001665 }
1666
mtkleinc095df52016-08-24 12:23:52 -07001667 template("test_lib") {
1668 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001669 if (defined(invoker.public_defines)) {
1670 defines = invoker.public_defines
1671 }
mtklein25c81d42016-07-27 13:55:26 -07001672 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001673 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001674 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001675 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001676 public_configs = [
1677 ":" + target_name + "_config",
1678 ":skia_private",
1679 ]
1680
1681 if (!defined(deps)) {
1682 deps = []
1683 }
1684 deps += [ ":skia" ]
1685 testonly = true
1686 }
mtklein25c81d42016-07-27 13:55:26 -07001687 }
mtklein25c81d42016-07-27 13:55:26 -07001688
Mike Kleine6682eb2017-01-05 10:54:57 -05001689 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001690 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001691 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001692 forward_variables_from(invoker,
1693 "*",
1694 [
1695 "output_name",
1696 "visibility",
1697 "is_shared_library",
1698 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001699 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001700 extra_configs = [ ":skia_private" ]
1701 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1702 data_sources = [ "resources" ]
1703 if ("True" == exec_script("//gn/checkdir.py",
1704 [ rebase_path("skps", root_build_dir) ],
1705 "trim string")) {
1706 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001707 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001708 if ("True" == exec_script("//gn/checkdir.py",
1709 [ rebase_path("mskps", root_build_dir) ],
1710 "trim string")) {
1711 data_sources += [ "mskps" ]
1712 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001713 }
1714 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001715 # !is_ios
1716
1717 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001718 skia_shared_library("lib" + target_name) {
1719 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001720 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001721 if (!defined(configs)) {
1722 configs = []
1723 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001724 configs += [ ":skia_private" ]
1725 testonly = true
1726 }
1727 } else {
1728 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001729 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001730 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001731 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001732 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001733 if (!defined(configs)) {
1734 configs = []
1735 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001736 configs += [ ":skia_private" ]
1737 testonly = true
1738 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001739 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001740 if (is_android && skia_android_serial != "" && defined(_executable)) {
1741 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001742 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001743 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001744 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001745 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001746 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001747 args = [
1748 rebase_path("$root_build_dir/$_executable"),
1749 skia_android_serial,
1750 rebase_path(_stamp),
1751 ]
1752 testonly = true
1753 }
Mike Klein7d921032017-01-05 12:20:41 -05001754 }
1755 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001756 }
1757
mtkleinc095df52016-08-24 12:23:52 -07001758 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001759 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001760
Mike Klein9e25bb92019-04-29 09:46:36 -05001761 # Bots and even devs may not have Vulkan headers, so put
1762 # include/third_party/vulkan on our path so they're always available.
1763 all_dependent_configs = [ ":our_vulkan_headers" ]
1764
Mike Klein333fb452019-04-24 08:48:11 -05001765 defines = []
1766 if (skia_enable_discrete_gpu) {
1767 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1768 }
1769
Brian Osmanc9a42472018-05-31 13:17:12 -04001770 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001771 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001772 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001773 "tools/gpu/BackendSurfaceFactory.cpp",
1774 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001775 "tools/gpu/BackendTextureImageFactory.cpp",
1776 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001777 "tools/gpu/FlushFinishTracker.cpp",
1778 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001779 "tools/gpu/GrContextFactory.cpp",
1780 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001781 "tools/gpu/ManagedBackendTexture.cpp",
1782 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001783 "tools/gpu/MemoryCache.cpp",
1784 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001785 "tools/gpu/ProxyUtils.cpp",
1786 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001787 "tools/gpu/TestOps.cpp",
1788 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001789 "tools/gpu/YUVUtils.cpp",
1790 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001791 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1792 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001793 "tools/gpu/mock/MockTestContext.cpp",
1794 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001795
1796 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001797 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001798
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001799 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001800 sources +=
1801 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001802 if (is_ios) {
1803 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001804 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001805 } else if (is_mac) {
1806 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001807 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001808 if (skia_use_angle) {
1809 deps += [ "//third_party/angle2" ]
1810 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1811 }
Brian Salomon1171d312020-03-19 08:47:44 -04001812 }
1813
Kevin Lubick49df61f2022-02-03 10:54:07 -05001814 if (skia_use_gl && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001815 if (is_android || skia_use_egl) {
1816 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1817 libs += [ "EGL" ]
1818 } else if (is_linux) {
1819 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1820 libs += [
1821 "GLU",
1822 "GL",
1823 "X11",
1824 ]
1825 } else if (is_win) {
1826 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1827 libs += [ "Gdi32.lib" ]
1828 if (target_cpu != "arm64") {
1829 libs += [ "OpenGL32.lib" ]
1830 }
1831 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001832 }
Greg Daniel54200e42018-12-11 17:03:39 -05001833
Brian Osmanc9a42472018-05-31 13:17:12 -04001834 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001835 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001836 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001837 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1838 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001839 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001840 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001841 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1842 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001843 }
1844 if (skia_use_metal) {
1845 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001846 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001847 if (skia_use_direct3d) {
1848 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001849 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001850 }
Stephen White985741a2019-07-18 11:43:45 -04001851 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001852 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001853 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001854 if (is_clang) {
1855 cflags_cc = [ "-Wno-microsoft-cast" ]
1856 }
Stephen White985741a2019-07-18 11:43:45 -04001857 }
Robert Phillips72354b02021-07-06 13:43:56 -04001858 if (!skia_enable_skgpu_v1) {
1859 sources -= [ "tools/gpu/GrTest.cpp" ]
1860 sources -= [ "tools/gpu/TestOps.cpp" ]
1861 sources -= [ "tools/gpu/TestOps.h" ]
1862 }
Robert Phillipsd034db72021-09-29 14:29:32 -04001863 if (skia_enable_graphite) {
Robert Phillips091694f2021-09-30 11:41:16 -04001864 sources += [ "tools/graphite/ContextFactory.h" ]
1865 sources += [ "tools/graphite/ContextFactory.cpp" ]
Robert Phillipsd034db72021-09-29 14:29:32 -04001866 sources += [ "tools/graphite/GraphiteTestContext.h" ]
1867 sources += [ "tools/graphite/GraphiteTestContext.cpp" ]
1868 if (skia_use_metal) {
1869 sources += [ "tools/graphite/mtl/GraphiteMtlTestContext.h" ]
1870 sources += [ "tools/graphite/mtl/MtlTestContext.mm" ]
1871 }
1872 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001873
1874 if (is_fuchsia && using_fuchsia_sdk) {
1875 libs +=
1876 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1877 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001878 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001879
mtkleinc095df52016-08-24 12:23:52 -07001880 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001881 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001882 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001883
1884 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001885 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1886 deps = [ ":flags" ]
1887 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001888 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001889 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001890 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1891 deps = [ ":flags" ]
1892 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001893 }
1894 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001895 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1896 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001897 }
Kevin Lubick237dd2d2021-10-14 08:24:22 -04001898 test_lib("common_flags_fontmgr") {
1899 sources = [ "tools/flags/CommonFlagsFontMgr.cpp" ]
1900 deps = [ ":flags" ]
1901 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001902 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001903 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1904 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001905 }
mtklein25c81d42016-07-27 13:55:26 -07001906
Mike Klein499f0ac2019-03-25 13:00:12 -05001907 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001908 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001909 sources = [
1910 "tools/trace/ChromeTracingTracer.cpp",
1911 "tools/trace/ChromeTracingTracer.h",
1912 "tools/trace/EventTracingPriv.cpp",
1913 "tools/trace/EventTracingPriv.h",
1914 "tools/trace/SkDebugfTracer.cpp",
1915 "tools/trace/SkDebugfTracer.h",
1916 ]
1917 }
1918
mtkleinc095df52016-08-24 12:23:52 -07001919 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001920 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001921 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001922 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001923 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001924 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001925 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001926 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001927 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001928 "tools/MSKPPlayer.cpp",
1929 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001930 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001931 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001932 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001933 "tools/Resources.h",
John Stilesb5ac66c2021-07-14 14:04:49 -04001934 "tools/RuntimeBlendUtils.cpp",
1935 "tools/RuntimeBlendUtils.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001936 "tools/SkMetaData.cpp",
1937 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001938 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001939 "tools/SkSharingProc.h",
1940 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001941 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001942 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001943 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001944 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001945 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001946 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001947 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001948 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001949 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001950 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001951 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001952 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001953 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001954 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001955 "tools/fonts/TestEmptyTypeface.h",
1956 "tools/fonts/TestFontMgr.cpp",
1957 "tools/fonts/TestFontMgr.h",
1958 "tools/fonts/TestSVGTypeface.cpp",
1959 "tools/fonts/TestSVGTypeface.h",
1960 "tools/fonts/TestTypeface.cpp",
1961 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001962 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001963 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001964 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001965 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001966 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001967 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001968 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001969 if (target_cpu != "wasm") {
1970 sources += [ "tools/CrashHandler.cpp" ]
1971 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001972 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001973 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001974 if (is_ios) {
1975 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001976 sources += [ "tools/ios_utils.h" ]
1977 if (skia_use_metal) {
1978 sources += [ "tools/AutoreleasePool.mm" ]
1979 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001980 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001981 } else if (is_mac) {
1982 if (skia_use_metal) {
1983 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001984 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001985 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001986 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001987 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001988 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001989
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001990 defines = []
1991 if (skia_tools_require_resources) {
1992 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1993 }
mtkleinc095df52016-08-24 12:23:52 -07001994 deps = [
1995 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001996 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001997 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001998 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001999 }
mtklein25c81d42016-07-27 13:55:26 -07002000
Mike Kleine11e5c12019-04-24 12:46:06 -05002001 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002002 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05002003 }
2004
Mike Klein6e744122016-10-27 12:21:40 -04002005 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07002006 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07002007 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07002008 if (skia_use_gl) {
2009 sources += gl_gm_sources
2010 }
Robert Phillips024668c2021-07-01 12:12:52 -04002011 if (!skia_enable_skgpu_v1) {
2012 sources -= skgpu_v1_gm_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002013 }
mtkleinc095df52016-08-24 12:23:52 -07002014 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05002015 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07002016 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07002017 ":skia",
2018 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05002019 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04002020 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04002021 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04002022 "modules/skparagraph",
2023 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002024 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002025 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04002026 if (is_skia_dev_build) {
2027 sources += [ "gm/fiddle.cpp" ]
2028 deps += [ ":skia.h" ]
2029 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002030 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04002031
2032 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04002033 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04002034 sources += [ "gm/video_decoder.cpp" ]
2035 }
mtkleinc095df52016-08-24 12:23:52 -07002036 }
mtklein25c81d42016-07-27 13:55:26 -07002037
Ben Wagnerbded42a2021-02-17 22:14:34 -05002038 test_lib("test") {
2039 sources = [
2040 "tests/Test.cpp",
2041 "tests/Test.h",
John Stiles64e15ee2022-03-09 17:18:18 -05002042 "tests/TestHarness.cpp",
2043 "tests/TestHarness.h",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002044 "tests/TestUtils.cpp",
2045 "tests/TestUtils.h",
2046 ]
2047 deps = [
2048 ":flags",
2049 ":skia",
2050 ":tool_utils",
2051 ]
2052 public_deps = [
2053 ":gpu_tool_utils", # Test.h #includes headers from this target.
2054 ]
2055 }
2056
Mike Klein6e744122016-10-27 12:21:40 -04002057 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002058 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002059 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002060 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002061 if (skia_use_metal) {
2062 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002063 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002064 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002065 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002066 if (skia_use_gl) {
2067 sources += gl_tests_sources
2068 }
Robert Phillips30627592021-10-11 11:28:21 -04002069 if (skia_enable_graphite) {
2070 sources += graphite_tests_sources
Greg Daniel5e0950e2021-11-30 12:02:30 -05002071 if (skia_use_metal) {
2072 sources += graphite_metal_tests_sources
2073 }
Robert Phillips30627592021-10-11 11:28:21 -04002074 }
Robert Phillips024668c2021-07-01 12:12:52 -04002075 if (!skia_enable_skgpu_v1) {
2076 sources -= skgpu_v1_tests_sources
Robert Phillips1ca0da42021-06-14 15:27:19 -04002077 }
mtkleinc095df52016-08-24 12:23:52 -07002078 deps = [
2079 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002080 ":fontmgr_android_tests",
2081 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002082 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002083 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002084 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002085 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002086 "experimental/skrive:tests",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002087 "experimental/sktext:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002088 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002089 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002090 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002091 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002092 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002093 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002094 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002095 "//third_party/zlib",
2096 ]
2097 }
mtklein2f3416d2016-08-02 16:02:05 -07002098
Mike Klein6e744122016-10-27 12:21:40 -04002099 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002100 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002101 sources = bench_sources
Chris Dalton2fceb212021-10-19 13:04:41 -06002102 if (skia_enable_graphite) {
2103 sources += graphite_bench_sources
2104 }
Robert Phillips04f22ea2021-07-22 15:11:03 -04002105 if (!skia_enable_skgpu_v1) {
2106 sources -= skgpu_v1_bench_sources
2107 }
mtkleinc095df52016-08-24 12:23:52 -07002108 deps = [
2109 ":flags",
2110 ":gm",
2111 ":gpu_tool_utils",
2112 ":skia",
2113 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002114 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002115 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002116 ]
2117 }
mtklein2b6870c2016-07-28 14:17:33 -07002118
Florin Malitabfe876a2018-09-02 12:33:59 -04002119 if (is_linux || is_mac) {
Florin Malita8b868112021-06-09 13:26:27 -04002120 if (skia_enable_skottie) {
2121 test_app("skottie_tool") {
2122 deps = [ "modules/skottie:tool" ]
2123 }
Florin Malita79725d32018-06-05 16:16:57 -04002124 }
Florin Malitab3418102020-10-15 18:10:29 -04002125 test_app("svg_tool") {
2126 deps = [ "modules/svg:tool" ]
2127 }
Florin Malita79725d32018-06-05 16:16:57 -04002128 }
2129
Chris Dalton2b598902020-03-25 10:50:35 -06002130 import("gn/samples.gni")
2131 test_lib("samples") {
2132 sources = samples_sources
Robert Phillips024668c2021-07-01 12:12:52 -04002133 if (!skia_enable_skgpu_v1) {
2134 sources -= skgpu_v1_samples_sources
Robert Phillips3674f582021-06-16 12:05:54 -04002135 }
Mike Kleina01c6b02020-04-01 13:47:34 -05002136 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002137 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002138 ":flags",
2139 ":gpu_tool_utils",
2140 ":xml",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002141 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002142 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002143 "modules/skparagraph:samples",
2144 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002145 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002146 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002147 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002148 }
Kevin Lubick00398742020-10-08 10:05:07 -04002149 test_lib("hash_and_encode") {
2150 sources = [
2151 "tools/HashAndEncode.cpp",
2152 "tools/HashAndEncode.h",
2153 ]
2154 deps = [
2155 ":flags",
2156 ":skia",
2157 "//third_party/libpng",
2158 ]
2159 }
Chris Dalton2b598902020-03-25 10:50:35 -06002160 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002161 test_app("convert-to-nia") {
2162 sources = [ "tools/convert-to-nia.cpp" ]
2163 deps = [ ":skia" ]
2164 }
Mike Klein7af351a2018-07-27 09:54:43 -04002165 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002166 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002167 deps = [
2168 ":skcms",
2169 ":skia",
2170 ]
2171 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002172 test_app("fm") {
2173 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002174 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002175 "tools/fm/fm.cpp",
2176 ]
2177 deps = [
2178 ":common_flags_aa",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002179 ":common_flags_fontmgr",
Mike Klein735c7ba2019-03-25 12:57:58 -05002180 ":common_flags_gpu",
2181 ":flags",
2182 ":gm",
2183 ":gpu_tool_utils",
2184 ":hash_and_encode",
2185 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002186 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002187 ":tool_utils",
2188 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002189 "modules/skottie",
2190 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002191 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002192 ]
2193 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002194 test_app("dm") {
2195 sources = [
2196 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002197 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002198 "dm/DMJsonWriter.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002199 "dm/DMJsonWriter.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002200 "dm/DMSrcSink.cpp",
John Stiles65ec1982021-07-20 12:53:54 -04002201 "dm/DMSrcSink.h",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002202 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002203 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002204 ":common_flags_aa",
2205 ":common_flags_config",
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002206 ":common_flags_fontmgr",
Mike Kleinc6142d82019-03-25 10:54:59 -05002207 ":common_flags_gpu",
2208 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002209 ":flags",
2210 ":gm",
2211 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002212 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002213 ":skia",
2214 ":tests",
2215 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002216 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002217 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002218 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002219 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002220 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002221 ]
2222 }
Robert Phillips4d45e092021-07-01 13:27:16 -04002223 test_app("sorttoy") {
Robert Phillips4b732282021-05-20 09:45:10 -04002224 sources = [
Robert Phillips4d45e092021-07-01 13:27:16 -04002225 "experimental/sorttoy/Cmds.cpp",
2226 "experimental/sorttoy/Cmds.h",
2227 "experimental/sorttoy/Fake.cpp",
2228 "experimental/sorttoy/Fake.h",
2229 "experimental/sorttoy/SortKey.h",
2230 "experimental/sorttoy/sorttoy.cpp",
2231 "experimental/sorttoy/sorttypes.h",
Robert Phillips4b732282021-05-20 09:45:10 -04002232 ]
Robert Phillipscd1e3972021-02-22 17:24:22 -05002233 deps = [
2234 ":flags",
2235 ":skia",
2236 ":tool_utils",
2237 ]
2238 }
Michael Ludwig30217952020-12-04 12:58:35 -05002239
2240 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002241 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002242 sources = [
2243 "tests/CanvasStateHelpers.cpp",
2244 "tests/CanvasStateHelpers.h",
2245 ]
2246 deps = [ ":skia" ]
2247 }
Brian Osman16adfa32016-10-18 14:42:44 -04002248 }
2249
Mike Kleina8a51ce2018-01-09 12:34:11 -05002250 if (!is_win) {
2251 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002252 sources = [ "tools/remote_demo.cpp" ]
2253 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002254 }
2255 }
2256
Hal Canarye107faa2019-10-23 12:52:33 -04002257 if (!is_win) {
2258 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002259 sources = [ "tools/blob_cache_sim.cpp" ]
2260 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002261 }
2262 }
2263
Mike Kleine6682eb2017-01-05 10:54:57 -05002264 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002265 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002266 deps = [
2267 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002268 ":common_flags_aa",
2269 ":common_flags_config",
2270 ":common_flags_gpu",
2271 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002272 ":flags",
2273 ":gm",
2274 ":gpu_tool_utils",
2275 ":skia",
2276 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002277 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002278 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002279 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002280 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002281 ]
mtklein2b6870c2016-07-28 14:17:33 -07002282 }
halcanary19a97202016-08-03 15:08:04 -07002283
Ravi Mistry10d36c52017-01-31 09:49:18 -05002284 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002285 sources = [ "tools/skpinfo.cpp" ]
Greg Daniel0eb35a92021-06-18 10:47:54 -04002286 configs = [ ":our_vulkan_headers" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002287 deps = [
2288 ":flags",
2289 ":skia",
2290 ]
2291 }
2292
Mike Reedc0ee21f2019-05-28 16:11:03 -04002293 if (skia_use_ffmpeg) {
2294 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002295 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002296 deps = [
2297 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002298 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002299 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002300 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002301 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002302 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002303 ]
2304 }
2305 }
2306
Brian Osmanc9a42472018-05-31 13:17:12 -04002307 test_app("skpbench") {
Kevin Lubickf541ddf2021-10-13 16:02:56 -04002308 sources = [
2309 "bench/BigPath.cpp",
2310 "tools/skpbench/skpbench.cpp",
2311 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002312 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002313 ":common_flags_config",
2314 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002315 ":flags",
2316 ":gpu_tool_utils",
2317 ":skia",
2318 ":tool_utils",
2319 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002320 }
2321
Mike Kleine6682eb2017-01-05 10:54:57 -05002322 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002323 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002324 deps = [
2325 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002326 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002327 ]
halcanary3eee9d92016-09-10 07:01:53 -07002328 }
mtklein046cb562016-09-16 10:23:12 -07002329
Ben Wagner219f3622017-07-17 15:32:25 -04002330 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002331 sources = [ "tools/fonts/create_test_font.cpp" ]
2332 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002333 assert_no_deps = [
2334 # tool_utils requires the output of this app.
2335 ":tool_utils",
2336 ]
2337 }
2338
Florin Malita5d3ff432018-07-31 16:38:43 -04002339 if (skia_use_expat) {
2340 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002341 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002342 deps = [
2343 ":flags",
2344 ":skia",
2345 ":tool_utils",
2346 ]
2347 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002348 }
2349
Mike Kleine6682eb2017-01-05 10:54:57 -05002350 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002351 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002352 deps = [
2353 ":flags",
2354 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002355 ]
mtklein046cb562016-09-16 10:23:12 -07002356 }
mtkleinecbc5262016-09-22 11:51:24 -07002357
Brian Osman6788a542018-12-10 11:56:01 -05002358 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002359 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002360 sources = [
2361 "tools/skiaserve/Request.cpp",
2362 "tools/skiaserve/Response.cpp",
2363 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002364 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2365 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2366 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2367 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2368 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2369 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2370 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2371 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2372 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002373 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2374 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002375 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2376 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2377 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2378 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2379 ]
2380 deps = [
2381 ":flags",
2382 ":gpu_tool_utils",
2383 ":skia",
2384 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002385 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002386 ]
Mike Klein7d302882016-11-03 14:06:31 -04002387 }
mtkleinecbc5262016-09-22 11:51:24 -07002388 }
kjlubick14f984b2016-10-03 11:49:45 -07002389
Mike Kleine6682eb2017-01-05 10:54:57 -05002390 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002391 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002392 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002393 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002394 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002395 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002396 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002397 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002398 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002399 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002400 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002401 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002402 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002403 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002404 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002405 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002406 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002407 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002408 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002409 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002410 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002411 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2412 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002413 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002414 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002415 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002416 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002417 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2418 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002419 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002420 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2421 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002422 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002423 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002424 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002425 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002426 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002427 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002428 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002429 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002430 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002431 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002432 "tools/debugger/DrawCommand.cpp",
2433 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002434 ]
2435 deps = [
2436 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002437 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002438 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002439 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002440 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002441 ]
kjlubick14f984b2016-10-03 11:49:45 -07002442 }
Mike Klein38312422016-10-05 15:41:01 -04002443
Mike Kleine6682eb2017-01-05 10:54:57 -05002444 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002445 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002446 deps = [
2447 ":flags",
2448 ":skia",
2449 ]
Mike Klein38312422016-10-05 15:41:01 -04002450 }
bungemanfe917272016-10-13 17:36:40 -04002451
Mike Kleine6682eb2017-01-05 10:54:57 -05002452 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002453 sources = [
2454 "tools/skdiff/skdiff.cpp",
2455 "tools/skdiff/skdiff_html.cpp",
2456 "tools/skdiff/skdiff_main.cpp",
2457 "tools/skdiff/skdiff_utils.cpp",
2458 ]
2459 deps = [
2460 ":skia",
2461 ":tool_utils",
2462 ]
bungemanfe917272016-10-13 17:36:40 -04002463 }
halcanarya73d76a2016-10-17 13:19:02 -07002464
Mike Kleine6682eb2017-01-05 10:54:57 -05002465 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002466 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002467 deps = [
2468 ":skia",
2469 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002470 ]
halcanarya73d76a2016-10-17 13:19:02 -07002471 }
Brian Osman16adfa32016-10-18 14:42:44 -04002472
Brian Osmanc9a42472018-05-31 13:17:12 -04002473 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002474 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002475 check_includes = false
2476 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002477 public_configs = [ ":skia_private" ]
Hal Canary75427132017-10-11 16:00:31 -04002478 sources = [
2479 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002480 "tools/skqp/src/skqp.cpp",
John Stilesd4e08762022-03-04 17:48:15 -05002481 "tools/skqp/src/skqp.h",
Hal Canary75427132017-10-11 16:00:31 -04002482 ]
2483 deps = [
2484 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002485 ":skia",
2486 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002487 ":tool_utils",
2488 ]
2489 }
2490 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002491 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002492 include_dirs = [ "//" ]
2493 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002494 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002495 }
Hal Canary75427132017-10-11 16:00:31 -04002496 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002497 if (is_fuchsia) {
2498 # Build a package repository for skqp on Fuchsia.
2499 group("skqp_repo") {
2500 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002501 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002502 }
2503 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002504 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002505 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002506 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002507 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002508 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002509 deps = [
2510 ":skia",
2511 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002512 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002513 ]
2514 libs = [ "android" ]
2515 }
2516 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002517 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002518 test_app("skottie_android") {
2519 is_shared_library = true
2520
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002521 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002522 libs = []
2523
Stan Iliev93151722018-08-02 11:10:52 -04002524 deps = [
2525 ":skia",
2526 "modules/skottie",
2527 ]
2528 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002529
2530 test_app("androidkit") {
2531 is_shared_library = true
2532
Florin Malita2a650cc2021-04-12 13:38:44 -04002533 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002534 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002535 "modules/androidkit/src/Canvas.cpp",
Florin Malita1df87562021-06-28 16:34:14 -04002536 "modules/androidkit/src/ColorFilters.cpp",
Jorge Betancourt151a6f32021-09-07 16:50:21 -04002537 "modules/androidkit/src/Font.cpp",
Jorge Betancourtaa9656d2021-10-14 14:02:08 -04002538 "modules/androidkit/src/FontChainAdapter.cpp",
Florin Malitaca8191b2021-06-17 14:05:57 -04002539 "modules/androidkit/src/Gradients.cpp",
Florin Malita934c0212021-05-20 12:23:42 -04002540 "modules/androidkit/src/Image.cpp",
Jorge Betancourtf961bc22021-06-04 16:34:02 -04002541 "modules/androidkit/src/ImageFilter.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002542 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002543 "modules/androidkit/src/Paint.cpp",
Jorge Betancourtcfa47742021-06-16 14:45:52 -04002544 "modules/androidkit/src/Path.cpp",
2545 "modules/androidkit/src/PathBuilder.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002546 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2547 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002548 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002549 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002550 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002551 "modules/androidkit/src/SurfaceThread.cpp",
2552 "modules/androidkit/src/SurfaceThread.h",
Jorge Betancourte1fb47d2021-08-20 14:37:13 -04002553 "modules/androidkit/src/Text.cpp",
Florin Malita50cc5d42021-05-21 08:23:32 -04002554 "modules/androidkit/src/Utils.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002555 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002556 libs = [
2557 "android",
2558 "jnigraphics",
2559 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002560
Florin Malita2cc65382021-04-26 21:59:35 -04002561 deps = [
2562 ":sk_app",
2563 ":skia",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002564 "experimental/sktext:sktext",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002565 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002566 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002567 }
Stan Iliev93151722018-08-02 11:10:52 -04002568 }
Hal Canary75427132017-10-11 16:00:31 -04002569
Hal Canarya9de7602018-01-19 13:08:23 -05002570 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002571 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002572 deps = [
2573 ":gm",
2574 ":skia",
2575 ]
2576 }
2577 test_app("list_gpu_unit_tests") {
2578 sources = [
2579 "dm/DMGpuTestProcs.cpp",
2580 "tools/list_gpu_unit_tests.cpp",
2581 ]
2582 deps = [
2583 ":skia",
2584 ":tests",
2585 ]
2586 }
2587
Brian Osmanc9a42472018-05-31 13:17:12 -04002588 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002589 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002590 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002591 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002592 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002593 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002594 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002595 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002596 "tools/sk_app/CommandSet.h",
2597 "tools/sk_app/DisplayParams.h",
2598 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002599 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002600 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002601 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002602 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002603 ]
2604 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002605 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002606
2607 if (is_android) {
2608 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002609 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002610 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002611 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002612 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002613 "tools/sk_app/android/main_android.cpp",
2614 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002615 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002616 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002617 libs += [ "android" ]
2618 } else if (is_linux) {
2619 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002620 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002621 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002622 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002623 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002624 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002625 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002626 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002627 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002628 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002629 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002630 "X11",
2631 ]
2632 } else if (is_win) {
2633 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002634 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002635 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002636 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002637 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002638 "tools/sk_app/win/main_win.cpp",
2639 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002640 } else if (is_mac) {
2641 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002642 "tools/sk_app/mac/WindowContextFactory_mac.h",
2643 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002644 "tools/sk_app/mac/Window_mac.mm",
2645 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002646 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002647 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002648 "QuartzCore.framework",
2649 "Cocoa.framework",
2650 "Foundation.framework",
2651 ]
2652 } else if (is_ios) {
2653 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002654 "tools/sk_app/ios/WindowContextFactory_ios.h",
2655 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002656 "tools/sk_app/ios/Window_ios.mm",
2657 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002658 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002659 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002660 }
2661
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002662 if (skia_use_gl) {
2663 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002664 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002665 if (is_android) {
2666 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2667 } else if (is_linux) {
2668 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2669 } else if (is_win) {
2670 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2671 if (skia_use_angle) {
2672 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2673 }
2674 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002675 sources += [
2676 "tools/sk_app/mac/GLWindowContext_mac.mm",
2677 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2678 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002679 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002680 sources += [
2681 "tools/sk_app/ios/GLWindowContext_ios.mm",
2682 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2683 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002684 }
2685 }
2686
Brian Osmanc9a42472018-05-31 13:17:12 -04002687 if (skia_use_vulkan) {
2688 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002689 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002690 if (is_android) {
2691 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2692 } else if (is_linux) {
2693 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2694 libs += [ "X11-xcb" ]
2695 } else if (is_win) {
2696 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2697 }
2698 }
2699
Jim Van Verthbe39f712019-02-08 15:36:14 -05002700 if (skia_use_metal) {
2701 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002702 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002703 if (skia_enable_graphite) {
2704 sources += [ "tools/sk_app/GraphiteMetalWindowContext.mm" ]
2705 sources += [ "tools/sk_app/GraphiteMetalWindowContext.h" ]
2706 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002707 if (is_mac) {
2708 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth7bb0ff02021-09-30 16:27:30 -04002709 if (skia_enable_graphite) {
2710 sources += [ "tools/sk_app/mac/GraphiteMetalWindowContext_mac.mm" ]
2711 }
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002712 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002713 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002714 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002715 }
2716
Jim Van Verth682a2f42020-05-13 16:54:09 -04002717 if (skia_use_direct3d) {
2718 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2719 }
2720
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002721 if (skia_use_dawn) {
2722 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002723 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002724 if (is_linux) {
2725 if (dawn_enable_vulkan) {
2726 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2727 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2728 libs += [ "X11-xcb" ]
2729 }
2730 } else if (is_win) {
2731 if (dawn_enable_d3d12) {
2732 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2733 }
2734 } else if (is_mac) {
2735 if (dawn_enable_metal) {
2736 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2737 }
2738 }
2739 }
2740
Mike Kleina01c6b02020-04-01 13:47:34 -05002741 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002742 if (is_android) {
2743 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002744 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002745 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002746 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002747 }
Brian Osman16adfa32016-10-18 14:42:44 -04002748 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002749
Hal Canary87515122019-03-15 14:22:51 -04002750 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2751 test_app("fiddle_examples") {
2752 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002753 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002754 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002755 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002756 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002757 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002758 cflags = [
2759 "/wd4756", # Overflow in constant arithmetic
2760 "/wd4305", # truncation from 'double' to 'float'
2761 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002762 }
Hal Canary87515122019-03-15 14:22:51 -04002763 deps = [
2764 ":skia",
2765 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002766 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002767 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002768 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002769 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002770 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002771 ]
2772 }
2773 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002774
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002775 # sk_app can work without GL but viewer always runs raster through a GL window context.
2776 if (skia_use_gl) {
2777 test_app("viewer") {
2778 is_shared_library = is_android
2779 sources = [
2780 "tools/viewer/AnimTimer.h",
2781 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002782 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002783 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002784 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002785 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002786 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002787 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002788 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002789 "tools/viewer/MSKPSlide.cpp",
2790 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002791 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002792 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002793 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002794 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002795 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002796 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002797 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002798 "tools/viewer/SkRiveSlide.h",
John Stiles00b3fcc2021-12-10 19:53:57 -05002799 "tools/viewer/SkSLDebuggerSlide.cpp",
2800 "tools/viewer/SkSLDebuggerSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002801 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002802 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002803 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002804 "tools/viewer/SkottieSlide.h",
2805 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002806 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002807 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002808 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002809 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002810 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002811 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002812 "tools/viewer/TouchGesture.cpp",
2813 "tools/viewer/TouchGesture.h",
2814 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002815 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002816 ]
2817 libs = []
2818
2819 deps = [
Kevin Lubick237dd2d2021-10-14 08:24:22 -04002820 ":common_flags_fontmgr",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002821 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002822 ":flags",
2823 ":gm",
2824 ":gpu_tool_utils",
2825 ":samples",
2826 ":sk_app",
2827 ":skia",
2828 ":tool_utils",
2829 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002830 "experimental/skrive",
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002831 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002832 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002833 "modules/particles",
2834 "modules/skottie",
2835 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002836 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002837 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002838 "//third_party/imgui",
2839 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002840 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002841 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002842 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002843
Corentin Wallez89d6e792021-03-08 15:25:34 +01002844 #spvtools depends on this but doesn't deps it in.
2845 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002846 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002847 }
Mike Reedd62d4062019-06-12 10:20:44 -04002848 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002849 }
2850
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002851 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002852 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002853 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002854 libs = []
2855
Brian Osmaneff04b52017-11-21 13:18:02 -05002856 deps = [
2857 ":flags",
2858 ":gpu_tool_utils",
2859 ":sk_app",
2860 ":skia",
2861 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002862 ]
2863 }
2864 }
2865
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002866 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2867 action_foreach("generate_mocs") {
2868 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002869 sources = [ "tools/mdbviz/MainWindow.h" ]
2870 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002871 args = [
2872 "$skia_qt_path" + "/bin/moc",
2873 "{{source}}",
2874 "-o",
2875 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2876 ]
2877 }
2878 action_foreach("generate_resources") {
2879 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002880 sources = [ "tools/mdbviz/resources.qrc" ]
2881 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002882 args = [
2883 "$skia_qt_path" + "/bin/rcc",
2884 "{{source}}",
2885 "-o",
2886 "gen/mdbviz/{{source_name_part}}_res.cpp",
2887 ]
2888 }
2889 test_app("mdbviz") {
2890 if (is_win) {
2891 # on Windows we need to disable some exception handling warnings due to the Qt headers
2892 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2893 }
2894 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002895 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002896 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002897 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002898 "tools/debugger/DrawCommand.cpp",
2899 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002900 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002901 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002902 "tools/mdbviz/main.cpp",
2903
2904 # generated files
2905 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2906 "$target_gen_dir/mdbviz/resources_res.cpp",
2907 ]
2908 lib_dirs = [ "$skia_qt_path/lib" ]
2909 libs = [
2910 "Qt5Core.lib",
2911 "Qt5Gui.lib",
2912 "Qt5Widgets.lib",
2913 ]
2914 include_dirs = [
2915 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002916 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002917 "$skia_qt_path/include/QtWidgets",
2918 ]
2919 deps = [
2920 ":generate_mocs",
2921 ":generate_resources",
2922 ":skia",
2923 ]
2924 }
2925 }
2926
Mike Kleine459afd2017-03-03 09:21:30 -05002927 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002928 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002929 sources = [ "$ndk/$ndk_gdbserver" ]
2930 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002931 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002932 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002933
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002934 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002935 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002936 deps = [
2937 ":skia",
2938 "modules/particles",
2939 ]
2940 }
2941
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002942 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002943 test_app("editor") {
2944 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002945 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002946 }
Julia Lavrova9f6e4632021-09-17 15:19:02 -04002947 test_app("text_editor") {
2948 is_shared_library = is_android
2949 deps = [ "experimental/sktext:text_editor" ]
2950 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002951 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002952
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002953 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002954 sources = [ "tools/image_diff_metric.cpp" ]
2955 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002956 }
Chris Dalton2b598902020-03-25 10:50:35 -06002957
2958 group("modules_testonly") {
2959 testonly = true
2960 deps = []
Kevin Lubickc13cd642022-02-14 15:08:12 -05002961 if (is_wasm) {
Chris Dalton2b598902020-03-25 10:50:35 -06002962 deps += [ "modules/canvaskit:viewer_wasm" ]
2963 }
2964 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002965
2966 if (skia_build_fuzzers) {
2967 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002968 skia_executable(target_name) {
2969 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002970 check_includes = false
2971 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002972 if (!defined(configs)) {
2973 configs = []
2974 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002975 configs += [ ":skia_private" ]
2976 sources += [
2977 "fuzz/Fuzz.cpp",
2978 "fuzz/FuzzCommon.cpp",
2979 ]
2980 deps += [
2981 ":flags",
2982 ":gpu_tool_utils",
2983 ":skia",
2984 ]
2985 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2986 if (skia_use_libfuzzer_defaults) {
2987 cflags = [ "-fsanitize=fuzzer" ]
2988 ldflags = [ "-fsanitize=fuzzer" ]
2989 }
2990 testonly = true
2991 }
2992 }
2993
2994 libfuzzer_app("region_deserialize") {
2995 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2996 deps = []
2997 }
2998
2999 libfuzzer_app("image_filter_deserialize") {
3000 include_dirs = [
3001 "tools",
3002 "tools/fonts",
3003 ]
3004 sources = [
3005 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
3006 "tools/Resources.cpp",
3007 "tools/fonts/TestFontMgr.cpp",
3008 "tools/fonts/TestSVGTypeface.cpp",
3009 "tools/fonts/TestTypeface.cpp",
3010 ]
Florin Malitab3418102020-10-15 18:10:29 -04003011 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003012 }
3013
3014 libfuzzer_app("region_set_path") {
3015 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
3016 deps = []
3017 }
3018
3019 libfuzzer_app("textblob_deserialize") {
3020 include_dirs = [
3021 "tools",
3022 "tools/fonts",
3023 ]
3024 sources = [
3025 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
3026 "tools/Resources.cpp",
3027 "tools/fonts/TestFontMgr.cpp",
3028 "tools/fonts/TestSVGTypeface.cpp",
3029 "tools/fonts/TestTypeface.cpp",
3030 ]
Florin Malitab3418102020-10-15 18:10:29 -04003031 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003032 }
3033
3034 libfuzzer_app("path_deserialize") {
3035 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
3036 deps = []
3037 }
3038
3039 libfuzzer_app("image_decode") {
3040 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3041 deps = []
3042 }
3043
3044 libfuzzer_app("animated_image_decode") {
3045 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3046 deps = []
3047 }
3048
3049 libfuzzer_app("api_create_ddl") {
3050 include_dirs = [
3051 "include",
3052 "include/gpu",
3053 ]
3054 sources = [
3055 "fuzz/FuzzCreateDDL.cpp",
3056 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3057 "tools/Resources.cpp",
3058 "tools/UrlDataManager.cpp",
3059 "tools/debugger/DebugCanvas.cpp",
3060 "tools/debugger/DebugLayerManager.cpp",
3061 "tools/debugger/DrawCommand.cpp",
3062 "tools/debugger/JsonWriteBuffer.cpp",
3063 "tools/fonts/TestFontMgr.cpp",
3064 "tools/fonts/TestSVGTypeface.cpp",
3065 "tools/fonts/TestTypeface.cpp",
3066 ]
3067 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003068 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003069 "//third_party/libpng",
3070 ]
3071 }
3072
3073 libfuzzer_app("api_draw_functions") {
3074 sources = [
3075 "fuzz/FuzzDrawFunctions.cpp",
3076 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3077 ]
3078 deps = []
3079 }
3080
Adlai Hollerccb68662021-02-25 10:28:44 -05003081 libfuzzer_app("api_ddl_threading") {
3082 sources = [
3083 "fuzz/FuzzDDLThreading.cpp",
3084 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3085 ]
3086 deps = []
3087 }
3088
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003089 libfuzzer_app("api_gradients") {
3090 sources = [
3091 "fuzz/FuzzGradients.cpp",
3092 "fuzz/oss_fuzz/FuzzGradients.cpp",
3093 ]
3094 deps = []
3095 }
3096
3097 libfuzzer_app("api_image_filter") {
3098 include_dirs = [
3099 "tools",
3100 "tools/debugger",
3101 ]
3102 sources = [
3103 "fuzz/FuzzCanvas.cpp",
3104 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3105 "tools/UrlDataManager.cpp",
3106 "tools/debugger/DebugCanvas.cpp",
3107 "tools/debugger/DebugLayerManager.cpp",
3108 "tools/debugger/DrawCommand.cpp",
3109 "tools/debugger/JsonWriteBuffer.cpp",
3110 ]
3111 deps = [ "//third_party/libpng" ]
3112 }
3113
3114 libfuzzer_app("api_path_measure") {
3115 sources = [
3116 "fuzz/FuzzPathMeasure.cpp",
3117 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3118 ]
3119 deps = []
3120 }
3121
3122 libfuzzer_app("api_pathop") {
3123 sources = [
3124 "fuzz/FuzzPathop.cpp",
3125 "fuzz/oss_fuzz/FuzzPathop.cpp",
3126 ]
3127 deps = []
3128 }
3129
Robert Phillips98b066c2021-04-22 10:51:58 -04003130 libfuzzer_app("api_triangulation") {
3131 sources = [
3132 "fuzz/FuzzTriangulation.cpp",
3133 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3134 ]
3135 deps = []
3136 }
3137
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003138 libfuzzer_app("api_raster_n32_canvas") {
3139 include_dirs = [
3140 "tools",
3141 "tools/debugger",
3142 "tools/fonts",
3143 ]
3144 sources = [
3145 "fuzz/FuzzCanvas.cpp",
3146 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3147 "tools/Resources.cpp",
3148 "tools/UrlDataManager.cpp",
3149 "tools/debugger/DebugCanvas.cpp",
3150 "tools/debugger/DebugLayerManager.cpp",
3151 "tools/debugger/DrawCommand.cpp",
3152 "tools/debugger/JsonWriteBuffer.cpp",
3153 "tools/fonts/TestFontMgr.cpp",
3154 "tools/fonts/TestSVGTypeface.cpp",
3155 "tools/fonts/TestTypeface.cpp",
3156 ]
3157 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003158 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003159 "//third_party/libpng",
3160 ]
3161 }
3162
Kevin Lubick7845b972021-03-29 08:07:32 -04003163 libfuzzer_app("api_regionop") {
3164 sources = [
3165 "fuzz/FuzzRegionOp.cpp",
3166 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3167 ]
3168 deps = []
3169 }
3170
Kevin Lubick94303e82022-02-01 09:03:41 -05003171 if (skia_enable_gpu) {
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003172 libfuzzer_app("api_mock_gpu_canvas") {
3173 include_dirs = [
3174 "tools",
3175 "tools/debugger",
3176 "tools/fonts",
3177 ]
3178 sources = [
3179 "fuzz/FuzzCanvas.cpp",
3180 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3181 "tools/LsanSuppressions.cpp",
3182 "tools/Resources.cpp",
3183 "tools/UrlDataManager.cpp",
3184 "tools/debugger/DebugCanvas.cpp",
3185 "tools/debugger/DebugLayerManager.cpp",
3186 "tools/debugger/DrawCommand.cpp",
3187 "tools/debugger/JsonWriteBuffer.cpp",
3188 "tools/fonts/TestFontMgr.cpp",
3189 "tools/fonts/TestSVGTypeface.cpp",
3190 "tools/fonts/TestTypeface.cpp",
3191 ]
3192 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003193 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003194 "//third_party/libpng",
3195 ]
3196 }
3197 }
3198
3199 libfuzzer_app("api_null_canvas") {
3200 include_dirs = [
3201 "tools",
3202 "tools/debugger",
3203 "tools/fonts",
3204 ]
3205 sources = [
3206 "fuzz/FuzzCanvas.cpp",
3207 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3208 "tools/Resources.cpp",
3209 "tools/UrlDataManager.cpp",
3210 "tools/debugger/DebugCanvas.cpp",
3211 "tools/debugger/DebugLayerManager.cpp",
3212 "tools/debugger/DrawCommand.cpp",
3213 "tools/debugger/JsonWriteBuffer.cpp",
3214 "tools/fonts/TestFontMgr.cpp",
3215 "tools/fonts/TestSVGTypeface.cpp",
3216 "tools/fonts/TestTypeface.cpp",
3217 ]
3218 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003219 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003220 "//third_party/libpng",
3221 ]
3222 }
3223
Weston Tracey1a771fe2021-02-04 11:09:59 -05003224 libfuzzer_app("api_skparagraph") {
3225 sources = [
3226 "fuzz/FuzzSkParagraph.cpp",
3227 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3228 "tools/Resources.cpp",
3229 ]
3230 deps = [ "modules/skparagraph" ]
3231 }
3232
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003233 libfuzzer_app("api_svg_canvas") {
3234 include_dirs = [
3235 "include",
3236 "include/svg",
3237 ]
3238 sources = [
3239 "fuzz/FuzzCanvas.cpp",
3240 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3241 "tools/Resources.cpp",
3242 "tools/UrlDataManager.cpp",
3243 "tools/debugger/DebugCanvas.cpp",
3244 "tools/debugger/DebugLayerManager.cpp",
3245 "tools/debugger/DrawCommand.cpp",
3246 "tools/debugger/JsonWriteBuffer.cpp",
3247 "tools/fonts/TestFontMgr.cpp",
3248 "tools/fonts/TestSVGTypeface.cpp",
3249 "tools/fonts/TestTypeface.cpp",
3250 ]
3251 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003252 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003253 "//third_party/libpng",
3254 ]
3255 }
3256
3257 libfuzzer_app("png_encoder") {
3258 sources = [
3259 "fuzz/FuzzEncoders.cpp",
3260 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3261 ]
3262 deps = []
3263 }
3264
3265 libfuzzer_app("jpeg_encoder") {
3266 sources = [
3267 "fuzz/FuzzEncoders.cpp",
3268 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3269 ]
3270 deps = []
3271 }
3272
3273 libfuzzer_app("webp_encoder") {
3274 sources = [
3275 "fuzz/FuzzEncoders.cpp",
3276 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3277 ]
3278 deps = []
3279 }
3280
3281 libfuzzer_app("skottie_json") {
3282 sources = [
3283 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3284 "tools/Resources.cpp",
3285 "tools/fonts/TestFontMgr.cpp",
3286 "tools/fonts/TestSVGTypeface.cpp",
3287 "tools/fonts/TestTypeface.cpp",
3288 ]
3289 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003290 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003291 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003292 ]
3293 }
3294
3295 libfuzzer_app("skjson") {
3296 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3297 deps = []
3298 }
3299
3300 libfuzzer_app("api_polyutils") {
3301 sources = [
3302 "fuzz/FuzzPolyUtils.cpp",
3303 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3304 ]
3305 deps = [ ":skia" ]
3306 }
3307
3308 libfuzzer_app("android_codec") {
3309 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3310 deps = []
3311 }
3312
3313 libfuzzer_app("image_decode_incremental") {
3314 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3315 deps = []
3316 }
3317
3318 libfuzzer_app("sksl2glsl") {
3319 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3320 deps = []
3321 }
3322
3323 libfuzzer_app("sksl2spirv") {
3324 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3325 deps = []
3326 }
3327
3328 libfuzzer_app("sksl2metal") {
3329 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3330 deps = []
3331 }
3332
3333 libfuzzer_app("sksl2pipeline") {
3334 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3335 deps = []
3336 }
3337
3338 libfuzzer_app("skdescriptor_deserialize") {
3339 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3340 deps = []
3341 }
3342
3343 libfuzzer_app("svg_dom") {
3344 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003345 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003346 }
3347
3348 libfuzzer_app("skruntimeeffect") {
3349 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3350 deps = []
3351 }
3352
3353 libfuzzer_app("skp") {
3354 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3355 deps = []
3356 }
3357 }
mtklein25c81d42016-07-27 13:55:26 -07003358}
Hal Canary932a2c02019-09-17 10:43:18 -04003359
Greg Daniel391f9412021-10-28 12:44:43 -04003360if (is_ios && skia_use_metal && skia_enable_gpu &&
3361 !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003362 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003363 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003364 }
Hal Canary27483062019-12-06 15:01:08 -05003365}
3366
Hal Canary60ff6512020-01-21 12:39:20 -05003367if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003368 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003369 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003370 }
3371}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003372
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003373skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003374 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3375 include_dirs = [ "." ]
3376 deps = [ ":skia" ]
3377}