blob: 3fa93441ade8b8166d79766b552cfd33c5e164df [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
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050035 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050036 skia_enable_effects = true
Mike Reed0917fad2018-06-19 10:17:30 -040037 skia_enable_effects_imagefilters = 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
Mike Klein4d598a32016-10-31 13:44:49 -040063 if (is_android) {
64 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070065 } else if (is_fuchsia) {
66 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040067 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040068 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
69 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040070 }
Jim Van Verth4e502972017-12-07 15:16:10 -050071
72 if (is_ios) {
73 skia_ios_identity = ".*Google.*"
74 skia_ios_profile = "Google Development"
75 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040076}
Brian Salomon789e25e2016-09-30 13:41:03 -040077
Adam Barth54ef74a2017-10-13 10:59:38 -070078if (defined(skia_settings)) {
79 import(skia_settings)
80}
81
Brian Osmanc9a42472018-05-31 13:17:12 -040082# Our tools require static linking (they use non-exported symbols), and the GPU backend.
83skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070084
mtkleina45be612016-08-29 15:22:10 -070085fontmgr_android_enabled = skia_use_expat && skia_use_freetype
86
mtklein1211e0c2016-07-26 13:55:45 -070087skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070088 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070089 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070090 "include/codec",
91 "include/config",
92 "include/core",
93 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040094 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070095 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050096 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070097 "include/pathops",
98 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070099 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/utils",
101 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700102]
103
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500104if (skia_enable_atlas_text) {
105 skia_public_includes += [ "include/atlastext" ]
106}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000107
mtkleinc04ff472016-06-23 10:29:30 -0700108# Skia public API, generally provided by :skia.
109config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700110 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400111 defines = []
112 if (is_component_build) {
113 defines += [ "SKIA_DLL" ]
114 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400115 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700116 defines += [ "SK_SAMPLES_FOR_X" ]
117 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400118 if (skia_enable_flutter_defines) {
119 defines += flutter_defines
120 }
mtklein06c35c02016-09-20 12:28:12 -0700121 if (!skia_enable_gpu) {
122 defines += [ "SK_SUPPORT_GPU=0" ]
123 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500124 if (skia_enable_atlas_text) {
125 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
126 }
mtkleinc04ff472016-06-23 10:29:30 -0700127}
128
129# Skia internal APIs, used by Skia itself and a few test tools.
130config("skia_private") {
131 visibility = [ ":*" ]
132
133 include_dirs = [
134 "include/private",
135 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700136 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700137 "src/core",
138 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700139 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700140 "src/image",
141 "src/images",
142 "src/lazy",
143 "src/opts",
144 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700145 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700146 "src/ports",
147 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400148 "src/shaders",
149 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700150 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700151 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700152 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500153 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700154 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700155 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400156 if (skia_llvm_path != "") {
157 include_dirs += [ "$skia_llvm_path/include" ]
158 }
mtklein150d1132016-08-01 06:56:40 -0700159
Mike Reeda9e241d2017-05-03 10:52:00 -0400160 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700161 if (is_android) {
162 defines += [
163 "SK_GAMMA_EXPONENT=1.4",
164 "SK_GAMMA_CONTRAST=0.0",
165 ]
166 }
mtklein88a7ac02016-09-14 11:16:49 -0700167 if (is_official_build || is_android) {
168 # TODO(bsalomon): it'd be nice to make Android normal.
169 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
170 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400171 libs = []
172 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500173 if (skia_enable_gpu) {
174 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500175 if (is_skia_dev_build && skia_use_vulkan) {
176 include_dirs += [ "tools/gpu/vk" ]
177 }
Brian Salomon03e05842017-02-23 12:23:47 -0500178 }
Brian Osman34755e22016-12-05 09:46:02 -0500179 if (skia_use_angle) {
180 defines += [ "SK_ANGLE" ]
181 }
Brian Osman3f375d02016-12-28 11:19:22 -0500182 if (skia_enable_discrete_gpu) {
183 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
184 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400185 if (!is_official_build) {
186 defines += [ "GR_TEST_UTILS=1" ]
187 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400188 if (skia_llvm_path != "") {
189 defines += [ "SK_LLVM_AVAILABLE" ]
190 include_dirs += [ "$skia_llvm_path/include" ]
191 libs += [ skia_llvm_lib ]
192 lib_dirs += [ "$skia_llvm_path/lib/" ]
193 }
mtkleinc04ff472016-06-23 10:29:30 -0700194}
195
196# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
197config("skia_library") {
198 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700199 defines = [ "SKIA_IMPLEMENTATION=1" ]
200}
201
202skia_library_configs = [
203 ":skia_public",
204 ":skia_private",
205 ":skia_library",
206]
207
mtklein9b8583d2016-08-24 17:32:30 -0700208# Use for CPU-specific Skia code that needs particular compiler flags.
209template("opts") {
210 if (invoker.enabled) {
211 source_set(target_name) {
212 forward_variables_from(invoker, "*")
213 configs += skia_library_configs
214 }
215 } else {
216 # If not enabled, a phony empty target that swallows all otherwise unused variables.
217 source_set(target_name) {
218 forward_variables_from(invoker,
219 "*",
220 [
221 "sources",
222 "cflags",
223 ])
224 }
225 }
anmittala7eaf2e2016-08-17 13:57:26 -0700226}
227
mtklein422310d2016-08-16 18:28:43 -0700228is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700229
mtklein7d6fb2c2016-08-25 14:50:44 -0700230opts("none") {
231 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700232 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700233 cflags = []
234}
235
mtklein7d6fb2c2016-08-25 14:50:44 -0700236opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700237 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700239 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700240}
241
242opts("arm64") {
243 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700245 cflags = []
246}
247
248opts("crc32") {
249 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700251 cflags = [ "-march=armv8-a+crc" ]
252}
253
mtklein9b8583d2016-08-24 17:32:30 -0700254opts("sse2") {
255 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400257 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400258 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
259 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400260 cflags = [ "-msse2" ]
261 }
mtklein9b8583d2016-08-24 17:32:30 -0700262}
mtkleinc04ff472016-06-23 10:29:30 -0700263
mtklein9b8583d2016-08-24 17:32:30 -0700264opts("ssse3") {
265 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400267 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400268 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
269 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400270 cflags = [ "-mssse3" ]
271 }
mtklein9b8583d2016-08-24 17:32:30 -0700272}
mtkleinc04ff472016-06-23 10:29:30 -0700273
mtklein9b8583d2016-08-24 17:32:30 -0700274opts("sse41") {
275 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700276 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400277 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400278 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
279 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400280 cflags = [ "-msse4.1" ]
281 }
mtklein9b8583d2016-08-24 17:32:30 -0700282}
mtklein4e976072016-08-08 09:06:27 -0700283
mtklein9b8583d2016-08-24 17:32:30 -0700284opts("sse42") {
285 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700286 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400287 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400288 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
289 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400290 cflags = [ "-msse4.2" ]
291 }
mtklein9b8583d2016-08-24 17:32:30 -0700292}
293
294opts("avx") {
295 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700296 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400297 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000298 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400299 } else {
300 cflags = [ "-mavx" ]
301 }
mtkleinc04ff472016-06-23 10:29:30 -0700302}
303
Mike Klein1b9b7d52018-02-27 10:37:40 -0500304opts("hsw") {
305 enabled = is_x86
306 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400307 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500308 cflags = [ "/arch:AVX2" ]
309 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000310 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500311 }
312
313 # Oddly, clang-cl doesn't recognize this as a valid flag.
314 # If it ever does, it'd nice to move this up with -mavx2 and co.
315 if (is_clang && !is_win) {
316 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
317 # but nice to have, generating slightly better code for paths without explicit FMAs.
318 cflags += [ "-ffp-contract=fast" ]
319 }
320}
321
mtkleinc095df52016-08-24 12:23:52 -0700322# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700323template("optional") {
324 if (invoker.enabled) {
325 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700326 if (defined(invoker.public_defines)) {
327 defines = invoker.public_defines
328 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600329 if (defined(invoker.public_configs)) {
330 configs = invoker.public_configs
331 }
mtklein457b42a2016-08-23 13:56:37 -0700332 }
333 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700334 forward_variables_from(invoker,
335 "*",
336 [
337 "public_defines",
338 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700339 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700340 ])
mtklein457b42a2016-08-23 13:56:37 -0700341 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700342 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700343 if (defined(invoker.configs_to_remove)) {
344 configs -= invoker.configs_to_remove
345 }
mtklein457b42a2016-08-23 13:56:37 -0700346 }
347 } else {
mtklein457b42a2016-08-23 13:56:37 -0700348 source_set(target_name) {
349 forward_variables_from(invoker,
350 "*",
351 [
352 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400353 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700354 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700355 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700356 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700357 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700358 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700359 ])
mtkleincd01b032016-08-31 04:58:19 -0700360 if (defined(invoker.sources_when_disabled)) {
361 sources = invoker.sources_when_disabled
362 }
363 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700364 }
mtkleineb3c4252016-08-23 07:38:09 -0700365 }
mtklein457b42a2016-08-23 13:56:37 -0700366}
mtklein457b42a2016-08-23 13:56:37 -0700367
Mike Kleina04bb452017-02-09 12:24:07 -0500368optional("effects") {
369 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400370 deps = [
371 ":compile_processors",
372 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500373 sources =
374 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
Mike Reed0917fad2018-06-19 10:17:30 -0400375 if (skia_enable_effects_imagefilters) {
376 sources += skia_effects_imagefilter_sources
377 } else {
378 sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
379 }
380 sources_when_disabled = [
381 "src/ports/SkGlobalInitialization_none.cpp",
382 "src/ports/SkGlobalInitialization_none_imagefilters.cpp",
383 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500384}
385
mtkleina45be612016-08-29 15:22:10 -0700386optional("fontmgr_android") {
387 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700388
389 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500390 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700391 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700392 ]
393 sources = [
394 "src/ports/SkFontMgr_android.cpp",
395 "src/ports/SkFontMgr_android_factory.cpp",
396 "src/ports/SkFontMgr_android_parser.cpp",
397 ]
398}
399
mtkleind2e39db2016-09-07 07:52:55 -0700400optional("fontmgr_custom") {
401 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
402
403 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500404 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700405 ]
406 sources = [
407 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500408 "src/ports/SkFontMgr_custom.h",
409 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700410 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500411 "src/ports/SkFontMgr_custom_embedded.cpp",
412 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700413 ]
414}
415
Hal Canaryff2742e2018-01-30 11:35:47 -0500416optional("fontmgr_empty") {
417 enabled = skia_enable_fontmgr_empty
418 sources = [
419 "src/ports/SkFontMgr_empty_factory.cpp",
420 ]
421}
422
mtklein3cc22182016-08-29 13:26:14 -0700423optional("fontmgr_fontconfig") {
424 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700425
426 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500427 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700428 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700429 ]
430 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700431 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700432 "src/ports/SkFontConfigInterface_direct.cpp",
433 "src/ports/SkFontConfigInterface_direct_factory.cpp",
434 "src/ports/SkFontMgr_FontConfigInterface.cpp",
435 "src/ports/SkFontMgr_fontconfig.cpp",
436 "src/ports/SkFontMgr_fontconfig_factory.cpp",
437 ]
438}
439
mtkleincdedd0e2016-09-12 15:15:44 -0700440optional("fontmgr_fuchsia") {
441 enabled = is_fuchsia && skia_use_freetype
442
443 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500444 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700445 ]
446 sources = [
447 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500448 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700449 "src/ports/SkFontMgr_custom_empty_factory.cpp",
450 ]
451}
452
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700453if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400454 executable("sksllex") {
455 sources = [
456 "src/sksl/lex/Main.cpp",
457 "src/sksl/lex/NFA.cpp",
458 "src/sksl/lex/RegexNode.cpp",
459 "src/sksl/lex/RegexParser.cpp",
460 ]
461 include_dirs = [ "src/sksl/lex" ]
462 }
463
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700464 action("run_sksllex") {
465 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400466 deps = [
467 ":sksllex(//gn/toolchain:$host_toolchain)",
468 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700469 sources = [
470 "src/sksl/lex/layout.lex",
471 "src/sksl/lex/sksl.lex",
472 ]
473
474 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
475 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
476 outputs = [
477 "$target_out_dir/" +
478 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
479 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
480 # confused due to the same file being named by two different paths
481 ]
482 sksllex_path = "$root_out_dir/"
483 sksllex_path += "sksllex"
484 if (host_os == "win") {
485 sksllex_path += ".exe"
486 }
487 args = [
488 rebase_path(sksllex_path),
489 rebase_path("bin/clang-format"),
490 rebase_path("src"),
491 ]
492 }
493} else {
494 group("run_sksllex") {
495 }
496}
497
498if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400499 executable("skslc") {
500 defines = [ "SKSL_STANDALONE" ]
501 sources = [
502 "src/sksl/SkSLMain.cpp",
503 ]
504 sources += skia_sksl_sources
505 include_dirs = [
506 "src/gpu",
507 "src/sksl",
508 ]
509 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500510 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400511 "//third_party/spirv-tools",
512 ]
513 }
514
515 skia_gpu_processor_outputs = []
516 foreach(src, skia_gpu_processor_sources) {
517 dir = get_path_info(src, "dir")
518 name = get_path_info(src, "name")
519
520 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
521 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
522 skia_gpu_processor_outputs += [
523 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
524 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
525 # confused due to the same file being named by two different paths
526 ]
527 }
528
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500529 action("create_sksl_enums") {
530 script = "gn/create_sksl_enums.py"
531 sources = [
532 "include/private/GrSharedEnums.h",
533 ]
534 outputs = [
535 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500536 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500537 ]
538 args = [
539 rebase_path(sources[0]),
540 rebase_path(outputs[0]),
541 ]
542 }
543
Ethan Nicholas762466e2017-06-29 10:03:38 -0400544 action("compile_processors") {
545 script = "gn/compile_processors.py"
546 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500547 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400548 ":skslc(//gn/toolchain:$host_toolchain)",
549 ]
550 sources = skia_gpu_processor_sources
551 outputs = skia_gpu_processor_outputs
552 skslc_path = "$root_out_dir/"
553 if (host_toolchain != default_toolchain_name) {
554 skslc_path += "$host_toolchain/"
555 }
556 skslc_path += "skslc"
557 if (host_os == "win") {
558 skslc_path += ".exe"
559 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400560 args = [
561 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400562 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400563 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400564 args += rebase_path(skia_gpu_processor_sources)
565 }
566} else {
567 skia_gpu_processor_outputs = []
568 group("compile_processors") {
569 }
570}
571
mtklein06c35c02016-09-20 12:28:12 -0700572optional("gpu") {
573 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 deps = [
575 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700576 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400577 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700578 if (skia_generate_workarounds) {
579 deps += [ ":workaround_list" ]
580 }
mtkleine9fb3d52016-09-20 15:11:46 -0700581 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600582 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400583 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700584
Brian Salomon3d6801e2017-12-11 10:06:31 -0500585 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700586
587 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500588 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700589 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400590 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700591 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400592 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400593
594 # this lib is required to link against AHardwareBuffer
595 if (defined(ndk_api) && ndk_api >= 26) {
596 libs += [ "android" ]
597 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400598 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500599 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400600 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700601 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500602 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400603 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700604 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500605 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800606 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500607 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400608 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500609 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400610 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700611 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700613 }
mtkleine9fb3d52016-09-20 15:11:46 -0700614
615 if (skia_use_vulkan) {
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400616 # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
617 # //third_party/vulkan directory in their trees so they can set up the vulkan library however
618 # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
619 # vulkan files.
620 public_deps += [ "third_party/vulkan" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400621 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700622 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700623 if (skia_enable_vulkan_debug_layers) {
624 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
625 }
mtkleine9fb3d52016-09-20 15:11:46 -0700626 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400627
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400628 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400629 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400630 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
631 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400632
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400633 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400634 if (skia_use_metal) {
635 public_defines += [ "SK_METAL" ]
636 sources += skia_metal_sources
637 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400638 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400639 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500640
641 if (skia_enable_atlas_text) {
642 sources += skia_atlas_text_sources
643 }
mtklein06c35c02016-09-20 12:28:12 -0700644}
645
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400646optional("heif") {
647 enabled = skia_use_libheif
648 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
649
650 deps = []
651
652 sources = [
653 "src/codec/SkHeifCodec.cpp",
654 ]
655}
656
mtklein63213812016-08-24 09:55:56 -0700657optional("jpeg") {
658 enabled = skia_use_libjpeg_turbo
659 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
660
mtklein63213812016-08-24 09:55:56 -0700661 deps = [
662 "//third_party/libjpeg-turbo:libjpeg",
663 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400664 public = [
665 "include/encode/SkJpegEncoder.h",
666 ]
mtklein63213812016-08-24 09:55:56 -0700667 sources = [
668 "src/codec/SkJpegCodec.cpp",
669 "src/codec/SkJpegDecoderMgr.cpp",
670 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700671 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400672 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700673 ]
674}
675
676optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500677 enabled = skia_use_zlib && skia_enable_pdf
678 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700679
mtklein63213812016-08-24 09:55:56 -0700680 deps = [
681 "//third_party/zlib",
682 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400683 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700684 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400685 }
brettwb9447282016-09-01 14:24:39 -0700686 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700687 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700688
689 if (skia_use_sfntly) {
690 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500691 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700692 }
693}
694
695optional("png") {
696 enabled = skia_use_libpng
697 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
698
mtklein63213812016-08-24 09:55:56 -0700699 deps = [
700 "//third_party/libpng",
701 ]
702 sources = [
703 "src/codec/SkIcoCodec.cpp",
704 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400705 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700706 ]
707}
708
scroggof84ad642016-10-31 09:02:57 -0700709optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400710 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700711 public_defines = [ "SK_CODEC_DECODES_RAW" ]
712
713 deps = [
714 "//third_party/dng_sdk",
715 "//third_party/libjpeg-turbo:libjpeg",
716 "//third_party/piex",
717 ]
718
719 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
720 # Skia.
721 configs_to_remove = [ "//gn:no_exceptions" ]
722
723 sources = [
724 "src/codec/SkRawAdapterCodec.cpp",
725 "src/codec/SkRawCodec.cpp",
726 ]
727}
728
Mike Klein852a8cb2018-05-15 10:46:58 -0400729import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400730source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400731 cflags = []
732 if (!is_win || is_clang) {
733 cflags += [
734 "-w",
735 "-std=c11",
736 ]
737 }
738
739 public = [
740 "third_party/skcms/skcms.h",
741 ]
742 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
743}
744
mtklein3cc22182016-08-29 13:26:14 -0700745optional("typeface_freetype") {
746 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700747
748 deps = [
749 "//third_party/freetype2",
750 ]
751 sources = [
752 "src/ports/SkFontHost_FreeType.cpp",
753 "src/ports/SkFontHost_FreeType_common.cpp",
754 ]
755}
756
mtklein457b42a2016-08-23 13:56:37 -0700757optional("webp") {
758 enabled = skia_use_libwebp
759 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
760
mtklein457b42a2016-08-23 13:56:37 -0700761 deps = [
762 "//third_party/libwebp",
763 ]
764 sources = [
765 "src/codec/SkWebpAdapterCodec.cpp",
766 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400767 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700768 ]
mtkleineb3c4252016-08-23 07:38:09 -0700769}
770
mtklein63213812016-08-24 09:55:56 -0700771optional("xml") {
772 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000773 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700774
mtklein63213812016-08-24 09:55:56 -0700775 deps = [
776 "//third_party/expat",
777 ]
778 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500779 "src/svg/SkSVGCanvas.cpp",
780 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700781 "src/xml/SkDOM.cpp",
782 "src/xml/SkXMLParser.cpp",
783 "src/xml/SkXMLWriter.cpp",
784 ]
785}
786
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700787if (skia_enable_gpu && skia_generate_workarounds) {
788 action("workaround_list") {
789 script = "tools/build_workaround_header.py"
790
791 inputs = [
792 "src/gpu/gpu_workaround_list.txt",
793 ]
794
795 # see comments in skia_compile_processors about out dir path shenanigans.
796 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700797 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700798
799 outputs = [
800 "$root_out_dir/$output_file",
801 ]
802 args = [
803 "--output-file",
804 "$output_file",
805 ]
806
807 foreach(file, inputs) {
808 args += [ rebase_path(file, root_build_dir) ]
809 }
810 }
811}
812
mtkleinc04ff472016-06-23 10:29:30 -0700813component("skia") {
814 public_configs = [ ":skia_public" ]
815 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700816
817 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700818 ":arm64",
819 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700820 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700821 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500822 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700823 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700824 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500825 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700826 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700827 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400828 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500829 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700830 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700831 ":none",
mtklein63213812016-08-24 09:55:56 -0700832 ":pdf",
833 ":png",
scroggof84ad642016-10-31 09:02:57 -0700834 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500835 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700836 ":sse2",
837 ":sse41",
838 ":sse42",
839 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700840 ":webp",
mtklein63213812016-08-24 09:55:56 -0700841 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700842 ]
843
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400844 # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
845 # need to get propagated up to the tools that depend on :skia and thus :gpu.
846 public_deps = [
847 ":gpu",
848 ]
849
Chinmay Garde43f115c2016-11-16 15:04:12 -0800850 # This file (and all GN files in Skia) are designed to work with an
851 # empty sources assignment filter; we handle all that explicitly.
852 # We clear the filter here for clients who may have set up a global filter.
853 set_sources_assignment_filter([])
854
mtkleinc04ff472016-06-23 10:29:30 -0700855 sources = []
brettwb9447282016-09-01 14:24:39 -0700856 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700857 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500858 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700859 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400860 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500861 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700862 "src/android/SkBitmapRegionCodec.cpp",
863 "src/android/SkBitmapRegionDecoder.cpp",
864 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400865 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700866 "src/codec/SkBmpCodec.cpp",
867 "src/codec/SkBmpMaskCodec.cpp",
868 "src/codec/SkBmpRLECodec.cpp",
869 "src/codec/SkBmpStandardCodec.cpp",
870 "src/codec/SkCodec.cpp",
871 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400872 "src/codec/SkColorTable.cpp",
scroggo19b91532016-10-24 09:03:26 -0700873 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700874 "src/codec/SkMaskSwizzler.cpp",
875 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700876 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700877 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700878 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700879 "src/codec/SkSwizzler.cpp",
880 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700881 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700882 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700883 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700884 "src/ports/SkMemory_malloc.cpp",
885 "src/ports/SkOSFile_stdio.cpp",
886 "src/sfnt/SkOTTable_name.cpp",
887 "src/sfnt/SkOTUtils.cpp",
888 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700889 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700890 ]
brettwb9447282016-09-01 14:24:39 -0700891
mtklein7d6fb2c2016-08-25 14:50:44 -0700892 libs = []
893
mtkleinc04ff472016-06-23 10:29:30 -0700894 if (is_win) {
895 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400896 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700897 "src/ports/SkDebug_win.cpp",
898 "src/ports/SkFontHost_win.cpp",
899 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500900 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700901 "src/ports/SkImageEncoder_WIC.cpp",
902 "src/ports/SkImageGeneratorWIC.cpp",
903 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700904 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700905 "src/ports/SkScalerContext_win_dw.cpp",
906 "src/ports/SkTLS_win.cpp",
907 "src/ports/SkTypeface_win_dw.cpp",
908 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400909 libs += [
910 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500911 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400912 "Ole32.lib",
913 "OleAut32.lib",
914 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500915 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400916 ]
mtkleinc04ff472016-06-23 10:29:30 -0700917 } else {
918 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700919 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700920 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700921 "src/ports/SkTLS_pthread.cpp",
922 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400923 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700924 }
925
mtklein7d6fb2c2016-08-25 14:50:44 -0700926 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500927 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500928 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500929 deps += [ "//third_party/cpu-features" ]
930 }
mtklein06c35c02016-09-20 12:28:12 -0700931 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700932 libs += [
933 "EGL",
934 "GLESv2",
935 "log",
936 ]
937 }
938
mtkleinc04ff472016-06-23 10:29:30 -0700939 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700940 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400941 if (skia_use_egl) {
942 libs += [ "GLESv2" ]
943 }
mtkleinc04ff472016-06-23 10:29:30 -0700944 }
945
946 if (is_mac) {
947 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700948 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700949 "src/ports/SkFontHost_mac.cpp",
950 "src/ports/SkImageEncoder_CG.cpp",
951 "src/ports/SkImageGeneratorCG.cpp",
952 ]
mtklein09e61f72016-08-23 13:35:28 -0700953 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400954 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
955 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700956 "ApplicationServices.framework",
957 "OpenGL.framework",
958 ]
mtkleinc04ff472016-06-23 10:29:30 -0700959 }
abarth6fc8ff02016-07-15 15:15:15 -0700960
Mike Klein7d302882016-11-03 14:06:31 -0400961 if (is_ios) {
962 sources += [
963 "src/ports/SkDebug_stdio.cpp",
964 "src/ports/SkFontHost_mac.cpp",
965 "src/ports/SkImageEncoder_CG.cpp",
966 "src/ports/SkImageGeneratorCG.cpp",
967 ]
968 libs += [
969 "CoreFoundation.framework",
970 "CoreGraphics.framework",
971 "CoreText.framework",
972 "ImageIO.framework",
973 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400974
975 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
976 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400977 ]
978 }
979
abarth6fc8ff02016-07-15 15:15:15 -0700980 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700981 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700982 }
mtkleinc04ff472016-06-23 10:29:30 -0700983}
984
mtkleinc095df52016-08-24 12:23:52 -0700985# Targets guarded by skia_enable_tools may use //third_party freely.
986if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500987 # Used by gn_to_bp.py to list our public include dirs.
988 source_set("public") {
989 configs += [ ":skia_public" ]
990 }
991
Mike Kleinc36dedf2016-11-18 09:35:28 -0500992 config("skia.h_config") {
993 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500994 if (skia_use_vulkan) {
995 # So we can get the header which includes vulkan
996 include_dirs += [ "tools/gpu/vk" ]
997 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500998 }
999 action("skia.h") {
1000 public_configs = [ ":skia.h_config" ]
1001 skia_h = "$target_gen_dir/skia.h"
1002 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001003
1004 # TODO: would be cool to not hard-code these here, but how?
1005 module_public_includes = [
1006 "modules/sksg/include",
1007 "modules/skottie/include",
1008 ]
1009 args =
1010 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1011 [ rebase_path(skia_h, root_build_dir) ] +
1012 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001013 depfile = "$skia_h.deps"
1014 outputs = [
1015 skia_h,
1016 ]
1017 }
1018
Brian Osmanc9a42472018-05-31 13:17:12 -04001019 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001020 executable("fiddle") {
1021 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001022 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001023 "tools/fiddle/draw.cpp",
1024 "tools/fiddle/fiddle_main.cpp",
1025 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001026
1027 if (skia_use_egl) {
1028 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001029 } else {
1030 sources += [ "tools/fiddle/null_context.cpp" ]
1031 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001032 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001033 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001034 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001035 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001036 ":skia",
1037 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001038 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001039 ]
1040 }
1041 }
1042
Brian Osmanc9a42472018-05-31 13:17:12 -04001043 source_set("public_headers_warnings_check") {
1044 sources = [
1045 "tools/public_headers_warnings_check.cpp",
1046 ]
1047 configs -= [ "//gn:warnings_except_public_headers" ]
1048 deps = [
1049 ":skia",
1050 ":skia.h",
1051 "modules/skottie",
1052 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001053 }
1054
mtkleinc095df52016-08-24 12:23:52 -07001055 template("test_lib") {
1056 config(target_name + "_config") {
1057 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001058 if (defined(invoker.public_defines)) {
1059 defines = invoker.public_defines
1060 }
mtklein25c81d42016-07-27 13:55:26 -07001061 }
mtkleinc095df52016-08-24 12:23:52 -07001062 source_set(target_name) {
1063 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1064 public_configs = [
1065 ":" + target_name + "_config",
1066 ":skia_private",
1067 ]
1068
1069 if (!defined(deps)) {
1070 deps = []
1071 }
1072 deps += [ ":skia" ]
1073 testonly = true
1074 }
mtklein25c81d42016-07-27 13:55:26 -07001075 }
mtklein25c81d42016-07-27 13:55:26 -07001076
Mike Kleine6682eb2017-01-05 10:54:57 -05001077 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001078 if (is_ios) {
1079 app_name = target_name
1080 gen_path = target_gen_dir
1081
1082 action("${app_name}_generate_info_plist") {
1083 script = "//gn/gen_plist_ios.py"
1084 outputs = [
1085 "$gen_path/${app_name}_Info.plist",
1086 ]
1087 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1088 }
1089
1090 bundle_data("${app_name}_bundle_info_plist") {
1091 public_deps = [
1092 ":${app_name}_generate_info_plist",
1093 ]
1094 sources = [
1095 "$gen_path/${app_name}_Info.plist",
1096 ]
1097 outputs = [
1098 "{{bundle_root_dir}}/Info.plist",
1099 ]
1100 }
1101
Jim Van Verth329c5a62017-11-29 11:42:33 -05001102 bundle_ios_data =
1103 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1104
1105 if (bundle_ios_data) {
1106 has_skps =
1107 "True" == exec_script("//gn/checkdir.py",
1108 [ rebase_path("skps", root_build_dir) ],
1109 "trim string")
1110 bundle_data("${app_name}_bundle_resources") {
1111 sources = [
1112 "resources",
1113 ]
1114 outputs = [
1115 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1116 "{{bundle_resources_dir}}/data/resources",
1117 ]
1118 }
1119
1120 if (has_skps) {
1121 bundle_data("${app_name}_bundle_skps") {
1122 sources = [
1123 "skps",
1124 ]
1125 outputs = [
1126 # Store in same folder as resources
1127 "{{bundle_resources_dir}}/data/skps",
1128 ]
1129 }
1130 }
1131 }
1132
Jim Van Verth443a9132017-11-28 09:45:26 -05001133 executable("${app_name}_generate_executable") {
1134 forward_variables_from(invoker,
1135 "*",
1136 [
1137 "output_name",
1138 "visibility",
1139 "is_shared_library",
1140 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001141 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001142 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001143 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1144 }
1145
1146 bundle_data("${app_name}_bundle_executable") {
1147 public_deps = [
1148 ":${app_name}_generate_executable",
1149 ]
1150 sources = [
1151 "$gen_path/$app_name",
1152 ]
1153 outputs = [
1154 "{{bundle_executable_dir}}/$app_name",
1155 ]
1156 testonly = true
1157 }
1158
1159 create_bundle("$app_name") {
1160 product_type = "com.apple.product-type.application"
1161 testonly = true
1162
1163 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1164 bundle_resources_dir = bundle_root_dir
1165 bundle_executable_dir = bundle_root_dir
1166 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1167
1168 deps = [
1169 ":${app_name}_bundle_executable",
1170 ":${app_name}_bundle_info_plist",
1171 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001172 if (bundle_ios_data) {
1173 deps += [ ":${app_name}_bundle_resources" ]
1174 if (has_skps) {
1175 deps += [ ":${app_name}_bundle_skps" ]
1176 }
1177 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001178
1179 # should only code sign when running on a device, not the simulator
1180 if (target_cpu != "x64") {
1181 code_signing_script = "//gn/codesign_ios.py"
1182 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1183 code_signing_outputs = [
1184 "$bundle_root_dir/_CodeSignature/CodeResources",
1185 "$bundle_root_dir/embedded.mobileprovision",
1186 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001187 code_signing_args = [
1188 rebase_path("$bundle_root_dir", root_build_dir),
1189 skia_ios_identity,
1190 skia_ios_profile,
1191 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001192 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001193 }
1194 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001195 # !is_ios
1196
1197 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1198 shared_library("lib" + target_name) {
1199 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1200 configs += [ ":skia_private" ]
1201 testonly = true
1202 }
1203 } else {
1204 _executable = target_name
1205 executable(_executable) {
1206 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1207 configs += [ ":skia_private" ]
1208 testonly = true
1209 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001210 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001211 if (is_android && skia_android_serial != "" && defined(_executable)) {
1212 action("push_" + target_name) {
1213 script = "gn/push_to_android.py"
1214 deps = [
1215 ":" + _executable,
1216 ]
1217 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1218 outputs = [
1219 _stamp,
1220 ]
1221 args = [
1222 rebase_path("$root_build_dir/$_executable"),
1223 skia_android_serial,
1224 rebase_path(_stamp),
1225 ]
1226 testonly = true
1227 }
Mike Klein7d921032017-01-05 12:20:41 -05001228 }
1229 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001230 }
1231
mtkleinc095df52016-08-24 12:23:52 -07001232 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001233 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001234 public_defines = []
1235 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001236
Brian Osmanc9a42472018-05-31 13:17:12 -04001237 deps = []
1238 sources = [
1239 "tools/gpu/GrContextFactory.cpp",
1240 "tools/gpu/GrTest.cpp",
1241 "tools/gpu/ProxyUtils.cpp",
1242 "tools/gpu/TestContext.cpp",
1243 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1244 "tools/gpu/gl/GLTestContext.cpp",
1245 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
1246 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1247 "tools/gpu/gl/debug/GrBufferObj.cpp",
1248 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1249 "tools/gpu/gl/debug/GrProgramObj.cpp",
1250 "tools/gpu/gl/debug/GrShaderObj.cpp",
1251 "tools/gpu/gl/debug/GrTextureObj.cpp",
1252 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1253 "tools/gpu/gl/null/NullGLTestContext.cpp",
1254 "tools/gpu/mock/MockTestContext.cpp",
1255 ]
1256 libs = []
1257
1258 if (is_android || skia_use_egl) {
1259 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1260 } else if (is_ios) {
1261 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1262 libs += [ "OpenGLES.framework" ]
1263 } else if (is_linux) {
1264 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001265 libs += [
1266 "GLU",
1267 "X11",
1268 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001269 } else if (is_mac) {
1270 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1271 } else if (is_win) {
1272 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1273 libs += [
1274 "Gdi32.lib",
1275 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001276 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001277 }
mtklein25c81d42016-07-27 13:55:26 -07001278
Brian Osmanc9a42472018-05-31 13:17:12 -04001279 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001280
Brian Osmanc9a42472018-05-31 13:17:12 -04001281 if (skia_use_angle) {
1282 deps += [ "//third_party/angle2" ]
1283 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1284 }
1285 if (skia_use_vulkan) {
1286 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1287 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
1288 }
1289 if (skia_use_metal) {
1290 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001291 }
mtklein25c81d42016-07-27 13:55:26 -07001292 }
mtklein25c81d42016-07-27 13:55:26 -07001293
mtkleinc095df52016-08-24 12:23:52 -07001294 test_lib("flags") {
1295 public_include_dirs = [ "tools/flags" ]
1296 sources = [
1297 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001298 ]
1299 }
1300 test_lib("common_flags") {
1301 public_include_dirs = [ "tools/flags" ]
1302 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001303 "tools/flags/SkCommonFlags.cpp",
1304 "tools/flags/SkCommonFlagsConfig.cpp",
1305 ]
1306 deps = [
mtklein046cb562016-09-16 10:23:12 -07001307 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001308 ":gpu_tool_utils",
1309 ]
1310 }
mtklein25c81d42016-07-27 13:55:26 -07001311
mtkleinc095df52016-08-24 12:23:52 -07001312 test_lib("tool_utils") {
1313 public_include_dirs = [
1314 "tools",
1315 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001316 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001317 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001318 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001319 ]
1320 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001321 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001322 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001323 "tools/DDLPromiseImageHelper.cpp",
1324 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001325 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001326 "tools/ProcStats.cpp",
1327 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001328 "tools/UrlDataManager.cpp",
1329 "tools/debugger/SkDebugCanvas.cpp",
1330 "tools/debugger/SkDrawCommand.cpp",
1331 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001332 "tools/fonts/SkRandomScalerContext.cpp",
1333 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001334 "tools/fonts/SkTestFontMgr.h",
1335 "tools/fonts/SkTestSVGTypeface.cpp",
1336 "tools/fonts/SkTestSVGTypeface.h",
1337 "tools/fonts/SkTestTypeface.cpp",
1338 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001339 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001340 "tools/picture_utils.cpp",
1341 "tools/random_parse_path.cpp",
1342 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001343 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001344 "tools/trace/SkChromeTracingTracer.cpp",
1345 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001346 "tools/trace/SkDebugfTracer.cpp",
1347 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001348 "tools/trace/SkEventTracingPriv.cpp",
1349 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001350 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001351 libs = []
1352 if (is_ios) {
1353 sources += [ "tools/ios_utils.m" ]
1354 libs += [ "Foundation.framework" ]
1355 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001356 defines = []
1357 if (skia_tools_require_resources) {
1358 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1359 }
mtkleinc095df52016-08-24 12:23:52 -07001360 deps = [
mtklein046cb562016-09-16 10:23:12 -07001361 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001362 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001363 ":flags",
1364 "//third_party/libpng",
1365 ]
1366 public_deps = [
1367 "//third_party/jsoncpp",
1368 ]
1369 }
mtklein25c81d42016-07-27 13:55:26 -07001370
Mike Klein6e744122016-10-27 12:21:40 -04001371 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001372 test_lib("gm") {
1373 public_include_dirs = [ "gm" ]
1374 sources = gm_sources
1375 deps = [
scroggo19b91532016-10-24 09:03:26 -07001376 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001377 ":gpu_tool_utils",
1378 ":skia",
1379 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001380 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001381 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001382 ]
1383 }
mtklein25c81d42016-07-27 13:55:26 -07001384
Mike Klein6e744122016-10-27 12:21:40 -04001385 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001386 test_lib("tests") {
1387 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001388 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001389 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001390 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001391 }
mtkleinc095df52016-08-24 12:23:52 -07001392 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001393 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001394 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001395 ":skia",
1396 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001397 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001398 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001399 "//third_party/libpng",
1400 "//third_party/zlib",
1401 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001402 public_deps = [
1403 ":gpu_tool_utils", # Test.h #includes headers from this target.
1404 ]
mtkleinc095df52016-08-24 12:23:52 -07001405 }
mtklein2f3416d2016-08-02 16:02:05 -07001406
Mike Klein6e744122016-10-27 12:21:40 -04001407 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001408 test_lib("bench") {
1409 public_include_dirs = [ "bench" ]
1410 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001411 deps = [
1412 ":flags",
1413 ":gm",
1414 ":gpu_tool_utils",
1415 ":skia",
1416 ":tool_utils",
1417 ]
1418 }
mtklein2b6870c2016-07-28 14:17:33 -07001419
mtkleinc095df52016-08-24 12:23:52 -07001420 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001421 public_include_dirs = []
1422 if (skia_use_expat) {
1423 public_include_dirs += [ "experimental/svg/model" ]
1424 sources = [
1425 "experimental/svg/model/SkSVGAttribute.cpp",
1426 "experimental/svg/model/SkSVGAttributeParser.cpp",
1427 "experimental/svg/model/SkSVGCircle.cpp",
1428 "experimental/svg/model/SkSVGClipPath.cpp",
1429 "experimental/svg/model/SkSVGContainer.cpp",
1430 "experimental/svg/model/SkSVGDOM.cpp",
1431 "experimental/svg/model/SkSVGEllipse.cpp",
1432 "experimental/svg/model/SkSVGGradient.cpp",
1433 "experimental/svg/model/SkSVGLine.cpp",
1434 "experimental/svg/model/SkSVGLinearGradient.cpp",
1435 "experimental/svg/model/SkSVGNode.cpp",
1436 "experimental/svg/model/SkSVGPath.cpp",
1437 "experimental/svg/model/SkSVGPattern.cpp",
1438 "experimental/svg/model/SkSVGPoly.cpp",
1439 "experimental/svg/model/SkSVGRadialGradient.cpp",
1440 "experimental/svg/model/SkSVGRect.cpp",
1441 "experimental/svg/model/SkSVGRenderContext.cpp",
1442 "experimental/svg/model/SkSVGSVG.cpp",
1443 "experimental/svg/model/SkSVGShape.cpp",
1444 "experimental/svg/model/SkSVGStop.cpp",
1445 "experimental/svg/model/SkSVGTransformableNode.cpp",
1446 "experimental/svg/model/SkSVGUse.cpp",
1447 "experimental/svg/model/SkSVGValue.cpp",
1448 ]
1449 deps = [
1450 ":skia",
1451 ":xml",
1452 ]
1453 }
mtkleinc095df52016-08-24 12:23:52 -07001454 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001455
Kevin Lubickebf648e2017-09-21 13:45:16 -04001456 if (target_cpu != "wasm") {
1457 test_lib("views") {
1458 public_include_dirs = [ "include/views" ]
1459 sources = [
1460 "src/views/SkEvent.cpp",
1461 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001462 "src/views/SkTouchGesture.cpp",
1463 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001464 ]
Brian Osman34755e22016-12-05 09:46:02 -05001465 }
Brian Osman16adfa32016-10-18 14:42:44 -04001466 }
1467
Mike Klein38af9432016-11-11 11:39:44 -05001468 if (skia_use_lua) {
1469 test_lib("lua") {
1470 public_include_dirs = []
1471 sources = [
1472 "src/utils/SkLua.cpp",
1473 "src/utils/SkLuaCanvas.cpp",
1474 ]
1475 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001476 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001477 "//third_party/lua",
1478 ]
1479 }
1480
Mike Kleine6682eb2017-01-05 10:54:57 -05001481 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001482 sources = [
1483 "tools/lua/lua_app.cpp",
1484 ]
1485 deps = [
1486 ":lua",
1487 ":skia",
1488 "//third_party/lua",
1489 ]
Mike Klein38af9432016-11-11 11:39:44 -05001490 }
1491
Mike Kleine6682eb2017-01-05 10:54:57 -05001492 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001493 sources = [
1494 "tools/lua/lua_pictures.cpp",
1495 ]
1496 deps = [
1497 ":flags",
1498 ":lua",
1499 ":skia",
1500 ":tool_utils",
1501 "//third_party/lua",
1502 ]
Mike Klein38af9432016-11-11 11:39:44 -05001503 }
1504 }
1505
Cary Clark8032b982017-07-28 11:04:54 -04001506 test_app("bookmaker") {
1507 sources = [
1508 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001509 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001510 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001511 "tools/bookmaker/fiddleParser.cpp",
1512 "tools/bookmaker/includeParser.cpp",
1513 "tools/bookmaker/includeWriter.cpp",
1514 "tools/bookmaker/mdOut.cpp",
1515 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001516 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001517 "tools/bookmaker/spellCheck.cpp",
1518 ]
1519 deps = [
1520 ":flags",
1521 ":skia",
1522 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001523 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001524 ]
1525 }
1526
Florin Malitae2aa7b62018-06-06 09:37:26 -04001527 if (is_linux) {
Florin Malita79725d32018-06-05 16:16:57 -04001528 test_app("skottie_tool") {
1529 deps = [
1530 "modules/skottie:tool",
1531 ]
1532 }
1533 }
1534
Kevin Lubickebf648e2017-09-21 13:45:16 -04001535 if (target_cpu != "wasm") {
1536 import("gn/samples.gni")
1537 test_lib("samples") {
1538 public_include_dirs = [ "samplecode" ]
1539 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001540 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001541 deps = [
1542 ":experimental_svg_model",
1543 ":flags",
1544 ":gm",
1545 ":tool_utils",
1546 ":views",
1547 ":xml",
Brian Osmanccb87522018-06-01 19:20:00 +00001548 "modules/sksg:samples",
Herb Derby264182c2018-05-29 15:53:40 -04001549 "modules/skshaper",
Brian Osmanc069a572018-06-19 16:05:09 -04001550 "//third_party/Nima-Cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001551 ]
Mike Klein38af9432016-11-11 11:39:44 -05001552
Kevin Lubickebf648e2017-09-21 13:45:16 -04001553 if (skia_use_lua) {
1554 sources += [ "samplecode/SampleLua.cpp" ]
1555 deps += [
1556 ":lua",
1557 "//third_party/lua",
1558 ]
1559 }
1560 }
1561 test_app("dm") {
1562 sources = [
1563 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001564 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001565 "dm/DMJsonWriter.cpp",
1566 "dm/DMSrcSink.cpp",
1567 ]
1568 include_dirs = [ "tests" ]
1569 deps = [
1570 ":common_flags",
1571 ":experimental_svg_model",
1572 ":flags",
1573 ":gm",
1574 ":gpu_tool_utils",
1575 ":skia",
1576 ":tests",
1577 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001578 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001579 "modules/sksg",
Brian Osmanc069a572018-06-19 16:05:09 -04001580 "//third_party/Nima-Cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001581 "//third_party/jsoncpp",
1582 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001583 ]
1584 }
Brian Osman16adfa32016-10-18 14:42:44 -04001585 }
1586
Mike Kleina8a51ce2018-01-09 12:34:11 -05001587 if (!is_win) {
1588 test_app("remote_demo") {
1589 sources = [
1590 "tools/remote_demo.cpp",
1591 ]
1592 deps = [
1593 ":skia",
1594 ]
1595 }
1596 }
1597
Mike Kleine6682eb2017-01-05 10:54:57 -05001598 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001599 sources = [
1600 "bench/nanobench.cpp",
1601 ]
1602 deps = [
1603 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001604 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001605 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001606 ":flags",
1607 ":gm",
1608 ":gpu_tool_utils",
1609 ":skia",
1610 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001611 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001612 "//third_party/jsoncpp",
1613 ]
mtklein2b6870c2016-07-28 14:17:33 -07001614 }
halcanary19a97202016-08-03 15:08:04 -07001615
Ravi Mistry10d36c52017-01-31 09:49:18 -05001616 test_app("skpinfo") {
1617 sources = [
1618 "tools/skpinfo.cpp",
1619 ]
1620 deps = [
1621 ":flags",
1622 ":skia",
1623 ]
1624 }
1625
Brian Osmanc9a42472018-05-31 13:17:12 -04001626 test_app("skpbench") {
1627 sources = [
1628 "tools/skpbench/skpbench.cpp",
1629 ]
1630 deps = [
1631 ":flags",
1632 ":gpu_tool_utils",
1633 ":skia",
1634 ":tool_utils",
1635 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001636 }
1637
Mike Kleine6682eb2017-01-05 10:54:57 -05001638 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001639 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001640 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001641 ]
1642 deps = [
1643 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001644 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001645 ]
halcanary3eee9d92016-09-10 07:01:53 -07001646 }
mtklein046cb562016-09-16 10:23:12 -07001647
Matt Sarett9f1c4032017-05-17 10:06:32 -04001648 test_app("create_flutter_test_images") {
1649 sources = [
1650 "tools/create_flutter_test_images.cpp",
1651 ]
1652 deps = [
1653 ":skia",
1654 ":tool_utils",
1655 ]
1656 }
1657
Ben Wagner219f3622017-07-17 15:32:25 -04001658 test_app("create_test_font") {
1659 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001660 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001661 ]
1662 deps = [
1663 ":skia",
1664 ]
1665 assert_no_deps = [
1666 # tool_utils requires the output of this app.
1667 ":tool_utils",
1668 ]
1669 }
1670
Ben Wagner97182cc2018-02-15 10:20:04 -05001671 test_app("create_test_font_color") {
1672 sources = [
1673 "tools/fonts/create_test_font_color.cpp",
1674 ]
1675 deps = [
1676 ":flags",
1677 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001678 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001679 ]
1680 }
1681
Mike Kleine6682eb2017-01-05 10:54:57 -05001682 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001683 sources = [
1684 "tools/get_images_from_skps.cpp",
1685 ]
1686 deps = [
1687 ":flags",
1688 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001689 ]
mtklein046cb562016-09-16 10:23:12 -07001690 }
mtkleinecbc5262016-09-22 11:51:24 -07001691
Kevin Lubickebf648e2017-09-21 13:45:16 -04001692 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001693 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001694 sources = [
1695 "tools/skiaserve/Request.cpp",
1696 "tools/skiaserve/Response.cpp",
1697 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001698 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1699 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1700 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1701 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1702 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1703 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1704 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1705 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1706 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001707 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1708 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001709 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1710 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1711 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1712 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1713 ]
1714 deps = [
1715 ":flags",
1716 ":gpu_tool_utils",
1717 ":skia",
1718 ":tool_utils",
1719 "//third_party/jsoncpp",
1720 "//third_party/libmicrohttpd",
1721 "//third_party/libpng",
1722 ]
Mike Klein7d302882016-11-03 14:06:31 -04001723 }
mtkleinecbc5262016-09-22 11:51:24 -07001724 }
kjlubick14f984b2016-10-03 11:49:45 -07001725
Mike Kleine6682eb2017-01-05 10:54:57 -05001726 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001727 include_dirs = [
1728 "tools",
1729 "tools/debugger",
1730 ]
kjlubick14f984b2016-10-03 11:49:45 -07001731 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001732 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001733 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001734 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001735 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001736 "fuzz/FuzzGradients.cpp",
1737 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001738 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001739 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001740 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001741 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001742 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1743 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001744 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001745 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001746 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001747 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1748 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001749 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001750 "tools/UrlDataManager.cpp",
1751 "tools/debugger/SkDebugCanvas.cpp",
1752 "tools/debugger/SkDrawCommand.cpp",
1753 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001754 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001755 ]
1756 deps = [
1757 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001758 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001759 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001760 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001761 "//third_party/jsoncpp",
1762 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001763 ]
kjlubick14f984b2016-10-03 11:49:45 -07001764 }
Mike Klein38312422016-10-05 15:41:01 -04001765
Mike Kleine6682eb2017-01-05 10:54:57 -05001766 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001767 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001768 rebase_path("tests/skia_test.cpp"),
1769 rebase_path("tests/Test.cpp"),
1770 ]
caryclark9feb6322016-10-25 08:58:26 -07001771 deps = [
1772 ":flags",
1773 ":gpu_tool_utils",
1774 ":skia",
1775 ":tool_utils",
1776 ]
caryclark9feb6322016-10-25 08:58:26 -07001777 }
1778
Mike Kleine6682eb2017-01-05 10:54:57 -05001779 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001780 sources = [
1781 "tools/DumpRecord.cpp",
1782 "tools/dump_record.cpp",
1783 ]
1784 deps = [
1785 ":flags",
1786 ":skia",
1787 ]
Mike Klein38312422016-10-05 15:41:01 -04001788 }
bungemanfe917272016-10-13 17:36:40 -04001789
Mike Kleine6682eb2017-01-05 10:54:57 -05001790 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001791 sources = [
1792 "tools/skdiff/skdiff.cpp",
1793 "tools/skdiff/skdiff_html.cpp",
1794 "tools/skdiff/skdiff_main.cpp",
1795 "tools/skdiff/skdiff_utils.cpp",
1796 ]
1797 deps = [
1798 ":skia",
1799 ":tool_utils",
1800 ]
bungemanfe917272016-10-13 17:36:40 -04001801 }
halcanarya73d76a2016-10-17 13:19:02 -07001802
Mike Kleine6682eb2017-01-05 10:54:57 -05001803 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001804 sources = [
1805 "tools/skp_parser.cpp",
1806 ]
1807 deps = [
1808 ":skia",
1809 ":tool_utils",
1810 "//third_party/jsoncpp",
1811 ]
halcanarya73d76a2016-10-17 13:19:02 -07001812 }
Brian Osman16adfa32016-10-18 14:42:44 -04001813
Brian Osmanc9a42472018-05-31 13:17:12 -04001814 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001815 test_lib("skqp_lib") {
1816 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001817 defines =
1818 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001819 if (skia_skqp_enable_driver_correctness_workarounds) {
1820 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1821 }
Hal Canary75427132017-10-11 16:00:31 -04001822 sources = [
1823 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001824 "tools/skqp/gm_knowledge.cpp",
1825 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001826 ]
1827 deps = [
1828 ":gm",
1829 ":gpu_tool_utils",
1830 ":skia",
1831 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001832 ":tool_utils",
1833 ]
1834 }
1835 test_app("skqp") {
1836 sources = [
1837 "tools/skqp/skqp.cpp",
1838 ]
1839 deps = [
1840 ":skia",
1841 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001842 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001843 "//third_party/googletest",
1844 ]
1845 }
1846 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001847 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001848 test_app("skqp_app") {
1849 is_shared_library = true
1850 sources = [
1851 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1852 ]
1853 deps = [
1854 ":skia",
1855 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001856 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001857 ]
1858 libs = [ "android" ]
1859 }
1860 }
Hal Canary75427132017-10-11 16:00:31 -04001861
Hal Canarya9de7602018-01-19 13:08:23 -05001862 test_app("list_gms") {
1863 sources = [
1864 "tools/list_gms.cpp",
1865 ]
1866 deps = [
1867 ":gm",
1868 ":skia",
1869 ]
1870 }
1871 test_app("list_gpu_unit_tests") {
1872 sources = [
1873 "dm/DMGpuTestProcs.cpp",
1874 "tools/list_gpu_unit_tests.cpp",
1875 ]
1876 deps = [
1877 ":skia",
1878 ":tests",
1879 ]
1880 }
1881
Brian Osmanc9a42472018-05-31 13:17:12 -04001882 test_lib("sk_app") {
1883 public_include_dirs = [ "tools/sk_app" ]
1884 sources = [
1885 "tools/sk_app/CommandSet.cpp",
1886 "tools/sk_app/GLWindowContext.cpp",
1887 "tools/sk_app/Window.cpp",
1888 ]
1889 libs = []
1890
1891 if (is_android) {
1892 sources += [
1893 "tools/sk_app/android/GLWindowContext_android.cpp",
1894 "tools/sk_app/android/RasterWindowContext_android.cpp",
1895 "tools/sk_app/android/Window_android.cpp",
1896 "tools/sk_app/android/main_android.cpp",
1897 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001898 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001899 libs += [ "android" ]
1900 } else if (is_linux) {
1901 sources += [
1902 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1903 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1904 "tools/sk_app/unix/Window_unix.cpp",
1905 "tools/sk_app/unix/keysym2ucs.c",
1906 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001907 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001908 libs += [
1909 "GL",
1910 "X11",
1911 ]
1912 } else if (is_win) {
1913 sources += [
1914 "tools/sk_app/win/GLWindowContext_win.cpp",
1915 "tools/sk_app/win/RasterWindowContext_win.cpp",
1916 "tools/sk_app/win/Window_win.cpp",
1917 "tools/sk_app/win/main_win.cpp",
1918 ]
Brian Salomon194db172017-08-17 14:37:06 -04001919 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001920 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001921 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001922 } else if (is_mac) {
1923 sources += [
1924 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1925 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1926 "tools/sk_app/mac/Window_mac.cpp",
1927 "tools/sk_app/mac/main_mac.cpp",
1928 ]
1929 libs += [
1930 "QuartzCore.framework",
1931 "Cocoa.framework",
1932 "Foundation.framework",
1933 ]
1934 } else if (is_ios) {
1935 sources += [
1936 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1937 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1938 "tools/sk_app/ios/Window_ios.cpp",
1939 "tools/sk_app/ios/main_ios.cpp",
1940 ]
1941 }
1942
1943 if (skia_use_vulkan) {
1944 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1945 if (is_android) {
1946 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1947 } else if (is_linux) {
1948 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1949 libs += [ "X11-xcb" ]
1950 } else if (is_win) {
1951 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
1952 }
1953 }
1954
1955 deps = [
1956 ":gpu_tool_utils",
1957 ":skia",
1958 ":tool_utils",
1959 ":views",
1960 ]
1961 if (is_android) {
1962 deps += [ "//third_party/native_app_glue" ]
1963 } else if (is_mac || is_ios) {
1964 deps += [ "//third_party/libsdl" ]
1965 }
1966 if (skia_use_angle) {
1967 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05001968 }
Brian Osman16adfa32016-10-18 14:42:44 -04001969 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001970
Brian Osmanc9a42472018-05-31 13:17:12 -04001971 test_app("viewer") {
1972 is_shared_library = is_android
1973 if (is_ios) {
1974 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05001975 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001976 sources = [
1977 "tools/viewer/BisectSlide.cpp",
1978 "tools/viewer/GMSlide.cpp",
1979 "tools/viewer/ImGuiLayer.cpp",
1980 "tools/viewer/ImageSlide.cpp",
1981 "tools/viewer/SKPSlide.cpp",
1982 "tools/viewer/SampleSlide.cpp",
1983 "tools/viewer/SkottieSlide.cpp",
1984 "tools/viewer/SlideDir.cpp",
1985 "tools/viewer/StatsLayer.cpp",
1986 "tools/viewer/SvgSlide.cpp",
1987 "tools/viewer/Viewer.cpp",
1988 ]
1989 libs = []
1990
1991 include_dirs = []
1992 deps = [
1993 ":experimental_svg_model",
1994 ":flags",
1995 ":gm",
1996 ":gpu_tool_utils",
1997 ":samples",
1998 ":sk_app",
1999 ":skia",
2000 ":tool_utils",
2001 ":views",
2002 "modules/skottie",
2003 "modules/sksg",
Brian Osmanc069a572018-06-19 16:05:09 -04002004 "//third_party/Nima-Cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002005 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002006 ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002007 }
2008
ziadbbceddbc2018-06-19 13:57:15 -04002009 if (is_android) {
2010 test_app("arcore") {
2011 is_shared_library = true
2012 configs = [
2013 ":skia_public",
2014 "gn:default",
2015 ]
2016
2017 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2018 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2019 sources = []
2020 sources += skia_core_sources
2021 sources += skia_utils_sources
2022 sources += skia_xps_sources
2023 sources += [
2024 "src/android/SkAndroidFrameworkUtils.cpp",
2025 "src/android/SkAnimatedImage.cpp",
2026 "src/android/SkBitmapRegionCodec.cpp",
2027 "src/android/SkBitmapRegionDecoder.cpp",
2028 "src/codec/SkAndroidCodec.cpp",
2029 "src/codec/SkBmpBaseCodec.cpp",
2030 "src/codec/SkBmpCodec.cpp",
2031 "src/codec/SkBmpMaskCodec.cpp",
2032 "src/codec/SkBmpRLECodec.cpp",
2033 "src/codec/SkBmpStandardCodec.cpp",
2034 "src/codec/SkCodec.cpp",
2035 "src/codec/SkCodecImageGenerator.cpp",
2036 "src/codec/SkColorTable.cpp",
2037 "src/codec/SkGifCodec.cpp",
2038 "src/codec/SkMaskSwizzler.cpp",
2039 "src/codec/SkMasks.cpp",
2040 "src/codec/SkSampledCodec.cpp",
2041 "src/codec/SkSampler.cpp",
2042 "src/codec/SkStreamBuffer.cpp",
2043 "src/codec/SkSwizzler.cpp",
2044 "src/codec/SkWbmpCodec.cpp",
2045 "src/images/SkImageEncoder.cpp",
2046 "src/ports/SkDiscardableMemory_none.cpp",
2047 "src/ports/SkImageGenerator_skia.cpp",
2048 "src/ports/SkMemory_malloc.cpp",
2049 "src/ports/SkOSFile_stdio.cpp",
2050 "src/sfnt/SkOTTable_name.cpp",
2051 "src/sfnt/SkOTUtils.cpp",
2052 "src/utils/mac/SkStream_mac.cpp",
2053 "third_party/gif/SkGifImageReader.cpp",
2054 ]
2055 deps = [
2056 ":tool_utils",
2057 "modules/skottie",
2058 "modules/skshaper",
2059 ]
2060 }
2061 }
2062
Brian Osmanc9a42472018-05-31 13:17:12 -04002063 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002064 test_app("HelloWorld") {
2065 sources = [
2066 "example/HelloWorld.cpp",
2067 ]
2068 libs = []
2069
2070 include_dirs = []
2071 deps = [
2072 ":flags",
2073 ":gpu_tool_utils",
2074 ":sk_app",
2075 ":skia",
2076 ":tool_utils",
2077 ":views",
2078 ]
2079 }
2080 }
2081
Brian Osmanc9a42472018-05-31 13:17:12 -04002082 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002083 test_app("SkiaSDLExample") {
2084 sources = [
2085 "example/SkiaSDLExample.cpp",
2086 ]
2087 libs = []
2088 include_dirs = []
2089 deps = [
2090 ":gpu_tool_utils",
2091 ":skia",
2092 "//third_party/libsdl",
2093 ]
2094 }
2095 }
2096
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002097 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2098 action_foreach("generate_mocs") {
2099 script = "gn/call.py"
2100 sources = [
2101 "tools/mdbviz/MainWindow.h",
2102 ]
2103 outputs = [
2104 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2105 ]
2106 args = [
2107 "$skia_qt_path" + "/bin/moc",
2108 "{{source}}",
2109 "-o",
2110 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2111 ]
2112 }
2113 action_foreach("generate_resources") {
2114 script = "gn/call.py"
2115 sources = [
2116 "tools/mdbviz/resources.qrc",
2117 ]
2118 outputs = [
2119 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2120 ]
2121 args = [
2122 "$skia_qt_path" + "/bin/rcc",
2123 "{{source}}",
2124 "-o",
2125 "gen/mdbviz/{{source_name_part}}_res.cpp",
2126 ]
2127 }
2128 test_app("mdbviz") {
2129 if (is_win) {
2130 # on Windows we need to disable some exception handling warnings due to the Qt headers
2131 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2132 }
2133 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002134 "tools/UrlDataManager.cpp",
2135 "tools/debugger/SkDebugCanvas.cpp",
2136 "tools/debugger/SkDrawCommand.cpp",
2137 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002138 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002139 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002140 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002141 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002142
2143 # generated files
2144 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2145 "$target_gen_dir/mdbviz/resources_res.cpp",
2146 ]
2147 lib_dirs = [ "$skia_qt_path/lib" ]
2148 libs = [
2149 "Qt5Core.lib",
2150 "Qt5Gui.lib",
2151 "Qt5Widgets.lib",
2152 ]
2153 include_dirs = [
2154 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002155 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002156 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002157 "tools",
2158 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002159 ]
2160 deps = [
2161 ":generate_mocs",
2162 ":generate_resources",
2163 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002164 "//third_party/jsoncpp",
2165 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002166 ]
2167 }
2168 }
2169
Mike Kleine459afd2017-03-03 09:21:30 -05002170 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002171 copy("gdbserver") {
2172 sources = [
2173 "$ndk/$ndk_gdbserver",
2174 ]
2175 outputs = [
2176 "$root_out_dir/gdbserver",
2177 ]
2178 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002179 }
mtklein25c81d42016-07-27 13:55:26 -07002180}