blob: 8e2ec150db09db0ad51c8a68897d7ec80a9c0bbd [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
Stephen White0d70b712019-07-10 15:51:30 -040039 skia_use_dawn = false
Mike Klein36f182f2017-10-20 12:33:53 -040040 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070041 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050042 skia_use_xps = true
Stephen White0d70b712019-07-10 15:51:30 -040043}
mtklein1bd72ba2016-09-16 07:45:52 -070044
Stephen White0d70b712019-07-10 15:51:30 -040045declare_args() {
Mike Klein7d921032017-01-05 12:20:41 -050046 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040047 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000048 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050049 skia_enable_discrete_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050050 skia_enable_pdf = true
Stephen White0d70b712019-07-10 15:51:30 -040051 skia_enable_spirv_validation = is_skia_dev_build && is_debug && !skia_use_dawn
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040052 skia_enable_skpicture = true
Brian Osman489cf882019-07-09 10:48:28 -040053 skia_enable_sksl_interpreter = is_skia_dev_build
Mike Kleinba41df72019-06-27 18:13:15 -040054 skia_enable_skvm_jit = is_skia_dev_build && target_cpu == "x64" && is_linux
Mike Klein3669a822017-03-03 10:55:02 -050055 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040056 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040057 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070058 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070059 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040060
Hal Canary2331c822018-02-01 14:06:13 -050061 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040062
63 skia_llvm_path = ""
64 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040065
66 skia_tools_require_resources = false
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -040067 skia_include_multiframe_procs = false
mtkleinc04ff472016-06-23 10:29:30 -070068}
Stephen White0d70b712019-07-10 15:51:30 -040069
70if (skia_use_dawn) {
71 import("third_party/externals/dawn/scripts/dawn_features.gni")
72}
73
Brian Salomon23d73ea2016-10-27 13:31:37 -040074declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040075 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040076 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050077 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050078 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050079 skia_enable_fontmgr_custom =
80 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050081 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
82 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080083 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050084 skia_enable_fontmgr_win = is_win
85 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040086
Kevin Lubick27ba7032019-03-21 08:13:54 -040087 if (is_mac) {
88 skia_gl_standard = "gl"
89 } else if (is_ios) {
90 skia_gl_standard = "gles"
91 } else {
92 skia_gl_standard = ""
93 }
94
Mike Klein4d598a32016-10-31 13:44:49 -040095 if (is_android) {
96 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070097 } else if (is_fuchsia) {
98 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040099 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -0500100 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -0400101 }
Jim Van Verth4e502972017-12-07 15:16:10 -0500102
103 if (is_ios) {
104 skia_ios_identity = ".*Google.*"
105 skia_ios_profile = "Google Development"
106 }
Brian Salomon23d73ea2016-10-27 13:31:37 -0400107}
Brian Salomon789e25e2016-09-30 13:41:03 -0400108
Adam Barth54ef74a2017-10-13 10:59:38 -0700109if (defined(skia_settings)) {
110 import(skia_settings)
111}
112
mtkleinc04ff472016-06-23 10:29:30 -0700113# Skia public API, generally provided by :skia.
114config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -0500115 include_dirs = [ "." ]
116
Mike Kleinae7e6712016-10-11 17:49:33 -0400117 defines = []
118 if (is_component_build) {
119 defines += [ "SKIA_DLL" ]
120 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400121 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -0500122 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -0700123 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400124 if (skia_enable_flutter_defines) {
125 defines += flutter_defines
126 }
mtklein06c35c02016-09-20 12:28:12 -0700127 if (!skia_enable_gpu) {
128 defines += [ "SK_SUPPORT_GPU=0" ]
129 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500130 if (skia_enable_atlas_text) {
131 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
132 }
Mike Reed025f7832018-11-12 09:27:05 -0500133 if (is_fuchsia) {
134 defines += fuchsia_defines
135 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400136 if (skia_gl_standard == "gles") {
137 defines += [ "SK_ASSUME_GL_ES=1" ]
138 } else if (skia_gl_standard == "gl") {
139 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400140 } else if (skia_gl_standard == "webgl") {
141 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400142 }
mtkleinc04ff472016-06-23 10:29:30 -0700143}
144
145# Skia internal APIs, used by Skia itself and a few test tools.
146config("skia_private") {
147 visibility = [ ":*" ]
148
Mike Reeda9e241d2017-05-03 10:52:00 -0400149 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500150 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700151 defines += [
152 "SK_GAMMA_EXPONENT=1.4",
153 "SK_GAMMA_CONTRAST=0.0",
154 ]
155 }
Mike Kleinb45d8622019-04-24 14:04:01 -0500156 if (is_skia_dev_build) {
157 defines += [
158 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
159 "GR_TEST_UTILS=1",
160 ]
mtklein88a7ac02016-09-14 11:16:49 -0700161 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400162 libs = []
163 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -0500164 if (skia_use_angle) {
165 defines += [ "SK_ANGLE" ]
166 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400167 if (skia_llvm_path != "") {
168 defines += [ "SK_LLVM_AVAILABLE" ]
169 include_dirs += [ "$skia_llvm_path/include" ]
170 libs += [ skia_llvm_lib ]
171 lib_dirs += [ "$skia_llvm_path/lib/" ]
172 }
mtkleinc04ff472016-06-23 10:29:30 -0700173}
174
175# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
176config("skia_library") {
177 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000178 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700179}
180
181skia_library_configs = [
182 ":skia_public",
183 ":skia_private",
184 ":skia_library",
185]
186
mtklein9b8583d2016-08-24 17:32:30 -0700187# Use for CPU-specific Skia code that needs particular compiler flags.
188template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500189 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700190 if (invoker.enabled) {
191 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500192 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700193 forward_variables_from(invoker, "*")
194 configs += skia_library_configs
195 }
196 } else {
197 # If not enabled, a phony empty target that swallows all otherwise unused variables.
198 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500199 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700200 forward_variables_from(invoker,
201 "*",
202 [
203 "sources",
204 "cflags",
205 ])
206 }
207 }
anmittala7eaf2e2016-08-17 13:57:26 -0700208}
209
mtklein422310d2016-08-16 18:28:43 -0700210is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700211
mtklein7d6fb2c2016-08-25 14:50:44 -0700212opts("none") {
213 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700215 cflags = []
216}
217
mtklein7d6fb2c2016-08-25 14:50:44 -0700218opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700219 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700221 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700222}
223
224opts("arm64") {
225 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700226 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700227 cflags = []
228}
229
230opts("crc32") {
231 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700232 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700233 cflags = [ "-march=armv8-a+crc" ]
234}
235
mtklein9b8583d2016-08-24 17:32:30 -0700236opts("sse2") {
237 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.sse2_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_SSE2" ]
241 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400242 cflags = [ "-msse2" ]
243 }
mtklein9b8583d2016-08-24 17:32:30 -0700244}
mtkleinc04ff472016-06-23 10:29:30 -0700245
mtklein9b8583d2016-08-24 17:32:30 -0700246opts("ssse3") {
247 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700248 sources = skia_opts.ssse3_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_SSSE3" ]
251 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400252 cflags = [ "-mssse3" ]
253 }
mtklein9b8583d2016-08-24 17:32:30 -0700254}
mtkleinc04ff472016-06-23 10:29:30 -0700255
mtklein9b8583d2016-08-24 17:32:30 -0700256opts("sse41") {
257 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.sse41_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_SSE41" ]
261 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400262 cflags = [ "-msse4.1" ]
263 }
mtklein9b8583d2016-08-24 17:32:30 -0700264}
mtklein4e976072016-08-08 09:06:27 -0700265
mtklein9b8583d2016-08-24 17:32:30 -0700266opts("sse42") {
267 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700268 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400269 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400270 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
271 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400272 cflags = [ "-msse4.2" ]
273 }
mtklein9b8583d2016-08-24 17:32:30 -0700274}
275
276opts("avx") {
277 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700278 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400279 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000280 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400281 } else {
282 cflags = [ "-mavx" ]
283 }
mtkleinc04ff472016-06-23 10:29:30 -0700284}
285
Mike Klein1b9b7d52018-02-27 10:37:40 -0500286opts("hsw") {
287 enabled = is_x86
288 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400289 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500290 cflags = [ "/arch:AVX2" ]
291 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000292 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500293 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500294}
295
mtkleinc095df52016-08-24 12:23:52 -0700296# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700297template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500298 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700299 if (invoker.enabled) {
300 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700301 if (defined(invoker.public_defines)) {
302 defines = invoker.public_defines
303 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600304 if (defined(invoker.public_configs)) {
305 configs = invoker.public_configs
306 }
mtklein457b42a2016-08-23 13:56:37 -0700307 }
308 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500309 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700310 forward_variables_from(invoker,
311 "*",
312 [
313 "public_defines",
314 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700315 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700316 ])
mtklein457b42a2016-08-23 13:56:37 -0700317 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700318 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700319 if (defined(invoker.configs_to_remove)) {
320 configs -= invoker.configs_to_remove
321 }
mtklein457b42a2016-08-23 13:56:37 -0700322 }
323 } else {
mtklein457b42a2016-08-23 13:56:37 -0700324 source_set(target_name) {
325 forward_variables_from(invoker,
326 "*",
327 [
328 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400329 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700330 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700331 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700332 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700333 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700334 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700335 ])
mtkleincd01b032016-08-31 04:58:19 -0700336 if (defined(invoker.sources_when_disabled)) {
337 sources = invoker.sources_when_disabled
338 }
339 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700340 }
mtkleineb3c4252016-08-23 07:38:09 -0700341 }
mtklein457b42a2016-08-23 13:56:37 -0700342}
mtklein457b42a2016-08-23 13:56:37 -0700343
mtkleina45be612016-08-29 15:22:10 -0700344optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500345 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700346
347 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500348 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700349 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700350 ]
351 sources = [
352 "src/ports/SkFontMgr_android.cpp",
353 "src/ports/SkFontMgr_android_factory.cpp",
354 "src/ports/SkFontMgr_android_parser.cpp",
355 ]
356}
357
mtkleind2e39db2016-09-07 07:52:55 -0700358optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500359 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700360
361 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500362 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700363 ]
364 sources = [
365 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500366 "src/ports/SkFontMgr_custom.h",
367 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700368 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500369 "src/ports/SkFontMgr_custom_embedded.cpp",
370 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700371 ]
372}
373
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500374optional("fontmgr_custom_empty") {
375 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500376
377 deps = [
378 ":typeface_freetype",
379 ]
380 sources = [
381 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500382 "src/ports/SkFontMgr_custom_empty.cpp",
383 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800384 ]
385}
386
Hal Canaryff2742e2018-01-30 11:35:47 -0500387optional("fontmgr_empty") {
388 enabled = skia_enable_fontmgr_empty
389 sources = [
390 "src/ports/SkFontMgr_empty_factory.cpp",
391 ]
392}
393
mtklein3cc22182016-08-29 13:26:14 -0700394optional("fontmgr_fontconfig") {
395 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700396
397 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500398 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700399 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700400 ]
401 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700402 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700403 "src/ports/SkFontConfigInterface_direct.cpp",
404 "src/ports/SkFontConfigInterface_direct_factory.cpp",
405 "src/ports/SkFontMgr_FontConfigInterface.cpp",
406 "src/ports/SkFontMgr_fontconfig.cpp",
407 "src/ports/SkFontMgr_fontconfig_factory.cpp",
408 ]
409}
410
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500411optional("fontmgr_fuchsia") {
412 enabled = skia_enable_fontmgr_fuchsia
413
Chinmay Garde89820762019-05-06 16:44:06 -0700414 deps = []
415
416 if (is_fuchsia && using_fuchsia_sdk) {
417 deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
418 } else {
419 deps += [ "//sdk/fidl/fuchsia.fonts" ]
420 }
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500421 sources = [
422 "src/ports/SkFontMgr_fuchsia.cpp",
423 "src/ports/SkFontMgr_fuchsia.h",
424 ]
425}
426
427optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400428 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700429
430 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500431 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700432 ]
433 sources = [
434 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500435 "src/ports/SkFontMgr_custom.h",
436 "src/ports/SkFontMgr_custom_embedded.cpp",
437 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700438 ]
439}
440
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500441optional("fontmgr_win") {
442 enabled = skia_enable_fontmgr_win
443
444 sources = [
445 "src/fonts/SkFontMgr_indirect.cpp",
446 "src/ports/SkFontMgr_win_dw.cpp",
447 "src/ports/SkFontMgr_win_dw_factory.cpp",
448 "src/ports/SkScalerContext_win_dw.cpp",
449 "src/ports/SkTypeface_win_dw.cpp",
450 ]
451}
452
453optional("fontmgr_win_gdi") {
454 enabled = skia_enable_fontmgr_win_gdi
455
456 sources = [
457 "src/ports/SkFontHost_win.cpp",
458 ]
459 libs = [ "Gdi32.lib" ]
460}
461
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700462if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400463 executable("sksllex") {
464 sources = [
465 "src/sksl/lex/Main.cpp",
466 "src/sksl/lex/NFA.cpp",
467 "src/sksl/lex/RegexNode.cpp",
468 "src/sksl/lex/RegexParser.cpp",
469 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500470 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400471 }
472
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700473 action("run_sksllex") {
474 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400475 deps = [
476 ":sksllex(//gn/toolchain:$host_toolchain)",
477 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700478 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700479 "src/sksl/lex/sksl.lex",
480 ]
481
482 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
483 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
484 outputs = [
485 "$target_out_dir/" +
486 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
487 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
488 # confused due to the same file being named by two different paths
489 ]
490 sksllex_path = "$root_out_dir/"
491 sksllex_path += "sksllex"
492 if (host_os == "win") {
493 sksllex_path += ".exe"
494 }
495 args = [
496 rebase_path(sksllex_path),
497 rebase_path("bin/clang-format"),
498 rebase_path("src"),
499 ]
500 }
501} else {
502 group("run_sksllex") {
503 }
504}
505
506if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400507 executable("skslc") {
508 defines = [ "SKSL_STANDALONE" ]
509 sources = [
510 "src/sksl/SkSLMain.cpp",
511 ]
512 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400513 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500514 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400515 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500516 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400517 "//third_party/spirv-tools",
518 ]
519 }
520
521 skia_gpu_processor_outputs = []
522 foreach(src, skia_gpu_processor_sources) {
523 dir = get_path_info(src, "dir")
524 name = get_path_info(src, "name")
525
526 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
527 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
528 skia_gpu_processor_outputs += [
529 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
530 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
531 # confused due to the same file being named by two different paths
532 ]
533 }
534
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500535 action("create_sksl_enums") {
536 script = "gn/create_sksl_enums.py"
537 sources = [
538 "include/private/GrSharedEnums.h",
539 ]
540 outputs = [
541 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500542 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500543 ]
544 args = [
545 rebase_path(sources[0]),
546 rebase_path(outputs[0]),
547 ]
548 }
549
Ethan Nicholas762466e2017-06-29 10:03:38 -0400550 action("compile_processors") {
551 script = "gn/compile_processors.py"
552 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500553 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400554 ":skslc(//gn/toolchain:$host_toolchain)",
555 ]
556 sources = skia_gpu_processor_sources
557 outputs = skia_gpu_processor_outputs
558 skslc_path = "$root_out_dir/"
559 if (host_toolchain != default_toolchain_name) {
560 skslc_path += "$host_toolchain/"
561 }
562 skslc_path += "skslc"
563 if (host_os == "win") {
564 skslc_path += ".exe"
565 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400566 args = [
567 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400568 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400569 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400570 args += rebase_path(skia_gpu_processor_sources)
571 }
572} else {
573 skia_gpu_processor_outputs = []
574 group("compile_processors") {
575 }
576}
577
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500578optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700579 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400580 deps = [
581 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700582 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400583 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700584 if (skia_generate_workarounds) {
585 deps += [ ":workaround_list" ]
586 }
Robert Phillipsefb9f142019-05-17 14:19:44 -0400587 public_defines = [ "SK_GL" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600588 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400589 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700590
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400591 sources =
592 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400593 if (!skia_enable_ccpr) {
594 sources -= skia_ccpr_sources
595 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
596 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400597 if (!skia_enable_nvpr) {
598 sources -= skia_nvpr_sources
599 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
600 }
mtklein06c35c02016-09-20 12:28:12 -0700601
602 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500603 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700604 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400605 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700606 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400607 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400608
609 # this lib is required to link against AHardwareBuffer
610 if (defined(ndk_api) && ndk_api >= 26) {
611 libs += [ "android" ]
612 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400613 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500614 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400615 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700616 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500617 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400618 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700619 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500620 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800621 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500622 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400623 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500624 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500625 if (target_cpu != "arm64") {
626 libs += [ "OpenGL32.lib" ]
627 }
mtklein06c35c02016-09-20 12:28:12 -0700628 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500629 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700630 }
mtkleine9fb3d52016-09-20 15:11:46 -0700631
632 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400633 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400634 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700635 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700636 if (skia_enable_vulkan_debug_layers) {
637 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
638 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800639 if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -0700640 if (using_fuchsia_sdk) {
641 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
642 } else {
Brian Osman489cf882019-07-09 10:48:28 -0400643 public_deps += [ "//src/graphics/lib/vulkan" ]
Chinmay Garde89820762019-05-06 16:44:06 -0700644 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800645 }
mtkleine9fb3d52016-09-20 15:11:46 -0700646 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400647
Stephen White0d70b712019-07-10 15:51:30 -0400648 if (skia_use_dawn) {
649 public_defines += [ "SK_DAWN" ]
650 public_deps += [
651 "//third_party/dawn:dawn_headers",
652 "//third_party/dawn:libdawn",
653 "//third_party/dawn:libdawn_native_sources",
654 ]
655 if (dawn_enable_d3d12) {
656 libs += [
657 "d3d12.lib",
658 "dxgi.lib",
659 "d3dcompiler.lib",
660 ]
661 } else if (dawn_enable_metal) {
662 libs += [ "Metal.framework" ]
663 }
664 }
665
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400666 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400667 if (skia_use_metal) {
668 public_defines += [ "SK_METAL" ]
669 sources += skia_metal_sources
670 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400671 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400672 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400673 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500674
675 if (skia_enable_atlas_text) {
676 sources += skia_atlas_text_sources
677 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400678
679 if (is_debug) {
680 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
681 }
mtklein06c35c02016-09-20 12:28:12 -0700682}
683
Leon Scroggins III41169202019-01-29 09:29:57 -0500684optional("gif") {
685 enabled = !skia_use_wuffs
686 sources = [
687 "src/codec/SkGifCodec.cpp",
688 "third_party/gif/SkGifImageReader.cpp",
689 ]
690}
691
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400692optional("heif") {
693 enabled = skia_use_libheif
694 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
695
696 deps = []
697
698 sources = [
699 "src/codec/SkHeifCodec.cpp",
700 ]
701}
702
mtklein63213812016-08-24 09:55:56 -0700703optional("jpeg") {
704 enabled = skia_use_libjpeg_turbo
705 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
706
mtklein63213812016-08-24 09:55:56 -0700707 deps = [
708 "//third_party/libjpeg-turbo:libjpeg",
709 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400710 public = [
711 "include/encode/SkJpegEncoder.h",
712 ]
mtklein63213812016-08-24 09:55:56 -0700713 sources = [
714 "src/codec/SkJpegCodec.cpp",
715 "src/codec/SkJpegDecoderMgr.cpp",
716 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700717 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400718 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700719 ]
720}
721
722optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500723 enabled = skia_use_zlib && skia_enable_pdf
724 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700725
mtklein63213812016-08-24 09:55:56 -0700726 deps = [
727 "//third_party/zlib",
728 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400729 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700730 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400731 }
brettwb9447282016-09-01 14:24:39 -0700732 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700733 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500734 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
735 deps += [ "//third_party/harfbuzz" ]
736 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
737 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700738 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500739 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700740 }
741}
742
743optional("png") {
744 enabled = skia_use_libpng
745 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
746
mtklein63213812016-08-24 09:55:56 -0700747 deps = [
748 "//third_party/libpng",
749 ]
750 sources = [
751 "src/codec/SkIcoCodec.cpp",
752 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400753 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700754 ]
755}
756
scroggof84ad642016-10-31 09:02:57 -0700757optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400758 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700759 public_defines = [ "SK_CODEC_DECODES_RAW" ]
760
761 deps = [
762 "//third_party/dng_sdk",
763 "//third_party/libjpeg-turbo:libjpeg",
764 "//third_party/piex",
765 ]
766
767 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
768 # Skia.
769 configs_to_remove = [ "//gn:no_exceptions" ]
770
771 sources = [
scroggof84ad642016-10-31 09:02:57 -0700772 "src/codec/SkRawCodec.cpp",
773 ]
774}
775
Mike Klein852a8cb2018-05-15 10:46:58 -0400776import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400777source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400778 cflags = []
779 if (!is_win || is_clang) {
780 cflags += [
781 "-w",
782 "-std=c11",
783 ]
784 }
785
786 public = [
Brian Osmanea236bf2019-04-29 10:28:22 -0400787 "include/third_party/skcms/skcms.h",
Mike Klein852a8cb2018-05-15 10:46:58 -0400788 ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400789 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400790 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
791}
792
mtklein3cc22182016-08-29 13:26:14 -0700793optional("typeface_freetype") {
794 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700795
796 deps = [
797 "//third_party/freetype2",
798 ]
799 sources = [
800 "src/ports/SkFontHost_FreeType.cpp",
801 "src/ports/SkFontHost_FreeType_common.cpp",
802 ]
803}
804
mtklein457b42a2016-08-23 13:56:37 -0700805optional("webp") {
806 enabled = skia_use_libwebp
807 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
808
mtklein457b42a2016-08-23 13:56:37 -0700809 deps = [
810 "//third_party/libwebp",
811 ]
812 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700813 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400814 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700815 ]
mtkleineb3c4252016-08-23 07:38:09 -0700816}
817
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400818optional("wuffs") {
819 enabled = skia_use_wuffs
820 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
821
822 deps = [
823 "//third_party/wuffs",
824 ]
825 sources = [
826 "src/codec/SkWuffsCodec.cpp",
827 ]
828}
829
mtklein63213812016-08-24 09:55:56 -0700830optional("xml") {
831 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000832 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700833
mtklein63213812016-08-24 09:55:56 -0700834 deps = [
835 "//third_party/expat",
836 ]
837 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500838 "src/svg/SkSVGCanvas.cpp",
839 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700840 "src/xml/SkDOM.cpp",
841 "src/xml/SkXMLParser.cpp",
842 "src/xml/SkXMLWriter.cpp",
843 ]
844}
845
Brian Osman489cf882019-07-09 10:48:28 -0400846optional("sksl_interpreter") {
847 enabled = skia_enable_sksl_interpreter
848 public_defines = [ "SK_ENABLE_SKSL_INTERPRETER" ]
849}
850
Mike Klein613ad382019-06-06 11:42:02 -0500851optional("skvm_jit") {
Mike Klein6bbeb4a2019-06-21 16:34:06 -0500852 enabled = skia_enable_skvm_jit
Mike Klein613ad382019-06-06 11:42:02 -0500853 public_defines = [ "SKVM_JIT" ]
Mike Klein613ad382019-06-06 11:42:02 -0500854}
855
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700856if (skia_enable_gpu && skia_generate_workarounds) {
857 action("workaround_list") {
858 script = "tools/build_workaround_header.py"
859
860 inputs = [
861 "src/gpu/gpu_workaround_list.txt",
862 ]
863
864 # see comments in skia_compile_processors about out dir path shenanigans.
865 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700866 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700867
868 outputs = [
869 "$root_out_dir/$output_file",
870 ]
871 args = [
872 "--output-file",
873 "$output_file",
874 ]
875
876 foreach(file, inputs) {
877 args += [ rebase_path(file, root_build_dir) ]
878 }
879 }
880}
881
mtkleinc04ff472016-06-23 10:29:30 -0700882component("skia") {
883 public_configs = [ ":skia_public" ]
884 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700885
Mike Klein607b0a72018-11-07 16:17:34 -0500886 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500887 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500888 ":pdf",
889 ":skcms",
890 ]
891
mtkleinc04ff472016-06-23 10:29:30 -0700892 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700893 ":arm64",
894 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700895 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000896 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700897 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700898 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700899 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500900 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500901 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700902 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800903 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500904 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500905 ":fontmgr_win",
906 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500907 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400908 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500909 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700910 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700911 ":none",
mtklein63213812016-08-24 09:55:56 -0700912 ":png",
scroggof84ad642016-10-31 09:02:57 -0700913 ":raw",
Brian Osman489cf882019-07-09 10:48:28 -0400914 ":sksl_interpreter",
Mike Klein613ad382019-06-06 11:42:02 -0500915 ":skvm_jit",
mtklein9b8583d2016-08-24 17:32:30 -0700916 ":sse2",
917 ":sse41",
918 ":sse42",
919 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700920 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400921 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700922 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700923 ]
924
Chinmay Garde43f115c2016-11-16 15:04:12 -0800925 # This file (and all GN files in Skia) are designed to work with an
926 # empty sources assignment filter; we handle all that explicitly.
927 # We clear the filter here for clients who may have set up a global filter.
928 set_sources_assignment_filter([])
929
Hal Canaryc25f4e92019-02-26 11:54:25 -0500930 public = skia_core_public
931 public += skia_utils_public
932 public += skia_effects_public
933 public += skia_effects_imagefilter_public
934 public += skia_xps_public
935
mtkleinc04ff472016-06-23 10:29:30 -0700936 sources = []
brettwb9447282016-09-01 14:24:39 -0700937 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700938 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500939 if (skia_use_xps) {
940 sources += skia_xps_sources
941 }
Mike Klein54378232018-11-08 12:08:05 +0000942 sources += skia_effects_sources
943 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400944 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -0700945 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400946 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500947 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700948 "src/android/SkBitmapRegionCodec.cpp",
949 "src/android/SkBitmapRegionDecoder.cpp",
950 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100951 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400952 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700953 "src/codec/SkBmpCodec.cpp",
954 "src/codec/SkBmpMaskCodec.cpp",
955 "src/codec/SkBmpRLECodec.cpp",
956 "src/codec/SkBmpStandardCodec.cpp",
957 "src/codec/SkCodec.cpp",
958 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400959 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400960 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700961 "src/codec/SkMaskSwizzler.cpp",
962 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700963 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700964 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700965 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700966 "src/codec/SkSwizzler.cpp",
967 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700968 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700969 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000970 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700971 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700972 "src/ports/SkMemory_malloc.cpp",
973 "src/ports/SkOSFile_stdio.cpp",
974 "src/sfnt/SkOTTable_name.cpp",
975 "src/sfnt/SkOTUtils.cpp",
976 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700977 ]
brettwb9447282016-09-01 14:24:39 -0700978
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400979 defines = []
980 if (!skia_enable_skpicture) {
981 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500982 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400983 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000984 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400985 sources += [ "src/core/SkPicture_none.cpp" ]
986 }
987
mtklein7d6fb2c2016-08-25 14:50:44 -0700988 libs = []
989
mtkleinc04ff472016-06-23 10:29:30 -0700990 if (is_win) {
991 sources += [
992 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700993 "src/ports/SkImageEncoder_WIC.cpp",
994 "src/ports/SkImageGeneratorWIC.cpp",
995 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700996 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700997 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700998 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400999 libs += [
1000 "FontSub.lib",
1001 "Ole32.lib",
1002 "OleAut32.lib",
1003 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001004 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001005 ]
mtkleinc04ff472016-06-23 10:29:30 -07001006 } else {
1007 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001008 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001009 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001010 "src/ports/SkTLS_pthread.cpp",
1011 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001012 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001013 }
1014
mtklein7d6fb2c2016-08-25 14:50:44 -07001015 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001016 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001017 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001018 deps += [ "//third_party/cpu-features" ]
1019 }
mtklein06c35c02016-09-20 12:28:12 -07001020 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001021 libs += [
1022 "EGL",
1023 "GLESv2",
1024 "log",
1025 ]
1026 }
1027
Kevin Lubick217056c2018-09-20 17:39:31 -04001028 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001029 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001030 if (skia_use_egl) {
1031 libs += [ "GLESv2" ]
1032 }
mtkleinc04ff472016-06-23 10:29:30 -07001033 }
1034
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001035 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001036 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001037 }
1038
mtkleinc04ff472016-06-23 10:29:30 -07001039 if (is_mac) {
1040 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001041 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001042 "src/ports/SkImageEncoder_CG.cpp",
1043 "src/ports/SkImageGeneratorCG.cpp",
1044 ]
mtklein09e61f72016-08-23 13:35:28 -07001045 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001046 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1047 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001048 "ApplicationServices.framework",
1049 "OpenGL.framework",
1050 ]
mtkleinc04ff472016-06-23 10:29:30 -07001051 }
abarth6fc8ff02016-07-15 15:15:15 -07001052
Mike Klein7d302882016-11-03 14:06:31 -04001053 if (is_ios) {
1054 sources += [
1055 "src/ports/SkDebug_stdio.cpp",
1056 "src/ports/SkFontHost_mac.cpp",
1057 "src/ports/SkImageEncoder_CG.cpp",
1058 "src/ports/SkImageGeneratorCG.cpp",
1059 ]
1060 libs += [
1061 "CoreFoundation.framework",
1062 "CoreGraphics.framework",
1063 "CoreText.framework",
1064 "ImageIO.framework",
1065 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001066
1067 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1068 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001069 ]
1070 }
1071
abarth6fc8ff02016-07-15 15:15:15 -07001072 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001073 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001074 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001075
1076 if (skia_enable_spirv_validation) {
1077 deps += [ "//third_party/spirv-tools" ]
1078 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1079 }
Nathaniel Nifong0c4fbf12019-06-25 15:48:47 -04001080
1081 if (skia_include_multiframe_procs) {
1082 sources += [ "tools/SkSharingProc.cpp" ]
1083 }
mtkleinc04ff472016-06-23 10:29:30 -07001084}
1085
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001086# DebugCanvas used in experimental/wasm-skp-debugger
1087if (target_cpu == "wasm") {
1088 static_library("debugcanvas") {
1089 public_configs = [ ":skia_public" ]
1090
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001091 sources = [
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001092 "tools/SkSharingProc.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001093 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001094 "tools/debugger/DebugCanvas.cpp",
1095 "tools/debugger/DrawCommand.cpp",
1096 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001097 ]
1098
1099 deps = [
1100 ":fontmgr_wasm",
1101 ]
1102 }
1103}
1104
Kevin Lubickcbcff382018-10-02 09:02:18 -04001105static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001106 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001107 public_configs = [ ":skia_public" ]
1108 configs += skia_library_configs
1109
1110 deps = [
1111 ":arm64",
1112 ":armv7",
1113 ":avx",
1114 ":crc32",
1115 ":hsw",
1116 ":none",
1117 ":sse2",
1118 ":sse41",
1119 ":sse42",
1120 ":ssse3",
1121 ]
1122
1123 # This file (and all GN files in Skia) are designed to work with an
1124 # empty sources assignment filter; we handle all that explicitly.
1125 # We clear the filter here for clients who may have set up a global filter.
1126 set_sources_assignment_filter([])
1127
1128 sources = []
1129 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001130 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001131 sources += [
1132 "src/core/SkAnalyticEdge.cpp",
1133 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001134 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001135 "src/core/SkCubicMap.cpp",
1136 "src/core/SkEdge.cpp",
1137 "src/core/SkEdgeBuilder.cpp",
1138 "src/core/SkEdgeClipper.cpp",
1139 "src/core/SkGeometry.cpp",
1140 "src/core/SkLineClipper.cpp",
1141 "src/core/SkMallocPixelRef.cpp",
1142 "src/core/SkMath.cpp",
1143 "src/core/SkMatrix.cpp",
1144 "src/core/SkOpts.cpp",
1145 "src/core/SkPaint.cpp",
1146 "src/core/SkPath.cpp",
1147 "src/core/SkPathEffect.cpp",
1148 "src/core/SkPathMeasure.cpp",
1149 "src/core/SkPathRef.cpp",
1150 "src/core/SkPoint.cpp",
1151 "src/core/SkRRect.cpp",
1152 "src/core/SkRect.cpp",
1153 "src/core/SkSemaphore.cpp",
1154 "src/core/SkStream.cpp",
1155 "src/core/SkString.cpp",
1156 "src/core/SkStringUtils.cpp",
1157 "src/core/SkStroke.cpp",
1158 "src/core/SkStrokeRec.cpp",
1159 "src/core/SkStrokerPriv.cpp",
1160 "src/core/SkThreadID.cpp",
1161 "src/core/SkUtils.cpp",
1162 "src/effects/SkDashPathEffect.cpp",
1163 "src/effects/SkTrimPathEffect.cpp",
1164 "src/ports/SkDebug_stdio.cpp",
1165 "src/ports/SkMemory_malloc.cpp",
1166 "src/utils/SkDashPath.cpp",
1167 "src/utils/SkParse.cpp",
1168 "src/utils/SkParsePath.cpp",
1169 "src/utils/SkUTF.cpp",
1170 ]
1171}
1172
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001173group("modules") {
1174 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001175 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001176 "modules/skottie",
1177 "modules/skshaper",
1178 ]
1179}
1180
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001181executable("cpu_modules") {
1182 sources = [
1183 "tools/cpu_modules.cpp",
1184 ]
1185 deps = [
1186 ":skia",
1187 "modules/particles",
1188 ]
1189}
1190
mtkleinc095df52016-08-24 12:23:52 -07001191# Targets guarded by skia_enable_tools may use //third_party freely.
1192if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001193 skia_public_includes = [
1194 "include/android",
1195 "include/atlastext",
1196 "include/c",
1197 "include/codec",
1198 "include/config",
1199 "include/core",
1200 "include/docs",
1201 "include/effects",
1202 "include/encode",
1203 "include/gpu",
1204 "include/pathops",
1205 "include/ports",
1206 "include/svg",
1207 "include/utils",
1208 "include/utils/mac",
1209 "modules/sksg/include",
1210 "modules/skshaper/include",
1211 "modules/skottie/include",
1212 ]
1213
Mike Klein308b5ac2016-12-06 16:03:52 -05001214 # Used by gn_to_bp.py to list our public include dirs.
1215 source_set("public") {
1216 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001217 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001218 }
1219
Mike Kleinc36dedf2016-11-18 09:35:28 -05001220 config("skia.h_config") {
1221 include_dirs = [ "$target_gen_dir" ]
1222 }
1223 action("skia.h") {
1224 public_configs = [ ":skia.h_config" ]
1225 skia_h = "$target_gen_dir/skia.h"
1226 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001227
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001228 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1229 [ rebase_path(skia_h, root_build_dir) ] +
1230 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001231 depfile = "$skia_h.deps"
1232 outputs = [
1233 skia_h,
1234 ]
1235 }
1236
Brian Osmanc9a42472018-05-31 13:17:12 -04001237 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001238 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001239 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001240 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001241 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001242 "tools/fiddle/draw.cpp",
1243 "tools/fiddle/fiddle_main.cpp",
1244 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001245
1246 if (skia_use_egl) {
1247 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001248 } else {
1249 sources += [ "tools/fiddle/null_context.cpp" ]
1250 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001251 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001252 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001253 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001254 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001255 ":skia",
1256 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001257 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001258 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001259 ]
1260 }
1261 }
1262
Mike Klein9e25bb92019-04-29 09:46:36 -05001263 config("our_vulkan_headers") {
1264 # We add this directory to simulate the client already have
1265 # vulkan/vulkan_core.h on their path.
1266 include_dirs = [ "include/third_party/vulkan" ]
1267 }
1268
Brian Osmanc9a42472018-05-31 13:17:12 -04001269 source_set("public_headers_warnings_check") {
1270 sources = [
1271 "tools/public_headers_warnings_check.cpp",
1272 ]
1273 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001274 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001275 deps = [
1276 ":skia",
1277 ":skia.h",
1278 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001279 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001280 ]
Stephen White0d70b712019-07-10 15:51:30 -04001281
1282 if (skia_use_dawn) {
1283 deps += [ "//third_party/dawn:dawn_headers" ]
1284 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001285 }
1286
mtkleinc095df52016-08-24 12:23:52 -07001287 template("test_lib") {
1288 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001289 if (defined(invoker.public_defines)) {
1290 defines = invoker.public_defines
1291 }
mtklein25c81d42016-07-27 13:55:26 -07001292 }
mtkleinc095df52016-08-24 12:23:52 -07001293 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001294 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001295 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001296 public_configs = [
1297 ":" + target_name + "_config",
1298 ":skia_private",
1299 ]
1300
1301 if (!defined(deps)) {
1302 deps = []
1303 }
1304 deps += [ ":skia" ]
1305 testonly = true
1306 }
mtklein25c81d42016-07-27 13:55:26 -07001307 }
mtklein25c81d42016-07-27 13:55:26 -07001308
Mike Kleine6682eb2017-01-05 10:54:57 -05001309 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001310 if (is_ios) {
1311 app_name = target_name
1312 gen_path = target_gen_dir
1313
1314 action("${app_name}_generate_info_plist") {
1315 script = "//gn/gen_plist_ios.py"
1316 outputs = [
1317 "$gen_path/${app_name}_Info.plist",
1318 ]
1319 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1320 }
1321
1322 bundle_data("${app_name}_bundle_info_plist") {
1323 public_deps = [
1324 ":${app_name}_generate_info_plist",
1325 ]
1326 sources = [
1327 "$gen_path/${app_name}_Info.plist",
1328 ]
1329 outputs = [
1330 "{{bundle_root_dir}}/Info.plist",
1331 ]
1332 }
1333
Jim Van Verthffacf652019-04-02 11:59:34 -04001334 has_skps = "True" == exec_script("//gn/checkdir.py",
1335 [ rebase_path("skps", root_build_dir) ],
1336 "trim string")
1337 bundle_data("${app_name}_bundle_resources") {
1338 sources = [
1339 "resources",
1340 ]
1341 outputs = [
1342 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1343 "{{bundle_resources_dir}}/data/resources",
1344 ]
1345 }
1346 if (has_skps) {
1347 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001348 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001349 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001350 ]
1351 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001352 # Store in same folder as resources
1353 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001354 ]
1355 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001356 }
1357
Jim Van Verth443a9132017-11-28 09:45:26 -05001358 executable("${app_name}_generate_executable") {
1359 forward_variables_from(invoker,
1360 "*",
1361 [
1362 "output_name",
1363 "visibility",
1364 "is_shared_library",
1365 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001366 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001367 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001368 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1369 }
1370
1371 bundle_data("${app_name}_bundle_executable") {
1372 public_deps = [
1373 ":${app_name}_generate_executable",
1374 ]
1375 sources = [
1376 "$gen_path/$app_name",
1377 ]
1378 outputs = [
1379 "{{bundle_executable_dir}}/$app_name",
1380 ]
1381 testonly = true
1382 }
1383
Jim Van Verthffacf652019-04-02 11:59:34 -04001384 bundle_data("${app_name}_bundle_symbols") {
1385 public_deps = [
1386 ":${app_name}_generate_executable",
1387 ]
1388 sources = [
1389 "$gen_path/${app_name}.dSYM",
1390 ]
1391 outputs = [
1392 "{{bundle_executable_dir}}/${app_name}.dSYM",
1393 ]
1394 testonly = true
1395 }
1396
Jim Van Verth443a9132017-11-28 09:45:26 -05001397 create_bundle("$app_name") {
1398 product_type = "com.apple.product-type.application"
1399 testonly = true
1400
1401 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1402 bundle_resources_dir = bundle_root_dir
1403 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001404
1405 deps = [
1406 ":${app_name}_bundle_executable",
1407 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001408 ":${app_name}_bundle_resources",
1409 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001410 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001411 if (has_skps) {
1412 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001413 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001414
1415 # should only code sign when running on a device, not the simulator
1416 if (target_cpu != "x64") {
1417 code_signing_script = "//gn/codesign_ios.py"
1418 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1419 code_signing_outputs = [
1420 "$bundle_root_dir/_CodeSignature/CodeResources",
1421 "$bundle_root_dir/embedded.mobileprovision",
1422 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001423 code_signing_args = [
1424 rebase_path("$bundle_root_dir", root_build_dir),
1425 skia_ios_identity,
1426 skia_ios_profile,
1427 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001428 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001429 }
1430 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001431 # !is_ios
1432
1433 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1434 shared_library("lib" + target_name) {
1435 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1436 configs += [ ":skia_private" ]
1437 testonly = true
1438 }
1439 } else {
1440 _executable = target_name
1441 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001442 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001443 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1444 configs += [ ":skia_private" ]
1445 testonly = true
1446 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001447 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001448 if (is_android && skia_android_serial != "" && defined(_executable)) {
1449 action("push_" + target_name) {
1450 script = "gn/push_to_android.py"
1451 deps = [
1452 ":" + _executable,
1453 ]
1454 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1455 outputs = [
1456 _stamp,
1457 ]
1458 args = [
1459 rebase_path("$root_build_dir/$_executable"),
1460 skia_android_serial,
1461 rebase_path(_stamp),
1462 ]
1463 testonly = true
1464 }
Mike Klein7d921032017-01-05 12:20:41 -05001465 }
1466 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001467 }
1468
Greg Danielda16cce2018-08-01 09:23:57 -04001469 config("moltenvk_config") {
1470 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1471 if (is_ios) {
1472 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1473 } else {
1474 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1475 }
1476 cflags = [ "-F$moltenvk_framework_path" ]
1477 ldflags = [ "-F$moltenvk_framework_path" ]
1478 libs = [
1479 "MoltenVK.framework",
1480 "Metal.framework",
1481 "IOSurface.framework",
1482 "QuartzCore.framework",
1483 "Foundation.framework",
1484 ]
1485 if (is_ios) {
1486 libs += [ "UIKit.framework" ]
1487 } else {
1488 libs += [ "IOKit.framework" ]
1489 }
1490 defines = [ "SK_MOLTENVK" ]
1491 }
1492 }
1493
1494 source_set("moltenvk") {
1495 public_configs = [ ":moltenvk_config" ]
1496 }
1497
mtkleinc095df52016-08-24 12:23:52 -07001498 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001499 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001500
Mike Klein9e25bb92019-04-29 09:46:36 -05001501 # Bots and even devs may not have Vulkan headers, so put
1502 # include/third_party/vulkan on our path so they're always available.
1503 all_dependent_configs = [ ":our_vulkan_headers" ]
1504
Mike Klein333fb452019-04-24 08:48:11 -05001505 defines = []
1506 if (skia_enable_discrete_gpu) {
1507 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1508 }
1509
Brian Osmanc9a42472018-05-31 13:17:12 -04001510 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001511 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001512 sources = [
1513 "tools/gpu/GrContextFactory.cpp",
1514 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001515 "tools/gpu/MemoryCache.cpp",
1516 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001517 "tools/gpu/ProxyUtils.cpp",
1518 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001519 "tools/gpu/YUVUtils.cpp",
1520 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001521 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1522 "tools/gpu/gl/GLTestContext.cpp",
1523 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001524 "tools/gpu/mock/MockTestContext.cpp",
1525 ]
1526 libs = []
1527
1528 if (is_android || skia_use_egl) {
1529 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1530 } else if (is_ios) {
1531 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1532 libs += [ "OpenGLES.framework" ]
1533 } else if (is_linux) {
1534 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001535 libs += [
1536 "GLU",
1537 "X11",
1538 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001539 } else if (is_mac) {
1540 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1541 } else if (is_win) {
1542 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001543 libs += [ "Gdi32.lib" ]
1544 if (target_cpu != "arm64") {
1545 libs += [ "OpenGL32.lib" ]
1546 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001547 }
mtklein25c81d42016-07-27 13:55:26 -07001548
Brian Osmanc9a42472018-05-31 13:17:12 -04001549 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001550
Brian Osmanc9a42472018-05-31 13:17:12 -04001551 if (skia_use_angle) {
1552 deps += [ "//third_party/angle2" ]
1553 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1554 }
Greg Daniel54200e42018-12-11 17:03:39 -05001555
Brian Osmanc9a42472018-05-31 13:17:12 -04001556 if (skia_use_vulkan) {
1557 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1558 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001559 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1560 public_deps += [ ":moltenvk" ]
1561 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001562 }
1563 if (skia_use_metal) {
1564 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001565 }
mtklein25c81d42016-07-27 13:55:26 -07001566 }
mtklein25c81d42016-07-27 13:55:26 -07001567
mtkleinc095df52016-08-24 12:23:52 -07001568 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001569 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001570 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001571 ]
1572 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001573
1574 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001575 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001576 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001577 ]
1578 deps = [
mtklein046cb562016-09-16 10:23:12 -07001579 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001580 ]
1581 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001582 ":gpu_tool_utils",
1583 ]
1584 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001585 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001586 sources = [
1587 "tools/flags/CommonFlagsGpu.cpp",
1588 ]
1589 deps = [
1590 ":flags",
1591 ]
1592 public_deps = [
1593 ":gpu_tool_utils",
1594 ]
1595 }
1596 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001597 sources = [
1598 "tools/flags/CommonFlagsImages.cpp",
1599 ]
1600 deps = [
1601 ":flags",
1602 ]
1603 }
1604 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001605 sources = [
1606 "tools/flags/CommonFlagsAA.cpp",
1607 ]
1608 deps = [
1609 ":flags",
1610 ]
1611 }
mtklein25c81d42016-07-27 13:55:26 -07001612
Mike Klein499f0ac2019-03-25 13:00:12 -05001613 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001614 deps = [
1615 ":flags",
1616 ]
1617 sources = [
1618 "tools/trace/ChromeTracingTracer.cpp",
1619 "tools/trace/ChromeTracingTracer.h",
1620 "tools/trace/EventTracingPriv.cpp",
1621 "tools/trace/EventTracingPriv.h",
1622 "tools/trace/SkDebugfTracer.cpp",
1623 "tools/trace/SkDebugfTracer.h",
1624 ]
1625 }
1626
mtkleinc095df52016-08-24 12:23:52 -07001627 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001628 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001629 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001630 "tools/AutoreleasePool.h",
mtkleinc095df52016-08-24 12:23:52 -07001631 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001632 "tools/DDLPromiseImageHelper.cpp",
1633 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001634 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001635 "tools/ProcStats.cpp",
1636 "tools/Resources.cpp",
Nathaniel Nifong0426c382019-06-21 11:09:19 -04001637 "tools/SkSharingProc.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001638 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001639 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001640 "tools/debugger/DebugCanvas.cpp",
1641 "tools/debugger/DrawCommand.cpp",
1642 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001643 "tools/fonts/RandomScalerContext.cpp",
1644 "tools/fonts/TestEmptyTypeface.h",
1645 "tools/fonts/TestFontMgr.cpp",
1646 "tools/fonts/TestFontMgr.h",
1647 "tools/fonts/TestSVGTypeface.cpp",
1648 "tools/fonts/TestSVGTypeface.h",
1649 "tools/fonts/TestTypeface.cpp",
1650 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001651 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001652 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001653 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001654 "tools/timer/Timer.cpp",
1655 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001656 libs = []
1657 if (is_ios) {
1658 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001659 sources += [ "tools/ios_utils.h" ]
1660 if (skia_use_metal) {
1661 sources += [ "tools/AutoreleasePool.mm" ]
1662 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001663 libs += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001664 } else if (is_mac) {
1665 if (skia_use_metal) {
1666 sources += [ "tools/AutoreleasePool.mm" ]
1667 libs += [ "Foundation.framework" ]
1668 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001669 } else if (is_win) {
1670 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001671 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001672
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001673 defines = []
1674 if (skia_tools_require_resources) {
1675 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1676 }
mtkleinc095df52016-08-24 12:23:52 -07001677 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001678 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001679 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001680 ]
1681 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001682 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001683 ]
mtkleinc095df52016-08-24 12:23:52 -07001684 }
mtklein25c81d42016-07-27 13:55:26 -07001685
Mike Kleine11e5c12019-04-24 12:46:06 -05001686 test_lib("etc1") {
1687 sources = [
1688 "third_party/etc1/etc1.cpp",
1689 ]
1690 }
1691
Mike Reed7bf160e2019-05-17 16:50:51 -04001692 if (skia_use_ffmpeg) {
1693 test_lib("video_decoder") {
1694 sources = [
1695 "experimental/ffmpeg/SkVideoDecoder.cpp",
1696 "experimental/ffmpeg/SkVideoDecoder.h",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001697 "experimental/ffmpeg/SkVideoEncoder.cpp",
1698 "experimental/ffmpeg/SkVideoEncoder.h",
Mike Reed7bf160e2019-05-17 16:50:51 -04001699 ]
1700 libs = [
Mike Reedf97e8e92019-05-29 13:33:55 -04001701 "swscale",
Mike Reed7bf160e2019-05-17 16:50:51 -04001702 "avcodec",
1703 "avformat",
1704 "avutil",
1705 ]
1706 }
1707 }
1708
Mike Klein6e744122016-10-27 12:21:40 -04001709 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001710 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001711 sources = gm_sources
1712 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001713 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001714 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001715 ":skia",
1716 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001717 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001718 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001719 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001720 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001721 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001722 public_deps = [
1723 ":gpu_tool_utils",
1724 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001725
1726 if (skia_use_ffmpeg) {
1727 deps += [ ":video_decoder" ]
1728 sources += [ "gm/video_decoder.cpp" ]
1729 }
mtkleinc095df52016-08-24 12:23:52 -07001730 }
mtklein25c81d42016-07-27 13:55:26 -07001731
Mike Klein7b7077c2019-06-03 17:10:59 -05001732 test_lib("skvm_builders") {
1733 sources = [
1734 "tools/SkVMBuilders.cpp",
1735 "tools/SkVMBuilders.h",
1736 ]
1737 }
1738
Mike Klein6e744122016-10-27 12:21:40 -04001739 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001740 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001741 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001742 if (skia_use_metal) {
1743 sources += metal_tests_sources
1744 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001745 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001746 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001747 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001748 if (!(skia_use_freetype && skia_use_fontconfig)) {
1749 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1750 }
mtkleinc095df52016-08-24 12:23:52 -07001751 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001752 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001753 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001754 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001755 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001756 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001757 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001758 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001759 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001760 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001761 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001762 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001763 "//third_party/zlib",
1764 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001765 public_deps = [
1766 ":gpu_tool_utils", # Test.h #includes headers from this target.
1767 ]
mtkleinc095df52016-08-24 12:23:52 -07001768 }
mtklein2f3416d2016-08-02 16:02:05 -07001769
Mike Klein6e744122016-10-27 12:21:40 -04001770 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001771 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001772 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001773 deps = [
1774 ":flags",
1775 ":gm",
1776 ":gpu_tool_utils",
1777 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001778 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001779 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001780 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001781 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001782 ]
1783 }
mtklein2b6870c2016-07-28 14:17:33 -07001784
mtkleinc095df52016-08-24 12:23:52 -07001785 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001786 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001787 sources = [
1788 "experimental/svg/model/SkSVGAttribute.cpp",
1789 "experimental/svg/model/SkSVGAttributeParser.cpp",
1790 "experimental/svg/model/SkSVGCircle.cpp",
1791 "experimental/svg/model/SkSVGClipPath.cpp",
1792 "experimental/svg/model/SkSVGContainer.cpp",
1793 "experimental/svg/model/SkSVGDOM.cpp",
1794 "experimental/svg/model/SkSVGEllipse.cpp",
1795 "experimental/svg/model/SkSVGGradient.cpp",
1796 "experimental/svg/model/SkSVGLine.cpp",
1797 "experimental/svg/model/SkSVGLinearGradient.cpp",
1798 "experimental/svg/model/SkSVGNode.cpp",
1799 "experimental/svg/model/SkSVGPath.cpp",
1800 "experimental/svg/model/SkSVGPattern.cpp",
1801 "experimental/svg/model/SkSVGPoly.cpp",
1802 "experimental/svg/model/SkSVGRadialGradient.cpp",
1803 "experimental/svg/model/SkSVGRect.cpp",
1804 "experimental/svg/model/SkSVGRenderContext.cpp",
1805 "experimental/svg/model/SkSVGSVG.cpp",
1806 "experimental/svg/model/SkSVGShape.cpp",
1807 "experimental/svg/model/SkSVGStop.cpp",
1808 "experimental/svg/model/SkSVGTransformableNode.cpp",
1809 "experimental/svg/model/SkSVGUse.cpp",
1810 "experimental/svg/model/SkSVGValue.cpp",
1811 ]
1812 deps = [
1813 ":skia",
1814 ":xml",
1815 ]
1816 }
mtkleinc095df52016-08-24 12:23:52 -07001817 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001818
Mike Reedd62d4062019-06-12 10:20:44 -04001819 test_lib("experimental_xform") {
1820 sources = [
1821 "experimental/xform/SkShape.cpp",
1822 "experimental/xform/SkXform.cpp",
1823 "experimental/xform/XContext.cpp",
1824 ]
1825 deps = [
1826 ":skia",
1827 ]
1828 }
1829
Mike Klein38af9432016-11-11 11:39:44 -05001830 if (skia_use_lua) {
1831 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001832 sources = [
1833 "src/utils/SkLua.cpp",
1834 "src/utils/SkLuaCanvas.cpp",
1835 ]
1836 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001837 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001838 "//third_party/lua",
1839 ]
1840 }
1841
Mike Kleine6682eb2017-01-05 10:54:57 -05001842 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001843 sources = [
1844 "tools/lua/lua_app.cpp",
1845 ]
1846 deps = [
1847 ":lua",
1848 ":skia",
1849 "//third_party/lua",
1850 ]
Mike Klein38af9432016-11-11 11:39:44 -05001851 }
1852
Mike Kleine6682eb2017-01-05 10:54:57 -05001853 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001854 sources = [
1855 "tools/lua/lua_pictures.cpp",
1856 ]
1857 deps = [
1858 ":flags",
1859 ":lua",
1860 ":skia",
1861 ":tool_utils",
1862 "//third_party/lua",
1863 ]
Mike Klein38af9432016-11-11 11:39:44 -05001864 }
1865 }
1866
Florin Malitabfe876a2018-09-02 12:33:59 -04001867 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001868 test_app("skottie_tool") {
1869 deps = [
1870 "modules/skottie:tool",
1871 ]
1872 }
1873 }
1874
Hal Canary5b39dc82019-04-17 13:29:46 -04001875 test_app("make_skqp_model") {
1876 sources = [
1877 "tools/skqp/make_skqp_model.cpp",
1878 ]
1879 deps = [
1880 ":skia",
1881 ]
1882 }
1883
Kevin Lubickebf648e2017-09-21 13:45:16 -04001884 if (target_cpu != "wasm") {
1885 import("gn/samples.gni")
1886 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001887 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001888 public_deps = [
1889 ":tool_utils",
1890 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001891 deps = [
1892 ":experimental_svg_model",
1893 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001894 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001895 ":xml",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001896 "modules/skparagraph:samples",
Mike Reedec80d902019-02-12 11:31:27 -05001897 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001898 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001899 ]
Mike Klein38af9432016-11-11 11:39:44 -05001900
Kevin Lubickebf648e2017-09-21 13:45:16 -04001901 if (skia_use_lua) {
1902 sources += [ "samplecode/SampleLua.cpp" ]
1903 deps += [
1904 ":lua",
1905 "//third_party/lua",
1906 ]
1907 }
1908 }
Mike Klein7af351a2018-07-27 09:54:43 -04001909 test_app("imgcvt") {
1910 sources = [
1911 "tools/imgcvt.cpp",
1912 ]
1913 deps = [
1914 ":skcms",
1915 ":skia",
1916 ]
1917 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001918 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001919 sources = [
1920 "tools/HashAndEncode.cpp",
1921 "tools/HashAndEncode.h",
1922 ]
1923 deps = [
1924 ":flags",
1925 ":skia",
1926 "//third_party/libpng",
1927 ]
1928 }
1929 test_app("fm") {
1930 sources = [
1931 "tools/fm/fm.cpp",
1932 ]
1933 deps = [
1934 ":common_flags_aa",
1935 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001936 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001937 ":flags",
1938 ":gm",
1939 ":gpu_tool_utils",
1940 ":hash_and_encode",
1941 ":skia",
1942 ":tool_utils",
1943 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001944 "modules/skottie",
1945 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001946 ]
1947 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001948 test_app("dm") {
1949 sources = [
1950 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001951 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001952 "dm/DMJsonWriter.cpp",
1953 "dm/DMSrcSink.cpp",
1954 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001955 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001956 ":common_flags_aa",
1957 ":common_flags_config",
1958 ":common_flags_gpu",
1959 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001960 ":experimental_svg_model",
1961 ":flags",
1962 ":gm",
1963 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001964 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001965 ":skia",
1966 ":tests",
1967 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001968 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001969 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001970 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001971 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001972 ]
1973 }
Brian Osman16adfa32016-10-18 14:42:44 -04001974 }
1975
Mike Kleina8a51ce2018-01-09 12:34:11 -05001976 if (!is_win) {
1977 test_app("remote_demo") {
1978 sources = [
1979 "tools/remote_demo.cpp",
1980 ]
1981 deps = [
1982 ":skia",
1983 ]
1984 }
1985 }
1986
Mike Kleine6682eb2017-01-05 10:54:57 -05001987 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001988 sources = [
1989 "bench/nanobench.cpp",
1990 ]
1991 deps = [
1992 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001993 ":common_flags_aa",
1994 ":common_flags_config",
1995 ":common_flags_gpu",
1996 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001997 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001998 ":flags",
1999 ":gm",
2000 ":gpu_tool_utils",
2001 ":skia",
2002 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002003 ":trace",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002004 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04002005 "modules/sksg",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04002006 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07002007 ]
mtklein2b6870c2016-07-28 14:17:33 -07002008 }
halcanary19a97202016-08-03 15:08:04 -07002009
Ravi Mistry10d36c52017-01-31 09:49:18 -05002010 test_app("skpinfo") {
2011 sources = [
2012 "tools/skpinfo.cpp",
2013 ]
2014 deps = [
2015 ":flags",
2016 ":skia",
2017 ]
2018 }
2019
Mike Reedc0ee21f2019-05-28 16:11:03 -04002020 if (skia_use_ffmpeg) {
2021 test_app("skottie2movie") {
2022 sources = [
2023 "tools/skottie2movie.cpp",
2024 ]
2025 deps = [
2026 ":flags",
2027 ":skia",
2028 ":video_decoder",
2029 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04002030 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04002031 ]
2032 }
2033 }
2034
Brian Osmanc9a42472018-05-31 13:17:12 -04002035 test_app("skpbench") {
2036 sources = [
2037 "tools/skpbench/skpbench.cpp",
2038 ]
2039 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002040 ":common_flags_config",
2041 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002042 ":flags",
2043 ":gpu_tool_utils",
2044 ":skia",
2045 ":tool_utils",
2046 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002047 }
2048
Mike Kleine6682eb2017-01-05 10:54:57 -05002049 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07002050 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04002051 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07002052 ]
2053 deps = [
2054 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002055 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002056 ]
halcanary3eee9d92016-09-10 07:01:53 -07002057 }
mtklein046cb562016-09-16 10:23:12 -07002058
Ben Wagner219f3622017-07-17 15:32:25 -04002059 test_app("create_test_font") {
2060 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05002061 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04002062 ]
2063 deps = [
2064 ":skia",
2065 ]
2066 assert_no_deps = [
2067 # tool_utils requires the output of this app.
2068 ":tool_utils",
2069 ]
2070 }
2071
Florin Malita5d3ff432018-07-31 16:38:43 -04002072 if (skia_use_expat) {
2073 test_app("create_test_font_color") {
2074 sources = [
2075 "tools/fonts/create_test_font_color.cpp",
2076 ]
2077 deps = [
2078 ":flags",
2079 ":skia",
2080 ":tool_utils",
2081 ]
2082 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002083 }
2084
Mike Kleine6682eb2017-01-05 10:54:57 -05002085 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07002086 sources = [
2087 "tools/get_images_from_skps.cpp",
2088 ]
2089 deps = [
2090 ":flags",
2091 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002092 ]
mtklein046cb562016-09-16 10:23:12 -07002093 }
mtkleinecbc5262016-09-22 11:51:24 -07002094
Brian Osman6788a542018-12-10 11:56:01 -05002095 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002096 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002097 sources = [
2098 "tools/skiaserve/Request.cpp",
2099 "tools/skiaserve/Response.cpp",
2100 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002101 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2102 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2103 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2104 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2105 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2106 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2107 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2108 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2109 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002110 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2111 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002112 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2113 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2114 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2115 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2116 ]
2117 deps = [
2118 ":flags",
2119 ":gpu_tool_utils",
2120 ":skia",
2121 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002122 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002123 ]
Mike Klein7d302882016-11-03 14:06:31 -04002124 }
mtkleinecbc5262016-09-22 11:51:24 -07002125 }
kjlubick14f984b2016-10-03 11:49:45 -07002126
Mike Kleine6682eb2017-01-05 10:54:57 -05002127 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002128 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002129 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002130 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002131 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002132 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002133 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002134 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002135 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002136 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002137 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002138 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002139 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002140 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002141 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002142 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2143 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002144 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002145 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002146 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002147 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002148 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2149 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002150 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2151 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002152 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002153 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002154 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002155 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002156 "tools/debugger/DebugCanvas.cpp",
2157 "tools/debugger/DrawCommand.cpp",
2158 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002159 ]
2160 deps = [
2161 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002162 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002163 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002164 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002165 ]
kjlubick14f984b2016-10-03 11:49:45 -07002166 }
Mike Klein38312422016-10-05 15:41:01 -04002167
Mike Kleine6682eb2017-01-05 10:54:57 -05002168 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002169 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002170 rebase_path("tests/skia_test.cpp"),
2171 rebase_path("tests/Test.cpp"),
2172 ]
caryclark9feb6322016-10-25 08:58:26 -07002173 deps = [
2174 ":flags",
2175 ":gpu_tool_utils",
2176 ":skia",
2177 ":tool_utils",
2178 ]
caryclark9feb6322016-10-25 08:58:26 -07002179 }
2180
Mike Kleine6682eb2017-01-05 10:54:57 -05002181 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002182 sources = [
2183 "tools/DumpRecord.cpp",
2184 "tools/dump_record.cpp",
2185 ]
2186 deps = [
2187 ":flags",
2188 ":skia",
2189 ]
Mike Klein38312422016-10-05 15:41:01 -04002190 }
bungemanfe917272016-10-13 17:36:40 -04002191
Mike Kleine6682eb2017-01-05 10:54:57 -05002192 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002193 sources = [
2194 "tools/skdiff/skdiff.cpp",
2195 "tools/skdiff/skdiff_html.cpp",
2196 "tools/skdiff/skdiff_main.cpp",
2197 "tools/skdiff/skdiff_utils.cpp",
2198 ]
2199 deps = [
2200 ":skia",
2201 ":tool_utils",
2202 ]
bungemanfe917272016-10-13 17:36:40 -04002203 }
halcanarya73d76a2016-10-17 13:19:02 -07002204
Mike Kleine6682eb2017-01-05 10:54:57 -05002205 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002206 sources = [
2207 "tools/skp_parser.cpp",
2208 ]
2209 deps = [
2210 ":skia",
2211 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002212 ]
halcanarya73d76a2016-10-17 13:19:02 -07002213 }
Brian Osman16adfa32016-10-18 14:42:44 -04002214
Brian Osmanc9a42472018-05-31 13:17:12 -04002215 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002216 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002217 defines =
2218 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002219 sources = [
2220 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002221 "tools/skqp/src/skqp.cpp",
2222 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002223 ]
2224 deps = [
2225 ":gm",
2226 ":gpu_tool_utils",
2227 ":skia",
2228 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002229 ":tool_utils",
2230 ]
2231 }
2232 test_app("skqp") {
2233 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002234 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002235 ]
2236 deps = [
2237 ":skia",
2238 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002239 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002240 ]
2241 }
2242 test_app("jitter_gms") {
2243 sources = [
2244 "tools/skqp/jitter_gms.cpp",
2245 ]
2246 deps = [
2247 ":gm",
2248 ":skia",
2249 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002250 ]
2251 }
2252 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002253 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002254 test_app("skqp_app") {
2255 is_shared_library = true
2256 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002257 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002258 ]
2259 deps = [
2260 ":skia",
2261 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002262 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002263 ]
2264 libs = [ "android" ]
2265 }
2266 }
Stan Iliev93151722018-08-02 11:10:52 -04002267 if (is_android && skia_enable_gpu) {
2268 test_app("skottie_android") {
2269 is_shared_library = true
2270
2271 sources = [
2272 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2273 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2274 ]
2275 libs = []
2276
Stan Iliev93151722018-08-02 11:10:52 -04002277 deps = [
2278 ":skia",
2279 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002280 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002281 ]
2282 }
2283 }
Hal Canary75427132017-10-11 16:00:31 -04002284
Hal Canarya9de7602018-01-19 13:08:23 -05002285 test_app("list_gms") {
2286 sources = [
2287 "tools/list_gms.cpp",
2288 ]
2289 deps = [
2290 ":gm",
2291 ":skia",
2292 ]
2293 }
2294 test_app("list_gpu_unit_tests") {
2295 sources = [
2296 "dm/DMGpuTestProcs.cpp",
2297 "tools/list_gpu_unit_tests.cpp",
2298 ]
2299 deps = [
2300 ":skia",
2301 ":tests",
2302 ]
2303 }
2304
Brian Osmanc9a42472018-05-31 13:17:12 -04002305 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002306 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002307 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002308 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002309 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002310 sources = [
2311 "tools/sk_app/CommandSet.cpp",
2312 "tools/sk_app/GLWindowContext.cpp",
2313 "tools/sk_app/Window.cpp",
2314 ]
2315 libs = []
2316
2317 if (is_android) {
2318 sources += [
2319 "tools/sk_app/android/GLWindowContext_android.cpp",
2320 "tools/sk_app/android/RasterWindowContext_android.cpp",
2321 "tools/sk_app/android/Window_android.cpp",
2322 "tools/sk_app/android/main_android.cpp",
2323 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002324 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002325 libs += [ "android" ]
2326 } else if (is_linux) {
2327 sources += [
2328 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2329 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2330 "tools/sk_app/unix/Window_unix.cpp",
2331 "tools/sk_app/unix/keysym2ucs.c",
2332 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002333 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002334 libs += [
2335 "GL",
2336 "X11",
2337 ]
2338 } else if (is_win) {
2339 sources += [
2340 "tools/sk_app/win/GLWindowContext_win.cpp",
2341 "tools/sk_app/win/RasterWindowContext_win.cpp",
2342 "tools/sk_app/win/Window_win.cpp",
2343 "tools/sk_app/win/main_win.cpp",
2344 ]
Brian Salomon194db172017-08-17 14:37:06 -04002345 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002346 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002347 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002348 } else if (is_mac) {
2349 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002350 "tools/sk_app/mac/GLWindowContext_mac.mm",
2351 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2352 "tools/sk_app/mac/Window_mac.mm",
2353 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002354 ]
2355 libs += [
2356 "QuartzCore.framework",
2357 "Cocoa.framework",
2358 "Foundation.framework",
2359 ]
2360 } else if (is_ios) {
2361 sources += [
2362 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2363 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2364 "tools/sk_app/ios/Window_ios.cpp",
2365 "tools/sk_app/ios/main_ios.cpp",
2366 ]
2367 }
2368
2369 if (skia_use_vulkan) {
2370 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2371 if (is_android) {
2372 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2373 } else if (is_linux) {
2374 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2375 libs += [ "X11-xcb" ]
2376 } else if (is_win) {
2377 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002378 } else if (is_mac) {
2379 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2380 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002381 }
2382 }
2383
Jim Van Verthbe39f712019-02-08 15:36:14 -05002384 if (skia_use_metal) {
2385 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2386 if (is_mac) {
2387 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2388 }
2389 libs += [ "MetalKit.framework" ]
2390 }
2391
Brian Osmanc9a42472018-05-31 13:17:12 -04002392 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002393 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002394 ]
2395 if (is_android) {
2396 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002397 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002398 deps += [ "//third_party/libsdl" ]
2399 }
2400 if (skia_use_angle) {
2401 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002402 }
Brian Osman16adfa32016-10-18 14:42:44 -04002403 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002404
Hal Canary87515122019-03-15 14:22:51 -04002405 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2406 test_app("fiddle_examples") {
2407 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002408 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002409 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002410 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002411 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002412 if (is_win) {
2413 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2414 }
Hal Canary87515122019-03-15 14:22:51 -04002415 deps = [
2416 ":skia",
2417 ":skia.h",
2418 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002419 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002420 ]
2421 }
2422 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002423 test_app("viewer") {
2424 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002425 sources = [
2426 "tools/viewer/BisectSlide.cpp",
2427 "tools/viewer/GMSlide.cpp",
2428 "tools/viewer/ImGuiLayer.cpp",
2429 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002430 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002431 "tools/viewer/SKPSlide.cpp",
2432 "tools/viewer/SampleSlide.cpp",
2433 "tools/viewer/SkottieSlide.cpp",
2434 "tools/viewer/SlideDir.cpp",
2435 "tools/viewer/StatsLayer.cpp",
2436 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002437 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002438 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002439 "tools/viewer/Viewer.cpp",
2440 ]
2441 libs = []
2442
Brian Osmanc9a42472018-05-31 13:17:12 -04002443 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002444 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002445 ":experimental_svg_model",
2446 ":flags",
2447 ":gm",
2448 ":gpu_tool_utils",
2449 ":samples",
2450 ":sk_app",
2451 ":skia",
2452 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002453 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002454 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002455 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002456 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002457 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002458 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002459 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002460 ]
Mike Reedd62d4062019-06-12 10:20:44 -04002461 if (skia_use_experimental_xform) {
2462 deps += [ ":experimental_xform" ]
2463 sources += [ "gm/xform.cpp" ]
2464 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002465 }
2466
Brian Osmanc9a42472018-05-31 13:17:12 -04002467 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002468 test_app("HelloWorld") {
2469 sources = [
2470 "example/HelloWorld.cpp",
2471 ]
2472 libs = []
2473
Brian Osmaneff04b52017-11-21 13:18:02 -05002474 deps = [
2475 ":flags",
2476 ":gpu_tool_utils",
2477 ":sk_app",
2478 ":skia",
2479 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002480 ]
2481 }
2482 }
2483
Brian Osmanc9a42472018-05-31 13:17:12 -04002484 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002485 test_app("SkiaSDLExample") {
2486 sources = [
2487 "example/SkiaSDLExample.cpp",
2488 ]
2489 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002490 deps = [
2491 ":gpu_tool_utils",
2492 ":skia",
2493 "//third_party/libsdl",
2494 ]
2495 }
2496 }
2497
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002498 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2499 action_foreach("generate_mocs") {
2500 script = "gn/call.py"
2501 sources = [
2502 "tools/mdbviz/MainWindow.h",
2503 ]
2504 outputs = [
2505 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2506 ]
2507 args = [
2508 "$skia_qt_path" + "/bin/moc",
2509 "{{source}}",
2510 "-o",
2511 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2512 ]
2513 }
2514 action_foreach("generate_resources") {
2515 script = "gn/call.py"
2516 sources = [
2517 "tools/mdbviz/resources.qrc",
2518 ]
2519 outputs = [
2520 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2521 ]
2522 args = [
2523 "$skia_qt_path" + "/bin/rcc",
2524 "{{source}}",
2525 "-o",
2526 "gen/mdbviz/{{source_name_part}}_res.cpp",
2527 ]
2528 }
2529 test_app("mdbviz") {
2530 if (is_win) {
2531 # on Windows we need to disable some exception handling warnings due to the Qt headers
2532 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2533 }
2534 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002535 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002536 "tools/debugger/DebugCanvas.cpp",
2537 "tools/debugger/DrawCommand.cpp",
2538 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002539 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002540 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002541 "tools/mdbviz/main.cpp",
2542
2543 # generated files
2544 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2545 "$target_gen_dir/mdbviz/resources_res.cpp",
2546 ]
2547 lib_dirs = [ "$skia_qt_path/lib" ]
2548 libs = [
2549 "Qt5Core.lib",
2550 "Qt5Gui.lib",
2551 "Qt5Widgets.lib",
2552 ]
2553 include_dirs = [
2554 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002555 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002556 "$skia_qt_path/include/QtWidgets",
2557 ]
2558 deps = [
2559 ":generate_mocs",
2560 ":generate_resources",
2561 ":skia",
2562 ]
2563 }
2564 }
2565
Mike Kleine459afd2017-03-03 09:21:30 -05002566 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002567 copy("gdbserver") {
2568 sources = [
2569 "$ndk/$ndk_gdbserver",
2570 ]
2571 outputs = [
2572 "$root_out_dir/gdbserver",
2573 ]
2574 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002575 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002576
2577 if (skia_use_opencl) {
2578 test_app("hello-opencl") {
2579 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002580 "tools/hello-opencl.cpp",
2581 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002582 deps = [
2583 "//third_party/opencl",
2584 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002585 }
2586 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002587
2588 test_app("editor") {
2589 is_shared_library = is_android
2590 sources = [
Hal Canary50d650d2019-04-28 14:40:45 -04002591 "experimental/editor/editor.cpp",
2592 "experimental/editor/editor.h",
Hal Canary05694472019-05-03 17:14:21 -04002593 "experimental/editor/editor_application.cpp",
Hal Canary7b300a42019-04-30 12:38:28 -04002594 "experimental/editor/run_handler.cpp",
2595 "experimental/editor/run_handler.h",
Hal Canary05694472019-05-03 17:14:21 -04002596 "experimental/editor/stringslice.cpp",
2597 "experimental/editor/stringslice.h",
Hal Canaryb8f81af2019-04-24 13:56:16 -04002598 ]
2599 deps = [
2600 ":sk_app",
2601 ":skia",
2602 "modules/skshaper",
2603 ]
2604 }
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002605
Mike Klein7e650762019-07-02 15:21:11 -05002606 if (skia_enable_skvm_jit) {
Mike Kleinb5f95cd2019-07-02 14:16:26 -05002607 test_app("skvmtool") {
2608 defines = [
2609 "SKVM_JIT",
2610 "SKVM_PERF_DUMPS",
2611 ]
2612 include_dirs = [ "." ]
2613 sources = [
2614 "src/core/SkSpinlock.cpp",
2615 "src/core/SkThreadID.cpp",
2616 "src/core/SkVM.cpp",
2617 "tools/SkVMTool.cpp",
2618 ]
2619 if (target_cpu == "x64") {
2620 sources += [ "src/core/SkCpu.cpp" ]
2621 }
2622 }
2623 }
mtklein25c81d42016-07-27 13:55:26 -07002624}