blob: 4422e7740bbc436f4298bef9c90d13b3ffe45662 [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 Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -070012 import("//build/fuchsia/sdk.gni")
Forrest Reiling30229ac2017-04-17 13:36:39 -070013 import("//build/vulkan/config.gni")
14}
15
mtkleinc04ff472016-06-23 10:29:30 -070016declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040017 skia_enable_flutter_defines = false
18}
19
20declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000021 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040022 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070023 skia_use_expat = true
Mike Reedd62d4062019-06-12 10:20:44 -040024 skia_use_experimental_xform = false
Mike Reed7bf160e2019-05-17 16:50:51 -040025 skia_use_ffmpeg = false
mtklein3cc22182016-08-29 13:26:14 -070026 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050027 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070028 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050029 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070030 skia_use_libjpeg_turbo = true
31 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070032 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050033 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040034 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040035 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040036 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070037 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040038 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040039 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070040 skia_use_x11 = is_linux
Mike Klein613ad382019-06-06 11:42:02 -050041 skia_use_xbyak = false
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050042 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070043
Mike Klein7d921032017-01-05 12:20:41 -050044 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040045 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000046 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050047 skia_enable_discrete_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050048 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040049 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040050 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050051 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040052 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040053 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070054 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070055 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040056
Hal Canary2331c822018-02-01 14:06:13 -050057 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040058
59 skia_llvm_path = ""
60 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040061
62 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070063}
Brian Salomon23d73ea2016-10-27 13:31:37 -040064declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040065 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040066 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050067 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050068 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050069 skia_enable_fontmgr_custom =
70 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050071 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
72 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080073 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050074 skia_enable_fontmgr_win = is_win
75 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040076
Kevin Lubick27ba7032019-03-21 08:13:54 -040077 if (is_mac) {
78 skia_gl_standard = "gl"
79 } else if (is_ios) {
80 skia_gl_standard = "gles"
81 } else {
82 skia_gl_standard = ""
83 }
84
Mike Klein4d598a32016-10-31 13:44:49 -040085 if (is_android) {
86 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070087 } else if (is_fuchsia) {
88 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040089 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050090 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040091 }
Jim Van Verth4e502972017-12-07 15:16:10 -050092
93 if (is_ios) {
94 skia_ios_identity = ".*Google.*"
95 skia_ios_profile = "Google Development"
96 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040097}
Brian Salomon789e25e2016-09-30 13:41:03 -040098
Adam Barth54ef74a2017-10-13 10:59:38 -070099if (defined(skia_settings)) {
100 import(skia_settings)
101}
102
mtkleinc04ff472016-06-23 10:29:30 -0700103# Skia public API, generally provided by :skia.
104config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -0500105 include_dirs = [ "." ]
106
Mike Kleinae7e6712016-10-11 17:49:33 -0400107 defines = []
108 if (is_component_build) {
109 defines += [ "SKIA_DLL" ]
110 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400111 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -0500112 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -0700113 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400114 if (skia_enable_flutter_defines) {
115 defines += flutter_defines
116 }
mtklein06c35c02016-09-20 12:28:12 -0700117 if (!skia_enable_gpu) {
118 defines += [ "SK_SUPPORT_GPU=0" ]
119 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500120 if (skia_enable_atlas_text) {
121 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
122 }
Mike Reed025f7832018-11-12 09:27:05 -0500123 if (is_fuchsia) {
124 defines += fuchsia_defines
125 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400126 if (skia_gl_standard == "gles") {
127 defines += [ "SK_ASSUME_GL_ES=1" ]
128 } else if (skia_gl_standard == "gl") {
129 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400130 } else if (skia_gl_standard == "webgl") {
131 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400132 }
mtkleinc04ff472016-06-23 10:29:30 -0700133}
134
135# Skia internal APIs, used by Skia itself and a few test tools.
136config("skia_private") {
137 visibility = [ ":*" ]
138
Mike Reeda9e241d2017-05-03 10:52:00 -0400139 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500140 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700141 defines += [
142 "SK_GAMMA_EXPONENT=1.4",
143 "SK_GAMMA_CONTRAST=0.0",
144 ]
145 }
Mike Kleinb45d8622019-04-24 14:04:01 -0500146 if (is_skia_dev_build) {
147 defines += [
148 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
149 "GR_TEST_UTILS=1",
150 ]
mtklein88a7ac02016-09-14 11:16:49 -0700151 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400152 libs = []
153 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -0500154 if (skia_use_angle) {
155 defines += [ "SK_ANGLE" ]
156 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400157 if (skia_llvm_path != "") {
158 defines += [ "SK_LLVM_AVAILABLE" ]
159 include_dirs += [ "$skia_llvm_path/include" ]
160 libs += [ skia_llvm_lib ]
161 lib_dirs += [ "$skia_llvm_path/lib/" ]
162 }
mtkleinc04ff472016-06-23 10:29:30 -0700163}
164
165# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
166config("skia_library") {
167 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000168 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700169}
170
171skia_library_configs = [
172 ":skia_public",
173 ":skia_private",
174 ":skia_library",
175]
176
mtklein9b8583d2016-08-24 17:32:30 -0700177# Use for CPU-specific Skia code that needs particular compiler flags.
178template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500179 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700180 if (invoker.enabled) {
181 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500182 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700183 forward_variables_from(invoker, "*")
184 configs += skia_library_configs
185 }
186 } else {
187 # If not enabled, a phony empty target that swallows all otherwise unused variables.
188 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500189 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700190 forward_variables_from(invoker,
191 "*",
192 [
193 "sources",
194 "cflags",
195 ])
196 }
197 }
anmittala7eaf2e2016-08-17 13:57:26 -0700198}
199
mtklein422310d2016-08-16 18:28:43 -0700200is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700201
mtklein7d6fb2c2016-08-25 14:50:44 -0700202opts("none") {
203 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700204 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700205 cflags = []
206}
207
mtklein7d6fb2c2016-08-25 14:50:44 -0700208opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700209 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700211 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700212}
213
214opts("arm64") {
215 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700216 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700217 cflags = []
218}
219
220opts("crc32") {
221 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700222 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700223 cflags = [ "-march=armv8-a+crc" ]
224}
225
mtklein9b8583d2016-08-24 17:32:30 -0700226opts("sse2") {
227 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700228 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400229 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400230 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
231 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400232 cflags = [ "-msse2" ]
233 }
mtklein9b8583d2016-08-24 17:32:30 -0700234}
mtkleinc04ff472016-06-23 10:29:30 -0700235
mtklein9b8583d2016-08-24 17:32:30 -0700236opts("ssse3") {
237 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400239 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400240 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
241 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400242 cflags = [ "-mssse3" ]
243 }
mtklein9b8583d2016-08-24 17:32:30 -0700244}
mtkleinc04ff472016-06-23 10:29:30 -0700245
mtklein9b8583d2016-08-24 17:32:30 -0700246opts("sse41") {
247 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700248 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400249 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400250 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
251 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400252 cflags = [ "-msse4.1" ]
253 }
mtklein9b8583d2016-08-24 17:32:30 -0700254}
mtklein4e976072016-08-08 09:06:27 -0700255
mtklein9b8583d2016-08-24 17:32:30 -0700256opts("sse42") {
257 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400259 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400260 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
261 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400262 cflags = [ "-msse4.2" ]
263 }
mtklein9b8583d2016-08-24 17:32:30 -0700264}
265
266opts("avx") {
267 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700268 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400269 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000270 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400271 } else {
272 cflags = [ "-mavx" ]
273 }
mtkleinc04ff472016-06-23 10:29:30 -0700274}
275
Mike Klein1b9b7d52018-02-27 10:37:40 -0500276opts("hsw") {
277 enabled = is_x86
278 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400279 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500280 cflags = [ "/arch:AVX2" ]
281 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000282 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500283 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500284}
285
mtkleinc095df52016-08-24 12:23:52 -0700286# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700287template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500288 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700289 if (invoker.enabled) {
290 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700291 if (defined(invoker.public_defines)) {
292 defines = invoker.public_defines
293 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600294 if (defined(invoker.public_configs)) {
295 configs = invoker.public_configs
296 }
mtklein457b42a2016-08-23 13:56:37 -0700297 }
298 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500299 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700300 forward_variables_from(invoker,
301 "*",
302 [
303 "public_defines",
304 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700305 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700306 ])
mtklein457b42a2016-08-23 13:56:37 -0700307 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700308 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700309 if (defined(invoker.configs_to_remove)) {
310 configs -= invoker.configs_to_remove
311 }
mtklein457b42a2016-08-23 13:56:37 -0700312 }
313 } else {
mtklein457b42a2016-08-23 13:56:37 -0700314 source_set(target_name) {
315 forward_variables_from(invoker,
316 "*",
317 [
318 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400319 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700320 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700321 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700322 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700323 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700324 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700325 ])
mtkleincd01b032016-08-31 04:58:19 -0700326 if (defined(invoker.sources_when_disabled)) {
327 sources = invoker.sources_when_disabled
328 }
329 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700330 }
mtkleineb3c4252016-08-23 07:38:09 -0700331 }
mtklein457b42a2016-08-23 13:56:37 -0700332}
mtklein457b42a2016-08-23 13:56:37 -0700333
mtkleina45be612016-08-29 15:22:10 -0700334optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500335 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700336
337 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500338 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700339 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700340 ]
341 sources = [
342 "src/ports/SkFontMgr_android.cpp",
343 "src/ports/SkFontMgr_android_factory.cpp",
344 "src/ports/SkFontMgr_android_parser.cpp",
345 ]
346}
347
mtkleind2e39db2016-09-07 07:52:55 -0700348optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500349 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700350
351 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500352 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700353 ]
354 sources = [
355 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500356 "src/ports/SkFontMgr_custom.h",
357 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700358 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500359 "src/ports/SkFontMgr_custom_embedded.cpp",
360 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700361 ]
362}
363
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500364optional("fontmgr_custom_empty") {
365 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500366
367 deps = [
368 ":typeface_freetype",
369 ]
370 sources = [
371 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500372 "src/ports/SkFontMgr_custom_empty.cpp",
373 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800374 ]
375}
376
Hal Canaryff2742e2018-01-30 11:35:47 -0500377optional("fontmgr_empty") {
378 enabled = skia_enable_fontmgr_empty
379 sources = [
380 "src/ports/SkFontMgr_empty_factory.cpp",
381 ]
382}
383
mtklein3cc22182016-08-29 13:26:14 -0700384optional("fontmgr_fontconfig") {
385 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700386
387 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500388 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700389 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700390 ]
391 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700392 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700393 "src/ports/SkFontConfigInterface_direct.cpp",
394 "src/ports/SkFontConfigInterface_direct_factory.cpp",
395 "src/ports/SkFontMgr_FontConfigInterface.cpp",
396 "src/ports/SkFontMgr_fontconfig.cpp",
397 "src/ports/SkFontMgr_fontconfig_factory.cpp",
398 ]
399}
400
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500401optional("fontmgr_fuchsia") {
402 enabled = skia_enable_fontmgr_fuchsia
403
Chinmay Garde89820762019-05-06 16:44:06 -0700404 deps = []
405
406 if (is_fuchsia && using_fuchsia_sdk) {
407 deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
408 } else {
409 deps += [ "//sdk/fidl/fuchsia.fonts" ]
410 }
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500411 sources = [
412 "src/ports/SkFontMgr_fuchsia.cpp",
413 "src/ports/SkFontMgr_fuchsia.h",
414 ]
415}
416
417optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400418 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700419
420 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500421 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700422 ]
423 sources = [
424 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500425 "src/ports/SkFontMgr_custom.h",
426 "src/ports/SkFontMgr_custom_embedded.cpp",
427 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700428 ]
429}
430
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500431optional("fontmgr_win") {
432 enabled = skia_enable_fontmgr_win
433
434 sources = [
435 "src/fonts/SkFontMgr_indirect.cpp",
436 "src/ports/SkFontMgr_win_dw.cpp",
437 "src/ports/SkFontMgr_win_dw_factory.cpp",
438 "src/ports/SkScalerContext_win_dw.cpp",
439 "src/ports/SkTypeface_win_dw.cpp",
440 ]
441}
442
443optional("fontmgr_win_gdi") {
444 enabled = skia_enable_fontmgr_win_gdi
445
446 sources = [
447 "src/ports/SkFontHost_win.cpp",
448 ]
449 libs = [ "Gdi32.lib" ]
450}
451
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700452if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400453 executable("sksllex") {
454 sources = [
455 "src/sksl/lex/Main.cpp",
456 "src/sksl/lex/NFA.cpp",
457 "src/sksl/lex/RegexNode.cpp",
458 "src/sksl/lex/RegexParser.cpp",
459 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500460 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400461 }
462
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700463 action("run_sksllex") {
464 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400465 deps = [
466 ":sksllex(//gn/toolchain:$host_toolchain)",
467 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700468 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700469 "src/sksl/lex/sksl.lex",
470 ]
471
472 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
473 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
474 outputs = [
475 "$target_out_dir/" +
476 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
477 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
478 # confused due to the same file being named by two different paths
479 ]
480 sksllex_path = "$root_out_dir/"
481 sksllex_path += "sksllex"
482 if (host_os == "win") {
483 sksllex_path += ".exe"
484 }
485 args = [
486 rebase_path(sksllex_path),
487 rebase_path("bin/clang-format"),
488 rebase_path("src"),
489 ]
490 }
491} else {
492 group("run_sksllex") {
493 }
494}
495
496if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400497 executable("skslc") {
498 defines = [ "SKSL_STANDALONE" ]
499 sources = [
500 "src/sksl/SkSLMain.cpp",
501 ]
502 sources += skia_sksl_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500503 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400504 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500505 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400506 "//third_party/spirv-tools",
507 ]
508 }
509
510 skia_gpu_processor_outputs = []
511 foreach(src, skia_gpu_processor_sources) {
512 dir = get_path_info(src, "dir")
513 name = get_path_info(src, "name")
514
515 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
516 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
517 skia_gpu_processor_outputs += [
518 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
519 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
520 # confused due to the same file being named by two different paths
521 ]
522 }
523
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500524 action("create_sksl_enums") {
525 script = "gn/create_sksl_enums.py"
526 sources = [
527 "include/private/GrSharedEnums.h",
528 ]
529 outputs = [
530 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500531 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500532 ]
533 args = [
534 rebase_path(sources[0]),
535 rebase_path(outputs[0]),
536 ]
537 }
538
Ethan Nicholas762466e2017-06-29 10:03:38 -0400539 action("compile_processors") {
540 script = "gn/compile_processors.py"
541 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500542 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400543 ":skslc(//gn/toolchain:$host_toolchain)",
544 ]
545 sources = skia_gpu_processor_sources
546 outputs = skia_gpu_processor_outputs
547 skslc_path = "$root_out_dir/"
548 if (host_toolchain != default_toolchain_name) {
549 skslc_path += "$host_toolchain/"
550 }
551 skslc_path += "skslc"
552 if (host_os == "win") {
553 skslc_path += ".exe"
554 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400555 args = [
556 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400557 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400558 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400559 args += rebase_path(skia_gpu_processor_sources)
560 }
561} else {
562 skia_gpu_processor_outputs = []
563 group("compile_processors") {
564 }
565}
566
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500567optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700568 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400569 deps = [
570 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700571 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400572 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700573 if (skia_generate_workarounds) {
574 deps += [ ":workaround_list" ]
575 }
Robert Phillipsefb9f142019-05-17 14:19:44 -0400576 public_defines = [ "SK_GL" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600577 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400578 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700579
Brian Salomon3d6801e2017-12-11 10:06:31 -0500580 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400581 if (!skia_enable_ccpr) {
582 sources -= skia_ccpr_sources
583 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
584 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400585 if (!skia_enable_nvpr) {
586 sources -= skia_nvpr_sources
587 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
588 }
mtklein06c35c02016-09-20 12:28:12 -0700589
590 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500591 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700592 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400593 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700594 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400595 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400596
597 # this lib is required to link against AHardwareBuffer
598 if (defined(ndk_api) && ndk_api >= 26) {
599 libs += [ "android" ]
600 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400601 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500602 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400603 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700604 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500605 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400606 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700607 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800609 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400611 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500613 if (target_cpu != "arm64") {
614 libs += [ "OpenGL32.lib" ]
615 }
mtklein06c35c02016-09-20 12:28:12 -0700616 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500617 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700618 }
mtkleine9fb3d52016-09-20 15:11:46 -0700619
620 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400621 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400622 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700623 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700624 if (skia_enable_vulkan_debug_layers) {
625 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
626 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800627 if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -0700628 if (using_fuchsia_sdk) {
629 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
630 } else {
631 public_deps +=
632 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
633 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800634 }
mtkleine9fb3d52016-09-20 15:11:46 -0700635 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400636
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400637 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400638 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400639 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
640 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400641
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400642 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400643 if (skia_use_metal) {
644 public_defines += [ "SK_METAL" ]
645 sources += skia_metal_sources
646 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400647 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400648 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400649 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500650
651 if (skia_enable_atlas_text) {
652 sources += skia_atlas_text_sources
653 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400654
655 if (is_debug) {
656 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
657 }
mtklein06c35c02016-09-20 12:28:12 -0700658}
659
Leon Scroggins III41169202019-01-29 09:29:57 -0500660optional("gif") {
661 enabled = !skia_use_wuffs
662 sources = [
663 "src/codec/SkGifCodec.cpp",
664 "third_party/gif/SkGifImageReader.cpp",
665 ]
666}
667
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400668optional("heif") {
669 enabled = skia_use_libheif
670 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
671
672 deps = []
673
674 sources = [
675 "src/codec/SkHeifCodec.cpp",
676 ]
677}
678
mtklein63213812016-08-24 09:55:56 -0700679optional("jpeg") {
680 enabled = skia_use_libjpeg_turbo
681 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
682
mtklein63213812016-08-24 09:55:56 -0700683 deps = [
684 "//third_party/libjpeg-turbo:libjpeg",
685 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400686 public = [
687 "include/encode/SkJpegEncoder.h",
688 ]
mtklein63213812016-08-24 09:55:56 -0700689 sources = [
690 "src/codec/SkJpegCodec.cpp",
691 "src/codec/SkJpegDecoderMgr.cpp",
692 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700693 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400694 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700695 ]
696}
697
698optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500699 enabled = skia_use_zlib && skia_enable_pdf
700 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700701
mtklein63213812016-08-24 09:55:56 -0700702 deps = [
703 "//third_party/zlib",
704 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400705 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700706 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400707 }
brettwb9447282016-09-01 14:24:39 -0700708 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700709 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500710 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
711 deps += [ "//third_party/harfbuzz" ]
712 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
713 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700714 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500715 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700716 }
717}
718
719optional("png") {
720 enabled = skia_use_libpng
721 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
722
mtklein63213812016-08-24 09:55:56 -0700723 deps = [
724 "//third_party/libpng",
725 ]
726 sources = [
727 "src/codec/SkIcoCodec.cpp",
728 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400729 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700730 ]
731}
732
scroggof84ad642016-10-31 09:02:57 -0700733optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400734 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700735 public_defines = [ "SK_CODEC_DECODES_RAW" ]
736
737 deps = [
738 "//third_party/dng_sdk",
739 "//third_party/libjpeg-turbo:libjpeg",
740 "//third_party/piex",
741 ]
742
743 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
744 # Skia.
745 configs_to_remove = [ "//gn:no_exceptions" ]
746
747 sources = [
scroggof84ad642016-10-31 09:02:57 -0700748 "src/codec/SkRawCodec.cpp",
749 ]
750}
751
Mike Klein852a8cb2018-05-15 10:46:58 -0400752import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400753source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400754 cflags = []
755 if (!is_win || is_clang) {
756 cflags += [
757 "-w",
758 "-std=c11",
759 ]
760 }
761
762 public = [
Brian Osmanea236bf2019-04-29 10:28:22 -0400763 "include/third_party/skcms/skcms.h",
Mike Klein852a8cb2018-05-15 10:46:58 -0400764 ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400765 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400766 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
767}
768
mtklein3cc22182016-08-29 13:26:14 -0700769optional("typeface_freetype") {
770 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700771
772 deps = [
773 "//third_party/freetype2",
774 ]
775 sources = [
776 "src/ports/SkFontHost_FreeType.cpp",
777 "src/ports/SkFontHost_FreeType_common.cpp",
778 ]
779}
780
mtklein457b42a2016-08-23 13:56:37 -0700781optional("webp") {
782 enabled = skia_use_libwebp
783 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
784
mtklein457b42a2016-08-23 13:56:37 -0700785 deps = [
786 "//third_party/libwebp",
787 ]
788 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700789 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400790 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700791 ]
mtkleineb3c4252016-08-23 07:38:09 -0700792}
793
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400794optional("wuffs") {
795 enabled = skia_use_wuffs
796 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
797
798 deps = [
799 "//third_party/wuffs",
800 ]
801 sources = [
802 "src/codec/SkWuffsCodec.cpp",
803 ]
804}
805
mtklein63213812016-08-24 09:55:56 -0700806optional("xml") {
807 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000808 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700809
mtklein63213812016-08-24 09:55:56 -0700810 deps = [
811 "//third_party/expat",
812 ]
813 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500814 "src/svg/SkSVGCanvas.cpp",
815 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700816 "src/xml/SkDOM.cpp",
817 "src/xml/SkXMLParser.cpp",
818 "src/xml/SkXMLWriter.cpp",
819 ]
820}
821
Mike Klein613ad382019-06-06 11:42:02 -0500822optional("skvm_jit") {
823 enabled = skia_use_xbyak
824 public_defines = [ "SKVM_JIT" ]
825
826 public_deps = [
827 "//third_party/xbyak",
828 ]
829}
830
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700831if (skia_enable_gpu && skia_generate_workarounds) {
832 action("workaround_list") {
833 script = "tools/build_workaround_header.py"
834
835 inputs = [
836 "src/gpu/gpu_workaround_list.txt",
837 ]
838
839 # see comments in skia_compile_processors about out dir path shenanigans.
840 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700841 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700842
843 outputs = [
844 "$root_out_dir/$output_file",
845 ]
846 args = [
847 "--output-file",
848 "$output_file",
849 ]
850
851 foreach(file, inputs) {
852 args += [ rebase_path(file, root_build_dir) ]
853 }
854 }
855}
856
mtkleinc04ff472016-06-23 10:29:30 -0700857component("skia") {
858 public_configs = [ ":skia_public" ]
859 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700860
Mike Klein607b0a72018-11-07 16:17:34 -0500861 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500862 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500863 ":pdf",
864 ":skcms",
865 ]
866
mtkleinc04ff472016-06-23 10:29:30 -0700867 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700868 ":arm64",
869 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700870 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000871 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700872 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700873 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700874 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500875 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500876 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700877 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800878 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500879 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500880 ":fontmgr_win",
881 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500882 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400883 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500884 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700885 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700886 ":none",
mtklein63213812016-08-24 09:55:56 -0700887 ":png",
scroggof84ad642016-10-31 09:02:57 -0700888 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -0500889 ":skvm_jit",
mtklein9b8583d2016-08-24 17:32:30 -0700890 ":sse2",
891 ":sse41",
892 ":sse42",
893 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700894 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400895 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700896 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700897 ]
898
Chinmay Garde43f115c2016-11-16 15:04:12 -0800899 # This file (and all GN files in Skia) are designed to work with an
900 # empty sources assignment filter; we handle all that explicitly.
901 # We clear the filter here for clients who may have set up a global filter.
902 set_sources_assignment_filter([])
903
Hal Canaryc25f4e92019-02-26 11:54:25 -0500904 public = skia_core_public
905 public += skia_utils_public
906 public += skia_effects_public
907 public += skia_effects_imagefilter_public
908 public += skia_xps_public
909
mtkleinc04ff472016-06-23 10:29:30 -0700910 sources = []
brettwb9447282016-09-01 14:24:39 -0700911 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700912 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500913 if (skia_use_xps) {
914 sources += skia_xps_sources
915 }
Mike Klein54378232018-11-08 12:08:05 +0000916 sources += skia_effects_sources
917 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700918 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400919 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500920 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700921 "src/android/SkBitmapRegionCodec.cpp",
922 "src/android/SkBitmapRegionDecoder.cpp",
923 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100924 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400925 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700926 "src/codec/SkBmpCodec.cpp",
927 "src/codec/SkBmpMaskCodec.cpp",
928 "src/codec/SkBmpRLECodec.cpp",
929 "src/codec/SkBmpStandardCodec.cpp",
930 "src/codec/SkCodec.cpp",
931 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400932 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400933 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700934 "src/codec/SkMaskSwizzler.cpp",
935 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700936 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700937 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700938 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700939 "src/codec/SkSwizzler.cpp",
940 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700941 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700942 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000943 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700944 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700945 "src/ports/SkMemory_malloc.cpp",
946 "src/ports/SkOSFile_stdio.cpp",
947 "src/sfnt/SkOTTable_name.cpp",
948 "src/sfnt/SkOTUtils.cpp",
949 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700950 ]
brettwb9447282016-09-01 14:24:39 -0700951
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400952 defines = []
953 if (!skia_enable_skpicture) {
954 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500955 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400956 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000957 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400958 sources += [ "src/core/SkPicture_none.cpp" ]
959 }
960
mtklein7d6fb2c2016-08-25 14:50:44 -0700961 libs = []
962
mtkleinc04ff472016-06-23 10:29:30 -0700963 if (is_win) {
964 sources += [
965 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700966 "src/ports/SkImageEncoder_WIC.cpp",
967 "src/ports/SkImageGeneratorWIC.cpp",
968 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700969 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700970 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700971 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400972 libs += [
973 "FontSub.lib",
974 "Ole32.lib",
975 "OleAut32.lib",
976 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500977 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400978 ]
mtkleinc04ff472016-06-23 10:29:30 -0700979 } else {
980 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700981 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700982 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700983 "src/ports/SkTLS_pthread.cpp",
984 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400985 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700986 }
987
mtklein7d6fb2c2016-08-25 14:50:44 -0700988 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500989 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500990 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500991 deps += [ "//third_party/cpu-features" ]
992 }
mtklein06c35c02016-09-20 12:28:12 -0700993 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700994 libs += [
995 "EGL",
996 "GLESv2",
997 "log",
998 ]
999 }
1000
Kevin Lubick217056c2018-09-20 17:39:31 -04001001 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001002 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001003 if (skia_use_egl) {
1004 libs += [ "GLESv2" ]
1005 }
mtkleinc04ff472016-06-23 10:29:30 -07001006 }
1007
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001008 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001009 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001010 }
1011
mtkleinc04ff472016-06-23 10:29:30 -07001012 if (is_mac) {
1013 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001014 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001015 "src/ports/SkImageEncoder_CG.cpp",
1016 "src/ports/SkImageGeneratorCG.cpp",
1017 ]
mtklein09e61f72016-08-23 13:35:28 -07001018 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001019 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1020 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001021 "ApplicationServices.framework",
1022 "OpenGL.framework",
1023 ]
mtkleinc04ff472016-06-23 10:29:30 -07001024 }
abarth6fc8ff02016-07-15 15:15:15 -07001025
Mike Klein7d302882016-11-03 14:06:31 -04001026 if (is_ios) {
1027 sources += [
1028 "src/ports/SkDebug_stdio.cpp",
1029 "src/ports/SkFontHost_mac.cpp",
1030 "src/ports/SkImageEncoder_CG.cpp",
1031 "src/ports/SkImageGeneratorCG.cpp",
1032 ]
1033 libs += [
1034 "CoreFoundation.framework",
1035 "CoreGraphics.framework",
1036 "CoreText.framework",
1037 "ImageIO.framework",
1038 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001039
1040 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1041 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001042 ]
1043 }
1044
abarth6fc8ff02016-07-15 15:15:15 -07001045 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001046 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001047 }
mtkleinc04ff472016-06-23 10:29:30 -07001048}
1049
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001050# DebugCanvas used in experimental/wasm-skp-debugger
1051if (target_cpu == "wasm") {
1052 static_library("debugcanvas") {
1053 public_configs = [ ":skia_public" ]
1054
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001055 sources = [
1056 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001057 "tools/debugger/DebugCanvas.cpp",
1058 "tools/debugger/DrawCommand.cpp",
1059 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001060 ]
1061
1062 deps = [
1063 ":fontmgr_wasm",
1064 ]
1065 }
1066}
1067
Kevin Lubickcbcff382018-10-02 09:02:18 -04001068static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001069 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001070 public_configs = [ ":skia_public" ]
1071 configs += skia_library_configs
1072
1073 deps = [
1074 ":arm64",
1075 ":armv7",
1076 ":avx",
1077 ":crc32",
1078 ":hsw",
1079 ":none",
1080 ":sse2",
1081 ":sse41",
1082 ":sse42",
1083 ":ssse3",
1084 ]
1085
1086 # This file (and all GN files in Skia) are designed to work with an
1087 # empty sources assignment filter; we handle all that explicitly.
1088 # We clear the filter here for clients who may have set up a global filter.
1089 set_sources_assignment_filter([])
1090
1091 sources = []
1092 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001093 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001094 sources += [
1095 "src/core/SkAnalyticEdge.cpp",
1096 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001097 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001098 "src/core/SkCubicMap.cpp",
1099 "src/core/SkEdge.cpp",
1100 "src/core/SkEdgeBuilder.cpp",
1101 "src/core/SkEdgeClipper.cpp",
1102 "src/core/SkGeometry.cpp",
1103 "src/core/SkLineClipper.cpp",
1104 "src/core/SkMallocPixelRef.cpp",
1105 "src/core/SkMath.cpp",
1106 "src/core/SkMatrix.cpp",
1107 "src/core/SkOpts.cpp",
1108 "src/core/SkPaint.cpp",
1109 "src/core/SkPath.cpp",
1110 "src/core/SkPathEffect.cpp",
1111 "src/core/SkPathMeasure.cpp",
1112 "src/core/SkPathRef.cpp",
1113 "src/core/SkPoint.cpp",
1114 "src/core/SkRRect.cpp",
1115 "src/core/SkRect.cpp",
1116 "src/core/SkSemaphore.cpp",
1117 "src/core/SkStream.cpp",
1118 "src/core/SkString.cpp",
1119 "src/core/SkStringUtils.cpp",
1120 "src/core/SkStroke.cpp",
1121 "src/core/SkStrokeRec.cpp",
1122 "src/core/SkStrokerPriv.cpp",
1123 "src/core/SkThreadID.cpp",
1124 "src/core/SkUtils.cpp",
1125 "src/effects/SkDashPathEffect.cpp",
1126 "src/effects/SkTrimPathEffect.cpp",
1127 "src/ports/SkDebug_stdio.cpp",
1128 "src/ports/SkMemory_malloc.cpp",
1129 "src/utils/SkDashPath.cpp",
1130 "src/utils/SkParse.cpp",
1131 "src/utils/SkParsePath.cpp",
1132 "src/utils/SkUTF.cpp",
1133 ]
1134}
1135
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001136group("modules") {
1137 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001138 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001139 "modules/skottie",
1140 "modules/skshaper",
1141 ]
1142}
1143
mtkleinc095df52016-08-24 12:23:52 -07001144# Targets guarded by skia_enable_tools may use //third_party freely.
1145if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001146 skia_public_includes = [
1147 "include/android",
1148 "include/atlastext",
1149 "include/c",
1150 "include/codec",
1151 "include/config",
1152 "include/core",
1153 "include/docs",
1154 "include/effects",
1155 "include/encode",
1156 "include/gpu",
1157 "include/pathops",
1158 "include/ports",
1159 "include/svg",
1160 "include/utils",
1161 "include/utils/mac",
1162 "modules/sksg/include",
1163 "modules/skshaper/include",
1164 "modules/skottie/include",
1165 ]
1166
Mike Klein308b5ac2016-12-06 16:03:52 -05001167 # Used by gn_to_bp.py to list our public include dirs.
1168 source_set("public") {
1169 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001170 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001171 }
1172
Mike Kleinc36dedf2016-11-18 09:35:28 -05001173 config("skia.h_config") {
1174 include_dirs = [ "$target_gen_dir" ]
1175 }
1176 action("skia.h") {
1177 public_configs = [ ":skia.h_config" ]
1178 skia_h = "$target_gen_dir/skia.h"
1179 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001180
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001181 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1182 [ rebase_path(skia_h, root_build_dir) ] +
1183 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001184 depfile = "$skia_h.deps"
1185 outputs = [
1186 skia_h,
1187 ]
1188 }
1189
Brian Osmanc9a42472018-05-31 13:17:12 -04001190 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001191 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001192 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001193 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001194 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001195 "tools/fiddle/draw.cpp",
1196 "tools/fiddle/fiddle_main.cpp",
1197 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001198
1199 if (skia_use_egl) {
1200 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001201 } else {
1202 sources += [ "tools/fiddle/null_context.cpp" ]
1203 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001204 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001205 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001206 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001207 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001208 ":skia",
1209 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001210 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001211 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001212 ]
1213 }
1214 }
1215
Mike Klein9e25bb92019-04-29 09:46:36 -05001216 config("our_vulkan_headers") {
1217 # We add this directory to simulate the client already have
1218 # vulkan/vulkan_core.h on their path.
1219 include_dirs = [ "include/third_party/vulkan" ]
1220 }
1221
Brian Osmanc9a42472018-05-31 13:17:12 -04001222 source_set("public_headers_warnings_check") {
1223 sources = [
1224 "tools/public_headers_warnings_check.cpp",
1225 ]
1226 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001227 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001228 deps = [
1229 ":skia",
1230 ":skia.h",
1231 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001232 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001233 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001234 }
1235
mtkleinc095df52016-08-24 12:23:52 -07001236 template("test_lib") {
1237 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001238 if (defined(invoker.public_defines)) {
1239 defines = invoker.public_defines
1240 }
mtklein25c81d42016-07-27 13:55:26 -07001241 }
mtkleinc095df52016-08-24 12:23:52 -07001242 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001243 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001244 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001245 public_configs = [
1246 ":" + target_name + "_config",
1247 ":skia_private",
1248 ]
1249
1250 if (!defined(deps)) {
1251 deps = []
1252 }
1253 deps += [ ":skia" ]
1254 testonly = true
1255 }
mtklein25c81d42016-07-27 13:55:26 -07001256 }
mtklein25c81d42016-07-27 13:55:26 -07001257
Mike Kleine6682eb2017-01-05 10:54:57 -05001258 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001259 if (is_ios) {
1260 app_name = target_name
1261 gen_path = target_gen_dir
1262
1263 action("${app_name}_generate_info_plist") {
1264 script = "//gn/gen_plist_ios.py"
1265 outputs = [
1266 "$gen_path/${app_name}_Info.plist",
1267 ]
1268 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1269 }
1270
1271 bundle_data("${app_name}_bundle_info_plist") {
1272 public_deps = [
1273 ":${app_name}_generate_info_plist",
1274 ]
1275 sources = [
1276 "$gen_path/${app_name}_Info.plist",
1277 ]
1278 outputs = [
1279 "{{bundle_root_dir}}/Info.plist",
1280 ]
1281 }
1282
Jim Van Verthffacf652019-04-02 11:59:34 -04001283 has_skps = "True" == exec_script("//gn/checkdir.py",
1284 [ rebase_path("skps", root_build_dir) ],
1285 "trim string")
1286 bundle_data("${app_name}_bundle_resources") {
1287 sources = [
1288 "resources",
1289 ]
1290 outputs = [
1291 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1292 "{{bundle_resources_dir}}/data/resources",
1293 ]
1294 }
1295 if (has_skps) {
1296 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001297 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001298 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001299 ]
1300 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001301 # Store in same folder as resources
1302 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001303 ]
1304 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001305 }
1306
Jim Van Verth443a9132017-11-28 09:45:26 -05001307 executable("${app_name}_generate_executable") {
1308 forward_variables_from(invoker,
1309 "*",
1310 [
1311 "output_name",
1312 "visibility",
1313 "is_shared_library",
1314 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001315 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001316 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001317 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1318 }
1319
1320 bundle_data("${app_name}_bundle_executable") {
1321 public_deps = [
1322 ":${app_name}_generate_executable",
1323 ]
1324 sources = [
1325 "$gen_path/$app_name",
1326 ]
1327 outputs = [
1328 "{{bundle_executable_dir}}/$app_name",
1329 ]
1330 testonly = true
1331 }
1332
Jim Van Verthffacf652019-04-02 11:59:34 -04001333 bundle_data("${app_name}_bundle_symbols") {
1334 public_deps = [
1335 ":${app_name}_generate_executable",
1336 ]
1337 sources = [
1338 "$gen_path/${app_name}.dSYM",
1339 ]
1340 outputs = [
1341 "{{bundle_executable_dir}}/${app_name}.dSYM",
1342 ]
1343 testonly = true
1344 }
1345
Jim Van Verth443a9132017-11-28 09:45:26 -05001346 create_bundle("$app_name") {
1347 product_type = "com.apple.product-type.application"
1348 testonly = true
1349
1350 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1351 bundle_resources_dir = bundle_root_dir
1352 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001353
1354 deps = [
1355 ":${app_name}_bundle_executable",
1356 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001357 ":${app_name}_bundle_resources",
1358 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001359 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001360 if (has_skps) {
1361 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001362 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001363
1364 # should only code sign when running on a device, not the simulator
1365 if (target_cpu != "x64") {
1366 code_signing_script = "//gn/codesign_ios.py"
1367 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1368 code_signing_outputs = [
1369 "$bundle_root_dir/_CodeSignature/CodeResources",
1370 "$bundle_root_dir/embedded.mobileprovision",
1371 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001372 code_signing_args = [
1373 rebase_path("$bundle_root_dir", root_build_dir),
1374 skia_ios_identity,
1375 skia_ios_profile,
1376 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001377 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001378 }
1379 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001380 # !is_ios
1381
1382 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1383 shared_library("lib" + target_name) {
1384 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1385 configs += [ ":skia_private" ]
1386 testonly = true
1387 }
1388 } else {
1389 _executable = target_name
1390 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001391 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001392 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1393 configs += [ ":skia_private" ]
1394 testonly = true
1395 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001396 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001397 if (is_android && skia_android_serial != "" && defined(_executable)) {
1398 action("push_" + target_name) {
1399 script = "gn/push_to_android.py"
1400 deps = [
1401 ":" + _executable,
1402 ]
1403 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1404 outputs = [
1405 _stamp,
1406 ]
1407 args = [
1408 rebase_path("$root_build_dir/$_executable"),
1409 skia_android_serial,
1410 rebase_path(_stamp),
1411 ]
1412 testonly = true
1413 }
Mike Klein7d921032017-01-05 12:20:41 -05001414 }
1415 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001416 }
1417
Greg Danielda16cce2018-08-01 09:23:57 -04001418 config("moltenvk_config") {
1419 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1420 if (is_ios) {
1421 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1422 } else {
1423 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1424 }
1425 cflags = [ "-F$moltenvk_framework_path" ]
1426 ldflags = [ "-F$moltenvk_framework_path" ]
1427 libs = [
1428 "MoltenVK.framework",
1429 "Metal.framework",
1430 "IOSurface.framework",
1431 "QuartzCore.framework",
1432 "Foundation.framework",
1433 ]
1434 if (is_ios) {
1435 libs += [ "UIKit.framework" ]
1436 } else {
1437 libs += [ "IOKit.framework" ]
1438 }
1439 defines = [ "SK_MOLTENVK" ]
1440 }
1441 }
1442
1443 source_set("moltenvk") {
1444 public_configs = [ ":moltenvk_config" ]
1445 }
1446
mtkleinc095df52016-08-24 12:23:52 -07001447 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001448 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001449
Mike Klein9e25bb92019-04-29 09:46:36 -05001450 # Bots and even devs may not have Vulkan headers, so put
1451 # include/third_party/vulkan on our path so they're always available.
1452 all_dependent_configs = [ ":our_vulkan_headers" ]
1453
Mike Klein333fb452019-04-24 08:48:11 -05001454 defines = []
1455 if (skia_enable_discrete_gpu) {
1456 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1457 }
1458
Brian Osmanc9a42472018-05-31 13:17:12 -04001459 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001460 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001461 sources = [
1462 "tools/gpu/GrContextFactory.cpp",
1463 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001464 "tools/gpu/MemoryCache.cpp",
1465 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001466 "tools/gpu/ProxyUtils.cpp",
1467 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001468 "tools/gpu/YUVUtils.cpp",
1469 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001470 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1471 "tools/gpu/gl/GLTestContext.cpp",
1472 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001473 "tools/gpu/mock/MockTestContext.cpp",
1474 ]
1475 libs = []
1476
1477 if (is_android || skia_use_egl) {
1478 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1479 } else if (is_ios) {
1480 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1481 libs += [ "OpenGLES.framework" ]
1482 } else if (is_linux) {
1483 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001484 libs += [
1485 "GLU",
1486 "X11",
1487 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001488 } else if (is_mac) {
1489 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1490 } else if (is_win) {
1491 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001492 libs += [ "Gdi32.lib" ]
1493 if (target_cpu != "arm64") {
1494 libs += [ "OpenGL32.lib" ]
1495 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001496 }
mtklein25c81d42016-07-27 13:55:26 -07001497
Brian Osmanc9a42472018-05-31 13:17:12 -04001498 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001499
Brian Osmanc9a42472018-05-31 13:17:12 -04001500 if (skia_use_angle) {
1501 deps += [ "//third_party/angle2" ]
1502 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1503 }
Greg Daniel54200e42018-12-11 17:03:39 -05001504
Brian Osmanc9a42472018-05-31 13:17:12 -04001505 if (skia_use_vulkan) {
1506 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1507 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001508 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1509 public_deps += [ ":moltenvk" ]
1510 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001511 }
1512 if (skia_use_metal) {
1513 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001514 }
mtklein25c81d42016-07-27 13:55:26 -07001515 }
mtklein25c81d42016-07-27 13:55:26 -07001516
mtkleinc095df52016-08-24 12:23:52 -07001517 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001518 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001519 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001520 ]
1521 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001522
1523 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001524 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001525 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001526 ]
1527 deps = [
mtklein046cb562016-09-16 10:23:12 -07001528 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001529 ]
1530 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001531 ":gpu_tool_utils",
1532 ]
1533 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001534 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001535 sources = [
1536 "tools/flags/CommonFlagsGpu.cpp",
1537 ]
1538 deps = [
1539 ":flags",
1540 ]
1541 public_deps = [
1542 ":gpu_tool_utils",
1543 ]
1544 }
1545 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001546 sources = [
1547 "tools/flags/CommonFlagsImages.cpp",
1548 ]
1549 deps = [
1550 ":flags",
1551 ]
1552 }
1553 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001554 sources = [
1555 "tools/flags/CommonFlagsAA.cpp",
1556 ]
1557 deps = [
1558 ":flags",
1559 ]
1560 }
mtklein25c81d42016-07-27 13:55:26 -07001561
Mike Klein499f0ac2019-03-25 13:00:12 -05001562 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001563 deps = [
1564 ":flags",
1565 ]
1566 sources = [
1567 "tools/trace/ChromeTracingTracer.cpp",
1568 "tools/trace/ChromeTracingTracer.h",
1569 "tools/trace/EventTracingPriv.cpp",
1570 "tools/trace/EventTracingPriv.h",
1571 "tools/trace/SkDebugfTracer.cpp",
1572 "tools/trace/SkDebugfTracer.h",
1573 ]
1574 }
1575
mtkleinc095df52016-08-24 12:23:52 -07001576 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001577 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001578 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001579 "tools/AutoreleasePool.h",
mtkleinc095df52016-08-24 12:23:52 -07001580 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001581 "tools/DDLPromiseImageHelper.cpp",
1582 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001583 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001584 "tools/ProcStats.cpp",
1585 "tools/Resources.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001586 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001587 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001588 "tools/debugger/DebugCanvas.cpp",
1589 "tools/debugger/DrawCommand.cpp",
1590 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001591 "tools/fonts/RandomScalerContext.cpp",
1592 "tools/fonts/TestEmptyTypeface.h",
1593 "tools/fonts/TestFontMgr.cpp",
1594 "tools/fonts/TestFontMgr.h",
1595 "tools/fonts/TestSVGTypeface.cpp",
1596 "tools/fonts/TestSVGTypeface.h",
1597 "tools/fonts/TestTypeface.cpp",
1598 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001599 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001600 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001601 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001602 "tools/timer/Timer.cpp",
1603 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001604 libs = []
1605 if (is_ios) {
1606 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001607 sources += [ "tools/ios_utils.h" ]
1608 if (skia_use_metal) {
1609 sources += [ "tools/AutoreleasePool.mm" ]
1610 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001611 libs += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001612 } else if (is_mac) {
1613 if (skia_use_metal) {
1614 sources += [ "tools/AutoreleasePool.mm" ]
1615 libs += [ "Foundation.framework" ]
1616 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001617 } else if (is_win) {
1618 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001619 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001620
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001621 defines = []
1622 if (skia_tools_require_resources) {
1623 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1624 }
mtkleinc095df52016-08-24 12:23:52 -07001625 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001626 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001627 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001628 ]
1629 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001630 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001631 ]
mtkleinc095df52016-08-24 12:23:52 -07001632 }
mtklein25c81d42016-07-27 13:55:26 -07001633
Mike Kleine11e5c12019-04-24 12:46:06 -05001634 test_lib("etc1") {
1635 sources = [
1636 "third_party/etc1/etc1.cpp",
1637 ]
1638 }
1639
Mike Reed7bf160e2019-05-17 16:50:51 -04001640 if (skia_use_ffmpeg) {
1641 test_lib("video_decoder") {
1642 sources = [
1643 "experimental/ffmpeg/SkVideoDecoder.cpp",
1644 "experimental/ffmpeg/SkVideoDecoder.h",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001645 "experimental/ffmpeg/SkVideoEncoder.cpp",
1646 "experimental/ffmpeg/SkVideoEncoder.h",
Mike Reed7bf160e2019-05-17 16:50:51 -04001647 ]
1648 libs = [
Mike Reedf97e8e92019-05-29 13:33:55 -04001649 "swscale",
Mike Reed7bf160e2019-05-17 16:50:51 -04001650 "avcodec",
1651 "avformat",
1652 "avutil",
1653 ]
1654 }
1655 }
1656
Mike Klein6e744122016-10-27 12:21:40 -04001657 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001658 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001659 sources = gm_sources
1660 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001661 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001662 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001663 ":skia",
1664 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001665 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001666 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001667 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001668 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001669 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001670 public_deps = [
1671 ":gpu_tool_utils",
1672 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001673
1674 if (skia_use_ffmpeg) {
1675 deps += [ ":video_decoder" ]
1676 sources += [ "gm/video_decoder.cpp" ]
1677 }
mtkleinc095df52016-08-24 12:23:52 -07001678 }
mtklein25c81d42016-07-27 13:55:26 -07001679
Mike Klein7b7077c2019-06-03 17:10:59 -05001680 test_lib("skvm_builders") {
1681 sources = [
1682 "tools/SkVMBuilders.cpp",
1683 "tools/SkVMBuilders.h",
1684 ]
1685 }
1686
Mike Klein6e744122016-10-27 12:21:40 -04001687 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001688 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001689 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001690 if (skia_use_metal) {
1691 sources += metal_tests_sources
1692 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001693 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001694 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001695 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001696 if (!(skia_use_freetype && skia_use_fontconfig)) {
1697 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1698 }
mtkleinc095df52016-08-24 12:23:52 -07001699 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001700 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001701 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001702 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001703 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001704 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001705 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001706 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001707 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001708 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001709 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001710 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001711 "//third_party/zlib",
1712 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001713 public_deps = [
1714 ":gpu_tool_utils", # Test.h #includes headers from this target.
1715 ]
mtkleinc095df52016-08-24 12:23:52 -07001716 }
mtklein2f3416d2016-08-02 16:02:05 -07001717
Mike Klein6e744122016-10-27 12:21:40 -04001718 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001719 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001720 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001721 deps = [
1722 ":flags",
1723 ":gm",
1724 ":gpu_tool_utils",
1725 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001726 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001727 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001728 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001729 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001730 ]
1731 }
mtklein2b6870c2016-07-28 14:17:33 -07001732
mtkleinc095df52016-08-24 12:23:52 -07001733 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001734 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001735 sources = [
1736 "experimental/svg/model/SkSVGAttribute.cpp",
1737 "experimental/svg/model/SkSVGAttributeParser.cpp",
1738 "experimental/svg/model/SkSVGCircle.cpp",
1739 "experimental/svg/model/SkSVGClipPath.cpp",
1740 "experimental/svg/model/SkSVGContainer.cpp",
1741 "experimental/svg/model/SkSVGDOM.cpp",
1742 "experimental/svg/model/SkSVGEllipse.cpp",
1743 "experimental/svg/model/SkSVGGradient.cpp",
1744 "experimental/svg/model/SkSVGLine.cpp",
1745 "experimental/svg/model/SkSVGLinearGradient.cpp",
1746 "experimental/svg/model/SkSVGNode.cpp",
1747 "experimental/svg/model/SkSVGPath.cpp",
1748 "experimental/svg/model/SkSVGPattern.cpp",
1749 "experimental/svg/model/SkSVGPoly.cpp",
1750 "experimental/svg/model/SkSVGRadialGradient.cpp",
1751 "experimental/svg/model/SkSVGRect.cpp",
1752 "experimental/svg/model/SkSVGRenderContext.cpp",
1753 "experimental/svg/model/SkSVGSVG.cpp",
1754 "experimental/svg/model/SkSVGShape.cpp",
1755 "experimental/svg/model/SkSVGStop.cpp",
1756 "experimental/svg/model/SkSVGTransformableNode.cpp",
1757 "experimental/svg/model/SkSVGUse.cpp",
1758 "experimental/svg/model/SkSVGValue.cpp",
1759 ]
1760 deps = [
1761 ":skia",
1762 ":xml",
1763 ]
1764 }
mtkleinc095df52016-08-24 12:23:52 -07001765 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001766
Mike Reedd62d4062019-06-12 10:20:44 -04001767 test_lib("experimental_xform") {
1768 sources = [
1769 "experimental/xform/SkShape.cpp",
1770 "experimental/xform/SkXform.cpp",
1771 "experimental/xform/XContext.cpp",
1772 ]
1773 deps = [
1774 ":skia",
1775 ]
1776 }
1777
Mike Klein38af9432016-11-11 11:39:44 -05001778 if (skia_use_lua) {
1779 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001780 sources = [
1781 "src/utils/SkLua.cpp",
1782 "src/utils/SkLuaCanvas.cpp",
1783 ]
1784 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001785 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001786 "//third_party/lua",
1787 ]
1788 }
1789
Mike Kleine6682eb2017-01-05 10:54:57 -05001790 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001791 sources = [
1792 "tools/lua/lua_app.cpp",
1793 ]
1794 deps = [
1795 ":lua",
1796 ":skia",
1797 "//third_party/lua",
1798 ]
Mike Klein38af9432016-11-11 11:39:44 -05001799 }
1800
Mike Kleine6682eb2017-01-05 10:54:57 -05001801 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001802 sources = [
1803 "tools/lua/lua_pictures.cpp",
1804 ]
1805 deps = [
1806 ":flags",
1807 ":lua",
1808 ":skia",
1809 ":tool_utils",
1810 "//third_party/lua",
1811 ]
Mike Klein38af9432016-11-11 11:39:44 -05001812 }
1813 }
1814
Florin Malitabfe876a2018-09-02 12:33:59 -04001815 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001816 test_app("skottie_tool") {
1817 deps = [
1818 "modules/skottie:tool",
1819 ]
1820 }
1821 }
1822
Hal Canary5b39dc82019-04-17 13:29:46 -04001823 test_app("make_skqp_model") {
1824 sources = [
1825 "tools/skqp/make_skqp_model.cpp",
1826 ]
1827 deps = [
1828 ":skia",
1829 ]
1830 }
1831
Kevin Lubickebf648e2017-09-21 13:45:16 -04001832 if (target_cpu != "wasm") {
1833 import("gn/samples.gni")
1834 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001835 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001836 public_deps = [
1837 ":tool_utils",
1838 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001839 deps = [
1840 ":experimental_svg_model",
1841 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001842 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001843 ":xml",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001844 "modules/skparagraph:samples",
Mike Reedec80d902019-02-12 11:31:27 -05001845 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001846 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001847 ]
Mike Klein38af9432016-11-11 11:39:44 -05001848
Kevin Lubickebf648e2017-09-21 13:45:16 -04001849 if (skia_use_lua) {
1850 sources += [ "samplecode/SampleLua.cpp" ]
1851 deps += [
1852 ":lua",
1853 "//third_party/lua",
1854 ]
1855 }
1856 }
Mike Klein7af351a2018-07-27 09:54:43 -04001857 test_app("imgcvt") {
1858 sources = [
1859 "tools/imgcvt.cpp",
1860 ]
1861 deps = [
1862 ":skcms",
1863 ":skia",
1864 ]
1865 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001866 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001867 sources = [
1868 "tools/HashAndEncode.cpp",
1869 "tools/HashAndEncode.h",
1870 ]
1871 deps = [
1872 ":flags",
1873 ":skia",
1874 "//third_party/libpng",
1875 ]
1876 }
1877 test_app("fm") {
1878 sources = [
1879 "tools/fm/fm.cpp",
1880 ]
1881 deps = [
1882 ":common_flags_aa",
1883 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001884 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001885 ":flags",
1886 ":gm",
1887 ":gpu_tool_utils",
1888 ":hash_and_encode",
1889 ":skia",
1890 ":tool_utils",
1891 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001892 "modules/skottie",
1893 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001894 ]
1895 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001896 test_app("dm") {
1897 sources = [
1898 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001899 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001900 "dm/DMJsonWriter.cpp",
1901 "dm/DMSrcSink.cpp",
1902 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001903 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001904 ":common_flags_aa",
1905 ":common_flags_config",
1906 ":common_flags_gpu",
1907 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001908 ":experimental_svg_model",
1909 ":flags",
1910 ":gm",
1911 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001912 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001913 ":skia",
1914 ":tests",
1915 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001916 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001917 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001918 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001919 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001920 ]
1921 }
Brian Osman16adfa32016-10-18 14:42:44 -04001922 }
1923
Mike Kleina8a51ce2018-01-09 12:34:11 -05001924 if (!is_win) {
1925 test_app("remote_demo") {
1926 sources = [
1927 "tools/remote_demo.cpp",
1928 ]
1929 deps = [
1930 ":skia",
1931 ]
1932 }
1933 }
1934
Mike Kleine6682eb2017-01-05 10:54:57 -05001935 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001936 sources = [
1937 "bench/nanobench.cpp",
1938 ]
1939 deps = [
1940 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001941 ":common_flags_aa",
1942 ":common_flags_config",
1943 ":common_flags_gpu",
1944 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001945 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001946 ":flags",
1947 ":gm",
1948 ":gpu_tool_utils",
1949 ":skia",
1950 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001951 ":trace",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001952 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001953 "modules/sksg",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001954 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07001955 ]
mtklein2b6870c2016-07-28 14:17:33 -07001956 }
halcanary19a97202016-08-03 15:08:04 -07001957
Ravi Mistry10d36c52017-01-31 09:49:18 -05001958 test_app("skpinfo") {
1959 sources = [
1960 "tools/skpinfo.cpp",
1961 ]
1962 deps = [
1963 ":flags",
1964 ":skia",
1965 ]
1966 }
1967
Mike Reedc0ee21f2019-05-28 16:11:03 -04001968 if (skia_use_ffmpeg) {
1969 test_app("skottie2movie") {
1970 sources = [
1971 "tools/skottie2movie.cpp",
1972 ]
1973 deps = [
1974 ":flags",
1975 ":skia",
1976 ":video_decoder",
1977 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04001978 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001979 ]
1980 }
1981 }
1982
Brian Osmanc9a42472018-05-31 13:17:12 -04001983 test_app("skpbench") {
1984 sources = [
1985 "tools/skpbench/skpbench.cpp",
1986 ]
1987 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001988 ":common_flags_config",
1989 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001990 ":flags",
1991 ":gpu_tool_utils",
1992 ":skia",
1993 ":tool_utils",
1994 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001995 }
1996
Mike Kleine6682eb2017-01-05 10:54:57 -05001997 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001998 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001999 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07002000 ]
2001 deps = [
2002 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002003 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002004 ]
halcanary3eee9d92016-09-10 07:01:53 -07002005 }
mtklein046cb562016-09-16 10:23:12 -07002006
Ben Wagner219f3622017-07-17 15:32:25 -04002007 test_app("create_test_font") {
2008 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05002009 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04002010 ]
2011 deps = [
2012 ":skia",
2013 ]
2014 assert_no_deps = [
2015 # tool_utils requires the output of this app.
2016 ":tool_utils",
2017 ]
2018 }
2019
Florin Malita5d3ff432018-07-31 16:38:43 -04002020 if (skia_use_expat) {
2021 test_app("create_test_font_color") {
2022 sources = [
2023 "tools/fonts/create_test_font_color.cpp",
2024 ]
2025 deps = [
2026 ":flags",
2027 ":skia",
2028 ":tool_utils",
2029 ]
2030 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002031 }
2032
Mike Kleine6682eb2017-01-05 10:54:57 -05002033 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07002034 sources = [
2035 "tools/get_images_from_skps.cpp",
2036 ]
2037 deps = [
2038 ":flags",
2039 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002040 ]
mtklein046cb562016-09-16 10:23:12 -07002041 }
mtkleinecbc5262016-09-22 11:51:24 -07002042
Brian Osman6788a542018-12-10 11:56:01 -05002043 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002044 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002045 sources = [
2046 "tools/skiaserve/Request.cpp",
2047 "tools/skiaserve/Response.cpp",
2048 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002049 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2050 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2051 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2052 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2053 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2054 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2055 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2056 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2057 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002058 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2059 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002060 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2061 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2062 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2063 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2064 ]
2065 deps = [
2066 ":flags",
2067 ":gpu_tool_utils",
2068 ":skia",
2069 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002070 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002071 ]
Mike Klein7d302882016-11-03 14:06:31 -04002072 }
mtkleinecbc5262016-09-22 11:51:24 -07002073 }
kjlubick14f984b2016-10-03 11:49:45 -07002074
Mike Kleine6682eb2017-01-05 10:54:57 -05002075 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002076 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002077 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002078 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002079 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002080 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002081 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002082 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002083 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002084 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002085 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002086 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002087 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002088 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002089 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002090 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2091 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002092 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002093 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002094 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002095 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002096 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2097 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002098 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2099 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002100 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002101 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002102 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002103 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002104 "tools/debugger/DebugCanvas.cpp",
2105 "tools/debugger/DrawCommand.cpp",
2106 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002107 ]
2108 deps = [
2109 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002110 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002111 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002112 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002113 ]
kjlubick14f984b2016-10-03 11:49:45 -07002114 }
Mike Klein38312422016-10-05 15:41:01 -04002115
Mike Kleine6682eb2017-01-05 10:54:57 -05002116 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002117 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002118 rebase_path("tests/skia_test.cpp"),
2119 rebase_path("tests/Test.cpp"),
2120 ]
caryclark9feb6322016-10-25 08:58:26 -07002121 deps = [
2122 ":flags",
2123 ":gpu_tool_utils",
2124 ":skia",
2125 ":tool_utils",
2126 ]
caryclark9feb6322016-10-25 08:58:26 -07002127 }
2128
Mike Kleine6682eb2017-01-05 10:54:57 -05002129 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002130 sources = [
2131 "tools/DumpRecord.cpp",
2132 "tools/dump_record.cpp",
2133 ]
2134 deps = [
2135 ":flags",
2136 ":skia",
2137 ]
Mike Klein38312422016-10-05 15:41:01 -04002138 }
bungemanfe917272016-10-13 17:36:40 -04002139
Mike Kleine6682eb2017-01-05 10:54:57 -05002140 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002141 sources = [
2142 "tools/skdiff/skdiff.cpp",
2143 "tools/skdiff/skdiff_html.cpp",
2144 "tools/skdiff/skdiff_main.cpp",
2145 "tools/skdiff/skdiff_utils.cpp",
2146 ]
2147 deps = [
2148 ":skia",
2149 ":tool_utils",
2150 ]
bungemanfe917272016-10-13 17:36:40 -04002151 }
halcanarya73d76a2016-10-17 13:19:02 -07002152
Mike Kleine6682eb2017-01-05 10:54:57 -05002153 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002154 sources = [
2155 "tools/skp_parser.cpp",
2156 ]
2157 deps = [
2158 ":skia",
2159 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002160 ]
halcanarya73d76a2016-10-17 13:19:02 -07002161 }
Brian Osman16adfa32016-10-18 14:42:44 -04002162
Brian Osmanc9a42472018-05-31 13:17:12 -04002163 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002164 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002165 defines =
2166 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002167 sources = [
2168 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002169 "tools/skqp/src/skqp.cpp",
2170 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002171 ]
2172 deps = [
2173 ":gm",
2174 ":gpu_tool_utils",
2175 ":skia",
2176 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002177 ":tool_utils",
2178 ]
2179 }
2180 test_app("skqp") {
2181 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002182 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002183 ]
2184 deps = [
2185 ":skia",
2186 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002187 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002188 ]
2189 }
2190 test_app("jitter_gms") {
2191 sources = [
2192 "tools/skqp/jitter_gms.cpp",
2193 ]
2194 deps = [
2195 ":gm",
2196 ":skia",
2197 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002198 ]
2199 }
2200 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002201 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002202 test_app("skqp_app") {
2203 is_shared_library = true
2204 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002205 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002206 ]
2207 deps = [
2208 ":skia",
2209 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002210 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002211 ]
2212 libs = [ "android" ]
2213 }
2214 }
Stan Iliev93151722018-08-02 11:10:52 -04002215 if (is_android && skia_enable_gpu) {
2216 test_app("skottie_android") {
2217 is_shared_library = true
2218
2219 sources = [
2220 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2221 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2222 ]
2223 libs = []
2224
Stan Iliev93151722018-08-02 11:10:52 -04002225 deps = [
2226 ":skia",
2227 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002228 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002229 ]
2230 }
2231 }
Hal Canary75427132017-10-11 16:00:31 -04002232
Hal Canarya9de7602018-01-19 13:08:23 -05002233 test_app("list_gms") {
2234 sources = [
2235 "tools/list_gms.cpp",
2236 ]
2237 deps = [
2238 ":gm",
2239 ":skia",
2240 ]
2241 }
2242 test_app("list_gpu_unit_tests") {
2243 sources = [
2244 "dm/DMGpuTestProcs.cpp",
2245 "tools/list_gpu_unit_tests.cpp",
2246 ]
2247 deps = [
2248 ":skia",
2249 ":tests",
2250 ]
2251 }
2252
Brian Osmanc9a42472018-05-31 13:17:12 -04002253 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002254 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002255 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002256 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002257 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002258 sources = [
2259 "tools/sk_app/CommandSet.cpp",
2260 "tools/sk_app/GLWindowContext.cpp",
2261 "tools/sk_app/Window.cpp",
2262 ]
2263 libs = []
2264
2265 if (is_android) {
2266 sources += [
2267 "tools/sk_app/android/GLWindowContext_android.cpp",
2268 "tools/sk_app/android/RasterWindowContext_android.cpp",
2269 "tools/sk_app/android/Window_android.cpp",
2270 "tools/sk_app/android/main_android.cpp",
2271 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002272 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002273 libs += [ "android" ]
2274 } else if (is_linux) {
2275 sources += [
2276 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2277 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2278 "tools/sk_app/unix/Window_unix.cpp",
2279 "tools/sk_app/unix/keysym2ucs.c",
2280 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002281 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002282 libs += [
2283 "GL",
2284 "X11",
2285 ]
2286 } else if (is_win) {
2287 sources += [
2288 "tools/sk_app/win/GLWindowContext_win.cpp",
2289 "tools/sk_app/win/RasterWindowContext_win.cpp",
2290 "tools/sk_app/win/Window_win.cpp",
2291 "tools/sk_app/win/main_win.cpp",
2292 ]
Brian Salomon194db172017-08-17 14:37:06 -04002293 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002294 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002295 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002296 } else if (is_mac) {
2297 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002298 "tools/sk_app/mac/GLWindowContext_mac.mm",
2299 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2300 "tools/sk_app/mac/Window_mac.mm",
2301 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002302 ]
2303 libs += [
2304 "QuartzCore.framework",
2305 "Cocoa.framework",
2306 "Foundation.framework",
2307 ]
2308 } else if (is_ios) {
2309 sources += [
2310 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2311 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2312 "tools/sk_app/ios/Window_ios.cpp",
2313 "tools/sk_app/ios/main_ios.cpp",
2314 ]
2315 }
2316
2317 if (skia_use_vulkan) {
2318 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2319 if (is_android) {
2320 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2321 } else if (is_linux) {
2322 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2323 libs += [ "X11-xcb" ]
2324 } else if (is_win) {
2325 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002326 } else if (is_mac) {
2327 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2328 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002329 }
2330 }
2331
Jim Van Verthbe39f712019-02-08 15:36:14 -05002332 if (skia_use_metal) {
2333 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2334 if (is_mac) {
2335 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2336 }
2337 libs += [ "MetalKit.framework" ]
2338 }
2339
Brian Osmanc9a42472018-05-31 13:17:12 -04002340 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002341 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002342 ]
2343 if (is_android) {
2344 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002345 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002346 deps += [ "//third_party/libsdl" ]
2347 }
2348 if (skia_use_angle) {
2349 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002350 }
Brian Osman16adfa32016-10-18 14:42:44 -04002351 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002352
Hal Canary87515122019-03-15 14:22:51 -04002353 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2354 test_app("fiddle_examples") {
2355 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002356 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002357 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002358 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002359 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002360 if (is_win) {
2361 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2362 }
Hal Canary87515122019-03-15 14:22:51 -04002363 deps = [
2364 ":skia",
2365 ":skia.h",
2366 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002367 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002368 ]
2369 }
2370 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002371 test_app("viewer") {
2372 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002373 sources = [
2374 "tools/viewer/BisectSlide.cpp",
2375 "tools/viewer/GMSlide.cpp",
2376 "tools/viewer/ImGuiLayer.cpp",
2377 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002378 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002379 "tools/viewer/SKPSlide.cpp",
2380 "tools/viewer/SampleSlide.cpp",
2381 "tools/viewer/SkottieSlide.cpp",
2382 "tools/viewer/SlideDir.cpp",
2383 "tools/viewer/StatsLayer.cpp",
2384 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002385 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002386 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002387 "tools/viewer/Viewer.cpp",
2388 ]
2389 libs = []
2390
Brian Osmanc9a42472018-05-31 13:17:12 -04002391 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002392 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002393 ":experimental_svg_model",
2394 ":flags",
2395 ":gm",
2396 ":gpu_tool_utils",
2397 ":samples",
2398 ":sk_app",
2399 ":skia",
2400 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002401 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002402 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002403 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002404 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002405 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002406 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002407 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002408 ]
Mike Reedd62d4062019-06-12 10:20:44 -04002409 if (skia_use_experimental_xform) {
2410 deps += [ ":experimental_xform" ]
2411 sources += [ "gm/xform.cpp" ]
2412 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002413 }
2414
Brian Osmanc9a42472018-05-31 13:17:12 -04002415 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002416 test_app("HelloWorld") {
2417 sources = [
2418 "example/HelloWorld.cpp",
2419 ]
2420 libs = []
2421
Brian Osmaneff04b52017-11-21 13:18:02 -05002422 deps = [
2423 ":flags",
2424 ":gpu_tool_utils",
2425 ":sk_app",
2426 ":skia",
2427 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002428 ]
2429 }
2430 }
2431
Brian Osmanc9a42472018-05-31 13:17:12 -04002432 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002433 test_app("SkiaSDLExample") {
2434 sources = [
2435 "example/SkiaSDLExample.cpp",
2436 ]
2437 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002438 deps = [
2439 ":gpu_tool_utils",
2440 ":skia",
2441 "//third_party/libsdl",
2442 ]
2443 }
2444 }
2445
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002446 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2447 action_foreach("generate_mocs") {
2448 script = "gn/call.py"
2449 sources = [
2450 "tools/mdbviz/MainWindow.h",
2451 ]
2452 outputs = [
2453 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2454 ]
2455 args = [
2456 "$skia_qt_path" + "/bin/moc",
2457 "{{source}}",
2458 "-o",
2459 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2460 ]
2461 }
2462 action_foreach("generate_resources") {
2463 script = "gn/call.py"
2464 sources = [
2465 "tools/mdbviz/resources.qrc",
2466 ]
2467 outputs = [
2468 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2469 ]
2470 args = [
2471 "$skia_qt_path" + "/bin/rcc",
2472 "{{source}}",
2473 "-o",
2474 "gen/mdbviz/{{source_name_part}}_res.cpp",
2475 ]
2476 }
2477 test_app("mdbviz") {
2478 if (is_win) {
2479 # on Windows we need to disable some exception handling warnings due to the Qt headers
2480 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2481 }
2482 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002483 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002484 "tools/debugger/DebugCanvas.cpp",
2485 "tools/debugger/DrawCommand.cpp",
2486 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002487 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002488 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002489 "tools/mdbviz/main.cpp",
2490
2491 # generated files
2492 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2493 "$target_gen_dir/mdbviz/resources_res.cpp",
2494 ]
2495 lib_dirs = [ "$skia_qt_path/lib" ]
2496 libs = [
2497 "Qt5Core.lib",
2498 "Qt5Gui.lib",
2499 "Qt5Widgets.lib",
2500 ]
2501 include_dirs = [
2502 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002503 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002504 "$skia_qt_path/include/QtWidgets",
2505 ]
2506 deps = [
2507 ":generate_mocs",
2508 ":generate_resources",
2509 ":skia",
2510 ]
2511 }
2512 }
2513
Mike Kleine459afd2017-03-03 09:21:30 -05002514 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002515 copy("gdbserver") {
2516 sources = [
2517 "$ndk/$ndk_gdbserver",
2518 ]
2519 outputs = [
2520 "$root_out_dir/gdbserver",
2521 ]
2522 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002523 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002524
2525 if (skia_use_opencl) {
2526 test_app("hello-opencl") {
2527 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002528 "tools/hello-opencl.cpp",
2529 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002530 deps = [
2531 "//third_party/opencl",
2532 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002533 }
2534 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002535
2536 test_app("editor") {
2537 is_shared_library = is_android
2538 sources = [
Hal Canary50d650d2019-04-28 14:40:45 -04002539 "experimental/editor/editor.cpp",
2540 "experimental/editor/editor.h",
Hal Canary05694472019-05-03 17:14:21 -04002541 "experimental/editor/editor_application.cpp",
Hal Canary7b300a42019-04-30 12:38:28 -04002542 "experimental/editor/run_handler.cpp",
2543 "experimental/editor/run_handler.h",
Hal Canary05694472019-05-03 17:14:21 -04002544 "experimental/editor/stringslice.cpp",
2545 "experimental/editor/stringslice.h",
Hal Canaryb8f81af2019-04-24 13:56:16 -04002546 ]
2547 deps = [
2548 ":sk_app",
2549 ":skia",
2550 "modules/skshaper",
2551 ]
2552 }
mtklein25c81d42016-07-27 13:55:26 -07002553}