blob: 3872bc4f8900a475d2f49f3458986778c1097dcb [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 Kleinf9ae6702018-06-20 14:05:05 -040029 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040030 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070031 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040032 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040033 skia_use_libheif = is_skia_dev_build
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
Mike Reed0917fad2018-06-19 10:17:30 -040038 skia_enable_effects_imagefilters = true
Brian Osmanf2c90142017-07-13 15:50:03 -040039 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050040 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000041 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050042 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040043 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050044 skia_enable_tools = is_skia_dev_build
45 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielda16cce2018-08-01 09:23:57 -040046 skia_vulkan_header = "" # temporary as we remove the use from clients
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070049 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070050 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040051
Hal Canary4689b542018-01-31 11:54:14 -050052 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050053 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040054
55 skia_llvm_path = ""
56 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040057
58 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070059}
Brian Salomon23d73ea2016-10-27 13:31:37 -040060declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040061 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040062 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050063 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040064
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
Brian Osmanc9a42472018-05-31 13:17:12 -040084# Our tools require static linking (they use non-exported symbols), and the GPU backend.
85skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
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" ]
Mike Reed0917fad2018-06-19 10:17:30 -0400377 if (skia_enable_effects_imagefilters) {
378 sources += skia_effects_imagefilter_sources
379 } else {
380 sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
381 }
382 sources_when_disabled = [
383 "src/ports/SkGlobalInitialization_none.cpp",
384 "src/ports/SkGlobalInitialization_none_imagefilters.cpp",
385 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500386}
387
mtkleina45be612016-08-29 15:22:10 -0700388optional("fontmgr_android") {
389 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700390
391 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500392 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700393 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700394 ]
395 sources = [
396 "src/ports/SkFontMgr_android.cpp",
397 "src/ports/SkFontMgr_android_factory.cpp",
398 "src/ports/SkFontMgr_android_parser.cpp",
399 ]
400}
401
mtkleind2e39db2016-09-07 07:52:55 -0700402optional("fontmgr_custom") {
403 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
404
405 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500406 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700407 ]
408 sources = [
409 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500410 "src/ports/SkFontMgr_custom.h",
411 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700412 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500413 "src/ports/SkFontMgr_custom_embedded.cpp",
414 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700415 ]
416}
417
Hal Canaryff2742e2018-01-30 11:35:47 -0500418optional("fontmgr_empty") {
419 enabled = skia_enable_fontmgr_empty
420 sources = [
421 "src/ports/SkFontMgr_empty_factory.cpp",
422 ]
423}
424
mtklein3cc22182016-08-29 13:26:14 -0700425optional("fontmgr_fontconfig") {
426 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700427
428 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500429 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700430 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700431 ]
432 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700433 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700434 "src/ports/SkFontConfigInterface_direct.cpp",
435 "src/ports/SkFontConfigInterface_direct_factory.cpp",
436 "src/ports/SkFontMgr_FontConfigInterface.cpp",
437 "src/ports/SkFontMgr_fontconfig.cpp",
438 "src/ports/SkFontMgr_fontconfig_factory.cpp",
439 ]
440}
441
mtkleincdedd0e2016-09-12 15:15:44 -0700442optional("fontmgr_fuchsia") {
443 enabled = is_fuchsia && skia_use_freetype
444
445 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500446 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700447 ]
448 sources = [
449 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500450 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700451 "src/ports/SkFontMgr_custom_empty_factory.cpp",
452 ]
453}
454
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700455if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400456 executable("sksllex") {
457 sources = [
458 "src/sksl/lex/Main.cpp",
459 "src/sksl/lex/NFA.cpp",
460 "src/sksl/lex/RegexNode.cpp",
461 "src/sksl/lex/RegexParser.cpp",
462 ]
463 include_dirs = [ "src/sksl/lex" ]
464 }
465
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700466 action("run_sksllex") {
467 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400468 deps = [
469 ":sksllex(//gn/toolchain:$host_toolchain)",
470 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700471 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700472 "src/sksl/lex/sksl.lex",
473 ]
474
475 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
476 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
477 outputs = [
478 "$target_out_dir/" +
479 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
480 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
481 # confused due to the same file being named by two different paths
482 ]
483 sksllex_path = "$root_out_dir/"
484 sksllex_path += "sksllex"
485 if (host_os == "win") {
486 sksllex_path += ".exe"
487 }
488 args = [
489 rebase_path(sksllex_path),
490 rebase_path("bin/clang-format"),
491 rebase_path("src"),
492 ]
493 }
494} else {
495 group("run_sksllex") {
496 }
497}
498
499if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400500 executable("skslc") {
501 defines = [ "SKSL_STANDALONE" ]
502 sources = [
503 "src/sksl/SkSLMain.cpp",
504 ]
505 sources += skia_sksl_sources
506 include_dirs = [
507 "src/gpu",
508 "src/sksl",
509 ]
510 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500511 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400512 "//third_party/spirv-tools",
513 ]
514 }
515
516 skia_gpu_processor_outputs = []
517 foreach(src, skia_gpu_processor_sources) {
518 dir = get_path_info(src, "dir")
519 name = get_path_info(src, "name")
520
521 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
522 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
523 skia_gpu_processor_outputs += [
524 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
525 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
526 # confused due to the same file being named by two different paths
527 ]
528 }
529
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500530 action("create_sksl_enums") {
531 script = "gn/create_sksl_enums.py"
532 sources = [
533 "include/private/GrSharedEnums.h",
534 ]
535 outputs = [
536 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500537 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500538 ]
539 args = [
540 rebase_path(sources[0]),
541 rebase_path(outputs[0]),
542 ]
543 }
544
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 action("compile_processors") {
546 script = "gn/compile_processors.py"
547 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500548 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400549 ":skslc(//gn/toolchain:$host_toolchain)",
550 ]
551 sources = skia_gpu_processor_sources
552 outputs = skia_gpu_processor_outputs
553 skslc_path = "$root_out_dir/"
554 if (host_toolchain != default_toolchain_name) {
555 skslc_path += "$host_toolchain/"
556 }
557 skslc_path += "skslc"
558 if (host_os == "win") {
559 skslc_path += ".exe"
560 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400561 args = [
562 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400563 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400564 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400565 args += rebase_path(skia_gpu_processor_sources)
566 }
567} else {
568 skia_gpu_processor_outputs = []
569 group("compile_processors") {
570 }
571}
572
mtklein06c35c02016-09-20 12:28:12 -0700573optional("gpu") {
574 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 deps = [
576 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700577 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400578 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700579 if (skia_generate_workarounds) {
580 deps += [ ":workaround_list" ]
581 }
mtkleine9fb3d52016-09-20 15:11:46 -0700582 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600583 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400584 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700585
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700587
588 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500589 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700590 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400591 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700592 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400593 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400594
595 # this lib is required to link against AHardwareBuffer
596 if (defined(ndk_api) && ndk_api >= 26) {
597 libs += [ "android" ]
598 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400599 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500600 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400601 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700602 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500603 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400604 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700605 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800607 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400609 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400611 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700612 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500613 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700614 }
mtkleine9fb3d52016-09-20 15:11:46 -0700615
616 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400617 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400618 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700619 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700620 if (skia_enable_vulkan_debug_layers) {
621 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
622 }
mtkleine9fb3d52016-09-20 15:11:46 -0700623 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400624
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400625 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400626 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400627 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
628 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400629
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400630 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400631 if (skia_use_metal) {
632 public_defines += [ "SK_METAL" ]
633 sources += skia_metal_sources
634 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400635 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400636 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500637
638 if (skia_enable_atlas_text) {
639 sources += skia_atlas_text_sources
640 }
mtklein06c35c02016-09-20 12:28:12 -0700641}
642
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400643optional("heif") {
644 enabled = skia_use_libheif
645 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
646
647 deps = []
648
649 sources = [
650 "src/codec/SkHeifCodec.cpp",
651 ]
652}
653
mtklein63213812016-08-24 09:55:56 -0700654optional("jpeg") {
655 enabled = skia_use_libjpeg_turbo
656 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
657
mtklein63213812016-08-24 09:55:56 -0700658 deps = [
659 "//third_party/libjpeg-turbo:libjpeg",
660 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400661 public = [
662 "include/encode/SkJpegEncoder.h",
663 ]
mtklein63213812016-08-24 09:55:56 -0700664 sources = [
665 "src/codec/SkJpegCodec.cpp",
666 "src/codec/SkJpegDecoderMgr.cpp",
667 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700668 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400669 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700670 ]
671}
672
673optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500674 enabled = skia_use_zlib && skia_enable_pdf
675 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700676
mtklein63213812016-08-24 09:55:56 -0700677 deps = [
678 "//third_party/zlib",
679 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400680 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700681 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400682 }
brettwb9447282016-09-01 14:24:39 -0700683 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700684 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700685
686 if (skia_use_sfntly) {
687 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500688 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700689 }
690}
691
692optional("png") {
693 enabled = skia_use_libpng
694 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
695
mtklein63213812016-08-24 09:55:56 -0700696 deps = [
697 "//third_party/libpng",
698 ]
699 sources = [
700 "src/codec/SkIcoCodec.cpp",
701 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400702 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700703 ]
704}
705
scroggof84ad642016-10-31 09:02:57 -0700706optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400707 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700708 public_defines = [ "SK_CODEC_DECODES_RAW" ]
709
710 deps = [
711 "//third_party/dng_sdk",
712 "//third_party/libjpeg-turbo:libjpeg",
713 "//third_party/piex",
714 ]
715
716 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
717 # Skia.
718 configs_to_remove = [ "//gn:no_exceptions" ]
719
720 sources = [
721 "src/codec/SkRawAdapterCodec.cpp",
722 "src/codec/SkRawCodec.cpp",
723 ]
724}
725
Mike Klein852a8cb2018-05-15 10:46:58 -0400726import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400727source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400728 cflags = []
729 if (!is_win || is_clang) {
730 cflags += [
731 "-w",
732 "-std=c11",
733 ]
734 }
735
736 public = [
737 "third_party/skcms/skcms.h",
738 ]
739 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
740}
741
mtklein3cc22182016-08-29 13:26:14 -0700742optional("typeface_freetype") {
743 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700744
745 deps = [
746 "//third_party/freetype2",
747 ]
748 sources = [
749 "src/ports/SkFontHost_FreeType.cpp",
750 "src/ports/SkFontHost_FreeType_common.cpp",
751 ]
752}
753
mtklein457b42a2016-08-23 13:56:37 -0700754optional("webp") {
755 enabled = skia_use_libwebp
756 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
757
mtklein457b42a2016-08-23 13:56:37 -0700758 deps = [
759 "//third_party/libwebp",
760 ]
761 sources = [
762 "src/codec/SkWebpAdapterCodec.cpp",
763 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400764 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700765 ]
mtkleineb3c4252016-08-23 07:38:09 -0700766}
767
mtklein63213812016-08-24 09:55:56 -0700768optional("xml") {
769 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000770 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700771
mtklein63213812016-08-24 09:55:56 -0700772 deps = [
773 "//third_party/expat",
774 ]
775 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500776 "src/svg/SkSVGCanvas.cpp",
777 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700778 "src/xml/SkDOM.cpp",
779 "src/xml/SkXMLParser.cpp",
780 "src/xml/SkXMLWriter.cpp",
781 ]
782}
783
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700784if (skia_enable_gpu && skia_generate_workarounds) {
785 action("workaround_list") {
786 script = "tools/build_workaround_header.py"
787
788 inputs = [
789 "src/gpu/gpu_workaround_list.txt",
790 ]
791
792 # see comments in skia_compile_processors about out dir path shenanigans.
793 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700794 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700795
796 outputs = [
797 "$root_out_dir/$output_file",
798 ]
799 args = [
800 "--output-file",
801 "$output_file",
802 ]
803
804 foreach(file, inputs) {
805 args += [ rebase_path(file, root_build_dir) ]
806 }
807 }
808}
809
mtkleinc04ff472016-06-23 10:29:30 -0700810component("skia") {
811 public_configs = [ ":skia_public" ]
812 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700813
814 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700815 ":arm64",
816 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700817 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700818 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500819 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700820 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700821 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500822 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700823 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700824 ":fontmgr_fuchsia",
Greg Danielda16cce2018-08-01 09:23:57 -0400825 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400826 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500827 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700828 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700829 ":none",
mtklein63213812016-08-24 09:55:56 -0700830 ":pdf",
831 ":png",
scroggof84ad642016-10-31 09:02:57 -0700832 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500833 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700834 ":sse2",
835 ":sse41",
836 ":sse42",
837 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700838 ":webp",
mtklein63213812016-08-24 09:55:56 -0700839 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700840 ]
841
Chinmay Garde43f115c2016-11-16 15:04:12 -0800842 # This file (and all GN files in Skia) are designed to work with an
843 # empty sources assignment filter; we handle all that explicitly.
844 # We clear the filter here for clients who may have set up a global filter.
845 set_sources_assignment_filter([])
846
mtkleinc04ff472016-06-23 10:29:30 -0700847 sources = []
brettwb9447282016-09-01 14:24:39 -0700848 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700849 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500850 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700851 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400852 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500853 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700854 "src/android/SkBitmapRegionCodec.cpp",
855 "src/android/SkBitmapRegionDecoder.cpp",
856 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400857 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700858 "src/codec/SkBmpCodec.cpp",
859 "src/codec/SkBmpMaskCodec.cpp",
860 "src/codec/SkBmpRLECodec.cpp",
861 "src/codec/SkBmpStandardCodec.cpp",
862 "src/codec/SkCodec.cpp",
863 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400864 "src/codec/SkColorTable.cpp",
scroggo19b91532016-10-24 09:03:26 -0700865 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700866 "src/codec/SkMaskSwizzler.cpp",
867 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700868 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700869 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700870 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700871 "src/codec/SkSwizzler.cpp",
872 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700873 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700874 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700875 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700876 "src/ports/SkMemory_malloc.cpp",
877 "src/ports/SkOSFile_stdio.cpp",
878 "src/sfnt/SkOTTable_name.cpp",
879 "src/sfnt/SkOTUtils.cpp",
880 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700881 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700882 ]
brettwb9447282016-09-01 14:24:39 -0700883
mtklein7d6fb2c2016-08-25 14:50:44 -0700884 libs = []
885
mtkleinc04ff472016-06-23 10:29:30 -0700886 if (is_win) {
887 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400888 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700889 "src/ports/SkDebug_win.cpp",
890 "src/ports/SkFontHost_win.cpp",
891 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500892 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700893 "src/ports/SkImageEncoder_WIC.cpp",
894 "src/ports/SkImageGeneratorWIC.cpp",
895 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700896 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700897 "src/ports/SkScalerContext_win_dw.cpp",
898 "src/ports/SkTLS_win.cpp",
899 "src/ports/SkTypeface_win_dw.cpp",
900 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400901 libs += [
902 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500903 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400904 "Ole32.lib",
905 "OleAut32.lib",
906 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500907 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400908 ]
mtkleinc04ff472016-06-23 10:29:30 -0700909 } else {
910 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700911 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700912 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700913 "src/ports/SkTLS_pthread.cpp",
914 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400915 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700916 }
917
mtklein7d6fb2c2016-08-25 14:50:44 -0700918 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500919 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500920 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500921 deps += [ "//third_party/cpu-features" ]
922 }
mtklein06c35c02016-09-20 12:28:12 -0700923 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700924 libs += [
925 "EGL",
926 "GLESv2",
927 "log",
928 ]
929 }
930
mtkleinc04ff472016-06-23 10:29:30 -0700931 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700932 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400933 if (skia_use_egl) {
934 libs += [ "GLESv2" ]
935 }
mtkleinc04ff472016-06-23 10:29:30 -0700936 }
937
938 if (is_mac) {
939 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700940 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700941 "src/ports/SkFontHost_mac.cpp",
942 "src/ports/SkImageEncoder_CG.cpp",
943 "src/ports/SkImageGeneratorCG.cpp",
944 ]
mtklein09e61f72016-08-23 13:35:28 -0700945 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400946 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
947 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700948 "ApplicationServices.framework",
949 "OpenGL.framework",
950 ]
mtkleinc04ff472016-06-23 10:29:30 -0700951 }
abarth6fc8ff02016-07-15 15:15:15 -0700952
Mike Klein7d302882016-11-03 14:06:31 -0400953 if (is_ios) {
954 sources += [
955 "src/ports/SkDebug_stdio.cpp",
956 "src/ports/SkFontHost_mac.cpp",
957 "src/ports/SkImageEncoder_CG.cpp",
958 "src/ports/SkImageGeneratorCG.cpp",
959 ]
960 libs += [
961 "CoreFoundation.framework",
962 "CoreGraphics.framework",
963 "CoreText.framework",
964 "ImageIO.framework",
965 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400966
967 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
968 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400969 ]
970 }
971
abarth6fc8ff02016-07-15 15:15:15 -0700972 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700973 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700974 }
mtkleinc04ff472016-06-23 10:29:30 -0700975}
976
mtkleinc095df52016-08-24 12:23:52 -0700977# Targets guarded by skia_enable_tools may use //third_party freely.
978if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500979 # Used by gn_to_bp.py to list our public include dirs.
980 source_set("public") {
981 configs += [ ":skia_public" ]
982 }
983
Mike Kleinc36dedf2016-11-18 09:35:28 -0500984 config("skia.h_config") {
985 include_dirs = [ "$target_gen_dir" ]
986 }
987 action("skia.h") {
988 public_configs = [ ":skia.h_config" ]
989 skia_h = "$target_gen_dir/skia.h"
990 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -0400991
992 # TODO: would be cool to not hard-code these here, but how?
993 module_public_includes = [
994 "modules/sksg/include",
995 "modules/skottie/include",
996 ]
997 args =
998 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
999 [ rebase_path(skia_h, root_build_dir) ] +
1000 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001001 depfile = "$skia_h.deps"
1002 outputs = [
1003 skia_h,
1004 ]
1005 }
1006
Brian Osmanc9a42472018-05-31 13:17:12 -04001007 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001008 executable("fiddle") {
1009 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001010 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001011 "tools/fiddle/draw.cpp",
1012 "tools/fiddle/fiddle_main.cpp",
1013 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001014
1015 if (skia_use_egl) {
1016 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001017 } else {
1018 sources += [ "tools/fiddle/null_context.cpp" ]
1019 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001020 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001021 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001022 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001023 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001024 ":skia",
1025 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001026 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001027 ]
1028 }
1029 }
1030
Brian Osmanc9a42472018-05-31 13:17:12 -04001031 source_set("public_headers_warnings_check") {
1032 sources = [
1033 "tools/public_headers_warnings_check.cpp",
1034 ]
1035 configs -= [ "//gn:warnings_except_public_headers" ]
1036 deps = [
1037 ":skia",
1038 ":skia.h",
1039 "modules/skottie",
1040 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001041 }
1042
mtkleinc095df52016-08-24 12:23:52 -07001043 template("test_lib") {
1044 config(target_name + "_config") {
1045 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001046 if (defined(invoker.public_defines)) {
1047 defines = invoker.public_defines
1048 }
mtklein25c81d42016-07-27 13:55:26 -07001049 }
mtkleinc095df52016-08-24 12:23:52 -07001050 source_set(target_name) {
1051 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1052 public_configs = [
1053 ":" + target_name + "_config",
1054 ":skia_private",
1055 ]
1056
1057 if (!defined(deps)) {
1058 deps = []
1059 }
1060 deps += [ ":skia" ]
1061 testonly = true
1062 }
mtklein25c81d42016-07-27 13:55:26 -07001063 }
mtklein25c81d42016-07-27 13:55:26 -07001064
Mike Kleine6682eb2017-01-05 10:54:57 -05001065 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001066 if (is_ios) {
1067 app_name = target_name
1068 gen_path = target_gen_dir
1069
1070 action("${app_name}_generate_info_plist") {
1071 script = "//gn/gen_plist_ios.py"
1072 outputs = [
1073 "$gen_path/${app_name}_Info.plist",
1074 ]
1075 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1076 }
1077
1078 bundle_data("${app_name}_bundle_info_plist") {
1079 public_deps = [
1080 ":${app_name}_generate_info_plist",
1081 ]
1082 sources = [
1083 "$gen_path/${app_name}_Info.plist",
1084 ]
1085 outputs = [
1086 "{{bundle_root_dir}}/Info.plist",
1087 ]
1088 }
1089
Jim Van Verth329c5a62017-11-29 11:42:33 -05001090 bundle_ios_data =
1091 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1092
1093 if (bundle_ios_data) {
1094 has_skps =
1095 "True" == exec_script("//gn/checkdir.py",
1096 [ rebase_path("skps", root_build_dir) ],
1097 "trim string")
1098 bundle_data("${app_name}_bundle_resources") {
1099 sources = [
1100 "resources",
1101 ]
1102 outputs = [
1103 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1104 "{{bundle_resources_dir}}/data/resources",
1105 ]
1106 }
1107
1108 if (has_skps) {
1109 bundle_data("${app_name}_bundle_skps") {
1110 sources = [
1111 "skps",
1112 ]
1113 outputs = [
1114 # Store in same folder as resources
1115 "{{bundle_resources_dir}}/data/skps",
1116 ]
1117 }
1118 }
1119 }
1120
Jim Van Verth443a9132017-11-28 09:45:26 -05001121 executable("${app_name}_generate_executable") {
1122 forward_variables_from(invoker,
1123 "*",
1124 [
1125 "output_name",
1126 "visibility",
1127 "is_shared_library",
1128 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001129 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001130 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001131 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1132 }
1133
1134 bundle_data("${app_name}_bundle_executable") {
1135 public_deps = [
1136 ":${app_name}_generate_executable",
1137 ]
1138 sources = [
1139 "$gen_path/$app_name",
1140 ]
1141 outputs = [
1142 "{{bundle_executable_dir}}/$app_name",
1143 ]
1144 testonly = true
1145 }
1146
1147 create_bundle("$app_name") {
1148 product_type = "com.apple.product-type.application"
1149 testonly = true
1150
1151 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1152 bundle_resources_dir = bundle_root_dir
1153 bundle_executable_dir = bundle_root_dir
1154 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1155
1156 deps = [
1157 ":${app_name}_bundle_executable",
1158 ":${app_name}_bundle_info_plist",
1159 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001160 if (bundle_ios_data) {
1161 deps += [ ":${app_name}_bundle_resources" ]
1162 if (has_skps) {
1163 deps += [ ":${app_name}_bundle_skps" ]
1164 }
1165 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001166
1167 # should only code sign when running on a device, not the simulator
1168 if (target_cpu != "x64") {
1169 code_signing_script = "//gn/codesign_ios.py"
1170 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1171 code_signing_outputs = [
1172 "$bundle_root_dir/_CodeSignature/CodeResources",
1173 "$bundle_root_dir/embedded.mobileprovision",
1174 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001175 code_signing_args = [
1176 rebase_path("$bundle_root_dir", root_build_dir),
1177 skia_ios_identity,
1178 skia_ios_profile,
1179 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001180 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001181 }
1182 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001183 # !is_ios
1184
1185 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1186 shared_library("lib" + target_name) {
1187 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1188 configs += [ ":skia_private" ]
1189 testonly = true
1190 }
1191 } else {
1192 _executable = target_name
1193 executable(_executable) {
1194 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1195 configs += [ ":skia_private" ]
1196 testonly = true
1197 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001198 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001199 if (is_android && skia_android_serial != "" && defined(_executable)) {
1200 action("push_" + target_name) {
1201 script = "gn/push_to_android.py"
1202 deps = [
1203 ":" + _executable,
1204 ]
1205 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1206 outputs = [
1207 _stamp,
1208 ]
1209 args = [
1210 rebase_path("$root_build_dir/$_executable"),
1211 skia_android_serial,
1212 rebase_path(_stamp),
1213 ]
1214 testonly = true
1215 }
Mike Klein7d921032017-01-05 12:20:41 -05001216 }
1217 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001218 }
1219
Greg Danielda16cce2018-08-01 09:23:57 -04001220 config("moltenvk_config") {
1221 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1222 if (is_ios) {
1223 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1224 } else {
1225 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1226 }
1227 cflags = [ "-F$moltenvk_framework_path" ]
1228 ldflags = [ "-F$moltenvk_framework_path" ]
1229 libs = [
1230 "MoltenVK.framework",
1231 "Metal.framework",
1232 "IOSurface.framework",
1233 "QuartzCore.framework",
1234 "Foundation.framework",
1235 ]
1236 if (is_ios) {
1237 libs += [ "UIKit.framework" ]
1238 } else {
1239 libs += [ "IOKit.framework" ]
1240 }
1241 defines = [ "SK_MOLTENVK" ]
1242 }
1243 }
1244
1245 source_set("moltenvk") {
1246 public_configs = [ ":moltenvk_config" ]
1247 }
1248
mtkleinc095df52016-08-24 12:23:52 -07001249 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001250 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001251 public_defines = []
1252 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001253
Brian Osmanc9a42472018-05-31 13:17:12 -04001254 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001255 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001256 sources = [
1257 "tools/gpu/GrContextFactory.cpp",
1258 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001259 "tools/gpu/MemoryCache.cpp",
1260 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001261 "tools/gpu/ProxyUtils.cpp",
1262 "tools/gpu/TestContext.cpp",
1263 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1264 "tools/gpu/gl/GLTestContext.cpp",
1265 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001266 "tools/gpu/gl/null/NullGLTestContext.cpp",
1267 "tools/gpu/mock/MockTestContext.cpp",
1268 ]
1269 libs = []
1270
1271 if (is_android || skia_use_egl) {
1272 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1273 } else if (is_ios) {
1274 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1275 libs += [ "OpenGLES.framework" ]
1276 } else if (is_linux) {
1277 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001278 libs += [
1279 "GLU",
1280 "X11",
1281 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001282 } else if (is_mac) {
1283 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1284 } else if (is_win) {
1285 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1286 libs += [
1287 "Gdi32.lib",
1288 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001289 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001290 }
mtklein25c81d42016-07-27 13:55:26 -07001291
Brian Osmanc9a42472018-05-31 13:17:12 -04001292 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001293
Brian Osmanc9a42472018-05-31 13:17:12 -04001294 if (skia_use_angle) {
1295 deps += [ "//third_party/angle2" ]
1296 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1297 }
1298 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -04001299 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001300 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1301 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001302 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1303 public_deps += [ ":moltenvk" ]
1304 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001305 }
1306 if (skia_use_metal) {
1307 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001308 }
mtklein25c81d42016-07-27 13:55:26 -07001309 }
mtklein25c81d42016-07-27 13:55:26 -07001310
mtkleinc095df52016-08-24 12:23:52 -07001311 test_lib("flags") {
1312 public_include_dirs = [ "tools/flags" ]
1313 sources = [
1314 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001315 ]
1316 }
1317 test_lib("common_flags") {
1318 public_include_dirs = [ "tools/flags" ]
1319 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001320 "tools/flags/SkCommonFlags.cpp",
1321 "tools/flags/SkCommonFlagsConfig.cpp",
1322 ]
1323 deps = [
mtklein046cb562016-09-16 10:23:12 -07001324 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001325 ]
1326 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001327 ":gpu_tool_utils",
1328 ]
1329 }
mtklein25c81d42016-07-27 13:55:26 -07001330
mtkleinc095df52016-08-24 12:23:52 -07001331 test_lib("tool_utils") {
1332 public_include_dirs = [
1333 "tools",
1334 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001335 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001336 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001337 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001338 ]
1339 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001340 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001341 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001342 "tools/DDLPromiseImageHelper.cpp",
1343 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001344 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001345 "tools/ProcStats.cpp",
1346 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001347 "tools/UrlDataManager.cpp",
1348 "tools/debugger/SkDebugCanvas.cpp",
1349 "tools/debugger/SkDrawCommand.cpp",
1350 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001351 "tools/fonts/SkRandomScalerContext.cpp",
1352 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001353 "tools/fonts/SkTestFontMgr.h",
1354 "tools/fonts/SkTestSVGTypeface.cpp",
1355 "tools/fonts/SkTestSVGTypeface.h",
1356 "tools/fonts/SkTestTypeface.cpp",
1357 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001358 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001359 "tools/picture_utils.cpp",
1360 "tools/random_parse_path.cpp",
1361 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001362 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001363 "tools/trace/SkChromeTracingTracer.cpp",
1364 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001365 "tools/trace/SkDebugfTracer.cpp",
1366 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001367 "tools/trace/SkEventTracingPriv.cpp",
1368 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001369 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001370 libs = []
1371 if (is_ios) {
1372 sources += [ "tools/ios_utils.m" ]
1373 libs += [ "Foundation.framework" ]
1374 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001375 defines = []
1376 if (skia_tools_require_resources) {
1377 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1378 }
mtkleinc095df52016-08-24 12:23:52 -07001379 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001380 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001381 ":flags",
1382 "//third_party/libpng",
1383 ]
1384 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001385 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001386 "//third_party/jsoncpp",
1387 ]
1388 }
mtklein25c81d42016-07-27 13:55:26 -07001389
Mike Klein6e744122016-10-27 12:21:40 -04001390 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001391 test_lib("gm") {
1392 public_include_dirs = [ "gm" ]
1393 sources = gm_sources
1394 deps = [
scroggo19b91532016-10-24 09:03:26 -07001395 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001396 ":skia",
1397 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001398 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001399 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001400 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001401 public_deps = [
1402 ":gpu_tool_utils",
1403 ]
mtkleinc095df52016-08-24 12:23:52 -07001404 }
mtklein25c81d42016-07-27 13:55:26 -07001405
Mike Klein6e744122016-10-27 12:21:40 -04001406 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001407 test_lib("tests") {
1408 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001409 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001410 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001411 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001412 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001413 if (!(skia_use_freetype && skia_use_fontconfig)) {
1414 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1415 }
mtkleinc095df52016-08-24 12:23:52 -07001416 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001417 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001418 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001419 ":skia",
1420 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001421 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001422 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001423 "//third_party/libpng",
1424 "//third_party/zlib",
1425 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001426 public_deps = [
1427 ":gpu_tool_utils", # Test.h #includes headers from this target.
1428 ]
mtkleinc095df52016-08-24 12:23:52 -07001429 }
mtklein2f3416d2016-08-02 16:02:05 -07001430
Mike Klein6e744122016-10-27 12:21:40 -04001431 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001432 test_lib("bench") {
1433 public_include_dirs = [ "bench" ]
1434 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001435 deps = [
1436 ":flags",
1437 ":gm",
1438 ":gpu_tool_utils",
1439 ":skia",
1440 ":tool_utils",
1441 ]
1442 }
mtklein2b6870c2016-07-28 14:17:33 -07001443
mtkleinc095df52016-08-24 12:23:52 -07001444 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001445 public_include_dirs = []
1446 if (skia_use_expat) {
1447 public_include_dirs += [ "experimental/svg/model" ]
1448 sources = [
1449 "experimental/svg/model/SkSVGAttribute.cpp",
1450 "experimental/svg/model/SkSVGAttributeParser.cpp",
1451 "experimental/svg/model/SkSVGCircle.cpp",
1452 "experimental/svg/model/SkSVGClipPath.cpp",
1453 "experimental/svg/model/SkSVGContainer.cpp",
1454 "experimental/svg/model/SkSVGDOM.cpp",
1455 "experimental/svg/model/SkSVGEllipse.cpp",
1456 "experimental/svg/model/SkSVGGradient.cpp",
1457 "experimental/svg/model/SkSVGLine.cpp",
1458 "experimental/svg/model/SkSVGLinearGradient.cpp",
1459 "experimental/svg/model/SkSVGNode.cpp",
1460 "experimental/svg/model/SkSVGPath.cpp",
1461 "experimental/svg/model/SkSVGPattern.cpp",
1462 "experimental/svg/model/SkSVGPoly.cpp",
1463 "experimental/svg/model/SkSVGRadialGradient.cpp",
1464 "experimental/svg/model/SkSVGRect.cpp",
1465 "experimental/svg/model/SkSVGRenderContext.cpp",
1466 "experimental/svg/model/SkSVGSVG.cpp",
1467 "experimental/svg/model/SkSVGShape.cpp",
1468 "experimental/svg/model/SkSVGStop.cpp",
1469 "experimental/svg/model/SkSVGTransformableNode.cpp",
1470 "experimental/svg/model/SkSVGUse.cpp",
1471 "experimental/svg/model/SkSVGValue.cpp",
1472 ]
1473 deps = [
1474 ":skia",
1475 ":xml",
1476 ]
1477 }
mtkleinc095df52016-08-24 12:23:52 -07001478 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001479
Kevin Lubickebf648e2017-09-21 13:45:16 -04001480 if (target_cpu != "wasm") {
1481 test_lib("views") {
1482 public_include_dirs = [ "include/views" ]
1483 sources = [
1484 "src/views/SkEvent.cpp",
1485 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001486 "src/views/SkTouchGesture.cpp",
1487 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001488 ]
Brian Osman34755e22016-12-05 09:46:02 -05001489 }
Brian Osman16adfa32016-10-18 14:42:44 -04001490 }
1491
Mike Klein38af9432016-11-11 11:39:44 -05001492 if (skia_use_lua) {
1493 test_lib("lua") {
1494 public_include_dirs = []
1495 sources = [
1496 "src/utils/SkLua.cpp",
1497 "src/utils/SkLuaCanvas.cpp",
1498 ]
1499 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001500 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001501 "//third_party/lua",
1502 ]
1503 }
1504
Mike Kleine6682eb2017-01-05 10:54:57 -05001505 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001506 sources = [
1507 "tools/lua/lua_app.cpp",
1508 ]
1509 deps = [
1510 ":lua",
1511 ":skia",
1512 "//third_party/lua",
1513 ]
Mike Klein38af9432016-11-11 11:39:44 -05001514 }
1515
Mike Kleine6682eb2017-01-05 10:54:57 -05001516 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001517 sources = [
1518 "tools/lua/lua_pictures.cpp",
1519 ]
1520 deps = [
1521 ":flags",
1522 ":lua",
1523 ":skia",
1524 ":tool_utils",
1525 "//third_party/lua",
1526 ]
Mike Klein38af9432016-11-11 11:39:44 -05001527 }
1528 }
1529
Cary Clark8032b982017-07-28 11:04:54 -04001530 test_app("bookmaker") {
1531 sources = [
1532 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001533 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001534 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001535 "tools/bookmaker/fiddleParser.cpp",
1536 "tools/bookmaker/includeParser.cpp",
1537 "tools/bookmaker/includeWriter.cpp",
1538 "tools/bookmaker/mdOut.cpp",
1539 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001540 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001541 "tools/bookmaker/spellCheck.cpp",
1542 ]
1543 deps = [
1544 ":flags",
1545 ":skia",
1546 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001547 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001548 ]
1549 }
1550
Florin Malitae2aa7b62018-06-06 09:37:26 -04001551 if (is_linux) {
Florin Malita79725d32018-06-05 16:16:57 -04001552 test_app("skottie_tool") {
1553 deps = [
1554 "modules/skottie:tool",
1555 ]
1556 }
1557 }
1558
Kevin Lubickebf648e2017-09-21 13:45:16 -04001559 if (target_cpu != "wasm") {
1560 import("gn/samples.gni")
1561 test_lib("samples") {
1562 public_include_dirs = [ "samplecode" ]
1563 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001564 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001565 deps = [
1566 ":experimental_svg_model",
1567 ":flags",
1568 ":gm",
1569 ":tool_utils",
1570 ":views",
1571 ":xml",
Brian Osmanccb87522018-06-01 19:20:00 +00001572 "modules/sksg:samples",
Herb Derby264182c2018-05-29 15:53:40 -04001573 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001574 ]
Mike Klein38af9432016-11-11 11:39:44 -05001575
Ruiqi Maof5101492018-06-29 14:32:21 -04001576 # NIMA does not build on Windows clang
1577 if (!is_win || !is_clang) {
1578 deps += [ "//third_party/Nima-Cpp" ]
1579 }
1580
Kevin Lubickebf648e2017-09-21 13:45:16 -04001581 if (skia_use_lua) {
1582 sources += [ "samplecode/SampleLua.cpp" ]
1583 deps += [
1584 ":lua",
1585 "//third_party/lua",
1586 ]
1587 }
1588 }
Mike Klein7af351a2018-07-27 09:54:43 -04001589 test_app("imgcvt") {
1590 sources = [
1591 "tools/imgcvt.cpp",
1592 ]
1593 deps = [
1594 ":skcms",
1595 ":skia",
1596 ]
1597 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001598 test_app("dm") {
1599 sources = [
1600 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001601 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001602 "dm/DMJsonWriter.cpp",
1603 "dm/DMSrcSink.cpp",
1604 ]
1605 include_dirs = [ "tests" ]
1606 deps = [
1607 ":common_flags",
1608 ":experimental_svg_model",
1609 ":flags",
1610 ":gm",
1611 ":gpu_tool_utils",
1612 ":skia",
1613 ":tests",
1614 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001615 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001616 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001617 "//third_party/jsoncpp",
1618 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001619 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001620
1621 # NIMA does not build on Windows clang
1622 if (!is_win || !is_clang) {
1623 deps += [ "//third_party/Nima-Cpp" ]
1624 }
Mike Klein38af9432016-11-11 11:39:44 -05001625 }
Brian Osman16adfa32016-10-18 14:42:44 -04001626 }
1627
Mike Kleina8a51ce2018-01-09 12:34:11 -05001628 if (!is_win) {
1629 test_app("remote_demo") {
1630 sources = [
1631 "tools/remote_demo.cpp",
1632 ]
1633 deps = [
1634 ":skia",
1635 ]
1636 }
1637 }
1638
Mike Kleine6682eb2017-01-05 10:54:57 -05001639 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001640 sources = [
1641 "bench/nanobench.cpp",
1642 ]
1643 deps = [
1644 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001645 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001646 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001647 ":flags",
1648 ":gm",
1649 ":gpu_tool_utils",
1650 ":skia",
1651 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001652 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001653 "//third_party/jsoncpp",
1654 ]
mtklein2b6870c2016-07-28 14:17:33 -07001655 }
halcanary19a97202016-08-03 15:08:04 -07001656
Ravi Mistry10d36c52017-01-31 09:49:18 -05001657 test_app("skpinfo") {
1658 sources = [
1659 "tools/skpinfo.cpp",
1660 ]
1661 deps = [
1662 ":flags",
1663 ":skia",
1664 ]
1665 }
1666
Brian Osmanc9a42472018-05-31 13:17:12 -04001667 test_app("skpbench") {
1668 sources = [
1669 "tools/skpbench/skpbench.cpp",
1670 ]
1671 deps = [
1672 ":flags",
1673 ":gpu_tool_utils",
1674 ":skia",
1675 ":tool_utils",
1676 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001677 }
1678
Mike Kleine6682eb2017-01-05 10:54:57 -05001679 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001680 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001681 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001682 ]
1683 deps = [
1684 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001685 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001686 ]
halcanary3eee9d92016-09-10 07:01:53 -07001687 }
mtklein046cb562016-09-16 10:23:12 -07001688
Ben Wagner219f3622017-07-17 15:32:25 -04001689 test_app("create_test_font") {
1690 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001691 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001692 ]
1693 deps = [
1694 ":skia",
1695 ]
1696 assert_no_deps = [
1697 # tool_utils requires the output of this app.
1698 ":tool_utils",
1699 ]
1700 }
1701
Florin Malita5d3ff432018-07-31 16:38:43 -04001702 if (skia_use_expat) {
1703 test_app("create_test_font_color") {
1704 sources = [
1705 "tools/fonts/create_test_font_color.cpp",
1706 ]
1707 deps = [
1708 ":flags",
1709 ":skia",
1710 ":tool_utils",
1711 ]
1712 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001713 }
1714
Mike Kleine6682eb2017-01-05 10:54:57 -05001715 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001716 sources = [
1717 "tools/get_images_from_skps.cpp",
1718 ]
1719 deps = [
1720 ":flags",
1721 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001722 ]
mtklein046cb562016-09-16 10:23:12 -07001723 }
mtkleinecbc5262016-09-22 11:51:24 -07001724
Kevin Lubickebf648e2017-09-21 13:45:16 -04001725 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001726 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001727 sources = [
1728 "tools/skiaserve/Request.cpp",
1729 "tools/skiaserve/Response.cpp",
1730 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001731 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1732 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1733 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1734 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1735 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1736 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1737 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1738 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1739 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001740 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1741 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001742 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1743 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1744 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1745 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1746 ]
1747 deps = [
1748 ":flags",
1749 ":gpu_tool_utils",
1750 ":skia",
1751 ":tool_utils",
1752 "//third_party/jsoncpp",
1753 "//third_party/libmicrohttpd",
1754 "//third_party/libpng",
1755 ]
Mike Klein7d302882016-11-03 14:06:31 -04001756 }
mtkleinecbc5262016-09-22 11:51:24 -07001757 }
kjlubick14f984b2016-10-03 11:49:45 -07001758
Mike Kleine6682eb2017-01-05 10:54:57 -05001759 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001760 include_dirs = [
1761 "tools",
1762 "tools/debugger",
1763 ]
kjlubick14f984b2016-10-03 11:49:45 -07001764 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001765 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001766 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001767 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001768 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001769 "fuzz/FuzzGradients.cpp",
1770 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001771 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001772 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001773 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001774 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001775 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001776 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1777 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001778 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001779 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001780 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001781 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1782 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001783 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001784 "tools/UrlDataManager.cpp",
1785 "tools/debugger/SkDebugCanvas.cpp",
1786 "tools/debugger/SkDrawCommand.cpp",
1787 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001788 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001789 ]
1790 deps = [
1791 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001792 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001793 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001794 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001795 "//third_party/jsoncpp",
1796 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001797 ]
kjlubick14f984b2016-10-03 11:49:45 -07001798 }
Mike Klein38312422016-10-05 15:41:01 -04001799
Mike Kleine6682eb2017-01-05 10:54:57 -05001800 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001801 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001802 rebase_path("tests/skia_test.cpp"),
1803 rebase_path("tests/Test.cpp"),
1804 ]
caryclark9feb6322016-10-25 08:58:26 -07001805 deps = [
1806 ":flags",
1807 ":gpu_tool_utils",
1808 ":skia",
1809 ":tool_utils",
1810 ]
caryclark9feb6322016-10-25 08:58:26 -07001811 }
1812
Mike Kleine6682eb2017-01-05 10:54:57 -05001813 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001814 sources = [
1815 "tools/DumpRecord.cpp",
1816 "tools/dump_record.cpp",
1817 ]
1818 deps = [
1819 ":flags",
1820 ":skia",
1821 ]
Mike Klein38312422016-10-05 15:41:01 -04001822 }
bungemanfe917272016-10-13 17:36:40 -04001823
Mike Kleine6682eb2017-01-05 10:54:57 -05001824 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001825 sources = [
1826 "tools/skdiff/skdiff.cpp",
1827 "tools/skdiff/skdiff_html.cpp",
1828 "tools/skdiff/skdiff_main.cpp",
1829 "tools/skdiff/skdiff_utils.cpp",
1830 ]
1831 deps = [
1832 ":skia",
1833 ":tool_utils",
1834 ]
bungemanfe917272016-10-13 17:36:40 -04001835 }
halcanarya73d76a2016-10-17 13:19:02 -07001836
Mike Kleine6682eb2017-01-05 10:54:57 -05001837 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001838 sources = [
1839 "tools/skp_parser.cpp",
1840 ]
1841 deps = [
1842 ":skia",
1843 ":tool_utils",
1844 "//third_party/jsoncpp",
1845 ]
halcanarya73d76a2016-10-17 13:19:02 -07001846 }
Brian Osman16adfa32016-10-18 14:42:44 -04001847
Brian Osmanc9a42472018-05-31 13:17:12 -04001848 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001849 test_lib("skqp_lib") {
1850 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001851 defines =
1852 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001853 if (skia_skqp_enable_driver_correctness_workarounds) {
1854 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1855 }
Hal Canary75427132017-10-11 16:00:31 -04001856 sources = [
1857 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001858 "tools/skqp/gm_knowledge.cpp",
1859 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001860 ]
1861 deps = [
1862 ":gm",
1863 ":gpu_tool_utils",
1864 ":skia",
1865 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001866 ":tool_utils",
1867 ]
1868 }
1869 test_app("skqp") {
1870 sources = [
1871 "tools/skqp/skqp.cpp",
1872 ]
1873 deps = [
1874 ":skia",
1875 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001876 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001877 "//third_party/googletest",
1878 ]
1879 }
1880 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001881 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001882 test_app("skqp_app") {
1883 is_shared_library = true
1884 sources = [
1885 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1886 ]
1887 deps = [
1888 ":skia",
1889 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001890 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001891 ]
1892 libs = [ "android" ]
1893 }
1894 }
Stan Iliev93151722018-08-02 11:10:52 -04001895 if (is_android && skia_enable_gpu) {
1896 test_app("skottie_android") {
1897 is_shared_library = true
1898
1899 sources = [
1900 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
1901 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
1902 ]
1903 libs = []
1904
1905 include_dirs = []
1906 deps = [
1907 ":skia",
1908 "modules/skottie",
1909 ]
1910 }
1911 }
Hal Canary75427132017-10-11 16:00:31 -04001912
Hal Canarya9de7602018-01-19 13:08:23 -05001913 test_app("list_gms") {
1914 sources = [
1915 "tools/list_gms.cpp",
1916 ]
1917 deps = [
1918 ":gm",
1919 ":skia",
1920 ]
1921 }
1922 test_app("list_gpu_unit_tests") {
1923 sources = [
1924 "dm/DMGpuTestProcs.cpp",
1925 "tools/list_gpu_unit_tests.cpp",
1926 ]
1927 deps = [
1928 ":skia",
1929 ":tests",
1930 ]
1931 }
1932
Brian Osmanc9a42472018-05-31 13:17:12 -04001933 test_lib("sk_app") {
1934 public_include_dirs = [ "tools/sk_app" ]
1935 sources = [
1936 "tools/sk_app/CommandSet.cpp",
1937 "tools/sk_app/GLWindowContext.cpp",
1938 "tools/sk_app/Window.cpp",
1939 ]
1940 libs = []
1941
1942 if (is_android) {
1943 sources += [
1944 "tools/sk_app/android/GLWindowContext_android.cpp",
1945 "tools/sk_app/android/RasterWindowContext_android.cpp",
1946 "tools/sk_app/android/Window_android.cpp",
1947 "tools/sk_app/android/main_android.cpp",
1948 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001949 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001950 libs += [ "android" ]
1951 } else if (is_linux) {
1952 sources += [
1953 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1954 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1955 "tools/sk_app/unix/Window_unix.cpp",
1956 "tools/sk_app/unix/keysym2ucs.c",
1957 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001958 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001959 libs += [
1960 "GL",
1961 "X11",
1962 ]
1963 } else if (is_win) {
1964 sources += [
1965 "tools/sk_app/win/GLWindowContext_win.cpp",
1966 "tools/sk_app/win/RasterWindowContext_win.cpp",
1967 "tools/sk_app/win/Window_win.cpp",
1968 "tools/sk_app/win/main_win.cpp",
1969 ]
Brian Salomon194db172017-08-17 14:37:06 -04001970 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001971 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001972 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001973 } else if (is_mac) {
1974 sources += [
1975 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1976 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1977 "tools/sk_app/mac/Window_mac.cpp",
1978 "tools/sk_app/mac/main_mac.cpp",
1979 ]
1980 libs += [
1981 "QuartzCore.framework",
1982 "Cocoa.framework",
1983 "Foundation.framework",
1984 ]
1985 } else if (is_ios) {
1986 sources += [
1987 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1988 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1989 "tools/sk_app/ios/Window_ios.cpp",
1990 "tools/sk_app/ios/main_ios.cpp",
1991 ]
1992 }
1993
1994 if (skia_use_vulkan) {
1995 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1996 if (is_android) {
1997 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1998 } else if (is_linux) {
1999 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2000 libs += [ "X11-xcb" ]
2001 } else if (is_win) {
2002 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2003 }
2004 }
2005
2006 deps = [
2007 ":gpu_tool_utils",
2008 ":skia",
2009 ":tool_utils",
2010 ":views",
2011 ]
2012 if (is_android) {
2013 deps += [ "//third_party/native_app_glue" ]
2014 } else if (is_mac || is_ios) {
2015 deps += [ "//third_party/libsdl" ]
2016 }
2017 if (skia_use_angle) {
2018 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002019 }
Brian Osman16adfa32016-10-18 14:42:44 -04002020 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002021
Brian Osmanc9a42472018-05-31 13:17:12 -04002022 test_app("viewer") {
2023 is_shared_library = is_android
2024 if (is_ios) {
2025 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002026 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002027 sources = [
2028 "tools/viewer/BisectSlide.cpp",
2029 "tools/viewer/GMSlide.cpp",
2030 "tools/viewer/ImGuiLayer.cpp",
2031 "tools/viewer/ImageSlide.cpp",
2032 "tools/viewer/SKPSlide.cpp",
2033 "tools/viewer/SampleSlide.cpp",
2034 "tools/viewer/SkottieSlide.cpp",
2035 "tools/viewer/SlideDir.cpp",
2036 "tools/viewer/StatsLayer.cpp",
2037 "tools/viewer/SvgSlide.cpp",
2038 "tools/viewer/Viewer.cpp",
2039 ]
2040 libs = []
2041
2042 include_dirs = []
2043 deps = [
2044 ":experimental_svg_model",
2045 ":flags",
2046 ":gm",
2047 ":gpu_tool_utils",
2048 ":samples",
2049 ":sk_app",
2050 ":skia",
2051 ":tool_utils",
2052 ":views",
2053 "modules/skottie",
2054 "modules/sksg",
2055 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002056 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002057
2058 # NIMA does not build on Windows clang
2059 if (!is_win || !is_clang) {
2060 sources += [ "tools/viewer/NIMASlide.cpp" ]
2061 deps += [ "//third_party/Nima-Cpp" ]
2062 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002063 }
2064
ziadbbceddbc2018-06-19 13:57:15 -04002065 if (is_android) {
2066 test_app("arcore") {
2067 is_shared_library = true
2068 configs = [
2069 ":skia_public",
2070 "gn:default",
2071 ]
2072
2073 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2074 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2075 sources = []
2076 sources += skia_core_sources
2077 sources += skia_utils_sources
2078 sources += skia_xps_sources
2079 sources += [
2080 "src/android/SkAndroidFrameworkUtils.cpp",
2081 "src/android/SkAnimatedImage.cpp",
2082 "src/android/SkBitmapRegionCodec.cpp",
2083 "src/android/SkBitmapRegionDecoder.cpp",
2084 "src/codec/SkAndroidCodec.cpp",
2085 "src/codec/SkBmpBaseCodec.cpp",
2086 "src/codec/SkBmpCodec.cpp",
2087 "src/codec/SkBmpMaskCodec.cpp",
2088 "src/codec/SkBmpRLECodec.cpp",
2089 "src/codec/SkBmpStandardCodec.cpp",
2090 "src/codec/SkCodec.cpp",
2091 "src/codec/SkCodecImageGenerator.cpp",
2092 "src/codec/SkColorTable.cpp",
2093 "src/codec/SkGifCodec.cpp",
2094 "src/codec/SkMaskSwizzler.cpp",
2095 "src/codec/SkMasks.cpp",
2096 "src/codec/SkSampledCodec.cpp",
2097 "src/codec/SkSampler.cpp",
2098 "src/codec/SkStreamBuffer.cpp",
2099 "src/codec/SkSwizzler.cpp",
2100 "src/codec/SkWbmpCodec.cpp",
2101 "src/images/SkImageEncoder.cpp",
2102 "src/ports/SkDiscardableMemory_none.cpp",
2103 "src/ports/SkImageGenerator_skia.cpp",
2104 "src/ports/SkMemory_malloc.cpp",
2105 "src/ports/SkOSFile_stdio.cpp",
2106 "src/sfnt/SkOTTable_name.cpp",
2107 "src/sfnt/SkOTUtils.cpp",
2108 "src/utils/mac/SkStream_mac.cpp",
2109 "third_party/gif/SkGifImageReader.cpp",
2110 ]
2111 deps = [
2112 ":tool_utils",
2113 "modules/skottie",
2114 "modules/skshaper",
2115 ]
2116 }
2117 }
2118
Brian Osmanc9a42472018-05-31 13:17:12 -04002119 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002120 test_app("HelloWorld") {
2121 sources = [
2122 "example/HelloWorld.cpp",
2123 ]
2124 libs = []
2125
2126 include_dirs = []
2127 deps = [
2128 ":flags",
2129 ":gpu_tool_utils",
2130 ":sk_app",
2131 ":skia",
2132 ":tool_utils",
2133 ":views",
2134 ]
2135 }
2136 }
2137
Brian Osmanc9a42472018-05-31 13:17:12 -04002138 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002139 test_app("SkiaSDLExample") {
2140 sources = [
2141 "example/SkiaSDLExample.cpp",
2142 ]
2143 libs = []
2144 include_dirs = []
2145 deps = [
2146 ":gpu_tool_utils",
2147 ":skia",
2148 "//third_party/libsdl",
2149 ]
2150 }
2151 }
2152
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002153 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2154 action_foreach("generate_mocs") {
2155 script = "gn/call.py"
2156 sources = [
2157 "tools/mdbviz/MainWindow.h",
2158 ]
2159 outputs = [
2160 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2161 ]
2162 args = [
2163 "$skia_qt_path" + "/bin/moc",
2164 "{{source}}",
2165 "-o",
2166 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2167 ]
2168 }
2169 action_foreach("generate_resources") {
2170 script = "gn/call.py"
2171 sources = [
2172 "tools/mdbviz/resources.qrc",
2173 ]
2174 outputs = [
2175 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2176 ]
2177 args = [
2178 "$skia_qt_path" + "/bin/rcc",
2179 "{{source}}",
2180 "-o",
2181 "gen/mdbviz/{{source_name_part}}_res.cpp",
2182 ]
2183 }
2184 test_app("mdbviz") {
2185 if (is_win) {
2186 # on Windows we need to disable some exception handling warnings due to the Qt headers
2187 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2188 }
2189 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002190 "tools/UrlDataManager.cpp",
2191 "tools/debugger/SkDebugCanvas.cpp",
2192 "tools/debugger/SkDrawCommand.cpp",
2193 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002194 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002195 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002196 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002197 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002198
2199 # generated files
2200 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2201 "$target_gen_dir/mdbviz/resources_res.cpp",
2202 ]
2203 lib_dirs = [ "$skia_qt_path/lib" ]
2204 libs = [
2205 "Qt5Core.lib",
2206 "Qt5Gui.lib",
2207 "Qt5Widgets.lib",
2208 ]
2209 include_dirs = [
2210 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002211 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002212 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002213 "tools",
2214 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002215 ]
2216 deps = [
2217 ":generate_mocs",
2218 ":generate_resources",
2219 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002220 "//third_party/jsoncpp",
2221 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002222 ]
2223 }
2224 }
2225
Mike Kleine459afd2017-03-03 09:21:30 -05002226 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002227 copy("gdbserver") {
2228 sources = [
2229 "$ndk/$ndk_gdbserver",
2230 ]
2231 outputs = [
2232 "$root_out_dir/gdbserver",
2233 ]
2234 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002235 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002236
2237 if (skia_use_opencl) {
2238 test_app("hello-opencl") {
2239 sources = [
2240 "src/compute/common/cl/assert_cl.c",
2241 "src/compute/common/cl/find_cl.c",
2242 "tools/hello-opencl.cpp",
2243 ]
2244 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002245 if (is_linux) {
2246 libs = [ "OpenCL" ]
2247 } else if (is_win) {
2248 libs = [ "OpenCL.lib" ]
2249 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002250 }
2251 }
mtklein25c81d42016-07-27 13:55:26 -07002252}