blob: d0c675555535cd30c484eccdd40f2b68426c188e [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")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Brian Osman670a2902018-04-23 13:31:56 -040033 skia_use_skcms = true
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040045 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040046 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070047 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070048 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040049
Hal Canary4689b542018-01-31 11:54:14 -050050 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050051 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040052
53 skia_llvm_path = ""
54 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040055
56 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070057}
Brian Salomon23d73ea2016-10-27 13:31:37 -040058declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040059 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040060 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050061 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040062
Brian Salomon5f33a8c2018-02-26 14:32:39 -050063 skia_use_legacy_gpu_pixel_ops = is_skia_dev_build && is_win # Arbitrary to keep old code path tested until deletion.
64
Mike Klein4d598a32016-10-31 13:44:49 -040065 if (is_android) {
66 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070067 } else if (is_fuchsia) {
68 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040069 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040070 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
71 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040072 }
Jim Van Verth4e502972017-12-07 15:16:10 -050073
74 if (is_ios) {
75 skia_ios_identity = ".*Google.*"
76 skia_ios_profile = "Google Development"
77 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040078}
Brian Salomon789e25e2016-09-30 13:41:03 -040079
Adam Barth54ef74a2017-10-13 10:59:38 -070080if (defined(skia_settings)) {
81 import(skia_settings)
82}
83
mtklein38925aa2016-09-21 10:11:25 -070084# Our tools require static linking (they use non-exported symbols).
85skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070086
mtkleina45be612016-08-29 15:22:10 -070087fontmgr_android_enabled = skia_use_expat && skia_use_freetype
88
mtklein1211e0c2016-07-26 13:55:45 -070089skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070090 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070091 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070092 "include/codec",
93 "include/config",
94 "include/core",
95 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040096 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070097 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050098 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/pathops",
100 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700101 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700102 "include/utils",
103 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700104]
105
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500106if (skia_enable_atlas_text) {
107 skia_public_includes += [ "include/atlastext" ]
108}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000109
mtkleinc04ff472016-06-23 10:29:30 -0700110# Skia public API, generally provided by :skia.
111config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700112 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400113 defines = []
114 if (is_component_build) {
115 defines += [ "SKIA_DLL" ]
116 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400117 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700118 defines += [ "SK_SAMPLES_FOR_X" ]
119 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400120 if (skia_enable_flutter_defines) {
121 defines += flutter_defines
122 }
mtklein06c35c02016-09-20 12:28:12 -0700123 if (!skia_enable_gpu) {
124 defines += [ "SK_SUPPORT_GPU=0" ]
125 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500126 if (skia_enable_atlas_text) {
127 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
128 }
mtkleinc04ff472016-06-23 10:29:30 -0700129}
130
131# Skia internal APIs, used by Skia itself and a few test tools.
132config("skia_private") {
133 visibility = [ ":*" ]
134
135 include_dirs = [
136 "include/private",
137 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700138 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700139 "src/core",
140 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700141 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700142 "src/image",
143 "src/images",
144 "src/lazy",
145 "src/opts",
146 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700147 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700148 "src/ports",
149 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400150 "src/shaders",
151 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700152 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700153 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700154 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500155 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700156 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700157 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400158 if (skia_llvm_path != "") {
159 include_dirs += [ "$skia_llvm_path/include" ]
160 }
mtklein150d1132016-08-01 06:56:40 -0700161
Mike Reeda9e241d2017-05-03 10:52:00 -0400162 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700163 if (is_android) {
164 defines += [
165 "SK_GAMMA_EXPONENT=1.4",
166 "SK_GAMMA_CONTRAST=0.0",
167 ]
168 }
mtklein88a7ac02016-09-14 11:16:49 -0700169 if (is_official_build || is_android) {
170 # TODO(bsalomon): it'd be nice to make Android normal.
171 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
172 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400173 libs = []
174 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500175 if (skia_enable_gpu) {
176 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500177 if (is_skia_dev_build && skia_use_vulkan) {
178 include_dirs += [ "tools/gpu/vk" ]
179 }
Brian Salomon03e05842017-02-23 12:23:47 -0500180 }
Brian Osman34755e22016-12-05 09:46:02 -0500181 if (skia_use_angle) {
182 defines += [ "SK_ANGLE" ]
183 }
Brian Osman3f375d02016-12-28 11:19:22 -0500184 if (skia_enable_discrete_gpu) {
185 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
186 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400187 if (!is_official_build) {
188 defines += [ "GR_TEST_UTILS=1" ]
189 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400190 if (skia_llvm_path != "") {
191 defines += [ "SK_LLVM_AVAILABLE" ]
192 include_dirs += [ "$skia_llvm_path/include" ]
193 libs += [ skia_llvm_lib ]
194 lib_dirs += [ "$skia_llvm_path/lib/" ]
195 }
mtkleinc04ff472016-06-23 10:29:30 -0700196}
197
198# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
199config("skia_library") {
200 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700201 defines = [ "SKIA_IMPLEMENTATION=1" ]
202}
203
204skia_library_configs = [
205 ":skia_public",
206 ":skia_private",
207 ":skia_library",
208]
209
mtklein9b8583d2016-08-24 17:32:30 -0700210# Use for CPU-specific Skia code that needs particular compiler flags.
211template("opts") {
212 if (invoker.enabled) {
213 source_set(target_name) {
214 forward_variables_from(invoker, "*")
215 configs += skia_library_configs
216 }
217 } else {
218 # If not enabled, a phony empty target that swallows all otherwise unused variables.
219 source_set(target_name) {
220 forward_variables_from(invoker,
221 "*",
222 [
223 "sources",
224 "cflags",
225 ])
226 }
227 }
anmittala7eaf2e2016-08-17 13:57:26 -0700228}
229
mtklein422310d2016-08-16 18:28:43 -0700230is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700231
mtklein7d6fb2c2016-08-25 14:50:44 -0700232opts("none") {
233 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700234 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700235 cflags = []
236}
237
mtklein7d6fb2c2016-08-25 14:50:44 -0700238opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700239 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700241 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700242}
243
244opts("arm64") {
245 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700247 cflags = []
248}
249
250opts("crc32") {
251 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700252 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700253 cflags = [ "-march=armv8-a+crc" ]
254}
255
mtklein9b8583d2016-08-24 17:32:30 -0700256opts("sse2") {
257 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.sse2_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_SSE2" ]
261 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400262 cflags = [ "-msse2" ]
263 }
mtklein9b8583d2016-08-24 17:32:30 -0700264}
mtkleinc04ff472016-06-23 10:29:30 -0700265
mtklein9b8583d2016-08-24 17:32:30 -0700266opts("ssse3") {
267 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700268 sources = skia_opts.ssse3_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_SSSE3" ]
271 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400272 cflags = [ "-mssse3" ]
273 }
mtklein9b8583d2016-08-24 17:32:30 -0700274}
mtkleinc04ff472016-06-23 10:29:30 -0700275
mtklein9b8583d2016-08-24 17:32:30 -0700276opts("sse41") {
277 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700278 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400279 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400280 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
281 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400282 cflags = [ "-msse4.1" ]
283 }
mtklein9b8583d2016-08-24 17:32:30 -0700284}
mtklein4e976072016-08-08 09:06:27 -0700285
mtklein9b8583d2016-08-24 17:32:30 -0700286opts("sse42") {
287 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700288 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400289 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400290 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
291 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400292 cflags = [ "-msse4.2" ]
293 }
mtklein9b8583d2016-08-24 17:32:30 -0700294}
295
296opts("avx") {
297 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700298 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400299 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000300 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400301 } else {
302 cflags = [ "-mavx" ]
303 }
mtkleinc04ff472016-06-23 10:29:30 -0700304}
305
Mike Klein1b9b7d52018-02-27 10:37:40 -0500306opts("hsw") {
307 enabled = is_x86
308 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400309 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500310 cflags = [ "/arch:AVX2" ]
311 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000312 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500313 }
314
315 # Oddly, clang-cl doesn't recognize this as a valid flag.
316 # If it ever does, it'd nice to move this up with -mavx2 and co.
317 if (is_clang && !is_win) {
318 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
319 # but nice to have, generating slightly better code for paths without explicit FMAs.
320 cflags += [ "-ffp-contract=fast" ]
321 }
322}
323
mtkleinc095df52016-08-24 12:23:52 -0700324# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700325template("optional") {
326 if (invoker.enabled) {
327 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700328 if (defined(invoker.public_defines)) {
329 defines = invoker.public_defines
330 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600331 if (defined(invoker.public_configs)) {
332 configs = invoker.public_configs
333 }
mtklein457b42a2016-08-23 13:56:37 -0700334 }
335 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700336 forward_variables_from(invoker,
337 "*",
338 [
339 "public_defines",
340 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700341 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700342 ])
mtklein457b42a2016-08-23 13:56:37 -0700343 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700344 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700345 if (defined(invoker.configs_to_remove)) {
346 configs -= invoker.configs_to_remove
347 }
mtklein457b42a2016-08-23 13:56:37 -0700348 }
349 } else {
mtklein457b42a2016-08-23 13:56:37 -0700350 source_set(target_name) {
351 forward_variables_from(invoker,
352 "*",
353 [
354 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400355 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700356 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700357 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700358 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700359 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700360 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700361 ])
mtkleincd01b032016-08-31 04:58:19 -0700362 if (defined(invoker.sources_when_disabled)) {
363 sources = invoker.sources_when_disabled
364 }
365 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700366 }
mtkleineb3c4252016-08-23 07:38:09 -0700367 }
mtklein457b42a2016-08-23 13:56:37 -0700368}
mtklein457b42a2016-08-23 13:56:37 -0700369
Mike Kleina04bb452017-02-09 12:24:07 -0500370optional("effects") {
371 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400372 deps = [
373 ":compile_processors",
374 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500375 sources =
376 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
377 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
378}
379
mtkleina45be612016-08-29 15:22:10 -0700380optional("fontmgr_android") {
381 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700382
383 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500384 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700385 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700386 ]
387 sources = [
388 "src/ports/SkFontMgr_android.cpp",
389 "src/ports/SkFontMgr_android_factory.cpp",
390 "src/ports/SkFontMgr_android_parser.cpp",
391 ]
392}
393
mtkleind2e39db2016-09-07 07:52:55 -0700394optional("fontmgr_custom") {
395 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
396
397 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500398 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700399 ]
400 sources = [
401 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500402 "src/ports/SkFontMgr_custom.h",
403 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700404 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500405 "src/ports/SkFontMgr_custom_embedded.cpp",
406 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700407 ]
408}
409
Hal Canaryff2742e2018-01-30 11:35:47 -0500410optional("fontmgr_empty") {
411 enabled = skia_enable_fontmgr_empty
412 sources = [
413 "src/ports/SkFontMgr_empty_factory.cpp",
414 ]
415}
416
mtklein3cc22182016-08-29 13:26:14 -0700417optional("fontmgr_fontconfig") {
418 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700419
420 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500421 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700422 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700423 ]
424 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700425 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700426 "src/ports/SkFontConfigInterface_direct.cpp",
427 "src/ports/SkFontConfigInterface_direct_factory.cpp",
428 "src/ports/SkFontMgr_FontConfigInterface.cpp",
429 "src/ports/SkFontMgr_fontconfig.cpp",
430 "src/ports/SkFontMgr_fontconfig_factory.cpp",
431 ]
432}
433
mtkleincdedd0e2016-09-12 15:15:44 -0700434optional("fontmgr_fuchsia") {
435 enabled = is_fuchsia && skia_use_freetype
436
437 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500438 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700439 ]
440 sources = [
441 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500442 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700443 "src/ports/SkFontMgr_custom_empty_factory.cpp",
444 ]
445}
446
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700447if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400448 executable("sksllex") {
449 sources = [
450 "src/sksl/lex/Main.cpp",
451 "src/sksl/lex/NFA.cpp",
452 "src/sksl/lex/RegexNode.cpp",
453 "src/sksl/lex/RegexParser.cpp",
454 ]
455 include_dirs = [ "src/sksl/lex" ]
456 }
457
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700458 action("run_sksllex") {
459 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400460 deps = [
461 ":sksllex(//gn/toolchain:$host_toolchain)",
462 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700463 sources = [
464 "src/sksl/lex/layout.lex",
465 "src/sksl/lex/sksl.lex",
466 ]
467
468 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
469 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
470 outputs = [
471 "$target_out_dir/" +
472 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
473 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
474 # confused due to the same file being named by two different paths
475 ]
476 sksllex_path = "$root_out_dir/"
477 sksllex_path += "sksllex"
478 if (host_os == "win") {
479 sksllex_path += ".exe"
480 }
481 args = [
482 rebase_path(sksllex_path),
483 rebase_path("bin/clang-format"),
484 rebase_path("src"),
485 ]
486 }
487} else {
488 group("run_sksllex") {
489 }
490}
491
492if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400493 executable("skslc") {
494 defines = [ "SKSL_STANDALONE" ]
495 sources = [
496 "src/sksl/SkSLMain.cpp",
497 ]
498 sources += skia_sksl_sources
499 include_dirs = [
500 "src/gpu",
501 "src/sksl",
502 ]
503 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500504 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400505 "//third_party/spirv-tools",
506 ]
507 }
508
509 skia_gpu_processor_outputs = []
510 foreach(src, skia_gpu_processor_sources) {
511 dir = get_path_info(src, "dir")
512 name = get_path_info(src, "name")
513
514 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
515 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
516 skia_gpu_processor_outputs += [
517 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
518 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
519 # confused due to the same file being named by two different paths
520 ]
521 }
522
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500523 action("create_sksl_enums") {
524 script = "gn/create_sksl_enums.py"
525 sources = [
526 "include/private/GrSharedEnums.h",
527 ]
528 outputs = [
529 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500530 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500531 ]
532 args = [
533 rebase_path(sources[0]),
534 rebase_path(outputs[0]),
535 ]
536 }
537
Ethan Nicholas762466e2017-06-29 10:03:38 -0400538 action("compile_processors") {
539 script = "gn/compile_processors.py"
540 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500541 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400542 ":skslc(//gn/toolchain:$host_toolchain)",
543 ]
544 sources = skia_gpu_processor_sources
545 outputs = skia_gpu_processor_outputs
546 skslc_path = "$root_out_dir/"
547 if (host_toolchain != default_toolchain_name) {
548 skslc_path += "$host_toolchain/"
549 }
550 skslc_path += "skslc"
551 if (host_os == "win") {
552 skslc_path += ".exe"
553 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400554 args = [
555 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400556 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400557 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400558 args += rebase_path(skia_gpu_processor_sources)
559 }
560} else {
561 skia_gpu_processor_outputs = []
562 group("compile_processors") {
563 }
564}
565
mtklein06c35c02016-09-20 12:28:12 -0700566optional("gpu") {
567 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400568 deps = [
569 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700570 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400571 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700572 if (skia_generate_workarounds) {
573 deps += [ ":workaround_list" ]
574 }
mtkleine9fb3d52016-09-20 15:11:46 -0700575 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600576 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400577 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700578
Brian Salomon3d6801e2017-12-11 10:06:31 -0500579 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700580
581 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500582 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700583 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400584 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700585 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400586 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400587
588 # this lib is required to link against AHardwareBuffer
589 if (defined(ndk_api) && ndk_api >= 26) {
590 libs += [ "android" ]
591 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400592 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500593 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400594 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700595 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500596 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500597 libs += [
598 "GL",
599 "GLU",
600 ]
mtklein06c35c02016-09-20 12:28:12 -0700601 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500602 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800603 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500604 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400605 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400607 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700608 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500609 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700610 }
mtkleine9fb3d52016-09-20 15:11:46 -0700611
612 if (skia_use_vulkan) {
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400613 # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
614 # //third_party/vulkan directory in their trees so they can set up the vulkan library however
615 # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
616 # vulkan files.
617 public_deps += [ "third_party/vulkan" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700618 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700619 if (skia_enable_vulkan_debug_layers) {
620 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
621 }
mtkleine9fb3d52016-09-20 15:11:46 -0700622 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400623
Brian Salomon5f33a8c2018-02-26 14:32:39 -0500624 if (skia_use_legacy_gpu_pixel_ops) {
625 public_defines += [ "SK_LEGACY_GPU_PIXEL_OPS" ]
626 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400627 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400628 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400629 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
630 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400631
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400632 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400633 if (skia_use_metal) {
634 public_defines += [ "SK_METAL" ]
635 sources += skia_metal_sources
636 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400637 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400638 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500639
640 if (skia_enable_atlas_text) {
641 sources += skia_atlas_text_sources
642 }
mtklein06c35c02016-09-20 12:28:12 -0700643}
644
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400645optional("heif") {
646 enabled = skia_use_libheif
647 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
648
649 deps = []
650
651 sources = [
652 "src/codec/SkHeifCodec.cpp",
653 ]
654}
655
mtklein63213812016-08-24 09:55:56 -0700656optional("jpeg") {
657 enabled = skia_use_libjpeg_turbo
658 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
659
mtklein63213812016-08-24 09:55:56 -0700660 deps = [
661 "//third_party/libjpeg-turbo:libjpeg",
662 ]
663 sources = [
664 "src/codec/SkJpegCodec.cpp",
665 "src/codec/SkJpegDecoderMgr.cpp",
666 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700667 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400668 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700669 ]
670}
671
672optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500673 enabled = skia_use_zlib && skia_enable_pdf
674 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700675
mtklein63213812016-08-24 09:55:56 -0700676 deps = [
677 "//third_party/zlib",
678 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400679 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700680 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400681 }
brettwb9447282016-09-01 14:24:39 -0700682 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700683 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700684
685 if (skia_use_sfntly) {
686 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500687 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700688 }
689}
690
691optional("png") {
692 enabled = skia_use_libpng
693 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
694
mtklein63213812016-08-24 09:55:56 -0700695 deps = [
696 "//third_party/libpng",
697 ]
698 sources = [
699 "src/codec/SkIcoCodec.cpp",
700 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400701 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700702 ]
703}
704
scroggof84ad642016-10-31 09:02:57 -0700705optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400706 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700707 public_defines = [ "SK_CODEC_DECODES_RAW" ]
708
709 deps = [
710 "//third_party/dng_sdk",
711 "//third_party/libjpeg-turbo:libjpeg",
712 "//third_party/piex",
713 ]
714
715 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
716 # Skia.
717 configs_to_remove = [ "//gn:no_exceptions" ]
718
719 sources = [
720 "src/codec/SkRawAdapterCodec.cpp",
721 "src/codec/SkRawCodec.cpp",
722 ]
723}
724
Mike Klein852a8cb2018-05-15 10:46:58 -0400725import("third_party/skcms/skcms.gni")
726config("third_party_skcms_public") {
727 include_dirs = [ "third_party/skcms" ]
728}
729source_set("third_party_skcms") {
730 public_configs = [ ":third_party_skcms_public" ]
731
732 cflags = []
733 if (!is_win || is_clang) {
734 cflags += [
735 "-w",
736 "-std=c11",
737 ]
738 }
739
740 public = [
741 "third_party/skcms/skcms.h",
742 ]
743 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
744}
745
Mike Kleinfb333552018-01-25 12:49:37 -0500746optional("skcms") {
747 enabled = skia_use_skcms
748
Brian Osman094fba92018-03-26 17:05:48 -0400749 public_defines = [ "SK_USE_SKCMS" ]
Mike Kleinfb333552018-01-25 12:49:37 -0500750 deps = [
Mike Klein852a8cb2018-05-15 10:46:58 -0400751 ":third_party_skcms",
Mike Kleinfb333552018-01-25 12:49:37 -0500752 ]
753 sources = [
Brian Osman094fba92018-03-26 17:05:48 -0400754 "src/core/SkColorSpaceXform_skcms.cpp",
Mike Kleinfb333552018-01-25 12:49:37 -0500755 ]
756}
757
mtklein3cc22182016-08-29 13:26:14 -0700758optional("typeface_freetype") {
759 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700760
761 deps = [
762 "//third_party/freetype2",
763 ]
764 sources = [
765 "src/ports/SkFontHost_FreeType.cpp",
766 "src/ports/SkFontHost_FreeType_common.cpp",
767 ]
768}
769
mtklein457b42a2016-08-23 13:56:37 -0700770optional("webp") {
771 enabled = skia_use_libwebp
772 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
773
mtklein457b42a2016-08-23 13:56:37 -0700774 deps = [
775 "//third_party/libwebp",
776 ]
777 sources = [
778 "src/codec/SkWebpAdapterCodec.cpp",
779 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400780 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700781 ]
mtkleineb3c4252016-08-23 07:38:09 -0700782}
783
mtklein63213812016-08-24 09:55:56 -0700784optional("xml") {
785 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000786 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700787
mtklein63213812016-08-24 09:55:56 -0700788 deps = [
789 "//third_party/expat",
790 ]
791 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500792 "src/svg/SkSVGCanvas.cpp",
793 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700794 "src/xml/SkDOM.cpp",
795 "src/xml/SkXMLParser.cpp",
796 "src/xml/SkXMLWriter.cpp",
797 ]
798}
799
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700800if (skia_enable_gpu && skia_generate_workarounds) {
801 action("workaround_list") {
802 script = "tools/build_workaround_header.py"
803
804 inputs = [
805 "src/gpu/gpu_workaround_list.txt",
806 ]
807
808 # see comments in skia_compile_processors about out dir path shenanigans.
809 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700810 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700811
812 outputs = [
813 "$root_out_dir/$output_file",
814 ]
815 args = [
816 "--output-file",
817 "$output_file",
818 ]
819
820 foreach(file, inputs) {
821 args += [ rebase_path(file, root_build_dir) ]
822 }
823 }
824}
825
mtkleinc04ff472016-06-23 10:29:30 -0700826component("skia") {
827 public_configs = [ ":skia_public" ]
828 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700829
830 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700831 ":arm64",
832 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700833 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700834 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500835 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700836 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700837 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500838 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700839 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700840 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400841 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500842 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700843 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700844 ":none",
mtklein63213812016-08-24 09:55:56 -0700845 ":pdf",
846 ":png",
scroggof84ad642016-10-31 09:02:57 -0700847 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500848 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700849 ":sse2",
850 ":sse41",
851 ":sse42",
852 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700853 ":webp",
mtklein63213812016-08-24 09:55:56 -0700854 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700855 ]
856
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400857 # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
858 # need to get propagated up to the tools that depend on :skia and thus :gpu.
859 public_deps = [
860 ":gpu",
861 ]
862
Chinmay Garde43f115c2016-11-16 15:04:12 -0800863 # This file (and all GN files in Skia) are designed to work with an
864 # empty sources assignment filter; we handle all that explicitly.
865 # We clear the filter here for clients who may have set up a global filter.
866 set_sources_assignment_filter([])
867
mtkleinc04ff472016-06-23 10:29:30 -0700868 sources = []
brettwb9447282016-09-01 14:24:39 -0700869 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700870 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500871 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700872 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400873 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500874 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700875 "src/android/SkBitmapRegionCodec.cpp",
876 "src/android/SkBitmapRegionDecoder.cpp",
877 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400878 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700879 "src/codec/SkBmpCodec.cpp",
880 "src/codec/SkBmpMaskCodec.cpp",
881 "src/codec/SkBmpRLECodec.cpp",
882 "src/codec/SkBmpStandardCodec.cpp",
883 "src/codec/SkCodec.cpp",
884 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700885 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700886 "src/codec/SkMaskSwizzler.cpp",
887 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700888 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700889 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700890 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700891 "src/codec/SkSwizzler.cpp",
892 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700893 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700894 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700895 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700896 "src/ports/SkMemory_malloc.cpp",
897 "src/ports/SkOSFile_stdio.cpp",
898 "src/sfnt/SkOTTable_name.cpp",
899 "src/sfnt/SkOTUtils.cpp",
900 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700901 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700902 ]
brettwb9447282016-09-01 14:24:39 -0700903
mtklein7d6fb2c2016-08-25 14:50:44 -0700904 libs = []
905
mtkleinc04ff472016-06-23 10:29:30 -0700906 if (is_win) {
907 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400908 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700909 "src/ports/SkDebug_win.cpp",
910 "src/ports/SkFontHost_win.cpp",
911 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500912 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700913 "src/ports/SkImageEncoder_WIC.cpp",
914 "src/ports/SkImageGeneratorWIC.cpp",
915 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700916 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700917 "src/ports/SkScalerContext_win_dw.cpp",
918 "src/ports/SkTLS_win.cpp",
919 "src/ports/SkTypeface_win_dw.cpp",
920 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400921 libs += [
922 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500923 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400924 "Ole32.lib",
925 "OleAut32.lib",
926 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500927 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400928 ]
mtkleinc04ff472016-06-23 10:29:30 -0700929 } else {
930 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700931 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700932 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700933 "src/ports/SkTLS_pthread.cpp",
934 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400935 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700936 }
937
mtklein7d6fb2c2016-08-25 14:50:44 -0700938 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500939 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500940 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500941 deps += [ "//third_party/cpu-features" ]
942 }
mtklein06c35c02016-09-20 12:28:12 -0700943 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700944 libs += [
945 "EGL",
946 "GLESv2",
947 "log",
948 ]
949 }
950
mtkleinc04ff472016-06-23 10:29:30 -0700951 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700952 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400953 if (skia_use_egl) {
954 libs += [ "GLESv2" ]
955 }
mtkleinc04ff472016-06-23 10:29:30 -0700956 }
957
958 if (is_mac) {
959 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700960 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700961 "src/ports/SkFontHost_mac.cpp",
962 "src/ports/SkImageEncoder_CG.cpp",
963 "src/ports/SkImageGeneratorCG.cpp",
964 ]
mtklein09e61f72016-08-23 13:35:28 -0700965 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400966 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
967 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700968 "ApplicationServices.framework",
969 "OpenGL.framework",
970 ]
mtkleinc04ff472016-06-23 10:29:30 -0700971 }
abarth6fc8ff02016-07-15 15:15:15 -0700972
Mike Klein7d302882016-11-03 14:06:31 -0400973 if (is_ios) {
974 sources += [
975 "src/ports/SkDebug_stdio.cpp",
976 "src/ports/SkFontHost_mac.cpp",
977 "src/ports/SkImageEncoder_CG.cpp",
978 "src/ports/SkImageGeneratorCG.cpp",
979 ]
980 libs += [
981 "CoreFoundation.framework",
982 "CoreGraphics.framework",
983 "CoreText.framework",
984 "ImageIO.framework",
985 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400986
987 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
988 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400989 ]
990 }
991
abarth6fc8ff02016-07-15 15:15:15 -0700992 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700993 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700994 }
mtkleinc04ff472016-06-23 10:29:30 -0700995}
996
mtkleinc095df52016-08-24 12:23:52 -0700997# Targets guarded by skia_enable_tools may use //third_party freely.
998if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500999 # Used by gn_to_bp.py to list our public include dirs.
1000 source_set("public") {
1001 configs += [ ":skia_public" ]
1002 }
1003
Mike Kleinc36dedf2016-11-18 09:35:28 -05001004 config("skia.h_config") {
1005 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -05001006 if (skia_use_vulkan) {
1007 # So we can get the header which includes vulkan
1008 include_dirs += [ "tools/gpu/vk" ]
1009 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001010 }
1011 action("skia.h") {
1012 public_configs = [ ":skia.h_config" ]
1013 skia_h = "$target_gen_dir/skia.h"
1014 script = "gn/find_headers.py"
Florin Malita3d856bd2018-05-26 09:49:28 -04001015 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
Ben Wagner9494f3e2018-05-25 15:48:31 -04001016 [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +00001017 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001018 depfile = "$skia_h.deps"
1019 outputs = [
1020 skia_h,
1021 ]
1022 }
1023
1024 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001025 executable("fiddle") {
1026 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001027 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001028 "tools/fiddle/draw.cpp",
1029 "tools/fiddle/fiddle_main.cpp",
1030 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001031
1032 if (skia_use_egl) {
1033 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001034 } else {
1035 sources += [ "tools/fiddle/null_context.cpp" ]
1036 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001037 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001038 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001039 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001040 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001041 ":skia",
1042 ":skia.h",
1043 ]
1044 }
1045 }
1046
1047 if (skia_enable_gpu) {
1048 source_set("public_headers_warnings_check") {
1049 sources = [
1050 "tools/public_headers_warnings_check.cpp",
1051 ]
1052 configs -= [ "//gn:warnings_except_public_headers" ]
1053 deps = [
1054 ":skia",
1055 ":skia.h",
1056 ]
1057 }
1058 }
1059
mtkleinc095df52016-08-24 12:23:52 -07001060 template("test_lib") {
1061 config(target_name + "_config") {
1062 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001063 if (defined(invoker.public_defines)) {
1064 defines = invoker.public_defines
1065 }
mtklein25c81d42016-07-27 13:55:26 -07001066 }
mtkleinc095df52016-08-24 12:23:52 -07001067 source_set(target_name) {
1068 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1069 public_configs = [
1070 ":" + target_name + "_config",
1071 ":skia_private",
1072 ]
1073
1074 if (!defined(deps)) {
1075 deps = []
1076 }
1077 deps += [ ":skia" ]
1078 testonly = true
1079 }
mtklein25c81d42016-07-27 13:55:26 -07001080 }
mtklein25c81d42016-07-27 13:55:26 -07001081
Mike Kleine6682eb2017-01-05 10:54:57 -05001082 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001083 if (is_ios) {
1084 app_name = target_name
1085 gen_path = target_gen_dir
1086
1087 action("${app_name}_generate_info_plist") {
1088 script = "//gn/gen_plist_ios.py"
1089 outputs = [
1090 "$gen_path/${app_name}_Info.plist",
1091 ]
1092 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1093 }
1094
1095 bundle_data("${app_name}_bundle_info_plist") {
1096 public_deps = [
1097 ":${app_name}_generate_info_plist",
1098 ]
1099 sources = [
1100 "$gen_path/${app_name}_Info.plist",
1101 ]
1102 outputs = [
1103 "{{bundle_root_dir}}/Info.plist",
1104 ]
1105 }
1106
Jim Van Verth329c5a62017-11-29 11:42:33 -05001107 bundle_ios_data =
1108 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1109
1110 if (bundle_ios_data) {
1111 has_skps =
1112 "True" == exec_script("//gn/checkdir.py",
1113 [ rebase_path("skps", root_build_dir) ],
1114 "trim string")
1115 bundle_data("${app_name}_bundle_resources") {
1116 sources = [
1117 "resources",
1118 ]
1119 outputs = [
1120 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1121 "{{bundle_resources_dir}}/data/resources",
1122 ]
1123 }
1124
1125 if (has_skps) {
1126 bundle_data("${app_name}_bundle_skps") {
1127 sources = [
1128 "skps",
1129 ]
1130 outputs = [
1131 # Store in same folder as resources
1132 "{{bundle_resources_dir}}/data/skps",
1133 ]
1134 }
1135 }
1136 }
1137
Jim Van Verth443a9132017-11-28 09:45:26 -05001138 executable("${app_name}_generate_executable") {
1139 forward_variables_from(invoker,
1140 "*",
1141 [
1142 "output_name",
1143 "visibility",
1144 "is_shared_library",
1145 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001146 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001147 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001148 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1149 }
1150
1151 bundle_data("${app_name}_bundle_executable") {
1152 public_deps = [
1153 ":${app_name}_generate_executable",
1154 ]
1155 sources = [
1156 "$gen_path/$app_name",
1157 ]
1158 outputs = [
1159 "{{bundle_executable_dir}}/$app_name",
1160 ]
1161 testonly = true
1162 }
1163
1164 create_bundle("$app_name") {
1165 product_type = "com.apple.product-type.application"
1166 testonly = true
1167
1168 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1169 bundle_resources_dir = bundle_root_dir
1170 bundle_executable_dir = bundle_root_dir
1171 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1172
1173 deps = [
1174 ":${app_name}_bundle_executable",
1175 ":${app_name}_bundle_info_plist",
1176 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001177 if (bundle_ios_data) {
1178 deps += [ ":${app_name}_bundle_resources" ]
1179 if (has_skps) {
1180 deps += [ ":${app_name}_bundle_skps" ]
1181 }
1182 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001183
1184 # should only code sign when running on a device, not the simulator
1185 if (target_cpu != "x64") {
1186 code_signing_script = "//gn/codesign_ios.py"
1187 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1188 code_signing_outputs = [
1189 "$bundle_root_dir/_CodeSignature/CodeResources",
1190 "$bundle_root_dir/embedded.mobileprovision",
1191 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001192 code_signing_args = [
1193 rebase_path("$bundle_root_dir", root_build_dir),
1194 skia_ios_identity,
1195 skia_ios_profile,
1196 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001197 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001198 }
1199 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001200 # !is_ios
1201
1202 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1203 shared_library("lib" + target_name) {
1204 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1205 configs += [ ":skia_private" ]
1206 testonly = true
1207 }
1208 } else {
1209 _executable = target_name
1210 executable(_executable) {
1211 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1212 configs += [ ":skia_private" ]
1213 testonly = true
1214 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001215 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001216 if (is_android && skia_android_serial != "" && defined(_executable)) {
1217 action("push_" + target_name) {
1218 script = "gn/push_to_android.py"
1219 deps = [
1220 ":" + _executable,
1221 ]
1222 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1223 outputs = [
1224 _stamp,
1225 ]
1226 args = [
1227 rebase_path("$root_build_dir/$_executable"),
1228 skia_android_serial,
1229 rebase_path(_stamp),
1230 ]
1231 testonly = true
1232 }
Mike Klein7d921032017-01-05 12:20:41 -05001233 }
1234 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001235 }
1236
mtkleinc095df52016-08-24 12:23:52 -07001237 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001238 public_include_dirs = []
1239 if (skia_enable_gpu) {
1240 public_defines = []
1241 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001242
1243 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001244 sources = [
1245 "tools/gpu/GrContextFactory.cpp",
1246 "tools/gpu/GrTest.cpp",
Brian Salomon58389b92018-03-07 13:01:25 -05001247 "tools/gpu/ProxyUtils.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001248 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001249 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001250 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001251 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001252 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1253 "tools/gpu/gl/debug/GrBufferObj.cpp",
1254 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1255 "tools/gpu/gl/debug/GrProgramObj.cpp",
1256 "tools/gpu/gl/debug/GrShaderObj.cpp",
1257 "tools/gpu/gl/debug/GrTextureObj.cpp",
1258 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1259 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001260 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001261 ]
1262 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001263
Kevin Lubick4a24e102017-03-29 11:19:01 -04001264 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001265 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001266 } else if (is_ios) {
1267 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1268 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001269 } else if (is_linux) {
1270 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001271 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001272 } else if (is_mac) {
1273 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001274 } else if (is_win) {
1275 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1276 libs += [
1277 "Gdi32.lib",
1278 "OpenGL32.lib",
1279 ]
mtklein38925aa2016-09-21 10:11:25 -07001280 }
mtklein6ef69992016-09-14 06:12:09 -07001281
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001282 cflags_objcc = [ "-fobjc-arc" ]
1283
Mike Kleinc168a3a2016-11-14 14:53:13 +00001284 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001285 deps += [ "//third_party/angle2" ]
1286 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1287 }
mtkleind68f9b02016-09-23 13:18:41 -07001288 if (skia_use_vulkan) {
1289 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001290 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001291 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001292 if (skia_use_metal) {
1293 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1294 }
mtkleina627b5c2016-09-20 13:36:47 -07001295 }
mtklein25c81d42016-07-27 13:55:26 -07001296 }
mtklein25c81d42016-07-27 13:55:26 -07001297
mtkleinc095df52016-08-24 12:23:52 -07001298 test_lib("flags") {
1299 public_include_dirs = [ "tools/flags" ]
1300 sources = [
1301 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001302 ]
1303 }
1304 test_lib("common_flags") {
1305 public_include_dirs = [ "tools/flags" ]
1306 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001307 "tools/flags/SkCommonFlags.cpp",
1308 "tools/flags/SkCommonFlagsConfig.cpp",
1309 ]
1310 deps = [
mtklein046cb562016-09-16 10:23:12 -07001311 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001312 ":gpu_tool_utils",
1313 ]
1314 }
mtklein25c81d42016-07-27 13:55:26 -07001315
mtkleinc095df52016-08-24 12:23:52 -07001316 test_lib("tool_utils") {
1317 public_include_dirs = [
1318 "tools",
1319 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001320 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001321 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001322 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001323 ]
1324 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001325 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001326 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001327 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001328 "tools/ProcStats.cpp",
1329 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001330 "tools/UrlDataManager.cpp",
1331 "tools/debugger/SkDebugCanvas.cpp",
1332 "tools/debugger/SkDrawCommand.cpp",
1333 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001334 "tools/fonts/SkRandomScalerContext.cpp",
1335 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001336 "tools/fonts/SkTestFontMgr.h",
1337 "tools/fonts/SkTestSVGTypeface.cpp",
1338 "tools/fonts/SkTestSVGTypeface.h",
1339 "tools/fonts/SkTestTypeface.cpp",
1340 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001341 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001342 "tools/picture_utils.cpp",
1343 "tools/random_parse_path.cpp",
1344 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001345 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001346 "tools/trace/SkChromeTracingTracer.cpp",
1347 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001348 "tools/trace/SkDebugfTracer.cpp",
1349 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001350 "tools/trace/SkEventTracingPriv.cpp",
1351 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001352 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001353 libs = []
1354 if (is_ios) {
1355 sources += [ "tools/ios_utils.m" ]
1356 libs += [ "Foundation.framework" ]
1357 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001358 defines = []
1359 if (skia_tools_require_resources) {
1360 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1361 }
mtkleinc095df52016-08-24 12:23:52 -07001362 deps = [
mtklein046cb562016-09-16 10:23:12 -07001363 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001364 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001365 ":flags",
1366 "//third_party/libpng",
1367 ]
1368 public_deps = [
1369 "//third_party/jsoncpp",
1370 ]
1371 }
mtklein25c81d42016-07-27 13:55:26 -07001372
Mike Klein6e744122016-10-27 12:21:40 -04001373 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001374 test_lib("gm") {
1375 public_include_dirs = [ "gm" ]
1376 sources = gm_sources
1377 deps = [
scroggo19b91532016-10-24 09:03:26 -07001378 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001379 ":gpu_tool_utils",
1380 ":skia",
1381 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001382 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001383 ]
1384 }
mtklein25c81d42016-07-27 13:55:26 -07001385
Mike Klein6e744122016-10-27 12:21:40 -04001386 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001387 test_lib("tests") {
1388 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001389 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001390 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001391 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001392 }
mtkleinc095df52016-08-24 12:23:52 -07001393 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001394 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001395 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001396 ":skia",
Mike Klein852a8cb2018-05-15 10:46:58 -04001397 ":third_party_skcms",
mtkleinc095df52016-08-24 12:23:52 -07001398 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001399 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001400 "//third_party/libpng",
1401 "//third_party/zlib",
1402 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001403 public_deps = [
1404 ":gpu_tool_utils", # Test.h #includes headers from this target.
1405 ]
mtkleinc095df52016-08-24 12:23:52 -07001406 }
mtklein2f3416d2016-08-02 16:02:05 -07001407
Mike Klein6e744122016-10-27 12:21:40 -04001408 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001409 test_lib("bench") {
1410 public_include_dirs = [ "bench" ]
1411 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001412 deps = [
1413 ":flags",
1414 ":gm",
1415 ":gpu_tool_utils",
1416 ":skia",
1417 ":tool_utils",
1418 ]
1419 }
mtklein2b6870c2016-07-28 14:17:33 -07001420
mtkleinc095df52016-08-24 12:23:52 -07001421 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001422 public_include_dirs = []
1423 if (skia_use_expat) {
1424 public_include_dirs += [ "experimental/svg/model" ]
1425 sources = [
1426 "experimental/svg/model/SkSVGAttribute.cpp",
1427 "experimental/svg/model/SkSVGAttributeParser.cpp",
1428 "experimental/svg/model/SkSVGCircle.cpp",
1429 "experimental/svg/model/SkSVGClipPath.cpp",
1430 "experimental/svg/model/SkSVGContainer.cpp",
1431 "experimental/svg/model/SkSVGDOM.cpp",
1432 "experimental/svg/model/SkSVGEllipse.cpp",
1433 "experimental/svg/model/SkSVGGradient.cpp",
1434 "experimental/svg/model/SkSVGLine.cpp",
1435 "experimental/svg/model/SkSVGLinearGradient.cpp",
1436 "experimental/svg/model/SkSVGNode.cpp",
1437 "experimental/svg/model/SkSVGPath.cpp",
1438 "experimental/svg/model/SkSVGPattern.cpp",
1439 "experimental/svg/model/SkSVGPoly.cpp",
1440 "experimental/svg/model/SkSVGRadialGradient.cpp",
1441 "experimental/svg/model/SkSVGRect.cpp",
1442 "experimental/svg/model/SkSVGRenderContext.cpp",
1443 "experimental/svg/model/SkSVGSVG.cpp",
1444 "experimental/svg/model/SkSVGShape.cpp",
1445 "experimental/svg/model/SkSVGStop.cpp",
1446 "experimental/svg/model/SkSVGTransformableNode.cpp",
1447 "experimental/svg/model/SkSVGUse.cpp",
1448 "experimental/svg/model/SkSVGValue.cpp",
1449 ]
1450 deps = [
1451 ":skia",
1452 ":xml",
1453 ]
1454 }
mtkleinc095df52016-08-24 12:23:52 -07001455 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001456
Kevin Lubickebf648e2017-09-21 13:45:16 -04001457 if (target_cpu != "wasm") {
1458 test_lib("views") {
1459 public_include_dirs = [ "include/views" ]
1460 sources = [
1461 "src/views/SkEvent.cpp",
1462 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001463 "src/views/SkTouchGesture.cpp",
1464 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001465 ]
Brian Osman34755e22016-12-05 09:46:02 -05001466 }
Brian Osman16adfa32016-10-18 14:42:44 -04001467 }
1468
Mike Klein38af9432016-11-11 11:39:44 -05001469 if (skia_use_lua) {
1470 test_lib("lua") {
1471 public_include_dirs = []
1472 sources = [
1473 "src/utils/SkLua.cpp",
1474 "src/utils/SkLuaCanvas.cpp",
1475 ]
1476 deps = [
Herb Derby1724db12018-05-22 12:01:50 -04001477 ":skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001478 "//third_party/lua",
1479 ]
1480 }
1481
Mike Kleine6682eb2017-01-05 10:54:57 -05001482 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001483 sources = [
1484 "tools/lua/lua_app.cpp",
1485 ]
1486 deps = [
1487 ":lua",
1488 ":skia",
1489 "//third_party/lua",
1490 ]
Mike Klein38af9432016-11-11 11:39:44 -05001491 }
1492
Mike Kleine6682eb2017-01-05 10:54:57 -05001493 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001494 sources = [
1495 "tools/lua/lua_pictures.cpp",
1496 ]
1497 deps = [
1498 ":flags",
1499 ":lua",
1500 ":skia",
1501 ":tool_utils",
1502 "//third_party/lua",
1503 ]
Mike Klein38af9432016-11-11 11:39:44 -05001504 }
1505 }
1506
Cary Clark8032b982017-07-28 11:04:54 -04001507 test_app("bookmaker") {
1508 sources = [
1509 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001510 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001511 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001512 "tools/bookmaker/fiddleParser.cpp",
1513 "tools/bookmaker/includeParser.cpp",
1514 "tools/bookmaker/includeWriter.cpp",
1515 "tools/bookmaker/mdOut.cpp",
1516 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001517 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001518 "tools/bookmaker/spellCheck.cpp",
1519 ]
1520 deps = [
1521 ":flags",
1522 ":skia",
1523 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001524 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001525 ]
1526 }
1527
Kevin Lubickebf648e2017-09-21 13:45:16 -04001528 if (target_cpu != "wasm") {
1529 import("gn/samples.gni")
1530 test_lib("samples") {
1531 public_include_dirs = [ "samplecode" ]
1532 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001533 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001534 deps = [
1535 ":experimental_svg_model",
1536 ":flags",
1537 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001538 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001539 ":tool_utils",
1540 ":views",
1541 ":xml",
Florin Malita3b526b02018-05-25 12:43:51 -04001542 "modules/sksg:samples",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001543 ]
Mike Klein38af9432016-11-11 11:39:44 -05001544
Kevin Lubickebf648e2017-09-21 13:45:16 -04001545 if (skia_use_lua) {
1546 sources += [ "samplecode/SampleLua.cpp" ]
1547 deps += [
1548 ":lua",
1549 "//third_party/lua",
1550 ]
1551 }
1552 }
1553 test_app("dm") {
1554 sources = [
1555 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001556 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001557 "dm/DMJsonWriter.cpp",
1558 "dm/DMSrcSink.cpp",
1559 ]
1560 include_dirs = [ "tests" ]
1561 deps = [
1562 ":common_flags",
1563 ":experimental_svg_model",
1564 ":flags",
1565 ":gm",
1566 ":gpu_tool_utils",
1567 ":skia",
1568 ":tests",
Brian Osmanc494a702018-05-23 11:52:00 -04001569 ":third_party_skcms",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001570 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001571 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001572 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001573 "//third_party/jsoncpp",
1574 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001575 ]
1576 }
Brian Osman16adfa32016-10-18 14:42:44 -04001577 }
1578
Mike Kleina8a51ce2018-01-09 12:34:11 -05001579 if (!is_win) {
1580 test_app("remote_demo") {
1581 sources = [
1582 "tools/remote_demo.cpp",
1583 ]
1584 deps = [
1585 ":skia",
1586 ]
1587 }
1588 }
1589
Mike Kleine6682eb2017-01-05 10:54:57 -05001590 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001591 sources = [
1592 "bench/nanobench.cpp",
1593 ]
1594 deps = [
1595 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001596 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001597 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001598 ":flags",
1599 ":gm",
1600 ":gpu_tool_utils",
1601 ":skia",
1602 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001603 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001604 "//third_party/jsoncpp",
1605 ]
mtklein2b6870c2016-07-28 14:17:33 -07001606 }
halcanary19a97202016-08-03 15:08:04 -07001607
Ravi Mistry10d36c52017-01-31 09:49:18 -05001608 test_app("skpinfo") {
1609 sources = [
1610 "tools/skpinfo.cpp",
1611 ]
1612 deps = [
1613 ":flags",
1614 ":skia",
1615 ]
1616 }
1617
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001618 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001619 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001620 sources = [
1621 "tools/skpbench/skpbench.cpp",
1622 ]
1623 deps = [
1624 ":flags",
1625 ":gpu_tool_utils",
1626 ":skia",
1627 ":tool_utils",
1628 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001629 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001630 }
1631
Hal Canary96c57252018-02-09 11:43:05 -05001632 test_lib("skshaper") {
1633 public_include_dirs = [ "tools/shape" ]
1634 deps = [
1635 ":skia",
1636 ]
1637
Hal Canary8bb40832018-02-08 15:16:28 -05001638 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001639 sources = [
1640 "tools/shape/SkShaper_primitive.cpp",
1641 ]
1642 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001643 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001644 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001645 ]
Hal Canary96c57252018-02-09 11:43:05 -05001646 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001647 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001648 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001649 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001650 }
halcanary19a97202016-08-03 15:08:04 -07001651 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001652 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001653 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001654 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001655 ]
1656 deps = [
1657 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001658 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001659 ]
halcanary3eee9d92016-09-10 07:01:53 -07001660 }
mtklein046cb562016-09-16 10:23:12 -07001661
Matt Sarett9f1c4032017-05-17 10:06:32 -04001662 test_app("create_flutter_test_images") {
1663 sources = [
1664 "tools/create_flutter_test_images.cpp",
1665 ]
1666 deps = [
1667 ":skia",
1668 ":tool_utils",
1669 ]
1670 }
1671
Ben Wagner219f3622017-07-17 15:32:25 -04001672 test_app("create_test_font") {
1673 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001674 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001675 ]
1676 deps = [
1677 ":skia",
1678 ]
1679 assert_no_deps = [
1680 # tool_utils requires the output of this app.
1681 ":tool_utils",
1682 ]
1683 }
1684
Ben Wagner97182cc2018-02-15 10:20:04 -05001685 test_app("create_test_font_color") {
1686 sources = [
1687 "tools/fonts/create_test_font_color.cpp",
1688 ]
1689 deps = [
1690 ":flags",
1691 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001692 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001693 ]
1694 }
1695
Mike Kleine6682eb2017-01-05 10:54:57 -05001696 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001697 sources = [
1698 "tools/get_images_from_skps.cpp",
1699 ]
1700 deps = [
1701 ":flags",
1702 ":skia",
1703 "//third_party/jsoncpp",
1704 ]
mtklein046cb562016-09-16 10:23:12 -07001705 }
mtkleinecbc5262016-09-22 11:51:24 -07001706
Kevin Lubickebf648e2017-09-21 13:45:16 -04001707 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001708 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001709 sources = [
1710 "tools/skiaserve/Request.cpp",
1711 "tools/skiaserve/Response.cpp",
1712 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001713 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1714 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1715 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1716 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1717 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1718 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1719 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1720 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1721 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001722 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1723 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001724 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1725 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1726 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1727 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1728 ]
1729 deps = [
1730 ":flags",
1731 ":gpu_tool_utils",
1732 ":skia",
1733 ":tool_utils",
1734 "//third_party/jsoncpp",
1735 "//third_party/libmicrohttpd",
1736 "//third_party/libpng",
1737 ]
Mike Klein7d302882016-11-03 14:06:31 -04001738 }
mtkleinecbc5262016-09-22 11:51:24 -07001739 }
kjlubick14f984b2016-10-03 11:49:45 -07001740
Mike Kleine6682eb2017-01-05 10:54:57 -05001741 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001742 include_dirs = [
1743 "tools",
1744 "tools/debugger",
1745 ]
kjlubick14f984b2016-10-03 11:49:45 -07001746 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001747 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001748 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001749 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001750 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001751 "fuzz/FuzzGradients.cpp",
1752 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001753 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001754 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001755 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001756 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001757 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1758 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001759 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1760 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001761 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1762 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001763 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001764 "tools/UrlDataManager.cpp",
1765 "tools/debugger/SkDebugCanvas.cpp",
1766 "tools/debugger/SkDrawCommand.cpp",
1767 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001768 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001769 ]
1770 deps = [
1771 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001772 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001773 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001774 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001775 "//third_party/jsoncpp",
1776 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001777 ]
kjlubick14f984b2016-10-03 11:49:45 -07001778 }
Mike Klein38312422016-10-05 15:41:01 -04001779
Mike Kleine6682eb2017-01-05 10:54:57 -05001780 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001781 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001782 rebase_path("tests/skia_test.cpp"),
1783 rebase_path("tests/Test.cpp"),
1784 ]
caryclark9feb6322016-10-25 08:58:26 -07001785 deps = [
1786 ":flags",
1787 ":gpu_tool_utils",
1788 ":skia",
1789 ":tool_utils",
1790 ]
caryclark9feb6322016-10-25 08:58:26 -07001791 }
1792
Mike Kleine6682eb2017-01-05 10:54:57 -05001793 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001794 sources = [
1795 "tools/DumpRecord.cpp",
1796 "tools/dump_record.cpp",
1797 ]
1798 deps = [
1799 ":flags",
1800 ":skia",
1801 ]
Mike Klein38312422016-10-05 15:41:01 -04001802 }
bungemanfe917272016-10-13 17:36:40 -04001803
Mike Kleine6682eb2017-01-05 10:54:57 -05001804 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001805 sources = [
1806 "tools/skdiff/skdiff.cpp",
1807 "tools/skdiff/skdiff_html.cpp",
1808 "tools/skdiff/skdiff_main.cpp",
1809 "tools/skdiff/skdiff_utils.cpp",
1810 ]
1811 deps = [
1812 ":skia",
1813 ":tool_utils",
1814 ]
bungemanfe917272016-10-13 17:36:40 -04001815 }
halcanarya73d76a2016-10-17 13:19:02 -07001816
Mike Kleine6682eb2017-01-05 10:54:57 -05001817 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001818 sources = [
1819 "tools/skp_parser.cpp",
1820 ]
1821 deps = [
1822 ":skia",
1823 ":tool_utils",
1824 "//third_party/jsoncpp",
1825 ]
halcanarya73d76a2016-10-17 13:19:02 -07001826 }
Brian Osman16adfa32016-10-18 14:42:44 -04001827
Hal Canaryd7b38452017-12-11 17:46:26 -05001828 if (!is_win && skia_enable_gpu) {
1829 test_lib("skqp_lib") {
1830 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001831 defines =
1832 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001833 if (skia_skqp_enable_driver_correctness_workarounds) {
1834 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1835 }
Hal Canary75427132017-10-11 16:00:31 -04001836 sources = [
1837 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001838 "tools/skqp/gm_knowledge.cpp",
1839 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001840 ]
1841 deps = [
1842 ":gm",
1843 ":gpu_tool_utils",
1844 ":skia",
1845 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001846 ":tool_utils",
1847 ]
1848 }
1849 test_app("skqp") {
1850 sources = [
1851 "tools/skqp/skqp.cpp",
1852 ]
1853 deps = [
1854 ":skia",
1855 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001856 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001857 "//third_party/googletest",
1858 ]
1859 }
1860 }
Hal Canary28f89382017-12-12 09:42:14 -05001861 if (is_android && skia_enable_gpu) {
1862 test_app("skqp_app") {
1863 is_shared_library = true
1864 sources = [
1865 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1866 ]
1867 deps = [
1868 ":skia",
1869 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001870 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001871 ]
1872 libs = [ "android" ]
1873 }
1874 }
Hal Canary75427132017-10-11 16:00:31 -04001875
Hal Canarya9de7602018-01-19 13:08:23 -05001876 test_app("list_gms") {
1877 sources = [
1878 "tools/list_gms.cpp",
1879 ]
1880 deps = [
1881 ":gm",
1882 ":skia",
1883 ]
1884 }
1885 test_app("list_gpu_unit_tests") {
1886 sources = [
1887 "dm/DMGpuTestProcs.cpp",
1888 "tools/list_gpu_unit_tests.cpp",
1889 ]
1890 deps = [
1891 ":skia",
1892 ":tests",
1893 ]
1894 }
1895
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001896 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001897 test_lib("sk_app") {
1898 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001899 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001900 "tools/sk_app/CommandSet.cpp",
1901 "tools/sk_app/GLWindowContext.cpp",
1902 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001903 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001904 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001905
Jim Van Verth4e56a912016-10-21 10:58:52 -04001906 if (is_android) {
1907 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001908 "tools/sk_app/android/GLWindowContext_android.cpp",
1909 "tools/sk_app/android/RasterWindowContext_android.cpp",
1910 "tools/sk_app/android/Window_android.cpp",
1911 "tools/sk_app/android/main_android.cpp",
1912 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001913 ]
Brian Osman462334e2017-02-09 11:22:57 -05001914 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001915 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001916 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001917 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1918 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1919 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001920 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001921 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001922 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001923 libs += [
1924 "GL",
1925 "X11",
1926 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001927 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001928 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001929 "tools/sk_app/win/GLWindowContext_win.cpp",
1930 "tools/sk_app/win/RasterWindowContext_win.cpp",
1931 "tools/sk_app/win/Window_win.cpp",
1932 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001933 ]
Brian Salomon194db172017-08-17 14:37:06 -04001934 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001935 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001936 }
Mike Klein43c25262016-10-20 10:17:47 -04001937 } else if (is_mac) {
1938 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001939 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1940 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1941 "tools/sk_app/mac/Window_mac.cpp",
1942 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001943 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001944 libs += [
1945 "QuartzCore.framework",
1946 "Cocoa.framework",
1947 "Foundation.framework",
1948 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001949 } else if (is_ios) {
1950 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001951 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1952 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1953 "tools/sk_app/ios/Window_ios.cpp",
1954 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001955 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001956 }
1957
1958 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001959 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001960 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001961 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001962 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001963 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001964 libs += [ "X11-xcb" ]
1965 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001966 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001967 }
1968 }
1969
Brian Osman16adfa32016-10-18 14:42:44 -04001970 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001971 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001972 ":skia",
1973 ":tool_utils",
1974 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001975 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001976 if (is_android) {
1977 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001978 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001979 deps += [ "//third_party/libsdl" ]
1980 }
Brian Salomon194db172017-08-17 14:37:06 -04001981 if (skia_use_angle) {
1982 deps += [ "//third_party/angle2" ]
1983 }
Mike Kleina92c3832016-12-08 09:49:39 -05001984 }
Brian Osman16adfa32016-10-18 14:42:44 -04001985 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001986
Brian Osmaneff04b52017-11-21 13:18:02 -05001987 if (skia_enable_gpu) {
1988 test_app("viewer") {
1989 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001990 if (is_ios) {
1991 bundle_ios_data = true
1992 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001993 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07001994 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001995 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001996 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001997 "tools/viewer/ImageSlide.cpp",
1998 "tools/viewer/SKPSlide.cpp",
1999 "tools/viewer/SampleSlide.cpp",
Florin Malita3d856bd2018-05-26 09:49:28 -04002000 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05002001 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05002002 "tools/viewer/StatsLayer.cpp",
Florin Malitac659c2c2018-04-05 11:57:21 -04002003 "tools/viewer/SvgSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002004 "tools/viewer/Viewer.cpp",
2005 ]
2006 libs = []
2007
2008 include_dirs = []
2009 deps = [
Florin Malitac659c2c2018-04-05 11:57:21 -04002010 ":experimental_svg_model",
Brian Osmaneff04b52017-11-21 13:18:02 -05002011 ":flags",
2012 ":gm",
2013 ":gpu_tool_utils",
2014 ":samples",
2015 ":sk_app",
2016 ":skia",
2017 ":tool_utils",
2018 ":views",
Florin Malita3d856bd2018-05-26 09:49:28 -04002019 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04002020 "modules/sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05002021 "//third_party/imgui",
2022 "//third_party/jsoncpp",
2023 ]
2024 }
2025 }
2026
2027 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2028 test_app("HelloWorld") {
2029 sources = [
2030 "example/HelloWorld.cpp",
2031 ]
2032 libs = []
2033
2034 include_dirs = []
2035 deps = [
2036 ":flags",
2037 ":gpu_tool_utils",
2038 ":sk_app",
2039 ":skia",
2040 ":tool_utils",
2041 ":views",
2042 ]
2043 }
2044 }
2045
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002046 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002047 test_app("SkiaSDLExample") {
2048 sources = [
2049 "example/SkiaSDLExample.cpp",
2050 ]
2051 libs = []
2052 include_dirs = []
2053 deps = [
2054 ":gpu_tool_utils",
2055 ":skia",
2056 "//third_party/libsdl",
2057 ]
2058 }
2059 }
2060
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002061 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2062 action_foreach("generate_mocs") {
2063 script = "gn/call.py"
2064 sources = [
2065 "tools/mdbviz/MainWindow.h",
2066 ]
2067 outputs = [
2068 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2069 ]
2070 args = [
2071 "$skia_qt_path" + "/bin/moc",
2072 "{{source}}",
2073 "-o",
2074 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2075 ]
2076 }
2077 action_foreach("generate_resources") {
2078 script = "gn/call.py"
2079 sources = [
2080 "tools/mdbviz/resources.qrc",
2081 ]
2082 outputs = [
2083 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2084 ]
2085 args = [
2086 "$skia_qt_path" + "/bin/rcc",
2087 "{{source}}",
2088 "-o",
2089 "gen/mdbviz/{{source_name_part}}_res.cpp",
2090 ]
2091 }
2092 test_app("mdbviz") {
2093 if (is_win) {
2094 # on Windows we need to disable some exception handling warnings due to the Qt headers
2095 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2096 }
2097 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002098 "tools/UrlDataManager.cpp",
2099 "tools/debugger/SkDebugCanvas.cpp",
2100 "tools/debugger/SkDrawCommand.cpp",
2101 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002102 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002103 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002104 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002105 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002106
2107 # generated files
2108 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2109 "$target_gen_dir/mdbviz/resources_res.cpp",
2110 ]
2111 lib_dirs = [ "$skia_qt_path/lib" ]
2112 libs = [
2113 "Qt5Core.lib",
2114 "Qt5Gui.lib",
2115 "Qt5Widgets.lib",
2116 ]
2117 include_dirs = [
2118 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002119 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002120 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002121 "tools",
2122 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002123 ]
2124 deps = [
2125 ":generate_mocs",
2126 ":generate_resources",
2127 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002128 "//third_party/jsoncpp",
2129 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002130 ]
2131 }
2132 }
2133
Mike Kleine459afd2017-03-03 09:21:30 -05002134 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002135 copy("gdbserver") {
2136 sources = [
2137 "$ndk/$ndk_gdbserver",
2138 ]
2139 outputs = [
2140 "$root_out_dir/gdbserver",
2141 ]
2142 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002143 }
mtklein25c81d42016-07-27 13:55:26 -07002144}