blob: 1691936eca0be178c9a745f9a093759378efc65b [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
Brian Osmanf2c90142017-07-13 15:50:03 -040037 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050038 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000039 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050040 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040041 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050042 skia_enable_tools = is_skia_dev_build
43 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040044 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040045 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070046 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070047 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040048
Hal Canary4689b542018-01-31 11:54:14 -050049 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050050 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040051
52 skia_llvm_path = ""
53 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040054
55 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070056}
Brian Salomon23d73ea2016-10-27 13:31:37 -040057declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040058 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040059 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050060 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040061
Mike Klein4d598a32016-10-31 13:44:49 -040062 if (is_android) {
63 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070064 } else if (is_fuchsia) {
65 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040066 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040067 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
68 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040069 }
Jim Van Verth4e502972017-12-07 15:16:10 -050070
71 if (is_ios) {
72 skia_ios_identity = ".*Google.*"
73 skia_ios_profile = "Google Development"
74 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040075}
Brian Salomon789e25e2016-09-30 13:41:03 -040076
Adam Barth54ef74a2017-10-13 10:59:38 -070077if (defined(skia_settings)) {
78 import(skia_settings)
79}
80
Brian Osmanc9a42472018-05-31 13:17:12 -040081# Our tools require static linking (they use non-exported symbols), and the GPU backend.
82skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070083
mtkleina45be612016-08-29 15:22:10 -070084fontmgr_android_enabled = skia_use_expat && skia_use_freetype
85
mtklein1211e0c2016-07-26 13:55:45 -070086skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070087 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070088 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070089 "include/codec",
90 "include/config",
91 "include/core",
92 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040093 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070094 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050095 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070096 "include/pathops",
97 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070098 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/utils",
100 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700101]
102
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500103if (skia_enable_atlas_text) {
104 skia_public_includes += [ "include/atlastext" ]
105}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000106
mtkleinc04ff472016-06-23 10:29:30 -0700107# Skia public API, generally provided by :skia.
108config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700109 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400110 defines = []
111 if (is_component_build) {
112 defines += [ "SKIA_DLL" ]
113 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400114 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700115 defines += [ "SK_SAMPLES_FOR_X" ]
116 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400117 if (skia_enable_flutter_defines) {
118 defines += flutter_defines
119 }
mtklein06c35c02016-09-20 12:28:12 -0700120 if (!skia_enable_gpu) {
121 defines += [ "SK_SUPPORT_GPU=0" ]
122 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500123 if (skia_enable_atlas_text) {
124 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
125 }
mtkleinc04ff472016-06-23 10:29:30 -0700126}
127
128# Skia internal APIs, used by Skia itself and a few test tools.
129config("skia_private") {
130 visibility = [ ":*" ]
131
132 include_dirs = [
133 "include/private",
134 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700135 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700136 "src/core",
137 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700138 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700139 "src/image",
140 "src/images",
141 "src/lazy",
142 "src/opts",
143 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700144 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700145 "src/ports",
146 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400147 "src/shaders",
148 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700149 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700150 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700151 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500152 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700153 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700154 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400155 if (skia_llvm_path != "") {
156 include_dirs += [ "$skia_llvm_path/include" ]
157 }
mtklein150d1132016-08-01 06:56:40 -0700158
Mike Reeda9e241d2017-05-03 10:52:00 -0400159 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700160 if (is_android) {
161 defines += [
162 "SK_GAMMA_EXPONENT=1.4",
163 "SK_GAMMA_CONTRAST=0.0",
164 ]
165 }
mtklein88a7ac02016-09-14 11:16:49 -0700166 if (is_official_build || is_android) {
167 # TODO(bsalomon): it'd be nice to make Android normal.
168 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
169 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400170 libs = []
171 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500172 if (skia_enable_gpu) {
173 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500174 if (is_skia_dev_build && skia_use_vulkan) {
175 include_dirs += [ "tools/gpu/vk" ]
176 }
Brian Salomon03e05842017-02-23 12:23:47 -0500177 }
Brian Osman34755e22016-12-05 09:46:02 -0500178 if (skia_use_angle) {
179 defines += [ "SK_ANGLE" ]
180 }
Brian Osman3f375d02016-12-28 11:19:22 -0500181 if (skia_enable_discrete_gpu) {
182 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
183 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400184 if (!is_official_build) {
185 defines += [ "GR_TEST_UTILS=1" ]
186 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400187 if (skia_llvm_path != "") {
188 defines += [ "SK_LLVM_AVAILABLE" ]
189 include_dirs += [ "$skia_llvm_path/include" ]
190 libs += [ skia_llvm_lib ]
191 lib_dirs += [ "$skia_llvm_path/lib/" ]
192 }
mtkleinc04ff472016-06-23 10:29:30 -0700193}
194
195# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
196config("skia_library") {
197 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700198 defines = [ "SKIA_IMPLEMENTATION=1" ]
199}
200
201skia_library_configs = [
202 ":skia_public",
203 ":skia_private",
204 ":skia_library",
205]
206
mtklein9b8583d2016-08-24 17:32:30 -0700207# Use for CPU-specific Skia code that needs particular compiler flags.
208template("opts") {
209 if (invoker.enabled) {
210 source_set(target_name) {
211 forward_variables_from(invoker, "*")
212 configs += skia_library_configs
213 }
214 } else {
215 # If not enabled, a phony empty target that swallows all otherwise unused variables.
216 source_set(target_name) {
217 forward_variables_from(invoker,
218 "*",
219 [
220 "sources",
221 "cflags",
222 ])
223 }
224 }
anmittala7eaf2e2016-08-17 13:57:26 -0700225}
226
mtklein422310d2016-08-16 18:28:43 -0700227is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700228
mtklein7d6fb2c2016-08-25 14:50:44 -0700229opts("none") {
230 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700231 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700232 cflags = []
233}
234
mtklein7d6fb2c2016-08-25 14:50:44 -0700235opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700236 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700237 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700238 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700239}
240
241opts("arm64") {
242 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700244 cflags = []
245}
246
247opts("crc32") {
248 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700250 cflags = [ "-march=armv8-a+crc" ]
251}
252
mtklein9b8583d2016-08-24 17:32:30 -0700253opts("sse2") {
254 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700255 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400256 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400257 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
258 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400259 cflags = [ "-msse2" ]
260 }
mtklein9b8583d2016-08-24 17:32:30 -0700261}
mtkleinc04ff472016-06-23 10:29:30 -0700262
mtklein9b8583d2016-08-24 17:32:30 -0700263opts("ssse3") {
264 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700265 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400266 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400267 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
268 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400269 cflags = [ "-mssse3" ]
270 }
mtklein9b8583d2016-08-24 17:32:30 -0700271}
mtkleinc04ff472016-06-23 10:29:30 -0700272
mtklein9b8583d2016-08-24 17:32:30 -0700273opts("sse41") {
274 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700275 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400276 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400277 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
278 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400279 cflags = [ "-msse4.1" ]
280 }
mtklein9b8583d2016-08-24 17:32:30 -0700281}
mtklein4e976072016-08-08 09:06:27 -0700282
mtklein9b8583d2016-08-24 17:32:30 -0700283opts("sse42") {
284 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700285 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400286 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400287 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
288 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400289 cflags = [ "-msse4.2" ]
290 }
mtklein9b8583d2016-08-24 17:32:30 -0700291}
292
293opts("avx") {
294 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700295 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400296 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000297 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400298 } else {
299 cflags = [ "-mavx" ]
300 }
mtkleinc04ff472016-06-23 10:29:30 -0700301}
302
Mike Klein1b9b7d52018-02-27 10:37:40 -0500303opts("hsw") {
304 enabled = is_x86
305 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400306 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500307 cflags = [ "/arch:AVX2" ]
308 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000309 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500310 }
311
312 # Oddly, clang-cl doesn't recognize this as a valid flag.
313 # If it ever does, it'd nice to move this up with -mavx2 and co.
314 if (is_clang && !is_win) {
315 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
316 # but nice to have, generating slightly better code for paths without explicit FMAs.
317 cflags += [ "-ffp-contract=fast" ]
318 }
319}
320
mtkleinc095df52016-08-24 12:23:52 -0700321# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700322template("optional") {
323 if (invoker.enabled) {
324 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700325 if (defined(invoker.public_defines)) {
326 defines = invoker.public_defines
327 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600328 if (defined(invoker.public_configs)) {
329 configs = invoker.public_configs
330 }
mtklein457b42a2016-08-23 13:56:37 -0700331 }
332 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700333 forward_variables_from(invoker,
334 "*",
335 [
336 "public_defines",
337 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700338 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700339 ])
mtklein457b42a2016-08-23 13:56:37 -0700340 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700341 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700342 if (defined(invoker.configs_to_remove)) {
343 configs -= invoker.configs_to_remove
344 }
mtklein457b42a2016-08-23 13:56:37 -0700345 }
346 } else {
mtklein457b42a2016-08-23 13:56:37 -0700347 source_set(target_name) {
348 forward_variables_from(invoker,
349 "*",
350 [
351 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400352 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700353 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700354 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700355 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700356 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700357 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700358 ])
mtkleincd01b032016-08-31 04:58:19 -0700359 if (defined(invoker.sources_when_disabled)) {
360 sources = invoker.sources_when_disabled
361 }
362 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700363 }
mtkleineb3c4252016-08-23 07:38:09 -0700364 }
mtklein457b42a2016-08-23 13:56:37 -0700365}
mtklein457b42a2016-08-23 13:56:37 -0700366
Mike Kleina04bb452017-02-09 12:24:07 -0500367optional("effects") {
368 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400369 deps = [
370 ":compile_processors",
371 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500372 sources =
373 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
374 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
375}
376
mtkleina45be612016-08-29 15:22:10 -0700377optional("fontmgr_android") {
378 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700382 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700383 ]
384 sources = [
385 "src/ports/SkFontMgr_android.cpp",
386 "src/ports/SkFontMgr_android_factory.cpp",
387 "src/ports/SkFontMgr_android_parser.cpp",
388 ]
389}
390
mtkleind2e39db2016-09-07 07:52:55 -0700391optional("fontmgr_custom") {
392 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
393
394 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500395 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700396 ]
397 sources = [
398 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500399 "src/ports/SkFontMgr_custom.h",
400 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700401 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500402 "src/ports/SkFontMgr_custom_embedded.cpp",
403 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700404 ]
405}
406
Hal Canaryff2742e2018-01-30 11:35:47 -0500407optional("fontmgr_empty") {
408 enabled = skia_enable_fontmgr_empty
409 sources = [
410 "src/ports/SkFontMgr_empty_factory.cpp",
411 ]
412}
413
mtklein3cc22182016-08-29 13:26:14 -0700414optional("fontmgr_fontconfig") {
415 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700416
417 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500418 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700419 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700420 ]
421 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700422 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700423 "src/ports/SkFontConfigInterface_direct.cpp",
424 "src/ports/SkFontConfigInterface_direct_factory.cpp",
425 "src/ports/SkFontMgr_FontConfigInterface.cpp",
426 "src/ports/SkFontMgr_fontconfig.cpp",
427 "src/ports/SkFontMgr_fontconfig_factory.cpp",
428 ]
429}
430
mtkleincdedd0e2016-09-12 15:15:44 -0700431optional("fontmgr_fuchsia") {
432 enabled = is_fuchsia && skia_use_freetype
433
434 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500435 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700436 ]
437 sources = [
438 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500439 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700440 "src/ports/SkFontMgr_custom_empty_factory.cpp",
441 ]
442}
443
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700444if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400445 executable("sksllex") {
446 sources = [
447 "src/sksl/lex/Main.cpp",
448 "src/sksl/lex/NFA.cpp",
449 "src/sksl/lex/RegexNode.cpp",
450 "src/sksl/lex/RegexParser.cpp",
451 ]
452 include_dirs = [ "src/sksl/lex" ]
453 }
454
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700455 action("run_sksllex") {
456 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400457 deps = [
458 ":sksllex(//gn/toolchain:$host_toolchain)",
459 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700460 sources = [
461 "src/sksl/lex/layout.lex",
462 "src/sksl/lex/sksl.lex",
463 ]
464
465 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
466 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
467 outputs = [
468 "$target_out_dir/" +
469 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
470 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
471 # confused due to the same file being named by two different paths
472 ]
473 sksllex_path = "$root_out_dir/"
474 sksllex_path += "sksllex"
475 if (host_os == "win") {
476 sksllex_path += ".exe"
477 }
478 args = [
479 rebase_path(sksllex_path),
480 rebase_path("bin/clang-format"),
481 rebase_path("src"),
482 ]
483 }
484} else {
485 group("run_sksllex") {
486 }
487}
488
489if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400490 executable("skslc") {
491 defines = [ "SKSL_STANDALONE" ]
492 sources = [
493 "src/sksl/SkSLMain.cpp",
494 ]
495 sources += skia_sksl_sources
496 include_dirs = [
497 "src/gpu",
498 "src/sksl",
499 ]
500 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500501 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400502 "//third_party/spirv-tools",
503 ]
504 }
505
506 skia_gpu_processor_outputs = []
507 foreach(src, skia_gpu_processor_sources) {
508 dir = get_path_info(src, "dir")
509 name = get_path_info(src, "name")
510
511 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
512 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
513 skia_gpu_processor_outputs += [
514 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
515 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
516 # confused due to the same file being named by two different paths
517 ]
518 }
519
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500520 action("create_sksl_enums") {
521 script = "gn/create_sksl_enums.py"
522 sources = [
523 "include/private/GrSharedEnums.h",
524 ]
525 outputs = [
526 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500527 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500528 ]
529 args = [
530 rebase_path(sources[0]),
531 rebase_path(outputs[0]),
532 ]
533 }
534
Ethan Nicholas762466e2017-06-29 10:03:38 -0400535 action("compile_processors") {
536 script = "gn/compile_processors.py"
537 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500538 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400539 ":skslc(//gn/toolchain:$host_toolchain)",
540 ]
541 sources = skia_gpu_processor_sources
542 outputs = skia_gpu_processor_outputs
543 skslc_path = "$root_out_dir/"
544 if (host_toolchain != default_toolchain_name) {
545 skslc_path += "$host_toolchain/"
546 }
547 skslc_path += "skslc"
548 if (host_os == "win") {
549 skslc_path += ".exe"
550 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400551 args = [
552 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400553 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400554 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400555 args += rebase_path(skia_gpu_processor_sources)
556 }
557} else {
558 skia_gpu_processor_outputs = []
559 group("compile_processors") {
560 }
561}
562
mtklein06c35c02016-09-20 12:28:12 -0700563optional("gpu") {
564 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400565 deps = [
566 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700567 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400568 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700569 if (skia_generate_workarounds) {
570 deps += [ ":workaround_list" ]
571 }
mtkleine9fb3d52016-09-20 15:11:46 -0700572 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600573 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400574 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700575
Brian Salomon3d6801e2017-12-11 10:06:31 -0500576 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700577
578 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500579 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700580 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400581 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700582 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400583 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400584
585 # this lib is required to link against AHardwareBuffer
586 if (defined(ndk_api) && ndk_api >= 26) {
587 libs += [ "android" ]
588 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400589 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500590 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400591 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700592 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500593 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500594 libs += [
595 "GL",
596 "GLU",
597 ]
mtklein06c35c02016-09-20 12:28:12 -0700598 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500599 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800600 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500601 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400602 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500603 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400604 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700605 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700607 }
mtkleine9fb3d52016-09-20 15:11:46 -0700608
609 if (skia_use_vulkan) {
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400610 # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
611 # //third_party/vulkan directory in their trees so they can set up the vulkan library however
612 # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
613 # vulkan files.
614 public_deps += [ "third_party/vulkan" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400615 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700616 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700617 if (skia_enable_vulkan_debug_layers) {
618 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
619 }
mtkleine9fb3d52016-09-20 15:11:46 -0700620 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400621
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400622 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400623 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400624 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
625 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400626
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400627 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400628 if (skia_use_metal) {
629 public_defines += [ "SK_METAL" ]
630 sources += skia_metal_sources
631 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400632 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400633 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500634
635 if (skia_enable_atlas_text) {
636 sources += skia_atlas_text_sources
637 }
mtklein06c35c02016-09-20 12:28:12 -0700638}
639
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400640optional("heif") {
641 enabled = skia_use_libheif
642 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
643
644 deps = []
645
646 sources = [
647 "src/codec/SkHeifCodec.cpp",
648 ]
649}
650
mtklein63213812016-08-24 09:55:56 -0700651optional("jpeg") {
652 enabled = skia_use_libjpeg_turbo
653 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
654
mtklein63213812016-08-24 09:55:56 -0700655 deps = [
656 "//third_party/libjpeg-turbo:libjpeg",
657 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400658 public = [
659 "include/encode/SkJpegEncoder.h",
660 ]
mtklein63213812016-08-24 09:55:56 -0700661 sources = [
662 "src/codec/SkJpegCodec.cpp",
663 "src/codec/SkJpegDecoderMgr.cpp",
664 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700665 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400666 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700667 ]
668}
669
670optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500671 enabled = skia_use_zlib && skia_enable_pdf
672 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700673
mtklein63213812016-08-24 09:55:56 -0700674 deps = [
675 "//third_party/zlib",
676 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400677 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700678 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400679 }
brettwb9447282016-09-01 14:24:39 -0700680 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700681 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700682
683 if (skia_use_sfntly) {
684 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500685 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700686 }
687}
688
689optional("png") {
690 enabled = skia_use_libpng
691 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
692
mtklein63213812016-08-24 09:55:56 -0700693 deps = [
694 "//third_party/libpng",
695 ]
696 sources = [
697 "src/codec/SkIcoCodec.cpp",
698 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400699 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700700 ]
701}
702
scroggof84ad642016-10-31 09:02:57 -0700703optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400704 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700705 public_defines = [ "SK_CODEC_DECODES_RAW" ]
706
707 deps = [
708 "//third_party/dng_sdk",
709 "//third_party/libjpeg-turbo:libjpeg",
710 "//third_party/piex",
711 ]
712
713 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
714 # Skia.
715 configs_to_remove = [ "//gn:no_exceptions" ]
716
717 sources = [
718 "src/codec/SkRawAdapterCodec.cpp",
719 "src/codec/SkRawCodec.cpp",
720 ]
721}
722
Mike Klein852a8cb2018-05-15 10:46:58 -0400723import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400724source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400725 cflags = []
726 if (!is_win || is_clang) {
727 cflags += [
728 "-w",
729 "-std=c11",
730 ]
731 }
732
733 public = [
734 "third_party/skcms/skcms.h",
735 ]
736 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
737}
738
mtklein3cc22182016-08-29 13:26:14 -0700739optional("typeface_freetype") {
740 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700741
742 deps = [
743 "//third_party/freetype2",
744 ]
745 sources = [
746 "src/ports/SkFontHost_FreeType.cpp",
747 "src/ports/SkFontHost_FreeType_common.cpp",
748 ]
749}
750
mtklein457b42a2016-08-23 13:56:37 -0700751optional("webp") {
752 enabled = skia_use_libwebp
753 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
754
mtklein457b42a2016-08-23 13:56:37 -0700755 deps = [
756 "//third_party/libwebp",
757 ]
758 sources = [
759 "src/codec/SkWebpAdapterCodec.cpp",
760 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400761 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700762 ]
mtkleineb3c4252016-08-23 07:38:09 -0700763}
764
mtklein63213812016-08-24 09:55:56 -0700765optional("xml") {
766 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000767 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700768
mtklein63213812016-08-24 09:55:56 -0700769 deps = [
770 "//third_party/expat",
771 ]
772 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500773 "src/svg/SkSVGCanvas.cpp",
774 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700775 "src/xml/SkDOM.cpp",
776 "src/xml/SkXMLParser.cpp",
777 "src/xml/SkXMLWriter.cpp",
778 ]
779}
780
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700781if (skia_enable_gpu && skia_generate_workarounds) {
782 action("workaround_list") {
783 script = "tools/build_workaround_header.py"
784
785 inputs = [
786 "src/gpu/gpu_workaround_list.txt",
787 ]
788
789 # see comments in skia_compile_processors about out dir path shenanigans.
790 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700791 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700792
793 outputs = [
794 "$root_out_dir/$output_file",
795 ]
796 args = [
797 "--output-file",
798 "$output_file",
799 ]
800
801 foreach(file, inputs) {
802 args += [ rebase_path(file, root_build_dir) ]
803 }
804 }
805}
806
mtkleinc04ff472016-06-23 10:29:30 -0700807component("skia") {
808 public_configs = [ ":skia_public" ]
809 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700810
811 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700812 ":arm64",
813 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700814 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700815 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500816 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700817 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700818 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500819 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700820 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700821 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400822 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500823 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700824 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700825 ":none",
mtklein63213812016-08-24 09:55:56 -0700826 ":pdf",
827 ":png",
scroggof84ad642016-10-31 09:02:57 -0700828 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500829 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700830 ":sse2",
831 ":sse41",
832 ":sse42",
833 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700834 ":webp",
mtklein63213812016-08-24 09:55:56 -0700835 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700836 ]
837
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400838 # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
839 # need to get propagated up to the tools that depend on :skia and thus :gpu.
840 public_deps = [
841 ":gpu",
842 ]
843
Chinmay Garde43f115c2016-11-16 15:04:12 -0800844 # This file (and all GN files in Skia) are designed to work with an
845 # empty sources assignment filter; we handle all that explicitly.
846 # We clear the filter here for clients who may have set up a global filter.
847 set_sources_assignment_filter([])
848
mtkleinc04ff472016-06-23 10:29:30 -0700849 sources = []
brettwb9447282016-09-01 14:24:39 -0700850 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700851 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500852 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700853 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400854 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500855 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700856 "src/android/SkBitmapRegionCodec.cpp",
857 "src/android/SkBitmapRegionDecoder.cpp",
858 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400859 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700860 "src/codec/SkBmpCodec.cpp",
861 "src/codec/SkBmpMaskCodec.cpp",
862 "src/codec/SkBmpRLECodec.cpp",
863 "src/codec/SkBmpStandardCodec.cpp",
864 "src/codec/SkCodec.cpp",
865 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400866 "src/codec/SkColorTable.cpp",
scroggo19b91532016-10-24 09:03:26 -0700867 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700868 "src/codec/SkMaskSwizzler.cpp",
869 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700870 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700871 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700872 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700873 "src/codec/SkSwizzler.cpp",
874 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700875 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700876 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700877 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700878 "src/ports/SkMemory_malloc.cpp",
879 "src/ports/SkOSFile_stdio.cpp",
880 "src/sfnt/SkOTTable_name.cpp",
881 "src/sfnt/SkOTUtils.cpp",
882 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700883 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700884 ]
brettwb9447282016-09-01 14:24:39 -0700885
mtklein7d6fb2c2016-08-25 14:50:44 -0700886 libs = []
887
mtkleinc04ff472016-06-23 10:29:30 -0700888 if (is_win) {
889 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400890 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700891 "src/ports/SkDebug_win.cpp",
892 "src/ports/SkFontHost_win.cpp",
893 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500894 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700895 "src/ports/SkImageEncoder_WIC.cpp",
896 "src/ports/SkImageGeneratorWIC.cpp",
897 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700898 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700899 "src/ports/SkScalerContext_win_dw.cpp",
900 "src/ports/SkTLS_win.cpp",
901 "src/ports/SkTypeface_win_dw.cpp",
902 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400903 libs += [
904 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500905 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400906 "Ole32.lib",
907 "OleAut32.lib",
908 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500909 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400910 ]
mtkleinc04ff472016-06-23 10:29:30 -0700911 } else {
912 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700913 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700914 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700915 "src/ports/SkTLS_pthread.cpp",
916 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400917 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700918 }
919
mtklein7d6fb2c2016-08-25 14:50:44 -0700920 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500921 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500922 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500923 deps += [ "//third_party/cpu-features" ]
924 }
mtklein06c35c02016-09-20 12:28:12 -0700925 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700926 libs += [
927 "EGL",
928 "GLESv2",
929 "log",
930 ]
931 }
932
mtkleinc04ff472016-06-23 10:29:30 -0700933 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700934 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400935 if (skia_use_egl) {
936 libs += [ "GLESv2" ]
937 }
mtkleinc04ff472016-06-23 10:29:30 -0700938 }
939
940 if (is_mac) {
941 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700942 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700943 "src/ports/SkFontHost_mac.cpp",
944 "src/ports/SkImageEncoder_CG.cpp",
945 "src/ports/SkImageGeneratorCG.cpp",
946 ]
mtklein09e61f72016-08-23 13:35:28 -0700947 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400948 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
949 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700950 "ApplicationServices.framework",
951 "OpenGL.framework",
952 ]
mtkleinc04ff472016-06-23 10:29:30 -0700953 }
abarth6fc8ff02016-07-15 15:15:15 -0700954
Mike Klein7d302882016-11-03 14:06:31 -0400955 if (is_ios) {
956 sources += [
957 "src/ports/SkDebug_stdio.cpp",
958 "src/ports/SkFontHost_mac.cpp",
959 "src/ports/SkImageEncoder_CG.cpp",
960 "src/ports/SkImageGeneratorCG.cpp",
961 ]
962 libs += [
963 "CoreFoundation.framework",
964 "CoreGraphics.framework",
965 "CoreText.framework",
966 "ImageIO.framework",
967 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400968
969 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
970 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400971 ]
972 }
973
abarth6fc8ff02016-07-15 15:15:15 -0700974 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700975 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700976 }
mtkleinc04ff472016-06-23 10:29:30 -0700977}
978
mtkleinc095df52016-08-24 12:23:52 -0700979# Targets guarded by skia_enable_tools may use //third_party freely.
980if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500981 # Used by gn_to_bp.py to list our public include dirs.
982 source_set("public") {
983 configs += [ ":skia_public" ]
984 }
985
Mike Kleinc36dedf2016-11-18 09:35:28 -0500986 config("skia.h_config") {
987 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500988 if (skia_use_vulkan) {
989 # So we can get the header which includes vulkan
990 include_dirs += [ "tools/gpu/vk" ]
991 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500992 }
993 action("skia.h") {
994 public_configs = [ ":skia.h_config" ]
995 skia_h = "$target_gen_dir/skia.h"
996 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -0400997
998 # TODO: would be cool to not hard-code these here, but how?
999 module_public_includes = [
1000 "modules/sksg/include",
1001 "modules/skottie/include",
1002 ]
1003 args =
1004 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1005 [ rebase_path(skia_h, root_build_dir) ] +
1006 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001007 depfile = "$skia_h.deps"
1008 outputs = [
1009 skia_h,
1010 ]
1011 }
1012
Brian Osmanc9a42472018-05-31 13:17:12 -04001013 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001014 executable("fiddle") {
1015 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001016 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001017 "tools/fiddle/draw.cpp",
1018 "tools/fiddle/fiddle_main.cpp",
1019 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001020
1021 if (skia_use_egl) {
1022 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001023 } else {
1024 sources += [ "tools/fiddle/null_context.cpp" ]
1025 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001026 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001027 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001028 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001029 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001030 ":skia",
1031 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001032 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001033 ]
1034 }
1035 }
1036
Brian Osmanc9a42472018-05-31 13:17:12 -04001037 source_set("public_headers_warnings_check") {
1038 sources = [
1039 "tools/public_headers_warnings_check.cpp",
1040 ]
1041 configs -= [ "//gn:warnings_except_public_headers" ]
1042 deps = [
1043 ":skia",
1044 ":skia.h",
1045 "modules/skottie",
1046 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001047 }
1048
mtkleinc095df52016-08-24 12:23:52 -07001049 template("test_lib") {
1050 config(target_name + "_config") {
1051 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001052 if (defined(invoker.public_defines)) {
1053 defines = invoker.public_defines
1054 }
mtklein25c81d42016-07-27 13:55:26 -07001055 }
mtkleinc095df52016-08-24 12:23:52 -07001056 source_set(target_name) {
1057 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1058 public_configs = [
1059 ":" + target_name + "_config",
1060 ":skia_private",
1061 ]
1062
1063 if (!defined(deps)) {
1064 deps = []
1065 }
1066 deps += [ ":skia" ]
1067 testonly = true
1068 }
mtklein25c81d42016-07-27 13:55:26 -07001069 }
mtklein25c81d42016-07-27 13:55:26 -07001070
Mike Kleine6682eb2017-01-05 10:54:57 -05001071 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001072 if (is_ios) {
1073 app_name = target_name
1074 gen_path = target_gen_dir
1075
1076 action("${app_name}_generate_info_plist") {
1077 script = "//gn/gen_plist_ios.py"
1078 outputs = [
1079 "$gen_path/${app_name}_Info.plist",
1080 ]
1081 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1082 }
1083
1084 bundle_data("${app_name}_bundle_info_plist") {
1085 public_deps = [
1086 ":${app_name}_generate_info_plist",
1087 ]
1088 sources = [
1089 "$gen_path/${app_name}_Info.plist",
1090 ]
1091 outputs = [
1092 "{{bundle_root_dir}}/Info.plist",
1093 ]
1094 }
1095
Jim Van Verth329c5a62017-11-29 11:42:33 -05001096 bundle_ios_data =
1097 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1098
1099 if (bundle_ios_data) {
1100 has_skps =
1101 "True" == exec_script("//gn/checkdir.py",
1102 [ rebase_path("skps", root_build_dir) ],
1103 "trim string")
1104 bundle_data("${app_name}_bundle_resources") {
1105 sources = [
1106 "resources",
1107 ]
1108 outputs = [
1109 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1110 "{{bundle_resources_dir}}/data/resources",
1111 ]
1112 }
1113
1114 if (has_skps) {
1115 bundle_data("${app_name}_bundle_skps") {
1116 sources = [
1117 "skps",
1118 ]
1119 outputs = [
1120 # Store in same folder as resources
1121 "{{bundle_resources_dir}}/data/skps",
1122 ]
1123 }
1124 }
1125 }
1126
Jim Van Verth443a9132017-11-28 09:45:26 -05001127 executable("${app_name}_generate_executable") {
1128 forward_variables_from(invoker,
1129 "*",
1130 [
1131 "output_name",
1132 "visibility",
1133 "is_shared_library",
1134 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001135 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001136 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001137 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1138 }
1139
1140 bundle_data("${app_name}_bundle_executable") {
1141 public_deps = [
1142 ":${app_name}_generate_executable",
1143 ]
1144 sources = [
1145 "$gen_path/$app_name",
1146 ]
1147 outputs = [
1148 "{{bundle_executable_dir}}/$app_name",
1149 ]
1150 testonly = true
1151 }
1152
1153 create_bundle("$app_name") {
1154 product_type = "com.apple.product-type.application"
1155 testonly = true
1156
1157 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1158 bundle_resources_dir = bundle_root_dir
1159 bundle_executable_dir = bundle_root_dir
1160 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1161
1162 deps = [
1163 ":${app_name}_bundle_executable",
1164 ":${app_name}_bundle_info_plist",
1165 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001166 if (bundle_ios_data) {
1167 deps += [ ":${app_name}_bundle_resources" ]
1168 if (has_skps) {
1169 deps += [ ":${app_name}_bundle_skps" ]
1170 }
1171 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001172
1173 # should only code sign when running on a device, not the simulator
1174 if (target_cpu != "x64") {
1175 code_signing_script = "//gn/codesign_ios.py"
1176 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1177 code_signing_outputs = [
1178 "$bundle_root_dir/_CodeSignature/CodeResources",
1179 "$bundle_root_dir/embedded.mobileprovision",
1180 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001181 code_signing_args = [
1182 rebase_path("$bundle_root_dir", root_build_dir),
1183 skia_ios_identity,
1184 skia_ios_profile,
1185 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001186 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001187 }
1188 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001189 # !is_ios
1190
1191 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1192 shared_library("lib" + target_name) {
1193 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1194 configs += [ ":skia_private" ]
1195 testonly = true
1196 }
1197 } else {
1198 _executable = target_name
1199 executable(_executable) {
1200 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1201 configs += [ ":skia_private" ]
1202 testonly = true
1203 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001204 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001205 if (is_android && skia_android_serial != "" && defined(_executable)) {
1206 action("push_" + target_name) {
1207 script = "gn/push_to_android.py"
1208 deps = [
1209 ":" + _executable,
1210 ]
1211 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1212 outputs = [
1213 _stamp,
1214 ]
1215 args = [
1216 rebase_path("$root_build_dir/$_executable"),
1217 skia_android_serial,
1218 rebase_path(_stamp),
1219 ]
1220 testonly = true
1221 }
Mike Klein7d921032017-01-05 12:20:41 -05001222 }
1223 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001224 }
1225
mtkleinc095df52016-08-24 12:23:52 -07001226 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001227 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001228 public_defines = []
1229 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001230
Brian Osmanc9a42472018-05-31 13:17:12 -04001231 deps = []
1232 sources = [
1233 "tools/gpu/GrContextFactory.cpp",
1234 "tools/gpu/GrTest.cpp",
1235 "tools/gpu/ProxyUtils.cpp",
1236 "tools/gpu/TestContext.cpp",
1237 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1238 "tools/gpu/gl/GLTestContext.cpp",
1239 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
1240 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1241 "tools/gpu/gl/debug/GrBufferObj.cpp",
1242 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1243 "tools/gpu/gl/debug/GrProgramObj.cpp",
1244 "tools/gpu/gl/debug/GrShaderObj.cpp",
1245 "tools/gpu/gl/debug/GrTextureObj.cpp",
1246 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1247 "tools/gpu/gl/null/NullGLTestContext.cpp",
1248 "tools/gpu/mock/MockTestContext.cpp",
1249 ]
1250 libs = []
1251
1252 if (is_android || skia_use_egl) {
1253 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1254 } else if (is_ios) {
1255 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1256 libs += [ "OpenGLES.framework" ]
1257 } else if (is_linux) {
1258 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1259 libs += [ "X11" ]
1260 } else if (is_mac) {
1261 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1262 } else if (is_win) {
1263 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1264 libs += [
1265 "Gdi32.lib",
1266 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001267 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001268 }
mtklein25c81d42016-07-27 13:55:26 -07001269
Brian Osmanc9a42472018-05-31 13:17:12 -04001270 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001271
Brian Osmanc9a42472018-05-31 13:17:12 -04001272 if (skia_use_angle) {
1273 deps += [ "//third_party/angle2" ]
1274 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1275 }
1276 if (skia_use_vulkan) {
1277 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1278 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
1279 }
1280 if (skia_use_metal) {
1281 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001282 }
mtklein25c81d42016-07-27 13:55:26 -07001283 }
mtklein25c81d42016-07-27 13:55:26 -07001284
mtkleinc095df52016-08-24 12:23:52 -07001285 test_lib("flags") {
1286 public_include_dirs = [ "tools/flags" ]
1287 sources = [
1288 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001289 ]
1290 }
1291 test_lib("common_flags") {
1292 public_include_dirs = [ "tools/flags" ]
1293 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001294 "tools/flags/SkCommonFlags.cpp",
1295 "tools/flags/SkCommonFlagsConfig.cpp",
1296 ]
1297 deps = [
mtklein046cb562016-09-16 10:23:12 -07001298 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001299 ":gpu_tool_utils",
1300 ]
1301 }
mtklein25c81d42016-07-27 13:55:26 -07001302
mtkleinc095df52016-08-24 12:23:52 -07001303 test_lib("tool_utils") {
1304 public_include_dirs = [
1305 "tools",
1306 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001307 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001308 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001309 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001310 ]
1311 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001312 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001313 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001314 "tools/DDLPromiseImageHelper.cpp",
1315 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001316 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001317 "tools/ProcStats.cpp",
1318 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001319 "tools/UrlDataManager.cpp",
1320 "tools/debugger/SkDebugCanvas.cpp",
1321 "tools/debugger/SkDrawCommand.cpp",
1322 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001323 "tools/fonts/SkRandomScalerContext.cpp",
1324 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001325 "tools/fonts/SkTestFontMgr.h",
1326 "tools/fonts/SkTestSVGTypeface.cpp",
1327 "tools/fonts/SkTestSVGTypeface.h",
1328 "tools/fonts/SkTestTypeface.cpp",
1329 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001330 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001331 "tools/picture_utils.cpp",
1332 "tools/random_parse_path.cpp",
1333 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001334 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001335 "tools/trace/SkChromeTracingTracer.cpp",
1336 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001337 "tools/trace/SkDebugfTracer.cpp",
1338 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001339 "tools/trace/SkEventTracingPriv.cpp",
1340 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001341 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001342 libs = []
1343 if (is_ios) {
1344 sources += [ "tools/ios_utils.m" ]
1345 libs += [ "Foundation.framework" ]
1346 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001347 defines = []
1348 if (skia_tools_require_resources) {
1349 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1350 }
mtkleinc095df52016-08-24 12:23:52 -07001351 deps = [
mtklein046cb562016-09-16 10:23:12 -07001352 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001353 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001354 ":flags",
1355 "//third_party/libpng",
1356 ]
1357 public_deps = [
1358 "//third_party/jsoncpp",
1359 ]
1360 }
mtklein25c81d42016-07-27 13:55:26 -07001361
Mike Klein6e744122016-10-27 12:21:40 -04001362 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001363 test_lib("gm") {
1364 public_include_dirs = [ "gm" ]
1365 sources = gm_sources
1366 deps = [
scroggo19b91532016-10-24 09:03:26 -07001367 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001368 ":gpu_tool_utils",
1369 ":skia",
1370 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001371 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001372 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001373 ]
1374 }
mtklein25c81d42016-07-27 13:55:26 -07001375
Mike Klein6e744122016-10-27 12:21:40 -04001376 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001377 test_lib("tests") {
1378 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001379 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001380 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001381 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001382 }
mtkleinc095df52016-08-24 12:23:52 -07001383 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001384 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001385 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001386 ":skia",
1387 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001388 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001389 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001390 "//third_party/libpng",
1391 "//third_party/zlib",
1392 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001393 public_deps = [
1394 ":gpu_tool_utils", # Test.h #includes headers from this target.
Florin Malita7796f002018-06-08 12:25:38 -04001395 "modules/skjson:tests",
Mike Kleind63442d2017-03-27 14:16:04 -04001396 ]
mtkleinc095df52016-08-24 12:23:52 -07001397 }
mtklein2f3416d2016-08-02 16:02:05 -07001398
Mike Klein6e744122016-10-27 12:21:40 -04001399 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001400 test_lib("bench") {
1401 public_include_dirs = [ "bench" ]
1402 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001403 deps = [
1404 ":flags",
1405 ":gm",
1406 ":gpu_tool_utils",
1407 ":skia",
1408 ":tool_utils",
1409 ]
Florin Malita7796f002018-06-08 12:25:38 -04001410 public_deps = [
1411 "modules/skjson:bench",
1412 ]
mtkleinc095df52016-08-24 12:23:52 -07001413 }
mtklein2b6870c2016-07-28 14:17:33 -07001414
mtkleinc095df52016-08-24 12:23:52 -07001415 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001416 public_include_dirs = []
1417 if (skia_use_expat) {
1418 public_include_dirs += [ "experimental/svg/model" ]
1419 sources = [
1420 "experimental/svg/model/SkSVGAttribute.cpp",
1421 "experimental/svg/model/SkSVGAttributeParser.cpp",
1422 "experimental/svg/model/SkSVGCircle.cpp",
1423 "experimental/svg/model/SkSVGClipPath.cpp",
1424 "experimental/svg/model/SkSVGContainer.cpp",
1425 "experimental/svg/model/SkSVGDOM.cpp",
1426 "experimental/svg/model/SkSVGEllipse.cpp",
1427 "experimental/svg/model/SkSVGGradient.cpp",
1428 "experimental/svg/model/SkSVGLine.cpp",
1429 "experimental/svg/model/SkSVGLinearGradient.cpp",
1430 "experimental/svg/model/SkSVGNode.cpp",
1431 "experimental/svg/model/SkSVGPath.cpp",
1432 "experimental/svg/model/SkSVGPattern.cpp",
1433 "experimental/svg/model/SkSVGPoly.cpp",
1434 "experimental/svg/model/SkSVGRadialGradient.cpp",
1435 "experimental/svg/model/SkSVGRect.cpp",
1436 "experimental/svg/model/SkSVGRenderContext.cpp",
1437 "experimental/svg/model/SkSVGSVG.cpp",
1438 "experimental/svg/model/SkSVGShape.cpp",
1439 "experimental/svg/model/SkSVGStop.cpp",
1440 "experimental/svg/model/SkSVGTransformableNode.cpp",
1441 "experimental/svg/model/SkSVGUse.cpp",
1442 "experimental/svg/model/SkSVGValue.cpp",
1443 ]
1444 deps = [
1445 ":skia",
1446 ":xml",
1447 ]
1448 }
mtkleinc095df52016-08-24 12:23:52 -07001449 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001450
Kevin Lubickebf648e2017-09-21 13:45:16 -04001451 if (target_cpu != "wasm") {
1452 test_lib("views") {
1453 public_include_dirs = [ "include/views" ]
1454 sources = [
1455 "src/views/SkEvent.cpp",
1456 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001457 "src/views/SkTouchGesture.cpp",
1458 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001459 ]
Brian Osman34755e22016-12-05 09:46:02 -05001460 }
Brian Osman16adfa32016-10-18 14:42:44 -04001461 }
1462
Mike Klein38af9432016-11-11 11:39:44 -05001463 if (skia_use_lua) {
1464 test_lib("lua") {
1465 public_include_dirs = []
1466 sources = [
1467 "src/utils/SkLua.cpp",
1468 "src/utils/SkLuaCanvas.cpp",
1469 ]
1470 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001471 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001472 "//third_party/lua",
1473 ]
1474 }
1475
Mike Kleine6682eb2017-01-05 10:54:57 -05001476 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001477 sources = [
1478 "tools/lua/lua_app.cpp",
1479 ]
1480 deps = [
1481 ":lua",
1482 ":skia",
1483 "//third_party/lua",
1484 ]
Mike Klein38af9432016-11-11 11:39:44 -05001485 }
1486
Mike Kleine6682eb2017-01-05 10:54:57 -05001487 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001488 sources = [
1489 "tools/lua/lua_pictures.cpp",
1490 ]
1491 deps = [
1492 ":flags",
1493 ":lua",
1494 ":skia",
1495 ":tool_utils",
1496 "//third_party/lua",
1497 ]
Mike Klein38af9432016-11-11 11:39:44 -05001498 }
1499 }
1500
Cary Clark8032b982017-07-28 11:04:54 -04001501 test_app("bookmaker") {
1502 sources = [
1503 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001504 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001505 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001506 "tools/bookmaker/fiddleParser.cpp",
1507 "tools/bookmaker/includeParser.cpp",
1508 "tools/bookmaker/includeWriter.cpp",
1509 "tools/bookmaker/mdOut.cpp",
1510 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001511 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001512 "tools/bookmaker/spellCheck.cpp",
1513 ]
1514 deps = [
1515 ":flags",
1516 ":skia",
1517 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001518 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001519 ]
1520 }
1521
Florin Malitae2aa7b62018-06-06 09:37:26 -04001522 if (is_linux) {
Florin Malita79725d32018-06-05 16:16:57 -04001523 test_app("skottie_tool") {
1524 deps = [
1525 "modules/skottie:tool",
1526 ]
1527 }
1528 }
1529
Kevin Lubickebf648e2017-09-21 13:45:16 -04001530 if (target_cpu != "wasm") {
1531 import("gn/samples.gni")
1532 test_lib("samples") {
1533 public_include_dirs = [ "samplecode" ]
1534 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001535 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001536 deps = [
1537 ":experimental_svg_model",
1538 ":flags",
1539 ":gm",
1540 ":tool_utils",
1541 ":views",
1542 ":xml",
Brian Osmanccb87522018-06-01 19:20:00 +00001543 "modules/sksg:samples",
Herb Derby264182c2018-05-29 15:53:40 -04001544 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001545 ]
Mike Klein38af9432016-11-11 11:39:44 -05001546
Kevin Lubickebf648e2017-09-21 13:45:16 -04001547 if (skia_use_lua) {
1548 sources += [ "samplecode/SampleLua.cpp" ]
1549 deps += [
1550 ":lua",
1551 "//third_party/lua",
1552 ]
1553 }
1554 }
1555 test_app("dm") {
1556 sources = [
1557 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001558 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001559 "dm/DMJsonWriter.cpp",
1560 "dm/DMSrcSink.cpp",
1561 ]
1562 include_dirs = [ "tests" ]
1563 deps = [
1564 ":common_flags",
1565 ":experimental_svg_model",
1566 ":flags",
1567 ":gm",
1568 ":gpu_tool_utils",
1569 ":skia",
1570 ":tests",
1571 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001572 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001573 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001574 "//third_party/jsoncpp",
1575 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001576 ]
1577 }
Brian Osman16adfa32016-10-18 14:42:44 -04001578 }
1579
Mike Kleina8a51ce2018-01-09 12:34:11 -05001580 if (!is_win) {
1581 test_app("remote_demo") {
1582 sources = [
1583 "tools/remote_demo.cpp",
1584 ]
1585 deps = [
1586 ":skia",
1587 ]
1588 }
1589 }
1590
Mike Kleine6682eb2017-01-05 10:54:57 -05001591 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001592 sources = [
1593 "bench/nanobench.cpp",
1594 ]
1595 deps = [
1596 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001597 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001598 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001599 ":flags",
1600 ":gm",
1601 ":gpu_tool_utils",
1602 ":skia",
1603 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001604 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001605 "//third_party/jsoncpp",
1606 ]
mtklein2b6870c2016-07-28 14:17:33 -07001607 }
halcanary19a97202016-08-03 15:08:04 -07001608
Ravi Mistry10d36c52017-01-31 09:49:18 -05001609 test_app("skpinfo") {
1610 sources = [
1611 "tools/skpinfo.cpp",
1612 ]
1613 deps = [
1614 ":flags",
1615 ":skia",
1616 ]
1617 }
1618
Brian Osmanc9a42472018-05-31 13:17:12 -04001619 test_app("skpbench") {
1620 sources = [
1621 "tools/skpbench/skpbench.cpp",
1622 ]
1623 deps = [
1624 ":flags",
1625 ":gpu_tool_utils",
1626 ":skia",
1627 ":tool_utils",
1628 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001629 }
1630
Mike Kleine6682eb2017-01-05 10:54:57 -05001631 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001632 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001633 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001634 ]
1635 deps = [
1636 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001637 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001638 ]
halcanary3eee9d92016-09-10 07:01:53 -07001639 }
mtklein046cb562016-09-16 10:23:12 -07001640
Matt Sarett9f1c4032017-05-17 10:06:32 -04001641 test_app("create_flutter_test_images") {
1642 sources = [
1643 "tools/create_flutter_test_images.cpp",
1644 ]
1645 deps = [
1646 ":skia",
1647 ":tool_utils",
1648 ]
1649 }
1650
Ben Wagner219f3622017-07-17 15:32:25 -04001651 test_app("create_test_font") {
1652 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001653 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001654 ]
1655 deps = [
1656 ":skia",
1657 ]
1658 assert_no_deps = [
1659 # tool_utils requires the output of this app.
1660 ":tool_utils",
1661 ]
1662 }
1663
Ben Wagner97182cc2018-02-15 10:20:04 -05001664 test_app("create_test_font_color") {
1665 sources = [
1666 "tools/fonts/create_test_font_color.cpp",
1667 ]
1668 deps = [
1669 ":flags",
1670 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001671 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001672 ]
1673 }
1674
Mike Kleine6682eb2017-01-05 10:54:57 -05001675 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001676 sources = [
1677 "tools/get_images_from_skps.cpp",
1678 ]
1679 deps = [
1680 ":flags",
1681 ":skia",
1682 "//third_party/jsoncpp",
1683 ]
mtklein046cb562016-09-16 10:23:12 -07001684 }
mtkleinecbc5262016-09-22 11:51:24 -07001685
Kevin Lubickebf648e2017-09-21 13:45:16 -04001686 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001687 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001688 sources = [
1689 "tools/skiaserve/Request.cpp",
1690 "tools/skiaserve/Response.cpp",
1691 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001692 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1693 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1694 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1695 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1696 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1697 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1698 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1699 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1700 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001701 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1702 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001703 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1704 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1705 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1706 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1707 ]
1708 deps = [
1709 ":flags",
1710 ":gpu_tool_utils",
1711 ":skia",
1712 ":tool_utils",
1713 "//third_party/jsoncpp",
1714 "//third_party/libmicrohttpd",
1715 "//third_party/libpng",
1716 ]
Mike Klein7d302882016-11-03 14:06:31 -04001717 }
mtkleinecbc5262016-09-22 11:51:24 -07001718 }
kjlubick14f984b2016-10-03 11:49:45 -07001719
Mike Kleine6682eb2017-01-05 10:54:57 -05001720 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001721 include_dirs = [
1722 "tools",
1723 "tools/debugger",
1724 ]
kjlubick14f984b2016-10-03 11:49:45 -07001725 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001726 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001727 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001728 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001729 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001730 "fuzz/FuzzGradients.cpp",
1731 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001732 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001733 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001734 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001735 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001736 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1737 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001738 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1739 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001740 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1741 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001742 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001743 "tools/UrlDataManager.cpp",
1744 "tools/debugger/SkDebugCanvas.cpp",
1745 "tools/debugger/SkDrawCommand.cpp",
1746 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001747 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001748 ]
1749 deps = [
1750 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001751 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001752 ":skia",
Florin Malita7796f002018-06-08 12:25:38 -04001753 "modules/skjson:fuzz",
Florin Malita3d856bd2018-05-26 09:49:28 -04001754 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001755 "//third_party/jsoncpp",
1756 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001757 ]
kjlubick14f984b2016-10-03 11:49:45 -07001758 }
Mike Klein38312422016-10-05 15:41:01 -04001759
Mike Kleine6682eb2017-01-05 10:54:57 -05001760 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001761 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001762 rebase_path("tests/skia_test.cpp"),
1763 rebase_path("tests/Test.cpp"),
1764 ]
caryclark9feb6322016-10-25 08:58:26 -07001765 deps = [
1766 ":flags",
1767 ":gpu_tool_utils",
1768 ":skia",
1769 ":tool_utils",
1770 ]
caryclark9feb6322016-10-25 08:58:26 -07001771 }
1772
Mike Kleine6682eb2017-01-05 10:54:57 -05001773 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001774 sources = [
1775 "tools/DumpRecord.cpp",
1776 "tools/dump_record.cpp",
1777 ]
1778 deps = [
1779 ":flags",
1780 ":skia",
1781 ]
Mike Klein38312422016-10-05 15:41:01 -04001782 }
bungemanfe917272016-10-13 17:36:40 -04001783
Mike Kleine6682eb2017-01-05 10:54:57 -05001784 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001785 sources = [
1786 "tools/skdiff/skdiff.cpp",
1787 "tools/skdiff/skdiff_html.cpp",
1788 "tools/skdiff/skdiff_main.cpp",
1789 "tools/skdiff/skdiff_utils.cpp",
1790 ]
1791 deps = [
1792 ":skia",
1793 ":tool_utils",
1794 ]
bungemanfe917272016-10-13 17:36:40 -04001795 }
halcanarya73d76a2016-10-17 13:19:02 -07001796
Mike Kleine6682eb2017-01-05 10:54:57 -05001797 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001798 sources = [
1799 "tools/skp_parser.cpp",
1800 ]
1801 deps = [
1802 ":skia",
1803 ":tool_utils",
1804 "//third_party/jsoncpp",
1805 ]
halcanarya73d76a2016-10-17 13:19:02 -07001806 }
Brian Osman16adfa32016-10-18 14:42:44 -04001807
Brian Osmanc9a42472018-05-31 13:17:12 -04001808 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001809 test_lib("skqp_lib") {
1810 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001811 defines =
1812 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001813 if (skia_skqp_enable_driver_correctness_workarounds) {
1814 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1815 }
Hal Canary75427132017-10-11 16:00:31 -04001816 sources = [
1817 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001818 "tools/skqp/gm_knowledge.cpp",
1819 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001820 ]
1821 deps = [
1822 ":gm",
1823 ":gpu_tool_utils",
1824 ":skia",
1825 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001826 ":tool_utils",
1827 ]
1828 }
1829 test_app("skqp") {
1830 sources = [
1831 "tools/skqp/skqp.cpp",
1832 ]
1833 deps = [
1834 ":skia",
1835 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001836 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001837 "//third_party/googletest",
1838 ]
1839 }
1840 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001841 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001842 test_app("skqp_app") {
1843 is_shared_library = true
1844 sources = [
1845 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1846 ]
1847 deps = [
1848 ":skia",
1849 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001850 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001851 ]
1852 libs = [ "android" ]
1853 }
1854 }
Hal Canary75427132017-10-11 16:00:31 -04001855
Hal Canarya9de7602018-01-19 13:08:23 -05001856 test_app("list_gms") {
1857 sources = [
1858 "tools/list_gms.cpp",
1859 ]
1860 deps = [
1861 ":gm",
1862 ":skia",
1863 ]
1864 }
1865 test_app("list_gpu_unit_tests") {
1866 sources = [
1867 "dm/DMGpuTestProcs.cpp",
1868 "tools/list_gpu_unit_tests.cpp",
1869 ]
1870 deps = [
1871 ":skia",
1872 ":tests",
1873 ]
1874 }
1875
Brian Osmanc9a42472018-05-31 13:17:12 -04001876 test_lib("sk_app") {
1877 public_include_dirs = [ "tools/sk_app" ]
1878 sources = [
1879 "tools/sk_app/CommandSet.cpp",
1880 "tools/sk_app/GLWindowContext.cpp",
1881 "tools/sk_app/Window.cpp",
1882 ]
1883 libs = []
1884
1885 if (is_android) {
1886 sources += [
1887 "tools/sk_app/android/GLWindowContext_android.cpp",
1888 "tools/sk_app/android/RasterWindowContext_android.cpp",
1889 "tools/sk_app/android/Window_android.cpp",
1890 "tools/sk_app/android/main_android.cpp",
1891 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001892 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001893 libs += [ "android" ]
1894 } else if (is_linux) {
1895 sources += [
1896 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1897 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1898 "tools/sk_app/unix/Window_unix.cpp",
1899 "tools/sk_app/unix/keysym2ucs.c",
1900 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001901 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001902 libs += [
1903 "GL",
1904 "X11",
1905 ]
1906 } else if (is_win) {
1907 sources += [
1908 "tools/sk_app/win/GLWindowContext_win.cpp",
1909 "tools/sk_app/win/RasterWindowContext_win.cpp",
1910 "tools/sk_app/win/Window_win.cpp",
1911 "tools/sk_app/win/main_win.cpp",
1912 ]
Brian Salomon194db172017-08-17 14:37:06 -04001913 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001914 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001915 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001916 } else if (is_mac) {
1917 sources += [
1918 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1919 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1920 "tools/sk_app/mac/Window_mac.cpp",
1921 "tools/sk_app/mac/main_mac.cpp",
1922 ]
1923 libs += [
1924 "QuartzCore.framework",
1925 "Cocoa.framework",
1926 "Foundation.framework",
1927 ]
1928 } else if (is_ios) {
1929 sources += [
1930 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1931 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1932 "tools/sk_app/ios/Window_ios.cpp",
1933 "tools/sk_app/ios/main_ios.cpp",
1934 ]
1935 }
1936
1937 if (skia_use_vulkan) {
1938 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1939 if (is_android) {
1940 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1941 } else if (is_linux) {
1942 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1943 libs += [ "X11-xcb" ]
1944 } else if (is_win) {
1945 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
1946 }
1947 }
1948
1949 deps = [
1950 ":gpu_tool_utils",
1951 ":skia",
1952 ":tool_utils",
1953 ":views",
1954 ]
1955 if (is_android) {
1956 deps += [ "//third_party/native_app_glue" ]
1957 } else if (is_mac || is_ios) {
1958 deps += [ "//third_party/libsdl" ]
1959 }
1960 if (skia_use_angle) {
1961 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05001962 }
Brian Osman16adfa32016-10-18 14:42:44 -04001963 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001964
Brian Osmanc9a42472018-05-31 13:17:12 -04001965 test_app("viewer") {
1966 is_shared_library = is_android
1967 if (is_ios) {
1968 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05001969 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001970 sources = [
1971 "tools/viewer/BisectSlide.cpp",
1972 "tools/viewer/GMSlide.cpp",
1973 "tools/viewer/ImGuiLayer.cpp",
1974 "tools/viewer/ImageSlide.cpp",
1975 "tools/viewer/SKPSlide.cpp",
1976 "tools/viewer/SampleSlide.cpp",
1977 "tools/viewer/SkottieSlide.cpp",
1978 "tools/viewer/SlideDir.cpp",
1979 "tools/viewer/StatsLayer.cpp",
1980 "tools/viewer/SvgSlide.cpp",
1981 "tools/viewer/Viewer.cpp",
1982 ]
1983 libs = []
1984
1985 include_dirs = []
1986 deps = [
1987 ":experimental_svg_model",
1988 ":flags",
1989 ":gm",
1990 ":gpu_tool_utils",
1991 ":samples",
1992 ":sk_app",
1993 ":skia",
1994 ":tool_utils",
1995 ":views",
1996 "modules/skottie",
1997 "modules/sksg",
1998 "//third_party/imgui",
1999 "//third_party/jsoncpp",
2000 ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002001 }
2002
Brian Osmanc9a42472018-05-31 13:17:12 -04002003 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002004 test_app("HelloWorld") {
2005 sources = [
2006 "example/HelloWorld.cpp",
2007 ]
2008 libs = []
2009
2010 include_dirs = []
2011 deps = [
2012 ":flags",
2013 ":gpu_tool_utils",
2014 ":sk_app",
2015 ":skia",
2016 ":tool_utils",
2017 ":views",
2018 ]
2019 }
2020 }
2021
Brian Osmanc9a42472018-05-31 13:17:12 -04002022 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002023 test_app("SkiaSDLExample") {
2024 sources = [
2025 "example/SkiaSDLExample.cpp",
2026 ]
2027 libs = []
2028 include_dirs = []
2029 deps = [
2030 ":gpu_tool_utils",
2031 ":skia",
2032 "//third_party/libsdl",
2033 ]
2034 }
2035 }
2036
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002037 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2038 action_foreach("generate_mocs") {
2039 script = "gn/call.py"
2040 sources = [
2041 "tools/mdbviz/MainWindow.h",
2042 ]
2043 outputs = [
2044 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2045 ]
2046 args = [
2047 "$skia_qt_path" + "/bin/moc",
2048 "{{source}}",
2049 "-o",
2050 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2051 ]
2052 }
2053 action_foreach("generate_resources") {
2054 script = "gn/call.py"
2055 sources = [
2056 "tools/mdbviz/resources.qrc",
2057 ]
2058 outputs = [
2059 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2060 ]
2061 args = [
2062 "$skia_qt_path" + "/bin/rcc",
2063 "{{source}}",
2064 "-o",
2065 "gen/mdbviz/{{source_name_part}}_res.cpp",
2066 ]
2067 }
2068 test_app("mdbviz") {
2069 if (is_win) {
2070 # on Windows we need to disable some exception handling warnings due to the Qt headers
2071 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2072 }
2073 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002074 "tools/UrlDataManager.cpp",
2075 "tools/debugger/SkDebugCanvas.cpp",
2076 "tools/debugger/SkDrawCommand.cpp",
2077 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002078 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002079 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002080 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002081 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002082
2083 # generated files
2084 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2085 "$target_gen_dir/mdbviz/resources_res.cpp",
2086 ]
2087 lib_dirs = [ "$skia_qt_path/lib" ]
2088 libs = [
2089 "Qt5Core.lib",
2090 "Qt5Gui.lib",
2091 "Qt5Widgets.lib",
2092 ]
2093 include_dirs = [
2094 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002095 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002096 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002097 "tools",
2098 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002099 ]
2100 deps = [
2101 ":generate_mocs",
2102 ":generate_resources",
2103 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002104 "//third_party/jsoncpp",
2105 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002106 ]
2107 }
2108 }
2109
Mike Kleine459afd2017-03-03 09:21:30 -05002110 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002111 copy("gdbserver") {
2112 sources = [
2113 "$ndk/$ndk_gdbserver",
2114 ]
2115 outputs = [
2116 "$root_out_dir/gdbserver",
2117 ]
2118 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002119 }
mtklein25c81d42016-07-27 13:55:26 -07002120}