blob: 3f58f4480b631ef168253e5a6ce8717e3bceec22 [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 Kleina979a1d2017-02-23 10:31:13 -0500603 libs += [
604 "GL",
605 "GLU",
606 ]
mtklein06c35c02016-09-20 12:28:12 -0700607 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800609 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400611 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400613 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700614 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500615 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700616 }
mtkleine9fb3d52016-09-20 15:11:46 -0700617
618 if (skia_use_vulkan) {
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400619 # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
620 # //third_party/vulkan directory in their trees so they can set up the vulkan library however
621 # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
622 # vulkan files.
623 public_deps += [ "third_party/vulkan" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400624 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700625 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700626 if (skia_enable_vulkan_debug_layers) {
627 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
628 }
mtkleine9fb3d52016-09-20 15:11:46 -0700629 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400630
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400631 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400632 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400633 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
634 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400635
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400636 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400637 if (skia_use_metal) {
638 public_defines += [ "SK_METAL" ]
639 sources += skia_metal_sources
640 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400641 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400642 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500643
644 if (skia_enable_atlas_text) {
645 sources += skia_atlas_text_sources
646 }
mtklein06c35c02016-09-20 12:28:12 -0700647}
648
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400649optional("heif") {
650 enabled = skia_use_libheif
651 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
652
653 deps = []
654
655 sources = [
656 "src/codec/SkHeifCodec.cpp",
657 ]
658}
659
mtklein63213812016-08-24 09:55:56 -0700660optional("jpeg") {
661 enabled = skia_use_libjpeg_turbo
662 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
663
mtklein63213812016-08-24 09:55:56 -0700664 deps = [
665 "//third_party/libjpeg-turbo:libjpeg",
666 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400667 public = [
668 "include/encode/SkJpegEncoder.h",
669 ]
mtklein63213812016-08-24 09:55:56 -0700670 sources = [
671 "src/codec/SkJpegCodec.cpp",
672 "src/codec/SkJpegDecoderMgr.cpp",
673 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700674 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400675 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700676 ]
677}
678
679optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500680 enabled = skia_use_zlib && skia_enable_pdf
681 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700682
mtklein63213812016-08-24 09:55:56 -0700683 deps = [
684 "//third_party/zlib",
685 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400686 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700687 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400688 }
brettwb9447282016-09-01 14:24:39 -0700689 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700690 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700691
692 if (skia_use_sfntly) {
693 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500694 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700695 }
696}
697
698optional("png") {
699 enabled = skia_use_libpng
700 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
701
mtklein63213812016-08-24 09:55:56 -0700702 deps = [
703 "//third_party/libpng",
704 ]
705 sources = [
706 "src/codec/SkIcoCodec.cpp",
707 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400708 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700709 ]
710}
711
scroggof84ad642016-10-31 09:02:57 -0700712optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400713 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700714 public_defines = [ "SK_CODEC_DECODES_RAW" ]
715
716 deps = [
717 "//third_party/dng_sdk",
718 "//third_party/libjpeg-turbo:libjpeg",
719 "//third_party/piex",
720 ]
721
722 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
723 # Skia.
724 configs_to_remove = [ "//gn:no_exceptions" ]
725
726 sources = [
727 "src/codec/SkRawAdapterCodec.cpp",
728 "src/codec/SkRawCodec.cpp",
729 ]
730}
731
Mike Klein852a8cb2018-05-15 10:46:58 -0400732import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400733source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400734 cflags = []
735 if (!is_win || is_clang) {
736 cflags += [
737 "-w",
738 "-std=c11",
739 ]
740 }
741
742 public = [
743 "third_party/skcms/skcms.h",
744 ]
745 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
746}
747
mtklein3cc22182016-08-29 13:26:14 -0700748optional("typeface_freetype") {
749 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700750
751 deps = [
752 "//third_party/freetype2",
753 ]
754 sources = [
755 "src/ports/SkFontHost_FreeType.cpp",
756 "src/ports/SkFontHost_FreeType_common.cpp",
757 ]
758}
759
mtklein457b42a2016-08-23 13:56:37 -0700760optional("webp") {
761 enabled = skia_use_libwebp
762 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
763
mtklein457b42a2016-08-23 13:56:37 -0700764 deps = [
765 "//third_party/libwebp",
766 ]
767 sources = [
768 "src/codec/SkWebpAdapterCodec.cpp",
769 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400770 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700771 ]
mtkleineb3c4252016-08-23 07:38:09 -0700772}
773
mtklein63213812016-08-24 09:55:56 -0700774optional("xml") {
775 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000776 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700777
mtklein63213812016-08-24 09:55:56 -0700778 deps = [
779 "//third_party/expat",
780 ]
781 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500782 "src/svg/SkSVGCanvas.cpp",
783 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700784 "src/xml/SkDOM.cpp",
785 "src/xml/SkXMLParser.cpp",
786 "src/xml/SkXMLWriter.cpp",
787 ]
788}
789
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700790if (skia_enable_gpu && skia_generate_workarounds) {
791 action("workaround_list") {
792 script = "tools/build_workaround_header.py"
793
794 inputs = [
795 "src/gpu/gpu_workaround_list.txt",
796 ]
797
798 # see comments in skia_compile_processors about out dir path shenanigans.
799 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700800 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700801
802 outputs = [
803 "$root_out_dir/$output_file",
804 ]
805 args = [
806 "--output-file",
807 "$output_file",
808 ]
809
810 foreach(file, inputs) {
811 args += [ rebase_path(file, root_build_dir) ]
812 }
813 }
814}
815
mtkleinc04ff472016-06-23 10:29:30 -0700816component("skia") {
817 public_configs = [ ":skia_public" ]
818 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700819
820 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700821 ":arm64",
822 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700823 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700824 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500825 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700826 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700827 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500828 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700829 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700830 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400831 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500832 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700833 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700834 ":none",
mtklein63213812016-08-24 09:55:56 -0700835 ":pdf",
836 ":png",
scroggof84ad642016-10-31 09:02:57 -0700837 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500838 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700839 ":sse2",
840 ":sse41",
841 ":sse42",
842 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700843 ":webp",
mtklein63213812016-08-24 09:55:56 -0700844 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700845 ]
846
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400847 # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
848 # need to get propagated up to the tools that depend on :skia and thus :gpu.
849 public_deps = [
850 ":gpu",
851 ]
852
Chinmay Garde43f115c2016-11-16 15:04:12 -0800853 # This file (and all GN files in Skia) are designed to work with an
854 # empty sources assignment filter; we handle all that explicitly.
855 # We clear the filter here for clients who may have set up a global filter.
856 set_sources_assignment_filter([])
857
mtkleinc04ff472016-06-23 10:29:30 -0700858 sources = []
brettwb9447282016-09-01 14:24:39 -0700859 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700860 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500861 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700862 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400863 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500864 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700865 "src/android/SkBitmapRegionCodec.cpp",
866 "src/android/SkBitmapRegionDecoder.cpp",
867 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400868 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700869 "src/codec/SkBmpCodec.cpp",
870 "src/codec/SkBmpMaskCodec.cpp",
871 "src/codec/SkBmpRLECodec.cpp",
872 "src/codec/SkBmpStandardCodec.cpp",
873 "src/codec/SkCodec.cpp",
874 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400875 "src/codec/SkColorTable.cpp",
scroggo19b91532016-10-24 09:03:26 -0700876 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700877 "src/codec/SkMaskSwizzler.cpp",
878 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700879 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700880 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700881 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700882 "src/codec/SkSwizzler.cpp",
883 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700884 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700885 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700886 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700887 "src/ports/SkMemory_malloc.cpp",
888 "src/ports/SkOSFile_stdio.cpp",
889 "src/sfnt/SkOTTable_name.cpp",
890 "src/sfnt/SkOTUtils.cpp",
891 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700892 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700893 ]
brettwb9447282016-09-01 14:24:39 -0700894
mtklein7d6fb2c2016-08-25 14:50:44 -0700895 libs = []
896
mtkleinc04ff472016-06-23 10:29:30 -0700897 if (is_win) {
898 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400899 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700900 "src/ports/SkDebug_win.cpp",
901 "src/ports/SkFontHost_win.cpp",
902 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500903 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700904 "src/ports/SkImageEncoder_WIC.cpp",
905 "src/ports/SkImageGeneratorWIC.cpp",
906 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700907 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700908 "src/ports/SkScalerContext_win_dw.cpp",
909 "src/ports/SkTLS_win.cpp",
910 "src/ports/SkTypeface_win_dw.cpp",
911 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400912 libs += [
913 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500914 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400915 "Ole32.lib",
916 "OleAut32.lib",
917 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500918 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400919 ]
mtkleinc04ff472016-06-23 10:29:30 -0700920 } else {
921 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700922 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700923 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700924 "src/ports/SkTLS_pthread.cpp",
925 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400926 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700927 }
928
mtklein7d6fb2c2016-08-25 14:50:44 -0700929 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500930 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500931 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500932 deps += [ "//third_party/cpu-features" ]
933 }
mtklein06c35c02016-09-20 12:28:12 -0700934 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700935 libs += [
936 "EGL",
937 "GLESv2",
938 "log",
939 ]
940 }
941
mtkleinc04ff472016-06-23 10:29:30 -0700942 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700943 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400944 if (skia_use_egl) {
945 libs += [ "GLESv2" ]
946 }
mtkleinc04ff472016-06-23 10:29:30 -0700947 }
948
949 if (is_mac) {
950 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700951 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700952 "src/ports/SkFontHost_mac.cpp",
953 "src/ports/SkImageEncoder_CG.cpp",
954 "src/ports/SkImageGeneratorCG.cpp",
955 ]
mtklein09e61f72016-08-23 13:35:28 -0700956 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400957 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
958 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700959 "ApplicationServices.framework",
960 "OpenGL.framework",
961 ]
mtkleinc04ff472016-06-23 10:29:30 -0700962 }
abarth6fc8ff02016-07-15 15:15:15 -0700963
Mike Klein7d302882016-11-03 14:06:31 -0400964 if (is_ios) {
965 sources += [
966 "src/ports/SkDebug_stdio.cpp",
967 "src/ports/SkFontHost_mac.cpp",
968 "src/ports/SkImageEncoder_CG.cpp",
969 "src/ports/SkImageGeneratorCG.cpp",
970 ]
971 libs += [
972 "CoreFoundation.framework",
973 "CoreGraphics.framework",
974 "CoreText.framework",
975 "ImageIO.framework",
976 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400977
978 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
979 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400980 ]
981 }
982
abarth6fc8ff02016-07-15 15:15:15 -0700983 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700984 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700985 }
mtkleinc04ff472016-06-23 10:29:30 -0700986}
987
mtkleinc095df52016-08-24 12:23:52 -0700988# Targets guarded by skia_enable_tools may use //third_party freely.
989if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500990 # Used by gn_to_bp.py to list our public include dirs.
991 source_set("public") {
992 configs += [ ":skia_public" ]
993 }
994
Mike Kleinc36dedf2016-11-18 09:35:28 -0500995 config("skia.h_config") {
996 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500997 if (skia_use_vulkan) {
998 # So we can get the header which includes vulkan
999 include_dirs += [ "tools/gpu/vk" ]
1000 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001001 }
1002 action("skia.h") {
1003 public_configs = [ ":skia.h_config" ]
1004 skia_h = "$target_gen_dir/skia.h"
1005 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001006
1007 # TODO: would be cool to not hard-code these here, but how?
1008 module_public_includes = [
1009 "modules/sksg/include",
1010 "modules/skottie/include",
1011 ]
1012 args =
1013 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1014 [ rebase_path(skia_h, root_build_dir) ] +
1015 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001016 depfile = "$skia_h.deps"
1017 outputs = [
1018 skia_h,
1019 ]
1020 }
1021
Brian Osmanc9a42472018-05-31 13:17:12 -04001022 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001023 executable("fiddle") {
1024 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001025 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001026 "tools/fiddle/draw.cpp",
1027 "tools/fiddle/fiddle_main.cpp",
1028 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001029
1030 if (skia_use_egl) {
1031 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001032 } else {
1033 sources += [ "tools/fiddle/null_context.cpp" ]
1034 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001035 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001036 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001037 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001038 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001039 ":skia",
1040 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001041 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001042 ]
1043 }
1044 }
1045
Brian Osmanc9a42472018-05-31 13:17:12 -04001046 source_set("public_headers_warnings_check") {
1047 sources = [
1048 "tools/public_headers_warnings_check.cpp",
1049 ]
1050 configs -= [ "//gn:warnings_except_public_headers" ]
1051 deps = [
1052 ":skia",
1053 ":skia.h",
1054 "modules/skottie",
1055 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001056 }
1057
mtkleinc095df52016-08-24 12:23:52 -07001058 template("test_lib") {
1059 config(target_name + "_config") {
1060 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001061 if (defined(invoker.public_defines)) {
1062 defines = invoker.public_defines
1063 }
mtklein25c81d42016-07-27 13:55:26 -07001064 }
mtkleinc095df52016-08-24 12:23:52 -07001065 source_set(target_name) {
1066 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1067 public_configs = [
1068 ":" + target_name + "_config",
1069 ":skia_private",
1070 ]
1071
1072 if (!defined(deps)) {
1073 deps = []
1074 }
1075 deps += [ ":skia" ]
1076 testonly = true
1077 }
mtklein25c81d42016-07-27 13:55:26 -07001078 }
mtklein25c81d42016-07-27 13:55:26 -07001079
Mike Kleine6682eb2017-01-05 10:54:57 -05001080 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001081 if (is_ios) {
1082 app_name = target_name
1083 gen_path = target_gen_dir
1084
1085 action("${app_name}_generate_info_plist") {
1086 script = "//gn/gen_plist_ios.py"
1087 outputs = [
1088 "$gen_path/${app_name}_Info.plist",
1089 ]
1090 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1091 }
1092
1093 bundle_data("${app_name}_bundle_info_plist") {
1094 public_deps = [
1095 ":${app_name}_generate_info_plist",
1096 ]
1097 sources = [
1098 "$gen_path/${app_name}_Info.plist",
1099 ]
1100 outputs = [
1101 "{{bundle_root_dir}}/Info.plist",
1102 ]
1103 }
1104
Jim Van Verth329c5a62017-11-29 11:42:33 -05001105 bundle_ios_data =
1106 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1107
1108 if (bundle_ios_data) {
1109 has_skps =
1110 "True" == exec_script("//gn/checkdir.py",
1111 [ rebase_path("skps", root_build_dir) ],
1112 "trim string")
1113 bundle_data("${app_name}_bundle_resources") {
1114 sources = [
1115 "resources",
1116 ]
1117 outputs = [
1118 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1119 "{{bundle_resources_dir}}/data/resources",
1120 ]
1121 }
1122
1123 if (has_skps) {
1124 bundle_data("${app_name}_bundle_skps") {
1125 sources = [
1126 "skps",
1127 ]
1128 outputs = [
1129 # Store in same folder as resources
1130 "{{bundle_resources_dir}}/data/skps",
1131 ]
1132 }
1133 }
1134 }
1135
Jim Van Verth443a9132017-11-28 09:45:26 -05001136 executable("${app_name}_generate_executable") {
1137 forward_variables_from(invoker,
1138 "*",
1139 [
1140 "output_name",
1141 "visibility",
1142 "is_shared_library",
1143 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001144 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001145 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001146 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1147 }
1148
1149 bundle_data("${app_name}_bundle_executable") {
1150 public_deps = [
1151 ":${app_name}_generate_executable",
1152 ]
1153 sources = [
1154 "$gen_path/$app_name",
1155 ]
1156 outputs = [
1157 "{{bundle_executable_dir}}/$app_name",
1158 ]
1159 testonly = true
1160 }
1161
1162 create_bundle("$app_name") {
1163 product_type = "com.apple.product-type.application"
1164 testonly = true
1165
1166 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1167 bundle_resources_dir = bundle_root_dir
1168 bundle_executable_dir = bundle_root_dir
1169 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1170
1171 deps = [
1172 ":${app_name}_bundle_executable",
1173 ":${app_name}_bundle_info_plist",
1174 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001175 if (bundle_ios_data) {
1176 deps += [ ":${app_name}_bundle_resources" ]
1177 if (has_skps) {
1178 deps += [ ":${app_name}_bundle_skps" ]
1179 }
1180 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001181
1182 # should only code sign when running on a device, not the simulator
1183 if (target_cpu != "x64") {
1184 code_signing_script = "//gn/codesign_ios.py"
1185 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1186 code_signing_outputs = [
1187 "$bundle_root_dir/_CodeSignature/CodeResources",
1188 "$bundle_root_dir/embedded.mobileprovision",
1189 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001190 code_signing_args = [
1191 rebase_path("$bundle_root_dir", root_build_dir),
1192 skia_ios_identity,
1193 skia_ios_profile,
1194 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001195 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001196 }
1197 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001198 # !is_ios
1199
1200 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1201 shared_library("lib" + target_name) {
1202 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1203 configs += [ ":skia_private" ]
1204 testonly = true
1205 }
1206 } else {
1207 _executable = target_name
1208 executable(_executable) {
1209 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1210 configs += [ ":skia_private" ]
1211 testonly = true
1212 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001213 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001214 if (is_android && skia_android_serial != "" && defined(_executable)) {
1215 action("push_" + target_name) {
1216 script = "gn/push_to_android.py"
1217 deps = [
1218 ":" + _executable,
1219 ]
1220 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1221 outputs = [
1222 _stamp,
1223 ]
1224 args = [
1225 rebase_path("$root_build_dir/$_executable"),
1226 skia_android_serial,
1227 rebase_path(_stamp),
1228 ]
1229 testonly = true
1230 }
Mike Klein7d921032017-01-05 12:20:41 -05001231 }
1232 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001233 }
1234
mtkleinc095df52016-08-24 12:23:52 -07001235 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001236 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001237 public_defines = []
1238 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001239
Brian Osmanc9a42472018-05-31 13:17:12 -04001240 deps = []
1241 sources = [
1242 "tools/gpu/GrContextFactory.cpp",
1243 "tools/gpu/GrTest.cpp",
1244 "tools/gpu/ProxyUtils.cpp",
1245 "tools/gpu/TestContext.cpp",
1246 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1247 "tools/gpu/gl/GLTestContext.cpp",
1248 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
1249 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1250 "tools/gpu/gl/debug/GrBufferObj.cpp",
1251 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1252 "tools/gpu/gl/debug/GrProgramObj.cpp",
1253 "tools/gpu/gl/debug/GrShaderObj.cpp",
1254 "tools/gpu/gl/debug/GrTextureObj.cpp",
1255 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1256 "tools/gpu/gl/null/NullGLTestContext.cpp",
1257 "tools/gpu/mock/MockTestContext.cpp",
1258 ]
1259 libs = []
1260
1261 if (is_android || skia_use_egl) {
1262 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1263 } else if (is_ios) {
1264 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1265 libs += [ "OpenGLES.framework" ]
1266 } else if (is_linux) {
1267 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1268 libs += [ "X11" ]
1269 } 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",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001550 ]
Mike Klein38af9432016-11-11 11:39:44 -05001551
Kevin Lubickebf648e2017-09-21 13:45:16 -04001552 if (skia_use_lua) {
1553 sources += [ "samplecode/SampleLua.cpp" ]
1554 deps += [
1555 ":lua",
1556 "//third_party/lua",
1557 ]
1558 }
1559 }
1560 test_app("dm") {
1561 sources = [
1562 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001563 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001564 "dm/DMJsonWriter.cpp",
1565 "dm/DMSrcSink.cpp",
1566 ]
1567 include_dirs = [ "tests" ]
1568 deps = [
1569 ":common_flags",
1570 ":experimental_svg_model",
1571 ":flags",
1572 ":gm",
1573 ":gpu_tool_utils",
1574 ":skia",
1575 ":tests",
1576 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001577 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001578 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001579 "//third_party/jsoncpp",
1580 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001581 ]
1582 }
Brian Osman16adfa32016-10-18 14:42:44 -04001583 }
1584
Mike Kleina8a51ce2018-01-09 12:34:11 -05001585 if (!is_win) {
1586 test_app("remote_demo") {
1587 sources = [
1588 "tools/remote_demo.cpp",
1589 ]
1590 deps = [
1591 ":skia",
1592 ]
1593 }
1594 }
1595
Mike Kleine6682eb2017-01-05 10:54:57 -05001596 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001597 sources = [
1598 "bench/nanobench.cpp",
1599 ]
1600 deps = [
1601 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001602 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001603 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001604 ":flags",
1605 ":gm",
1606 ":gpu_tool_utils",
1607 ":skia",
1608 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001609 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001610 "//third_party/jsoncpp",
1611 ]
mtklein2b6870c2016-07-28 14:17:33 -07001612 }
halcanary19a97202016-08-03 15:08:04 -07001613
Ravi Mistry10d36c52017-01-31 09:49:18 -05001614 test_app("skpinfo") {
1615 sources = [
1616 "tools/skpinfo.cpp",
1617 ]
1618 deps = [
1619 ":flags",
1620 ":skia",
1621 ]
1622 }
1623
Brian Osmanc9a42472018-05-31 13:17:12 -04001624 test_app("skpbench") {
1625 sources = [
1626 "tools/skpbench/skpbench.cpp",
1627 ]
1628 deps = [
1629 ":flags",
1630 ":gpu_tool_utils",
1631 ":skia",
1632 ":tool_utils",
1633 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001634 }
1635
Mike Kleine6682eb2017-01-05 10:54:57 -05001636 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001637 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001638 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001639 ]
1640 deps = [
1641 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001642 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001643 ]
halcanary3eee9d92016-09-10 07:01:53 -07001644 }
mtklein046cb562016-09-16 10:23:12 -07001645
Matt Sarett9f1c4032017-05-17 10:06:32 -04001646 test_app("create_flutter_test_images") {
1647 sources = [
1648 "tools/create_flutter_test_images.cpp",
1649 ]
1650 deps = [
1651 ":skia",
1652 ":tool_utils",
1653 ]
1654 }
1655
Ben Wagner219f3622017-07-17 15:32:25 -04001656 test_app("create_test_font") {
1657 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001658 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001659 ]
1660 deps = [
1661 ":skia",
1662 ]
1663 assert_no_deps = [
1664 # tool_utils requires the output of this app.
1665 ":tool_utils",
1666 ]
1667 }
1668
Ben Wagner97182cc2018-02-15 10:20:04 -05001669 test_app("create_test_font_color") {
1670 sources = [
1671 "tools/fonts/create_test_font_color.cpp",
1672 ]
1673 deps = [
1674 ":flags",
1675 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001676 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001677 ]
1678 }
1679
Mike Kleine6682eb2017-01-05 10:54:57 -05001680 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001681 sources = [
1682 "tools/get_images_from_skps.cpp",
1683 ]
1684 deps = [
1685 ":flags",
1686 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001687 ]
mtklein046cb562016-09-16 10:23:12 -07001688 }
mtkleinecbc5262016-09-22 11:51:24 -07001689
Kevin Lubickebf648e2017-09-21 13:45:16 -04001690 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001691 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001692 sources = [
1693 "tools/skiaserve/Request.cpp",
1694 "tools/skiaserve/Response.cpp",
1695 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001696 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1697 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1698 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1699 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1700 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1701 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1702 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1703 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1704 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001705 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1706 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001707 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1708 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1709 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1710 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1711 ]
1712 deps = [
1713 ":flags",
1714 ":gpu_tool_utils",
1715 ":skia",
1716 ":tool_utils",
1717 "//third_party/jsoncpp",
1718 "//third_party/libmicrohttpd",
1719 "//third_party/libpng",
1720 ]
Mike Klein7d302882016-11-03 14:06:31 -04001721 }
mtkleinecbc5262016-09-22 11:51:24 -07001722 }
kjlubick14f984b2016-10-03 11:49:45 -07001723
Mike Kleine6682eb2017-01-05 10:54:57 -05001724 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001725 include_dirs = [
1726 "tools",
1727 "tools/debugger",
1728 ]
kjlubick14f984b2016-10-03 11:49:45 -07001729 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001730 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001731 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001732 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001733 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001734 "fuzz/FuzzGradients.cpp",
1735 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001736 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001737 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001738 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001739 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001740 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1741 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001742 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001743 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001744 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001745 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1746 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001747 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001748 "tools/UrlDataManager.cpp",
1749 "tools/debugger/SkDebugCanvas.cpp",
1750 "tools/debugger/SkDrawCommand.cpp",
1751 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001752 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001753 ]
1754 deps = [
1755 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001756 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001757 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001758 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001759 "//third_party/jsoncpp",
1760 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001761 ]
kjlubick14f984b2016-10-03 11:49:45 -07001762 }
Mike Klein38312422016-10-05 15:41:01 -04001763
Mike Kleine6682eb2017-01-05 10:54:57 -05001764 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001765 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001766 rebase_path("tests/skia_test.cpp"),
1767 rebase_path("tests/Test.cpp"),
1768 ]
caryclark9feb6322016-10-25 08:58:26 -07001769 deps = [
1770 ":flags",
1771 ":gpu_tool_utils",
1772 ":skia",
1773 ":tool_utils",
1774 ]
caryclark9feb6322016-10-25 08:58:26 -07001775 }
1776
Mike Kleine6682eb2017-01-05 10:54:57 -05001777 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001778 sources = [
1779 "tools/DumpRecord.cpp",
1780 "tools/dump_record.cpp",
1781 ]
1782 deps = [
1783 ":flags",
1784 ":skia",
1785 ]
Mike Klein38312422016-10-05 15:41:01 -04001786 }
bungemanfe917272016-10-13 17:36:40 -04001787
Mike Kleine6682eb2017-01-05 10:54:57 -05001788 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001789 sources = [
1790 "tools/skdiff/skdiff.cpp",
1791 "tools/skdiff/skdiff_html.cpp",
1792 "tools/skdiff/skdiff_main.cpp",
1793 "tools/skdiff/skdiff_utils.cpp",
1794 ]
1795 deps = [
1796 ":skia",
1797 ":tool_utils",
1798 ]
bungemanfe917272016-10-13 17:36:40 -04001799 }
halcanarya73d76a2016-10-17 13:19:02 -07001800
Mike Kleine6682eb2017-01-05 10:54:57 -05001801 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001802 sources = [
1803 "tools/skp_parser.cpp",
1804 ]
1805 deps = [
1806 ":skia",
1807 ":tool_utils",
1808 "//third_party/jsoncpp",
1809 ]
halcanarya73d76a2016-10-17 13:19:02 -07001810 }
Brian Osman16adfa32016-10-18 14:42:44 -04001811
Brian Osmanc9a42472018-05-31 13:17:12 -04001812 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001813 test_lib("skqp_lib") {
1814 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001815 defines =
1816 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001817 if (skia_skqp_enable_driver_correctness_workarounds) {
1818 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1819 }
Hal Canary75427132017-10-11 16:00:31 -04001820 sources = [
1821 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001822 "tools/skqp/gm_knowledge.cpp",
1823 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001824 ]
1825 deps = [
1826 ":gm",
1827 ":gpu_tool_utils",
1828 ":skia",
1829 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001830 ":tool_utils",
1831 ]
1832 }
1833 test_app("skqp") {
1834 sources = [
1835 "tools/skqp/skqp.cpp",
1836 ]
1837 deps = [
1838 ":skia",
1839 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001840 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001841 "//third_party/googletest",
1842 ]
1843 }
1844 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001845 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001846 test_app("skqp_app") {
1847 is_shared_library = true
1848 sources = [
1849 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1850 ]
1851 deps = [
1852 ":skia",
1853 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001854 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001855 ]
1856 libs = [ "android" ]
1857 }
1858 }
Hal Canary75427132017-10-11 16:00:31 -04001859
Hal Canarya9de7602018-01-19 13:08:23 -05001860 test_app("list_gms") {
1861 sources = [
1862 "tools/list_gms.cpp",
1863 ]
1864 deps = [
1865 ":gm",
1866 ":skia",
1867 ]
1868 }
1869 test_app("list_gpu_unit_tests") {
1870 sources = [
1871 "dm/DMGpuTestProcs.cpp",
1872 "tools/list_gpu_unit_tests.cpp",
1873 ]
1874 deps = [
1875 ":skia",
1876 ":tests",
1877 ]
1878 }
1879
Brian Osmanc9a42472018-05-31 13:17:12 -04001880 test_lib("sk_app") {
1881 public_include_dirs = [ "tools/sk_app" ]
1882 sources = [
1883 "tools/sk_app/CommandSet.cpp",
1884 "tools/sk_app/GLWindowContext.cpp",
1885 "tools/sk_app/Window.cpp",
1886 ]
1887 libs = []
1888
1889 if (is_android) {
1890 sources += [
1891 "tools/sk_app/android/GLWindowContext_android.cpp",
1892 "tools/sk_app/android/RasterWindowContext_android.cpp",
1893 "tools/sk_app/android/Window_android.cpp",
1894 "tools/sk_app/android/main_android.cpp",
1895 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001896 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001897 libs += [ "android" ]
1898 } else if (is_linux) {
1899 sources += [
1900 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1901 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1902 "tools/sk_app/unix/Window_unix.cpp",
1903 "tools/sk_app/unix/keysym2ucs.c",
1904 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001905 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001906 libs += [
1907 "GL",
1908 "X11",
1909 ]
1910 } else if (is_win) {
1911 sources += [
1912 "tools/sk_app/win/GLWindowContext_win.cpp",
1913 "tools/sk_app/win/RasterWindowContext_win.cpp",
1914 "tools/sk_app/win/Window_win.cpp",
1915 "tools/sk_app/win/main_win.cpp",
1916 ]
Brian Salomon194db172017-08-17 14:37:06 -04001917 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001918 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001919 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001920 } else if (is_mac) {
1921 sources += [
1922 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1923 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1924 "tools/sk_app/mac/Window_mac.cpp",
1925 "tools/sk_app/mac/main_mac.cpp",
1926 ]
1927 libs += [
1928 "QuartzCore.framework",
1929 "Cocoa.framework",
1930 "Foundation.framework",
1931 ]
1932 } else if (is_ios) {
1933 sources += [
1934 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1935 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1936 "tools/sk_app/ios/Window_ios.cpp",
1937 "tools/sk_app/ios/main_ios.cpp",
1938 ]
1939 }
1940
1941 if (skia_use_vulkan) {
1942 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1943 if (is_android) {
1944 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1945 } else if (is_linux) {
1946 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1947 libs += [ "X11-xcb" ]
1948 } else if (is_win) {
1949 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
1950 }
1951 }
1952
1953 deps = [
1954 ":gpu_tool_utils",
1955 ":skia",
1956 ":tool_utils",
1957 ":views",
1958 ]
1959 if (is_android) {
1960 deps += [ "//third_party/native_app_glue" ]
1961 } else if (is_mac || is_ios) {
1962 deps += [ "//third_party/libsdl" ]
1963 }
1964 if (skia_use_angle) {
1965 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05001966 }
Brian Osman16adfa32016-10-18 14:42:44 -04001967 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001968
Brian Osmanc9a42472018-05-31 13:17:12 -04001969 test_app("viewer") {
1970 is_shared_library = is_android
1971 if (is_ios) {
1972 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05001973 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001974 sources = [
1975 "tools/viewer/BisectSlide.cpp",
1976 "tools/viewer/GMSlide.cpp",
1977 "tools/viewer/ImGuiLayer.cpp",
1978 "tools/viewer/ImageSlide.cpp",
1979 "tools/viewer/SKPSlide.cpp",
1980 "tools/viewer/SampleSlide.cpp",
1981 "tools/viewer/SkottieSlide.cpp",
1982 "tools/viewer/SlideDir.cpp",
1983 "tools/viewer/StatsLayer.cpp",
1984 "tools/viewer/SvgSlide.cpp",
1985 "tools/viewer/Viewer.cpp",
1986 ]
1987 libs = []
1988
1989 include_dirs = []
1990 deps = [
1991 ":experimental_svg_model",
1992 ":flags",
1993 ":gm",
1994 ":gpu_tool_utils",
1995 ":samples",
1996 ":sk_app",
1997 ":skia",
1998 ":tool_utils",
1999 ":views",
2000 "modules/skottie",
2001 "modules/sksg",
2002 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002003 ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002004 }
2005
ziadbbceddbc2018-06-19 13:57:15 -04002006 if (is_android) {
2007 test_app("arcore") {
2008 is_shared_library = true
2009 configs = [
2010 ":skia_public",
2011 "gn:default",
2012 ]
2013
2014 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2015 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2016 sources = []
2017 sources += skia_core_sources
2018 sources += skia_utils_sources
2019 sources += skia_xps_sources
2020 sources += [
2021 "src/android/SkAndroidFrameworkUtils.cpp",
2022 "src/android/SkAnimatedImage.cpp",
2023 "src/android/SkBitmapRegionCodec.cpp",
2024 "src/android/SkBitmapRegionDecoder.cpp",
2025 "src/codec/SkAndroidCodec.cpp",
2026 "src/codec/SkBmpBaseCodec.cpp",
2027 "src/codec/SkBmpCodec.cpp",
2028 "src/codec/SkBmpMaskCodec.cpp",
2029 "src/codec/SkBmpRLECodec.cpp",
2030 "src/codec/SkBmpStandardCodec.cpp",
2031 "src/codec/SkCodec.cpp",
2032 "src/codec/SkCodecImageGenerator.cpp",
2033 "src/codec/SkColorTable.cpp",
2034 "src/codec/SkGifCodec.cpp",
2035 "src/codec/SkMaskSwizzler.cpp",
2036 "src/codec/SkMasks.cpp",
2037 "src/codec/SkSampledCodec.cpp",
2038 "src/codec/SkSampler.cpp",
2039 "src/codec/SkStreamBuffer.cpp",
2040 "src/codec/SkSwizzler.cpp",
2041 "src/codec/SkWbmpCodec.cpp",
2042 "src/images/SkImageEncoder.cpp",
2043 "src/ports/SkDiscardableMemory_none.cpp",
2044 "src/ports/SkImageGenerator_skia.cpp",
2045 "src/ports/SkMemory_malloc.cpp",
2046 "src/ports/SkOSFile_stdio.cpp",
2047 "src/sfnt/SkOTTable_name.cpp",
2048 "src/sfnt/SkOTUtils.cpp",
2049 "src/utils/mac/SkStream_mac.cpp",
2050 "third_party/gif/SkGifImageReader.cpp",
2051 ]
2052 deps = [
2053 ":tool_utils",
2054 "modules/skottie",
2055 "modules/skshaper",
2056 ]
2057 }
2058 }
2059
Brian Osmanc9a42472018-05-31 13:17:12 -04002060 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002061 test_app("HelloWorld") {
2062 sources = [
2063 "example/HelloWorld.cpp",
2064 ]
2065 libs = []
2066
2067 include_dirs = []
2068 deps = [
2069 ":flags",
2070 ":gpu_tool_utils",
2071 ":sk_app",
2072 ":skia",
2073 ":tool_utils",
2074 ":views",
2075 ]
2076 }
2077 }
2078
Brian Osmanc9a42472018-05-31 13:17:12 -04002079 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002080 test_app("SkiaSDLExample") {
2081 sources = [
2082 "example/SkiaSDLExample.cpp",
2083 ]
2084 libs = []
2085 include_dirs = []
2086 deps = [
2087 ":gpu_tool_utils",
2088 ":skia",
2089 "//third_party/libsdl",
2090 ]
2091 }
2092 }
2093
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002094 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2095 action_foreach("generate_mocs") {
2096 script = "gn/call.py"
2097 sources = [
2098 "tools/mdbviz/MainWindow.h",
2099 ]
2100 outputs = [
2101 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2102 ]
2103 args = [
2104 "$skia_qt_path" + "/bin/moc",
2105 "{{source}}",
2106 "-o",
2107 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2108 ]
2109 }
2110 action_foreach("generate_resources") {
2111 script = "gn/call.py"
2112 sources = [
2113 "tools/mdbviz/resources.qrc",
2114 ]
2115 outputs = [
2116 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2117 ]
2118 args = [
2119 "$skia_qt_path" + "/bin/rcc",
2120 "{{source}}",
2121 "-o",
2122 "gen/mdbviz/{{source_name_part}}_res.cpp",
2123 ]
2124 }
2125 test_app("mdbviz") {
2126 if (is_win) {
2127 # on Windows we need to disable some exception handling warnings due to the Qt headers
2128 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2129 }
2130 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002131 "tools/UrlDataManager.cpp",
2132 "tools/debugger/SkDebugCanvas.cpp",
2133 "tools/debugger/SkDrawCommand.cpp",
2134 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002135 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002136 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002137 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002138 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002139
2140 # generated files
2141 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2142 "$target_gen_dir/mdbviz/resources_res.cpp",
2143 ]
2144 lib_dirs = [ "$skia_qt_path/lib" ]
2145 libs = [
2146 "Qt5Core.lib",
2147 "Qt5Gui.lib",
2148 "Qt5Widgets.lib",
2149 ]
2150 include_dirs = [
2151 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002152 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002153 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002154 "tools",
2155 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002156 ]
2157 deps = [
2158 ":generate_mocs",
2159 ":generate_resources",
2160 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002161 "//third_party/jsoncpp",
2162 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002163 ]
2164 }
2165 }
2166
Mike Kleine459afd2017-03-03 09:21:30 -05002167 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002168 copy("gdbserver") {
2169 sources = [
2170 "$ndk/$ndk_gdbserver",
2171 ]
2172 outputs = [
2173 "$root_out_dir/gdbserver",
2174 ]
2175 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002176 }
mtklein25c81d42016-07-27 13:55:26 -07002177}