blob: 36ab16ca11ebbf1d60ca4ad3b80432157459160a [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
Brian Salomon5f33a8c2018-02-26 14:32:39 -050062 skia_use_legacy_gpu_pixel_ops = is_skia_dev_build && is_win # Arbitrary to keep old code path tested until deletion.
63
Mike Klein4d598a32016-10-31 13:44:49 -040064 if (is_android) {
65 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070066 } else if (is_fuchsia) {
67 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040068 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040069 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
70 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040071 }
Jim Van Verth4e502972017-12-07 15:16:10 -050072
73 if (is_ios) {
74 skia_ios_identity = ".*Google.*"
75 skia_ios_profile = "Google Development"
76 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040077}
Brian Salomon789e25e2016-09-30 13:41:03 -040078
Adam Barth54ef74a2017-10-13 10:59:38 -070079if (defined(skia_settings)) {
80 import(skia_settings)
81}
82
Brian Osmanc9a42472018-05-31 13:17:12 -040083# Our tools require static linking (they use non-exported symbols), and the GPU backend.
84skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070085
mtkleina45be612016-08-29 15:22:10 -070086fontmgr_android_enabled = skia_use_expat && skia_use_freetype
87
mtklein1211e0c2016-07-26 13:55:45 -070088skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070089 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070090 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070091 "include/codec",
92 "include/config",
93 "include/core",
94 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040095 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070096 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050097 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070098 "include/pathops",
99 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700100 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/utils",
102 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700103]
104
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500105if (skia_enable_atlas_text) {
106 skia_public_includes += [ "include/atlastext" ]
107}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000108
mtkleinc04ff472016-06-23 10:29:30 -0700109# Skia public API, generally provided by :skia.
110config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700111 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400112 defines = []
113 if (is_component_build) {
114 defines += [ "SKIA_DLL" ]
115 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400116 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700117 defines += [ "SK_SAMPLES_FOR_X" ]
118 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400119 if (skia_enable_flutter_defines) {
120 defines += flutter_defines
121 }
mtklein06c35c02016-09-20 12:28:12 -0700122 if (!skia_enable_gpu) {
123 defines += [ "SK_SUPPORT_GPU=0" ]
124 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500125 if (skia_enable_atlas_text) {
126 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
127 }
mtkleinc04ff472016-06-23 10:29:30 -0700128}
129
130# Skia internal APIs, used by Skia itself and a few test tools.
131config("skia_private") {
132 visibility = [ ":*" ]
133
134 include_dirs = [
135 "include/private",
136 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700137 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700138 "src/core",
139 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700140 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700141 "src/image",
142 "src/images",
143 "src/lazy",
144 "src/opts",
145 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700146 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700147 "src/ports",
148 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400149 "src/shaders",
150 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700151 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700152 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700153 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500154 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700155 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700156 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400157 if (skia_llvm_path != "") {
158 include_dirs += [ "$skia_llvm_path/include" ]
159 }
mtklein150d1132016-08-01 06:56:40 -0700160
Mike Reeda9e241d2017-05-03 10:52:00 -0400161 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700162 if (is_android) {
163 defines += [
164 "SK_GAMMA_EXPONENT=1.4",
165 "SK_GAMMA_CONTRAST=0.0",
166 ]
167 }
mtklein88a7ac02016-09-14 11:16:49 -0700168 if (is_official_build || is_android) {
169 # TODO(bsalomon): it'd be nice to make Android normal.
170 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
171 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400172 libs = []
173 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500174 if (skia_enable_gpu) {
175 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500176 if (is_skia_dev_build && skia_use_vulkan) {
177 include_dirs += [ "tools/gpu/vk" ]
178 }
Brian Salomon03e05842017-02-23 12:23:47 -0500179 }
Brian Osman34755e22016-12-05 09:46:02 -0500180 if (skia_use_angle) {
181 defines += [ "SK_ANGLE" ]
182 }
Brian Osman3f375d02016-12-28 11:19:22 -0500183 if (skia_enable_discrete_gpu) {
184 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
185 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400186 if (!is_official_build) {
187 defines += [ "GR_TEST_UTILS=1" ]
188 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400189 if (skia_llvm_path != "") {
190 defines += [ "SK_LLVM_AVAILABLE" ]
191 include_dirs += [ "$skia_llvm_path/include" ]
192 libs += [ skia_llvm_lib ]
193 lib_dirs += [ "$skia_llvm_path/lib/" ]
194 }
mtkleinc04ff472016-06-23 10:29:30 -0700195}
196
197# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
198config("skia_library") {
199 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700200 defines = [ "SKIA_IMPLEMENTATION=1" ]
201}
202
203skia_library_configs = [
204 ":skia_public",
205 ":skia_private",
206 ":skia_library",
207]
208
mtklein9b8583d2016-08-24 17:32:30 -0700209# Use for CPU-specific Skia code that needs particular compiler flags.
210template("opts") {
211 if (invoker.enabled) {
212 source_set(target_name) {
213 forward_variables_from(invoker, "*")
214 configs += skia_library_configs
215 }
216 } else {
217 # If not enabled, a phony empty target that swallows all otherwise unused variables.
218 source_set(target_name) {
219 forward_variables_from(invoker,
220 "*",
221 [
222 "sources",
223 "cflags",
224 ])
225 }
226 }
anmittala7eaf2e2016-08-17 13:57:26 -0700227}
228
mtklein422310d2016-08-16 18:28:43 -0700229is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700230
mtklein7d6fb2c2016-08-25 14:50:44 -0700231opts("none") {
232 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700233 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700234 cflags = []
235}
236
mtklein7d6fb2c2016-08-25 14:50:44 -0700237opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700238 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700240 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700241}
242
243opts("arm64") {
244 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700245 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700246 cflags = []
247}
248
249opts("crc32") {
250 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700252 cflags = [ "-march=armv8-a+crc" ]
253}
254
mtklein9b8583d2016-08-24 17:32:30 -0700255opts("sse2") {
256 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400258 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400259 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
260 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400261 cflags = [ "-msse2" ]
262 }
mtklein9b8583d2016-08-24 17:32:30 -0700263}
mtkleinc04ff472016-06-23 10:29:30 -0700264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("ssse3") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-mssse3" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtkleinc04ff472016-06-23 10:29:30 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("sse41") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-msse4.1" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtklein4e976072016-08-08 09:06:27 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("sse42") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400289 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-msse4.2" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
294
295opts("avx") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400298 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000299 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400300 } else {
301 cflags = [ "-mavx" ]
302 }
mtkleinc04ff472016-06-23 10:29:30 -0700303}
304
Mike Klein1b9b7d52018-02-27 10:37:40 -0500305opts("hsw") {
306 enabled = is_x86
307 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400308 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500309 cflags = [ "/arch:AVX2" ]
310 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000311 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500312 }
313
314 # Oddly, clang-cl doesn't recognize this as a valid flag.
315 # If it ever does, it'd nice to move this up with -mavx2 and co.
316 if (is_clang && !is_win) {
317 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
318 # but nice to have, generating slightly better code for paths without explicit FMAs.
319 cflags += [ "-ffp-contract=fast" ]
320 }
321}
322
mtkleinc095df52016-08-24 12:23:52 -0700323# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700324template("optional") {
325 if (invoker.enabled) {
326 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700327 if (defined(invoker.public_defines)) {
328 defines = invoker.public_defines
329 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600330 if (defined(invoker.public_configs)) {
331 configs = invoker.public_configs
332 }
mtklein457b42a2016-08-23 13:56:37 -0700333 }
334 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700335 forward_variables_from(invoker,
336 "*",
337 [
338 "public_defines",
339 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700340 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700341 ])
mtklein457b42a2016-08-23 13:56:37 -0700342 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700343 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700344 if (defined(invoker.configs_to_remove)) {
345 configs -= invoker.configs_to_remove
346 }
mtklein457b42a2016-08-23 13:56:37 -0700347 }
348 } else {
mtklein457b42a2016-08-23 13:56:37 -0700349 source_set(target_name) {
350 forward_variables_from(invoker,
351 "*",
352 [
353 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400354 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700355 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700356 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700357 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700358 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700359 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700360 ])
mtkleincd01b032016-08-31 04:58:19 -0700361 if (defined(invoker.sources_when_disabled)) {
362 sources = invoker.sources_when_disabled
363 }
364 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700365 }
mtkleineb3c4252016-08-23 07:38:09 -0700366 }
mtklein457b42a2016-08-23 13:56:37 -0700367}
mtklein457b42a2016-08-23 13:56:37 -0700368
Mike Kleina04bb452017-02-09 12:24:07 -0500369optional("effects") {
370 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400371 deps = [
372 ":compile_processors",
373 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500374 sources =
375 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
376 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
377}
378
mtkleina45be612016-08-29 15:22:10 -0700379optional("fontmgr_android") {
380 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700381
382 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500383 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700384 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700385 ]
386 sources = [
387 "src/ports/SkFontMgr_android.cpp",
388 "src/ports/SkFontMgr_android_factory.cpp",
389 "src/ports/SkFontMgr_android_parser.cpp",
390 ]
391}
392
mtkleind2e39db2016-09-07 07:52:55 -0700393optional("fontmgr_custom") {
394 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
395
396 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500397 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700398 ]
399 sources = [
400 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500401 "src/ports/SkFontMgr_custom.h",
402 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700403 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500404 "src/ports/SkFontMgr_custom_embedded.cpp",
405 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700406 ]
407}
408
Hal Canaryff2742e2018-01-30 11:35:47 -0500409optional("fontmgr_empty") {
410 enabled = skia_enable_fontmgr_empty
411 sources = [
412 "src/ports/SkFontMgr_empty_factory.cpp",
413 ]
414}
415
mtklein3cc22182016-08-29 13:26:14 -0700416optional("fontmgr_fontconfig") {
417 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700418
419 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500420 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700421 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700422 ]
423 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700424 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700425 "src/ports/SkFontConfigInterface_direct.cpp",
426 "src/ports/SkFontConfigInterface_direct_factory.cpp",
427 "src/ports/SkFontMgr_FontConfigInterface.cpp",
428 "src/ports/SkFontMgr_fontconfig.cpp",
429 "src/ports/SkFontMgr_fontconfig_factory.cpp",
430 ]
431}
432
mtkleincdedd0e2016-09-12 15:15:44 -0700433optional("fontmgr_fuchsia") {
434 enabled = is_fuchsia && skia_use_freetype
435
436 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500437 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700438 ]
439 sources = [
440 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500441 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700442 "src/ports/SkFontMgr_custom_empty_factory.cpp",
443 ]
444}
445
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700446if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400447 executable("sksllex") {
448 sources = [
449 "src/sksl/lex/Main.cpp",
450 "src/sksl/lex/NFA.cpp",
451 "src/sksl/lex/RegexNode.cpp",
452 "src/sksl/lex/RegexParser.cpp",
453 ]
454 include_dirs = [ "src/sksl/lex" ]
455 }
456
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700457 action("run_sksllex") {
458 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400459 deps = [
460 ":sksllex(//gn/toolchain:$host_toolchain)",
461 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700462 sources = [
463 "src/sksl/lex/layout.lex",
464 "src/sksl/lex/sksl.lex",
465 ]
466
467 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
468 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
469 outputs = [
470 "$target_out_dir/" +
471 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
472 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
473 # confused due to the same file being named by two different paths
474 ]
475 sksllex_path = "$root_out_dir/"
476 sksllex_path += "sksllex"
477 if (host_os == "win") {
478 sksllex_path += ".exe"
479 }
480 args = [
481 rebase_path(sksllex_path),
482 rebase_path("bin/clang-format"),
483 rebase_path("src"),
484 ]
485 }
486} else {
487 group("run_sksllex") {
488 }
489}
490
491if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400492 executable("skslc") {
493 defines = [ "SKSL_STANDALONE" ]
494 sources = [
495 "src/sksl/SkSLMain.cpp",
496 ]
497 sources += skia_sksl_sources
498 include_dirs = [
499 "src/gpu",
500 "src/sksl",
501 ]
502 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500503 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400504 "//third_party/spirv-tools",
505 ]
506 }
507
508 skia_gpu_processor_outputs = []
509 foreach(src, skia_gpu_processor_sources) {
510 dir = get_path_info(src, "dir")
511 name = get_path_info(src, "name")
512
513 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
514 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
515 skia_gpu_processor_outputs += [
516 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
517 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
518 # confused due to the same file being named by two different paths
519 ]
520 }
521
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500522 action("create_sksl_enums") {
523 script = "gn/create_sksl_enums.py"
524 sources = [
525 "include/private/GrSharedEnums.h",
526 ]
527 outputs = [
528 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500529 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500530 ]
531 args = [
532 rebase_path(sources[0]),
533 rebase_path(outputs[0]),
534 ]
535 }
536
Ethan Nicholas762466e2017-06-29 10:03:38 -0400537 action("compile_processors") {
538 script = "gn/compile_processors.py"
539 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500540 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 ":skslc(//gn/toolchain:$host_toolchain)",
542 ]
543 sources = skia_gpu_processor_sources
544 outputs = skia_gpu_processor_outputs
545 skslc_path = "$root_out_dir/"
546 if (host_toolchain != default_toolchain_name) {
547 skslc_path += "$host_toolchain/"
548 }
549 skslc_path += "skslc"
550 if (host_os == "win") {
551 skslc_path += ".exe"
552 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400553 args = [
554 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400555 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400556 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400557 args += rebase_path(skia_gpu_processor_sources)
558 }
559} else {
560 skia_gpu_processor_outputs = []
561 group("compile_processors") {
562 }
563}
564
mtklein06c35c02016-09-20 12:28:12 -0700565optional("gpu") {
566 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400567 deps = [
568 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700569 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400570 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700571 if (skia_generate_workarounds) {
572 deps += [ ":workaround_list" ]
573 }
mtkleine9fb3d52016-09-20 15:11:46 -0700574 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600575 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400576 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700577
Brian Salomon3d6801e2017-12-11 10:06:31 -0500578 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700579
580 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500581 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700582 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400583 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700584 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400585 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400586
587 # this lib is required to link against AHardwareBuffer
588 if (defined(ndk_api) && ndk_api >= 26) {
589 libs += [ "android" ]
590 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400591 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500592 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400593 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700594 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500595 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500596 libs += [
597 "GL",
598 "GLU",
599 ]
mtklein06c35c02016-09-20 12:28:12 -0700600 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500601 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800602 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500603 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400604 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500605 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400606 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700607 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700609 }
mtkleine9fb3d52016-09-20 15:11:46 -0700610
611 if (skia_use_vulkan) {
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400612 # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
613 # //third_party/vulkan directory in their trees so they can set up the vulkan library however
614 # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
615 # vulkan files.
616 public_deps += [ "third_party/vulkan" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400617 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700618 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700619 if (skia_enable_vulkan_debug_layers) {
620 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
621 }
mtkleine9fb3d52016-09-20 15:11:46 -0700622 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400623
Brian Salomon5f33a8c2018-02-26 14:32:39 -0500624 if (skia_use_legacy_gpu_pixel_ops) {
625 public_defines += [ "SK_LEGACY_GPU_PIXEL_OPS" ]
626 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400627 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400628 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400629 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
630 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400631
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400632 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400633 if (skia_use_metal) {
634 public_defines += [ "SK_METAL" ]
635 sources += skia_metal_sources
636 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400637 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400638 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500639
640 if (skia_enable_atlas_text) {
641 sources += skia_atlas_text_sources
642 }
mtklein06c35c02016-09-20 12:28:12 -0700643}
644
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400645optional("heif") {
646 enabled = skia_use_libheif
647 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
648
649 deps = []
650
651 sources = [
652 "src/codec/SkHeifCodec.cpp",
653 ]
654}
655
mtklein63213812016-08-24 09:55:56 -0700656optional("jpeg") {
657 enabled = skia_use_libjpeg_turbo
658 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
659
mtklein63213812016-08-24 09:55:56 -0700660 deps = [
661 "//third_party/libjpeg-turbo:libjpeg",
662 ]
663 sources = [
664 "src/codec/SkJpegCodec.cpp",
665 "src/codec/SkJpegDecoderMgr.cpp",
666 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700667 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400668 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700669 ]
670}
671
672optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500673 enabled = skia_use_zlib && skia_enable_pdf
674 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700675
mtklein63213812016-08-24 09:55:56 -0700676 deps = [
677 "//third_party/zlib",
678 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400679 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700680 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400681 }
brettwb9447282016-09-01 14:24:39 -0700682 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700683 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700684
685 if (skia_use_sfntly) {
686 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500687 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700688 }
689}
690
691optional("png") {
692 enabled = skia_use_libpng
693 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
694
mtklein63213812016-08-24 09:55:56 -0700695 deps = [
696 "//third_party/libpng",
697 ]
698 sources = [
699 "src/codec/SkIcoCodec.cpp",
700 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400701 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700702 ]
703}
704
scroggof84ad642016-10-31 09:02:57 -0700705optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400706 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700707 public_defines = [ "SK_CODEC_DECODES_RAW" ]
708
709 deps = [
710 "//third_party/dng_sdk",
711 "//third_party/libjpeg-turbo:libjpeg",
712 "//third_party/piex",
713 ]
714
715 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
716 # Skia.
717 configs_to_remove = [ "//gn:no_exceptions" ]
718
719 sources = [
720 "src/codec/SkRawAdapterCodec.cpp",
721 "src/codec/SkRawCodec.cpp",
722 ]
723}
724
Mike Klein852a8cb2018-05-15 10:46:58 -0400725import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400726source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400727 cflags = []
728 if (!is_win || is_clang) {
729 cflags += [
730 "-w",
731 "-std=c11",
732 ]
733 }
734
735 public = [
736 "third_party/skcms/skcms.h",
737 ]
738 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
739}
740
mtklein3cc22182016-08-29 13:26:14 -0700741optional("typeface_freetype") {
742 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700743
744 deps = [
745 "//third_party/freetype2",
746 ]
747 sources = [
748 "src/ports/SkFontHost_FreeType.cpp",
749 "src/ports/SkFontHost_FreeType_common.cpp",
750 ]
751}
752
mtklein457b42a2016-08-23 13:56:37 -0700753optional("webp") {
754 enabled = skia_use_libwebp
755 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
756
mtklein457b42a2016-08-23 13:56:37 -0700757 deps = [
758 "//third_party/libwebp",
759 ]
760 sources = [
761 "src/codec/SkWebpAdapterCodec.cpp",
762 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400763 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700764 ]
mtkleineb3c4252016-08-23 07:38:09 -0700765}
766
mtklein63213812016-08-24 09:55:56 -0700767optional("xml") {
768 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000769 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700770
mtklein63213812016-08-24 09:55:56 -0700771 deps = [
772 "//third_party/expat",
773 ]
774 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500775 "src/svg/SkSVGCanvas.cpp",
776 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700777 "src/xml/SkDOM.cpp",
778 "src/xml/SkXMLParser.cpp",
779 "src/xml/SkXMLWriter.cpp",
780 ]
781}
782
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700783if (skia_enable_gpu && skia_generate_workarounds) {
784 action("workaround_list") {
785 script = "tools/build_workaround_header.py"
786
787 inputs = [
788 "src/gpu/gpu_workaround_list.txt",
789 ]
790
791 # see comments in skia_compile_processors about out dir path shenanigans.
792 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700793 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700794
795 outputs = [
796 "$root_out_dir/$output_file",
797 ]
798 args = [
799 "--output-file",
800 "$output_file",
801 ]
802
803 foreach(file, inputs) {
804 args += [ rebase_path(file, root_build_dir) ]
805 }
806 }
807}
808
mtkleinc04ff472016-06-23 10:29:30 -0700809component("skia") {
810 public_configs = [ ":skia_public" ]
811 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700812
813 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700814 ":arm64",
815 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700816 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700817 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500818 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700819 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700820 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500821 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700822 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700823 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400824 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500825 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700826 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700827 ":none",
mtklein63213812016-08-24 09:55:56 -0700828 ":pdf",
829 ":png",
scroggof84ad642016-10-31 09:02:57 -0700830 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500831 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700832 ":sse2",
833 ":sse41",
834 ":sse42",
835 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700836 ":webp",
mtklein63213812016-08-24 09:55:56 -0700837 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700838 ]
839
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400840 # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
841 # need to get propagated up to the tools that depend on :skia and thus :gpu.
842 public_deps = [
843 ":gpu",
844 ]
845
Chinmay Garde43f115c2016-11-16 15:04:12 -0800846 # This file (and all GN files in Skia) are designed to work with an
847 # empty sources assignment filter; we handle all that explicitly.
848 # We clear the filter here for clients who may have set up a global filter.
849 set_sources_assignment_filter([])
850
mtkleinc04ff472016-06-23 10:29:30 -0700851 sources = []
brettwb9447282016-09-01 14:24:39 -0700852 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700853 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500854 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700855 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400856 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500857 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700858 "src/android/SkBitmapRegionCodec.cpp",
859 "src/android/SkBitmapRegionDecoder.cpp",
860 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400861 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700862 "src/codec/SkBmpCodec.cpp",
863 "src/codec/SkBmpMaskCodec.cpp",
864 "src/codec/SkBmpRLECodec.cpp",
865 "src/codec/SkBmpStandardCodec.cpp",
866 "src/codec/SkCodec.cpp",
867 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700868 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700869 "src/codec/SkMaskSwizzler.cpp",
870 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700871 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700872 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700873 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700874 "src/codec/SkSwizzler.cpp",
875 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700876 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700877 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700878 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700879 "src/ports/SkMemory_malloc.cpp",
880 "src/ports/SkOSFile_stdio.cpp",
881 "src/sfnt/SkOTTable_name.cpp",
882 "src/sfnt/SkOTUtils.cpp",
883 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700884 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700885 ]
brettwb9447282016-09-01 14:24:39 -0700886
mtklein7d6fb2c2016-08-25 14:50:44 -0700887 libs = []
888
mtkleinc04ff472016-06-23 10:29:30 -0700889 if (is_win) {
890 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400891 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700892 "src/ports/SkDebug_win.cpp",
893 "src/ports/SkFontHost_win.cpp",
894 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500895 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700896 "src/ports/SkImageEncoder_WIC.cpp",
897 "src/ports/SkImageGeneratorWIC.cpp",
898 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700899 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700900 "src/ports/SkScalerContext_win_dw.cpp",
901 "src/ports/SkTLS_win.cpp",
902 "src/ports/SkTypeface_win_dw.cpp",
903 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400904 libs += [
905 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500906 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400907 "Ole32.lib",
908 "OleAut32.lib",
909 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500910 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400911 ]
mtkleinc04ff472016-06-23 10:29:30 -0700912 } else {
913 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700914 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700915 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700916 "src/ports/SkTLS_pthread.cpp",
917 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400918 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700919 }
920
mtklein7d6fb2c2016-08-25 14:50:44 -0700921 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500922 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500923 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500924 deps += [ "//third_party/cpu-features" ]
925 }
mtklein06c35c02016-09-20 12:28:12 -0700926 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700927 libs += [
928 "EGL",
929 "GLESv2",
930 "log",
931 ]
932 }
933
mtkleinc04ff472016-06-23 10:29:30 -0700934 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700935 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400936 if (skia_use_egl) {
937 libs += [ "GLESv2" ]
938 }
mtkleinc04ff472016-06-23 10:29:30 -0700939 }
940
941 if (is_mac) {
942 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700943 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 "src/ports/SkFontHost_mac.cpp",
945 "src/ports/SkImageEncoder_CG.cpp",
946 "src/ports/SkImageGeneratorCG.cpp",
947 ]
mtklein09e61f72016-08-23 13:35:28 -0700948 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400949 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
950 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700951 "ApplicationServices.framework",
952 "OpenGL.framework",
953 ]
mtkleinc04ff472016-06-23 10:29:30 -0700954 }
abarth6fc8ff02016-07-15 15:15:15 -0700955
Mike Klein7d302882016-11-03 14:06:31 -0400956 if (is_ios) {
957 sources += [
958 "src/ports/SkDebug_stdio.cpp",
959 "src/ports/SkFontHost_mac.cpp",
960 "src/ports/SkImageEncoder_CG.cpp",
961 "src/ports/SkImageGeneratorCG.cpp",
962 ]
963 libs += [
964 "CoreFoundation.framework",
965 "CoreGraphics.framework",
966 "CoreText.framework",
967 "ImageIO.framework",
968 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400969
970 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
971 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400972 ]
973 }
974
abarth6fc8ff02016-07-15 15:15:15 -0700975 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700976 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700977 }
mtkleinc04ff472016-06-23 10:29:30 -0700978}
979
mtkleinc095df52016-08-24 12:23:52 -0700980# Targets guarded by skia_enable_tools may use //third_party freely.
981if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500982 # Used by gn_to_bp.py to list our public include dirs.
983 source_set("public") {
984 configs += [ ":skia_public" ]
985 }
986
Mike Kleinc36dedf2016-11-18 09:35:28 -0500987 config("skia.h_config") {
988 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500989 if (skia_use_vulkan) {
990 # So we can get the header which includes vulkan
991 include_dirs += [ "tools/gpu/vk" ]
992 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500993 }
994 action("skia.h") {
995 public_configs = [ ":skia.h_config" ]
996 skia_h = "$target_gen_dir/skia.h"
997 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -0400998
999 # TODO: would be cool to not hard-code these here, but how?
1000 module_public_includes = [
1001 "modules/sksg/include",
1002 "modules/skottie/include",
1003 ]
1004 args =
1005 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1006 [ rebase_path(skia_h, root_build_dir) ] +
1007 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001008 depfile = "$skia_h.deps"
1009 outputs = [
1010 skia_h,
1011 ]
1012 }
1013
Brian Osmanc9a42472018-05-31 13:17:12 -04001014 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001015 executable("fiddle") {
1016 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001017 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001018 "tools/fiddle/draw.cpp",
1019 "tools/fiddle/fiddle_main.cpp",
1020 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001021
1022 if (skia_use_egl) {
1023 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001024 } else {
1025 sources += [ "tools/fiddle/null_context.cpp" ]
1026 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001027 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001028 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001029 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001030 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001031 ":skia",
1032 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001033 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001034 ]
1035 }
1036 }
1037
Brian Osmanc9a42472018-05-31 13:17:12 -04001038 source_set("public_headers_warnings_check") {
1039 sources = [
1040 "tools/public_headers_warnings_check.cpp",
1041 ]
1042 configs -= [ "//gn:warnings_except_public_headers" ]
1043 deps = [
1044 ":skia",
1045 ":skia.h",
1046 "modules/skottie",
1047 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001048 }
1049
mtkleinc095df52016-08-24 12:23:52 -07001050 template("test_lib") {
1051 config(target_name + "_config") {
1052 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001053 if (defined(invoker.public_defines)) {
1054 defines = invoker.public_defines
1055 }
mtklein25c81d42016-07-27 13:55:26 -07001056 }
mtkleinc095df52016-08-24 12:23:52 -07001057 source_set(target_name) {
1058 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1059 public_configs = [
1060 ":" + target_name + "_config",
1061 ":skia_private",
1062 ]
1063
1064 if (!defined(deps)) {
1065 deps = []
1066 }
1067 deps += [ ":skia" ]
1068 testonly = true
1069 }
mtklein25c81d42016-07-27 13:55:26 -07001070 }
mtklein25c81d42016-07-27 13:55:26 -07001071
Mike Kleine6682eb2017-01-05 10:54:57 -05001072 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001073 if (is_ios) {
1074 app_name = target_name
1075 gen_path = target_gen_dir
1076
1077 action("${app_name}_generate_info_plist") {
1078 script = "//gn/gen_plist_ios.py"
1079 outputs = [
1080 "$gen_path/${app_name}_Info.plist",
1081 ]
1082 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1083 }
1084
1085 bundle_data("${app_name}_bundle_info_plist") {
1086 public_deps = [
1087 ":${app_name}_generate_info_plist",
1088 ]
1089 sources = [
1090 "$gen_path/${app_name}_Info.plist",
1091 ]
1092 outputs = [
1093 "{{bundle_root_dir}}/Info.plist",
1094 ]
1095 }
1096
Jim Van Verth329c5a62017-11-29 11:42:33 -05001097 bundle_ios_data =
1098 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1099
1100 if (bundle_ios_data) {
1101 has_skps =
1102 "True" == exec_script("//gn/checkdir.py",
1103 [ rebase_path("skps", root_build_dir) ],
1104 "trim string")
1105 bundle_data("${app_name}_bundle_resources") {
1106 sources = [
1107 "resources",
1108 ]
1109 outputs = [
1110 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1111 "{{bundle_resources_dir}}/data/resources",
1112 ]
1113 }
1114
1115 if (has_skps) {
1116 bundle_data("${app_name}_bundle_skps") {
1117 sources = [
1118 "skps",
1119 ]
1120 outputs = [
1121 # Store in same folder as resources
1122 "{{bundle_resources_dir}}/data/skps",
1123 ]
1124 }
1125 }
1126 }
1127
Jim Van Verth443a9132017-11-28 09:45:26 -05001128 executable("${app_name}_generate_executable") {
1129 forward_variables_from(invoker,
1130 "*",
1131 [
1132 "output_name",
1133 "visibility",
1134 "is_shared_library",
1135 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001136 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001137 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001138 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1139 }
1140
1141 bundle_data("${app_name}_bundle_executable") {
1142 public_deps = [
1143 ":${app_name}_generate_executable",
1144 ]
1145 sources = [
1146 "$gen_path/$app_name",
1147 ]
1148 outputs = [
1149 "{{bundle_executable_dir}}/$app_name",
1150 ]
1151 testonly = true
1152 }
1153
1154 create_bundle("$app_name") {
1155 product_type = "com.apple.product-type.application"
1156 testonly = true
1157
1158 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1159 bundle_resources_dir = bundle_root_dir
1160 bundle_executable_dir = bundle_root_dir
1161 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1162
1163 deps = [
1164 ":${app_name}_bundle_executable",
1165 ":${app_name}_bundle_info_plist",
1166 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001167 if (bundle_ios_data) {
1168 deps += [ ":${app_name}_bundle_resources" ]
1169 if (has_skps) {
1170 deps += [ ":${app_name}_bundle_skps" ]
1171 }
1172 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001173
1174 # should only code sign when running on a device, not the simulator
1175 if (target_cpu != "x64") {
1176 code_signing_script = "//gn/codesign_ios.py"
1177 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1178 code_signing_outputs = [
1179 "$bundle_root_dir/_CodeSignature/CodeResources",
1180 "$bundle_root_dir/embedded.mobileprovision",
1181 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001182 code_signing_args = [
1183 rebase_path("$bundle_root_dir", root_build_dir),
1184 skia_ios_identity,
1185 skia_ios_profile,
1186 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001187 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001188 }
1189 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001190 # !is_ios
1191
1192 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1193 shared_library("lib" + target_name) {
1194 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1195 configs += [ ":skia_private" ]
1196 testonly = true
1197 }
1198 } else {
1199 _executable = target_name
1200 executable(_executable) {
1201 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1202 configs += [ ":skia_private" ]
1203 testonly = true
1204 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001205 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001206 if (is_android && skia_android_serial != "" && defined(_executable)) {
1207 action("push_" + target_name) {
1208 script = "gn/push_to_android.py"
1209 deps = [
1210 ":" + _executable,
1211 ]
1212 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1213 outputs = [
1214 _stamp,
1215 ]
1216 args = [
1217 rebase_path("$root_build_dir/$_executable"),
1218 skia_android_serial,
1219 rebase_path(_stamp),
1220 ]
1221 testonly = true
1222 }
Mike Klein7d921032017-01-05 12:20:41 -05001223 }
1224 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001225 }
1226
mtkleinc095df52016-08-24 12:23:52 -07001227 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001228 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001229 public_defines = []
1230 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001231
Brian Osmanc9a42472018-05-31 13:17:12 -04001232 deps = []
1233 sources = [
1234 "tools/gpu/GrContextFactory.cpp",
1235 "tools/gpu/GrTest.cpp",
1236 "tools/gpu/ProxyUtils.cpp",
1237 "tools/gpu/TestContext.cpp",
1238 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1239 "tools/gpu/gl/GLTestContext.cpp",
1240 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
1241 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1242 "tools/gpu/gl/debug/GrBufferObj.cpp",
1243 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1244 "tools/gpu/gl/debug/GrProgramObj.cpp",
1245 "tools/gpu/gl/debug/GrShaderObj.cpp",
1246 "tools/gpu/gl/debug/GrTextureObj.cpp",
1247 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1248 "tools/gpu/gl/null/NullGLTestContext.cpp",
1249 "tools/gpu/mock/MockTestContext.cpp",
1250 ]
1251 libs = []
1252
1253 if (is_android || skia_use_egl) {
1254 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1255 } else if (is_ios) {
1256 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1257 libs += [ "OpenGLES.framework" ]
1258 } else if (is_linux) {
1259 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
1260 libs += [ "X11" ]
1261 } else if (is_mac) {
1262 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1263 } else if (is_win) {
1264 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1265 libs += [
1266 "Gdi32.lib",
1267 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001268 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001269 }
mtklein25c81d42016-07-27 13:55:26 -07001270
Brian Osmanc9a42472018-05-31 13:17:12 -04001271 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001272
Brian Osmanc9a42472018-05-31 13:17:12 -04001273 if (skia_use_angle) {
1274 deps += [ "//third_party/angle2" ]
1275 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1276 }
1277 if (skia_use_vulkan) {
1278 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1279 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
1280 }
1281 if (skia_use_metal) {
1282 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001283 }
mtklein25c81d42016-07-27 13:55:26 -07001284 }
mtklein25c81d42016-07-27 13:55:26 -07001285
mtkleinc095df52016-08-24 12:23:52 -07001286 test_lib("flags") {
1287 public_include_dirs = [ "tools/flags" ]
1288 sources = [
1289 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001290 ]
1291 }
1292 test_lib("common_flags") {
1293 public_include_dirs = [ "tools/flags" ]
1294 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001295 "tools/flags/SkCommonFlags.cpp",
1296 "tools/flags/SkCommonFlagsConfig.cpp",
1297 ]
1298 deps = [
mtklein046cb562016-09-16 10:23:12 -07001299 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001300 ":gpu_tool_utils",
1301 ]
1302 }
mtklein25c81d42016-07-27 13:55:26 -07001303
mtkleinc095df52016-08-24 12:23:52 -07001304 test_lib("tool_utils") {
1305 public_include_dirs = [
1306 "tools",
1307 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001308 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001309 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001310 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001311 ]
1312 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001313 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001314 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001315 "tools/DDLPromiseImageHelper.cpp",
1316 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001317 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001318 "tools/ProcStats.cpp",
1319 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001320 "tools/UrlDataManager.cpp",
1321 "tools/debugger/SkDebugCanvas.cpp",
1322 "tools/debugger/SkDrawCommand.cpp",
1323 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001324 "tools/fonts/SkRandomScalerContext.cpp",
1325 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001326 "tools/fonts/SkTestFontMgr.h",
1327 "tools/fonts/SkTestSVGTypeface.cpp",
1328 "tools/fonts/SkTestSVGTypeface.h",
1329 "tools/fonts/SkTestTypeface.cpp",
1330 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001331 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001332 "tools/picture_utils.cpp",
1333 "tools/random_parse_path.cpp",
1334 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001335 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001336 "tools/trace/SkChromeTracingTracer.cpp",
1337 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001338 "tools/trace/SkDebugfTracer.cpp",
1339 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001340 "tools/trace/SkEventTracingPriv.cpp",
1341 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001342 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001343 libs = []
1344 if (is_ios) {
1345 sources += [ "tools/ios_utils.m" ]
1346 libs += [ "Foundation.framework" ]
1347 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001348 defines = []
1349 if (skia_tools_require_resources) {
1350 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1351 }
mtkleinc095df52016-08-24 12:23:52 -07001352 deps = [
mtklein046cb562016-09-16 10:23:12 -07001353 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001354 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001355 ":flags",
1356 "//third_party/libpng",
1357 ]
1358 public_deps = [
1359 "//third_party/jsoncpp",
1360 ]
1361 }
mtklein25c81d42016-07-27 13:55:26 -07001362
Mike Klein6e744122016-10-27 12:21:40 -04001363 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001364 test_lib("gm") {
1365 public_include_dirs = [ "gm" ]
1366 sources = gm_sources
1367 deps = [
scroggo19b91532016-10-24 09:03:26 -07001368 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001369 ":gpu_tool_utils",
1370 ":skia",
1371 ":tool_utils",
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 Malita3b526b02018-05-25 12:43:51 -04001388 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001389 "//third_party/libpng",
1390 "//third_party/zlib",
1391 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001392 public_deps = [
1393 ":gpu_tool_utils", # Test.h #includes headers from this target.
1394 ]
mtkleinc095df52016-08-24 12:23:52 -07001395 }
mtklein2f3416d2016-08-02 16:02:05 -07001396
Mike Klein6e744122016-10-27 12:21:40 -04001397 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001398 test_lib("bench") {
1399 public_include_dirs = [ "bench" ]
1400 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001401 deps = [
1402 ":flags",
1403 ":gm",
1404 ":gpu_tool_utils",
1405 ":skia",
1406 ":tool_utils",
1407 ]
1408 }
mtklein2b6870c2016-07-28 14:17:33 -07001409
mtkleinc095df52016-08-24 12:23:52 -07001410 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001411 public_include_dirs = []
1412 if (skia_use_expat) {
1413 public_include_dirs += [ "experimental/svg/model" ]
1414 sources = [
1415 "experimental/svg/model/SkSVGAttribute.cpp",
1416 "experimental/svg/model/SkSVGAttributeParser.cpp",
1417 "experimental/svg/model/SkSVGCircle.cpp",
1418 "experimental/svg/model/SkSVGClipPath.cpp",
1419 "experimental/svg/model/SkSVGContainer.cpp",
1420 "experimental/svg/model/SkSVGDOM.cpp",
1421 "experimental/svg/model/SkSVGEllipse.cpp",
1422 "experimental/svg/model/SkSVGGradient.cpp",
1423 "experimental/svg/model/SkSVGLine.cpp",
1424 "experimental/svg/model/SkSVGLinearGradient.cpp",
1425 "experimental/svg/model/SkSVGNode.cpp",
1426 "experimental/svg/model/SkSVGPath.cpp",
1427 "experimental/svg/model/SkSVGPattern.cpp",
1428 "experimental/svg/model/SkSVGPoly.cpp",
1429 "experimental/svg/model/SkSVGRadialGradient.cpp",
1430 "experimental/svg/model/SkSVGRect.cpp",
1431 "experimental/svg/model/SkSVGRenderContext.cpp",
1432 "experimental/svg/model/SkSVGSVG.cpp",
1433 "experimental/svg/model/SkSVGShape.cpp",
1434 "experimental/svg/model/SkSVGStop.cpp",
1435 "experimental/svg/model/SkSVGTransformableNode.cpp",
1436 "experimental/svg/model/SkSVGUse.cpp",
1437 "experimental/svg/model/SkSVGValue.cpp",
1438 ]
1439 deps = [
1440 ":skia",
1441 ":xml",
1442 ]
1443 }
mtkleinc095df52016-08-24 12:23:52 -07001444 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001445
Kevin Lubickebf648e2017-09-21 13:45:16 -04001446 if (target_cpu != "wasm") {
1447 test_lib("views") {
1448 public_include_dirs = [ "include/views" ]
1449 sources = [
1450 "src/views/SkEvent.cpp",
1451 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001452 "src/views/SkTouchGesture.cpp",
1453 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001454 ]
Brian Osman34755e22016-12-05 09:46:02 -05001455 }
Brian Osman16adfa32016-10-18 14:42:44 -04001456 }
1457
Mike Klein38af9432016-11-11 11:39:44 -05001458 if (skia_use_lua) {
1459 test_lib("lua") {
1460 public_include_dirs = []
1461 sources = [
1462 "src/utils/SkLua.cpp",
1463 "src/utils/SkLuaCanvas.cpp",
1464 ]
1465 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001466 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001467 "//third_party/lua",
1468 ]
1469 }
1470
Mike Kleine6682eb2017-01-05 10:54:57 -05001471 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001472 sources = [
1473 "tools/lua/lua_app.cpp",
1474 ]
1475 deps = [
1476 ":lua",
1477 ":skia",
1478 "//third_party/lua",
1479 ]
Mike Klein38af9432016-11-11 11:39:44 -05001480 }
1481
Mike Kleine6682eb2017-01-05 10:54:57 -05001482 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001483 sources = [
1484 "tools/lua/lua_pictures.cpp",
1485 ]
1486 deps = [
1487 ":flags",
1488 ":lua",
1489 ":skia",
1490 ":tool_utils",
1491 "//third_party/lua",
1492 ]
Mike Klein38af9432016-11-11 11:39:44 -05001493 }
1494 }
1495
Cary Clark8032b982017-07-28 11:04:54 -04001496 test_app("bookmaker") {
1497 sources = [
1498 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001499 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001500 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001501 "tools/bookmaker/fiddleParser.cpp",
1502 "tools/bookmaker/includeParser.cpp",
1503 "tools/bookmaker/includeWriter.cpp",
1504 "tools/bookmaker/mdOut.cpp",
1505 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001506 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001507 "tools/bookmaker/spellCheck.cpp",
1508 ]
1509 deps = [
1510 ":flags",
1511 ":skia",
1512 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001513 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001514 ]
1515 }
1516
Kevin Lubickebf648e2017-09-21 13:45:16 -04001517 if (target_cpu != "wasm") {
1518 import("gn/samples.gni")
1519 test_lib("samples") {
1520 public_include_dirs = [ "samplecode" ]
1521 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001522 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001523 deps = [
1524 ":experimental_svg_model",
1525 ":flags",
1526 ":gm",
1527 ":tool_utils",
1528 ":views",
1529 ":xml",
Florin Malita3b526b02018-05-25 12:43:51 -04001530 "modules/sksg:samples",
Herb Derby264182c2018-05-29 15:53:40 -04001531 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001532 ]
Mike Klein38af9432016-11-11 11:39:44 -05001533
Kevin Lubickebf648e2017-09-21 13:45:16 -04001534 if (skia_use_lua) {
1535 sources += [ "samplecode/SampleLua.cpp" ]
1536 deps += [
1537 ":lua",
1538 "//third_party/lua",
1539 ]
1540 }
1541 }
1542 test_app("dm") {
1543 sources = [
1544 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001545 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001546 "dm/DMJsonWriter.cpp",
1547 "dm/DMSrcSink.cpp",
1548 ]
1549 include_dirs = [ "tests" ]
1550 deps = [
1551 ":common_flags",
1552 ":experimental_svg_model",
1553 ":flags",
1554 ":gm",
1555 ":gpu_tool_utils",
1556 ":skia",
1557 ":tests",
1558 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001559 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001560 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001561 "//third_party/jsoncpp",
1562 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001563 ]
1564 }
Brian Osman16adfa32016-10-18 14:42:44 -04001565 }
1566
Mike Kleina8a51ce2018-01-09 12:34:11 -05001567 if (!is_win) {
1568 test_app("remote_demo") {
1569 sources = [
1570 "tools/remote_demo.cpp",
1571 ]
1572 deps = [
1573 ":skia",
1574 ]
1575 }
1576 }
1577
Mike Kleine6682eb2017-01-05 10:54:57 -05001578 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001579 sources = [
1580 "bench/nanobench.cpp",
1581 ]
1582 deps = [
1583 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001584 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001585 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001586 ":flags",
1587 ":gm",
1588 ":gpu_tool_utils",
1589 ":skia",
1590 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001591 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001592 "//third_party/jsoncpp",
1593 ]
mtklein2b6870c2016-07-28 14:17:33 -07001594 }
halcanary19a97202016-08-03 15:08:04 -07001595
Ravi Mistry10d36c52017-01-31 09:49:18 -05001596 test_app("skpinfo") {
1597 sources = [
1598 "tools/skpinfo.cpp",
1599 ]
1600 deps = [
1601 ":flags",
1602 ":skia",
1603 ]
1604 }
1605
Brian Osmanc9a42472018-05-31 13:17:12 -04001606 test_app("skpbench") {
1607 sources = [
1608 "tools/skpbench/skpbench.cpp",
1609 ]
1610 deps = [
1611 ":flags",
1612 ":gpu_tool_utils",
1613 ":skia",
1614 ":tool_utils",
1615 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001616 }
1617
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001619 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001620 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001621 ]
1622 deps = [
1623 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001624 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001625 ]
halcanary3eee9d92016-09-10 07:01:53 -07001626 }
mtklein046cb562016-09-16 10:23:12 -07001627
Matt Sarett9f1c4032017-05-17 10:06:32 -04001628 test_app("create_flutter_test_images") {
1629 sources = [
1630 "tools/create_flutter_test_images.cpp",
1631 ]
1632 deps = [
1633 ":skia",
1634 ":tool_utils",
1635 ]
1636 }
1637
Ben Wagner219f3622017-07-17 15:32:25 -04001638 test_app("create_test_font") {
1639 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001640 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001641 ]
1642 deps = [
1643 ":skia",
1644 ]
1645 assert_no_deps = [
1646 # tool_utils requires the output of this app.
1647 ":tool_utils",
1648 ]
1649 }
1650
Ben Wagner97182cc2018-02-15 10:20:04 -05001651 test_app("create_test_font_color") {
1652 sources = [
1653 "tools/fonts/create_test_font_color.cpp",
1654 ]
1655 deps = [
1656 ":flags",
1657 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001658 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001659 ]
1660 }
1661
Mike Kleine6682eb2017-01-05 10:54:57 -05001662 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001663 sources = [
1664 "tools/get_images_from_skps.cpp",
1665 ]
1666 deps = [
1667 ":flags",
1668 ":skia",
1669 "//third_party/jsoncpp",
1670 ]
mtklein046cb562016-09-16 10:23:12 -07001671 }
mtkleinecbc5262016-09-22 11:51:24 -07001672
Kevin Lubickebf648e2017-09-21 13:45:16 -04001673 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001674 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001675 sources = [
1676 "tools/skiaserve/Request.cpp",
1677 "tools/skiaserve/Response.cpp",
1678 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001679 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1680 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1681 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1682 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1683 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1684 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1685 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1686 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1687 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001688 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1689 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001690 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1691 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1692 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1693 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1694 ]
1695 deps = [
1696 ":flags",
1697 ":gpu_tool_utils",
1698 ":skia",
1699 ":tool_utils",
1700 "//third_party/jsoncpp",
1701 "//third_party/libmicrohttpd",
1702 "//third_party/libpng",
1703 ]
Mike Klein7d302882016-11-03 14:06:31 -04001704 }
mtkleinecbc5262016-09-22 11:51:24 -07001705 }
kjlubick14f984b2016-10-03 11:49:45 -07001706
Mike Kleine6682eb2017-01-05 10:54:57 -05001707 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001708 include_dirs = [
1709 "tools",
1710 "tools/debugger",
1711 ]
kjlubick14f984b2016-10-03 11:49:45 -07001712 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001713 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001714 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001715 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001716 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001717 "fuzz/FuzzGradients.cpp",
1718 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001719 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001720 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001721 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001722 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001723 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1724 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001725 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1726 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001727 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1728 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001729 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001730 "tools/UrlDataManager.cpp",
1731 "tools/debugger/SkDebugCanvas.cpp",
1732 "tools/debugger/SkDrawCommand.cpp",
1733 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001734 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001735 ]
1736 deps = [
1737 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001738 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001739 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001740 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001741 "//third_party/jsoncpp",
1742 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001743 ]
kjlubick14f984b2016-10-03 11:49:45 -07001744 }
Mike Klein38312422016-10-05 15:41:01 -04001745
Mike Kleine6682eb2017-01-05 10:54:57 -05001746 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001747 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001748 rebase_path("tests/skia_test.cpp"),
1749 rebase_path("tests/Test.cpp"),
1750 ]
caryclark9feb6322016-10-25 08:58:26 -07001751 deps = [
1752 ":flags",
1753 ":gpu_tool_utils",
1754 ":skia",
1755 ":tool_utils",
1756 ]
caryclark9feb6322016-10-25 08:58:26 -07001757 }
1758
Mike Kleine6682eb2017-01-05 10:54:57 -05001759 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001760 sources = [
1761 "tools/DumpRecord.cpp",
1762 "tools/dump_record.cpp",
1763 ]
1764 deps = [
1765 ":flags",
1766 ":skia",
1767 ]
Mike Klein38312422016-10-05 15:41:01 -04001768 }
bungemanfe917272016-10-13 17:36:40 -04001769
Mike Kleine6682eb2017-01-05 10:54:57 -05001770 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001771 sources = [
1772 "tools/skdiff/skdiff.cpp",
1773 "tools/skdiff/skdiff_html.cpp",
1774 "tools/skdiff/skdiff_main.cpp",
1775 "tools/skdiff/skdiff_utils.cpp",
1776 ]
1777 deps = [
1778 ":skia",
1779 ":tool_utils",
1780 ]
bungemanfe917272016-10-13 17:36:40 -04001781 }
halcanarya73d76a2016-10-17 13:19:02 -07001782
Mike Kleine6682eb2017-01-05 10:54:57 -05001783 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001784 sources = [
1785 "tools/skp_parser.cpp",
1786 ]
1787 deps = [
1788 ":skia",
1789 ":tool_utils",
1790 "//third_party/jsoncpp",
1791 ]
halcanarya73d76a2016-10-17 13:19:02 -07001792 }
Brian Osman16adfa32016-10-18 14:42:44 -04001793
Brian Osmanc9a42472018-05-31 13:17:12 -04001794 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001795 test_lib("skqp_lib") {
1796 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001797 defines =
1798 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001799 if (skia_skqp_enable_driver_correctness_workarounds) {
1800 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1801 }
Hal Canary75427132017-10-11 16:00:31 -04001802 sources = [
1803 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001804 "tools/skqp/gm_knowledge.cpp",
1805 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001806 ]
1807 deps = [
1808 ":gm",
1809 ":gpu_tool_utils",
1810 ":skia",
1811 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001812 ":tool_utils",
1813 ]
1814 }
1815 test_app("skqp") {
1816 sources = [
1817 "tools/skqp/skqp.cpp",
1818 ]
1819 deps = [
1820 ":skia",
1821 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001822 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001823 "//third_party/googletest",
1824 ]
1825 }
1826 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001827 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001828 test_app("skqp_app") {
1829 is_shared_library = true
1830 sources = [
1831 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1832 ]
1833 deps = [
1834 ":skia",
1835 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001836 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001837 ]
1838 libs = [ "android" ]
1839 }
1840 }
Hal Canary75427132017-10-11 16:00:31 -04001841
Hal Canarya9de7602018-01-19 13:08:23 -05001842 test_app("list_gms") {
1843 sources = [
1844 "tools/list_gms.cpp",
1845 ]
1846 deps = [
1847 ":gm",
1848 ":skia",
1849 ]
1850 }
1851 test_app("list_gpu_unit_tests") {
1852 sources = [
1853 "dm/DMGpuTestProcs.cpp",
1854 "tools/list_gpu_unit_tests.cpp",
1855 ]
1856 deps = [
1857 ":skia",
1858 ":tests",
1859 ]
1860 }
1861
Brian Osmanc9a42472018-05-31 13:17:12 -04001862 test_lib("sk_app") {
1863 public_include_dirs = [ "tools/sk_app" ]
1864 sources = [
1865 "tools/sk_app/CommandSet.cpp",
1866 "tools/sk_app/GLWindowContext.cpp",
1867 "tools/sk_app/Window.cpp",
1868 ]
1869 libs = []
1870
1871 if (is_android) {
1872 sources += [
1873 "tools/sk_app/android/GLWindowContext_android.cpp",
1874 "tools/sk_app/android/RasterWindowContext_android.cpp",
1875 "tools/sk_app/android/Window_android.cpp",
1876 "tools/sk_app/android/main_android.cpp",
1877 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001878 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001879 libs += [ "android" ]
1880 } else if (is_linux) {
1881 sources += [
1882 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1883 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1884 "tools/sk_app/unix/Window_unix.cpp",
1885 "tools/sk_app/unix/keysym2ucs.c",
1886 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001887 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001888 libs += [
1889 "GL",
1890 "X11",
1891 ]
1892 } else if (is_win) {
1893 sources += [
1894 "tools/sk_app/win/GLWindowContext_win.cpp",
1895 "tools/sk_app/win/RasterWindowContext_win.cpp",
1896 "tools/sk_app/win/Window_win.cpp",
1897 "tools/sk_app/win/main_win.cpp",
1898 ]
Brian Salomon194db172017-08-17 14:37:06 -04001899 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001900 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001901 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001902 } else if (is_mac) {
1903 sources += [
1904 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1905 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1906 "tools/sk_app/mac/Window_mac.cpp",
1907 "tools/sk_app/mac/main_mac.cpp",
1908 ]
1909 libs += [
1910 "QuartzCore.framework",
1911 "Cocoa.framework",
1912 "Foundation.framework",
1913 ]
1914 } else if (is_ios) {
1915 sources += [
1916 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1917 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1918 "tools/sk_app/ios/Window_ios.cpp",
1919 "tools/sk_app/ios/main_ios.cpp",
1920 ]
1921 }
1922
1923 if (skia_use_vulkan) {
1924 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1925 if (is_android) {
1926 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1927 } else if (is_linux) {
1928 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1929 libs += [ "X11-xcb" ]
1930 } else if (is_win) {
1931 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
1932 }
1933 }
1934
1935 deps = [
1936 ":gpu_tool_utils",
1937 ":skia",
1938 ":tool_utils",
1939 ":views",
1940 ]
1941 if (is_android) {
1942 deps += [ "//third_party/native_app_glue" ]
1943 } else if (is_mac || is_ios) {
1944 deps += [ "//third_party/libsdl" ]
1945 }
1946 if (skia_use_angle) {
1947 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05001948 }
Brian Osman16adfa32016-10-18 14:42:44 -04001949 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001950
Brian Osmanc9a42472018-05-31 13:17:12 -04001951 test_app("viewer") {
1952 is_shared_library = is_android
1953 if (is_ios) {
1954 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05001955 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001956 sources = [
1957 "tools/viewer/BisectSlide.cpp",
1958 "tools/viewer/GMSlide.cpp",
1959 "tools/viewer/ImGuiLayer.cpp",
1960 "tools/viewer/ImageSlide.cpp",
1961 "tools/viewer/SKPSlide.cpp",
1962 "tools/viewer/SampleSlide.cpp",
1963 "tools/viewer/SkottieSlide.cpp",
1964 "tools/viewer/SlideDir.cpp",
1965 "tools/viewer/StatsLayer.cpp",
1966 "tools/viewer/SvgSlide.cpp",
1967 "tools/viewer/Viewer.cpp",
1968 ]
1969 libs = []
1970
1971 include_dirs = []
1972 deps = [
1973 ":experimental_svg_model",
1974 ":flags",
1975 ":gm",
1976 ":gpu_tool_utils",
1977 ":samples",
1978 ":sk_app",
1979 ":skia",
1980 ":tool_utils",
1981 ":views",
1982 "modules/skottie",
1983 "modules/sksg",
1984 "//third_party/imgui",
1985 "//third_party/jsoncpp",
1986 ]
Brian Osmaneff04b52017-11-21 13:18:02 -05001987 }
1988
Brian Osmanc9a42472018-05-31 13:17:12 -04001989 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001990 test_app("HelloWorld") {
1991 sources = [
1992 "example/HelloWorld.cpp",
1993 ]
1994 libs = []
1995
1996 include_dirs = []
1997 deps = [
1998 ":flags",
1999 ":gpu_tool_utils",
2000 ":sk_app",
2001 ":skia",
2002 ":tool_utils",
2003 ":views",
2004 ]
2005 }
2006 }
2007
Brian Osmanc9a42472018-05-31 13:17:12 -04002008 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002009 test_app("SkiaSDLExample") {
2010 sources = [
2011 "example/SkiaSDLExample.cpp",
2012 ]
2013 libs = []
2014 include_dirs = []
2015 deps = [
2016 ":gpu_tool_utils",
2017 ":skia",
2018 "//third_party/libsdl",
2019 ]
2020 }
2021 }
2022
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002023 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2024 action_foreach("generate_mocs") {
2025 script = "gn/call.py"
2026 sources = [
2027 "tools/mdbviz/MainWindow.h",
2028 ]
2029 outputs = [
2030 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2031 ]
2032 args = [
2033 "$skia_qt_path" + "/bin/moc",
2034 "{{source}}",
2035 "-o",
2036 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2037 ]
2038 }
2039 action_foreach("generate_resources") {
2040 script = "gn/call.py"
2041 sources = [
2042 "tools/mdbviz/resources.qrc",
2043 ]
2044 outputs = [
2045 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2046 ]
2047 args = [
2048 "$skia_qt_path" + "/bin/rcc",
2049 "{{source}}",
2050 "-o",
2051 "gen/mdbviz/{{source_name_part}}_res.cpp",
2052 ]
2053 }
2054 test_app("mdbviz") {
2055 if (is_win) {
2056 # on Windows we need to disable some exception handling warnings due to the Qt headers
2057 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2058 }
2059 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002060 "tools/UrlDataManager.cpp",
2061 "tools/debugger/SkDebugCanvas.cpp",
2062 "tools/debugger/SkDrawCommand.cpp",
2063 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002064 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002065 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002066 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002067 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002068
2069 # generated files
2070 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2071 "$target_gen_dir/mdbviz/resources_res.cpp",
2072 ]
2073 lib_dirs = [ "$skia_qt_path/lib" ]
2074 libs = [
2075 "Qt5Core.lib",
2076 "Qt5Gui.lib",
2077 "Qt5Widgets.lib",
2078 ]
2079 include_dirs = [
2080 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002081 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002082 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002083 "tools",
2084 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002085 ]
2086 deps = [
2087 ":generate_mocs",
2088 ":generate_resources",
2089 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002090 "//third_party/jsoncpp",
2091 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002092 ]
2093 }
2094 }
2095
Mike Kleine459afd2017-03-03 09:21:30 -05002096 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002097 copy("gdbserver") {
2098 sources = [
2099 "$ndk/$ndk_gdbserver",
2100 ]
2101 outputs = [
2102 "$root_out_dir/gdbserver",
2103 ]
2104 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002105 }
mtklein25c81d42016-07-27 13:55:26 -07002106}