blob: 390e616108353d2b3ec64299a686c57c251d1fb6 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary45812a12019-09-04 08:58:59 -04009import("gn/skia.gni")
10
John Rosasco24cbdab2019-09-25 14:14:35 -070011if (is_fuchsia) {
12 import("//build/fuchsia/sdk.gni")
13 import("build/fuchsia/fuchsia_download_sdk.gni")
14}
15
Stephen White0d70b712019-07-10 15:51:30 -040016if (skia_use_dawn) {
17 import("third_party/externals/dawn/scripts/dawn_features.gni")
18}
19
Adam Barth54ef74a2017-10-13 10:59:38 -070020if (defined(skia_settings)) {
21 import(skia_settings)
22}
23
Hal Canary3388c1a2019-09-16 12:53:17 -040024import("gn/ios.gni")
25
mtkleinc04ff472016-06-23 10:29:30 -070026# Skia public API, generally provided by :skia.
27config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -050028 include_dirs = [ "." ]
29
Mike Kleinae7e6712016-10-11 17:49:33 -040030 defines = []
Chinmay Gardef832c0a2020-03-18 14:37:23 -070031 cflags_objcc = []
Mike Kleinae7e6712016-10-11 17:49:33 -040032 if (is_component_build) {
33 defines += [ "SKIA_DLL" ]
34 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040035 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -050036 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070037 }
Brian Osmanf2c90142017-07-13 15:50:03 -040038 if (skia_enable_flutter_defines) {
39 defines += flutter_defines
40 }
mtklein06c35c02016-09-20 12:28:12 -070041 if (!skia_enable_gpu) {
42 defines += [ "SK_SUPPORT_GPU=0" ]
43 }
Mike Reed025f7832018-11-12 09:27:05 -050044 if (is_fuchsia) {
45 defines += fuchsia_defines
46 }
Kevin Lubick27ba7032019-03-21 08:13:54 -040047 if (skia_gl_standard == "gles") {
48 defines += [ "SK_ASSUME_GL_ES=1" ]
49 } else if (skia_gl_standard == "gl") {
50 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -040051 } else if (skia_gl_standard == "webgl") {
Kevin Lubick2f9a0982020-08-20 10:33:39 -040052 defines += [
53 "SK_ASSUME_WEBGL=1",
54 "SK_USE_WEBGL",
55 ]
Kevin Lubick27ba7032019-03-21 08:13:54 -040056 }
Robert Phillips3b97aa22021-05-03 11:42:40 -040057 if (skia_enable_nga) {
58 defines += [ "SK_NGA" ]
59 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070060
61 # Some older versions of the Clang toolchain change the visibility of
62 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
63 # toolchains suppress the use of this macro till toolchain updates are made.
64 if (is_mac || is_ios) {
65 if (skia_enable_api_available_macro) {
66 defines += [ "SK_ENABLE_API_AVAILABLE" ]
67 } else {
68 cflags_objcc += [ "-Wno-unguarded-availability" ]
69 }
70 }
mtkleinc04ff472016-06-23 10:29:30 -070071}
72
73# Skia internal APIs, used by Skia itself and a few test tools.
74config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060075 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070076
Mike Reeda9e241d2017-05-03 10:52:00 -040077 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050078 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070079 defines += [
80 "SK_GAMMA_EXPONENT=1.4",
81 "SK_GAMMA_CONTRAST=0.0",
82 ]
83 }
Mike Kleinb45d8622019-04-24 14:04:01 -050084 if (is_skia_dev_build) {
85 defines += [
86 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
87 "GR_TEST_UTILS=1",
88 ]
mtklein88a7ac02016-09-14 11:16:49 -070089 }
Brian Salomon789e25e2016-09-30 13:41:03 -040090 libs = []
91 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040092 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050093 defines += [ "SK_ANGLE" ]
94 }
Greg Danielb16beb92020-04-27 14:26:21 +000095 if (skia_use_vma) {
96 defines += [ "SK_USE_VMA" ]
97 }
James Clarkeb8c0dab2021-02-09 06:22:41 -080098 if (skia_enable_winuwp) {
James Clarkeb2bfa9d2021-02-18 19:54:42 -080099 defines += [ "SK_WINUWP" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800100 }
101}
102
mtkleinc04ff472016-06-23 10:29:30 -0700103# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
104config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -0600105 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000106 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700107}
108
109skia_library_configs = [
110 ":skia_public",
111 ":skia_private",
112 ":skia_library",
113]
114
mtklein9b8583d2016-08-24 17:32:30 -0700115# Use for CPU-specific Skia code that needs particular compiler flags.
116template("opts") {
117 if (invoker.enabled) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400118 skia_source_set(target_name) {
119 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500120 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400121 configs = skia_library_configs
mtklein9b8583d2016-08-24 17:32:30 -0700122 forward_variables_from(invoker, "*")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400123 if (defined(invoker.configs)) {
124 configs += invoker.configs
125 }
mtklein9b8583d2016-08-24 17:32:30 -0700126 }
127 } else {
128 # If not enabled, a phony empty target that swallows all otherwise unused variables.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400129 skia_source_set(target_name) {
130 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500131 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700132 forward_variables_from(invoker,
133 "*",
134 [
135 "sources",
136 "cflags",
137 ])
138 }
139 }
anmittala7eaf2e2016-08-17 13:57:26 -0700140}
141
mtklein422310d2016-08-16 18:28:43 -0700142is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700143
mtklein7d6fb2c2016-08-25 14:50:44 -0700144opts("none") {
145 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700146 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700147 cflags = []
148}
149
mtklein7d6fb2c2016-08-25 14:50:44 -0700150opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700151 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700152 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700153 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700154}
155
156opts("arm64") {
157 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700158 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700159 cflags = []
160}
161
162opts("crc32") {
163 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700164 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700165 cflags = [ "-march=armv8-a+crc" ]
166}
167
mtklein9b8583d2016-08-24 17:32:30 -0700168opts("sse2") {
169 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700170 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400171 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400172 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
173 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400174 cflags = [ "-msse2" ]
175 }
mtklein9b8583d2016-08-24 17:32:30 -0700176}
mtkleinc04ff472016-06-23 10:29:30 -0700177
mtklein9b8583d2016-08-24 17:32:30 -0700178opts("ssse3") {
179 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.ssse3_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_SSSE3" ]
183 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400184 cflags = [ "-mssse3" ]
185 }
mtklein9b8583d2016-08-24 17:32:30 -0700186}
mtkleinc04ff472016-06-23 10:29:30 -0700187
mtklein9b8583d2016-08-24 17:32:30 -0700188opts("sse41") {
189 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700190 sources = skia_opts.sse41_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_SSE41" ]
193 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400194 cflags = [ "-msse4.1" ]
195 }
mtklein9b8583d2016-08-24 17:32:30 -0700196}
mtklein4e976072016-08-08 09:06:27 -0700197
mtklein9b8583d2016-08-24 17:32:30 -0700198opts("sse42") {
199 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700200 sources = skia_opts.sse42_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_SSE42" ]
203 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400204 cflags = [ "-msse4.2" ]
205 }
mtklein9b8583d2016-08-24 17:32:30 -0700206}
207
208opts("avx") {
209 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400211 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000212 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400213 } else {
214 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500215 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500216 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500217 }
Mike Klein3eb71212016-10-11 17:08:53 -0400218 }
mtkleinc04ff472016-06-23 10:29:30 -0700219}
220
Mike Klein1b9b7d52018-02-27 10:37:40 -0500221opts("hsw") {
222 enabled = is_x86
223 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400224 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500225 cflags = [ "/arch:AVX2" ]
226 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000227 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600228 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500229 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600230 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500231 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500232}
233
Mike Kleinad56c4c2020-06-05 06:57:30 -0500234opts("skx") {
235 enabled = is_x86
236 sources = skia_opts.skx_sources
237 if (is_win) {
238 cflags = [ "/arch:AVX512" ]
239 } else {
240 cflags = [ "-march=skylake-avx512" ]
241 if (is_mac && is_debug) {
242 cflags += [ "-fno-stack-check" ] # Work around skia:9709
243 }
244 }
245}
246
mtkleinc095df52016-08-24 12:23:52 -0700247# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700248template("optional") {
249 if (invoker.enabled) {
250 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700251 if (defined(invoker.public_defines)) {
252 defines = invoker.public_defines
253 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600254 if (defined(invoker.public_configs)) {
255 configs = invoker.public_configs
256 }
Hal Canary2dad9902019-11-20 16:01:31 -0500257 if (defined(invoker.public_include_dirs)) {
258 include_dirs = invoker.public_include_dirs
259 }
mtklein457b42a2016-08-23 13:56:37 -0700260 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400261 skia_source_set(target_name) {
262 visibility = [ ":*" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500263 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400264 configs = skia_library_configs
265
266 # "*" clobbers the current scope; append to existing configs
mtkleincd01b032016-08-31 04:58:19 -0700267 forward_variables_from(invoker,
268 "*",
269 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400270 "configs",
mtkleincd01b032016-08-31 04:58:19 -0700271 "public_defines",
Ben Wagnere75021e2021-02-17 22:18:34 -0500272 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700273 "sources_when_disabled",
274 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400275 if (defined(invoker.configs)) {
276 configs += invoker.configs
scroggof84ad642016-10-31 09:02:57 -0700277 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400278 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein457b42a2016-08-23 13:56:37 -0700279 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500280 if (defined(invoker.sources_for_tests) && skia_enable_tools) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400281 skia_source_set(target_name + "_tests") {
282 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500283 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400284 configs = skia_library_configs
285
286 # "*" clobbers the current scope; append to existing configs
Ben Wagnere75021e2021-02-17 22:18:34 -0500287 forward_variables_from(invoker,
288 "*",
289 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400290 "configs",
Ben Wagnere75021e2021-02-17 22:18:34 -0500291 "public_defines",
292 "sources",
293 "sources_for_tests",
294 "sources_when_disabled",
Ben Wagnere75021e2021-02-17 22:18:34 -0500295 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400296 if (defined(invoker.configs)) {
297 configs += invoker.configs
298 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500299 testonly = true
300 sources = invoker.sources_for_tests
301 if (!defined(deps)) {
302 deps = []
303 }
304 deps += [ ":test" ]
305 all_dependent_configs = [ ":" + target_name + "_public" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500306 }
307 }
mtklein457b42a2016-08-23 13:56:37 -0700308 } else {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400309 skia_source_set(target_name) {
310 visibility = [ ":*" ]
311 configs = skia_library_configs
312
313 # "*" clobbers the current scope; append to existing configs
mtklein457b42a2016-08-23 13:56:37 -0700314 forward_variables_from(invoker,
315 "*",
316 [
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400317 "configs",
Ben Wagnerea765a32020-06-05 13:42:30 -0400318 "public",
mtklein457b42a2016-08-23 13:56:37 -0700319 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400320 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700321 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700322 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400323 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700324 "sources",
Ben Wagnere75021e2021-02-17 22:18:34 -0500325 "sources_for_tests",
mtkleincd01b032016-08-31 04:58:19 -0700326 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700327 ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400328 if (defined(invoker.configs)) {
329 configs += invoker.configs
330 }
mtkleincd01b032016-08-31 04:58:19 -0700331 if (defined(invoker.sources_when_disabled)) {
332 sources = invoker.sources_when_disabled
333 }
mtklein457b42a2016-08-23 13:56:37 -0700334 }
Ben Wagnere75021e2021-02-17 22:18:34 -0500335 if (defined(invoker.sources_for_tests)) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400336 skia_source_set(target_name + "_tests") {
337 visibility = [ ":*" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500338 }
339 }
mtkleineb3c4252016-08-23 07:38:09 -0700340 }
mtklein457b42a2016-08-23 13:56:37 -0700341}
mtklein457b42a2016-08-23 13:56:37 -0700342
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400343optional("android_utils") {
344 enabled = skia_enable_android_utils
345
Leon Scroggins III87caae62020-05-04 10:02:45 -0400346 public = [
347 "client_utils/android/BRDAllocator.h",
348 "client_utils/android/BitmapRegionDecoder.h",
349 "client_utils/android/FrontBufferedStream.h",
350 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400351 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400352 sources = [
353 "client_utils/android/BitmapRegionDecoder.cpp",
354 "client_utils/android/FrontBufferedStream.cpp",
355 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400356}
357
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400358group("fontmgr_factory") {
359 public_deps = [ skia_fontmgr_factory ]
360}
361
362optional("fontmgr_empty_factory") {
363 enabled = true
364 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400365}
366
mtkleina45be612016-08-29 15:22:10 -0700367optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500368 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700369
370 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500371 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700372 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700373 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400374 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700375 sources = [
376 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700377 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400378 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700379 ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500380 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700381}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400382optional("fontmgr_android_factory") {
383 enabled = skia_enable_fontmgr_android
384 deps = [ ":fontmgr_android" ]
385 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
386}
mtkleina45be612016-08-29 15:22:10 -0700387
mtkleind2e39db2016-09-07 07:52:55 -0700388optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400389 enabled =
390 skia_enable_fontmgr_custom_directory ||
391 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700392
Mike Kleina01c6b02020-04-01 13:47:34 -0500393 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400394 public = [ "src/ports/SkFontMgr_custom.h" ]
395 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
396}
397
398optional("fontmgr_custom_directory") {
399 enabled = skia_enable_fontmgr_custom_directory
400
401 deps = [
402 ":fontmgr_custom",
403 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700404 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400405 public = [ "include/ports/SkFontMgr_directory.h" ]
406 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
407}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400408optional("fontmgr_custom_directory_factory") {
409 enabled = skia_enable_fontmgr_custom_directory
410 deps = [ ":fontmgr_custom_directory" ]
411 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
412}
Ben Wagner75626e42020-06-03 13:20:37 -0400413
414optional("fontmgr_custom_embedded") {
415 enabled = skia_enable_fontmgr_custom_embedded
416
417 deps = [
418 ":fontmgr_custom",
419 ":typeface_freetype",
420 ]
421 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700422}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400423optional("fontmgr_custom_embedded_factory") {
424 enabled = skia_enable_fontmgr_custom_embedded
425 deps = [ ":fontmgr_custom_embedded" ]
426 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
427}
mtkleind2e39db2016-09-07 07:52:55 -0700428
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500429optional("fontmgr_custom_empty") {
430 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500431
Ben Wagner75626e42020-06-03 13:20:37 -0400432 deps = [
433 ":fontmgr_custom",
434 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800435 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400436 public = [ "include/ports/SkFontMgr_empty.h" ]
437 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500438}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400439optional("fontmgr_custom_empty_factory") {
440 enabled = skia_enable_fontmgr_custom_empty
441 deps = [ ":fontmgr_custom_empty" ]
442 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
443}
Hal Canaryff2742e2018-01-30 11:35:47 -0500444
mtklein3cc22182016-08-29 13:26:14 -0700445optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400446 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700447
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400448 # The public header includes fontconfig.h and uses FcConfig*
449 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400450 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400451 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400452 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
Ben Wagnere75021e2021-02-17 22:18:34 -0500453 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400454}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400455optional("fontmgr_fontconfig_factory") {
456 enabled = skia_enable_fontmgr_fontconfig
457 deps = [ ":fontmgr_fontconfig" ]
458 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
459}
Ben Wagner75626e42020-06-03 13:20:37 -0400460
461optional("fontmgr_FontConfigInterface") {
462 enabled = skia_enable_fontmgr_FontConfigInterface
463
464 deps = [
465 ":typeface_freetype",
466 "//third_party:fontconfig",
467 ]
468 public = [
469 "include/ports/SkFontConfigInterface.h",
470 "include/ports/SkFontMgr_FontConfigInterface.h",
471 ]
mtklein3cc22182016-08-29 13:26:14 -0700472 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700473 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700474 "src/ports/SkFontConfigInterface_direct.cpp",
475 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400476 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700477 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700478 ]
479}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400480optional("fontmgr_FontConfigInterface_factory") {
481 enabled = skia_enable_fontmgr_FontConfigInterface
482 deps = [ ":fontmgr_FontConfigInterface" ]
483 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
484}
mtklein3cc22182016-08-29 13:26:14 -0700485
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500486optional("fontmgr_fuchsia") {
487 enabled = skia_enable_fontmgr_fuchsia
488
Chinmay Garde89820762019-05-06 16:44:06 -0700489 deps = []
490
491 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700492 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700493 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500494 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700495 }
Ben Wagner75626e42020-06-03 13:20:37 -0400496 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
497 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500498}
499
Ben Wagner75626e42020-06-03 13:20:37 -0400500optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400501 enabled = skia_use_fonthost_mac
502
Ben Wagner75626e42020-06-03 13:20:37 -0400503 public = [
504 "include/ports/SkFontMgr_mac_ct.h",
505 "include/ports/SkTypeface_mac.h",
506 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400507 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400508 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400509 "src/ports/SkScalerContext_mac_ct.cpp",
510 "src/ports/SkScalerContext_mac_ct.h",
511 "src/ports/SkTypeface_mac_ct.cpp",
512 "src/ports/SkTypeface_mac_ct.h",
513 ]
Ben Wagnera3e5e552021-02-22 15:37:33 +0000514 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400515
516 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400517 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400518 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
519 "AppKit.framework",
520 "ApplicationServices.framework",
521 ]
522 }
523
524 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400525 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400526 "CoreFoundation.framework",
527 "CoreGraphics.framework",
528 "CoreText.framework",
529
530 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
531 "UIKit.framework",
532 ]
533 }
534}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400535optional("fontmgr_mac_ct_factory") {
536 enabled = skia_use_fonthost_mac
537 deps = [ ":fontmgr_mac_ct" ]
538 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
539}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400540
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500541optional("fontmgr_win") {
542 enabled = skia_enable_fontmgr_win
543
Ben Wagner75626e42020-06-03 13:20:37 -0400544 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500545 sources = [
546 "src/fonts/SkFontMgr_indirect.cpp",
547 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500548 "src/ports/SkScalerContext_win_dw.cpp",
549 "src/ports/SkTypeface_win_dw.cpp",
550 ]
551}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400552optional("fontmgr_win_factory") {
553 enabled = skia_enable_fontmgr_win
554 deps = [ ":fontmgr_win" ]
555 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
556}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500557
558optional("fontmgr_win_gdi") {
559 enabled = skia_enable_fontmgr_win_gdi
560
Ben Wagner75626e42020-06-03 13:20:37 -0400561 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500562 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500563 libs = [ "Gdi32.lib" ]
564}
565
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700566if (skia_lex) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400567 skia_executable("sksllex") {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400568 sources = [
569 "src/sksl/lex/Main.cpp",
570 "src/sksl/lex/NFA.cpp",
571 "src/sksl/lex/RegexNode.cpp",
572 "src/sksl/lex/RegexParser.cpp",
573 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500574 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400575 }
576
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700577 action("run_sksllex") {
578 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500579 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
580 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700581
582 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
583 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
584 outputs = [
Brian Osman1e7d8aa2021-02-18 14:37:29 -0500585 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700586 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
587 # confused due to the same file being named by two different paths
588 ]
589 sksllex_path = "$root_out_dir/"
590 sksllex_path += "sksllex"
591 if (host_os == "win") {
592 sksllex_path += ".exe"
593 }
594 args = [
595 rebase_path(sksllex_path),
596 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400597 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700598 rebase_path("src"),
599 ]
600 }
601} else {
602 group("run_sksllex") {
603 }
604}
605
John Stilesd836f842020-09-14 10:21:44 -0400606# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
607if (skia_compile_processors || skia_compile_sksl_tests) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -0400608 skia_executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500609 defines = [
610 "SKSL_STANDALONE",
Brian Osmand010f652021-02-24 13:59:39 -0500611 "SK_DISABLE_TRACING",
Brian Osman8d09d4a2020-11-24 15:51:06 -0500612 "SK_ENABLE_SPIRV_VALIDATION",
613 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400614 sources = [
Brian Osman47726a12020-12-17 16:02:08 -0500615 "src/core/SkCpu.cpp",
616 "src/core/SkData.cpp",
617 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400618 "src/core/SkMalloc.cpp",
619 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400620 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500621 "src/core/SkStream.cpp",
622 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500623 "src/core/SkStringUtils.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400624 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500625 "src/core/SkUtils.cpp",
626 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400627 "src/gpu/GrBlockAllocator.cpp",
628 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500629 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400630 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500631 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400632 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500633 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400634 ]
Brian Osman47726a12020-12-17 16:02:08 -0500635 if (is_win) {
636 sources += [ "src/ports/SkOSFile_win.cpp" ]
637 } else {
638 sources += [ "src/ports/SkOSFile_posix.cpp" ]
639 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400640 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400641 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500642 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400643 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500644 ":run_sksllex",
Corentin Wallez89d6e792021-03-08 15:25:34 +0100645 "//third_party/externals/spirv-tools:spvtools",
646 "//third_party/externals/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400647 ]
648 }
649
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400650 skslc_path = "$root_out_dir/"
651 if (host_toolchain != default_toolchain_name) {
652 skslc_path += "$host_toolchain/"
653 }
654 skslc_path += "skslc"
655 if (host_os == "win") {
656 skslc_path += ".exe"
657 }
658
Brian Osmandd496172020-08-08 08:17:18 -0400659 action("create_sksl_fp") {
660 script = "gn/create_sksl_fp.py"
661 sources = [
662 "include/private/GrSharedEnums.h",
663 "src/sksl/sksl_fp_raw.sksl",
664 ]
665 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
666 args = [
667 rebase_path(sources[0]),
668 rebase_path(sources[1]),
669 rebase_path(outputs[0]),
670 ]
671 }
672
673 copy("sksl_pre_includes") {
674 sources = [
675 "src/sksl/sksl_frag.sksl",
676 "src/sksl/sksl_geom.sksl",
677 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500678 "src/sksl/sksl_public.sksl",
Brian Osmancbb60bd2021-04-12 09:49:20 -0400679 "src/sksl/sksl_rt_colorfilter.sksl",
680 "src/sksl/sksl_rt_shader.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400681 "src/sksl/sksl_vert.sksl",
682 ]
683 outputs = [ "$root_out_dir/{{source_file_part}}" ]
684 }
685
686 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
687 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
688
689 dehydrate_sksl_outputs = []
690 foreach(src, dehydrate_sksl_sources) {
691 name = get_path_info(src, "name")
692
693 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
694 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
695 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
696 "src/sksl/generated/$name.dehydrated.sksl",
697 target_out_dir) ]
698 }
699
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400700 action("dehydrate_sksl") {
701 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400702 deps = [
703 ":create_sksl_fp",
704 ":sksl_pre_includes",
705 ":skslc(//gn/toolchain:$host_toolchain)",
706 ]
707 sources = dehydrate_sksl_sources
708 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000709 args = [
710 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400711 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000712 ]
Brian Osmandd496172020-08-08 08:17:18 -0400713 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400714 }
John Stilesd836f842020-09-14 10:21:44 -0400715} else {
716 group("dehydrate_sksl") {
717 }
718}
719
720skia_gpu_processor_outputs = []
721if (skia_compile_processors) {
722 foreach(src, skia_gpu_processor_sources) {
723 dir = get_path_info(src, "dir")
724 name = get_path_info(src, "name")
725
726 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
727 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
728 skia_gpu_processor_outputs += [
729 "$target_out_dir/" +
730 rebase_path("$dir/generated/$name.h", target_out_dir),
731 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
732 # confused due to the same file being named by two different paths
733 ]
734 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400735
Ethan Nicholas762466e2017-06-29 10:03:38 -0400736 action("compile_processors") {
737 script = "gn/compile_processors.py"
738 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400739 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400740 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400741 ":skslc(//gn/toolchain:$host_toolchain)",
742 ]
743 sources = skia_gpu_processor_sources
744 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400745 args = [
746 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400747 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400748 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400749 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400750 args += rebase_path(skia_gpu_processor_sources)
751 }
752} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400753 group("compile_processors") {
754 }
John Stilesd836f842020-09-14 10:21:44 -0400755}
756
757if (skia_compile_sksl_tests) {
758 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400759
John Stiles7e248712020-09-24 16:42:09 -0400760 template("compile_sksl") {
761 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
762 action("compile_sksl_${target_name}") {
763 script = "gn/compile_sksl_tests.py"
764 deps = [
765 ":create_sksl_fp",
766 ":sksl_pre_includes",
767 ":skslc(//gn/toolchain:$host_toolchain)",
768 ]
John Stilesda57fc02021-01-22 11:54:30 -0500769 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400770 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500771 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500772 args = [
773 rebase_path(skslc_path),
774 invoker.lang,
775 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500776 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500777 ]
778
John Stilesbfc9be02021-01-22 11:55:48 -0500779 testsDir = get_path_info("tests", "abspath")
780 resourcesDir = get_path_info("resources", "abspath")
781
782 foreach(partialPath, invoker.sources) {
783 dst = testsDir + partialPath
784 src = resourcesDir + partialPath
785
786 dir = get_path_info(dst, "dir")
John Stiles0a0a50a2021-04-14 09:35:24 -0400787
788 # We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
789 # Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
790 # For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
791 # For input path "file.cc", name will contain "file" and ext will contain ".cc".
792 nameTmp = get_path_info(dst, "name")
793 name = get_path_info(nameTmp, "name")
794 ext = get_path_info(nameTmp, "extension")
795 ext += get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500796 response_file_contents += rebase_path([
797 src,
798 dir,
799 ])
John Stilesda57fc02021-01-22 11:54:30 -0500800 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500801
John Stilesda57fc02021-01-22 11:54:30 -0500802 foreach(outExtension, invoker.outExtensions) {
John Stilesc3012182020-12-08 15:07:00 -0500803 # SPIR-V uses separate extensions for .vert and .geom shaders.
John Stiles82ab3402021-04-13 17:13:03 -0400804 if (ext == "vert" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500805 outExtension = ".asm.vert"
John Stiles82ab3402021-04-13 17:13:03 -0400806 } else if (ext == "geom" && outExtension == ".asm.frag") {
John Stilesc3012182020-12-08 15:07:00 -0500807 outExtension = ".asm.geom"
808 }
John Stilesbfc9be02021-01-22 11:55:48 -0500809 outputs +=
810 [ target_out_dir + "/" +
811 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400812 }
813 }
John Stiles7e248712020-09-24 16:42:09 -0400814 }
John Stilesd836f842020-09-14 10:21:44 -0400815 }
John Stiles7e248712020-09-24 16:42:09 -0400816 compile_sksl("fp_tests") {
817 sources = sksl_fp_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500818 outExtensions = [
819 ".cpp",
820 ".h",
John Stiles7e248712020-09-24 16:42:09 -0400821 ]
822 lang = "--fp"
823 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400824 }
John Stiles82ab3402021-04-13 17:13:03 -0400825 compile_sksl("dsl_fp_tests") {
826 sources = sksl_dsl_fp_tests_sources
827 outExtensions = [
John Stiles0a0a50a2021-04-14 09:35:24 -0400828 ".dsl.cpp",
John Stiles82ab3402021-04-13 17:13:03 -0400829 ".h",
830 ]
831 lang = "--dslfp"
832 settings = "--settings"
833 }
John Stiles7e248712020-09-24 16:42:09 -0400834 compile_sksl("glsl_tests") {
835 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500836 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400837 lang = "--glsl"
838 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400839 }
John Stiles7e248712020-09-24 16:42:09 -0400840 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400841 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500842 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400843 lang = "--glsl"
844 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400845 }
John Stilesaeae3a52020-09-25 13:35:58 -0400846 compile_sksl("metal_tests") {
847 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500848 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400849 lang = "--metal"
850 settings = "--settings"
851 }
Brian Osman977feec2020-12-22 11:28:59 -0500852 compile_sksl("skvm_tests") {
853 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500854 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500855 lang = "--skvm"
856 settings = "--settings"
857 }
Brian Osman62b039b2021-02-08 13:49:53 -0500858 compile_sksl("stage_tests") {
859 sources = sksl_stage_tests_sources
860 outExtensions = [ ".stage" ]
861 lang = "--stage"
862 settings = "--settings"
863 }
John Stilesdda1d312020-11-20 16:28:50 -0500864 compile_sksl("spirv_tests") {
865 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500866 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500867 lang = "--spirv"
868 settings = "--settings"
869 }
John Stilesd836f842020-09-14 10:21:44 -0400870} else {
John Stiles7e248712020-09-24 16:42:09 -0400871 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400872 }
John Stiles7e248712020-09-24 16:42:09 -0400873 group("compile_sksl_glsl_tests") {
874 }
875 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400876 }
John Stilesaeae3a52020-09-25 13:35:58 -0400877 group("compile_sksl_metal_tests") {
878 }
Brian Osman977feec2020-12-22 11:28:59 -0500879 group("compile_sksl_skvm_tests") {
880 }
John Stilesdda1d312020-11-20 16:28:50 -0500881 group("compile_sksl_spirv_tests") {
882 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400883}
884
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500885optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700886 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400887 deps = [
888 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400889 ":compile_sksl_fp_tests",
890 ":compile_sksl_glsl_nosettings_tests",
891 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400892 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500893 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500894 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400895 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700896 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400897 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700898 if (skia_generate_workarounds) {
899 deps += [ ":workaround_list" ]
900 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800901 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600902 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400903 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700904
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400905 sources =
906 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400907 if (!skia_enable_ccpr) {
908 sources -= skia_ccpr_sources
909 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
910 }
mtklein06c35c02016-09-20 12:28:12 -0700911
Robert Phillips3b97aa22021-05-03 11:42:40 -0400912 if (skia_enable_nga) {
913 sources += skia_nga_sources
914 }
915
Mike Klein703cf5a2016-10-13 17:18:04 -0400916 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400917 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700918
John Rosascoa9b348f2019-11-08 13:18:15 -0800919 if (skia_use_gl) {
920 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400921 if (is_android) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500922 sources += [
923 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
924 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
925 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400926
927 # this lib is required to link against AHardwareBuffer
928 if (defined(ndk_api) && ndk_api >= 26) {
929 libs += [ "android" ]
930 }
931 } else if (skia_use_egl) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500932 sources += [
933 "src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
934 "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
935 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400936 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400937 } else if (skia_use_webgl) {
938 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400939 } else if (is_linux && skia_use_x11) {
Brian Salomonbe6de9b2021-02-18 16:23:41 -0500940 sources += [
941 "src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
942 "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
943 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400944 libs += [ "GL" ]
945 } else if (is_mac) {
946 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
947 } else if (is_ios) {
948 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
James Clarkeb8c0dab2021-02-09 06:22:41 -0800949 } else if (is_win && !skia_enable_winuwp) {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400950 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
951 if (target_cpu != "arm64") {
952 libs += [ "OpenGL32.lib" ]
953 }
954 } else {
955 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
956 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800957 sources += skia_gl_gpu_sources
958 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400959
mtkleine9fb3d52016-09-20 15:11:46 -0700960 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400961 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000962 if (skia_use_vma) {
963 deps += [ "third_party/vulkanmemoryallocator" ]
964 }
mtkleine9fb3d52016-09-20 15:11:46 -0700965 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700966 if (skia_enable_vulkan_debug_layers) {
967 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
968 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800969 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800970 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700971 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
972 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400973 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700974 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800975 }
mtkleine9fb3d52016-09-20 15:11:46 -0700976 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400977
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400978 if (is_android && (skia_use_gl || skia_use_vulkan)) {
979 # this lib is required to link against AHardwareBuffer
980 if (defined(ndk_api) && ndk_api >= 26) {
981 libs += [ "android" ]
982 }
983 }
984
Stephen White0d70b712019-07-10 15:51:30 -0400985 if (skia_use_dawn) {
986 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400987 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700988 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400989 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700990 "//third_party/externals/dawn/src/dawn:dawn_proc",
991 "//third_party/externals/dawn/src/dawn:dawncpp",
992 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400993 ]
994 if (dawn_enable_d3d12) {
995 libs += [
996 "d3d12.lib",
997 "dxgi.lib",
998 "d3dcompiler.lib",
999 ]
1000 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -04001001 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -04001002 }
1003 }
1004
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001005 if (skia_use_direct3d) {
1006 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -04001007 deps += [
1008 "//third_party/d3d12allocator",
1009 "//third_party/spirv-cross:spirv_cross",
1010 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001011 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001012 if (skia_enable_direct3d_debug_layer) {
1013 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
1014 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001015 libs += [
1016 "d3d12.lib",
1017 "dxgi.lib",
1018 "d3dcompiler.lib",
1019 ]
1020 }
1021
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001022 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -04001023 if (skia_use_metal) {
1024 public_defines += [ "SK_METAL" ]
1025 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -04001026 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001027 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +00001028 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -04001029 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001030
Kevin Lubickf4def342018-10-04 12:52:50 -04001031 if (is_debug) {
1032 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
1033 }
mtklein06c35c02016-09-20 12:28:12 -07001034}
1035
Leon Scroggins III41169202019-01-29 09:29:57 -05001036optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -05001037 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -05001038 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
1039 if ("True" ==
1040 exec_script("gn/checkpath.py",
1041 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
1042 "trim string")) {
1043 public_defines = [ "SK_USE_LIBGIFCODEC" ]
1044 public_include_dirs = [
1045 ".",
1046 skia_libgifcodec_path,
1047 ]
1048 include_dirs = public_include_dirs
1049 import(_libgifcodec_gni_path)
1050 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
1051 ".",
1052 skia_libgifcodec_path)
1053 }
Leon Scroggins III41169202019-01-29 09:29:57 -05001054}
1055
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001056optional("heif") {
1057 enabled = skia_use_libheif
1058 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
1059
1060 deps = []
1061
Mike Kleina01c6b02020-04-01 13:47:34 -05001062 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001063}
1064
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001065optional("jpeg_decode") {
1066 enabled = skia_use_libjpeg_turbo_decode
1067 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
1068
Mike Kleina01c6b02020-04-01 13:47:34 -05001069 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001070 sources = [
1071 "src/codec/SkJpegCodec.cpp",
1072 "src/codec/SkJpegDecoderMgr.cpp",
1073 "src/codec/SkJpegUtility.cpp",
1074 ]
1075}
1076
1077optional("jpeg_encode") {
1078 enabled = skia_use_libjpeg_turbo_encode
1079 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -07001080
Mike Kleina01c6b02020-04-01 13:47:34 -05001081 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1082 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001083 sources = [
mtklein63213812016-08-24 09:55:56 -07001084 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001085 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001086 ]
1087}
1088
Leon Scroggins III326b9892020-08-05 16:51:10 -04001089optional("ndk_images") {
1090 enabled = skia_use_ndk_images
1091 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1092 sources = [
1093 "src/ports/SkImageEncoder_NDK.cpp",
1094 "src/ports/SkImageGeneratorNDK.cpp",
1095 "src/ports/SkNDKConversions.cpp",
1096 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001097 libs = [ "jnigraphics" ]
1098}
1099
mtklein63213812016-08-24 09:55:56 -07001100optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001101 enabled = skia_use_zlib && skia_enable_pdf
1102 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001103
Mike Kleina01c6b02020-04-01 13:47:34 -05001104 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001105 if (skia_use_libjpeg_turbo_decode) {
1106 deps += [ ":jpeg_decode" ]
1107 }
1108 if (skia_use_libjpeg_turbo_encode) {
1109 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001110 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001111 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001112 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001113 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001114 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1115 deps += [ "//third_party/harfbuzz" ]
1116 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1117 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001118 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001119 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001120 }
1121}
1122
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001123optional("xps") {
1124 enabled = skia_use_xps && is_win
1125 public_defines = [ "SK_SUPPORT_XPS" ]
1126 public = skia_xps_public
1127 sources = skia_xps_sources
1128}
1129
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001130optional("png_decode") {
1131 enabled = skia_use_libpng_decode
1132 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001133
Mike Kleina01c6b02020-04-01 13:47:34 -05001134 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001135 sources = [
1136 "src/codec/SkIcoCodec.cpp",
1137 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001138 ]
1139}
1140
1141optional("png_encode") {
1142 enabled = skia_use_libpng_encode
1143 public_defines = [ "SK_ENCODE_PNG" ]
1144
Mike Kleina01c6b02020-04-01 13:47:34 -05001145 deps = [ "//third_party/libpng" ]
1146 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001147}
1148
scroggof84ad642016-10-31 09:02:57 -07001149optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001150 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001151 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1152
1153 deps = [
1154 "//third_party/dng_sdk",
1155 "//third_party/libjpeg-turbo:libjpeg",
1156 "//third_party/piex",
1157 ]
1158
1159 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1160 # Skia.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001161 configs = [ "gn/portable:add_exceptions" ]
scroggof84ad642016-10-31 09:02:57 -07001162
Mike Kleina01c6b02020-04-01 13:47:34 -05001163 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001164}
1165
Mike Klein852a8cb2018-05-15 10:46:58 -04001166import("third_party/skcms/skcms.gni")
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001167skia_source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001168 cflags = []
1169 if (!is_win || is_clang) {
1170 cflags += [
1171 "-w",
1172 "-std=c11",
1173 ]
1174 }
1175
Mike Kleina01c6b02020-04-01 13:47:34 -05001176 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001177 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001178 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1179}
1180
mtklein3cc22182016-08-29 13:26:14 -07001181optional("typeface_freetype") {
1182 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001183
Mike Kleina01c6b02020-04-01 13:47:34 -05001184 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001185 sources = [
1186 "src/ports/SkFontHost_FreeType.cpp",
1187 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001188 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001189 ]
1190}
1191
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001192optional("webp_decode") {
1193 enabled = skia_use_libwebp_decode
1194 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001195
Mike Kleina01c6b02020-04-01 13:47:34 -05001196 deps = [ "//third_party/libwebp" ]
1197 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001198}
1199
1200optional("webp_encode") {
1201 enabled = skia_use_libwebp_encode
1202 public_defines = [ "SK_ENCODE_WEBP" ]
1203
Mike Kleina01c6b02020-04-01 13:47:34 -05001204 deps = [ "//third_party/libwebp" ]
1205 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001206}
1207
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001208optional("wuffs") {
1209 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001210 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001211
Mike Kleina01c6b02020-04-01 13:47:34 -05001212 deps = [ "//third_party/wuffs" ]
1213 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001214}
1215
mtklein63213812016-08-24 09:55:56 -07001216optional("xml") {
1217 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001218 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001219
Mike Kleina01c6b02020-04-01 13:47:34 -05001220 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001221 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001222 "src/svg/SkSVGCanvas.cpp",
1223 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001224 "src/xml/SkDOM.cpp",
1225 "src/xml/SkXMLParser.cpp",
1226 "src/xml/SkXMLWriter.cpp",
1227 ]
1228}
1229
Mike Klein613ad382019-06-06 11:42:02 -05001230optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001231 enabled = skia_enable_skvm_jit_when_possible
1232 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001233 if (skia_vtune_path != "") {
1234 public_defines += [ "SKVM_JIT_VTUNE" ]
1235 public_include_dirs = [ "$skia_vtune_path/include" ]
1236 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1237 }
Mike Klein613ad382019-06-06 11:42:02 -05001238}
1239
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001240if (skia_enable_gpu && skia_generate_workarounds) {
1241 action("workaround_list") {
1242 script = "tools/build_workaround_header.py"
1243
Mike Kleina01c6b02020-04-01 13:47:34 -05001244 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001245
1246 # see comments in skia_compile_processors about out dir path shenanigans.
1247 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001248 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001249
Mike Kleina01c6b02020-04-01 13:47:34 -05001250 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001251 args = [
1252 "--output-file",
1253 "$output_file",
1254 ]
1255
1256 foreach(file, inputs) {
1257 args += [ rebase_path(file, root_build_dir) ]
1258 }
1259 }
1260}
1261
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001262skia_component("skia") {
mtkleinc04ff472016-06-23 10:29:30 -07001263 public_configs = [ ":skia_public" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001264 configs = skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001265
Mike Klein607b0a72018-11-07 16:17:34 -05001266 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001267 ":fontmgr_FontConfigInterface",
1268 ":fontmgr_android",
1269 ":fontmgr_custom_directory",
1270 ":fontmgr_custom_embedded",
1271 ":fontmgr_custom_empty",
1272 ":fontmgr_fontconfig",
1273 ":fontmgr_fuchsia",
1274 ":fontmgr_mac_ct",
1275 ":fontmgr_win",
1276 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001277 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001278 ":pdf",
1279 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001280 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001281 ]
1282
mtkleinc04ff472016-06-23 10:29:30 -07001283 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001284 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001285 ":arm64",
1286 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001287 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001288 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001289 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001290 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001291 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001292 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001293 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001294 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001295 ":jpeg_decode",
1296 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001297 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001298 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001299 ":png_decode",
1300 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001301 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001302 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001303 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001304 ":sse2",
1305 ":sse41",
1306 ":sse42",
1307 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001308 ":webp_decode",
1309 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001310 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001311 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001312 ]
1313
Hal Canaryc25f4e92019-02-26 11:54:25 -05001314 public = skia_core_public
1315 public += skia_utils_public
1316 public += skia_effects_public
1317 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001318
mtkleinc04ff472016-06-23 10:29:30 -07001319 sources = []
brettwb9447282016-09-01 14:24:39 -07001320 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001321 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001322 sources += skia_effects_sources
1323 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001324 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001325 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001326 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001327 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001328 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001329 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001330 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001331 "src/codec/SkBmpCodec.cpp",
1332 "src/codec/SkBmpMaskCodec.cpp",
1333 "src/codec/SkBmpRLECodec.cpp",
1334 "src/codec/SkBmpStandardCodec.cpp",
1335 "src/codec/SkCodec.cpp",
1336 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001337 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001338 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001339 "src/codec/SkMaskSwizzler.cpp",
1340 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001341 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001342 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001343 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001344 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001345 "src/codec/SkSwizzler.cpp",
1346 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001347 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001348 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001349 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001350 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001351 "src/ports/SkMemory_malloc.cpp",
1352 "src/ports/SkOSFile_stdio.cpp",
1353 "src/sfnt/SkOTTable_name.cpp",
1354 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001355 ]
brettwb9447282016-09-01 14:24:39 -07001356
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001357 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001358 libs = []
1359
mtkleinc04ff472016-06-23 10:29:30 -07001360 if (is_win) {
1361 sources += [
1362 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001363 "src/ports/SkImageEncoder_WIC.cpp",
1364 "src/ports/SkImageGeneratorWIC.cpp",
1365 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001366 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001367 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001368 libs += [
Mike Klein4b167fc2016-10-11 18:13:53 -04001369 "Ole32.lib",
1370 "OleAut32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001371 ]
James Clarkeb8c0dab2021-02-09 06:22:41 -08001372
1373 if (!skia_enable_winuwp) {
1374 libs += [
1375 "FontSub.lib",
1376 "User32.lib",
1377 "Usp10.lib",
1378 ]
1379 }
mtkleinc04ff472016-06-23 10:29:30 -07001380 } else {
1381 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001382 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001383 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001384 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001385 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001386 }
1387
mtklein7d6fb2c2016-08-25 14:50:44 -07001388 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001389 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001390 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001391 deps += [ "//third_party/cpu-features" ]
1392 }
mtklein06c35c02016-09-20 12:28:12 -07001393 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001394 libs += [
1395 "EGL",
1396 "GLESv2",
1397 "log",
1398 ]
1399 }
1400
Kevin Lubick217056c2018-09-20 17:39:31 -04001401 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001402 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001403 if (skia_use_egl) {
1404 libs += [ "GLESv2" ]
1405 }
mtkleinc04ff472016-06-23 10:29:30 -07001406 }
1407
1408 if (is_mac) {
1409 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001410 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001411 "src/ports/SkImageEncoder_CG.cpp",
1412 "src/ports/SkImageGeneratorCG.cpp",
1413 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001414 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001415 "ApplicationServices.framework",
1416 "OpenGL.framework",
1417 ]
mtkleinc04ff472016-06-23 10:29:30 -07001418 }
abarth6fc8ff02016-07-15 15:15:15 -07001419
Mike Klein7d302882016-11-03 14:06:31 -04001420 if (is_ios) {
1421 sources += [
1422 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001423 "src/ports/SkImageEncoder_CG.cpp",
1424 "src/ports/SkImageGeneratorCG.cpp",
1425 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001426 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001427 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001428 "ImageIO.framework",
1429 "MobileCoreServices.framework",
1430 ]
1431 }
1432
abarth6fc8ff02016-07-15 15:15:15 -07001433 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001434 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001435 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001436
1437 if (skia_enable_spirv_validation) {
Corentin Wallez89d6e792021-03-08 15:25:34 +01001438 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001439 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1440 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001441
1442 if (skia_include_multiframe_procs) {
1443 sources += [ "tools/SkSharingProc.cpp" ]
1444 }
mtkleinc04ff472016-06-23 10:29:30 -07001445}
1446
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001447# DebugCanvas used in experimental/wasm-skp-debugger
1448if (target_cpu == "wasm") {
Ben Wagner25eb5342021-03-22 14:07:15 -04001449 skia_static_library("debugcanvas") {
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001450 public_configs = [ ":skia_public" ]
1451
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001452 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001453 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001454 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001455 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001456 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001457 "tools/debugger/DrawCommand.cpp",
1458 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001459 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001460 }
1461}
1462
Ben Wagner25eb5342021-03-22 14:07:15 -04001463skia_static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001464 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001465 public_configs = [ ":skia_public" ]
Ben Wagner25eb5342021-03-22 14:07:15 -04001466 configs = skia_library_configs
Kevin Lubickcbcff382018-10-02 09:02:18 -04001467
1468 deps = [
1469 ":arm64",
1470 ":armv7",
1471 ":avx",
1472 ":crc32",
1473 ":hsw",
1474 ":none",
1475 ":sse2",
1476 ":sse41",
1477 ":sse42",
1478 ":ssse3",
1479 ]
1480
Kevin Lubickcbcff382018-10-02 09:02:18 -04001481 sources = []
1482 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001483 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001484 sources += [
1485 "src/core/SkAnalyticEdge.cpp",
1486 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001487 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001488 "src/core/SkCubicMap.cpp",
1489 "src/core/SkEdge.cpp",
1490 "src/core/SkEdgeBuilder.cpp",
1491 "src/core/SkEdgeClipper.cpp",
1492 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001493 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001494 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001495 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001496 "src/core/SkMallocPixelRef.cpp",
1497 "src/core/SkMath.cpp",
1498 "src/core/SkMatrix.cpp",
1499 "src/core/SkOpts.cpp",
1500 "src/core/SkPaint.cpp",
1501 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001502 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001503 "src/core/SkPathEffect.cpp",
1504 "src/core/SkPathMeasure.cpp",
1505 "src/core/SkPathRef.cpp",
1506 "src/core/SkPoint.cpp",
1507 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001508 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001509 "src/core/SkRect.cpp",
1510 "src/core/SkSemaphore.cpp",
1511 "src/core/SkStream.cpp",
1512 "src/core/SkString.cpp",
1513 "src/core/SkStringUtils.cpp",
1514 "src/core/SkStroke.cpp",
1515 "src/core/SkStrokeRec.cpp",
1516 "src/core/SkStrokerPriv.cpp",
1517 "src/core/SkThreadID.cpp",
1518 "src/core/SkUtils.cpp",
1519 "src/effects/SkDashPathEffect.cpp",
1520 "src/effects/SkTrimPathEffect.cpp",
1521 "src/ports/SkDebug_stdio.cpp",
1522 "src/ports/SkMemory_malloc.cpp",
1523 "src/utils/SkDashPath.cpp",
1524 "src/utils/SkParse.cpp",
1525 "src/utils/SkParsePath.cpp",
1526 "src/utils/SkUTF.cpp",
1527 ]
1528}
1529
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001530group("modules") {
1531 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001532 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001533 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001534 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001535 "modules/skshaper",
Tyler Denniston333b9382021-03-18 13:48:52 -04001536 "modules/svg",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001537 ]
1538}
1539
Julia Lavrova159fd842021-02-24 12:15:08 -05001540group("experimental") {
1541 deps = [ "experimental/sktext" ]
1542}
1543
Brian Osmancd28fa62020-07-07 16:01:26 -04001544config("our_vulkan_headers") {
1545 include_dirs = [ "include/third_party/vulkan" ]
1546}
1547
mtkleinc095df52016-08-24 12:23:52 -07001548# Targets guarded by skia_enable_tools may use //third_party freely.
1549if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001550 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001551 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001552 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001553 "include/c",
1554 "include/codec",
1555 "include/config",
1556 "include/core",
1557 "include/docs",
1558 "include/effects",
1559 "include/encode",
1560 "include/gpu",
1561 "include/pathops",
1562 "include/ports",
1563 "include/svg",
1564 "include/utils",
1565 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001566 "modules/particles/include",
1567 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001568 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001569 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001570 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001571 ]
1572
Mike Klein308b5ac2016-12-06 16:03:52 -05001573 # Used by gn_to_bp.py to list our public include dirs.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001574 skia_source_set("public") {
1575 configs = [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001576 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001577 }
1578
Mike Kleinc36dedf2016-11-18 09:35:28 -05001579 config("skia.h_config") {
1580 include_dirs = [ "$target_gen_dir" ]
1581 }
1582 action("skia.h") {
1583 public_configs = [ ":skia.h_config" ]
1584 skia_h = "$target_gen_dir/skia.h"
1585 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001586
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001587 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1588 [ rebase_path(skia_h, root_build_dir) ] +
1589 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001590 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001591 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001592 }
1593
Brian Osmanc9a42472018-05-31 13:17:12 -04001594 if (target_cpu == "x64") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001595 skia_executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001596 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001597 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001598 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001599 "tools/fiddle/draw.cpp",
1600 "tools/fiddle/fiddle_main.cpp",
1601 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001602
1603 if (skia_use_egl) {
1604 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001605 } else {
1606 sources += [ "tools/fiddle/null_context.cpp" ]
1607 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001608 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001609 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001610 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001611 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001612 ":skia",
1613 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001614 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001615 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001616 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001617 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001618 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001619 ]
1620 }
1621 }
1622
Mike Kleine5463e62020-06-11 13:53:53 -05001623 config("cpp14") {
1624 if (is_win) {
1625 cflags_cc = [ "/std:c++14" ]
1626 } else {
1627 cflags_cc = [ "-std=c++14" ]
1628 }
1629 }
1630
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001631 skia_source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001632 sources = [ "tools/public_headers_warnings_check.cpp" ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001633 configs = [
Mike Kleine5463e62020-06-11 13:53:53 -05001634 ":our_vulkan_headers",
1635 ":cpp14",
1636 ]
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001637 if (defined(skia_header_target_default_configs)) {
1638 configs += skia_header_target_default_configs
1639 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001640 deps = [
1641 ":skia",
1642 ":skia.h",
1643 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001644 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001645 ]
Stephen White0d70b712019-07-10 15:51:30 -04001646
1647 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001648 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001649 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001650 }
1651
mtkleinc095df52016-08-24 12:23:52 -07001652 template("test_lib") {
1653 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001654 if (defined(invoker.public_defines)) {
1655 defines = invoker.public_defines
1656 }
mtklein25c81d42016-07-27 13:55:26 -07001657 }
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001658 skia_source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001659 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001660 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001661 public_configs = [
1662 ":" + target_name + "_config",
1663 ":skia_private",
1664 ]
1665
1666 if (!defined(deps)) {
1667 deps = []
1668 }
1669 deps += [ ":skia" ]
1670 testonly = true
1671 }
mtklein25c81d42016-07-27 13:55:26 -07001672 }
mtklein25c81d42016-07-27 13:55:26 -07001673
Mike Kleine6682eb2017-01-05 10:54:57 -05001674 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001675 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001676 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001677 forward_variables_from(invoker,
1678 "*",
1679 [
1680 "output_name",
1681 "visibility",
1682 "is_shared_library",
1683 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001684 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001685 extra_configs = [ ":skia_private" ]
1686 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1687 data_sources = [ "resources" ]
1688 if ("True" == exec_script("//gn/checkdir.py",
1689 [ rebase_path("skps", root_build_dir) ],
1690 "trim string")) {
1691 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001692 }
Brian Salomon06c9e292021-04-29 14:10:23 -04001693 if ("True" == exec_script("//gn/checkdir.py",
1694 [ rebase_path("mskps", root_build_dir) ],
1695 "trim string")) {
1696 data_sources += [ "mskps" ]
1697 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001698 }
1699 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001700 # !is_ios
1701
1702 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001703 skia_shared_library("lib" + target_name) {
1704 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001705 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001706 if (!defined(configs)) {
1707 configs = []
1708 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001709 configs += [ ":skia_private" ]
1710 testonly = true
1711 }
1712 } else {
1713 _executable = target_name
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001714 skia_executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001715 check_includes = false
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001716 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001717 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001718 if (!defined(configs)) {
1719 configs = []
1720 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001721 configs += [ ":skia_private" ]
1722 testonly = true
1723 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001724 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001725 if (is_android && skia_android_serial != "" && defined(_executable)) {
1726 action("push_" + target_name) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04001727 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001728 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001729 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001730 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001731 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001732 args = [
1733 rebase_path("$root_build_dir/$_executable"),
1734 skia_android_serial,
1735 rebase_path(_stamp),
1736 ]
1737 testonly = true
1738 }
Mike Klein7d921032017-01-05 12:20:41 -05001739 }
1740 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001741 }
1742
mtkleinc095df52016-08-24 12:23:52 -07001743 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001744 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001745
Mike Klein9e25bb92019-04-29 09:46:36 -05001746 # Bots and even devs may not have Vulkan headers, so put
1747 # include/third_party/vulkan on our path so they're always available.
1748 all_dependent_configs = [ ":our_vulkan_headers" ]
1749
Mike Klein333fb452019-04-24 08:48:11 -05001750 defines = []
1751 if (skia_enable_discrete_gpu) {
1752 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1753 }
1754
Brian Osmanc9a42472018-05-31 13:17:12 -04001755 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001756 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001757 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001758 "tools/gpu/BackendSurfaceFactory.cpp",
1759 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001760 "tools/gpu/BackendTextureImageFactory.cpp",
1761 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001762 "tools/gpu/FlushFinishTracker.cpp",
1763 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001764 "tools/gpu/GrContextFactory.cpp",
1765 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001766 "tools/gpu/ManagedBackendTexture.cpp",
1767 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001768 "tools/gpu/MemoryCache.cpp",
1769 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001770 "tools/gpu/ProxyUtils.cpp",
1771 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001772 "tools/gpu/TestOps.cpp",
1773 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001774 "tools/gpu/YUVUtils.cpp",
1775 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001776 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1777 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001778 "tools/gpu/mock/MockTestContext.cpp",
1779 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001780
1781 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001782 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001783
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001784 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001785 sources +=
1786 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001787 if (is_ios) {
1788 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001789 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001790 } else if (is_mac) {
1791 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001792 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001793 if (skia_use_angle) {
1794 deps += [ "//third_party/angle2" ]
1795 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1796 }
Brian Salomon1171d312020-03-19 08:47:44 -04001797 }
1798
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001799 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1800 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001801 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001802 if (is_android || skia_use_egl) {
1803 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1804 libs += [ "EGL" ]
1805 } else if (is_linux) {
1806 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1807 libs += [
1808 "GLU",
1809 "GL",
1810 "X11",
1811 ]
1812 } else if (is_win) {
1813 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1814 libs += [ "Gdi32.lib" ]
1815 if (target_cpu != "arm64") {
1816 libs += [ "OpenGL32.lib" ]
1817 }
1818 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001819 }
Greg Daniel54200e42018-12-11 17:03:39 -05001820
Brian Osmanc9a42472018-05-31 13:17:12 -04001821 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001822 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001823 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001824 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1825 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001826 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001827 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001828 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1829 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001830 }
1831 if (skia_use_metal) {
1832 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001833 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001834 if (skia_use_direct3d) {
1835 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001836 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001837 }
Stephen White985741a2019-07-18 11:43:45 -04001838 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001839 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001840 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001841 if (is_clang) {
1842 cflags_cc = [ "-Wno-microsoft-cast" ]
1843 }
Stephen White985741a2019-07-18 11:43:45 -04001844 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001845
1846 if (is_fuchsia && using_fuchsia_sdk) {
1847 libs +=
1848 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1849 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001850 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001851
mtkleinc095df52016-08-24 12:23:52 -07001852 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001853 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001854 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001855
1856 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001857 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1858 deps = [ ":flags" ]
1859 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001860 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001861 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001862 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1863 deps = [ ":flags" ]
1864 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001865 }
1866 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001867 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1868 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001869 }
1870 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001871 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1872 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001873 }
mtklein25c81d42016-07-27 13:55:26 -07001874
Mike Klein499f0ac2019-03-25 13:00:12 -05001875 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001876 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001877 sources = [
1878 "tools/trace/ChromeTracingTracer.cpp",
1879 "tools/trace/ChromeTracingTracer.h",
1880 "tools/trace/EventTracingPriv.cpp",
1881 "tools/trace/EventTracingPriv.h",
1882 "tools/trace/SkDebugfTracer.cpp",
1883 "tools/trace/SkDebugfTracer.h",
1884 ]
1885 }
1886
mtkleinc095df52016-08-24 12:23:52 -07001887 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001888 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001889 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001890 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001891 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001892 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001893 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001894 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001895 "tools/LsanSuppressions.cpp",
Brian Salomon06c9e292021-04-29 14:10:23 -04001896 "tools/MSKPPlayer.cpp",
1897 "tools/MSKPPlayer.h",
mtkleinc095df52016-08-24 12:23:52 -07001898 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001899 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001900 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001901 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001902 "tools/SkMetaData.cpp",
1903 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001904 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001905 "tools/SkSharingProc.h",
1906 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001907 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001908 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001909 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001910 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001911 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001912 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001913 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001914 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001915 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001916 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001917 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001918 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001919 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001920 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001921 "tools/fonts/TestEmptyTypeface.h",
1922 "tools/fonts/TestFontMgr.cpp",
1923 "tools/fonts/TestFontMgr.h",
1924 "tools/fonts/TestSVGTypeface.cpp",
1925 "tools/fonts/TestSVGTypeface.h",
1926 "tools/fonts/TestTypeface.cpp",
1927 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001928 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001929 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001930 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001931 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001932 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001933 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001934 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001935 if (target_cpu != "wasm") {
1936 sources += [ "tools/CrashHandler.cpp" ]
1937 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001938 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001939 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001940 if (is_ios) {
1941 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001942 sources += [ "tools/ios_utils.h" ]
1943 if (skia_use_metal) {
1944 sources += [ "tools/AutoreleasePool.mm" ]
1945 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001946 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001947 } else if (is_mac) {
1948 if (skia_use_metal) {
1949 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001950 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001951 }
James Clarkeb8c0dab2021-02-09 06:22:41 -08001952 } else if (is_win && !skia_enable_winuwp) {
Mike Kleinbf15b662019-04-15 11:32:16 -05001953 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001954 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001955
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001956 defines = []
1957 if (skia_tools_require_resources) {
1958 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1959 }
mtkleinc095df52016-08-24 12:23:52 -07001960 deps = [
1961 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001962 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001963 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001964 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001965 }
mtklein25c81d42016-07-27 13:55:26 -07001966
Mike Kleine11e5c12019-04-24 12:46:06 -05001967 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001968 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001969 }
1970
Mike Klein6e744122016-10-27 12:21:40 -04001971 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001972 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001973 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001974 if (skia_use_gl) {
1975 sources += gl_gm_sources
1976 }
mtkleinc095df52016-08-24 12:23:52 -07001977 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001978 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001979 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001980 ":skia",
1981 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001982 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001983 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001984 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001985 "modules/skparagraph",
1986 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001987 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001988 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001989 if (is_skia_dev_build) {
1990 sources += [ "gm/fiddle.cpp" ]
1991 deps += [ ":skia.h" ]
1992 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001993 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001994
1995 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001996 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001997 sources += [ "gm/video_decoder.cpp" ]
1998 }
mtkleinc095df52016-08-24 12:23:52 -07001999 }
mtklein25c81d42016-07-27 13:55:26 -07002000
Ben Wagnerbded42a2021-02-17 22:14:34 -05002001 test_lib("test") {
2002 sources = [
2003 "tests/Test.cpp",
2004 "tests/Test.h",
2005 "tests/TestUtils.cpp",
2006 "tests/TestUtils.h",
2007 ]
2008 deps = [
2009 ":flags",
2010 ":skia",
2011 ":tool_utils",
2012 ]
2013 public_deps = [
2014 ":gpu_tool_utils", # Test.h #includes headers from this target.
2015 ]
2016 }
2017
Mike Klein6e744122016-10-27 12:21:40 -04002018 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07002019 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04002020 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002021 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04002022 if (skia_use_metal) {
2023 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00002024 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07002025 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04002026 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002027 if (skia_use_gl) {
2028 sources += gl_tests_sources
2029 }
mtkleinc095df52016-08-24 12:23:52 -07002030 deps = [
2031 ":flags",
Ben Wagnere75021e2021-02-17 22:18:34 -05002032 ":fontmgr_android_tests",
2033 ":fontmgr_fontconfig_tests",
Ben Wagnera3e5e552021-02-22 15:37:33 +00002034 ":fontmgr_mac_ct_tests",
mtkleinc095df52016-08-24 12:23:52 -07002035 ":skia",
Ben Wagnerbded42a2021-02-17 22:14:34 -05002036 ":test",
mtkleinc095df52016-08-24 12:23:52 -07002037 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04002038 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04002039 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002040 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00002041 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04002042 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05002043 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07002044 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05002045 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07002046 "//third_party/zlib",
2047 ]
2048 }
mtklein2f3416d2016-08-02 16:02:05 -07002049
Mike Klein6e744122016-10-27 12:21:40 -04002050 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07002051 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07002052 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07002053 deps = [
2054 ":flags",
2055 ":gm",
2056 ":gpu_tool_utils",
2057 ":skia",
2058 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002059 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002060 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07002061 ]
2062 }
mtklein2b6870c2016-07-28 14:17:33 -07002063
Mike Reedd62d4062019-06-12 10:20:44 -04002064 test_lib("experimental_xform") {
2065 sources = [
2066 "experimental/xform/SkShape.cpp",
2067 "experimental/xform/SkXform.cpp",
2068 "experimental/xform/XContext.cpp",
2069 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05002070 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04002071 }
2072
Florin Malitabfe876a2018-09-02 12:33:59 -04002073 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04002074 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002075 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04002076 }
Florin Malitab3418102020-10-15 18:10:29 -04002077 test_app("svg_tool") {
2078 deps = [ "modules/svg:tool" ]
2079 }
Florin Malita79725d32018-06-05 16:16:57 -04002080 }
2081
Hal Canary5b39dc82019-04-17 13:29:46 -04002082 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002083 sources = [ "tools/skqp/make_skqp_model.cpp" ]
2084 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04002085 }
2086
Chris Dalton2b598902020-03-25 10:50:35 -06002087 import("gn/samples.gni")
2088 test_lib("samples") {
2089 sources = samples_sources
Mike Kleina01c6b02020-04-01 13:47:34 -05002090 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06002091 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06002092 ":flags",
2093 ":gpu_tool_utils",
2094 ":xml",
Julia Lavrova159fd842021-02-24 12:15:08 -05002095 "experimental/sktext:samples",
Jorge Betancourtb8621312020-09-10 15:16:35 -04002096 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06002097 "modules/skparagraph:samples",
2098 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002099 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04002100 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06002101 ]
Chris Dalton2b598902020-03-25 10:50:35 -06002102 }
Kevin Lubick00398742020-10-08 10:05:07 -04002103 test_lib("hash_and_encode") {
2104 sources = [
2105 "tools/HashAndEncode.cpp",
2106 "tools/HashAndEncode.h",
2107 ]
2108 deps = [
2109 ":flags",
2110 ":skia",
2111 "//third_party/libpng",
2112 ]
2113 }
Chris Dalton2b598902020-03-25 10:50:35 -06002114 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10002115 test_app("convert-to-nia") {
2116 sources = [ "tools/convert-to-nia.cpp" ]
2117 deps = [ ":skia" ]
2118 }
Mike Klein7af351a2018-07-27 09:54:43 -04002119 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002120 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002121 deps = [
2122 ":skcms",
2123 ":skia",
2124 ]
2125 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002126 test_app("fm") {
2127 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002128 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002129 "tools/fm/fm.cpp",
2130 ]
2131 deps = [
2132 ":common_flags_aa",
2133 ":common_flags_gpu",
2134 ":flags",
2135 ":gm",
2136 ":gpu_tool_utils",
2137 ":hash_and_encode",
2138 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002139 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002140 ":tool_utils",
2141 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002142 "modules/skottie",
2143 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002144 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002145 ]
2146 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002147 test_app("dm") {
2148 sources = [
2149 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002150 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002151 "dm/DMJsonWriter.cpp",
2152 "dm/DMSrcSink.cpp",
2153 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002154 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002155 ":common_flags_aa",
2156 ":common_flags_config",
2157 ":common_flags_gpu",
2158 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002159 ":flags",
2160 ":gm",
2161 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002162 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002163 ":skia",
2164 ":tests",
2165 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002166 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002167 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002168 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002169 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002170 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002171 ]
2172 }
Robert Phillipscd1e3972021-02-22 17:24:22 -05002173 test_app("ddlbench") {
2174 sources = [ "experimental/ddlbench/ddlbench.cpp" ]
2175 deps = [
2176 ":flags",
2177 ":skia",
2178 ":tool_utils",
2179 ]
2180 }
Michael Ludwig30217952020-12-04 12:58:35 -05002181
2182 # optional separate library to dlopen when running CanvasStateTests.
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002183 skia_shared_library("canvas_state_lib") {
Michael Ludwig30217952020-12-04 12:58:35 -05002184 sources = [
2185 "tests/CanvasStateHelpers.cpp",
2186 "tests/CanvasStateHelpers.h",
2187 ]
2188 deps = [ ":skia" ]
2189 }
Brian Osman16adfa32016-10-18 14:42:44 -04002190 }
2191
Mike Kleina8a51ce2018-01-09 12:34:11 -05002192 if (!is_win) {
2193 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002194 sources = [ "tools/remote_demo.cpp" ]
2195 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002196 }
2197 }
2198
Hal Canarye107faa2019-10-23 12:52:33 -04002199 if (!is_win) {
2200 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002201 sources = [ "tools/blob_cache_sim.cpp" ]
2202 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002203 }
2204 }
2205
Mike Kleine6682eb2017-01-05 10:54:57 -05002206 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002207 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002208 deps = [
2209 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002210 ":common_flags_aa",
2211 ":common_flags_config",
2212 ":common_flags_gpu",
2213 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002214 ":flags",
2215 ":gm",
2216 ":gpu_tool_utils",
2217 ":skia",
2218 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002219 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002220 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002221 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002222 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002223 ]
mtklein2b6870c2016-07-28 14:17:33 -07002224 }
halcanary19a97202016-08-03 15:08:04 -07002225
Ravi Mistry10d36c52017-01-31 09:49:18 -05002226 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002227 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002228 deps = [
2229 ":flags",
2230 ":skia",
2231 ]
2232 }
2233
Mike Reedc0ee21f2019-05-28 16:11:03 -04002234 if (skia_use_ffmpeg) {
2235 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002236 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002237 deps = [
2238 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002239 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002240 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002241 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002242 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002243 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002244 ]
2245 }
2246 }
2247
Brian Osmanc9a42472018-05-31 13:17:12 -04002248 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002249 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002250 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002251 ":common_flags_config",
2252 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002253 ":flags",
2254 ":gpu_tool_utils",
2255 ":skia",
2256 ":tool_utils",
2257 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002258 }
2259
Mike Kleine6682eb2017-01-05 10:54:57 -05002260 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002261 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002262 deps = [
2263 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002264 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002265 ]
halcanary3eee9d92016-09-10 07:01:53 -07002266 }
mtklein046cb562016-09-16 10:23:12 -07002267
Ben Wagner219f3622017-07-17 15:32:25 -04002268 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002269 sources = [ "tools/fonts/create_test_font.cpp" ]
2270 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002271 assert_no_deps = [
2272 # tool_utils requires the output of this app.
2273 ":tool_utils",
2274 ]
2275 }
2276
Florin Malita5d3ff432018-07-31 16:38:43 -04002277 if (skia_use_expat) {
2278 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002279 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002280 deps = [
2281 ":flags",
2282 ":skia",
2283 ":tool_utils",
2284 ]
2285 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002286 }
2287
Mike Kleine6682eb2017-01-05 10:54:57 -05002288 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002289 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002290 deps = [
2291 ":flags",
2292 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002293 ]
mtklein046cb562016-09-16 10:23:12 -07002294 }
mtkleinecbc5262016-09-22 11:51:24 -07002295
Brian Osman6788a542018-12-10 11:56:01 -05002296 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002297 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002298 sources = [
2299 "tools/skiaserve/Request.cpp",
2300 "tools/skiaserve/Response.cpp",
2301 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002302 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2303 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2304 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2305 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2306 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2307 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2308 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2309 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2310 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002311 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2312 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002313 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2314 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2315 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2316 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2317 ]
2318 deps = [
2319 ":flags",
2320 ":gpu_tool_utils",
2321 ":skia",
2322 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002323 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002324 ]
Mike Klein7d302882016-11-03 14:06:31 -04002325 }
mtkleinecbc5262016-09-22 11:51:24 -07002326 }
kjlubick14f984b2016-10-03 11:49:45 -07002327
Mike Kleine6682eb2017-01-05 10:54:57 -05002328 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002329 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002330 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002331 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002332 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002333 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002334 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002335 "fuzz/FuzzCreateDDL.cpp",
Adlai Hollerea8d1972021-02-23 13:05:32 -05002336 "fuzz/FuzzDDLThreading.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002337 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002338 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002339 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002340 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002341 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002342 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002343 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002344 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002345 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002346 "fuzz/FuzzSkParagraph.cpp",
Robert Phillips98b066c2021-04-22 10:51:58 -04002347 "fuzz/FuzzTriangulation.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002348 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002349 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2350 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002351 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002352 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002353 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002354 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002355 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2356 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002357 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002358 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2359 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002360 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002361 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002362 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002363 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002364 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002365 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002366 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002367 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002368 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002369 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002370 "tools/debugger/DrawCommand.cpp",
2371 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002372 ]
2373 deps = [
2374 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002375 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002376 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002377 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002378 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002379 ]
kjlubick14f984b2016-10-03 11:49:45 -07002380 }
Mike Klein38312422016-10-05 15:41:01 -04002381
Mike Kleine6682eb2017-01-05 10:54:57 -05002382 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002383 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002384 rebase_path("tests/skia_test.cpp"),
2385 rebase_path("tests/Test.cpp"),
2386 ]
caryclark9feb6322016-10-25 08:58:26 -07002387 deps = [
2388 ":flags",
2389 ":gpu_tool_utils",
2390 ":skia",
2391 ":tool_utils",
2392 ]
caryclark9feb6322016-10-25 08:58:26 -07002393 }
2394
Mike Kleine6682eb2017-01-05 10:54:57 -05002395 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002396 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002397 deps = [
2398 ":flags",
2399 ":skia",
2400 ]
Mike Klein38312422016-10-05 15:41:01 -04002401 }
bungemanfe917272016-10-13 17:36:40 -04002402
Mike Kleine6682eb2017-01-05 10:54:57 -05002403 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002404 sources = [
2405 "tools/skdiff/skdiff.cpp",
2406 "tools/skdiff/skdiff_html.cpp",
2407 "tools/skdiff/skdiff_main.cpp",
2408 "tools/skdiff/skdiff_utils.cpp",
2409 ]
2410 deps = [
2411 ":skia",
2412 ":tool_utils",
2413 ]
bungemanfe917272016-10-13 17:36:40 -04002414 }
halcanarya73d76a2016-10-17 13:19:02 -07002415
Mike Kleine6682eb2017-01-05 10:54:57 -05002416 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002417 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002418 deps = [
2419 ":skia",
2420 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002421 ]
halcanarya73d76a2016-10-17 13:19:02 -07002422 }
Brian Osman16adfa32016-10-18 14:42:44 -04002423
Brian Osmanc9a42472018-05-31 13:17:12 -04002424 if (!is_win) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002425 source_set("skqp_lib") { # Not a skia_source_set
Colin Cross654eb2a2019-11-08 13:08:36 -08002426 check_includes = false
2427 testonly = true
Colin Cross654eb2a2019-11-08 13:08:36 -08002428 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002429 defines =
2430 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002431 sources = [
2432 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002433 "tools/skqp/src/skqp.cpp",
2434 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002435 ]
2436 deps = [
2437 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002438 ":skia",
2439 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002440 ":tool_utils",
2441 ]
2442 }
2443 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002444 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002445 include_dirs = [ "//" ]
2446 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002447 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002448 }
2449 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002450 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002451 deps = [
2452 ":gm",
2453 ":skia",
2454 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002455 ]
2456 }
2457 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002458 if (is_fuchsia) {
2459 # Build a package repository for skqp on Fuchsia.
2460 group("skqp_repo") {
2461 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002462 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002463 }
2464 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002465 if (is_android) {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002466 shared_library("libskqp_app") { # Not a skia_shared_library
Colin Cross654eb2a2019-11-08 13:08:36 -08002467 configs += [ ":skia_private" ]
Colin Cross654eb2a2019-11-08 13:08:36 -08002468 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002469 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002470 deps = [
2471 ":skia",
2472 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002473 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002474 ]
2475 libs = [ "android" ]
2476 }
2477 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002478 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002479 test_app("skottie_android") {
2480 is_shared_library = true
2481
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002482 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002483 libs = []
2484
Stan Iliev93151722018-08-02 11:10:52 -04002485 deps = [
2486 ":skia",
2487 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002488 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002489 ]
2490 }
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002491
2492 test_app("androidkit") {
2493 is_shared_library = true
2494
Florin Malita2a650cc2021-04-12 13:38:44 -04002495 sources = [
Florin Malita8bad8f72021-04-13 10:05:27 -04002496 "modules/androidkit/src/AndroidKit.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002497 "modules/androidkit/src/Canvas.cpp",
Jorge Betancourt5cddd7f2021-04-29 13:33:50 -04002498 "modules/androidkit/src/Matrix.cpp",
Florin Malitade89bf02021-04-13 11:06:43 -04002499 "modules/androidkit/src/Paint.cpp",
Florin Malita05bb5a82021-04-22 09:37:50 -04002500 "modules/androidkit/src/RuntimeShaderBuilder.cpp",
2501 "modules/androidkit/src/Shader.cpp",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002502 "modules/androidkit/src/SkottieAnimation.cpp",
Florin Malita2a650cc2021-04-12 13:38:44 -04002503 "modules/androidkit/src/Surface.cpp",
Jorge Betancourte3f80302021-05-13 11:24:37 -04002504 "modules/androidkit/src/Surface.h",
Jorge Betancourtf102b882021-04-26 13:48:56 -04002505 "modules/androidkit/src/SurfaceThread.cpp",
2506 "modules/androidkit/src/SurfaceThread.h",
Florin Malita2a650cc2021-04-12 13:38:44 -04002507 ]
Jorge Betancourtf102b882021-04-26 13:48:56 -04002508 libs = [
2509 "android",
2510 "jnigraphics",
2511 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002512
Florin Malita2cc65382021-04-26 21:59:35 -04002513 deps = [
2514 ":sk_app",
2515 ":skia",
Florin Malita5e8d88e2021-05-18 09:54:10 -04002516 "modules/skottie:skottie",
Florin Malita2cc65382021-04-26 21:59:35 -04002517 ]
Jorge Betancourt265e3e12021-04-08 15:27:13 -04002518 }
Stan Iliev93151722018-08-02 11:10:52 -04002519 }
Hal Canary75427132017-10-11 16:00:31 -04002520
Hal Canarya9de7602018-01-19 13:08:23 -05002521 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002522 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002523 deps = [
2524 ":gm",
2525 ":skia",
2526 ]
2527 }
2528 test_app("list_gpu_unit_tests") {
2529 sources = [
2530 "dm/DMGpuTestProcs.cpp",
2531 "tools/list_gpu_unit_tests.cpp",
2532 ]
2533 deps = [
2534 ":skia",
2535 ":tests",
2536 ]
2537 }
2538
Brian Osmanc9a42472018-05-31 13:17:12 -04002539 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002540 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002541 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002542 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002543 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002544 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002545 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002546 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002547 "tools/sk_app/CommandSet.h",
2548 "tools/sk_app/DisplayParams.h",
2549 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002550 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002551 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002552 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002553 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002554 ]
2555 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002556 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002557
2558 if (is_android) {
2559 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002560 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002561 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002562 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002563 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002564 "tools/sk_app/android/main_android.cpp",
2565 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002566 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002567 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002568 libs += [ "android" ]
2569 } else if (is_linux) {
2570 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002571 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002572 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002573 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002574 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002575 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002576 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002577 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002578 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002579 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002580 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002581 "X11",
2582 ]
2583 } else if (is_win) {
2584 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002585 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002586 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002587 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002588 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002589 "tools/sk_app/win/main_win.cpp",
2590 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002591 } else if (is_mac) {
2592 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002593 "tools/sk_app/mac/WindowContextFactory_mac.h",
2594 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002595 "tools/sk_app/mac/Window_mac.mm",
2596 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002597 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002598 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002599 "QuartzCore.framework",
2600 "Cocoa.framework",
2601 "Foundation.framework",
2602 ]
2603 } else if (is_ios) {
2604 sources += [
John Stilesab9578e2020-06-30 17:36:55 -04002605 "tools/sk_app/ios/WindowContextFactory_ios.h",
2606 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002607 "tools/sk_app/ios/Window_ios.mm",
2608 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002609 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002610 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002611 }
2612
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002613 if (skia_use_gl) {
2614 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002615 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002616 if (is_android) {
2617 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2618 } else if (is_linux) {
2619 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2620 } else if (is_win) {
2621 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2622 if (skia_use_angle) {
2623 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2624 }
2625 } else if (is_mac) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002626 sources += [
2627 "tools/sk_app/mac/GLWindowContext_mac.mm",
2628 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2629 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002630 } else if (is_ios) {
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002631 sources += [
2632 "tools/sk_app/ios/GLWindowContext_ios.mm",
2633 "tools/sk_app/ios/RasterWindowContext_ios.mm",
2634 ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002635 }
2636 }
2637
Brian Osmanc9a42472018-05-31 13:17:12 -04002638 if (skia_use_vulkan) {
2639 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002640 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002641 if (is_android) {
2642 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2643 } else if (is_linux) {
2644 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2645 libs += [ "X11-xcb" ]
2646 } else if (is_win) {
2647 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2648 }
2649 }
2650
Jim Van Verthbe39f712019-02-08 15:36:14 -05002651 if (skia_use_metal) {
2652 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002653 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002654 if (is_mac) {
2655 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002656 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002657 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002658 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002659 }
2660
Jim Van Verth682a2f42020-05-13 16:54:09 -04002661 if (skia_use_direct3d) {
2662 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2663 }
2664
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002665 if (skia_use_dawn) {
2666 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002667 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002668 if (is_linux) {
2669 if (dawn_enable_vulkan) {
2670 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2671 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2672 libs += [ "X11-xcb" ]
2673 }
2674 } else if (is_win) {
2675 if (dawn_enable_d3d12) {
2676 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2677 }
2678 } else if (is_mac) {
2679 if (dawn_enable_metal) {
2680 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2681 }
2682 }
2683 }
2684
Mike Kleina01c6b02020-04-01 13:47:34 -05002685 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002686 if (is_android) {
2687 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002688 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002689 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002690 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002691 }
Brian Osman16adfa32016-10-18 14:42:44 -04002692 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002693
Hal Canary87515122019-03-15 14:22:51 -04002694 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2695 test_app("fiddle_examples") {
2696 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002697 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002698 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002699 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002700 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002701 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002702 cflags = [
2703 "/wd4756", # Overflow in constant arithmetic
2704 "/wd4305", # truncation from 'double' to 'float'
2705 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002706 }
Hal Canary87515122019-03-15 14:22:51 -04002707 deps = [
2708 ":skia",
2709 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002710 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002711 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002712 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002713 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002714 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002715 ]
2716 }
2717 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002718
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002719 # sk_app can work without GL but viewer always runs raster through a GL window context.
2720 if (skia_use_gl) {
2721 test_app("viewer") {
2722 is_shared_library = is_android
2723 sources = [
2724 "tools/viewer/AnimTimer.h",
2725 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002726 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002727 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002728 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002729 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002730 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002731 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002732 "tools/viewer/ImageSlide.h",
Brian Salomon06c9e292021-04-29 14:10:23 -04002733 "tools/viewer/MSKPSlide.cpp",
2734 "tools/viewer/MSKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002735 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002736 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002737 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002738 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002739 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002740 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002741 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002742 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002743 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002744 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002745 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002746 "tools/viewer/SkottieSlide.h",
2747 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002748 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002749 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002750 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002751 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002752 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002753 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002754 "tools/viewer/TouchGesture.cpp",
2755 "tools/viewer/TouchGesture.h",
2756 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002757 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002758 ]
2759 libs = []
2760
2761 deps = [
2762 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002763 ":flags",
2764 ":gm",
2765 ":gpu_tool_utils",
2766 ":samples",
2767 ":sk_app",
2768 ":skia",
2769 ":tool_utils",
2770 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002771 "experimental/skrive",
Julia Lavrova159fd842021-02-24 12:15:08 -05002772 "experimental/sktext",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002773 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002774 "modules/particles",
2775 "modules/skottie",
2776 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002777 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002778 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002779 "//third_party/imgui",
2780 ]
2781 if (skia_use_experimental_xform) {
2782 deps += [ ":experimental_xform" ]
2783 sources += [ "gm/xform.cpp" ]
2784 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002785 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002786 deps += [
Corentin Wallez89d6e792021-03-08 15:25:34 +01002787 "//third_party/externals/spirv-tools:spvtools",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002788
Corentin Wallez89d6e792021-03-08 15:25:34 +01002789 #spvtools depends on this but doesn't deps it in.
2790 "//third_party/externals/spirv-tools:spvtools_val",
Brian Salomon3207fbe2020-06-30 11:09:25 -04002791 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002792 }
Mike Reedd62d4062019-06-12 10:20:44 -04002793 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002794 }
2795
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002796 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002797 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002798 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002799 libs = []
2800
Brian Osmaneff04b52017-11-21 13:18:02 -05002801 deps = [
2802 ":flags",
2803 ":gpu_tool_utils",
2804 ":sk_app",
2805 ":skia",
2806 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002807 ]
2808 }
2809 }
2810
Mike Klein9f6468f2020-05-19 13:14:40 -05002811 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002812 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002813 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002814 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002815 deps = [
2816 ":gpu_tool_utils",
2817 ":skia",
2818 "//third_party/libsdl",
2819 ]
2820 }
2821 }
2822
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002823 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2824 action_foreach("generate_mocs") {
2825 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002826 sources = [ "tools/mdbviz/MainWindow.h" ]
2827 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002828 args = [
2829 "$skia_qt_path" + "/bin/moc",
2830 "{{source}}",
2831 "-o",
2832 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2833 ]
2834 }
2835 action_foreach("generate_resources") {
2836 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002837 sources = [ "tools/mdbviz/resources.qrc" ]
2838 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002839 args = [
2840 "$skia_qt_path" + "/bin/rcc",
2841 "{{source}}",
2842 "-o",
2843 "gen/mdbviz/{{source_name_part}}_res.cpp",
2844 ]
2845 }
2846 test_app("mdbviz") {
2847 if (is_win) {
2848 # on Windows we need to disable some exception handling warnings due to the Qt headers
2849 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2850 }
2851 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002852 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002853 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002854 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002855 "tools/debugger/DrawCommand.cpp",
2856 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002857 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002858 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002859 "tools/mdbviz/main.cpp",
2860
2861 # generated files
2862 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2863 "$target_gen_dir/mdbviz/resources_res.cpp",
2864 ]
2865 lib_dirs = [ "$skia_qt_path/lib" ]
2866 libs = [
2867 "Qt5Core.lib",
2868 "Qt5Gui.lib",
2869 "Qt5Widgets.lib",
2870 ]
2871 include_dirs = [
2872 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002873 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002874 "$skia_qt_path/include/QtWidgets",
2875 ]
2876 deps = [
2877 ":generate_mocs",
2878 ":generate_resources",
2879 ":skia",
2880 ]
2881 }
2882 }
2883
Mike Kleine459afd2017-03-03 09:21:30 -05002884 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002885 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002886 sources = [ "$ndk/$ndk_gdbserver" ]
2887 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002888 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002889 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002890
2891 if (skia_use_opencl) {
2892 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002893 sources = [ "tools/hello-opencl.cpp" ]
2894 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002895 }
2896 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002897
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002898 skia_executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002899 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002900 deps = [
2901 ":skia",
2902 "modules/particles",
2903 ]
2904 }
2905
Ben Wagnerf6cc8582021-04-19 14:12:12 +00002906 if (skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002907 test_app("editor") {
2908 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002909 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002910 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002911 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002912
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002913 skia_executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002914 sources = [ "tools/image_diff_metric.cpp" ]
2915 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002916 }
Chris Dalton2b598902020-03-25 10:50:35 -06002917
2918 group("modules_testonly") {
2919 testonly = true
2920 deps = []
2921 if (target_cpu == "wasm") {
2922 deps += [ "modules/canvaskit:viewer_wasm" ]
2923 }
2924 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002925
2926 if (skia_build_fuzzers) {
2927 template("libfuzzer_app") {
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002928 skia_executable(target_name) {
2929 output_dir = root_build_dir
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002930 check_includes = false
2931 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04002932 if (!defined(configs)) {
2933 configs = []
2934 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002935 configs += [ ":skia_private" ]
2936 sources += [
2937 "fuzz/Fuzz.cpp",
2938 "fuzz/FuzzCommon.cpp",
2939 ]
2940 deps += [
2941 ":flags",
2942 ":gpu_tool_utils",
2943 ":skia",
2944 ]
2945 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2946 if (skia_use_libfuzzer_defaults) {
2947 cflags = [ "-fsanitize=fuzzer" ]
2948 ldflags = [ "-fsanitize=fuzzer" ]
2949 }
2950 testonly = true
2951 }
2952 }
2953
2954 libfuzzer_app("region_deserialize") {
2955 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2956 deps = []
2957 }
2958
2959 libfuzzer_app("image_filter_deserialize") {
2960 include_dirs = [
2961 "tools",
2962 "tools/fonts",
2963 ]
2964 sources = [
2965 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2966 "tools/Resources.cpp",
2967 "tools/fonts/TestFontMgr.cpp",
2968 "tools/fonts/TestSVGTypeface.cpp",
2969 "tools/fonts/TestTypeface.cpp",
2970 ]
Florin Malitab3418102020-10-15 18:10:29 -04002971 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002972 }
2973
2974 libfuzzer_app("region_set_path") {
2975 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2976 deps = []
2977 }
2978
2979 libfuzzer_app("textblob_deserialize") {
2980 include_dirs = [
2981 "tools",
2982 "tools/fonts",
2983 ]
2984 sources = [
2985 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2986 "tools/Resources.cpp",
2987 "tools/fonts/TestFontMgr.cpp",
2988 "tools/fonts/TestSVGTypeface.cpp",
2989 "tools/fonts/TestTypeface.cpp",
2990 ]
Florin Malitab3418102020-10-15 18:10:29 -04002991 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002992 }
2993
2994 libfuzzer_app("path_deserialize") {
2995 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2996 deps = []
2997 }
2998
2999 libfuzzer_app("image_decode") {
3000 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
3001 deps = []
3002 }
3003
3004 libfuzzer_app("animated_image_decode") {
3005 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
3006 deps = []
3007 }
3008
3009 libfuzzer_app("api_create_ddl") {
3010 include_dirs = [
3011 "include",
3012 "include/gpu",
3013 ]
3014 sources = [
3015 "fuzz/FuzzCreateDDL.cpp",
3016 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
3017 "tools/Resources.cpp",
3018 "tools/UrlDataManager.cpp",
3019 "tools/debugger/DebugCanvas.cpp",
3020 "tools/debugger/DebugLayerManager.cpp",
3021 "tools/debugger/DrawCommand.cpp",
3022 "tools/debugger/JsonWriteBuffer.cpp",
3023 "tools/fonts/TestFontMgr.cpp",
3024 "tools/fonts/TestSVGTypeface.cpp",
3025 "tools/fonts/TestTypeface.cpp",
3026 ]
3027 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003028 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003029 "//third_party/libpng",
3030 ]
3031 }
3032
3033 libfuzzer_app("api_draw_functions") {
3034 sources = [
3035 "fuzz/FuzzDrawFunctions.cpp",
3036 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
3037 ]
3038 deps = []
3039 }
3040
Adlai Hollerccb68662021-02-25 10:28:44 -05003041 libfuzzer_app("api_ddl_threading") {
3042 sources = [
3043 "fuzz/FuzzDDLThreading.cpp",
3044 "fuzz/oss_fuzz/FuzzDDLThreading.cpp",
3045 ]
3046 deps = []
3047 }
3048
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003049 libfuzzer_app("api_gradients") {
3050 sources = [
3051 "fuzz/FuzzGradients.cpp",
3052 "fuzz/oss_fuzz/FuzzGradients.cpp",
3053 ]
3054 deps = []
3055 }
3056
3057 libfuzzer_app("api_image_filter") {
3058 include_dirs = [
3059 "tools",
3060 "tools/debugger",
3061 ]
3062 sources = [
3063 "fuzz/FuzzCanvas.cpp",
3064 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
3065 "tools/UrlDataManager.cpp",
3066 "tools/debugger/DebugCanvas.cpp",
3067 "tools/debugger/DebugLayerManager.cpp",
3068 "tools/debugger/DrawCommand.cpp",
3069 "tools/debugger/JsonWriteBuffer.cpp",
3070 ]
3071 deps = [ "//third_party/libpng" ]
3072 }
3073
3074 libfuzzer_app("api_path_measure") {
3075 sources = [
3076 "fuzz/FuzzPathMeasure.cpp",
3077 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
3078 ]
3079 deps = []
3080 }
3081
3082 libfuzzer_app("api_pathop") {
3083 sources = [
3084 "fuzz/FuzzPathop.cpp",
3085 "fuzz/oss_fuzz/FuzzPathop.cpp",
3086 ]
3087 deps = []
3088 }
3089
Robert Phillips98b066c2021-04-22 10:51:58 -04003090 libfuzzer_app("api_triangulation") {
3091 sources = [
3092 "fuzz/FuzzTriangulation.cpp",
3093 "fuzz/oss_fuzz/FuzzTriangulation.cpp",
3094 ]
3095 deps = []
3096 }
3097
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003098 libfuzzer_app("api_raster_n32_canvas") {
3099 include_dirs = [
3100 "tools",
3101 "tools/debugger",
3102 "tools/fonts",
3103 ]
3104 sources = [
3105 "fuzz/FuzzCanvas.cpp",
3106 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
3107 "tools/Resources.cpp",
3108 "tools/UrlDataManager.cpp",
3109 "tools/debugger/DebugCanvas.cpp",
3110 "tools/debugger/DebugLayerManager.cpp",
3111 "tools/debugger/DrawCommand.cpp",
3112 "tools/debugger/JsonWriteBuffer.cpp",
3113 "tools/fonts/TestFontMgr.cpp",
3114 "tools/fonts/TestSVGTypeface.cpp",
3115 "tools/fonts/TestTypeface.cpp",
3116 ]
3117 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003118 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003119 "//third_party/libpng",
3120 ]
3121 }
3122
Kevin Lubick7845b972021-03-29 08:07:32 -04003123 libfuzzer_app("api_regionop") {
3124 sources = [
3125 "fuzz/FuzzRegionOp.cpp",
3126 "fuzz/oss_fuzz/FuzzRegionOp.cpp",
3127 ]
3128 deps = []
3129 }
3130
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003131 if (skia_use_gl) {
3132 libfuzzer_app("api_mock_gpu_canvas") {
3133 include_dirs = [
3134 "tools",
3135 "tools/debugger",
3136 "tools/fonts",
3137 ]
3138 sources = [
3139 "fuzz/FuzzCanvas.cpp",
3140 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
3141 "tools/LsanSuppressions.cpp",
3142 "tools/Resources.cpp",
3143 "tools/UrlDataManager.cpp",
3144 "tools/debugger/DebugCanvas.cpp",
3145 "tools/debugger/DebugLayerManager.cpp",
3146 "tools/debugger/DrawCommand.cpp",
3147 "tools/debugger/JsonWriteBuffer.cpp",
3148 "tools/fonts/TestFontMgr.cpp",
3149 "tools/fonts/TestSVGTypeface.cpp",
3150 "tools/fonts/TestTypeface.cpp",
3151 ]
3152 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003153 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003154 "//third_party/libpng",
3155 ]
3156 }
3157 }
3158
3159 libfuzzer_app("api_null_canvas") {
3160 include_dirs = [
3161 "tools",
3162 "tools/debugger",
3163 "tools/fonts",
3164 ]
3165 sources = [
3166 "fuzz/FuzzCanvas.cpp",
3167 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
3168 "tools/Resources.cpp",
3169 "tools/UrlDataManager.cpp",
3170 "tools/debugger/DebugCanvas.cpp",
3171 "tools/debugger/DebugLayerManager.cpp",
3172 "tools/debugger/DrawCommand.cpp",
3173 "tools/debugger/JsonWriteBuffer.cpp",
3174 "tools/fonts/TestFontMgr.cpp",
3175 "tools/fonts/TestSVGTypeface.cpp",
3176 "tools/fonts/TestTypeface.cpp",
3177 ]
3178 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003179 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003180 "//third_party/libpng",
3181 ]
3182 }
3183
Weston Tracey1a771fe2021-02-04 11:09:59 -05003184 libfuzzer_app("api_skparagraph") {
3185 sources = [
3186 "fuzz/FuzzSkParagraph.cpp",
3187 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3188 "tools/Resources.cpp",
3189 ]
3190 deps = [ "modules/skparagraph" ]
3191 }
3192
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003193 libfuzzer_app("api_svg_canvas") {
3194 include_dirs = [
3195 "include",
3196 "include/svg",
3197 ]
3198 sources = [
3199 "fuzz/FuzzCanvas.cpp",
3200 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3201 "tools/Resources.cpp",
3202 "tools/UrlDataManager.cpp",
3203 "tools/debugger/DebugCanvas.cpp",
3204 "tools/debugger/DebugLayerManager.cpp",
3205 "tools/debugger/DrawCommand.cpp",
3206 "tools/debugger/JsonWriteBuffer.cpp",
3207 "tools/fonts/TestFontMgr.cpp",
3208 "tools/fonts/TestSVGTypeface.cpp",
3209 "tools/fonts/TestTypeface.cpp",
3210 ]
3211 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003212 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003213 "//third_party/libpng",
3214 ]
3215 }
3216
3217 libfuzzer_app("png_encoder") {
3218 sources = [
3219 "fuzz/FuzzEncoders.cpp",
3220 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3221 ]
3222 deps = []
3223 }
3224
3225 libfuzzer_app("jpeg_encoder") {
3226 sources = [
3227 "fuzz/FuzzEncoders.cpp",
3228 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3229 ]
3230 deps = []
3231 }
3232
3233 libfuzzer_app("webp_encoder") {
3234 sources = [
3235 "fuzz/FuzzEncoders.cpp",
3236 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3237 ]
3238 deps = []
3239 }
3240
3241 libfuzzer_app("skottie_json") {
3242 sources = [
3243 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3244 "tools/Resources.cpp",
3245 "tools/fonts/TestFontMgr.cpp",
3246 "tools/fonts/TestSVGTypeface.cpp",
3247 "tools/fonts/TestTypeface.cpp",
3248 ]
3249 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003250 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003251 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003252 ]
3253 }
3254
3255 libfuzzer_app("skjson") {
3256 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3257 deps = []
3258 }
3259
3260 libfuzzer_app("api_polyutils") {
3261 sources = [
3262 "fuzz/FuzzPolyUtils.cpp",
3263 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3264 ]
3265 deps = [ ":skia" ]
3266 }
3267
3268 libfuzzer_app("android_codec") {
3269 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3270 deps = []
3271 }
3272
3273 libfuzzer_app("image_decode_incremental") {
3274 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3275 deps = []
3276 }
3277
3278 libfuzzer_app("sksl2glsl") {
3279 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3280 deps = []
3281 }
3282
3283 libfuzzer_app("sksl2spirv") {
3284 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3285 deps = []
3286 }
3287
3288 libfuzzer_app("sksl2metal") {
3289 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3290 deps = []
3291 }
3292
3293 libfuzzer_app("sksl2pipeline") {
3294 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3295 deps = []
3296 }
3297
3298 libfuzzer_app("skdescriptor_deserialize") {
3299 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3300 deps = []
3301 }
3302
3303 libfuzzer_app("svg_dom") {
3304 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003305 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003306 }
3307
3308 libfuzzer_app("skruntimeeffect") {
3309 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3310 deps = []
3311 }
3312
3313 libfuzzer_app("skp") {
3314 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3315 deps = []
3316 }
3317 }
mtklein25c81d42016-07-27 13:55:26 -07003318}
Hal Canary932a2c02019-09-17 10:43:18 -04003319
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003320if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003321 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003322 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003323 }
Hal Canary27483062019-12-06 15:01:08 -05003324}
3325
Hal Canary60ff6512020-01-21 12:39:20 -05003326if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003327 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003328 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003329 }
3330}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003331
Ben Wagner3d9ab7e2021-03-16 14:29:20 -04003332skia_executable("skia_c_api_example") {
Martin Kustermannb65d2992020-12-15 16:15:13 +01003333 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3334 include_dirs = [ "." ]
3335 deps = [ ":skia" ]
3336}