blob: 2be010e288def19eb7da7d52ca10108398398284 [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
Mike Kleinfb333552018-01-25 12:49:37 -050033 skia_use_skcms = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050045 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040046 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
Hal Canary4689b542018-01-31 11:54:14 -050051 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050052 skia_skqp_global_error_tolerance = 0
mtkleinc04ff472016-06-23 10:29:30 -070053}
Brian Salomon23d73ea2016-10-27 13:31:37 -040054declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040055 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040056 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050057 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040058
Brian Salomon5f33a8c2018-02-26 14:32:39 -050059 skia_use_legacy_gpu_pixel_ops = is_skia_dev_build && is_win # Arbitrary to keep old code path tested until deletion.
60
Mike Klein4d598a32016-10-31 13:44:49 -040061 if (is_android) {
62 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070063 } else if (is_fuchsia) {
64 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040065 } else {
66 skia_use_vulkan = skia_vulkan_sdk != ""
67 }
Jim Van Verth4e502972017-12-07 15:16:10 -050068
69 if (is_ios) {
70 skia_ios_identity = ".*Google.*"
71 skia_ios_profile = "Google Development"
72 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040073}
Greg Danielec6ae522017-04-25 13:38:26 -040074declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050075 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040076 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000077 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040078 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050079 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040080 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050081 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040082 }
Greg Danielec6ae522017-04-25 13:38:26 -040083 }
84}
Brian Salomon789e25e2016-09-30 13:41:03 -040085
Adam Barth54ef74a2017-10-13 10:59:38 -070086if (defined(skia_settings)) {
87 import(skia_settings)
88}
89
mtklein38925aa2016-09-21 10:11:25 -070090# Our tools require static linking (they use non-exported symbols).
91skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070092
mtkleina45be612016-08-29 15:22:10 -070093fontmgr_android_enabled = skia_use_expat && skia_use_freetype
94
mtklein1211e0c2016-07-26 13:55:45 -070095skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070096 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070097 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070098 "include/codec",
99 "include/config",
100 "include/core",
101 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400102 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/gpu",
104 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500105 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/pathops",
107 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700108 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700109 "include/utils",
110 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700111]
112
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000113if (skia_use_vulkan) {
114 skia_public_includes += [ "include/gpu/vk" ]
115}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500116if (skia_enable_atlas_text) {
117 skia_public_includes += [ "include/atlastext" ]
118}
Greg Daniele5ddff52017-07-05 16:49:36 -0400119if (skia_use_metal) {
120 skia_public_includes += [ "include/gpu/mtl" ]
121}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000122
mtkleinc04ff472016-06-23 10:29:30 -0700123# Skia public API, generally provided by :skia.
124config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700125 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500126 if (skia_tools_vulkan_header_dir != "") {
127 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400128 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400129 defines = []
130 if (is_component_build) {
131 defines += [ "SKIA_DLL" ]
132 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400133 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700134 defines += [ "SK_SAMPLES_FOR_X" ]
135 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400136 if (skia_enable_flutter_defines) {
137 defines += flutter_defines
138 }
mtklein06c35c02016-09-20 12:28:12 -0700139 if (!skia_enable_gpu) {
140 defines += [ "SK_SUPPORT_GPU=0" ]
141 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500142 if (skia_enable_atlas_text) {
143 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
144 }
mtkleinc04ff472016-06-23 10:29:30 -0700145}
146
147# Skia internal APIs, used by Skia itself and a few test tools.
148config("skia_private") {
149 visibility = [ ":*" ]
150
151 include_dirs = [
152 "include/private",
153 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700154 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/core",
156 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700157 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700158 "src/image",
159 "src/images",
160 "src/lazy",
161 "src/opts",
162 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700163 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700164 "src/ports",
165 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400166 "src/shaders",
167 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700168 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700169 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700170 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500171 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700172 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700173 ]
mtklein150d1132016-08-01 06:56:40 -0700174
Mike Reeda9e241d2017-05-03 10:52:00 -0400175 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700176 if (is_android) {
177 defines += [
178 "SK_GAMMA_EXPONENT=1.4",
179 "SK_GAMMA_CONTRAST=0.0",
180 ]
181 }
mtklein88a7ac02016-09-14 11:16:49 -0700182 if (is_official_build || is_android) {
183 # TODO(bsalomon): it'd be nice to make Android normal.
184 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
185 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400186 libs = []
187 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500188 if (skia_enable_gpu) {
189 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500190 if (is_skia_dev_build && skia_use_vulkan) {
191 include_dirs += [ "tools/gpu/vk" ]
192 }
Brian Salomon03e05842017-02-23 12:23:47 -0500193 }
Brian Osman34755e22016-12-05 09:46:02 -0500194 if (skia_use_angle) {
195 defines += [ "SK_ANGLE" ]
196 }
Brian Osman3f375d02016-12-28 11:19:22 -0500197 if (skia_enable_discrete_gpu) {
198 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
199 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400200 if (!is_official_build) {
201 defines += [ "GR_TEST_UTILS=1" ]
202 }
mtkleinc04ff472016-06-23 10:29:30 -0700203}
204
205# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
206config("skia_library") {
207 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700208 defines = [ "SKIA_IMPLEMENTATION=1" ]
209}
210
211skia_library_configs = [
212 ":skia_public",
213 ":skia_private",
214 ":skia_library",
215]
216
mtklein9b8583d2016-08-24 17:32:30 -0700217# Use for CPU-specific Skia code that needs particular compiler flags.
218template("opts") {
219 if (invoker.enabled) {
220 source_set(target_name) {
221 forward_variables_from(invoker, "*")
222 configs += skia_library_configs
223 }
224 } else {
225 # If not enabled, a phony empty target that swallows all otherwise unused variables.
226 source_set(target_name) {
227 forward_variables_from(invoker,
228 "*",
229 [
230 "sources",
231 "cflags",
232 ])
233 }
234 }
anmittala7eaf2e2016-08-17 13:57:26 -0700235}
236
mtklein422310d2016-08-16 18:28:43 -0700237is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700238
mtklein7d6fb2c2016-08-25 14:50:44 -0700239opts("none") {
240 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700242 cflags = []
243}
244
mtklein7d6fb2c2016-08-25 14:50:44 -0700245opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700246 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700248 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700249}
250
251opts("arm64") {
252 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700254 cflags = []
255}
256
257opts("crc32") {
258 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700260 cflags = [ "-march=armv8-a+crc" ]
261}
262
mtklein9b8583d2016-08-24 17:32:30 -0700263opts("sse2") {
264 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700265 sources = skia_opts.sse2_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_SSE2" ]
268 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400269 cflags = [ "-msse2" ]
270 }
mtklein9b8583d2016-08-24 17:32:30 -0700271}
mtkleinc04ff472016-06-23 10:29:30 -0700272
mtklein9b8583d2016-08-24 17:32:30 -0700273opts("ssse3") {
274 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700275 sources = skia_opts.ssse3_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_SSSE3" ]
278 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400279 cflags = [ "-mssse3" ]
280 }
mtklein9b8583d2016-08-24 17:32:30 -0700281}
mtkleinc04ff472016-06-23 10:29:30 -0700282
mtklein9b8583d2016-08-24 17:32:30 -0700283opts("sse41") {
284 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700285 sources = skia_opts.sse41_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_SSE41" ]
288 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400289 cflags = [ "-msse4.1" ]
290 }
mtklein9b8583d2016-08-24 17:32:30 -0700291}
mtklein4e976072016-08-08 09:06:27 -0700292
mtklein9b8583d2016-08-24 17:32:30 -0700293opts("sse42") {
294 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700295 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400296 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400297 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
298 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400299 cflags = [ "-msse4.2" ]
300 }
mtklein9b8583d2016-08-24 17:32:30 -0700301}
302
303opts("avx") {
304 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700305 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400306 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000307 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400308 } else {
309 cflags = [ "-mavx" ]
310 }
mtkleinc04ff472016-06-23 10:29:30 -0700311}
312
Mike Klein1b9b7d52018-02-27 10:37:40 -0500313opts("hsw") {
314 enabled = is_x86
315 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400316 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500317 cflags = [ "/arch:AVX2" ]
318 } else {
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400319 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500320 }
321
322 # Oddly, clang-cl doesn't recognize this as a valid flag.
323 # If it ever does, it'd nice to move this up with -mavx2 and co.
324 if (is_clang && !is_win) {
325 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
326 # but nice to have, generating slightly better code for paths without explicit FMAs.
327 cflags += [ "-ffp-contract=fast" ]
328 }
329}
330
mtkleinc095df52016-08-24 12:23:52 -0700331# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700332template("optional") {
333 if (invoker.enabled) {
334 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700335 if (defined(invoker.public_defines)) {
336 defines = invoker.public_defines
337 }
mtklein457b42a2016-08-23 13:56:37 -0700338 }
339 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700340 forward_variables_from(invoker,
341 "*",
342 [
343 "public_defines",
344 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700345 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700346 ])
mtklein457b42a2016-08-23 13:56:37 -0700347 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700348 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700349 if (defined(invoker.configs_to_remove)) {
350 configs -= invoker.configs_to_remove
351 }
mtklein457b42a2016-08-23 13:56:37 -0700352 }
353 } else {
mtklein457b42a2016-08-23 13:56:37 -0700354 source_set(target_name) {
355 forward_variables_from(invoker,
356 "*",
357 [
358 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700359 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700360 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700361 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700362 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700363 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700364 ])
mtkleincd01b032016-08-31 04:58:19 -0700365 if (defined(invoker.sources_when_disabled)) {
366 sources = invoker.sources_when_disabled
367 }
368 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700369 }
mtkleineb3c4252016-08-23 07:38:09 -0700370 }
mtklein457b42a2016-08-23 13:56:37 -0700371}
mtklein457b42a2016-08-23 13:56:37 -0700372
Mike Kleina04bb452017-02-09 12:24:07 -0500373optional("effects") {
374 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400375 deps = [
376 ":compile_processors",
377 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500378 sources =
379 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
380 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
381}
382
mtkleina45be612016-08-29 15:22:10 -0700383optional("fontmgr_android") {
384 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700385
386 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500387 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700388 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700389 ]
390 sources = [
391 "src/ports/SkFontMgr_android.cpp",
392 "src/ports/SkFontMgr_android_factory.cpp",
393 "src/ports/SkFontMgr_android_parser.cpp",
394 ]
395}
396
mtkleind2e39db2016-09-07 07:52:55 -0700397optional("fontmgr_custom") {
398 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
399
400 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500401 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700402 ]
403 sources = [
404 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500405 "src/ports/SkFontMgr_custom.h",
406 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700407 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500408 "src/ports/SkFontMgr_custom_embedded.cpp",
409 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700410 ]
411}
412
Hal Canaryff2742e2018-01-30 11:35:47 -0500413optional("fontmgr_empty") {
414 enabled = skia_enable_fontmgr_empty
415 sources = [
416 "src/ports/SkFontMgr_empty_factory.cpp",
417 ]
418}
419
mtklein3cc22182016-08-29 13:26:14 -0700420optional("fontmgr_fontconfig") {
421 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700422
423 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500424 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700425 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700426 ]
427 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700428 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700429 "src/ports/SkFontConfigInterface_direct.cpp",
430 "src/ports/SkFontConfigInterface_direct_factory.cpp",
431 "src/ports/SkFontMgr_FontConfigInterface.cpp",
432 "src/ports/SkFontMgr_fontconfig.cpp",
433 "src/ports/SkFontMgr_fontconfig_factory.cpp",
434 ]
435}
436
mtkleincdedd0e2016-09-12 15:15:44 -0700437optional("fontmgr_fuchsia") {
438 enabled = is_fuchsia && skia_use_freetype
439
440 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500441 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700442 ]
443 sources = [
444 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500445 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700446 "src/ports/SkFontMgr_custom_empty_factory.cpp",
447 ]
448}
449
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700450if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400451 executable("sksllex") {
452 sources = [
453 "src/sksl/lex/Main.cpp",
454 "src/sksl/lex/NFA.cpp",
455 "src/sksl/lex/RegexNode.cpp",
456 "src/sksl/lex/RegexParser.cpp",
457 ]
458 include_dirs = [ "src/sksl/lex" ]
459 }
460
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700461 action("run_sksllex") {
462 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400463 deps = [
464 ":sksllex(//gn/toolchain:$host_toolchain)",
465 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700466 sources = [
467 "src/sksl/lex/layout.lex",
468 "src/sksl/lex/sksl.lex",
469 ]
470
471 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
472 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
473 outputs = [
474 "$target_out_dir/" +
475 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
476 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
477 # confused due to the same file being named by two different paths
478 ]
479 sksllex_path = "$root_out_dir/"
480 sksllex_path += "sksllex"
481 if (host_os == "win") {
482 sksllex_path += ".exe"
483 }
484 args = [
485 rebase_path(sksllex_path),
486 rebase_path("bin/clang-format"),
487 rebase_path("src"),
488 ]
489 }
490} else {
491 group("run_sksllex") {
492 }
493}
494
495if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400496 executable("skslc") {
497 defines = [ "SKSL_STANDALONE" ]
498 sources = [
499 "src/sksl/SkSLMain.cpp",
500 ]
501 sources += skia_sksl_sources
502 include_dirs = [
503 "src/gpu",
504 "src/sksl",
505 ]
506 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500507 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 "//third_party/spirv-tools",
509 ]
510 }
511
512 skia_gpu_processor_outputs = []
513 foreach(src, skia_gpu_processor_sources) {
514 dir = get_path_info(src, "dir")
515 name = get_path_info(src, "name")
516
517 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
518 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
519 skia_gpu_processor_outputs += [
520 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
521 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
522 # confused due to the same file being named by two different paths
523 ]
524 }
525
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500526 action("create_sksl_enums") {
527 script = "gn/create_sksl_enums.py"
528 sources = [
529 "include/private/GrSharedEnums.h",
530 ]
531 outputs = [
532 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500533 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500534 ]
535 args = [
536 rebase_path(sources[0]),
537 rebase_path(outputs[0]),
538 ]
539 }
540
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 action("compile_processors") {
542 script = "gn/compile_processors.py"
543 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500544 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 ":skslc(//gn/toolchain:$host_toolchain)",
546 ]
547 sources = skia_gpu_processor_sources
548 outputs = skia_gpu_processor_outputs
549 skslc_path = "$root_out_dir/"
550 if (host_toolchain != default_toolchain_name) {
551 skslc_path += "$host_toolchain/"
552 }
553 skslc_path += "skslc"
554 if (host_os == "win") {
555 skslc_path += ".exe"
556 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400557 args = [
558 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400559 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400560 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400561 args += rebase_path(skia_gpu_processor_sources)
562 }
563} else {
564 skia_gpu_processor_outputs = []
565 group("compile_processors") {
566 }
567}
568
mtklein06c35c02016-09-20 12:28:12 -0700569optional("gpu") {
570 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400571 deps = [
572 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700573 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700575 public_defines = []
576
Brian Salomon3d6801e2017-12-11 10:06:31 -0500577 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700578
579 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500580 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700581 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400582 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700583 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400584 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400585
586 # this lib is required to link against AHardwareBuffer
587 if (defined(ndk_api) && ndk_api >= 26) {
588 libs += [ "android" ]
589 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400590 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500591 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400592 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700593 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500594 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500595 libs += [
596 "GL",
597 "GLU",
598 ]
mtklein06c35c02016-09-20 12:28:12 -0700599 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500600 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800601 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500602 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400603 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500604 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400605 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700606 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500607 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700608 }
mtkleine9fb3d52016-09-20 15:11:46 -0700609
610 if (skia_use_vulkan) {
611 public_defines += [ "SK_VULKAN" ]
612 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700613 if (skia_enable_vulkan_debug_layers) {
614 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
615 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500616 if (skia_vulkan_header != "") {
617 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
618 } else {
619 if (is_skia_dev_build) {
620 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
621 }
622 }
mtkleine9fb3d52016-09-20 15:11:46 -0700623 }
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 ]
brettwb9447282016-09-01 14:24:39 -0700679 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700680 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700681
682 if (skia_use_sfntly) {
683 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500684 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700685 }
686}
687
688optional("png") {
689 enabled = skia_use_libpng
690 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
691
mtklein63213812016-08-24 09:55:56 -0700692 deps = [
693 "//third_party/libpng",
694 ]
695 sources = [
696 "src/codec/SkIcoCodec.cpp",
697 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400698 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700699 ]
700}
701
scroggof84ad642016-10-31 09:02:57 -0700702optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400703 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700704 public_defines = [ "SK_CODEC_DECODES_RAW" ]
705
706 deps = [
707 "//third_party/dng_sdk",
708 "//third_party/libjpeg-turbo:libjpeg",
709 "//third_party/piex",
710 ]
711
712 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
713 # Skia.
714 configs_to_remove = [ "//gn:no_exceptions" ]
715
716 sources = [
717 "src/codec/SkRawAdapterCodec.cpp",
718 "src/codec/SkRawCodec.cpp",
719 ]
720}
721
Mike Kleinfb333552018-01-25 12:49:37 -0500722optional("skcms") {
723 enabled = skia_use_skcms
724
725 deps = [
726 "//third_party/skcms",
727 ]
728 sources = [
Brian Osman98242a82018-03-13 14:35:27 +0000729 # TODO
Mike Kleinfb333552018-01-25 12:49:37 -0500730 ]
731}
732
mtklein3cc22182016-08-29 13:26:14 -0700733optional("typeface_freetype") {
734 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700735
736 deps = [
737 "//third_party/freetype2",
738 ]
739 sources = [
740 "src/ports/SkFontHost_FreeType.cpp",
741 "src/ports/SkFontHost_FreeType_common.cpp",
742 ]
743}
744
mtklein457b42a2016-08-23 13:56:37 -0700745optional("webp") {
746 enabled = skia_use_libwebp
747 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
748
mtklein457b42a2016-08-23 13:56:37 -0700749 deps = [
750 "//third_party/libwebp",
751 ]
752 sources = [
753 "src/codec/SkWebpAdapterCodec.cpp",
754 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400755 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700756 ]
mtkleineb3c4252016-08-23 07:38:09 -0700757}
758
mtklein63213812016-08-24 09:55:56 -0700759optional("xml") {
760 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000761 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700762
mtklein63213812016-08-24 09:55:56 -0700763 deps = [
764 "//third_party/expat",
765 ]
766 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500767 "src/svg/SkSVGCanvas.cpp",
768 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700769 "src/xml/SkDOM.cpp",
770 "src/xml/SkXMLParser.cpp",
771 "src/xml/SkXMLWriter.cpp",
772 ]
773}
774
mtkleinc04ff472016-06-23 10:29:30 -0700775component("skia") {
776 public_configs = [ ":skia_public" ]
777 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700778
779 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700780 ":arm64",
781 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700782 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700783 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500784 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700785 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700786 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500787 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700788 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700789 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700790 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400791 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500792 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700793 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700794 ":none",
mtklein63213812016-08-24 09:55:56 -0700795 ":pdf",
796 ":png",
scroggof84ad642016-10-31 09:02:57 -0700797 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500798 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700799 ":sse2",
800 ":sse41",
801 ":sse42",
802 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700803 ":webp",
mtklein63213812016-08-24 09:55:56 -0700804 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700805 ]
806
Chinmay Garde43f115c2016-11-16 15:04:12 -0800807 # This file (and all GN files in Skia) are designed to work with an
808 # empty sources assignment filter; we handle all that explicitly.
809 # We clear the filter here for clients who may have set up a global filter.
810 set_sources_assignment_filter([])
811
mtkleinc04ff472016-06-23 10:29:30 -0700812 sources = []
brettwb9447282016-09-01 14:24:39 -0700813 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700814 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500815 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700816 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400817 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500818 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700819 "src/android/SkBitmapRegionCodec.cpp",
820 "src/android/SkBitmapRegionDecoder.cpp",
821 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400822 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700823 "src/codec/SkBmpCodec.cpp",
824 "src/codec/SkBmpMaskCodec.cpp",
825 "src/codec/SkBmpRLECodec.cpp",
826 "src/codec/SkBmpStandardCodec.cpp",
827 "src/codec/SkCodec.cpp",
828 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700829 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700830 "src/codec/SkMaskSwizzler.cpp",
831 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700832 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700833 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700834 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700835 "src/codec/SkSwizzler.cpp",
836 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700837 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700838 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700839 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700840 "src/ports/SkMemory_malloc.cpp",
841 "src/ports/SkOSFile_stdio.cpp",
842 "src/sfnt/SkOTTable_name.cpp",
843 "src/sfnt/SkOTUtils.cpp",
844 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700845 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700846 ]
brettwb9447282016-09-01 14:24:39 -0700847
mtklein7d6fb2c2016-08-25 14:50:44 -0700848 libs = []
849
mtkleinc04ff472016-06-23 10:29:30 -0700850 if (is_win) {
851 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400852 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700853 "src/ports/SkDebug_win.cpp",
854 "src/ports/SkFontHost_win.cpp",
855 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500856 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700857 "src/ports/SkImageEncoder_WIC.cpp",
858 "src/ports/SkImageGeneratorWIC.cpp",
859 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700860 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700861 "src/ports/SkScalerContext_win_dw.cpp",
862 "src/ports/SkTLS_win.cpp",
863 "src/ports/SkTypeface_win_dw.cpp",
864 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400865 libs += [
866 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500867 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400868 "Ole32.lib",
869 "OleAut32.lib",
870 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500871 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400872 ]
mtkleinc04ff472016-06-23 10:29:30 -0700873 } else {
874 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700875 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700876 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700877 "src/ports/SkTLS_pthread.cpp",
878 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400879 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700880 }
881
mtklein7d6fb2c2016-08-25 14:50:44 -0700882 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500883 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500884 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500885 deps += [ "//third_party/cpu-features" ]
886 }
mtklein06c35c02016-09-20 12:28:12 -0700887 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700888 libs += [
889 "EGL",
890 "GLESv2",
891 "log",
892 ]
893 }
894
mtkleinc04ff472016-06-23 10:29:30 -0700895 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700896 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400897 if (skia_use_egl) {
898 libs += [ "GLESv2" ]
899 }
mtkleinc04ff472016-06-23 10:29:30 -0700900 }
901
902 if (is_mac) {
903 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700904 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700905 "src/ports/SkFontHost_mac.cpp",
906 "src/ports/SkImageEncoder_CG.cpp",
907 "src/ports/SkImageGeneratorCG.cpp",
908 ]
mtklein09e61f72016-08-23 13:35:28 -0700909 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400910 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
911 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700912 "ApplicationServices.framework",
913 "OpenGL.framework",
914 ]
mtkleinc04ff472016-06-23 10:29:30 -0700915 }
abarth6fc8ff02016-07-15 15:15:15 -0700916
Mike Klein7d302882016-11-03 14:06:31 -0400917 if (is_ios) {
918 sources += [
919 "src/ports/SkDebug_stdio.cpp",
920 "src/ports/SkFontHost_mac.cpp",
921 "src/ports/SkImageEncoder_CG.cpp",
922 "src/ports/SkImageGeneratorCG.cpp",
923 ]
924 libs += [
925 "CoreFoundation.framework",
926 "CoreGraphics.framework",
927 "CoreText.framework",
928 "ImageIO.framework",
929 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400930
931 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
932 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400933 ]
934 }
935
abarth6fc8ff02016-07-15 15:15:15 -0700936 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700937 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700938 }
mtkleinc04ff472016-06-23 10:29:30 -0700939}
940
mtkleinc095df52016-08-24 12:23:52 -0700941# Targets guarded by skia_enable_tools may use //third_party freely.
942if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500943 # Used by gn_to_bp.py to list our public include dirs.
944 source_set("public") {
945 configs += [ ":skia_public" ]
946 }
947
Mike Kleinc36dedf2016-11-18 09:35:28 -0500948 config("skia.h_config") {
949 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500950 if (skia_use_vulkan) {
951 # So we can get the header which includes vulkan
952 include_dirs += [ "tools/gpu/vk" ]
953 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500954 }
955 action("skia.h") {
956 public_configs = [ ":skia.h_config" ]
957 skia_h = "$target_gen_dir/skia.h"
958 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400959 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000960 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500961 depfile = "$skia_h.deps"
962 outputs = [
963 skia_h,
964 ]
965 }
966
967 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500968 executable("fiddle") {
969 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500970 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500971 "tools/fiddle/draw.cpp",
972 "tools/fiddle/fiddle_main.cpp",
973 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400974
975 if (skia_use_egl) {
976 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400977 } else {
978 sources += [ "tools/fiddle/null_context.cpp" ]
979 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400980 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500981 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400982 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500983 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500984 ":skia",
985 ":skia.h",
986 ]
987 }
988 }
989
990 if (skia_enable_gpu) {
991 source_set("public_headers_warnings_check") {
992 sources = [
993 "tools/public_headers_warnings_check.cpp",
994 ]
995 configs -= [ "//gn:warnings_except_public_headers" ]
996 deps = [
997 ":skia",
998 ":skia.h",
999 ]
1000 }
1001 }
1002
mtkleinc095df52016-08-24 12:23:52 -07001003 template("test_lib") {
1004 config(target_name + "_config") {
1005 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001006 if (defined(invoker.public_defines)) {
1007 defines = invoker.public_defines
1008 }
mtklein25c81d42016-07-27 13:55:26 -07001009 }
mtkleinc095df52016-08-24 12:23:52 -07001010 source_set(target_name) {
1011 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1012 public_configs = [
1013 ":" + target_name + "_config",
1014 ":skia_private",
1015 ]
1016
1017 if (!defined(deps)) {
1018 deps = []
1019 }
1020 deps += [ ":skia" ]
1021 testonly = true
1022 }
mtklein25c81d42016-07-27 13:55:26 -07001023 }
mtklein25c81d42016-07-27 13:55:26 -07001024
Mike Kleine6682eb2017-01-05 10:54:57 -05001025 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001026 if (is_ios) {
1027 app_name = target_name
1028 gen_path = target_gen_dir
1029
1030 action("${app_name}_generate_info_plist") {
1031 script = "//gn/gen_plist_ios.py"
1032 outputs = [
1033 "$gen_path/${app_name}_Info.plist",
1034 ]
1035 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1036 }
1037
1038 bundle_data("${app_name}_bundle_info_plist") {
1039 public_deps = [
1040 ":${app_name}_generate_info_plist",
1041 ]
1042 sources = [
1043 "$gen_path/${app_name}_Info.plist",
1044 ]
1045 outputs = [
1046 "{{bundle_root_dir}}/Info.plist",
1047 ]
1048 }
1049
Jim Van Verth329c5a62017-11-29 11:42:33 -05001050 bundle_ios_data =
1051 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1052
1053 if (bundle_ios_data) {
1054 has_skps =
1055 "True" == exec_script("//gn/checkdir.py",
1056 [ rebase_path("skps", root_build_dir) ],
1057 "trim string")
1058 bundle_data("${app_name}_bundle_resources") {
1059 sources = [
1060 "resources",
1061 ]
1062 outputs = [
1063 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1064 "{{bundle_resources_dir}}/data/resources",
1065 ]
1066 }
1067
1068 if (has_skps) {
1069 bundle_data("${app_name}_bundle_skps") {
1070 sources = [
1071 "skps",
1072 ]
1073 outputs = [
1074 # Store in same folder as resources
1075 "{{bundle_resources_dir}}/data/skps",
1076 ]
1077 }
1078 }
1079 }
1080
Jim Van Verth443a9132017-11-28 09:45:26 -05001081 executable("${app_name}_generate_executable") {
1082 forward_variables_from(invoker,
1083 "*",
1084 [
1085 "output_name",
1086 "visibility",
1087 "is_shared_library",
1088 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001089 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001090 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001091 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1092 }
1093
1094 bundle_data("${app_name}_bundle_executable") {
1095 public_deps = [
1096 ":${app_name}_generate_executable",
1097 ]
1098 sources = [
1099 "$gen_path/$app_name",
1100 ]
1101 outputs = [
1102 "{{bundle_executable_dir}}/$app_name",
1103 ]
1104 testonly = true
1105 }
1106
1107 create_bundle("$app_name") {
1108 product_type = "com.apple.product-type.application"
1109 testonly = true
1110
1111 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1112 bundle_resources_dir = bundle_root_dir
1113 bundle_executable_dir = bundle_root_dir
1114 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1115
1116 deps = [
1117 ":${app_name}_bundle_executable",
1118 ":${app_name}_bundle_info_plist",
1119 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001120 if (bundle_ios_data) {
1121 deps += [ ":${app_name}_bundle_resources" ]
1122 if (has_skps) {
1123 deps += [ ":${app_name}_bundle_skps" ]
1124 }
1125 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001126
1127 # should only code sign when running on a device, not the simulator
1128 if (target_cpu != "x64") {
1129 code_signing_script = "//gn/codesign_ios.py"
1130 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1131 code_signing_outputs = [
1132 "$bundle_root_dir/_CodeSignature/CodeResources",
1133 "$bundle_root_dir/embedded.mobileprovision",
1134 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001135 code_signing_args = [
1136 rebase_path("$bundle_root_dir", root_build_dir),
1137 skia_ios_identity,
1138 skia_ios_profile,
1139 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001140 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001141 }
1142 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001143 # !is_ios
1144
1145 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1146 shared_library("lib" + target_name) {
1147 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1148 configs += [ ":skia_private" ]
1149 testonly = true
1150 }
1151 } else {
1152 _executable = target_name
1153 executable(_executable) {
1154 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1155 configs += [ ":skia_private" ]
1156 testonly = true
1157 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001158 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001159 if (is_android && skia_android_serial != "" && defined(_executable)) {
1160 action("push_" + target_name) {
1161 script = "gn/push_to_android.py"
1162 deps = [
1163 ":" + _executable,
1164 ]
1165 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1166 outputs = [
1167 _stamp,
1168 ]
1169 args = [
1170 rebase_path("$root_build_dir/$_executable"),
1171 skia_android_serial,
1172 rebase_path(_stamp),
1173 ]
1174 testonly = true
1175 }
Mike Klein7d921032017-01-05 12:20:41 -05001176 }
1177 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001178 }
1179
mtkleinc095df52016-08-24 12:23:52 -07001180 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001181 public_include_dirs = []
1182 if (skia_enable_gpu) {
1183 public_defines = []
1184 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001185
1186 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001187 sources = [
1188 "tools/gpu/GrContextFactory.cpp",
1189 "tools/gpu/GrTest.cpp",
Brian Salomon58389b92018-03-07 13:01:25 -05001190 "tools/gpu/ProxyUtils.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001191 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001192 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001193 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001194 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001195 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1196 "tools/gpu/gl/debug/GrBufferObj.cpp",
1197 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1198 "tools/gpu/gl/debug/GrProgramObj.cpp",
1199 "tools/gpu/gl/debug/GrShaderObj.cpp",
1200 "tools/gpu/gl/debug/GrTextureObj.cpp",
1201 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1202 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001203 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001204 ]
1205 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001206
Kevin Lubick4a24e102017-03-29 11:19:01 -04001207 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001208 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001209 } else if (is_ios) {
1210 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1211 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001212 } else if (is_linux) {
1213 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001214 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001215 } else if (is_mac) {
1216 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001217 } else if (is_win) {
1218 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1219 libs += [
1220 "Gdi32.lib",
1221 "OpenGL32.lib",
1222 ]
mtklein38925aa2016-09-21 10:11:25 -07001223 }
mtklein6ef69992016-09-14 06:12:09 -07001224
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001225 cflags_objcc = [ "-fobjc-arc" ]
1226
Mike Kleinc168a3a2016-11-14 14:53:13 +00001227 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001228 deps += [ "//third_party/angle2" ]
1229 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1230 }
mtkleind68f9b02016-09-23 13:18:41 -07001231 if (skia_use_vulkan) {
1232 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001233 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001234 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001235 if (skia_use_metal) {
1236 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1237 }
mtkleina627b5c2016-09-20 13:36:47 -07001238 }
mtklein25c81d42016-07-27 13:55:26 -07001239 }
mtklein25c81d42016-07-27 13:55:26 -07001240
mtkleinc095df52016-08-24 12:23:52 -07001241 test_lib("flags") {
1242 public_include_dirs = [ "tools/flags" ]
1243 sources = [
1244 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001245 ]
1246 }
1247 test_lib("common_flags") {
1248 public_include_dirs = [ "tools/flags" ]
1249 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001250 "tools/flags/SkCommonFlags.cpp",
1251 "tools/flags/SkCommonFlagsConfig.cpp",
1252 ]
1253 deps = [
mtklein046cb562016-09-16 10:23:12 -07001254 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001255 ":gpu_tool_utils",
1256 ]
1257 }
mtklein25c81d42016-07-27 13:55:26 -07001258
mtkleinc095df52016-08-24 12:23:52 -07001259 test_lib("tool_utils") {
1260 public_include_dirs = [
1261 "tools",
1262 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001263 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001264 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001265 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001266 ]
1267 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001268 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001269 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001270 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001271 "tools/ProcStats.cpp",
1272 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001273 "tools/UrlDataManager.cpp",
1274 "tools/debugger/SkDebugCanvas.cpp",
1275 "tools/debugger/SkDrawCommand.cpp",
1276 "tools/debugger/SkJsonWriteBuffer.cpp",
1277 "tools/debugger/SkObjectParser.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001278 "tools/fonts/SkRandomScalerContext.cpp",
1279 "tools/fonts/SkTestFontMgr.cpp",
1280 "tools/fonts/SkTestScalerContext.cpp",
1281 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001282 "tools/picture_utils.cpp",
1283 "tools/random_parse_path.cpp",
1284 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001285 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001286 "tools/trace/SkChromeTracingTracer.cpp",
1287 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001288 "tools/trace/SkDebugfTracer.cpp",
1289 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001290 "tools/trace/SkEventTracingPriv.cpp",
1291 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001292 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001293 libs = []
1294 if (is_ios) {
1295 sources += [ "tools/ios_utils.m" ]
1296 libs += [ "Foundation.framework" ]
1297 }
mtkleinc095df52016-08-24 12:23:52 -07001298 deps = [
mtklein046cb562016-09-16 10:23:12 -07001299 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001300 ":flags",
1301 "//third_party/libpng",
1302 ]
1303 public_deps = [
1304 "//third_party/jsoncpp",
1305 ]
1306 }
mtklein25c81d42016-07-27 13:55:26 -07001307
Mike Klein6e744122016-10-27 12:21:40 -04001308 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001309 test_lib("gm") {
1310 public_include_dirs = [ "gm" ]
1311 sources = gm_sources
1312 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001313 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001314 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001315 ":gpu_tool_utils",
1316 ":skia",
1317 ":tool_utils",
1318 ]
1319 }
mtklein25c81d42016-07-27 13:55:26 -07001320
Mike Klein6e744122016-10-27 12:21:40 -04001321 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001322 test_lib("tests") {
1323 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001324 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001325 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001326 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001327 }
mtkleinc095df52016-08-24 12:23:52 -07001328 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001329 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001330 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001331 ":skia",
1332 ":tool_utils",
1333 "//third_party/libpng",
1334 "//third_party/zlib",
1335 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001336 if (skia_use_expat) {
1337 deps += [ ":experimental_svg_model" ]
1338 }
Mike Kleind63442d2017-03-27 14:16:04 -04001339 public_deps = [
1340 ":gpu_tool_utils", # Test.h #includes headers from this target.
1341 ]
mtkleinc095df52016-08-24 12:23:52 -07001342 }
mtklein2f3416d2016-08-02 16:02:05 -07001343
Mike Klein6e744122016-10-27 12:21:40 -04001344 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001345 test_lib("bench") {
1346 public_include_dirs = [ "bench" ]
1347 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001348 deps = [
1349 ":flags",
1350 ":gm",
1351 ":gpu_tool_utils",
1352 ":skia",
1353 ":tool_utils",
1354 ]
1355 }
mtklein2b6870c2016-07-28 14:17:33 -07001356
Florin Malita54f65c42018-01-16 17:04:30 -05001357 test_lib("experimental_skottie") {
1358 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001359 include_dirs = [ "tools" ]
1360 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001361 "experimental/skottie/Skottie.cpp",
1362 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001363 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001364 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001365 ]
1366 deps = [
1367 ":experimental_sksg",
1368 ":skia",
1369 "//third_party/jsoncpp",
1370 ]
1371 }
1372
mtkleinc095df52016-08-24 12:23:52 -07001373 test_lib("experimental_svg_model") {
1374 public_include_dirs = [ "experimental/svg/model" ]
1375 sources = [
1376 "experimental/svg/model/SkSVGAttribute.cpp",
1377 "experimental/svg/model/SkSVGAttributeParser.cpp",
1378 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001379 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001380 "experimental/svg/model/SkSVGContainer.cpp",
1381 "experimental/svg/model/SkSVGDOM.cpp",
1382 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001383 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001384 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001385 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001386 "experimental/svg/model/SkSVGNode.cpp",
1387 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001388 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001389 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001390 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001391 "experimental/svg/model/SkSVGRect.cpp",
1392 "experimental/svg/model/SkSVGRenderContext.cpp",
1393 "experimental/svg/model/SkSVGSVG.cpp",
1394 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001395 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001396 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001397 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001398 "experimental/svg/model/SkSVGValue.cpp",
1399 ]
1400 deps = [
1401 ":skia",
1402 ]
1403 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001404
Florin Malita4aa44412017-12-19 12:21:02 -05001405 test_lib("experimental_sksg") {
1406 public_include_dirs = [
1407 "experimental/sksg",
1408 "experimental/sksg/effects",
1409 "experimental/sksg/geometry",
1410 "experimental/sksg/paint",
1411 ]
1412 sources = [
1413 "experimental/sksg/SkSGDraw.cpp",
1414 "experimental/sksg/SkSGEffectNode.cpp",
1415 "experimental/sksg/SkSGGeometryNode.cpp",
1416 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001417 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001418 "experimental/sksg/SkSGInvalidationController.cpp",
1419 "experimental/sksg/SkSGNode.cpp",
1420 "experimental/sksg/SkSGPaintNode.cpp",
1421 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001422 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001423 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001424 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001425 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001426 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001427 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001428 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001429 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001430 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001431 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001432 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001433 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001434 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001435 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001436 ]
1437 deps = [
1438 ":skia",
1439 ]
1440 }
1441
Kevin Lubickebf648e2017-09-21 13:45:16 -04001442 if (target_cpu != "wasm") {
1443 test_lib("views") {
1444 public_include_dirs = [ "include/views" ]
1445 sources = [
1446 "src/views/SkEvent.cpp",
1447 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001448 "src/views/SkTouchGesture.cpp",
1449 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001450 ]
Brian Osman34755e22016-12-05 09:46:02 -05001451 }
Brian Osman16adfa32016-10-18 14:42:44 -04001452 }
1453
Mike Klein38af9432016-11-11 11:39:44 -05001454 if (skia_use_lua) {
1455 test_lib("lua") {
1456 public_include_dirs = []
1457 sources = [
1458 "src/utils/SkLua.cpp",
1459 "src/utils/SkLuaCanvas.cpp",
1460 ]
1461 deps = [
1462 "//third_party/lua",
1463 ]
1464 }
1465
Mike Kleine6682eb2017-01-05 10:54:57 -05001466 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001467 sources = [
1468 "tools/lua/lua_app.cpp",
1469 ]
1470 deps = [
1471 ":lua",
1472 ":skia",
1473 "//third_party/lua",
1474 ]
Mike Klein38af9432016-11-11 11:39:44 -05001475 }
1476
Mike Kleine6682eb2017-01-05 10:54:57 -05001477 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001478 sources = [
1479 "tools/lua/lua_pictures.cpp",
1480 ]
1481 deps = [
1482 ":flags",
1483 ":lua",
1484 ":skia",
1485 ":tool_utils",
1486 "//third_party/lua",
1487 ]
Mike Klein38af9432016-11-11 11:39:44 -05001488 }
1489 }
1490
Cary Clark8032b982017-07-28 11:04:54 -04001491 test_app("bookmaker") {
1492 sources = [
1493 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001494 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001495 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001496 "tools/bookmaker/fiddleParser.cpp",
1497 "tools/bookmaker/includeParser.cpp",
1498 "tools/bookmaker/includeWriter.cpp",
1499 "tools/bookmaker/mdOut.cpp",
1500 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001501 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001502 "tools/bookmaker/spellCheck.cpp",
1503 ]
1504 deps = [
1505 ":flags",
1506 ":skia",
1507 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001508 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001509 ]
1510 }
1511
Kevin Lubickebf648e2017-09-21 13:45:16 -04001512 if (target_cpu != "wasm") {
1513 import("gn/samples.gni")
1514 test_lib("samples") {
1515 public_include_dirs = [ "samplecode" ]
1516 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001517 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001518 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001519 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001520 ":experimental_svg_model",
1521 ":flags",
1522 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001523 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001524 ":tool_utils",
1525 ":views",
1526 ":xml",
1527 ]
Mike Klein38af9432016-11-11 11:39:44 -05001528
Kevin Lubickebf648e2017-09-21 13:45:16 -04001529 if (skia_use_lua) {
1530 sources += [ "samplecode/SampleLua.cpp" ]
1531 deps += [
1532 ":lua",
1533 "//third_party/lua",
1534 ]
1535 }
1536 }
1537 test_app("dm") {
1538 sources = [
1539 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001540 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001541 "dm/DMJsonWriter.cpp",
1542 "dm/DMSrcSink.cpp",
1543 ]
1544 include_dirs = [ "tests" ]
1545 deps = [
1546 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001547 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001548 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001549 ":experimental_svg_model",
1550 ":flags",
1551 ":gm",
1552 ":gpu_tool_utils",
1553 ":skia",
1554 ":tests",
1555 ":tool_utils",
1556 "//third_party/jsoncpp",
1557 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001558 ]
1559 }
Brian Osman16adfa32016-10-18 14:42:44 -04001560 }
1561
Mike Kleina8a51ce2018-01-09 12:34:11 -05001562 if (!is_win) {
1563 test_app("remote_demo") {
1564 sources = [
1565 "tools/remote_demo.cpp",
1566 ]
1567 deps = [
1568 ":skia",
1569 ]
1570 }
1571 }
1572
Mike Kleine6682eb2017-01-05 10:54:57 -05001573 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001574 sources = [
1575 "bench/nanobench.cpp",
1576 ]
1577 deps = [
1578 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001579 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001580 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001581 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001582 ":flags",
1583 ":gm",
1584 ":gpu_tool_utils",
1585 ":skia",
1586 ":tool_utils",
1587 "//third_party/jsoncpp",
1588 ]
mtklein2b6870c2016-07-28 14:17:33 -07001589 }
halcanary19a97202016-08-03 15:08:04 -07001590
Ravi Mistry10d36c52017-01-31 09:49:18 -05001591 test_app("skpinfo") {
1592 sources = [
1593 "tools/skpinfo.cpp",
1594 ]
1595 deps = [
1596 ":flags",
1597 ":skia",
1598 ]
1599 }
1600
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001601 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001602 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001603 sources = [
1604 "tools/skpbench/skpbench.cpp",
1605 ]
1606 deps = [
1607 ":flags",
1608 ":gpu_tool_utils",
1609 ":skia",
1610 ":tool_utils",
1611 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001612 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001613 }
1614
Hal Canary96c57252018-02-09 11:43:05 -05001615 test_lib("skshaper") {
1616 public_include_dirs = [ "tools/shape" ]
1617 deps = [
1618 ":skia",
1619 ]
1620
Hal Canary8bb40832018-02-08 15:16:28 -05001621 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001622 sources = [
1623 "tools/shape/SkShaper_primitive.cpp",
1624 ]
1625 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001626 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001627 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001628 ]
Hal Canary96c57252018-02-09 11:43:05 -05001629 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001630 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001631 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001632 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001633 }
halcanary19a97202016-08-03 15:08:04 -07001634 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001635 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001636 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001637 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001638 ]
1639 deps = [
1640 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001641 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001642 ]
halcanary3eee9d92016-09-10 07:01:53 -07001643 }
mtklein046cb562016-09-16 10:23:12 -07001644
Matt Sarett9f1c4032017-05-17 10:06:32 -04001645 test_app("create_flutter_test_images") {
1646 sources = [
1647 "tools/create_flutter_test_images.cpp",
1648 ]
1649 deps = [
1650 ":skia",
1651 ":tool_utils",
1652 ]
1653 }
1654
Ben Wagner219f3622017-07-17 15:32:25 -04001655 test_app("create_test_font") {
1656 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001657 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001658 ]
1659 deps = [
1660 ":skia",
1661 ]
1662 assert_no_deps = [
1663 # tool_utils requires the output of this app.
1664 ":tool_utils",
1665 ]
1666 }
1667
Mike Kleine6682eb2017-01-05 10:54:57 -05001668 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001669 sources = [
1670 "tools/get_images_from_skps.cpp",
1671 ]
1672 deps = [
1673 ":flags",
1674 ":skia",
1675 "//third_party/jsoncpp",
1676 ]
mtklein046cb562016-09-16 10:23:12 -07001677 }
mtkleinecbc5262016-09-22 11:51:24 -07001678
Mike Kleine6682eb2017-01-05 10:54:57 -05001679 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001680 sources = [
1681 "tools/colorspaceinfo.cpp",
1682 ]
1683 deps = [
1684 ":flags",
1685 ":skia",
1686 ":tool_utils",
1687 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001688 }
1689
Kevin Lubickebf648e2017-09-21 13:45:16 -04001690 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001691 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001692 sources = [
1693 "tools/skiaserve/Request.cpp",
1694 "tools/skiaserve/Response.cpp",
1695 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001696 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1697 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1698 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1699 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1700 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1701 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1702 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1703 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1704 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001705 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1706 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001707 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1708 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1709 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1710 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1711 ]
1712 deps = [
1713 ":flags",
1714 ":gpu_tool_utils",
1715 ":skia",
1716 ":tool_utils",
1717 "//third_party/jsoncpp",
1718 "//third_party/libmicrohttpd",
1719 "//third_party/libpng",
1720 ]
Mike Klein7d302882016-11-03 14:06:31 -04001721 }
mtkleinecbc5262016-09-22 11:51:24 -07001722 }
kjlubick14f984b2016-10-03 11:49:45 -07001723
Mike Kleine6682eb2017-01-05 10:54:57 -05001724 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001725 include_dirs = [
1726 "tools",
1727 "tools/debugger",
1728 ]
kjlubick14f984b2016-10-03 11:49:45 -07001729 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001730 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001731 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001732 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001733 "fuzz/FuzzGradients.cpp",
1734 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001735 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001736 "fuzz/FuzzPathop.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001737 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001738 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1739 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001740 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1741 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001742 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1743 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001744 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001745 "tools/UrlDataManager.cpp",
1746 "tools/debugger/SkDebugCanvas.cpp",
1747 "tools/debugger/SkDrawCommand.cpp",
1748 "tools/debugger/SkJsonWriteBuffer.cpp",
1749 "tools/debugger/SkObjectParser.cpp",
1750 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001751 ]
1752 deps = [
1753 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001754 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001755 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001756 "//third_party/jsoncpp",
1757 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001758 ]
kjlubick14f984b2016-10-03 11:49:45 -07001759 }
Mike Klein38312422016-10-05 15:41:01 -04001760
Mike Kleine6682eb2017-01-05 10:54:57 -05001761 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001762 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001763 rebase_path("tests/skia_test.cpp"),
1764 rebase_path("tests/Test.cpp"),
1765 ]
caryclark9feb6322016-10-25 08:58:26 -07001766 deps = [
1767 ":flags",
1768 ":gpu_tool_utils",
1769 ":skia",
1770 ":tool_utils",
1771 ]
caryclark9feb6322016-10-25 08:58:26 -07001772 }
1773
Mike Kleine6682eb2017-01-05 10:54:57 -05001774 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001775 sources = [
1776 "tools/DumpRecord.cpp",
1777 "tools/dump_record.cpp",
1778 ]
1779 deps = [
1780 ":flags",
1781 ":skia",
1782 ]
Mike Klein38312422016-10-05 15:41:01 -04001783 }
bungemanfe917272016-10-13 17:36:40 -04001784
Mike Kleine6682eb2017-01-05 10:54:57 -05001785 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001786 sources = [
1787 "tools/skdiff/skdiff.cpp",
1788 "tools/skdiff/skdiff_html.cpp",
1789 "tools/skdiff/skdiff_main.cpp",
1790 "tools/skdiff/skdiff_utils.cpp",
1791 ]
1792 deps = [
1793 ":skia",
1794 ":tool_utils",
1795 ]
bungemanfe917272016-10-13 17:36:40 -04001796 }
halcanarya73d76a2016-10-17 13:19:02 -07001797
Mike Kleine6682eb2017-01-05 10:54:57 -05001798 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001799 sources = [
1800 "tools/skp_parser.cpp",
1801 ]
1802 deps = [
1803 ":skia",
1804 ":tool_utils",
1805 "//third_party/jsoncpp",
1806 ]
halcanarya73d76a2016-10-17 13:19:02 -07001807 }
Brian Osman16adfa32016-10-18 14:42:44 -04001808
Hal Canaryd7b38452017-12-11 17:46:26 -05001809 if (!is_win && skia_enable_gpu) {
1810 test_lib("skqp_lib") {
1811 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001812 defines =
1813 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001814 if (skia_skqp_enable_driver_correctness_workarounds) {
1815 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1816 }
Hal Canary75427132017-10-11 16:00:31 -04001817 sources = [
1818 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001819 "tools/skqp/gm_knowledge.cpp",
1820 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001821 ]
1822 deps = [
1823 ":gm",
1824 ":gpu_tool_utils",
1825 ":skia",
1826 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001827 ":tool_utils",
1828 ]
1829 }
1830 test_app("skqp") {
1831 sources = [
1832 "tools/skqp/skqp.cpp",
1833 ]
1834 deps = [
1835 ":skia",
1836 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001837 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001838 "//third_party/googletest",
1839 ]
1840 }
1841 }
Hal Canary28f89382017-12-12 09:42:14 -05001842 if (is_android && skia_enable_gpu) {
1843 test_app("skqp_app") {
1844 is_shared_library = true
1845 sources = [
1846 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1847 ]
1848 deps = [
1849 ":skia",
1850 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001851 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001852 ]
1853 libs = [ "android" ]
1854 }
1855 }
Hal Canary75427132017-10-11 16:00:31 -04001856
Hal Canarya9de7602018-01-19 13:08:23 -05001857 test_app("list_gms") {
1858 sources = [
1859 "tools/list_gms.cpp",
1860 ]
1861 deps = [
1862 ":gm",
1863 ":skia",
1864 ]
1865 }
1866 test_app("list_gpu_unit_tests") {
1867 sources = [
1868 "dm/DMGpuTestProcs.cpp",
1869 "tools/list_gpu_unit_tests.cpp",
1870 ]
1871 deps = [
1872 ":skia",
1873 ":tests",
1874 ]
1875 }
1876
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001877 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001878 test_lib("sk_app") {
1879 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001880 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001881 "tools/sk_app/CommandSet.cpp",
1882 "tools/sk_app/GLWindowContext.cpp",
1883 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001884 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001885 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001886
Jim Van Verth4e56a912016-10-21 10:58:52 -04001887 if (is_android) {
1888 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001889 "tools/sk_app/android/GLWindowContext_android.cpp",
1890 "tools/sk_app/android/RasterWindowContext_android.cpp",
1891 "tools/sk_app/android/Window_android.cpp",
1892 "tools/sk_app/android/main_android.cpp",
1893 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001894 ]
Brian Osman462334e2017-02-09 11:22:57 -05001895 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001896 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001897 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001898 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1899 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1900 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001901 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001902 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001903 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001904 libs += [
1905 "GL",
1906 "X11",
1907 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001908 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001909 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001910 "tools/sk_app/win/GLWindowContext_win.cpp",
1911 "tools/sk_app/win/RasterWindowContext_win.cpp",
1912 "tools/sk_app/win/Window_win.cpp",
1913 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001914 ]
Brian Salomon194db172017-08-17 14:37:06 -04001915 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001916 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001917 }
Mike Klein43c25262016-10-20 10:17:47 -04001918 } else if (is_mac) {
1919 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001920 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1921 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1922 "tools/sk_app/mac/Window_mac.cpp",
1923 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001924 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001925 libs += [
1926 "QuartzCore.framework",
1927 "Cocoa.framework",
1928 "Foundation.framework",
1929 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001930 } else if (is_ios) {
1931 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001932 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1933 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1934 "tools/sk_app/ios/Window_ios.cpp",
1935 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001936 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001937 }
1938
1939 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001940 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001941 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001942 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001943 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001944 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001945 libs += [ "X11-xcb" ]
1946 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001947 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001948 }
1949 }
1950
Brian Osman16adfa32016-10-18 14:42:44 -04001951 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001952 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001953 ":skia",
1954 ":tool_utils",
1955 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001956 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001957 if (is_android) {
1958 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001959 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001960 deps += [ "//third_party/libsdl" ]
1961 }
Brian Salomon194db172017-08-17 14:37:06 -04001962 if (skia_use_angle) {
1963 deps += [ "//third_party/angle2" ]
1964 }
Mike Kleina92c3832016-12-08 09:49:39 -05001965 }
Brian Osman16adfa32016-10-18 14:42:44 -04001966 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001967
Brian Osmaneff04b52017-11-21 13:18:02 -05001968 if (skia_enable_gpu) {
1969 test_app("viewer") {
1970 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001971 if (is_ios) {
1972 bundle_ios_data = true
1973 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001974 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07001975 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001976 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001977 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001978 "tools/viewer/ImageSlide.cpp",
1979 "tools/viewer/SKPSlide.cpp",
1980 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001981 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05001982 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001983 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001984 "tools/viewer/Viewer.cpp",
1985 ]
1986 libs = []
1987
1988 include_dirs = []
1989 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001990 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05001991 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05001992 ":flags",
1993 ":gm",
1994 ":gpu_tool_utils",
1995 ":samples",
1996 ":sk_app",
1997 ":skia",
1998 ":tool_utils",
1999 ":views",
2000 "//third_party/imgui",
2001 "//third_party/jsoncpp",
2002 ]
2003 }
2004 }
2005
2006 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2007 test_app("HelloWorld") {
2008 sources = [
2009 "example/HelloWorld.cpp",
2010 ]
2011 libs = []
2012
2013 include_dirs = []
2014 deps = [
2015 ":flags",
2016 ":gpu_tool_utils",
2017 ":sk_app",
2018 ":skia",
2019 ":tool_utils",
2020 ":views",
2021 ]
2022 }
2023 }
2024
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002025 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002026 test_app("SkiaSDLExample") {
2027 sources = [
2028 "example/SkiaSDLExample.cpp",
2029 ]
2030 libs = []
2031 include_dirs = []
2032 deps = [
2033 ":gpu_tool_utils",
2034 ":skia",
2035 "//third_party/libsdl",
2036 ]
2037 }
2038 }
2039
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002040 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2041 action_foreach("generate_mocs") {
2042 script = "gn/call.py"
2043 sources = [
2044 "tools/mdbviz/MainWindow.h",
2045 ]
2046 outputs = [
2047 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2048 ]
2049 args = [
2050 "$skia_qt_path" + "/bin/moc",
2051 "{{source}}",
2052 "-o",
2053 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2054 ]
2055 }
2056 action_foreach("generate_resources") {
2057 script = "gn/call.py"
2058 sources = [
2059 "tools/mdbviz/resources.qrc",
2060 ]
2061 outputs = [
2062 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2063 ]
2064 args = [
2065 "$skia_qt_path" + "/bin/rcc",
2066 "{{source}}",
2067 "-o",
2068 "gen/mdbviz/{{source_name_part}}_res.cpp",
2069 ]
2070 }
2071 test_app("mdbviz") {
2072 if (is_win) {
2073 # on Windows we need to disable some exception handling warnings due to the Qt headers
2074 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2075 }
2076 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002077 "tools/UrlDataManager.cpp",
2078 "tools/debugger/SkDebugCanvas.cpp",
2079 "tools/debugger/SkDrawCommand.cpp",
2080 "tools/debugger/SkJsonWriteBuffer.cpp",
2081 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002082 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002083 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002084 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002085 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002086
2087 # generated files
2088 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2089 "$target_gen_dir/mdbviz/resources_res.cpp",
2090 ]
2091 lib_dirs = [ "$skia_qt_path/lib" ]
2092 libs = [
2093 "Qt5Core.lib",
2094 "Qt5Gui.lib",
2095 "Qt5Widgets.lib",
2096 ]
2097 include_dirs = [
2098 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002099 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002100 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002101 "tools",
2102 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002103 ]
2104 deps = [
2105 ":generate_mocs",
2106 ":generate_resources",
2107 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002108 "//third_party/jsoncpp",
2109 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002110 ]
2111 }
2112 }
2113
Mike Kleine459afd2017-03-03 09:21:30 -05002114 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002115 copy("gdbserver") {
2116 sources = [
2117 "$ndk/$ndk_gdbserver",
2118 ]
2119 outputs = [
2120 "$root_out_dir/gdbserver",
2121 ]
2122 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002123 }
mtklein25c81d42016-07-27 13:55:26 -07002124}