blob: 01dfa5a41ae76a4cff2f708774928d60c56712b8 [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 }
Chinmay Gardef832c0a2020-03-18 14:37:23 -070057
58 # Some older versions of the Clang toolchain change the visibility of
59 # symbols decorated with API_AVAILABLE macro to be visible. Users of such
60 # toolchains suppress the use of this macro till toolchain updates are made.
61 if (is_mac || is_ios) {
62 if (skia_enable_api_available_macro) {
63 defines += [ "SK_ENABLE_API_AVAILABLE" ]
64 } else {
65 cflags_objcc += [ "-Wno-unguarded-availability" ]
66 }
67 }
mtkleinc04ff472016-06-23 10:29:30 -070068}
69
70# Skia internal APIs, used by Skia itself and a few test tools.
71config("skia_private") {
Mike Klein4f4c0642021-01-15 07:20:33 -060072 visibility = [ "./*" ]
mtkleinc04ff472016-06-23 10:29:30 -070073
Mike Reeda9e241d2017-05-03 10:52:00 -040074 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050075 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -070076 defines += [
77 "SK_GAMMA_EXPONENT=1.4",
78 "SK_GAMMA_CONTRAST=0.0",
79 ]
80 }
Mike Kleinb45d8622019-04-24 14:04:01 -050081 if (is_skia_dev_build) {
82 defines += [
83 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
84 "GR_TEST_UTILS=1",
85 ]
mtklein88a7ac02016-09-14 11:16:49 -070086 }
Brian Salomon789e25e2016-09-30 13:41:03 -040087 libs = []
88 lib_dirs = []
Brian Salomonf4ba4ec2020-03-19 15:54:28 -040089 if (skia_use_gl && skia_use_angle) {
Brian Osman34755e22016-12-05 09:46:02 -050090 defines += [ "SK_ANGLE" ]
91 }
Greg Danielb16beb92020-04-27 14:26:21 +000092 if (skia_use_vma) {
93 defines += [ "SK_USE_VMA" ]
94 }
mtkleinc04ff472016-06-23 10:29:30 -070095}
96
97# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
98config("skia_library") {
Mike Klein4f4c0642021-01-15 07:20:33 -060099 visibility = [ "./*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000100 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700101}
102
103skia_library_configs = [
104 ":skia_public",
105 ":skia_private",
106 ":skia_library",
107]
108
mtklein9b8583d2016-08-24 17:32:30 -0700109# Use for CPU-specific Skia code that needs particular compiler flags.
110template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500111 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700112 if (invoker.enabled) {
113 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500114 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700115 forward_variables_from(invoker, "*")
116 configs += skia_library_configs
117 }
118 } else {
119 # If not enabled, a phony empty target that swallows all otherwise unused variables.
120 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500121 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700122 forward_variables_from(invoker,
123 "*",
124 [
125 "sources",
126 "cflags",
127 ])
128 }
129 }
anmittala7eaf2e2016-08-17 13:57:26 -0700130}
131
mtklein422310d2016-08-16 18:28:43 -0700132is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700133
mtklein7d6fb2c2016-08-25 14:50:44 -0700134opts("none") {
135 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700136 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700137 cflags = []
138}
139
mtklein7d6fb2c2016-08-25 14:50:44 -0700140opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700141 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700142 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700143 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700144}
145
146opts("arm64") {
147 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700148 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700149 cflags = []
150}
151
152opts("crc32") {
153 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700154 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700155 cflags = [ "-march=armv8-a+crc" ]
156}
157
mtklein9b8583d2016-08-24 17:32:30 -0700158opts("sse2") {
159 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700160 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400161 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400162 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
163 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400164 cflags = [ "-msse2" ]
165 }
mtklein9b8583d2016-08-24 17:32:30 -0700166}
mtkleinc04ff472016-06-23 10:29:30 -0700167
mtklein9b8583d2016-08-24 17:32:30 -0700168opts("ssse3") {
169 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700170 sources = skia_opts.ssse3_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_SSSE3" ]
173 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400174 cflags = [ "-mssse3" ]
175 }
mtklein9b8583d2016-08-24 17:32:30 -0700176}
mtkleinc04ff472016-06-23 10:29:30 -0700177
mtklein9b8583d2016-08-24 17:32:30 -0700178opts("sse41") {
179 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.sse41_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_SSE41" ]
183 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400184 cflags = [ "-msse4.1" ]
185 }
mtklein9b8583d2016-08-24 17:32:30 -0700186}
mtklein4e976072016-08-08 09:06:27 -0700187
mtklein9b8583d2016-08-24 17:32:30 -0700188opts("sse42") {
189 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700190 sources = skia_opts.sse42_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_SSE42" ]
193 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400194 cflags = [ "-msse4.2" ]
195 }
mtklein9b8583d2016-08-24 17:32:30 -0700196}
197
198opts("avx") {
199 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700200 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400201 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000202 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400203 } else {
204 cflags = [ "-mavx" ]
Mike Klein1cc767b2019-12-13 13:02:22 -0500205 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500206 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Klein1cc767b2019-12-13 13:02:22 -0500207 }
Mike Klein3eb71212016-10-11 17:08:53 -0400208 }
mtkleinc04ff472016-06-23 10:29:30 -0700209}
210
Mike Klein1b9b7d52018-02-27 10:37:40 -0500211opts("hsw") {
212 enabled = is_x86
213 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400214 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500215 cflags = [ "/arch:AVX2" ]
216 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000217 cflags = [ "-march=haswell" ]
Mike Kleindb380222020-01-22 13:53:18 -0600218 if (is_mac && is_debug) {
Mike Kleinf800c1d2020-06-04 11:53:56 -0500219 cflags += [ "-fno-stack-check" ] # Work around skia:9709
Mike Kleindb380222020-01-22 13:53:18 -0600220 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500221 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500222}
223
Mike Kleinad56c4c2020-06-05 06:57:30 -0500224opts("skx") {
225 enabled = is_x86
226 sources = skia_opts.skx_sources
227 if (is_win) {
228 cflags = [ "/arch:AVX512" ]
229 } else {
230 cflags = [ "-march=skylake-avx512" ]
231 if (is_mac && is_debug) {
232 cflags += [ "-fno-stack-check" ] # Work around skia:9709
233 }
234 }
235}
236
mtkleinc095df52016-08-24 12:23:52 -0700237# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700238template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500239 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700240 if (invoker.enabled) {
241 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700242 if (defined(invoker.public_defines)) {
243 defines = invoker.public_defines
244 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600245 if (defined(invoker.public_configs)) {
246 configs = invoker.public_configs
247 }
Hal Canary2dad9902019-11-20 16:01:31 -0500248 if (defined(invoker.public_include_dirs)) {
249 include_dirs = invoker.public_include_dirs
250 }
mtklein457b42a2016-08-23 13:56:37 -0700251 }
252 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500253 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700254 forward_variables_from(invoker,
255 "*",
256 [
257 "public_defines",
258 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700259 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700260 ])
mtklein457b42a2016-08-23 13:56:37 -0700261 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700262 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700263 if (defined(invoker.configs_to_remove)) {
264 configs -= invoker.configs_to_remove
265 }
mtklein457b42a2016-08-23 13:56:37 -0700266 }
267 } else {
mtklein457b42a2016-08-23 13:56:37 -0700268 source_set(target_name) {
269 forward_variables_from(invoker,
270 "*",
271 [
Ben Wagnerea765a32020-06-05 13:42:30 -0400272 "public",
mtklein457b42a2016-08-23 13:56:37 -0700273 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400274 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700275 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700276 "libs",
Jim Van Verthef820be2020-08-12 10:45:00 -0400277 "frameworks",
mtklein457b42a2016-08-23 13:56:37 -0700278 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700279 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700280 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700281 ])
mtkleincd01b032016-08-31 04:58:19 -0700282 if (defined(invoker.sources_when_disabled)) {
283 sources = invoker.sources_when_disabled
284 }
285 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700286 }
mtkleineb3c4252016-08-23 07:38:09 -0700287 }
mtklein457b42a2016-08-23 13:56:37 -0700288}
mtklein457b42a2016-08-23 13:56:37 -0700289
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400290optional("android_utils") {
291 enabled = skia_enable_android_utils
292
Leon Scroggins III87caae62020-05-04 10:02:45 -0400293 public = [
294 "client_utils/android/BRDAllocator.h",
295 "client_utils/android/BitmapRegionDecoder.h",
296 "client_utils/android/FrontBufferedStream.h",
297 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400298 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
Leon Scroggins III87caae62020-05-04 10:02:45 -0400299 sources = [
300 "client_utils/android/BitmapRegionDecoder.cpp",
301 "client_utils/android/FrontBufferedStream.cpp",
302 ]
Leon Scroggins III63cfb362020-04-24 13:00:48 -0400303}
304
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400305group("fontmgr_factory") {
306 public_deps = [ skia_fontmgr_factory ]
307}
308
309optional("fontmgr_empty_factory") {
310 enabled = true
311 sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400312}
313
mtkleina45be612016-08-29 15:22:10 -0700314optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500315 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700316
317 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500318 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700319 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700320 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400321 public = [ "include/ports/SkFontMgr_android.h" ]
mtkleina45be612016-08-29 15:22:10 -0700322 sources = [
323 "src/ports/SkFontMgr_android.cpp",
mtkleina45be612016-08-29 15:22:10 -0700324 "src/ports/SkFontMgr_android_parser.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400325 "src/ports/SkFontMgr_android_parser.h",
mtkleina45be612016-08-29 15:22:10 -0700326 ]
327}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400328optional("fontmgr_android_factory") {
329 enabled = skia_enable_fontmgr_android
330 deps = [ ":fontmgr_android" ]
331 sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
332}
mtkleina45be612016-08-29 15:22:10 -0700333
mtkleind2e39db2016-09-07 07:52:55 -0700334optional("fontmgr_custom") {
Ben Wagner75626e42020-06-03 13:20:37 -0400335 enabled =
336 skia_enable_fontmgr_custom_directory ||
337 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
mtkleind2e39db2016-09-07 07:52:55 -0700338
Mike Kleina01c6b02020-04-01 13:47:34 -0500339 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400340 public = [ "src/ports/SkFontMgr_custom.h" ]
341 sources = [ "src/ports/SkFontMgr_custom.cpp" ]
342}
343
344optional("fontmgr_custom_directory") {
345 enabled = skia_enable_fontmgr_custom_directory
346
347 deps = [
348 ":fontmgr_custom",
349 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700350 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400351 public = [ "include/ports/SkFontMgr_directory.h" ]
352 sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
353}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400354optional("fontmgr_custom_directory_factory") {
355 enabled = skia_enable_fontmgr_custom_directory
356 deps = [ ":fontmgr_custom_directory" ]
357 sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
358}
Ben Wagner75626e42020-06-03 13:20:37 -0400359
360optional("fontmgr_custom_embedded") {
361 enabled = skia_enable_fontmgr_custom_embedded
362
363 deps = [
364 ":fontmgr_custom",
365 ":typeface_freetype",
366 ]
367 sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
mtkleind2e39db2016-09-07 07:52:55 -0700368}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400369optional("fontmgr_custom_embedded_factory") {
370 enabled = skia_enable_fontmgr_custom_embedded
371 deps = [ ":fontmgr_custom_embedded" ]
372 sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
373}
mtkleind2e39db2016-09-07 07:52:55 -0700374
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500375optional("fontmgr_custom_empty") {
376 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500377
Ben Wagner75626e42020-06-03 13:20:37 -0400378 deps = [
379 ":fontmgr_custom",
380 ":typeface_freetype",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800381 ]
Ben Wagner75626e42020-06-03 13:20:37 -0400382 public = [ "include/ports/SkFontMgr_empty.h" ]
383 sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
Hal Canaryff2742e2018-01-30 11:35:47 -0500384}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400385optional("fontmgr_custom_empty_factory") {
386 enabled = skia_enable_fontmgr_custom_empty
387 deps = [ ":fontmgr_custom_empty" ]
388 sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
389}
Hal Canaryff2742e2018-01-30 11:35:47 -0500390
mtklein3cc22182016-08-29 13:26:14 -0700391optional("fontmgr_fontconfig") {
Ben Wagner75626e42020-06-03 13:20:37 -0400392 enabled = skia_enable_fontmgr_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700393
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400394 # The public header includes fontconfig.h and uses FcConfig*
395 public_deps = [ "//third_party:fontconfig" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400396 public = [ "include/ports/SkFontMgr_fontconfig.h" ]
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400397 deps = [ ":typeface_freetype" ]
Ben Wagner75626e42020-06-03 13:20:37 -0400398 sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
399}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400400optional("fontmgr_fontconfig_factory") {
401 enabled = skia_enable_fontmgr_fontconfig
402 deps = [ ":fontmgr_fontconfig" ]
403 sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
404}
Ben Wagner75626e42020-06-03 13:20:37 -0400405
406optional("fontmgr_FontConfigInterface") {
407 enabled = skia_enable_fontmgr_FontConfigInterface
408
409 deps = [
410 ":typeface_freetype",
411 "//third_party:fontconfig",
412 ]
413 public = [
414 "include/ports/SkFontConfigInterface.h",
415 "include/ports/SkFontMgr_FontConfigInterface.h",
416 ]
mtklein3cc22182016-08-29 13:26:14 -0700417 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700418 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700419 "src/ports/SkFontConfigInterface_direct.cpp",
420 "src/ports/SkFontConfigInterface_direct_factory.cpp",
Ben Wagner75626e42020-06-03 13:20:37 -0400421 "src/ports/SkFontConfigTypeface.h",
mtklein3cc22182016-08-29 13:26:14 -0700422 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700423 ]
424}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400425optional("fontmgr_FontConfigInterface_factory") {
426 enabled = skia_enable_fontmgr_FontConfigInterface
427 deps = [ ":fontmgr_FontConfigInterface" ]
428 sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
429}
mtklein3cc22182016-08-29 13:26:14 -0700430
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500431optional("fontmgr_fuchsia") {
432 enabled = skia_enable_fontmgr_fuchsia
433
Chinmay Garde89820762019-05-06 16:44:06 -0700434 deps = []
435
436 if (is_fuchsia && using_fuchsia_sdk) {
John Rosasco24cbdab2019-09-25 14:14:35 -0700437 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700438 } else {
Mike Kleina01c6b02020-04-01 13:47:34 -0500439 deps = [ "//sdk/fidl/fuchsia.fonts" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700440 }
Ben Wagner75626e42020-06-03 13:20:37 -0400441 public = [ "src/ports/SkFontMgr_fuchsia.h" ]
442 sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500443}
444
Ben Wagner75626e42020-06-03 13:20:37 -0400445optional("fontmgr_mac_ct") {
Ben Wagnerd13487e2020-06-03 23:29:43 -0400446 enabled = skia_use_fonthost_mac
447
Ben Wagner75626e42020-06-03 13:20:37 -0400448 public = [
449 "include/ports/SkFontMgr_mac_ct.h",
450 "include/ports/SkTypeface_mac.h",
451 ]
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400452 sources = [
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400453 "src/ports/SkFontMgr_mac_ct.cpp",
Ben Wagner0ef90dd2020-06-05 11:25:42 -0400454 "src/ports/SkScalerContext_mac_ct.cpp",
455 "src/ports/SkScalerContext_mac_ct.h",
456 "src/ports/SkTypeface_mac_ct.cpp",
457 "src/ports/SkTypeface_mac_ct.h",
458 ]
Ben Wagnerd13487e2020-06-03 23:29:43 -0400459
460 if (is_mac) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400461 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400462 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
463 "AppKit.framework",
464 "ApplicationServices.framework",
465 ]
466 }
467
468 if (is_ios) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400469 frameworks = [
Ben Wagnerd13487e2020-06-03 23:29:43 -0400470 "CoreFoundation.framework",
471 "CoreGraphics.framework",
472 "CoreText.framework",
473
474 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
475 "UIKit.framework",
476 ]
477 }
478}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400479optional("fontmgr_mac_ct_factory") {
480 enabled = skia_use_fonthost_mac
481 deps = [ ":fontmgr_mac_ct" ]
482 sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
483}
Ben Wagnerd13487e2020-06-03 23:29:43 -0400484
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500485optional("fontmgr_win") {
486 enabled = skia_enable_fontmgr_win
487
Ben Wagner75626e42020-06-03 13:20:37 -0400488 public = [ "include/ports/SkTypeface_win.h" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500489 sources = [
490 "src/fonts/SkFontMgr_indirect.cpp",
491 "src/ports/SkFontMgr_win_dw.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500492 "src/ports/SkScalerContext_win_dw.cpp",
493 "src/ports/SkTypeface_win_dw.cpp",
494 ]
495}
Ben Wagner8c3daeb2020-06-29 11:59:10 -0400496optional("fontmgr_win_factory") {
497 enabled = skia_enable_fontmgr_win
498 deps = [ ":fontmgr_win" ]
499 sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
500}
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500501
502optional("fontmgr_win_gdi") {
503 enabled = skia_enable_fontmgr_win_gdi
504
Ben Wagner75626e42020-06-03 13:20:37 -0400505 public = [ "include/ports/SkTypeface_win.h" ]
Mike Kleina01c6b02020-04-01 13:47:34 -0500506 sources = [ "src/ports/SkFontHost_win.cpp" ]
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500507 libs = [ "Gdi32.lib" ]
508}
509
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700510if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400511 executable("sksllex") {
512 sources = [
513 "src/sksl/lex/Main.cpp",
514 "src/sksl/lex/NFA.cpp",
515 "src/sksl/lex/RegexNode.cpp",
516 "src/sksl/lex/RegexParser.cpp",
517 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500518 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400519 }
520
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700521 action("run_sksllex") {
522 script = "gn/run_sksllex.py"
Mike Kleina01c6b02020-04-01 13:47:34 -0500523 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
524 sources = [ "src/sksl/lex/sksl.lex" ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700525
526 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
527 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
528 outputs = [
529 "$target_out_dir/" +
530 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
531 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
532 # confused due to the same file being named by two different paths
533 ]
534 sksllex_path = "$root_out_dir/"
535 sksllex_path += "sksllex"
536 if (host_os == "win") {
537 sksllex_path += ".exe"
538 }
539 args = [
540 rebase_path(sksllex_path),
541 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400542 rebase_path("bin/fetch-clang-format"),
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700543 rebase_path("src"),
544 ]
545 }
546} else {
547 group("run_sksllex") {
548 }
549}
550
John Stilesd836f842020-09-14 10:21:44 -0400551# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
552if (skia_compile_processors || skia_compile_sksl_tests) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400553 executable("skslc") {
Brian Osman8d09d4a2020-11-24 15:51:06 -0500554 defines = [
555 "SKSL_STANDALONE",
556 "SK_ENABLE_SPIRV_VALIDATION",
557 ]
Brian Osmana6ca9752020-10-02 13:41:21 -0400558 sources = [
Brian Osman47726a12020-12-17 16:02:08 -0500559 "src/core/SkCpu.cpp",
560 "src/core/SkData.cpp",
561 "src/core/SkHalf.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400562 "src/core/SkMalloc.cpp",
563 "src/core/SkMath.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400564 "src/core/SkSemaphore.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500565 "src/core/SkStream.cpp",
566 "src/core/SkString.cpp",
Brian Osmane9ad19b2020-12-23 13:31:13 -0500567 "src/core/SkStringUtils.cpp",
John Stiles060503e2020-10-22 15:02:26 -0400568 "src/core/SkThreadID.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500569 "src/core/SkUtils.cpp",
570 "src/core/SkVM.cpp",
John Stiles23e68662020-10-29 10:17:15 -0400571 "src/gpu/GrBlockAllocator.cpp",
572 "src/gpu/GrMemoryPool.cpp",
Brian Osman62b039b2021-02-08 13:49:53 -0500573 "src/gpu/GrShaderUtils.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400574 "src/ports/SkMemory_malloc.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500575 "src/ports/SkOSFile_stdio.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400576 "src/sksl/SkSLMain.cpp",
Brian Osman47726a12020-12-17 16:02:08 -0500577 "src/utils/SkUTF.cpp",
Brian Osmana6ca9752020-10-02 13:41:21 -0400578 ]
Brian Osman47726a12020-12-17 16:02:08 -0500579 if (is_win) {
580 sources += [ "src/ports/SkOSFile_win.cpp" ]
581 } else {
582 sources += [ "src/ports/SkOSFile_posix.cpp" ]
583 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400584 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400585 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500586 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400587 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500588 ":run_sksllex",
Stephen White238fc242019-08-26 10:19:23 -0400589 "//third_party/spirv-tools:spvtools",
John Stilesdda1d312020-11-20 16:28:50 -0500590 "//third_party/spirv-tools:spvtools_val",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400591 ]
592 }
593
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400594 skslc_path = "$root_out_dir/"
595 if (host_toolchain != default_toolchain_name) {
596 skslc_path += "$host_toolchain/"
597 }
598 skslc_path += "skslc"
599 if (host_os == "win") {
600 skslc_path += ".exe"
601 }
602
Brian Osmandd496172020-08-08 08:17:18 -0400603 action("create_sksl_fp") {
604 script = "gn/create_sksl_fp.py"
605 sources = [
606 "include/private/GrSharedEnums.h",
607 "src/sksl/sksl_fp_raw.sksl",
608 ]
609 outputs = [ "$root_out_dir/sksl_fp.sksl" ]
610 args = [
611 rebase_path(sources[0]),
612 rebase_path(sources[1]),
613 rebase_path(outputs[0]),
614 ]
615 }
616
617 copy("sksl_pre_includes") {
618 sources = [
619 "src/sksl/sksl_frag.sksl",
620 "src/sksl/sksl_geom.sksl",
621 "src/sksl/sksl_gpu.sksl",
Brian Osmanb06301e2020-11-06 11:45:36 -0500622 "src/sksl/sksl_public.sksl",
Brian Osman91946752020-12-21 13:20:40 -0500623 "src/sksl/sksl_runtime.sksl",
Brian Osmandd496172020-08-08 08:17:18 -0400624 "src/sksl/sksl_vert.sksl",
625 ]
626 outputs = [ "$root_out_dir/{{source_file_part}}" ]
627 }
628
629 dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
630 dehydrate_sksl_sources += get_target_outputs(":create_sksl_fp")
631
632 dehydrate_sksl_outputs = []
633 foreach(src, dehydrate_sksl_sources) {
634 name = get_path_info(src, "name")
635
636 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
637 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
638 dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
639 "src/sksl/generated/$name.dehydrated.sksl",
640 target_out_dir) ]
641 }
642
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400643 action("dehydrate_sksl") {
644 script = "gn/dehydrate_sksl.py"
Brian Osmandd496172020-08-08 08:17:18 -0400645 deps = [
646 ":create_sksl_fp",
647 ":sksl_pre_includes",
648 ":skslc(//gn/toolchain:$host_toolchain)",
649 ]
650 sources = dehydrate_sksl_sources
651 outputs = dehydrate_sksl_outputs
Brian Osmana5781382020-08-07 21:28:12 +0000652 args = [
653 rebase_path(skslc_path),
Brian Osmandd496172020-08-08 08:17:18 -0400654 rebase_path("src/sksl/generated"),
Brian Osmana5781382020-08-07 21:28:12 +0000655 ]
Brian Osmandd496172020-08-08 08:17:18 -0400656 args += rebase_path(dehydrate_sksl_sources)
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400657 }
John Stilesd836f842020-09-14 10:21:44 -0400658} else {
659 group("dehydrate_sksl") {
660 }
661}
662
663skia_gpu_processor_outputs = []
664if (skia_compile_processors) {
665 foreach(src, skia_gpu_processor_sources) {
666 dir = get_path_info(src, "dir")
667 name = get_path_info(src, "name")
668
669 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
670 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
671 skia_gpu_processor_outputs += [
672 "$target_out_dir/" +
673 rebase_path("$dir/generated/$name.h", target_out_dir),
674 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
675 # confused due to the same file being named by two different paths
676 ]
677 }
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400678
Ethan Nicholas762466e2017-06-29 10:03:38 -0400679 action("compile_processors") {
680 script = "gn/compile_processors.py"
681 deps = [
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400682 ":create_sksl_fp",
Brian Osmandd496172020-08-08 08:17:18 -0400683 ":sksl_pre_includes",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400684 ":skslc(//gn/toolchain:$host_toolchain)",
685 ]
686 sources = skia_gpu_processor_sources
687 outputs = skia_gpu_processor_outputs
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400688 args = [
689 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400690 rebase_path("bin/clang-format"),
John Stiles796e7022020-06-11 19:57:22 -0400691 rebase_path("bin/fetch-clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400692 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400693 args += rebase_path(skia_gpu_processor_sources)
694 }
695} else {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400696 group("compile_processors") {
697 }
John Stilesd836f842020-09-14 10:21:44 -0400698}
699
700if (skia_compile_sksl_tests) {
701 import("gn/sksl_tests.gni")
John Stilesd836f842020-09-14 10:21:44 -0400702
John Stiles7e248712020-09-24 16:42:09 -0400703 template("compile_sksl") {
704 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
705 action("compile_sksl_${target_name}") {
706 script = "gn/compile_sksl_tests.py"
707 deps = [
708 ":create_sksl_fp",
709 ":sksl_pre_includes",
710 ":skslc(//gn/toolchain:$host_toolchain)",
711 ]
John Stilesda57fc02021-01-22 11:54:30 -0500712 sources = []
John Stiles7e248712020-09-24 16:42:09 -0400713 outputs = []
John Stilesb7f5e1b2021-01-27 14:05:15 -0500714 response_file_contents = []
John Stilesda57fc02021-01-22 11:54:30 -0500715 args = [
716 rebase_path(skslc_path),
717 invoker.lang,
718 invoker.settings,
John Stilesb7f5e1b2021-01-27 14:05:15 -0500719 "{{response_file_name}}",
John Stilesda57fc02021-01-22 11:54:30 -0500720 ]
721
John Stilesbfc9be02021-01-22 11:55:48 -0500722 testsDir = get_path_info("tests", "abspath")
723 resourcesDir = get_path_info("resources", "abspath")
724
725 foreach(partialPath, invoker.sources) {
726 dst = testsDir + partialPath
727 src = resourcesDir + partialPath
728
729 dir = get_path_info(dst, "dir")
730 name = get_path_info(dst, "name")
731 ext = get_path_info(dst, "extension")
John Stilesb7f5e1b2021-01-27 14:05:15 -0500732 response_file_contents += rebase_path([
733 src,
734 dir,
735 ])
John Stilesda57fc02021-01-22 11:54:30 -0500736 sources += [ src ]
John Stilesc3012182020-12-08 15:07:00 -0500737
John Stilesda57fc02021-01-22 11:54:30 -0500738 foreach(outExtension, invoker.outExtensions) {
John Stilesc3012182020-12-08 15:07:00 -0500739 # SPIR-V uses separate extensions for .vert and .geom shaders.
740 if (outExtension == ".asm.frag" && ext == "vert") {
741 outExtension = ".asm.vert"
742 } else if (outExtension == ".asm.frag" && ext == "geom") {
743 outExtension = ".asm.geom"
744 }
John Stilesbfc9be02021-01-22 11:55:48 -0500745 outputs +=
746 [ target_out_dir + "/" +
747 rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
John Stiles7e248712020-09-24 16:42:09 -0400748 }
749 }
John Stiles7e248712020-09-24 16:42:09 -0400750 }
John Stilesd836f842020-09-14 10:21:44 -0400751 }
John Stiles7e248712020-09-24 16:42:09 -0400752 compile_sksl("fp_tests") {
753 sources = sksl_fp_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500754 outExtensions = [
755 ".cpp",
756 ".h",
John Stiles7e248712020-09-24 16:42:09 -0400757 ]
758 lang = "--fp"
759 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400760 }
John Stiles7e248712020-09-24 16:42:09 -0400761 compile_sksl("glsl_tests") {
762 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500763 outExtensions = [ ".glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400764 lang = "--glsl"
765 settings = "--settings"
John Stiles0ed9f312020-09-16 17:46:37 -0400766 }
John Stiles7e248712020-09-24 16:42:09 -0400767 compile_sksl("glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400768 sources = sksl_glsl_settings_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500769 outExtensions = [ "StandaloneSettings.glsl" ]
John Stiles7e248712020-09-24 16:42:09 -0400770 lang = "--glsl"
771 settings = "--nosettings"
John Stilesd836f842020-09-14 10:21:44 -0400772 }
John Stilesaeae3a52020-09-25 13:35:58 -0400773 compile_sksl("metal_tests") {
774 sources = sksl_metal_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500775 outExtensions = [ ".metal" ]
John Stilesaeae3a52020-09-25 13:35:58 -0400776 lang = "--metal"
777 settings = "--settings"
778 }
Brian Osman977feec2020-12-22 11:28:59 -0500779 compile_sksl("skvm_tests") {
780 sources = sksl_skvm_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500781 outExtensions = [ ".skvm" ]
Brian Osman977feec2020-12-22 11:28:59 -0500782 lang = "--skvm"
783 settings = "--settings"
784 }
Brian Osman62b039b2021-02-08 13:49:53 -0500785 compile_sksl("stage_tests") {
786 sources = sksl_stage_tests_sources
787 outExtensions = [ ".stage" ]
788 lang = "--stage"
789 settings = "--settings"
790 }
John Stilesdda1d312020-11-20 16:28:50 -0500791 compile_sksl("spirv_tests") {
792 sources = sksl_spirv_tests_sources
John Stilesda57fc02021-01-22 11:54:30 -0500793 outExtensions = [ ".asm.frag" ]
John Stilesdda1d312020-11-20 16:28:50 -0500794 lang = "--spirv"
795 settings = "--settings"
796 }
John Stilesd836f842020-09-14 10:21:44 -0400797} else {
John Stiles7e248712020-09-24 16:42:09 -0400798 group("compile_sksl_fp_tests") {
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400799 }
John Stiles7e248712020-09-24 16:42:09 -0400800 group("compile_sksl_glsl_tests") {
801 }
802 group("compile_sksl_glsl_nosettings_tests") {
John Stiles0ed9f312020-09-16 17:46:37 -0400803 }
John Stilesaeae3a52020-09-25 13:35:58 -0400804 group("compile_sksl_metal_tests") {
805 }
Brian Osman977feec2020-12-22 11:28:59 -0500806 group("compile_sksl_skvm_tests") {
807 }
John Stilesdda1d312020-11-20 16:28:50 -0500808 group("compile_sksl_spirv_tests") {
809 }
Ethan Nicholas762466e2017-06-29 10:03:38 -0400810}
811
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500812optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700813 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400814 deps = [
815 ":compile_processors",
John Stiles7e248712020-09-24 16:42:09 -0400816 ":compile_sksl_fp_tests",
817 ":compile_sksl_glsl_nosettings_tests",
818 ":compile_sksl_glsl_tests",
John Stilesaeae3a52020-09-25 13:35:58 -0400819 ":compile_sksl_metal_tests",
Brian Osman977feec2020-12-22 11:28:59 -0500820 ":compile_sksl_skvm_tests",
John Stilesdda1d312020-11-20 16:28:50 -0500821 ":compile_sksl_spirv_tests",
Ethan Nicholasc18bb512020-07-28 14:46:53 -0400822 ":dehydrate_sksl",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700823 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400824 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700825 if (skia_generate_workarounds) {
826 deps += [ ":workaround_list" ]
827 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800828 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600829 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400830 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700831
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400832 sources =
833 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400834 if (!skia_enable_ccpr) {
835 sources -= skia_ccpr_sources
836 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
837 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400838 if (!skia_enable_nvpr) {
839 sources -= skia_nvpr_sources
840 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
841 }
mtklein06c35c02016-09-20 12:28:12 -0700842
Mike Klein703cf5a2016-10-13 17:18:04 -0400843 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -0400844 frameworks = []
mtkleine9fb3d52016-09-20 15:11:46 -0700845
John Rosascoa9b348f2019-11-08 13:18:15 -0800846 if (skia_use_gl) {
847 public_defines += [ "SK_GL" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400848 if (is_android) {
849 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
850
851 # this lib is required to link against AHardwareBuffer
852 if (defined(ndk_api) && ndk_api >= 26) {
853 libs += [ "android" ]
854 }
855 } else if (skia_use_egl) {
856 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
857 libs += [ "EGL" ]
Kevin Lubick204c3be2020-08-19 14:30:58 -0400858 } else if (skia_use_webgl) {
859 sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400860 } else if (is_linux && skia_use_x11) {
861 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
862 libs += [ "GL" ]
863 } else if (is_mac) {
864 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
865 } else if (is_ios) {
866 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
867 } else if (is_win) {
868 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
869 if (target_cpu != "arm64") {
870 libs += [ "OpenGL32.lib" ]
871 }
872 } else {
873 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
874 }
John Rosascoa9b348f2019-11-08 13:18:15 -0800875 sources += skia_gl_gpu_sources
876 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400877
mtkleine9fb3d52016-09-20 15:11:46 -0700878 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400879 public_defines += [ "SK_VULKAN" ]
Greg Danielb16beb92020-04-27 14:26:21 +0000880 if (skia_use_vma) {
881 deps += [ "third_party/vulkanmemoryallocator" ]
882 }
mtkleine9fb3d52016-09-20 15:11:46 -0700883 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700884 if (skia_enable_vulkan_debug_layers) {
885 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
886 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800887 if (is_fuchsia) {
John Rosascoe57ca492019-11-13 14:30:45 -0800888 if (using_fuchsia_sdk) {
Chinmay Garde89820762019-05-06 16:44:06 -0700889 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
890 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400891 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700892 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800893 }
mtkleine9fb3d52016-09-20 15:11:46 -0700894 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400895
Brian Salomonf4ba4ec2020-03-19 15:54:28 -0400896 if (is_android && (skia_use_gl || skia_use_vulkan)) {
897 # this lib is required to link against AHardwareBuffer
898 if (defined(ndk_api) && ndk_api >= 26) {
899 libs += [ "android" ]
900 }
901 }
902
Stephen White0d70b712019-07-10 15:51:30 -0400903 if (skia_use_dawn) {
904 public_defines += [ "SK_DAWN" ]
Stephen White985741a2019-07-18 11:43:45 -0400905 sources += skia_dawn_sources
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700906 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen Whitefbffb992019-10-17 10:32:40 -0400907 deps += [
Zhenyao Mo4f17b602020-04-13 15:26:17 -0700908 "//third_party/externals/dawn/src/dawn:dawn_proc",
909 "//third_party/externals/dawn/src/dawn:dawncpp",
910 "//third_party/externals/dawn/src/dawn_native",
Stephen White0d70b712019-07-10 15:51:30 -0400911 ]
912 if (dawn_enable_d3d12) {
913 libs += [
914 "d3d12.lib",
915 "dxgi.lib",
916 "d3dcompiler.lib",
917 ]
918 } else if (dawn_enable_metal) {
Jim Van Verthef820be2020-08-12 10:45:00 -0400919 frameworks += [ "Metal.framework" ]
Stephen White0d70b712019-07-10 15:51:30 -0400920 }
921 }
922
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500923 if (skia_use_direct3d) {
924 public_defines += [ "SK_DIRECT3D" ]
Jim Van Verth1b89eb72020-09-23 16:29:51 -0400925 deps += [
926 "//third_party/d3d12allocator",
927 "//third_party/spirv-cross:spirv_cross",
928 ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500929 sources += skia_direct3d_sources
Jim Van Verth03b8ab22020-02-24 11:36:15 -0500930 if (skia_enable_direct3d_debug_layer) {
931 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
932 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -0500933 libs += [
934 "d3d12.lib",
935 "dxgi.lib",
936 "d3dcompiler.lib",
937 ]
938 }
939
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400940 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400941 if (skia_use_metal) {
942 public_defines += [ "SK_METAL" ]
943 sources += skia_metal_sources
Jim Van Verthef820be2020-08-12 10:45:00 -0400944 frameworks += [ "Metal.framework" ]
Jim Van Verthef820be2020-08-12 10:45:00 -0400945 frameworks += [ "Foundation.framework" ]
Jim Van Verth36b86af2020-08-24 17:16:46 +0000946 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400947 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500948
Kevin Lubickf4def342018-10-04 12:52:50 -0400949 if (is_debug) {
950 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
951 }
mtklein06c35c02016-09-20 12:28:12 -0700952}
953
Leon Scroggins III41169202019-01-29 09:29:57 -0500954optional("gif") {
Hal Canary2dad9902019-11-20 16:01:31 -0500955 enabled = !skia_use_wuffs && skia_use_libgifcodec
Hal Canary1ec9a282019-11-21 10:15:50 -0500956 _libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
957 if ("True" ==
958 exec_script("gn/checkpath.py",
959 [ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
960 "trim string")) {
961 public_defines = [ "SK_USE_LIBGIFCODEC" ]
962 public_include_dirs = [
963 ".",
964 skia_libgifcodec_path,
965 ]
966 include_dirs = public_include_dirs
967 import(_libgifcodec_gni_path)
968 sources = rebase_path(libgifcodec_sources + libgifcodec_public,
969 ".",
970 skia_libgifcodec_path)
971 }
Leon Scroggins III41169202019-01-29 09:29:57 -0500972}
973
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400974optional("heif") {
975 enabled = skia_use_libheif
976 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
977
978 deps = []
979
Mike Kleina01c6b02020-04-01 13:47:34 -0500980 sources = [ "src/codec/SkHeifCodec.cpp" ]
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400981}
982
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400983optional("jpeg_decode") {
984 enabled = skia_use_libjpeg_turbo_decode
985 public_defines = [ "SK_CODEC_DECODES_JPEG" ]
986
Mike Kleina01c6b02020-04-01 13:47:34 -0500987 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -0400988 sources = [
989 "src/codec/SkJpegCodec.cpp",
990 "src/codec/SkJpegDecoderMgr.cpp",
991 "src/codec/SkJpegUtility.cpp",
992 ]
993}
994
995optional("jpeg_encode") {
996 enabled = skia_use_libjpeg_turbo_encode
997 public_defines = [ "SK_ENCODE_JPEG" ]
mtklein63213812016-08-24 09:55:56 -0700998
Mike Kleina01c6b02020-04-01 13:47:34 -0500999 deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
1000 public = [ "include/encode/SkJpegEncoder.h" ]
mtklein63213812016-08-24 09:55:56 -07001001 sources = [
mtklein63213812016-08-24 09:55:56 -07001002 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -04001003 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -07001004 ]
1005}
1006
Leon Scroggins III326b9892020-08-05 16:51:10 -04001007optional("ndk_images") {
1008 enabled = skia_use_ndk_images
1009 public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
1010 sources = [
1011 "src/ports/SkImageEncoder_NDK.cpp",
1012 "src/ports/SkImageGeneratorNDK.cpp",
1013 "src/ports/SkNDKConversions.cpp",
1014 ]
Leon Scroggins IIIf21d6b92020-08-05 10:44:17 -04001015 libs = [ "jnigraphics" ]
1016}
1017
mtklein63213812016-08-24 09:55:56 -07001018optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -05001019 enabled = skia_use_zlib && skia_enable_pdf
1020 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -07001021
Mike Kleina01c6b02020-04-01 13:47:34 -05001022 deps = [ "//third_party/zlib" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001023 if (skia_use_libjpeg_turbo_decode) {
1024 deps += [ ":jpeg_decode" ]
1025 }
1026 if (skia_use_libjpeg_turbo_encode) {
1027 deps += [ ":jpeg_encode" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -04001028 }
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001029 public = skia_pdf_public
brettwb9447282016-09-01 14:24:39 -07001030 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -07001031 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -05001032 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
1033 deps += [ "//third_party/harfbuzz" ]
1034 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
1035 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -07001036 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -05001037 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -07001038 }
1039}
1040
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001041optional("xps") {
1042 enabled = skia_use_xps && is_win
1043 public_defines = [ "SK_SUPPORT_XPS" ]
1044 public = skia_xps_public
1045 sources = skia_xps_sources
1046}
1047
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001048optional("png_decode") {
1049 enabled = skia_use_libpng_decode
1050 public_defines = [ "SK_CODEC_DECODES_PNG" ]
mtklein63213812016-08-24 09:55:56 -07001051
Mike Kleina01c6b02020-04-01 13:47:34 -05001052 deps = [ "//third_party/libpng" ]
mtklein63213812016-08-24 09:55:56 -07001053 sources = [
1054 "src/codec/SkIcoCodec.cpp",
1055 "src/codec/SkPngCodec.cpp",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001056 ]
1057}
1058
1059optional("png_encode") {
1060 enabled = skia_use_libpng_encode
1061 public_defines = [ "SK_ENCODE_PNG" ]
1062
Mike Kleina01c6b02020-04-01 13:47:34 -05001063 deps = [ "//third_party/libpng" ]
1064 sources = [ "src/images/SkPngEncoder.cpp" ]
mtklein63213812016-08-24 09:55:56 -07001065}
1066
scroggof84ad642016-10-31 09:02:57 -07001067optional("raw") {
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001068 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -07001069 public_defines = [ "SK_CODEC_DECODES_RAW" ]
1070
1071 deps = [
1072 "//third_party/dng_sdk",
1073 "//third_party/libjpeg-turbo:libjpeg",
1074 "//third_party/piex",
1075 ]
1076
1077 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
1078 # Skia.
1079 configs_to_remove = [ "//gn:no_exceptions" ]
1080
Mike Kleina01c6b02020-04-01 13:47:34 -05001081 sources = [ "src/codec/SkRawCodec.cpp" ]
scroggof84ad642016-10-31 09:02:57 -07001082}
1083
Mike Klein852a8cb2018-05-15 10:46:58 -04001084import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -04001085source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -04001086 cflags = []
1087 if (!is_win || is_clang) {
1088 cflags += [
1089 "-w",
1090 "-std=c11",
1091 ]
1092 }
1093
Mike Kleina01c6b02020-04-01 13:47:34 -05001094 public = [ "include/third_party/skcms/skcms.h" ]
Brian Osmanea236bf2019-04-29 10:28:22 -04001095 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -04001096 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
1097}
1098
mtklein3cc22182016-08-29 13:26:14 -07001099optional("typeface_freetype") {
1100 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -07001101
Mike Kleina01c6b02020-04-01 13:47:34 -05001102 deps = [ "//third_party/freetype2" ]
mtklein3cc22182016-08-29 13:26:14 -07001103 sources = [
1104 "src/ports/SkFontHost_FreeType.cpp",
1105 "src/ports/SkFontHost_FreeType_common.cpp",
Ben Wagner9d5c55c2020-06-27 12:52:14 -04001106 "src/ports/SkFontHost_FreeType_common.h",
mtklein3cc22182016-08-29 13:26:14 -07001107 ]
1108}
1109
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001110optional("webp_decode") {
1111 enabled = skia_use_libwebp_decode
1112 public_defines = [ "SK_CODEC_DECODES_WEBP" ]
mtklein457b42a2016-08-23 13:56:37 -07001113
Mike Kleina01c6b02020-04-01 13:47:34 -05001114 deps = [ "//third_party/libwebp" ]
1115 sources = [ "src/codec/SkWebpCodec.cpp" ]
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001116}
1117
1118optional("webp_encode") {
1119 enabled = skia_use_libwebp_encode
1120 public_defines = [ "SK_ENCODE_WEBP" ]
1121
Mike Kleina01c6b02020-04-01 13:47:34 -05001122 deps = [ "//third_party/libwebp" ]
1123 sources = [ "src/images/SkWebpEncoder.cpp" ]
mtkleineb3c4252016-08-23 07:38:09 -07001124}
1125
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001126optional("wuffs") {
1127 enabled = skia_use_wuffs
Nigel Tao5cfa7192020-08-17 21:14:13 +10001128 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001129
Mike Kleina01c6b02020-04-01 13:47:34 -05001130 deps = [ "//third_party/wuffs" ]
1131 sources = [ "src/codec/SkWuffsCodec.cpp" ]
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001132}
1133
mtklein63213812016-08-24 09:55:56 -07001134optional("xml") {
1135 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +00001136 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -07001137
Mike Kleina01c6b02020-04-01 13:47:34 -05001138 deps = [ "//third_party/expat" ]
mtklein63213812016-08-24 09:55:56 -07001139 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -05001140 "src/svg/SkSVGCanvas.cpp",
1141 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -07001142 "src/xml/SkDOM.cpp",
1143 "src/xml/SkXMLParser.cpp",
1144 "src/xml/SkXMLWriter.cpp",
1145 ]
1146}
1147
Mike Klein613ad382019-06-06 11:42:02 -05001148optional("skvm_jit") {
Mike Klein13ec5442020-08-14 07:36:54 -05001149 enabled = skia_enable_skvm_jit_when_possible
1150 public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
Mike Klein2b54e832020-07-10 12:56:07 -05001151 if (skia_vtune_path != "") {
1152 public_defines += [ "SKVM_JIT_VTUNE" ]
1153 public_include_dirs = [ "$skia_vtune_path/include" ]
1154 libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
1155 }
Mike Klein613ad382019-06-06 11:42:02 -05001156}
1157
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001158if (skia_enable_gpu && skia_generate_workarounds) {
1159 action("workaround_list") {
1160 script = "tools/build_workaround_header.py"
1161
Mike Kleina01c6b02020-04-01 13:47:34 -05001162 inputs = [ "src/gpu/gpu_workaround_list.txt" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001163
1164 # see comments in skia_compile_processors about out dir path shenanigans.
1165 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -07001166 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001167
Mike Kleina01c6b02020-04-01 13:47:34 -05001168 outputs = [ "$root_out_dir/$output_file" ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -07001169 args = [
1170 "--output-file",
1171 "$output_file",
1172 ]
1173
1174 foreach(file, inputs) {
1175 args += [ rebase_path(file, root_build_dir) ]
1176 }
1177 }
1178}
1179
mtkleinc04ff472016-06-23 10:29:30 -07001180component("skia") {
1181 public_configs = [ ":skia_public" ]
1182 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -07001183
Mike Klein607b0a72018-11-07 16:17:34 -05001184 public_deps = [
Ben Wagner32d5cfa2020-06-11 14:41:47 -04001185 ":fontmgr_FontConfigInterface",
1186 ":fontmgr_android",
1187 ":fontmgr_custom_directory",
1188 ":fontmgr_custom_embedded",
1189 ":fontmgr_custom_empty",
1190 ":fontmgr_fontconfig",
1191 ":fontmgr_fuchsia",
1192 ":fontmgr_mac_ct",
1193 ":fontmgr_win",
1194 ":fontmgr_win_gdi",
Ben Wagnere27ee6c2019-02-15 14:59:30 -05001195 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -05001196 ":pdf",
1197 ":skcms",
Robert Phillips9b00f1f2020-03-24 12:29:44 -04001198 ":xps",
Mike Klein607b0a72018-11-07 16:17:34 -05001199 ]
1200
mtkleinc04ff472016-06-23 10:29:30 -07001201 deps = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001202 ":android_utils",
anmittalb8b3f712016-08-25 04:55:19 -07001203 ":arm64",
1204 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -07001205 ":avx",
Mike Klein54378232018-11-08 12:08:05 +00001206 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -07001207 ":crc32",
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001208 ":dehydrate_sksl",
Ben Wagner75626e42020-06-03 13:20:37 -04001209 ":fontmgr_factory",
Leon Scroggins III41169202019-01-29 09:29:57 -05001210 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -04001211 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -05001212 ":hsw",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001213 ":jpeg_decode",
1214 ":jpeg_encode",
Leon Scroggins III326b9892020-08-05 16:51:10 -04001215 ":ndk_images",
mtklein9b8583d2016-08-24 17:32:30 -07001216 ":none",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001217 ":png_decode",
1218 ":png_encode",
scroggof84ad642016-10-31 09:02:57 -07001219 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -05001220 ":skvm_jit",
Mike Kleina9026da2020-06-05 08:57:05 -05001221 ":skx",
mtklein9b8583d2016-08-24 17:32:30 -07001222 ":sse2",
1223 ":sse41",
1224 ":sse42",
1225 ":ssse3",
Leon Scroggins IIIa77f30c2020-03-09 14:23:30 -04001226 ":webp_decode",
1227 ":webp_encode",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -04001228 ":wuffs",
mtklein63213812016-08-24 09:55:56 -07001229 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -07001230 ]
1231
Hal Canaryc25f4e92019-02-26 11:54:25 -05001232 public = skia_core_public
1233 public += skia_utils_public
1234 public += skia_effects_public
1235 public += skia_effects_imagefilter_public
Hal Canaryc25f4e92019-02-26 11:54:25 -05001236
mtkleinc04ff472016-06-23 10:29:30 -07001237 sources = []
brettwb9447282016-09-01 14:24:39 -07001238 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -07001239 sources += skia_utils_sources
Mike Klein54378232018-11-08 12:08:05 +00001240 sources += skia_effects_sources
1241 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001242 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -07001243 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -04001244 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -05001245 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001246 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +11001247 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -04001248 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001249 "src/codec/SkBmpCodec.cpp",
1250 "src/codec/SkBmpMaskCodec.cpp",
1251 "src/codec/SkBmpRLECodec.cpp",
1252 "src/codec/SkBmpStandardCodec.cpp",
1253 "src/codec/SkCodec.cpp",
1254 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -04001255 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -04001256 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001257 "src/codec/SkMaskSwizzler.cpp",
1258 "src/codec/SkMasks.cpp",
Leon Scroggins IIIba458302019-09-24 12:40:11 -04001259 "src/codec/SkParseEncodedOrigin.cpp",
mtklein25c81d42016-07-27 13:55:26 -07001260 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001261 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -07001262 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001263 "src/codec/SkSwizzler.cpp",
1264 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001265 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001266 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +00001267 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -07001268 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001269 "src/ports/SkMemory_malloc.cpp",
1270 "src/ports/SkOSFile_stdio.cpp",
1271 "src/sfnt/SkOTTable_name.cpp",
1272 "src/sfnt/SkOTUtils.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001273 ]
brettwb9447282016-09-01 14:24:39 -07001274
Leon Scroggins1340dbd2020-11-09 14:18:12 -05001275 defines = [ "SK_HAS_ANDROID_CODEC" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001276 libs = []
1277
mtkleinc04ff472016-06-23 10:29:30 -07001278 if (is_win) {
1279 sources += [
1280 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001281 "src/ports/SkImageEncoder_WIC.cpp",
1282 "src/ports/SkImageGeneratorWIC.cpp",
1283 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001284 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001285 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001286 libs += [
1287 "FontSub.lib",
1288 "Ole32.lib",
1289 "OleAut32.lib",
1290 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001291 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001292 ]
mtkleinc04ff472016-06-23 10:29:30 -07001293 } else {
1294 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001295 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001296 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001297 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001298 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001299 }
1300
mtklein7d6fb2c2016-08-25 14:50:44 -07001301 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001302 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001303 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001304 deps += [ "//third_party/cpu-features" ]
1305 }
mtklein06c35c02016-09-20 12:28:12 -07001306 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001307 libs += [
1308 "EGL",
1309 "GLESv2",
1310 "log",
1311 ]
1312 }
1313
Kevin Lubick217056c2018-09-20 17:39:31 -04001314 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001315 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001316 if (skia_use_egl) {
1317 libs += [ "GLESv2" ]
1318 }
mtkleinc04ff472016-06-23 10:29:30 -07001319 }
1320
1321 if (is_mac) {
1322 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001323 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001324 "src/ports/SkImageEncoder_CG.cpp",
1325 "src/ports/SkImageGeneratorCG.cpp",
1326 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001327 frameworks = [
mtklein09e61f72016-08-23 13:35:28 -07001328 "ApplicationServices.framework",
1329 "OpenGL.framework",
1330 ]
mtkleinc04ff472016-06-23 10:29:30 -07001331 }
abarth6fc8ff02016-07-15 15:15:15 -07001332
Mike Klein7d302882016-11-03 14:06:31 -04001333 if (is_ios) {
1334 sources += [
1335 "src/ports/SkDebug_stdio.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001336 "src/ports/SkImageEncoder_CG.cpp",
1337 "src/ports/SkImageGeneratorCG.cpp",
1338 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001339 frameworks = [
Mike Klein7d302882016-11-03 14:06:31 -04001340 "CoreFoundation.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001341 "ImageIO.framework",
1342 "MobileCoreServices.framework",
1343 ]
1344 }
1345
abarth6fc8ff02016-07-15 15:15:15 -07001346 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001347 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001348 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001349
1350 if (skia_enable_spirv_validation) {
Stephen White238fc242019-08-26 10:19:23 -04001351 deps += [ "//third_party/spirv-tools:spvtools_val" ]
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001352 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1353 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001354
1355 if (skia_include_multiframe_procs) {
1356 sources += [ "tools/SkSharingProc.cpp" ]
1357 }
mtkleinc04ff472016-06-23 10:29:30 -07001358}
1359
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001360# DebugCanvas used in experimental/wasm-skp-debugger
1361if (target_cpu == "wasm") {
1362 static_library("debugcanvas") {
1363 public_configs = [ ":skia_public" ]
1364
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001365 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001366 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001367 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001368 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001369 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001370 "tools/debugger/DrawCommand.cpp",
1371 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001372 ]
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001373 }
1374}
1375
Kevin Lubickcbcff382018-10-02 09:02:18 -04001376static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001377 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001378 public_configs = [ ":skia_public" ]
1379 configs += skia_library_configs
1380
1381 deps = [
1382 ":arm64",
1383 ":armv7",
1384 ":avx",
1385 ":crc32",
1386 ":hsw",
1387 ":none",
1388 ":sse2",
1389 ":sse41",
1390 ":sse42",
1391 ":ssse3",
1392 ]
1393
Kevin Lubickcbcff382018-10-02 09:02:18 -04001394 sources = []
1395 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001396 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001397 sources += [
1398 "src/core/SkAnalyticEdge.cpp",
1399 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001400 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001401 "src/core/SkCubicMap.cpp",
1402 "src/core/SkEdge.cpp",
1403 "src/core/SkEdgeBuilder.cpp",
1404 "src/core/SkEdgeClipper.cpp",
1405 "src/core/SkGeometry.cpp",
Brian Salomon71fe9452020-03-02 16:59:40 -05001406 "src/core/SkIDChangeListener.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001407 "src/core/SkLineClipper.cpp",
Hal Canary7823aeb2019-10-30 17:26:45 -04001408 "src/core/SkMalloc.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001409 "src/core/SkMallocPixelRef.cpp",
1410 "src/core/SkMath.cpp",
1411 "src/core/SkMatrix.cpp",
1412 "src/core/SkOpts.cpp",
1413 "src/core/SkPaint.cpp",
1414 "src/core/SkPath.cpp",
Mike Reed06d7c9d2020-08-26 12:56:51 -04001415 "src/core/SkPathBuilder.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001416 "src/core/SkPathEffect.cpp",
1417 "src/core/SkPathMeasure.cpp",
1418 "src/core/SkPathRef.cpp",
1419 "src/core/SkPoint.cpp",
1420 "src/core/SkRRect.cpp",
Mike Klein45f36b52020-06-08 14:10:29 -05001421 "src/core/SkReadBuffer.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001422 "src/core/SkRect.cpp",
1423 "src/core/SkSemaphore.cpp",
1424 "src/core/SkStream.cpp",
1425 "src/core/SkString.cpp",
1426 "src/core/SkStringUtils.cpp",
1427 "src/core/SkStroke.cpp",
1428 "src/core/SkStrokeRec.cpp",
1429 "src/core/SkStrokerPriv.cpp",
1430 "src/core/SkThreadID.cpp",
1431 "src/core/SkUtils.cpp",
1432 "src/effects/SkDashPathEffect.cpp",
1433 "src/effects/SkTrimPathEffect.cpp",
1434 "src/ports/SkDebug_stdio.cpp",
1435 "src/ports/SkMemory_malloc.cpp",
1436 "src/utils/SkDashPath.cpp",
1437 "src/utils/SkParse.cpp",
1438 "src/utils/SkParsePath.cpp",
1439 "src/utils/SkUTF.cpp",
1440 ]
1441}
1442
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001443group("modules") {
1444 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001445 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001446 "modules/skottie",
Mike Reed63559a52020-06-02 11:34:24 -04001447 "modules/skparagraph",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001448 "modules/skshaper",
1449 ]
1450}
1451
Brian Osmancd28fa62020-07-07 16:01:26 -04001452config("our_vulkan_headers") {
1453 include_dirs = [ "include/third_party/vulkan" ]
1454}
1455
mtkleinc095df52016-08-24 12:23:52 -07001456# Targets guarded by skia_enable_tools may use //third_party freely.
1457if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001458 skia_public_includes = [
Leon Scroggins III63cfb362020-04-24 13:00:48 -04001459 "client_utils/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001460 "include/android",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001461 "include/c",
1462 "include/codec",
1463 "include/config",
1464 "include/core",
1465 "include/docs",
1466 "include/effects",
1467 "include/encode",
1468 "include/gpu",
1469 "include/pathops",
1470 "include/ports",
1471 "include/svg",
1472 "include/utils",
1473 "include/utils/mac",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001474 "modules/particles/include",
1475 "modules/skottie/include",
Julia Lavrova70258c72020-07-15 11:28:57 -04001476 "modules/skparagraph/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001477 "modules/skshaper/include",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001478 "modules/svg/include",
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001479 ]
1480
Mike Klein308b5ac2016-12-06 16:03:52 -05001481 # Used by gn_to_bp.py to list our public include dirs.
1482 source_set("public") {
1483 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001484 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001485 }
1486
Mike Kleinc36dedf2016-11-18 09:35:28 -05001487 config("skia.h_config") {
1488 include_dirs = [ "$target_gen_dir" ]
1489 }
1490 action("skia.h") {
1491 public_configs = [ ":skia.h_config" ]
1492 skia_h = "$target_gen_dir/skia.h"
1493 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001494
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001495 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1496 [ rebase_path(skia_h, root_build_dir) ] +
1497 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001498 depfile = "$skia_h.deps"
Mike Kleina01c6b02020-04-01 13:47:34 -05001499 outputs = [ skia_h ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001500 }
1501
Brian Osmanc9a42472018-05-31 13:17:12 -04001502 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001503 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001504 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001505 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001506 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001507 "tools/fiddle/draw.cpp",
1508 "tools/fiddle/fiddle_main.cpp",
1509 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001510
1511 if (skia_use_egl) {
1512 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001513 } else {
1514 sources += [ "tools/fiddle/null_context.cpp" ]
1515 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001516 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001517 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001518 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001519 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001520 ":skia",
1521 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001522 "modules/particles",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001523 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001524 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001525 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05001526 "modules/svg",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001527 ]
1528 }
1529 }
1530
Mike Kleine5463e62020-06-11 13:53:53 -05001531 config("cpp14") {
1532 if (is_win) {
1533 cflags_cc = [ "/std:c++14" ]
1534 } else {
1535 cflags_cc = [ "-std=c++14" ]
1536 }
1537 }
1538
Brian Osmanc9a42472018-05-31 13:17:12 -04001539 source_set("public_headers_warnings_check") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001540 sources = [ "tools/public_headers_warnings_check.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001541 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Kleine5463e62020-06-11 13:53:53 -05001542 configs += [
1543 ":our_vulkan_headers",
1544 ":cpp14",
1545 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001546 deps = [
1547 ":skia",
1548 ":skia.h",
1549 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001550 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001551 ]
Stephen White0d70b712019-07-10 15:51:30 -04001552
1553 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001554 deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White0d70b712019-07-10 15:51:30 -04001555 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001556 }
1557
mtkleinc095df52016-08-24 12:23:52 -07001558 template("test_lib") {
1559 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001560 if (defined(invoker.public_defines)) {
1561 defines = invoker.public_defines
1562 }
mtklein25c81d42016-07-27 13:55:26 -07001563 }
mtkleinc095df52016-08-24 12:23:52 -07001564 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001565 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001566 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001567 public_configs = [
1568 ":" + target_name + "_config",
1569 ":skia_private",
1570 ]
1571
1572 if (!defined(deps)) {
1573 deps = []
1574 }
1575 deps += [ ":skia" ]
1576 testonly = true
1577 }
mtklein25c81d42016-07-27 13:55:26 -07001578 }
mtklein25c81d42016-07-27 13:55:26 -07001579
Mike Kleine6682eb2017-01-05 10:54:57 -05001580 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001581 if (is_ios) {
Hal Canary3388c1a2019-09-16 12:53:17 -04001582 ios_app_bundle(target_name) {
Jim Van Verth443a9132017-11-28 09:45:26 -05001583 forward_variables_from(invoker,
1584 "*",
1585 [
1586 "output_name",
1587 "visibility",
1588 "is_shared_library",
1589 ])
Mike Kleine6682eb2017-01-05 10:54:57 -05001590 testonly = true
Hal Canary3388c1a2019-09-16 12:53:17 -04001591 extra_configs = [ ":skia_private" ]
1592 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
1593 data_sources = [ "resources" ]
1594 if ("True" == exec_script("//gn/checkdir.py",
1595 [ rebase_path("skps", root_build_dir) ],
1596 "trim string")) {
1597 data_sources += [ "skps" ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001598 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001599 }
1600 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001601 # !is_ios
1602
Jim Van Verth92411c72020-04-03 15:18:31 -04001603 output_dir = root_build_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001604 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1605 shared_library("lib" + target_name) {
1606 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1607 configs += [ ":skia_private" ]
1608 testonly = true
1609 }
1610 } else {
1611 _executable = target_name
1612 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001613 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001614 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1615 configs += [ ":skia_private" ]
1616 testonly = true
1617 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001619 if (is_android && skia_android_serial != "" && defined(_executable)) {
1620 action("push_" + target_name) {
1621 script = "gn/push_to_android.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05001622 deps = [ ":" + _executable ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001623 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
Mike Kleina01c6b02020-04-01 13:47:34 -05001624 outputs = [ _stamp ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001625 args = [
1626 rebase_path("$root_build_dir/$_executable"),
1627 skia_android_serial,
1628 rebase_path(_stamp),
1629 ]
1630 testonly = true
1631 }
Mike Klein7d921032017-01-05 12:20:41 -05001632 }
1633 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001634 }
1635
mtkleinc095df52016-08-24 12:23:52 -07001636 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001637 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001638
Mike Klein9e25bb92019-04-29 09:46:36 -05001639 # Bots and even devs may not have Vulkan headers, so put
1640 # include/third_party/vulkan on our path so they're always available.
1641 all_dependent_configs = [ ":our_vulkan_headers" ]
1642
Mike Klein333fb452019-04-24 08:48:11 -05001643 defines = []
1644 if (skia_enable_discrete_gpu) {
1645 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1646 }
1647
Brian Osmanc9a42472018-05-31 13:17:12 -04001648 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001649 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001650 sources = [
Brian Salomon72c7b982020-10-06 10:07:38 -04001651 "tools/gpu/BackendSurfaceFactory.cpp",
1652 "tools/gpu/BackendSurfaceFactory.h",
Brian Salomon63a0a752020-06-26 13:32:09 -04001653 "tools/gpu/BackendTextureImageFactory.cpp",
1654 "tools/gpu/BackendTextureImageFactory.h",
Robert Phillips00f78de2020-07-01 16:09:43 -04001655 "tools/gpu/FlushFinishTracker.cpp",
1656 "tools/gpu/FlushFinishTracker.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001657 "tools/gpu/GrContextFactory.cpp",
1658 "tools/gpu/GrTest.cpp",
Brian Salomonf9b00422020-10-08 16:00:14 -04001659 "tools/gpu/ManagedBackendTexture.cpp",
1660 "tools/gpu/ManagedBackendTexture.h",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001661 "tools/gpu/MemoryCache.cpp",
1662 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001663 "tools/gpu/ProxyUtils.cpp",
1664 "tools/gpu/TestContext.cpp",
Brian Salomone21af502019-11-22 16:56:36 -05001665 "tools/gpu/TestOps.cpp",
1666 "tools/gpu/TestOps.h",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001667 "tools/gpu/YUVUtils.cpp",
1668 "tools/gpu/YUVUtils.h",
Mike Kleina01c6b02020-04-01 13:47:34 -05001669 "tools/gpu/gl/GLTestContext.cpp", # See comment below about
1670 # GrContextFactory workaround.
Brian Osmanc9a42472018-05-31 13:17:12 -04001671 "tools/gpu/mock/MockTestContext.cpp",
1672 ]
Brian Salomon1171d312020-03-19 08:47:44 -04001673
1674 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001675 frameworks = []
Brian Salomon1171d312020-03-19 08:47:44 -04001676
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001677 if (skia_use_gl) {
Herb Derby64aa5132020-06-03 12:14:55 -04001678 sources +=
1679 [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001680 if (is_ios) {
1681 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001682 frameworks += [ "OpenGLES.framework" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001683 } else if (is_mac) {
1684 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001685 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001686 if (skia_use_angle) {
1687 deps += [ "//third_party/angle2" ]
1688 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1689 }
Brian Salomon1171d312020-03-19 08:47:44 -04001690 }
1691
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001692 # We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
1693 # in GrContextFactory. This only matters for OSes that can run Vulkan.
Chris Dalton2b598902020-03-25 10:50:35 -06001694 if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001695 if (is_android || skia_use_egl) {
1696 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1697 libs += [ "EGL" ]
1698 } else if (is_linux) {
1699 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1700 libs += [
1701 "GLU",
1702 "GL",
1703 "X11",
1704 ]
1705 } else if (is_win) {
1706 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1707 libs += [ "Gdi32.lib" ]
1708 if (target_cpu != "arm64") {
1709 libs += [ "OpenGL32.lib" ]
1710 }
1711 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001712 }
Greg Daniel54200e42018-12-11 17:03:39 -05001713
Brian Osmanc9a42472018-05-31 13:17:12 -04001714 if (skia_use_vulkan) {
Robert Phillipsae413d82020-06-10 11:04:51 -04001715 sources += [ "tools/gpu/vk/VkTestContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001716 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Robert Phillips0d6ce7c2020-06-11 08:51:50 -04001717 sources += [ "tools/gpu/vk/VkTestHelper.h" ]
1718 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001719 sources += [ "tools/gpu/vk/VkTestUtils.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001720 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Robert Phillipsae413d82020-06-10 11:04:51 -04001721 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
1722 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001723 }
1724 if (skia_use_metal) {
1725 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001726 }
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001727 if (skia_use_direct3d) {
1728 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
Jim Van Verth03b8ab22020-02-24 11:36:15 -05001729 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
Jim Van Verthb01e12b2020-02-18 14:34:38 -05001730 }
Stephen White985741a2019-07-18 11:43:45 -04001731 if (skia_use_dawn) {
Zhenyao Mo4f17b602020-04-13 15:26:17 -07001732 public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
Stephen White985741a2019-07-18 11:43:45 -04001733 sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
Stephen White3ae5b292020-06-01 15:45:56 -04001734 if (is_clang) {
1735 cflags_cc = [ "-Wno-microsoft-cast" ]
1736 }
Stephen White985741a2019-07-18 11:43:45 -04001737 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04001738
1739 if (is_fuchsia && using_fuchsia_sdk) {
1740 libs +=
1741 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
1742 }
Jim Van Verth36b86af2020-08-24 17:16:46 +00001743
1744 cflags_objcc = [ "-fobjc-arc" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07001745 } # test_lib("gpu_tool_utils")
mtklein25c81d42016-07-27 13:55:26 -07001746
mtkleinc095df52016-08-24 12:23:52 -07001747 test_lib("flags") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001748 sources = [ "tools/flags/CommandLineFlags.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07001749 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001750
1751 test_lib("common_flags_config") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001752 sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
1753 deps = [ ":flags" ]
1754 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001755 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001756 test_lib("common_flags_gpu") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001757 sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
1758 deps = [ ":flags" ]
1759 public_deps = [ ":gpu_tool_utils" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001760 }
1761 test_lib("common_flags_images") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001762 sources = [ "tools/flags/CommonFlagsImages.cpp" ]
1763 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001764 }
1765 test_lib("common_flags_aa") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001766 sources = [ "tools/flags/CommonFlagsAA.cpp" ]
1767 deps = [ ":flags" ]
Mike Kleinc6142d82019-03-25 10:54:59 -05001768 }
mtklein25c81d42016-07-27 13:55:26 -07001769
Mike Klein499f0ac2019-03-25 13:00:12 -05001770 test_lib("trace") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001771 deps = [ ":flags" ]
Mike Klein499f0ac2019-03-25 13:00:12 -05001772 sources = [
1773 "tools/trace/ChromeTracingTracer.cpp",
1774 "tools/trace/ChromeTracingTracer.h",
1775 "tools/trace/EventTracingPriv.cpp",
1776 "tools/trace/EventTracingPriv.h",
1777 "tools/trace/SkDebugfTracer.cpp",
1778 "tools/trace/SkDebugfTracer.h",
1779 ]
1780 }
1781
mtkleinc095df52016-08-24 12:23:52 -07001782 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001783 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001784 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001785 "tools/AutoreleasePool.h",
Robert Phillips96601082018-05-29 16:13:26 -04001786 "tools/DDLPromiseImageHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001787 "tools/DDLPromiseImageHelper.h",
Robert Phillips96601082018-05-29 16:13:26 -04001788 "tools/DDLTileHelper.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001789 "tools/DDLTileHelper.h",
mtklein0590fa52016-09-01 07:06:54 -07001790 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001791 "tools/ProcStats.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001792 "tools/ProcStats.h",
mtkleinc095df52016-08-24 12:23:52 -07001793 "tools/Resources.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001794 "tools/Resources.h",
Hal Canarye574f1e2019-07-15 14:01:37 -04001795 "tools/SkMetaData.cpp",
1796 "tools/SkMetaData.h",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001797 "tools/SkSharingProc.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001798 "tools/SkSharingProc.h",
1799 "tools/Stats.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001800 "tools/ToolUtils.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001801 "tools/ToolUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001802 "tools/UrlDataManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001803 "tools/UrlDataManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001804 "tools/debugger/DebugCanvas.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001805 "tools/debugger/DebugCanvas.h",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05001806 "tools/debugger/DebugLayerManager.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001807 "tools/debugger/DebugLayerManager.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001808 "tools/debugger/DrawCommand.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001809 "tools/debugger/DrawCommand.h",
Mike Klein8f4e2242019-03-20 11:59:00 -05001810 "tools/debugger/JsonWriteBuffer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001811 "tools/debugger/JsonWriteBuffer.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001812 "tools/fonts/RandomScalerContext.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001813 "tools/fonts/RandomScalerContext.h",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001814 "tools/fonts/TestEmptyTypeface.h",
1815 "tools/fonts/TestFontMgr.cpp",
1816 "tools/fonts/TestFontMgr.h",
1817 "tools/fonts/TestSVGTypeface.cpp",
1818 "tools/fonts/TestSVGTypeface.h",
1819 "tools/fonts/TestTypeface.cpp",
1820 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001821 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001822 "tools/random_parse_path.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001823 "tools/random_parse_path.h",
Hal Canary41248072019-07-11 16:32:53 -04001824 "tools/timer/TimeUtils.h",
mtkleinc095df52016-08-24 12:23:52 -07001825 "tools/timer/Timer.cpp",
John Stilesaffae532020-07-13 18:06:53 -04001826 "tools/timer/Timer.h",
mtkleinc095df52016-08-24 12:23:52 -07001827 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001828 if (target_cpu != "wasm") {
1829 sources += [ "tools/CrashHandler.cpp" ]
1830 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001831 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04001832 frameworks = []
Mike Kleinadacaef2017-02-06 09:26:14 -05001833 if (is_ios) {
1834 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001835 sources += [ "tools/ios_utils.h" ]
1836 if (skia_use_metal) {
1837 sources += [ "tools/AutoreleasePool.mm" ]
1838 }
Jim Van Verthef820be2020-08-12 10:45:00 -04001839 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001840 } else if (is_mac) {
1841 if (skia_use_metal) {
1842 sources += [ "tools/AutoreleasePool.mm" ]
Jim Van Verthef820be2020-08-12 10:45:00 -04001843 frameworks += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001844 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001845 } else if (is_win) {
1846 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001847 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001848
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001849 defines = []
1850 if (skia_tools_require_resources) {
1851 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1852 }
mtkleinc095df52016-08-24 12:23:52 -07001853 deps = [
1854 ":flags",
Florin Malitab3418102020-10-15 18:10:29 -04001855 "modules/svg",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001856 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001857 public_deps = [ ":gpu_tool_utils" ]
mtkleinc095df52016-08-24 12:23:52 -07001858 }
mtklein25c81d42016-07-27 13:55:26 -07001859
Mike Kleine11e5c12019-04-24 12:46:06 -05001860 test_lib("etc1") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001861 sources = [ "third_party/etc1/etc1.cpp" ]
Mike Kleine11e5c12019-04-24 12:46:06 -05001862 }
1863
Mike Klein6e744122016-10-27 12:21:40 -04001864 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001865 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001866 sources = gm_sources
John Rosasco24cbdab2019-09-25 14:14:35 -07001867 if (skia_use_gl) {
1868 sources += gl_gm_sources
1869 }
mtkleinc095df52016-08-24 12:23:52 -07001870 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001871 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001872 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001873 ":skia",
1874 ":tool_utils",
Brian Osman84d884a2021-01-29 16:35:45 -05001875 "modules/particles",
Mike Reed2f0edd52018-05-31 14:22:30 -04001876 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001877 "modules/skottie:gm",
Mike Reed63559a52020-06-02 11:34:24 -04001878 "modules/skparagraph",
1879 "modules/skparagraph:gm",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001880 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001881 ]
Mike Kleinc4abade2019-08-09 10:11:35 -04001882 if (is_skia_dev_build) {
1883 sources += [ "gm/fiddle.cpp" ]
1884 deps += [ ":skia.h" ]
1885 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001886 public_deps = [ ":gpu_tool_utils" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001887
1888 if (skia_use_ffmpeg) {
Florin Malita123e3b82020-04-24 11:10:27 -04001889 deps += [ "experimental/ffmpeg:video_decoder" ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001890 sources += [ "gm/video_decoder.cpp" ]
1891 }
mtkleinc095df52016-08-24 12:23:52 -07001892 }
mtklein25c81d42016-07-27 13:55:26 -07001893
Mike Klein6e744122016-10-27 12:21:40 -04001894 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001895 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001896 sources = tests_sources + pathops_tests_sources
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001897 frameworks = []
Robert Phillips0c6daf02019-05-16 12:43:11 -04001898 if (skia_use_metal) {
1899 sources += metal_tests_sources
Jim Van Verth36b86af2020-08-24 17:16:46 +00001900 cflags_objcc = [ "-fobjc-arc" ]
Chinmay Garde3ee25e92020-09-01 15:10:14 -07001901 frameworks += [ "MetalKit.framework" ]
Robert Phillips0c6daf02019-05-16 12:43:11 -04001902 }
John Rosasco24cbdab2019-09-25 14:14:35 -07001903 if (skia_use_gl) {
1904 sources += gl_tests_sources
1905 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001906 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001907 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001908 }
Ben Wagner75626e42020-06-03 13:20:37 -04001909 if (!skia_enable_fontmgr_fontconfig) {
Ben Wagner37a06c02018-06-22 21:11:00 +00001910 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1911 }
mtkleinc095df52016-08-24 12:23:52 -07001912 deps = [
1913 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001914 ":skia",
1915 ":tool_utils",
Florin Malita26ae40f2020-06-08 12:03:48 -04001916 "experimental/skrive:tests",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001917 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001918 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001919 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001920 "modules/skshaper",
Florin Malitadec78022020-12-17 16:36:54 -05001921 "modules/svg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001922 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001923 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001924 "//third_party/zlib",
1925 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001926 public_deps = [
1927 ":gpu_tool_utils", # Test.h #includes headers from this target.
1928 ]
mtkleinc095df52016-08-24 12:23:52 -07001929 }
mtklein2f3416d2016-08-02 16:02:05 -07001930
Mike Klein6e744122016-10-27 12:21:40 -04001931 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001932 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001933 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001934 deps = [
1935 ":flags",
1936 ":gm",
1937 ":gpu_tool_utils",
1938 ":skia",
1939 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001940 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001941 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001942 ]
1943 }
mtklein2b6870c2016-07-28 14:17:33 -07001944
Mike Reedd62d4062019-06-12 10:20:44 -04001945 test_lib("experimental_xform") {
1946 sources = [
1947 "experimental/xform/SkShape.cpp",
1948 "experimental/xform/SkXform.cpp",
1949 "experimental/xform/XContext.cpp",
1950 ]
Mike Kleina01c6b02020-04-01 13:47:34 -05001951 deps = [ ":skia" ]
Mike Reedd62d4062019-06-12 10:20:44 -04001952 }
1953
Florin Malitabfe876a2018-09-02 12:33:59 -04001954 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001955 test_app("skottie_tool") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001956 deps = [ "modules/skottie:tool" ]
Florin Malita79725d32018-06-05 16:16:57 -04001957 }
Florin Malitab3418102020-10-15 18:10:29 -04001958 test_app("svg_tool") {
1959 deps = [ "modules/svg:tool" ]
1960 }
Florin Malita79725d32018-06-05 16:16:57 -04001961 }
1962
Hal Canary5b39dc82019-04-17 13:29:46 -04001963 test_app("make_skqp_model") {
Mike Kleina01c6b02020-04-01 13:47:34 -05001964 sources = [ "tools/skqp/make_skqp_model.cpp" ]
1965 deps = [ ":skia" ]
Hal Canary5b39dc82019-04-17 13:29:46 -04001966 }
1967
Chris Dalton2b598902020-03-25 10:50:35 -06001968 import("gn/samples.gni")
1969 test_lib("samples") {
1970 sources = samples_sources
1971 if (skia_enable_ccpr) {
1972 sources += samples_sources_ccpr
Kevin Lubickebf648e2017-09-21 13:45:16 -04001973 }
Mike Kleina01c6b02020-04-01 13:47:34 -05001974 public_deps = [ ":tool_utils" ]
Chris Dalton2b598902020-03-25 10:50:35 -06001975 deps = [
Chris Dalton2b598902020-03-25 10:50:35 -06001976 ":flags",
1977 ":gpu_tool_utils",
1978 ":xml",
Jorge Betancourtb8621312020-09-10 15:16:35 -04001979 "modules/audioplayer",
Chris Dalton2b598902020-03-25 10:50:35 -06001980 "modules/skparagraph:samples",
1981 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04001982 "modules/svg",
Tyler Denniston189ecd42020-10-22 15:40:49 -04001983 "//third_party/imgui",
Chris Dalton2b598902020-03-25 10:50:35 -06001984 ]
Chris Dalton2b598902020-03-25 10:50:35 -06001985 }
Kevin Lubick00398742020-10-08 10:05:07 -04001986 test_lib("hash_and_encode") {
1987 sources = [
1988 "tools/HashAndEncode.cpp",
1989 "tools/HashAndEncode.h",
1990 ]
1991 deps = [
1992 ":flags",
1993 ":skia",
1994 "//third_party/libpng",
1995 ]
1996 }
Chris Dalton2b598902020-03-25 10:50:35 -06001997 if (target_cpu != "wasm") {
Nigel Tao3ab9b1f2020-05-28 13:29:13 +10001998 test_app("convert-to-nia") {
1999 sources = [ "tools/convert-to-nia.cpp" ]
2000 deps = [ ":skia" ]
2001 }
Mike Klein7af351a2018-07-27 09:54:43 -04002002 test_app("imgcvt") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002003 sources = [ "tools/imgcvt.cpp" ]
Mike Klein7af351a2018-07-27 09:54:43 -04002004 deps = [
2005 ":skcms",
2006 ":skia",
2007 ]
2008 }
Mike Klein735c7ba2019-03-25 12:57:58 -05002009 test_app("fm") {
2010 sources = [
Mike Kleinfee00792019-11-21 16:18:47 -06002011 "dm/DMGpuTestProcs.cpp", # blech
Mike Klein735c7ba2019-03-25 12:57:58 -05002012 "tools/fm/fm.cpp",
2013 ]
2014 deps = [
2015 ":common_flags_aa",
2016 ":common_flags_gpu",
2017 ":flags",
2018 ":gm",
2019 ":gpu_tool_utils",
2020 ":hash_and_encode",
2021 ":skia",
Mike Kleinfee00792019-11-21 16:18:47 -06002022 ":tests",
Mike Klein735c7ba2019-03-25 12:57:58 -05002023 ":tool_utils",
2024 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04002025 "modules/skottie",
2026 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002027 "modules/svg",
Mike Klein735c7ba2019-03-25 12:57:58 -05002028 ]
2029 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04002030 test_app("dm") {
2031 sources = [
2032 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04002033 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002034 "dm/DMJsonWriter.cpp",
2035 "dm/DMSrcSink.cpp",
2036 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04002037 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002038 ":common_flags_aa",
2039 ":common_flags_config",
2040 ":common_flags_gpu",
2041 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002042 ":flags",
2043 ":gm",
2044 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05002045 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04002046 ":skia",
2047 ":tests",
2048 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002049 ":trace",
Florin Malita02616ea2020-06-25 13:33:17 -04002050 "experimental/skrive",
Florin Malita3d856bd2018-05-26 09:49:28 -04002051 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002052 "modules/skottie:utils",
Florin Malitab3418102020-10-15 18:10:29 -04002053 "modules/svg",
Mike Klein38af9432016-11-11 11:39:44 -05002054 ]
2055 }
Michael Ludwig30217952020-12-04 12:58:35 -05002056
2057 # optional separate library to dlopen when running CanvasStateTests.
2058 shared_library("canvas_state_lib") {
2059 sources = [
2060 "tests/CanvasStateHelpers.cpp",
2061 "tests/CanvasStateHelpers.h",
2062 ]
2063 deps = [ ":skia" ]
2064 }
Brian Osman16adfa32016-10-18 14:42:44 -04002065 }
2066
Mike Kleina8a51ce2018-01-09 12:34:11 -05002067 if (!is_win) {
2068 test_app("remote_demo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002069 sources = [ "tools/remote_demo.cpp" ]
2070 deps = [ ":skia" ]
Mike Kleina8a51ce2018-01-09 12:34:11 -05002071 }
2072 }
2073
Hal Canarye107faa2019-10-23 12:52:33 -04002074 if (!is_win) {
2075 test_app("blob_cache_sim") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002076 sources = [ "tools/blob_cache_sim.cpp" ]
2077 deps = [ ":skia" ]
Hal Canarye107faa2019-10-23 12:52:33 -04002078 }
2079 }
2080
Mike Kleine6682eb2017-01-05 10:54:57 -05002081 test_app("nanobench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002082 sources = [ "bench/nanobench.cpp" ]
mtklein2b6870c2016-07-28 14:17:33 -07002083 deps = [
2084 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05002085 ":common_flags_aa",
2086 ":common_flags_config",
2087 ":common_flags_gpu",
2088 ":common_flags_images",
mtklein2b6870c2016-07-28 14:17:33 -07002089 ":flags",
2090 ":gm",
2091 ":gpu_tool_utils",
2092 ":skia",
2093 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002094 ":trace",
Mike Reed63559a52020-06-02 11:34:24 -04002095 "modules/skparagraph",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002096 "modules/skshaper",
Florin Malitab3418102020-10-15 18:10:29 -04002097 "modules/svg",
mtklein2b6870c2016-07-28 14:17:33 -07002098 ]
mtklein2b6870c2016-07-28 14:17:33 -07002099 }
halcanary19a97202016-08-03 15:08:04 -07002100
Ravi Mistry10d36c52017-01-31 09:49:18 -05002101 test_app("skpinfo") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002102 sources = [ "tools/skpinfo.cpp" ]
Ravi Mistry10d36c52017-01-31 09:49:18 -05002103 deps = [
2104 ":flags",
2105 ":skia",
2106 ]
2107 }
2108
Mike Reedc0ee21f2019-05-28 16:11:03 -04002109 if (skia_use_ffmpeg) {
2110 test_app("skottie2movie") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002111 sources = [ "tools/skottie2movie.cpp" ]
Mike Reedc0ee21f2019-05-28 16:11:03 -04002112 deps = [
2113 ":flags",
Mike Reed5f12eaa2019-09-24 12:01:58 -04002114 ":gpu_tool_utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002115 ":skia",
Florin Malitaec403602020-04-24 12:14:03 -04002116 "experimental/ffmpeg:video_encoder",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002117 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002118 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002119 ]
2120 }
2121 }
2122
Brian Osmanc9a42472018-05-31 13:17:12 -04002123 test_app("skpbench") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002124 sources = [ "tools/skpbench/skpbench.cpp" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002125 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002126 ":common_flags_config",
2127 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002128 ":flags",
2129 ":gpu_tool_utils",
2130 ":skia",
2131 ":tool_utils",
2132 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002133 }
2134
Mike Kleine6682eb2017-01-05 10:54:57 -05002135 test_app("sktexttopdf") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002136 sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
halcanary3eee9d92016-09-10 07:01:53 -07002137 deps = [
2138 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002139 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002140 ]
halcanary3eee9d92016-09-10 07:01:53 -07002141 }
mtklein046cb562016-09-16 10:23:12 -07002142
Ben Wagner219f3622017-07-17 15:32:25 -04002143 test_app("create_test_font") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002144 sources = [ "tools/fonts/create_test_font.cpp" ]
2145 deps = [ ":skia" ]
Ben Wagner219f3622017-07-17 15:32:25 -04002146 assert_no_deps = [
2147 # tool_utils requires the output of this app.
2148 ":tool_utils",
2149 ]
2150 }
2151
Florin Malita5d3ff432018-07-31 16:38:43 -04002152 if (skia_use_expat) {
2153 test_app("create_test_font_color") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002154 sources = [ "tools/fonts/create_test_font_color.cpp" ]
Florin Malita5d3ff432018-07-31 16:38:43 -04002155 deps = [
2156 ":flags",
2157 ":skia",
2158 ":tool_utils",
2159 ]
2160 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002161 }
2162
Mike Kleine6682eb2017-01-05 10:54:57 -05002163 test_app("get_images_from_skps") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002164 sources = [ "tools/get_images_from_skps.cpp" ]
mtklein046cb562016-09-16 10:23:12 -07002165 deps = [
2166 ":flags",
2167 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002168 ]
mtklein046cb562016-09-16 10:23:12 -07002169 }
mtkleinecbc5262016-09-22 11:51:24 -07002170
Brian Osman6788a542018-12-10 11:56:01 -05002171 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002172 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002173 sources = [
2174 "tools/skiaserve/Request.cpp",
2175 "tools/skiaserve/Response.cpp",
2176 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002177 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2178 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2179 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2180 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2181 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2182 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2183 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2184 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2185 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002186 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2187 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002188 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2189 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2190 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2191 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2192 ]
2193 deps = [
2194 ":flags",
2195 ":gpu_tool_utils",
2196 ":skia",
2197 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002198 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002199 ]
Mike Klein7d302882016-11-03 14:06:31 -04002200 }
mtkleinecbc5262016-09-22 11:51:24 -07002201 }
kjlubick14f984b2016-10-03 11:49:45 -07002202
Mike Kleine6682eb2017-01-05 10:54:57 -05002203 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002204 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002205 "fuzz/Fuzz.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002206 "fuzz/Fuzz.h",
Hal Canary24ac42b2017-02-14 13:35:14 -05002207 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002208 "fuzz/FuzzCommon.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002209 "fuzz/FuzzCommon.h",
Zepeng Hu94007012020-07-22 14:37:46 +00002210 "fuzz/FuzzCreateDDL.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002211 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002212 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002213 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002214 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002215 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002216 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002217 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002218 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002219 "fuzz/FuzzRegionOp.cpp",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002220 "fuzz/FuzzSkParagraph.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002221 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002222 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2223 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002224 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002225 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002226 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002227 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002228 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2229 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Zepeng Hufcb7ba02020-07-31 17:21:29 +00002230 "fuzz/oss_fuzz/FuzzSKP.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002231 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2232 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002233 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002234 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Zepeng Huedaf3022020-06-12 12:20:59 +00002235 "fuzz/oss_fuzz/FuzzSVG.cpp",
Kevin Lubick2be14d32019-10-21 13:44:48 -04002236 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
Weston Tracey1a771fe2021-02-04 11:09:59 -05002237 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
Zepeng Hua5783f32020-07-10 13:36:20 +00002238 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002239 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002240 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002241 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002242 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002243 "tools/debugger/DrawCommand.cpp",
2244 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002245 ]
2246 deps = [
2247 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002248 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002249 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002250 "modules/skottie:fuzz",
Weston Tracey6d4577b2020-12-30 13:29:00 -05002251 "modules/skparagraph",
kjlubick14f984b2016-10-03 11:49:45 -07002252 ]
kjlubick14f984b2016-10-03 11:49:45 -07002253 }
Mike Klein38312422016-10-05 15:41:01 -04002254
Mike Kleine6682eb2017-01-05 10:54:57 -05002255 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002256 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002257 rebase_path("tests/skia_test.cpp"),
2258 rebase_path("tests/Test.cpp"),
2259 ]
caryclark9feb6322016-10-25 08:58:26 -07002260 deps = [
2261 ":flags",
2262 ":gpu_tool_utils",
2263 ":skia",
2264 ":tool_utils",
2265 ]
caryclark9feb6322016-10-25 08:58:26 -07002266 }
2267
Mike Kleine6682eb2017-01-05 10:54:57 -05002268 test_app("dump_record") {
Mike Klein4a56f4c2020-08-18 16:02:52 -05002269 sources = [ "tools/dump_record.cpp" ]
Mike Klein38312422016-10-05 15:41:01 -04002270 deps = [
2271 ":flags",
2272 ":skia",
2273 ]
Mike Klein38312422016-10-05 15:41:01 -04002274 }
bungemanfe917272016-10-13 17:36:40 -04002275
Mike Kleine6682eb2017-01-05 10:54:57 -05002276 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002277 sources = [
2278 "tools/skdiff/skdiff.cpp",
2279 "tools/skdiff/skdiff_html.cpp",
2280 "tools/skdiff/skdiff_main.cpp",
2281 "tools/skdiff/skdiff_utils.cpp",
2282 ]
2283 deps = [
2284 ":skia",
2285 ":tool_utils",
2286 ]
bungemanfe917272016-10-13 17:36:40 -04002287 }
halcanarya73d76a2016-10-17 13:19:02 -07002288
Mike Kleine6682eb2017-01-05 10:54:57 -05002289 test_app("skp_parser") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002290 sources = [ "tools/skp_parser.cpp" ]
halcanarya73d76a2016-10-17 13:19:02 -07002291 deps = [
2292 ":skia",
2293 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002294 ]
halcanarya73d76a2016-10-17 13:19:02 -07002295 }
Brian Osman16adfa32016-10-18 14:42:44 -04002296
Brian Osmanc9a42472018-05-31 13:17:12 -04002297 if (!is_win) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002298 source_set("skqp_lib") {
2299 check_includes = false
2300 testonly = true
2301 if (!is_official_build) {
2302 configs -= [ "//gn:warnings" ]
2303 }
2304 public_configs = [ ":skia_private" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002305 defines =
2306 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002307 sources = [
2308 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002309 "tools/skqp/src/skqp.cpp",
2310 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002311 ]
2312 deps = [
2313 ":gm",
Hal Canary75427132017-10-11 16:00:31 -04002314 ":skia",
2315 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002316 ":tool_utils",
2317 ]
2318 }
2319 test_app("skqp") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002320 sources = [ "tools/skqp/src/skqp_main.cpp" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002321 include_dirs = [ "//" ]
2322 lib_dirs = []
Mike Kleina01c6b02020-04-01 13:47:34 -05002323 deps = [ ":skqp_lib" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002324 }
2325 test_app("jitter_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002326 sources = [ "tools/skqp/jitter_gms.cpp" ]
Hal Canaryac7f23c2018-11-26 14:07:41 -05002327 deps = [
2328 ":gm",
2329 ":skia",
2330 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002331 ]
2332 }
2333 }
John Rosasco24cbdab2019-09-25 14:14:35 -07002334 if (is_fuchsia) {
2335 # Build a package repository for skqp on Fuchsia.
2336 group("skqp_repo") {
2337 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002338 deps = [ "//build/fuchsia/skqp:skqp_repo" ]
John Rosasco24cbdab2019-09-25 14:14:35 -07002339 }
2340 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002341 if (is_android) {
Colin Cross654eb2a2019-11-08 13:08:36 -08002342 shared_library("libskqp_app") {
2343 configs += [ ":skia_private" ]
2344 if (!is_official_build) {
2345 configs -= [ "//gn:warnings" ]
2346 }
2347 testonly = true
Mike Kleina01c6b02020-04-01 13:47:34 -05002348 sources = [ "tools/skqp/src/jni_skqp.cpp" ]
Hal Canary28f89382017-12-12 09:42:14 -05002349 deps = [
2350 ":skia",
2351 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002352 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002353 ]
2354 libs = [ "android" ]
2355 }
2356 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002357 if (is_android && skia_use_gl) {
Stan Iliev93151722018-08-02 11:10:52 -04002358 test_app("skottie_android") {
2359 is_shared_library = true
2360
Jorge Betancourt1fcdcaa2020-06-22 14:14:32 +00002361 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
Stan Iliev93151722018-08-02 11:10:52 -04002362 libs = []
2363
Stan Iliev93151722018-08-02 11:10:52 -04002364 deps = [
2365 ":skia",
2366 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002367 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002368 ]
2369 }
2370 }
Hal Canary75427132017-10-11 16:00:31 -04002371
Hal Canarya9de7602018-01-19 13:08:23 -05002372 test_app("list_gms") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002373 sources = [ "tools/list_gms.cpp" ]
Hal Canarya9de7602018-01-19 13:08:23 -05002374 deps = [
2375 ":gm",
2376 ":skia",
2377 ]
2378 }
2379 test_app("list_gpu_unit_tests") {
2380 sources = [
2381 "dm/DMGpuTestProcs.cpp",
2382 "tools/list_gpu_unit_tests.cpp",
2383 ]
2384 deps = [
2385 ":skia",
2386 ":tests",
2387 ]
2388 }
2389
Brian Osmanc9a42472018-05-31 13:17:12 -04002390 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002391 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002392 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002393 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002394 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002395 sources = [
John Stilesab9578e2020-06-30 17:36:55 -04002396 "tools/sk_app/Application.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002397 "tools/sk_app/CommandSet.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002398 "tools/sk_app/CommandSet.h",
2399 "tools/sk_app/DisplayParams.h",
2400 "tools/sk_app/RasterWindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002401 "tools/sk_app/Window.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002402 "tools/sk_app/Window.h",
Robert Phillipsed653392020-07-10 13:55:21 -04002403 "tools/sk_app/WindowContext.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002404 "tools/sk_app/WindowContext.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002405 ]
2406 libs = []
Jim Van Verthef820be2020-08-12 10:45:00 -04002407 frameworks = []
Brian Osmanc9a42472018-05-31 13:17:12 -04002408
2409 if (is_android) {
2410 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002411 "tools/sk_app/android/RasterWindowContext_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002412 "tools/sk_app/android/WindowContextFactory_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002413 "tools/sk_app/android/Window_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002414 "tools/sk_app/android/Window_android.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002415 "tools/sk_app/android/main_android.cpp",
2416 "tools/sk_app/android/surface_glue_android.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002417 "tools/sk_app/android/surface_glue_android.h",
Brian Osman16adfa32016-10-18 14:42:44 -04002418 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002419 libs += [ "android" ]
2420 } else if (is_linux) {
2421 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002422 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002423 "tools/sk_app/unix/WindowContextFactory_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002424 "tools/sk_app/unix/Window_unix.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002425 "tools/sk_app/unix/Window_unix.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002426 "tools/sk_app/unix/keysym2ucs.c",
John Stilesab9578e2020-06-30 17:36:55 -04002427 "tools/sk_app/unix/keysym2ucs.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002428 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002429 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002430 libs += [
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002431 "GL", # Used by raster window context, so cannot be behind skia_use_gl.
Brian Osmanc9a42472018-05-31 13:17:12 -04002432 "X11",
2433 ]
2434 } else if (is_win) {
2435 sources += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002436 "tools/sk_app/win/RasterWindowContext_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002437 "tools/sk_app/win/WindowContextFactory_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002438 "tools/sk_app/win/Window_win.cpp",
John Stilesab9578e2020-06-30 17:36:55 -04002439 "tools/sk_app/win/Window_win.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002440 "tools/sk_app/win/main_win.cpp",
2441 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002442 } else if (is_mac) {
2443 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002444 "tools/sk_app/mac/RasterWindowContext_mac.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002445 "tools/sk_app/mac/WindowContextFactory_mac.h",
2446 "tools/sk_app/mac/Window_mac.h",
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002447 "tools/sk_app/mac/Window_mac.mm",
2448 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002449 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002450 frameworks += [
Brian Osmanc9a42472018-05-31 13:17:12 -04002451 "QuartzCore.framework",
2452 "Cocoa.framework",
2453 "Foundation.framework",
2454 ]
2455 } else if (is_ios) {
2456 sources += [
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002457 "tools/sk_app/ios/RasterWindowContext_ios.mm",
John Stilesab9578e2020-06-30 17:36:55 -04002458 "tools/sk_app/ios/WindowContextFactory_ios.h",
2459 "tools/sk_app/ios/Window_ios.h",
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002460 "tools/sk_app/ios/Window_ios.mm",
2461 "tools/sk_app/ios/main_ios.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002462 ]
Jim Van Verthef820be2020-08-12 10:45:00 -04002463 frameworks += [ "QuartzCore.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002464 }
2465
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002466 if (skia_use_gl) {
2467 sources += [ "tools/sk_app/GLWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002468 sources += [ "tools/sk_app/GLWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002469 if (is_android) {
2470 sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
2471 } else if (is_linux) {
2472 sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
2473 } else if (is_win) {
2474 sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
2475 if (skia_use_angle) {
2476 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
2477 }
2478 } else if (is_mac) {
2479 sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ]
2480 } else if (is_ios) {
2481 sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ]
2482 }
2483 }
2484
Brian Osmanc9a42472018-05-31 13:17:12 -04002485 if (skia_use_vulkan) {
2486 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002487 sources += [ "tools/sk_app/VulkanWindowContext.h" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002488 if (is_android) {
2489 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2490 } else if (is_linux) {
2491 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2492 libs += [ "X11-xcb" ]
2493 } else if (is_win) {
2494 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2495 }
2496 }
2497
Jim Van Verthbe39f712019-02-08 15:36:14 -05002498 if (skia_use_metal) {
2499 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
John Stilesab9578e2020-06-30 17:36:55 -04002500 sources += [ "tools/sk_app/MetalWindowContext.h" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002501 if (is_mac) {
2502 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
Jim Van Verth68cb8b02019-08-29 14:59:17 -04002503 } else if (is_ios) {
Jim Van Verthe58d5322019-09-03 09:42:57 -04002504 sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
Jim Van Verthbe39f712019-02-08 15:36:14 -05002505 }
Jim Van Verthbe39f712019-02-08 15:36:14 -05002506 }
2507
Jim Van Verth682a2f42020-05-13 16:54:09 -04002508 if (skia_use_direct3d) {
2509 sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
2510 }
2511
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002512 if (skia_use_dawn) {
2513 sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
John Stilesab9578e2020-06-30 17:36:55 -04002514 sources += [ "tools/sk_app/DawnWindowContext.h" ]
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002515 if (is_linux) {
2516 if (dawn_enable_vulkan) {
2517 sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
2518 defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
2519 libs += [ "X11-xcb" ]
2520 }
2521 } else if (is_win) {
2522 if (dawn_enable_d3d12) {
2523 sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
2524 }
2525 } else if (is_mac) {
2526 if (dawn_enable_metal) {
2527 sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
2528 }
2529 }
2530 }
2531
Mike Kleina01c6b02020-04-01 13:47:34 -05002532 deps = [ ":tool_utils" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002533 if (is_android) {
2534 deps += [ "//third_party/native_app_glue" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002535 }
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002536 if (skia_use_gl && skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002537 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002538 }
Brian Osman16adfa32016-10-18 14:42:44 -04002539 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002540
Hal Canary87515122019-03-15 14:22:51 -04002541 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2542 test_app("fiddle_examples") {
2543 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002544 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002545 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002546 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002547 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002548 if (is_win) {
Hal Canary6c8422c2020-01-10 15:22:09 -05002549 cflags = [
2550 "/wd4756", # Overflow in constant arithmetic
2551 "/wd4305", # truncation from 'double' to 'float'
2552 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002553 }
Hal Canary87515122019-03-15 14:22:51 -04002554 deps = [
2555 ":skia",
2556 ":skia.h",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002557 "modules/particles",
Hal Canary87515122019-03-15 14:22:51 -04002558 "modules/skottie",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002559 "modules/skparagraph",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002560 "modules/skshaper",
Joe Gregorio7ae1b4c2020-12-28 14:37:39 -05002561 "modules/svg",
Hal Canary87515122019-03-15 14:22:51 -04002562 ]
2563 }
2564 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002565
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002566 # sk_app can work without GL but viewer always runs raster through a GL window context.
2567 if (skia_use_gl) {
2568 test_app("viewer") {
2569 is_shared_library = is_android
2570 sources = [
2571 "tools/viewer/AnimTimer.h",
2572 "tools/viewer/BisectSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002573 "tools/viewer/BisectSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002574 "tools/viewer/GMSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002575 "tools/viewer/GMSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002576 "tools/viewer/ImGuiLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002577 "tools/viewer/ImGuiLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002578 "tools/viewer/ImageSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002579 "tools/viewer/ImageSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002580 "tools/viewer/ParticlesSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002581 "tools/viewer/ParticlesSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002582 "tools/viewer/SKPSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002583 "tools/viewer/SKPSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002584 "tools/viewer/SampleSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002585 "tools/viewer/SampleSlide.h",
Florin Malita45cd2002020-06-09 14:00:54 -04002586 "tools/viewer/SkRiveSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002587 "tools/viewer/SkRiveSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002588 "tools/viewer/SkSLSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002589 "tools/viewer/SkSLSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002590 "tools/viewer/SkottieSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002591 "tools/viewer/SkottieSlide.h",
2592 "tools/viewer/Slide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002593 "tools/viewer/SlideDir.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002594 "tools/viewer/SlideDir.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002595 "tools/viewer/StatsLayer.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002596 "tools/viewer/StatsLayer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002597 "tools/viewer/SvgSlide.cpp",
Ben Wagnerfa8b5e42021-01-28 14:30:59 -05002598 "tools/viewer/SvgSlide.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002599 "tools/viewer/TouchGesture.cpp",
2600 "tools/viewer/TouchGesture.h",
2601 "tools/viewer/Viewer.cpp",
John Stiles6d3996c2020-07-31 12:33:31 -04002602 "tools/viewer/Viewer.h",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002603 ]
2604 libs = []
2605
2606 deps = [
2607 ":common_flags_gpu",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002608 ":flags",
2609 ":gm",
2610 ":gpu_tool_utils",
2611 ":samples",
2612 ":sk_app",
2613 ":skia",
2614 ":tool_utils",
2615 ":trace",
Florin Malita45cd2002020-06-09 14:00:54 -04002616 "experimental/skrive",
Florin Malitac9c4e2e2020-08-13 12:03:37 -04002617 "modules/audioplayer",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002618 "modules/particles",
2619 "modules/skottie",
2620 "modules/skottie:utils",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002621 "modules/sksg:samples",
Florin Malitab3418102020-10-15 18:10:29 -04002622 "modules/svg",
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002623 "//third_party/imgui",
2624 ]
2625 if (skia_use_experimental_xform) {
2626 deps += [ ":experimental_xform" ]
2627 sources += [ "gm/xform.cpp" ]
2628 }
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002629 if (skia_use_vulkan) {
Brian Salomon3207fbe2020-06-30 11:09:25 -04002630 deps += [
2631 "//third_party/spirv-tools:spvtools",
2632
2633 #spvtools depends on this but doesn't deps it in. Looks like upstream bug
2634 #that we replicated in our third_party/spirv-tools/BUILD.gn
2635 "//third_party/spirv-tools:spvtools_val",
2636 ]
Brian Osmanc85f1fa2020-06-16 15:11:34 -04002637 }
Mike Reedd62d4062019-06-12 10:20:44 -04002638 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002639 }
2640
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002641 if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002642 test_app("HelloWorld") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002643 sources = [ "example/HelloWorld.cpp" ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002644 libs = []
2645
Brian Osmaneff04b52017-11-21 13:18:02 -05002646 deps = [
2647 ":flags",
2648 ":gpu_tool_utils",
2649 ":sk_app",
2650 ":skia",
2651 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002652 ]
2653 }
2654 }
2655
Mike Klein9f6468f2020-05-19 13:14:40 -05002656 if (skia_use_gl && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002657 test_app("SkiaSDLExample") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002658 sources = [ "example/SkiaSDLExample.cpp" ]
Jim Van Verth4c70c752017-07-11 12:03:01 -04002659 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002660 deps = [
2661 ":gpu_tool_utils",
2662 ":skia",
2663 "//third_party/libsdl",
2664 ]
2665 }
2666 }
2667
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002668 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2669 action_foreach("generate_mocs") {
2670 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002671 sources = [ "tools/mdbviz/MainWindow.h" ]
2672 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002673 args = [
2674 "$skia_qt_path" + "/bin/moc",
2675 "{{source}}",
2676 "-o",
2677 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2678 ]
2679 }
2680 action_foreach("generate_resources") {
2681 script = "gn/call.py"
Mike Kleina01c6b02020-04-01 13:47:34 -05002682 sources = [ "tools/mdbviz/resources.qrc" ]
2683 outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002684 args = [
2685 "$skia_qt_path" + "/bin/rcc",
2686 "{{source}}",
2687 "-o",
2688 "gen/mdbviz/{{source_name_part}}_res.cpp",
2689 ]
2690 }
2691 test_app("mdbviz") {
2692 if (is_win) {
2693 # on Windows we need to disable some exception handling warnings due to the Qt headers
2694 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2695 }
2696 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002697 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002698 "tools/debugger/DebugCanvas.cpp",
Nathaniel Nifong20b177a2019-12-12 11:05:10 -05002699 "tools/debugger/DebugLayerManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002700 "tools/debugger/DrawCommand.cpp",
2701 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002702 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002703 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002704 "tools/mdbviz/main.cpp",
2705
2706 # generated files
2707 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2708 "$target_gen_dir/mdbviz/resources_res.cpp",
2709 ]
2710 lib_dirs = [ "$skia_qt_path/lib" ]
2711 libs = [
2712 "Qt5Core.lib",
2713 "Qt5Gui.lib",
2714 "Qt5Widgets.lib",
2715 ]
2716 include_dirs = [
2717 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002718 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002719 "$skia_qt_path/include/QtWidgets",
2720 ]
2721 deps = [
2722 ":generate_mocs",
2723 ":generate_resources",
2724 ":skia",
2725 ]
2726 }
2727 }
2728
Mike Kleine459afd2017-03-03 09:21:30 -05002729 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002730 copy("gdbserver") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002731 sources = [ "$ndk/$ndk_gdbserver" ]
2732 outputs = [ "$root_out_dir/gdbserver" ]
Derek Sollenberger70120c72017-01-05 11:39:04 -05002733 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002734 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002735
2736 if (skia_use_opencl) {
2737 test_app("hello-opencl") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002738 sources = [ "tools/hello-opencl.cpp" ]
2739 deps = [ "//third_party/opencl" ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002740 }
2741 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002742
Brian Osmanf564f152019-07-23 15:14:30 -04002743 executable("cpu_modules") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002744 sources = [ "tools/cpu_modules.cpp" ]
Brian Osmanf564f152019-07-23 15:14:30 -04002745 deps = [
2746 ":skia",
2747 "modules/particles",
2748 ]
2749 }
2750
Brian Salomonf4ba4ec2020-03-19 15:54:28 -04002751 if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) {
Hal Canary1f94d392019-07-30 09:27:56 -04002752 test_app("editor") {
2753 is_shared_library = is_android
Mike Kleina01c6b02020-04-01 13:47:34 -05002754 deps = [ "modules/skplaintexteditor:editor_app" ]
Hal Canary1f94d392019-07-30 09:27:56 -04002755 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002756 }
Hal Canarye5b65d22019-09-19 11:33:31 -04002757
2758 executable("image_diff_metric") {
Mike Kleina01c6b02020-04-01 13:47:34 -05002759 sources = [ "tools/image_diff_metric.cpp" ]
2760 deps = [ ":skia" ]
Hal Canarye5b65d22019-09-19 11:33:31 -04002761 }
Chris Dalton2b598902020-03-25 10:50:35 -06002762
2763 group("modules_testonly") {
2764 testonly = true
2765 deps = []
2766 if (target_cpu == "wasm") {
2767 deps += [ "modules/canvaskit:viewer_wasm" ]
2768 }
2769 }
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002770
2771 if (skia_build_fuzzers) {
2772 template("libfuzzer_app") {
2773 output_dir = root_build_dir
2774 executable(target_name) {
2775 check_includes = false
2776 forward_variables_from(invoker, "*", [ "is_shared_library" ])
2777 configs += [ ":skia_private" ]
2778 sources += [
2779 "fuzz/Fuzz.cpp",
2780 "fuzz/FuzzCommon.cpp",
2781 ]
2782 deps += [
2783 ":flags",
2784 ":gpu_tool_utils",
2785 ":skia",
2786 ]
2787 defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
2788 if (skia_use_libfuzzer_defaults) {
2789 cflags = [ "-fsanitize=fuzzer" ]
2790 ldflags = [ "-fsanitize=fuzzer" ]
2791 }
2792 testonly = true
2793 }
2794 }
2795
2796 libfuzzer_app("region_deserialize") {
2797 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
2798 deps = []
2799 }
2800
2801 libfuzzer_app("image_filter_deserialize") {
2802 include_dirs = [
2803 "tools",
2804 "tools/fonts",
2805 ]
2806 sources = [
2807 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
2808 "tools/Resources.cpp",
2809 "tools/fonts/TestFontMgr.cpp",
2810 "tools/fonts/TestSVGTypeface.cpp",
2811 "tools/fonts/TestTypeface.cpp",
2812 ]
Florin Malitab3418102020-10-15 18:10:29 -04002813 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002814 }
2815
2816 libfuzzer_app("region_set_path") {
2817 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
2818 deps = []
2819 }
2820
2821 libfuzzer_app("textblob_deserialize") {
2822 include_dirs = [
2823 "tools",
2824 "tools/fonts",
2825 ]
2826 sources = [
2827 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
2828 "tools/Resources.cpp",
2829 "tools/fonts/TestFontMgr.cpp",
2830 "tools/fonts/TestSVGTypeface.cpp",
2831 "tools/fonts/TestTypeface.cpp",
2832 ]
Florin Malitab3418102020-10-15 18:10:29 -04002833 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002834 }
2835
2836 libfuzzer_app("path_deserialize") {
2837 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
2838 deps = []
2839 }
2840
2841 libfuzzer_app("image_decode") {
2842 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
2843 deps = []
2844 }
2845
2846 libfuzzer_app("animated_image_decode") {
2847 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
2848 deps = []
2849 }
2850
2851 libfuzzer_app("api_create_ddl") {
2852 include_dirs = [
2853 "include",
2854 "include/gpu",
2855 ]
2856 sources = [
2857 "fuzz/FuzzCreateDDL.cpp",
2858 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
2859 "tools/Resources.cpp",
2860 "tools/UrlDataManager.cpp",
2861 "tools/debugger/DebugCanvas.cpp",
2862 "tools/debugger/DebugLayerManager.cpp",
2863 "tools/debugger/DrawCommand.cpp",
2864 "tools/debugger/JsonWriteBuffer.cpp",
2865 "tools/fonts/TestFontMgr.cpp",
2866 "tools/fonts/TestSVGTypeface.cpp",
2867 "tools/fonts/TestTypeface.cpp",
2868 ]
2869 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002870 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002871 "//third_party/libpng",
2872 ]
2873 }
2874
2875 libfuzzer_app("api_draw_functions") {
2876 sources = [
2877 "fuzz/FuzzDrawFunctions.cpp",
2878 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
2879 ]
2880 deps = []
2881 }
2882
2883 libfuzzer_app("api_gradients") {
2884 sources = [
2885 "fuzz/FuzzGradients.cpp",
2886 "fuzz/oss_fuzz/FuzzGradients.cpp",
2887 ]
2888 deps = []
2889 }
2890
2891 libfuzzer_app("api_image_filter") {
2892 include_dirs = [
2893 "tools",
2894 "tools/debugger",
2895 ]
2896 sources = [
2897 "fuzz/FuzzCanvas.cpp",
2898 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
2899 "tools/UrlDataManager.cpp",
2900 "tools/debugger/DebugCanvas.cpp",
2901 "tools/debugger/DebugLayerManager.cpp",
2902 "tools/debugger/DrawCommand.cpp",
2903 "tools/debugger/JsonWriteBuffer.cpp",
2904 ]
2905 deps = [ "//third_party/libpng" ]
2906 }
2907
2908 libfuzzer_app("api_path_measure") {
2909 sources = [
2910 "fuzz/FuzzPathMeasure.cpp",
2911 "fuzz/oss_fuzz/FuzzPathMeasure.cpp",
2912 ]
2913 deps = []
2914 }
2915
2916 libfuzzer_app("api_pathop") {
2917 sources = [
2918 "fuzz/FuzzPathop.cpp",
2919 "fuzz/oss_fuzz/FuzzPathop.cpp",
2920 ]
2921 deps = []
2922 }
2923
2924 libfuzzer_app("api_raster_n32_canvas") {
2925 include_dirs = [
2926 "tools",
2927 "tools/debugger",
2928 "tools/fonts",
2929 ]
2930 sources = [
2931 "fuzz/FuzzCanvas.cpp",
2932 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
2933 "tools/Resources.cpp",
2934 "tools/UrlDataManager.cpp",
2935 "tools/debugger/DebugCanvas.cpp",
2936 "tools/debugger/DebugLayerManager.cpp",
2937 "tools/debugger/DrawCommand.cpp",
2938 "tools/debugger/JsonWriteBuffer.cpp",
2939 "tools/fonts/TestFontMgr.cpp",
2940 "tools/fonts/TestSVGTypeface.cpp",
2941 "tools/fonts/TestTypeface.cpp",
2942 ]
2943 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002944 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002945 "//third_party/libpng",
2946 ]
2947 }
2948
2949 if (skia_use_gl) {
2950 libfuzzer_app("api_mock_gpu_canvas") {
2951 include_dirs = [
2952 "tools",
2953 "tools/debugger",
2954 "tools/fonts",
2955 ]
2956 sources = [
2957 "fuzz/FuzzCanvas.cpp",
2958 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
2959 "tools/LsanSuppressions.cpp",
2960 "tools/Resources.cpp",
2961 "tools/UrlDataManager.cpp",
2962 "tools/debugger/DebugCanvas.cpp",
2963 "tools/debugger/DebugLayerManager.cpp",
2964 "tools/debugger/DrawCommand.cpp",
2965 "tools/debugger/JsonWriteBuffer.cpp",
2966 "tools/fonts/TestFontMgr.cpp",
2967 "tools/fonts/TestSVGTypeface.cpp",
2968 "tools/fonts/TestTypeface.cpp",
2969 ]
2970 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002971 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002972 "//third_party/libpng",
2973 ]
2974 }
2975 }
2976
2977 libfuzzer_app("api_null_canvas") {
2978 include_dirs = [
2979 "tools",
2980 "tools/debugger",
2981 "tools/fonts",
2982 ]
2983 sources = [
2984 "fuzz/FuzzCanvas.cpp",
2985 "fuzz/oss_fuzz/FuzzNullCanvas.cpp",
2986 "tools/Resources.cpp",
2987 "tools/UrlDataManager.cpp",
2988 "tools/debugger/DebugCanvas.cpp",
2989 "tools/debugger/DebugLayerManager.cpp",
2990 "tools/debugger/DrawCommand.cpp",
2991 "tools/debugger/JsonWriteBuffer.cpp",
2992 "tools/fonts/TestFontMgr.cpp",
2993 "tools/fonts/TestSVGTypeface.cpp",
2994 "tools/fonts/TestTypeface.cpp",
2995 ]
2996 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04002997 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04002998 "//third_party/libpng",
2999 ]
3000 }
3001
Weston Tracey1a771fe2021-02-04 11:09:59 -05003002 libfuzzer_app("api_skparagraph") {
3003 sources = [
3004 "fuzz/FuzzSkParagraph.cpp",
3005 "fuzz/oss_fuzz/FuzzSkParagraph.cpp",
3006 "tools/Resources.cpp",
3007 ]
3008 deps = [ "modules/skparagraph" ]
3009 }
3010
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003011 libfuzzer_app("api_svg_canvas") {
3012 include_dirs = [
3013 "include",
3014 "include/svg",
3015 ]
3016 sources = [
3017 "fuzz/FuzzCanvas.cpp",
3018 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
3019 "tools/Resources.cpp",
3020 "tools/UrlDataManager.cpp",
3021 "tools/debugger/DebugCanvas.cpp",
3022 "tools/debugger/DebugLayerManager.cpp",
3023 "tools/debugger/DrawCommand.cpp",
3024 "tools/debugger/JsonWriteBuffer.cpp",
3025 "tools/fonts/TestFontMgr.cpp",
3026 "tools/fonts/TestSVGTypeface.cpp",
3027 "tools/fonts/TestTypeface.cpp",
3028 ]
3029 deps = [
Florin Malitab3418102020-10-15 18:10:29 -04003030 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003031 "//third_party/libpng",
3032 ]
3033 }
3034
3035 libfuzzer_app("png_encoder") {
3036 sources = [
3037 "fuzz/FuzzEncoders.cpp",
3038 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
3039 ]
3040 deps = []
3041 }
3042
3043 libfuzzer_app("jpeg_encoder") {
3044 sources = [
3045 "fuzz/FuzzEncoders.cpp",
3046 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
3047 ]
3048 deps = []
3049 }
3050
3051 libfuzzer_app("webp_encoder") {
3052 sources = [
3053 "fuzz/FuzzEncoders.cpp",
3054 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
3055 ]
3056 deps = []
3057 }
3058
3059 libfuzzer_app("skottie_json") {
3060 sources = [
3061 "modules/skottie/fuzz/FuzzSkottieJSON.cpp",
3062 "tools/Resources.cpp",
3063 "tools/fonts/TestFontMgr.cpp",
3064 "tools/fonts/TestSVGTypeface.cpp",
3065 "tools/fonts/TestTypeface.cpp",
3066 ]
3067 deps = [
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003068 "modules/skottie:skottie",
Florin Malitab3418102020-10-15 18:10:29 -04003069 "modules/svg",
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003070 ]
3071 }
3072
3073 libfuzzer_app("skjson") {
3074 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
3075 deps = []
3076 }
3077
3078 libfuzzer_app("api_polyutils") {
3079 sources = [
3080 "fuzz/FuzzPolyUtils.cpp",
3081 "fuzz/oss_fuzz/FuzzPolyUtils.cpp",
3082 ]
3083 deps = [ ":skia" ]
3084 }
3085
3086 libfuzzer_app("android_codec") {
3087 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
3088 deps = []
3089 }
3090
3091 libfuzzer_app("image_decode_incremental") {
3092 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
3093 deps = []
3094 }
3095
3096 libfuzzer_app("sksl2glsl") {
3097 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
3098 deps = []
3099 }
3100
3101 libfuzzer_app("sksl2spirv") {
3102 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
3103 deps = []
3104 }
3105
3106 libfuzzer_app("sksl2metal") {
3107 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
3108 deps = []
3109 }
3110
3111 libfuzzer_app("sksl2pipeline") {
3112 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
3113 deps = []
3114 }
3115
3116 libfuzzer_app("skdescriptor_deserialize") {
3117 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
3118 deps = []
3119 }
3120
3121 libfuzzer_app("svg_dom") {
3122 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
Florin Malitab3418102020-10-15 18:10:29 -04003123 deps = [ "modules/svg" ]
Kevin Lubick272e8bc2020-09-15 10:05:41 -04003124 }
3125
3126 libfuzzer_app("skruntimeeffect") {
3127 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
3128 deps = []
3129 }
3130
3131 libfuzzer_app("skp") {
3132 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
3133 deps = []
3134 }
3135 }
mtklein25c81d42016-07-27 13:55:26 -07003136}
Hal Canary932a2c02019-09-17 10:43:18 -04003137
Chinmay Gardea1ea0a92019-10-01 16:37:10 -07003138if (is_ios && skia_use_metal && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003139 group("minimal_ios_mtl_skia_app") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003140 deps = [ "experimental/minimal_ios_mtl_skia_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003141 }
Hal Canary27483062019-12-06 15:01:08 -05003142}
3143
Hal Canary60ff6512020-01-21 12:39:20 -05003144if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
Hal Canary932a2c02019-09-17 10:43:18 -04003145 group("skottie_ios") {
Mike Kleina01c6b02020-04-01 13:47:34 -05003146 deps = [ "tools/skottie_ios_app" ]
Hal Canary932a2c02019-09-17 10:43:18 -04003147 }
3148}
Martin Kustermannb65d2992020-12-15 16:15:13 +01003149
3150executable("skia_c_api_example") {
3151 sources = [ "experimental/c-api-example/skia-c-example.c" ]
3152 include_dirs = [ "." ]
3153 deps = [ ":skia" ]
3154}