blob: 364cde700d261d992bddec031bc0322509d58a1e [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
51 skia_jumper_clang = ""
52 skia_jumper_objdump = ""
53 skia_jumper_ccache = ""
Hal Canary4689b542018-01-31 11:54:14 -050054
55 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050056 skia_skqp_global_error_tolerance = 0
mtkleinc04ff472016-06-23 10:29:30 -070057}
Brian Salomon23d73ea2016-10-27 13:31:37 -040058declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040059 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040060 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050061 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040062
Mike Klein4d598a32016-10-31 13:44:49 -040063 if (is_android) {
64 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070065 } else if (is_fuchsia) {
66 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040067 } else {
68 skia_use_vulkan = skia_vulkan_sdk != ""
69 }
Jim Van Verth4e502972017-12-07 15:16:10 -050070
71 if (is_ios) {
72 skia_ios_identity = ".*Google.*"
73 skia_ios_profile = "Google Development"
74 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040075}
Greg Danielec6ae522017-04-25 13:38:26 -040076declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050077 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040078 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000079 # 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 -040080 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050081 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040082 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050083 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040084 }
Greg Danielec6ae522017-04-25 13:38:26 -040085 }
86}
Brian Salomon789e25e2016-09-30 13:41:03 -040087
Adam Barth54ef74a2017-10-13 10:59:38 -070088if (defined(skia_settings)) {
89 import(skia_settings)
90}
91
mtklein38925aa2016-09-21 10:11:25 -070092# Our tools require static linking (they use non-exported symbols).
93skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070094
mtkleina45be612016-08-29 15:22:10 -070095fontmgr_android_enabled = skia_use_expat && skia_use_freetype
96
mtklein1211e0c2016-07-26 13:55:45 -070097skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070098 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070099 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/codec",
101 "include/config",
102 "include/core",
103 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400104 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "include/gpu",
106 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500107 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700108 "include/pathops",
109 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700110 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700111 "include/utils",
112 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700113]
114
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000115if (skia_use_vulkan) {
116 skia_public_includes += [ "include/gpu/vk" ]
117}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500118if (skia_enable_atlas_text) {
119 skia_public_includes += [ "include/atlastext" ]
120}
Greg Daniele5ddff52017-07-05 16:49:36 -0400121if (skia_use_metal) {
122 skia_public_includes += [ "include/gpu/mtl" ]
123}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000124
mtkleinc04ff472016-06-23 10:29:30 -0700125# Skia public API, generally provided by :skia.
126config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700127 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500128 if (skia_tools_vulkan_header_dir != "") {
129 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400130 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400131 defines = []
132 if (is_component_build) {
133 defines += [ "SKIA_DLL" ]
134 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400135 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700136 defines += [ "SK_SAMPLES_FOR_X" ]
137 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400138 if (skia_enable_flutter_defines) {
139 defines += flutter_defines
140 }
mtklein06c35c02016-09-20 12:28:12 -0700141 if (!skia_enable_gpu) {
142 defines += [ "SK_SUPPORT_GPU=0" ]
143 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500144 if (skia_enable_atlas_text) {
145 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
146 }
Mike Klein1f313092018-01-03 10:30:21 -0500147
148 # Temporary.
149 defines += [ "SK_LEGACY_HIGH_QUALITY_SCALING_CLAMP" ]
mtkleinc04ff472016-06-23 10:29:30 -0700150}
151
152# Skia internal APIs, used by Skia itself and a few test tools.
153config("skia_private") {
154 visibility = [ ":*" ]
155
156 include_dirs = [
157 "include/private",
158 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700159 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/core",
161 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700162 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700163 "src/image",
164 "src/images",
165 "src/lazy",
166 "src/opts",
167 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700168 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700169 "src/ports",
170 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400171 "src/shaders",
172 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700173 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700174 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700175 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500176 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700177 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700178 ]
mtklein150d1132016-08-01 06:56:40 -0700179
Mike Reeda9e241d2017-05-03 10:52:00 -0400180 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700181 if (is_android) {
182 defines += [
183 "SK_GAMMA_EXPONENT=1.4",
184 "SK_GAMMA_CONTRAST=0.0",
185 ]
186 }
mtklein88a7ac02016-09-14 11:16:49 -0700187 if (is_official_build || is_android) {
188 # TODO(bsalomon): it'd be nice to make Android normal.
189 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
190 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400191 libs = []
192 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500193 if (skia_enable_gpu) {
194 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500195 if (is_skia_dev_build && skia_use_vulkan) {
196 include_dirs += [ "tools/gpu/vk" ]
197 }
Brian Salomon03e05842017-02-23 12:23:47 -0500198 }
Brian Osman34755e22016-12-05 09:46:02 -0500199 if (skia_use_angle) {
200 defines += [ "SK_ANGLE" ]
201 }
Brian Osman3f375d02016-12-28 11:19:22 -0500202 if (skia_enable_discrete_gpu) {
203 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
204 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400205 if (!is_official_build) {
206 defines += [ "GR_TEST_UTILS=1" ]
207 }
mtkleinc04ff472016-06-23 10:29:30 -0700208}
209
210# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
211config("skia_library") {
212 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700213 defines = [ "SKIA_IMPLEMENTATION=1" ]
214}
215
216skia_library_configs = [
217 ":skia_public",
218 ":skia_private",
219 ":skia_library",
220]
221
mtklein9b8583d2016-08-24 17:32:30 -0700222# Use for CPU-specific Skia code that needs particular compiler flags.
223template("opts") {
224 if (invoker.enabled) {
225 source_set(target_name) {
226 forward_variables_from(invoker, "*")
227 configs += skia_library_configs
228 }
229 } else {
230 # If not enabled, a phony empty target that swallows all otherwise unused variables.
231 source_set(target_name) {
232 forward_variables_from(invoker,
233 "*",
234 [
235 "sources",
236 "cflags",
237 ])
238 }
239 }
anmittala7eaf2e2016-08-17 13:57:26 -0700240}
241
mtklein422310d2016-08-16 18:28:43 -0700242is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700243
mtklein7d6fb2c2016-08-25 14:50:44 -0700244opts("none") {
245 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700247 cflags = []
248}
249
mtklein7d6fb2c2016-08-25 14:50:44 -0700250opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700251 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700252 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700253 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700254}
255
256opts("arm64") {
257 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700259 cflags = []
260}
261
262opts("crc32") {
263 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700265 cflags = [ "-march=armv8-a+crc" ]
266}
267
mtklein9b8583d2016-08-24 17:32:30 -0700268opts("sse2") {
269 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700270 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400271 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400272 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
273 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400274 cflags = [ "-msse2" ]
275 }
mtklein9b8583d2016-08-24 17:32:30 -0700276}
mtkleinc04ff472016-06-23 10:29:30 -0700277
mtklein9b8583d2016-08-24 17:32:30 -0700278opts("ssse3") {
279 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700280 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400281 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400282 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
283 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400284 cflags = [ "-mssse3" ]
285 }
mtklein9b8583d2016-08-24 17:32:30 -0700286}
mtkleinc04ff472016-06-23 10:29:30 -0700287
mtklein9b8583d2016-08-24 17:32:30 -0700288opts("sse41") {
289 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700290 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400291 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400292 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
293 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400294 cflags = [ "-msse4.1" ]
295 }
mtklein9b8583d2016-08-24 17:32:30 -0700296}
mtklein4e976072016-08-08 09:06:27 -0700297
mtklein9b8583d2016-08-24 17:32:30 -0700298opts("sse42") {
299 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700300 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400301 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400302 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
303 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400304 cflags = [ "-msse4.2" ]
305 }
mtklein9b8583d2016-08-24 17:32:30 -0700306}
307
308opts("avx") {
309 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700310 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400311 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000312 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400313 } else {
314 cflags = [ "-mavx" ]
315 }
mtkleinc04ff472016-06-23 10:29:30 -0700316}
317
mtkleinc095df52016-08-24 12:23:52 -0700318# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700319template("optional") {
320 if (invoker.enabled) {
321 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700322 if (defined(invoker.public_defines)) {
323 defines = invoker.public_defines
324 }
mtklein457b42a2016-08-23 13:56:37 -0700325 }
326 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700327 forward_variables_from(invoker,
328 "*",
329 [
330 "public_defines",
331 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700332 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700333 ])
mtklein457b42a2016-08-23 13:56:37 -0700334 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700335 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700336 if (defined(invoker.configs_to_remove)) {
337 configs -= invoker.configs_to_remove
338 }
mtklein457b42a2016-08-23 13:56:37 -0700339 }
340 } else {
mtklein457b42a2016-08-23 13:56:37 -0700341 source_set(target_name) {
342 forward_variables_from(invoker,
343 "*",
344 [
345 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700346 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700347 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700348 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700349 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700350 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700351 ])
mtkleincd01b032016-08-31 04:58:19 -0700352 if (defined(invoker.sources_when_disabled)) {
353 sources = invoker.sources_when_disabled
354 }
355 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700356 }
mtkleineb3c4252016-08-23 07:38:09 -0700357 }
mtklein457b42a2016-08-23 13:56:37 -0700358}
mtklein457b42a2016-08-23 13:56:37 -0700359
Mike Kleina04bb452017-02-09 12:24:07 -0500360optional("effects") {
361 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400362 deps = [
363 ":compile_processors",
364 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500365 sources =
366 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
367 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
368}
369
mtkleina45be612016-08-29 15:22:10 -0700370optional("fontmgr_android") {
371 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700372
373 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500374 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700375 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700376 ]
377 sources = [
378 "src/ports/SkFontMgr_android.cpp",
379 "src/ports/SkFontMgr_android_factory.cpp",
380 "src/ports/SkFontMgr_android_parser.cpp",
381 ]
382}
383
mtkleind2e39db2016-09-07 07:52:55 -0700384optional("fontmgr_custom") {
385 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
386
387 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500388 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700389 ]
390 sources = [
391 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500392 "src/ports/SkFontMgr_custom.h",
393 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700394 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500395 "src/ports/SkFontMgr_custom_embedded.cpp",
396 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700397 ]
398}
399
Hal Canaryff2742e2018-01-30 11:35:47 -0500400optional("fontmgr_empty") {
401 enabled = skia_enable_fontmgr_empty
402 sources = [
403 "src/ports/SkFontMgr_empty_factory.cpp",
404 ]
405}
406
mtklein3cc22182016-08-29 13:26:14 -0700407optional("fontmgr_fontconfig") {
408 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700409
410 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500411 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700412 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700413 ]
414 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700415 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700416 "src/ports/SkFontConfigInterface_direct.cpp",
417 "src/ports/SkFontConfigInterface_direct_factory.cpp",
418 "src/ports/SkFontMgr_FontConfigInterface.cpp",
419 "src/ports/SkFontMgr_fontconfig.cpp",
420 "src/ports/SkFontMgr_fontconfig_factory.cpp",
421 ]
422}
423
mtkleincdedd0e2016-09-12 15:15:44 -0700424optional("fontmgr_fuchsia") {
425 enabled = is_fuchsia && skia_use_freetype
426
427 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500428 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700429 ]
430 sources = [
431 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500432 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700433 "src/ports/SkFontMgr_custom_empty_factory.cpp",
434 ]
435}
436
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700437if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400438 executable("sksllex") {
439 sources = [
440 "src/sksl/lex/Main.cpp",
441 "src/sksl/lex/NFA.cpp",
442 "src/sksl/lex/RegexNode.cpp",
443 "src/sksl/lex/RegexParser.cpp",
444 ]
445 include_dirs = [ "src/sksl/lex" ]
446 }
447
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700448 action("run_sksllex") {
449 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400450 deps = [
451 ":sksllex(//gn/toolchain:$host_toolchain)",
452 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700453 sources = [
454 "src/sksl/lex/layout.lex",
455 "src/sksl/lex/sksl.lex",
456 ]
457
458 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
459 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
460 outputs = [
461 "$target_out_dir/" +
462 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
463 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
464 # confused due to the same file being named by two different paths
465 ]
466 sksllex_path = "$root_out_dir/"
467 sksllex_path += "sksllex"
468 if (host_os == "win") {
469 sksllex_path += ".exe"
470 }
471 args = [
472 rebase_path(sksllex_path),
473 rebase_path("bin/clang-format"),
474 rebase_path("src"),
475 ]
476 }
477} else {
478 group("run_sksllex") {
479 }
480}
481
482if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400483 executable("skslc") {
484 defines = [ "SKSL_STANDALONE" ]
485 sources = [
486 "src/sksl/SkSLMain.cpp",
487 ]
488 sources += skia_sksl_sources
489 include_dirs = [
490 "src/gpu",
491 "src/sksl",
492 ]
493 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500494 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400495 "//third_party/spirv-tools",
496 ]
497 }
498
499 skia_gpu_processor_outputs = []
500 foreach(src, skia_gpu_processor_sources) {
501 dir = get_path_info(src, "dir")
502 name = get_path_info(src, "name")
503
504 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
505 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
506 skia_gpu_processor_outputs += [
507 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
508 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
509 # confused due to the same file being named by two different paths
510 ]
511 }
512
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500513 action("create_sksl_enums") {
514 script = "gn/create_sksl_enums.py"
515 sources = [
516 "include/private/GrSharedEnums.h",
517 ]
518 outputs = [
519 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500520 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500521 ]
522 args = [
523 rebase_path(sources[0]),
524 rebase_path(outputs[0]),
525 ]
526 }
527
Ethan Nicholas762466e2017-06-29 10:03:38 -0400528 action("compile_processors") {
529 script = "gn/compile_processors.py"
530 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500531 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400532 ":skslc(//gn/toolchain:$host_toolchain)",
533 ]
534 sources = skia_gpu_processor_sources
535 outputs = skia_gpu_processor_outputs
536 skslc_path = "$root_out_dir/"
537 if (host_toolchain != default_toolchain_name) {
538 skslc_path += "$host_toolchain/"
539 }
540 skslc_path += "skslc"
541 if (host_os == "win") {
542 skslc_path += ".exe"
543 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400544 args = [
545 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400546 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400547 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400548 args += rebase_path(skia_gpu_processor_sources)
549 }
550} else {
551 skia_gpu_processor_outputs = []
552 group("compile_processors") {
553 }
554}
555
mtklein06c35c02016-09-20 12:28:12 -0700556optional("gpu") {
557 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400558 deps = [
559 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700560 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400561 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700562 public_defines = []
563
Brian Salomon3d6801e2017-12-11 10:06:31 -0500564 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700565
566 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500567 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700568 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400569 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700570 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500571 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400572
573 # this lib is required to link against AHardwareBuffer
574 if (defined(ndk_api) && ndk_api >= 26) {
575 libs += [ "android" ]
576 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400577 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500578 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400579 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700580 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500581 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500582 libs += [
583 "GL",
584 "GLU",
585 ]
mtklein06c35c02016-09-20 12:28:12 -0700586 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500587 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800588 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500589 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400590 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500591 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400592 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700593 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500594 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700595 }
mtkleine9fb3d52016-09-20 15:11:46 -0700596
597 if (skia_use_vulkan) {
598 public_defines += [ "SK_VULKAN" ]
599 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700600 if (skia_enable_vulkan_debug_layers) {
601 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
602 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500603 if (skia_vulkan_header != "") {
604 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
605 } else {
606 if (is_skia_dev_build) {
607 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
608 }
609 }
mtkleine9fb3d52016-09-20 15:11:46 -0700610 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400611 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400612 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400613 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
614 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400615
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400616 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400617 if (skia_use_metal) {
618 public_defines += [ "SK_METAL" ]
619 sources += skia_metal_sources
620 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400621 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400622 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500623
624 if (skia_enable_atlas_text) {
625 sources += skia_atlas_text_sources
626 }
mtklein06c35c02016-09-20 12:28:12 -0700627}
628
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400629optional("heif") {
630 enabled = skia_use_libheif
631 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
632
633 deps = []
634
635 sources = [
636 "src/codec/SkHeifCodec.cpp",
637 ]
638}
639
mtklein63213812016-08-24 09:55:56 -0700640optional("jpeg") {
641 enabled = skia_use_libjpeg_turbo
642 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
643
mtklein63213812016-08-24 09:55:56 -0700644 deps = [
645 "//third_party/libjpeg-turbo:libjpeg",
646 ]
647 sources = [
648 "src/codec/SkJpegCodec.cpp",
649 "src/codec/SkJpegDecoderMgr.cpp",
650 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700651 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400652 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700653 ]
654}
655
656optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500657 enabled = skia_use_zlib && skia_enable_pdf
658 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700659
mtklein63213812016-08-24 09:55:56 -0700660 deps = [
661 "//third_party/zlib",
662 ]
brettwb9447282016-09-01 14:24:39 -0700663 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700664 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700665
666 if (skia_use_sfntly) {
667 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500668 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700669 }
670}
671
672optional("png") {
673 enabled = skia_use_libpng
674 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
675
mtklein63213812016-08-24 09:55:56 -0700676 deps = [
677 "//third_party/libpng",
678 ]
679 sources = [
680 "src/codec/SkIcoCodec.cpp",
681 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400682 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700683 ]
684}
685
scroggof84ad642016-10-31 09:02:57 -0700686optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400687 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700688 public_defines = [ "SK_CODEC_DECODES_RAW" ]
689
690 deps = [
691 "//third_party/dng_sdk",
692 "//third_party/libjpeg-turbo:libjpeg",
693 "//third_party/piex",
694 ]
695
696 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
697 # Skia.
698 configs_to_remove = [ "//gn:no_exceptions" ]
699
700 sources = [
701 "src/codec/SkRawAdapterCodec.cpp",
702 "src/codec/SkRawCodec.cpp",
703 ]
704}
705
Mike Kleinfb333552018-01-25 12:49:37 -0500706optional("skcms") {
707 enabled = skia_use_skcms
708
709 deps = [
710 "//third_party/skcms",
711 ]
712 sources = [
713 # TODO
714 ]
715}
716
mtklein3cc22182016-08-29 13:26:14 -0700717optional("typeface_freetype") {
718 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700719
720 deps = [
721 "//third_party/freetype2",
722 ]
723 sources = [
724 "src/ports/SkFontHost_FreeType.cpp",
725 "src/ports/SkFontHost_FreeType_common.cpp",
726 ]
727}
728
mtklein457b42a2016-08-23 13:56:37 -0700729optional("webp") {
730 enabled = skia_use_libwebp
731 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
732
mtklein457b42a2016-08-23 13:56:37 -0700733 deps = [
734 "//third_party/libwebp",
735 ]
736 sources = [
737 "src/codec/SkWebpAdapterCodec.cpp",
738 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400739 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700740 ]
mtkleineb3c4252016-08-23 07:38:09 -0700741}
742
mtklein63213812016-08-24 09:55:56 -0700743optional("xml") {
744 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000745 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700746
mtklein63213812016-08-24 09:55:56 -0700747 deps = [
748 "//third_party/expat",
749 ]
750 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500751 "src/svg/SkSVGCanvas.cpp",
752 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700753 "src/xml/SkDOM.cpp",
754 "src/xml/SkXMLParser.cpp",
755 "src/xml/SkXMLWriter.cpp",
756 ]
757}
758
mtkleinc04ff472016-06-23 10:29:30 -0700759component("skia") {
760 public_configs = [ ":skia_public" ]
761 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700762
763 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700764 ":arm64",
765 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700766 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700767 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500768 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700769 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700770 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500771 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700772 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700773 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700774 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400775 ":heif",
mtklein63213812016-08-24 09:55:56 -0700776 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700777 ":none",
mtklein63213812016-08-24 09:55:56 -0700778 ":pdf",
779 ":png",
scroggof84ad642016-10-31 09:02:57 -0700780 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500781 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700782 ":sse2",
783 ":sse41",
784 ":sse42",
785 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700786 ":webp",
mtklein63213812016-08-24 09:55:56 -0700787 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700788 ]
789
Chinmay Garde43f115c2016-11-16 15:04:12 -0800790 # This file (and all GN files in Skia) are designed to work with an
791 # empty sources assignment filter; we handle all that explicitly.
792 # We clear the filter here for clients who may have set up a global filter.
793 set_sources_assignment_filter([])
794
mtkleinc04ff472016-06-23 10:29:30 -0700795 sources = []
brettwb9447282016-09-01 14:24:39 -0700796 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700797 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500798 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700799 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400800 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500801 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700802 "src/android/SkBitmapRegionCodec.cpp",
803 "src/android/SkBitmapRegionDecoder.cpp",
804 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400805 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700806 "src/codec/SkBmpCodec.cpp",
807 "src/codec/SkBmpMaskCodec.cpp",
808 "src/codec/SkBmpRLECodec.cpp",
809 "src/codec/SkBmpStandardCodec.cpp",
810 "src/codec/SkCodec.cpp",
811 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700812 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700813 "src/codec/SkMaskSwizzler.cpp",
814 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700815 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700816 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700817 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700818 "src/codec/SkSwizzler.cpp",
819 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700820 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700821 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700822 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700823 "src/ports/SkMemory_malloc.cpp",
824 "src/ports/SkOSFile_stdio.cpp",
825 "src/sfnt/SkOTTable_name.cpp",
826 "src/sfnt/SkOTUtils.cpp",
827 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700828 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700829 ]
brettwb9447282016-09-01 14:24:39 -0700830
mtklein7d6fb2c2016-08-25 14:50:44 -0700831 libs = []
832
mtkleinc04ff472016-06-23 10:29:30 -0700833 if (is_win) {
834 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400835 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700836 "src/ports/SkDebug_win.cpp",
837 "src/ports/SkFontHost_win.cpp",
838 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500839 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700840 "src/ports/SkImageEncoder_WIC.cpp",
841 "src/ports/SkImageGeneratorWIC.cpp",
842 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700843 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700844 "src/ports/SkScalerContext_win_dw.cpp",
845 "src/ports/SkTLS_win.cpp",
846 "src/ports/SkTypeface_win_dw.cpp",
847 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400848 libs += [
849 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500850 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400851 "Ole32.lib",
852 "OleAut32.lib",
853 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500854 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400855 ]
mtkleinc04ff472016-06-23 10:29:30 -0700856 } else {
857 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700858 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700859 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700860 "src/ports/SkTLS_pthread.cpp",
861 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400862 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700863 }
864
mtklein7d6fb2c2016-08-25 14:50:44 -0700865 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500866 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500867 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500868 deps += [ "//third_party/cpu-features" ]
869 }
mtklein06c35c02016-09-20 12:28:12 -0700870 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700871 libs += [
872 "EGL",
873 "GLESv2",
874 "log",
875 ]
876 }
877
mtkleinc04ff472016-06-23 10:29:30 -0700878 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700879 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700880 }
881
882 if (is_mac) {
883 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700884 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700885 "src/ports/SkFontHost_mac.cpp",
886 "src/ports/SkImageEncoder_CG.cpp",
887 "src/ports/SkImageGeneratorCG.cpp",
888 ]
mtklein09e61f72016-08-23 13:35:28 -0700889 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400890 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
891 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700892 "ApplicationServices.framework",
893 "OpenGL.framework",
894 ]
mtkleinc04ff472016-06-23 10:29:30 -0700895 }
abarth6fc8ff02016-07-15 15:15:15 -0700896
Mike Klein7d302882016-11-03 14:06:31 -0400897 if (is_ios) {
898 sources += [
899 "src/ports/SkDebug_stdio.cpp",
900 "src/ports/SkFontHost_mac.cpp",
901 "src/ports/SkImageEncoder_CG.cpp",
902 "src/ports/SkImageGeneratorCG.cpp",
903 ]
904 libs += [
905 "CoreFoundation.framework",
906 "CoreGraphics.framework",
907 "CoreText.framework",
908 "ImageIO.framework",
909 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400910
911 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
912 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400913 ]
914 }
915
abarth6fc8ff02016-07-15 15:15:15 -0700916 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700917 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700918 }
mtkleinc04ff472016-06-23 10:29:30 -0700919}
920
mtkleinc095df52016-08-24 12:23:52 -0700921# Targets guarded by skia_enable_tools may use //third_party freely.
922if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500923 # Used by gn_to_bp.py to list our public include dirs.
924 source_set("public") {
925 configs += [ ":skia_public" ]
926 }
927
Mike Kleinc36dedf2016-11-18 09:35:28 -0500928 config("skia.h_config") {
929 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500930 if (skia_use_vulkan) {
931 # So we can get the header which includes vulkan
932 include_dirs += [ "tools/gpu/vk" ]
933 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500934 }
935 action("skia.h") {
936 public_configs = [ ":skia.h_config" ]
937 skia_h = "$target_gen_dir/skia.h"
938 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400939 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000940 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500941 depfile = "$skia_h.deps"
942 outputs = [
943 skia_h,
944 ]
945 }
946
947 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500948 executable("fiddle") {
949 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500950 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500951 "tools/fiddle/draw.cpp",
952 "tools/fiddle/fiddle_main.cpp",
953 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400954
955 if (skia_use_egl) {
956 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400957 } else {
958 sources += [ "tools/fiddle/null_context.cpp" ]
959 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400960 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500961 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400962 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500963 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500964 ":skia",
965 ":skia.h",
966 ]
967 }
968 }
969
970 if (skia_enable_gpu) {
971 source_set("public_headers_warnings_check") {
972 sources = [
973 "tools/public_headers_warnings_check.cpp",
974 ]
975 configs -= [ "//gn:warnings_except_public_headers" ]
976 deps = [
977 ":skia",
978 ":skia.h",
979 ]
980 }
981 }
982
mtkleinc095df52016-08-24 12:23:52 -0700983 template("test_lib") {
984 config(target_name + "_config") {
985 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700986 if (defined(invoker.public_defines)) {
987 defines = invoker.public_defines
988 }
mtklein25c81d42016-07-27 13:55:26 -0700989 }
mtkleinc095df52016-08-24 12:23:52 -0700990 source_set(target_name) {
991 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
992 public_configs = [
993 ":" + target_name + "_config",
994 ":skia_private",
995 ]
996
997 if (!defined(deps)) {
998 deps = []
999 }
1000 deps += [ ":skia" ]
1001 testonly = true
1002 }
mtklein25c81d42016-07-27 13:55:26 -07001003 }
mtklein25c81d42016-07-27 13:55:26 -07001004
Mike Kleine6682eb2017-01-05 10:54:57 -05001005 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001006 if (is_ios) {
1007 app_name = target_name
1008 gen_path = target_gen_dir
1009
1010 action("${app_name}_generate_info_plist") {
1011 script = "//gn/gen_plist_ios.py"
1012 outputs = [
1013 "$gen_path/${app_name}_Info.plist",
1014 ]
1015 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1016 }
1017
1018 bundle_data("${app_name}_bundle_info_plist") {
1019 public_deps = [
1020 ":${app_name}_generate_info_plist",
1021 ]
1022 sources = [
1023 "$gen_path/${app_name}_Info.plist",
1024 ]
1025 outputs = [
1026 "{{bundle_root_dir}}/Info.plist",
1027 ]
1028 }
1029
Jim Van Verth329c5a62017-11-29 11:42:33 -05001030 bundle_ios_data =
1031 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1032
1033 if (bundle_ios_data) {
1034 has_skps =
1035 "True" == exec_script("//gn/checkdir.py",
1036 [ rebase_path("skps", root_build_dir) ],
1037 "trim string")
1038 bundle_data("${app_name}_bundle_resources") {
1039 sources = [
1040 "resources",
1041 ]
1042 outputs = [
1043 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1044 "{{bundle_resources_dir}}/data/resources",
1045 ]
1046 }
1047
1048 if (has_skps) {
1049 bundle_data("${app_name}_bundle_skps") {
1050 sources = [
1051 "skps",
1052 ]
1053 outputs = [
1054 # Store in same folder as resources
1055 "{{bundle_resources_dir}}/data/skps",
1056 ]
1057 }
1058 }
1059 }
1060
Jim Van Verth443a9132017-11-28 09:45:26 -05001061 executable("${app_name}_generate_executable") {
1062 forward_variables_from(invoker,
1063 "*",
1064 [
1065 "output_name",
1066 "visibility",
1067 "is_shared_library",
1068 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001069 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001070 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001071 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1072 }
1073
1074 bundle_data("${app_name}_bundle_executable") {
1075 public_deps = [
1076 ":${app_name}_generate_executable",
1077 ]
1078 sources = [
1079 "$gen_path/$app_name",
1080 ]
1081 outputs = [
1082 "{{bundle_executable_dir}}/$app_name",
1083 ]
1084 testonly = true
1085 }
1086
1087 create_bundle("$app_name") {
1088 product_type = "com.apple.product-type.application"
1089 testonly = true
1090
1091 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1092 bundle_resources_dir = bundle_root_dir
1093 bundle_executable_dir = bundle_root_dir
1094 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1095
1096 deps = [
1097 ":${app_name}_bundle_executable",
1098 ":${app_name}_bundle_info_plist",
1099 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001100 if (bundle_ios_data) {
1101 deps += [ ":${app_name}_bundle_resources" ]
1102 if (has_skps) {
1103 deps += [ ":${app_name}_bundle_skps" ]
1104 }
1105 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001106
1107 # should only code sign when running on a device, not the simulator
1108 if (target_cpu != "x64") {
1109 code_signing_script = "//gn/codesign_ios.py"
1110 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1111 code_signing_outputs = [
1112 "$bundle_root_dir/_CodeSignature/CodeResources",
1113 "$bundle_root_dir/embedded.mobileprovision",
1114 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001115 code_signing_args = [
1116 rebase_path("$bundle_root_dir", root_build_dir),
1117 skia_ios_identity,
1118 skia_ios_profile,
1119 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001120 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001121 }
1122 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001123 # !is_ios
1124
1125 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1126 shared_library("lib" + target_name) {
1127 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1128 configs += [ ":skia_private" ]
1129 testonly = true
1130 }
1131 } else {
1132 _executable = target_name
1133 executable(_executable) {
1134 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1135 configs += [ ":skia_private" ]
1136 testonly = true
1137 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001138 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001139 if (is_android && skia_android_serial != "" && defined(_executable)) {
1140 action("push_" + target_name) {
1141 script = "gn/push_to_android.py"
1142 deps = [
1143 ":" + _executable,
1144 ]
1145 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1146 outputs = [
1147 _stamp,
1148 ]
1149 args = [
1150 rebase_path("$root_build_dir/$_executable"),
1151 skia_android_serial,
1152 rebase_path(_stamp),
1153 ]
1154 testonly = true
1155 }
Mike Klein7d921032017-01-05 12:20:41 -05001156 }
1157 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001158 }
1159
mtkleinc095df52016-08-24 12:23:52 -07001160 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001161 public_include_dirs = []
1162 if (skia_enable_gpu) {
1163 public_defines = []
1164 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001165
1166 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001167 sources = [
1168 "tools/gpu/GrContextFactory.cpp",
1169 "tools/gpu/GrTest.cpp",
1170 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001171 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001172 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001173 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001174 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1175 "tools/gpu/gl/debug/GrBufferObj.cpp",
1176 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1177 "tools/gpu/gl/debug/GrProgramObj.cpp",
1178 "tools/gpu/gl/debug/GrShaderObj.cpp",
1179 "tools/gpu/gl/debug/GrTextureObj.cpp",
1180 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1181 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001182 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001183 ]
1184 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001185
Kevin Lubick4a24e102017-03-29 11:19:01 -04001186 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001187 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001188 } else if (is_ios) {
1189 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1190 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001191 } else if (is_linux) {
1192 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001193 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001194 } else if (is_mac) {
1195 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001196 } else if (is_win) {
1197 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1198 libs += [
1199 "Gdi32.lib",
1200 "OpenGL32.lib",
1201 ]
mtklein38925aa2016-09-21 10:11:25 -07001202 }
mtklein6ef69992016-09-14 06:12:09 -07001203
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001204 cflags_objcc = [ "-fobjc-arc" ]
1205
Mike Kleinc168a3a2016-11-14 14:53:13 +00001206 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001207 deps += [ "//third_party/angle2" ]
1208 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1209 }
mtkleind68f9b02016-09-23 13:18:41 -07001210 if (skia_use_vulkan) {
1211 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001212 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001213 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001214 if (skia_use_metal) {
1215 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1216 }
mtkleina627b5c2016-09-20 13:36:47 -07001217 }
mtklein25c81d42016-07-27 13:55:26 -07001218 }
mtklein25c81d42016-07-27 13:55:26 -07001219
mtkleinc095df52016-08-24 12:23:52 -07001220 test_lib("flags") {
1221 public_include_dirs = [ "tools/flags" ]
1222 sources = [
1223 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001224 ]
1225 }
1226 test_lib("common_flags") {
1227 public_include_dirs = [ "tools/flags" ]
1228 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001229 "tools/flags/SkCommonFlags.cpp",
1230 "tools/flags/SkCommonFlagsConfig.cpp",
1231 ]
1232 deps = [
mtklein046cb562016-09-16 10:23:12 -07001233 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001234 ":gpu_tool_utils",
1235 ]
1236 }
mtklein25c81d42016-07-27 13:55:26 -07001237
mtkleinc095df52016-08-24 12:23:52 -07001238 test_lib("tool_utils") {
1239 public_include_dirs = [
1240 "tools",
1241 "tools/debugger",
1242 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001243 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001244 ]
1245 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001246 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001247 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001248 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001249 "tools/ProcStats.cpp",
1250 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001251 "tools/SkRandomScalerContext.cpp",
1252 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001253 "tools/UrlDataManager.cpp",
1254 "tools/debugger/SkDebugCanvas.cpp",
1255 "tools/debugger/SkDrawCommand.cpp",
1256 "tools/debugger/SkJsonWriteBuffer.cpp",
1257 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001258 "tools/picture_utils.cpp",
1259 "tools/random_parse_path.cpp",
1260 "tools/sk_tool_utils.cpp",
1261 "tools/sk_tool_utils_font.cpp",
1262 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001263 "tools/trace/SkChromeTracingTracer.cpp",
1264 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001265 "tools/trace/SkDebugfTracer.cpp",
1266 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001267 "tools/trace/SkEventTracingPriv.cpp",
1268 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001269 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001270 libs = []
1271 if (is_ios) {
1272 sources += [ "tools/ios_utils.m" ]
1273 libs += [ "Foundation.framework" ]
1274 }
mtkleinc095df52016-08-24 12:23:52 -07001275 deps = [
mtklein046cb562016-09-16 10:23:12 -07001276 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001277 ":flags",
1278 "//third_party/libpng",
1279 ]
1280 public_deps = [
1281 "//third_party/jsoncpp",
1282 ]
1283 }
mtklein25c81d42016-07-27 13:55:26 -07001284
Mike Klein6e744122016-10-27 12:21:40 -04001285 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001286 test_lib("gm") {
1287 public_include_dirs = [ "gm" ]
1288 sources = gm_sources
1289 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001290 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001291 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001292 ":gpu_tool_utils",
1293 ":skia",
1294 ":tool_utils",
1295 ]
1296 }
mtklein25c81d42016-07-27 13:55:26 -07001297
Mike Klein6e744122016-10-27 12:21:40 -04001298 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001299 test_lib("tests") {
1300 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001301 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001302 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001303 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001304 }
mtkleinc095df52016-08-24 12:23:52 -07001305 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001306 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001307 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001308 ":skia",
1309 ":tool_utils",
1310 "//third_party/libpng",
1311 "//third_party/zlib",
1312 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001313 if (skia_use_expat) {
1314 deps += [ ":experimental_svg_model" ]
1315 }
Mike Kleind63442d2017-03-27 14:16:04 -04001316 public_deps = [
1317 ":gpu_tool_utils", # Test.h #includes headers from this target.
1318 ]
mtkleinc095df52016-08-24 12:23:52 -07001319 }
mtklein2f3416d2016-08-02 16:02:05 -07001320
Mike Klein6e744122016-10-27 12:21:40 -04001321 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001322 test_lib("bench") {
1323 public_include_dirs = [ "bench" ]
1324 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001325 deps = [
1326 ":flags",
1327 ":gm",
1328 ":gpu_tool_utils",
1329 ":skia",
1330 ":tool_utils",
1331 ]
1332 }
mtklein2b6870c2016-07-28 14:17:33 -07001333
Florin Malita54f65c42018-01-16 17:04:30 -05001334 test_lib("experimental_skottie") {
1335 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001336 include_dirs = [ "tools" ]
1337 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001338 "experimental/skottie/Skottie.cpp",
1339 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001340 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001341 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001342 ]
1343 deps = [
1344 ":experimental_sksg",
1345 ":skia",
1346 "//third_party/jsoncpp",
1347 ]
1348 }
1349
mtkleinc095df52016-08-24 12:23:52 -07001350 test_lib("experimental_svg_model") {
1351 public_include_dirs = [ "experimental/svg/model" ]
1352 sources = [
1353 "experimental/svg/model/SkSVGAttribute.cpp",
1354 "experimental/svg/model/SkSVGAttributeParser.cpp",
1355 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001356 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001357 "experimental/svg/model/SkSVGContainer.cpp",
1358 "experimental/svg/model/SkSVGDOM.cpp",
1359 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001360 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001361 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001362 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001363 "experimental/svg/model/SkSVGNode.cpp",
1364 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001365 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001366 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001367 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001368 "experimental/svg/model/SkSVGRect.cpp",
1369 "experimental/svg/model/SkSVGRenderContext.cpp",
1370 "experimental/svg/model/SkSVGSVG.cpp",
1371 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001372 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001373 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001374 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001375 "experimental/svg/model/SkSVGValue.cpp",
1376 ]
1377 deps = [
1378 ":skia",
1379 ]
1380 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001381
Florin Malita4aa44412017-12-19 12:21:02 -05001382 test_lib("experimental_sksg") {
1383 public_include_dirs = [
1384 "experimental/sksg",
1385 "experimental/sksg/effects",
1386 "experimental/sksg/geometry",
1387 "experimental/sksg/paint",
1388 ]
1389 sources = [
1390 "experimental/sksg/SkSGDraw.cpp",
1391 "experimental/sksg/SkSGEffectNode.cpp",
1392 "experimental/sksg/SkSGGeometryNode.cpp",
1393 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001394 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001395 "experimental/sksg/SkSGInvalidationController.cpp",
1396 "experimental/sksg/SkSGNode.cpp",
1397 "experimental/sksg/SkSGPaintNode.cpp",
1398 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001399 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001400 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001401 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001402 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001403 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001404 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001405 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001406 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001407 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001408 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001409 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001410 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001411 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001412 ]
1413 deps = [
1414 ":skia",
1415 ]
1416 }
1417
Kevin Lubickebf648e2017-09-21 13:45:16 -04001418 if (target_cpu != "wasm") {
1419 test_lib("views") {
1420 public_include_dirs = [ "include/views" ]
1421 sources = [
1422 "src/views/SkEvent.cpp",
1423 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001424 "src/views/SkTouchGesture.cpp",
1425 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001426 ]
Brian Osman34755e22016-12-05 09:46:02 -05001427 }
Brian Osman16adfa32016-10-18 14:42:44 -04001428 }
1429
Mike Klein38af9432016-11-11 11:39:44 -05001430 if (skia_use_lua) {
1431 test_lib("lua") {
1432 public_include_dirs = []
1433 sources = [
1434 "src/utils/SkLua.cpp",
1435 "src/utils/SkLuaCanvas.cpp",
1436 ]
1437 deps = [
1438 "//third_party/lua",
1439 ]
1440 }
1441
Mike Kleine6682eb2017-01-05 10:54:57 -05001442 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001443 sources = [
1444 "tools/lua/lua_app.cpp",
1445 ]
1446 deps = [
1447 ":lua",
1448 ":skia",
1449 "//third_party/lua",
1450 ]
Mike Klein38af9432016-11-11 11:39:44 -05001451 }
1452
Mike Kleine6682eb2017-01-05 10:54:57 -05001453 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001454 sources = [
1455 "tools/lua/lua_pictures.cpp",
1456 ]
1457 deps = [
1458 ":flags",
1459 ":lua",
1460 ":skia",
1461 ":tool_utils",
1462 "//third_party/lua",
1463 ]
Mike Klein38af9432016-11-11 11:39:44 -05001464 }
1465 }
1466
Cary Clark8032b982017-07-28 11:04:54 -04001467 test_app("bookmaker") {
1468 sources = [
1469 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001470 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001471 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001472 "tools/bookmaker/fiddleParser.cpp",
1473 "tools/bookmaker/includeParser.cpp",
1474 "tools/bookmaker/includeWriter.cpp",
1475 "tools/bookmaker/mdOut.cpp",
1476 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001477 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001478 "tools/bookmaker/spellCheck.cpp",
1479 ]
1480 deps = [
1481 ":flags",
1482 ":skia",
1483 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001484 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001485 ]
1486 }
1487
Kevin Lubickebf648e2017-09-21 13:45:16 -04001488 if (target_cpu != "wasm") {
1489 import("gn/samples.gni")
1490 test_lib("samples") {
1491 public_include_dirs = [ "samplecode" ]
1492 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001493 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001494 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001495 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001496 ":experimental_svg_model",
1497 ":flags",
1498 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001499 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001500 ":tool_utils",
1501 ":views",
1502 ":xml",
1503 ]
Mike Klein38af9432016-11-11 11:39:44 -05001504
Kevin Lubickebf648e2017-09-21 13:45:16 -04001505 if (skia_use_lua) {
1506 sources += [ "samplecode/SampleLua.cpp" ]
1507 deps += [
1508 ":lua",
1509 "//third_party/lua",
1510 ]
1511 }
1512 }
1513 test_app("dm") {
1514 sources = [
1515 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001516 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001517 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001518 "dm/DMJsonWriter.cpp",
1519 "dm/DMSrcSink.cpp",
1520 ]
1521 include_dirs = [ "tests" ]
1522 deps = [
1523 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001524 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001525 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001526 ":experimental_svg_model",
1527 ":flags",
1528 ":gm",
1529 ":gpu_tool_utils",
1530 ":skia",
1531 ":tests",
1532 ":tool_utils",
1533 "//third_party/jsoncpp",
1534 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001535 ]
1536 }
Brian Osman16adfa32016-10-18 14:42:44 -04001537 }
1538
Mike Kleina8a51ce2018-01-09 12:34:11 -05001539 if (!is_win) {
1540 test_app("remote_demo") {
1541 sources = [
1542 "tools/remote_demo.cpp",
1543 ]
1544 deps = [
1545 ":skia",
1546 ]
1547 }
1548 }
1549
Mike Klein06432b22017-03-21 13:14:33 -04001550 test_app("ok") {
1551 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001552 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001553 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001554 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001555 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001556 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001557 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001558 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001559 ]
1560 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001561 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001562 ":gm",
1563 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001564 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001565 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001566 ]
1567 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001568 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001569 sources = [
1570 "bench/nanobench.cpp",
1571 ]
1572 deps = [
1573 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001574 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001575 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001576 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001577 ":flags",
1578 ":gm",
1579 ":gpu_tool_utils",
1580 ":skia",
1581 ":tool_utils",
1582 "//third_party/jsoncpp",
1583 ]
mtklein2b6870c2016-07-28 14:17:33 -07001584 }
halcanary19a97202016-08-03 15:08:04 -07001585
Ravi Mistry10d36c52017-01-31 09:49:18 -05001586 test_app("skpinfo") {
1587 sources = [
1588 "tools/skpinfo.cpp",
1589 ]
1590 deps = [
1591 ":flags",
1592 ":skia",
1593 ]
1594 }
1595
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001596 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001597 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001598 sources = [
1599 "tools/skpbench/skpbench.cpp",
1600 ]
1601 deps = [
1602 ":flags",
1603 ":gpu_tool_utils",
1604 ":skia",
1605 ":tool_utils",
1606 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001607 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001608 }
1609
Hal Canary96c57252018-02-09 11:43:05 -05001610 test_lib("skshaper") {
1611 public_include_dirs = [ "tools/shape" ]
1612 deps = [
1613 ":skia",
1614 ]
1615
1616 # TODO(halcanary): Build ICU on iOS.
1617 if (is_ios || target_cpu == "wasm") {
1618 sources = [
1619 "tools/shape/SkShaper_primitive.cpp",
1620 ]
1621 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001622 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001623 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001624 ]
Hal Canary96c57252018-02-09 11:43:05 -05001625 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001626 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001627 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001628 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001629 }
halcanary19a97202016-08-03 15:08:04 -07001630 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001631 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001632 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001633 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001634 ]
1635 deps = [
1636 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001637 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001638 ]
halcanary3eee9d92016-09-10 07:01:53 -07001639 }
mtklein046cb562016-09-16 10:23:12 -07001640
Matt Sarett9f1c4032017-05-17 10:06:32 -04001641 test_app("create_flutter_test_images") {
1642 sources = [
1643 "tools/create_flutter_test_images.cpp",
1644 ]
1645 deps = [
1646 ":skia",
1647 ":tool_utils",
1648 ]
1649 }
1650
Ben Wagner219f3622017-07-17 15:32:25 -04001651 test_app("create_test_font") {
1652 sources = [
1653 "tools/create_test_font.cpp",
1654 ]
1655 deps = [
1656 ":skia",
1657 ]
1658 assert_no_deps = [
1659 # tool_utils requires the output of this app.
1660 ":tool_utils",
1661 ]
1662 }
1663
Mike Kleine6682eb2017-01-05 10:54:57 -05001664 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001665 sources = [
1666 "tools/get_images_from_skps.cpp",
1667 ]
1668 deps = [
1669 ":flags",
1670 ":skia",
1671 "//third_party/jsoncpp",
1672 ]
mtklein046cb562016-09-16 10:23:12 -07001673 }
mtkleinecbc5262016-09-22 11:51:24 -07001674
Mike Kleine6682eb2017-01-05 10:54:57 -05001675 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001676 sources = [
1677 "tools/colorspaceinfo.cpp",
1678 ]
1679 deps = [
1680 ":flags",
1681 ":skia",
1682 ":tool_utils",
1683 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001684 }
1685
Kevin Lubickebf648e2017-09-21 13:45:16 -04001686 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001687 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001688 sources = [
1689 "tools/skiaserve/Request.cpp",
1690 "tools/skiaserve/Response.cpp",
1691 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001692 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1693 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1694 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1695 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1696 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1697 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1698 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1699 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1700 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001701 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1702 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001703 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1704 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1705 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1706 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1707 ]
1708 deps = [
1709 ":flags",
1710 ":gpu_tool_utils",
1711 ":skia",
1712 ":tool_utils",
1713 "//third_party/jsoncpp",
1714 "//third_party/libmicrohttpd",
1715 "//third_party/libpng",
1716 ]
Mike Klein7d302882016-11-03 14:06:31 -04001717 }
mtkleinecbc5262016-09-22 11:51:24 -07001718 }
kjlubick14f984b2016-10-03 11:49:45 -07001719
Mike Kleine6682eb2017-01-05 10:54:57 -05001720 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001721 include_dirs = [
1722 "tools",
1723 "tools/debugger",
1724 ]
kjlubick14f984b2016-10-03 11:49:45 -07001725 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001726 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001727 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001728 "fuzz/FuzzGradients.cpp",
1729 "fuzz/FuzzParsePath.cpp",
1730 "fuzz/FuzzPathop.cpp",
1731 "fuzz/FuzzScaleToSides.cpp",
1732 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001733 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1734 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001735 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1736 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001737 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1738 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001739 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001740 "tools/UrlDataManager.cpp",
1741 "tools/debugger/SkDebugCanvas.cpp",
1742 "tools/debugger/SkDrawCommand.cpp",
1743 "tools/debugger/SkJsonWriteBuffer.cpp",
1744 "tools/debugger/SkObjectParser.cpp",
1745 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001746 ]
1747 deps = [
1748 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001749 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001750 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001751 "//third_party/jsoncpp",
1752 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001753 ]
kjlubick14f984b2016-10-03 11:49:45 -07001754 }
Mike Klein38312422016-10-05 15:41:01 -04001755
Mike Kleine6682eb2017-01-05 10:54:57 -05001756 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001757 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001758 rebase_path("tests/skia_test.cpp"),
1759 rebase_path("tests/Test.cpp"),
1760 ]
caryclark9feb6322016-10-25 08:58:26 -07001761 deps = [
1762 ":flags",
1763 ":gpu_tool_utils",
1764 ":skia",
1765 ":tool_utils",
1766 ]
caryclark9feb6322016-10-25 08:58:26 -07001767 }
1768
Mike Kleine6682eb2017-01-05 10:54:57 -05001769 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001770 sources = [
1771 "tools/DumpRecord.cpp",
1772 "tools/dump_record.cpp",
1773 ]
1774 deps = [
1775 ":flags",
1776 ":skia",
1777 ]
Mike Klein38312422016-10-05 15:41:01 -04001778 }
bungemanfe917272016-10-13 17:36:40 -04001779
Mike Kleine6682eb2017-01-05 10:54:57 -05001780 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001781 sources = [
1782 "tools/skdiff/skdiff.cpp",
1783 "tools/skdiff/skdiff_html.cpp",
1784 "tools/skdiff/skdiff_main.cpp",
1785 "tools/skdiff/skdiff_utils.cpp",
1786 ]
1787 deps = [
1788 ":skia",
1789 ":tool_utils",
1790 ]
bungemanfe917272016-10-13 17:36:40 -04001791 }
halcanarya73d76a2016-10-17 13:19:02 -07001792
Mike Kleine6682eb2017-01-05 10:54:57 -05001793 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001794 sources = [
1795 "tools/skp_parser.cpp",
1796 ]
1797 deps = [
1798 ":skia",
1799 ":tool_utils",
1800 "//third_party/jsoncpp",
1801 ]
halcanarya73d76a2016-10-17 13:19:02 -07001802 }
Brian Osman16adfa32016-10-18 14:42:44 -04001803
Hal Canaryd7b38452017-12-11 17:46:26 -05001804 if (!is_win && skia_enable_gpu) {
1805 test_lib("skqp_lib") {
1806 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001807 defines =
1808 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001809 if (skia_skqp_enable_driver_correctness_workarounds) {
1810 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1811 }
Hal Canary75427132017-10-11 16:00:31 -04001812 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001813 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001814 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001815 "tools/skqp/gm_knowledge.cpp",
1816 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001817 ]
1818 deps = [
1819 ":gm",
1820 ":gpu_tool_utils",
1821 ":skia",
1822 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001823 ":tool_utils",
1824 ]
1825 }
1826 test_app("skqp") {
1827 sources = [
1828 "tools/skqp/skqp.cpp",
1829 ]
1830 deps = [
1831 ":skia",
1832 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001833 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001834 "//third_party/googletest",
1835 ]
1836 }
1837 }
Hal Canary28f89382017-12-12 09:42:14 -05001838 if (is_android && skia_enable_gpu) {
1839 test_app("skqp_app") {
1840 is_shared_library = true
1841 sources = [
1842 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1843 ]
1844 deps = [
1845 ":skia",
1846 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001847 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001848 ]
1849 libs = [ "android" ]
1850 }
1851 }
Hal Canary75427132017-10-11 16:00:31 -04001852
Hal Canarya9de7602018-01-19 13:08:23 -05001853 test_app("list_gms") {
1854 sources = [
1855 "tools/list_gms.cpp",
1856 ]
1857 deps = [
1858 ":gm",
1859 ":skia",
1860 ]
1861 }
1862 test_app("list_gpu_unit_tests") {
1863 sources = [
1864 "dm/DMGpuTestProcs.cpp",
1865 "tools/list_gpu_unit_tests.cpp",
1866 ]
1867 deps = [
1868 ":skia",
1869 ":tests",
1870 ]
1871 }
1872
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001873 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001874 test_lib("sk_app") {
1875 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001876 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001877 "tools/sk_app/CommandSet.cpp",
1878 "tools/sk_app/GLWindowContext.cpp",
1879 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001880 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001881 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001882
Jim Van Verth4e56a912016-10-21 10:58:52 -04001883 if (is_android) {
1884 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001885 "tools/sk_app/android/GLWindowContext_android.cpp",
1886 "tools/sk_app/android/RasterWindowContext_android.cpp",
1887 "tools/sk_app/android/Window_android.cpp",
1888 "tools/sk_app/android/main_android.cpp",
1889 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001890 ]
Brian Osman462334e2017-02-09 11:22:57 -05001891 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001892 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001893 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001894 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1895 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1896 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001897 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001898 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001899 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001900 libs += [
1901 "GL",
1902 "X11",
1903 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001904 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001905 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001906 "tools/sk_app/win/GLWindowContext_win.cpp",
1907 "tools/sk_app/win/RasterWindowContext_win.cpp",
1908 "tools/sk_app/win/Window_win.cpp",
1909 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001910 ]
Brian Salomon194db172017-08-17 14:37:06 -04001911 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001912 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001913 }
Mike Klein43c25262016-10-20 10:17:47 -04001914 } else if (is_mac) {
1915 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001916 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1917 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1918 "tools/sk_app/mac/Window_mac.cpp",
1919 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001920 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001921 libs += [
1922 "QuartzCore.framework",
1923 "Cocoa.framework",
1924 "Foundation.framework",
1925 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001926 } else if (is_ios) {
1927 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001928 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1929 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1930 "tools/sk_app/ios/Window_ios.cpp",
1931 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001932 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001933 }
1934
1935 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001936 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001937 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001938 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001939 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001940 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001941 libs += [ "X11-xcb" ]
1942 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001943 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001944 }
1945 }
1946
Brian Osman16adfa32016-10-18 14:42:44 -04001947 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001948 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001949 ":skia",
1950 ":tool_utils",
1951 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001952 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001953 if (is_android) {
1954 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001955 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001956 deps += [ "//third_party/libsdl" ]
1957 }
Brian Salomon194db172017-08-17 14:37:06 -04001958 if (skia_use_angle) {
1959 deps += [ "//third_party/angle2" ]
1960 }
Mike Kleina92c3832016-12-08 09:49:39 -05001961 }
Brian Osman16adfa32016-10-18 14:42:44 -04001962 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001963
Brian Osmaneff04b52017-11-21 13:18:02 -05001964 if (skia_enable_gpu) {
1965 test_app("viewer") {
1966 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001967 if (is_ios) {
1968 bundle_ios_data = true
1969 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001970 sources = [
1971 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001972 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001973 "tools/viewer/ImageSlide.cpp",
1974 "tools/viewer/SKPSlide.cpp",
1975 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001976 "tools/viewer/SkottieSlide.cpp",
1977 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001978 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001979 "tools/viewer/Viewer.cpp",
1980 ]
1981 libs = []
1982
1983 include_dirs = []
1984 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001985 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05001986 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05001987 ":flags",
1988 ":gm",
1989 ":gpu_tool_utils",
1990 ":samples",
1991 ":sk_app",
1992 ":skia",
1993 ":tool_utils",
1994 ":views",
1995 "//third_party/imgui",
1996 "//third_party/jsoncpp",
1997 ]
1998 }
1999 }
2000
2001 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2002 test_app("HelloWorld") {
2003 sources = [
2004 "example/HelloWorld.cpp",
2005 ]
2006 libs = []
2007
2008 include_dirs = []
2009 deps = [
2010 ":flags",
2011 ":gpu_tool_utils",
2012 ":sk_app",
2013 ":skia",
2014 ":tool_utils",
2015 ":views",
2016 ]
2017 }
2018 }
2019
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002020 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002021 test_app("SkiaSDLExample") {
2022 sources = [
2023 "example/SkiaSDLExample.cpp",
2024 ]
2025 libs = []
2026 include_dirs = []
2027 deps = [
2028 ":gpu_tool_utils",
2029 ":skia",
2030 "//third_party/libsdl",
2031 ]
2032 }
2033 }
2034
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002035 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2036 action_foreach("generate_mocs") {
2037 script = "gn/call.py"
2038 sources = [
2039 "tools/mdbviz/MainWindow.h",
2040 ]
2041 outputs = [
2042 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2043 ]
2044 args = [
2045 "$skia_qt_path" + "/bin/moc",
2046 "{{source}}",
2047 "-o",
2048 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2049 ]
2050 }
2051 action_foreach("generate_resources") {
2052 script = "gn/call.py"
2053 sources = [
2054 "tools/mdbviz/resources.qrc",
2055 ]
2056 outputs = [
2057 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2058 ]
2059 args = [
2060 "$skia_qt_path" + "/bin/rcc",
2061 "{{source}}",
2062 "-o",
2063 "gen/mdbviz/{{source_name_part}}_res.cpp",
2064 ]
2065 }
2066 test_app("mdbviz") {
2067 if (is_win) {
2068 # on Windows we need to disable some exception handling warnings due to the Qt headers
2069 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2070 }
2071 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002072 "tools/UrlDataManager.cpp",
2073 "tools/debugger/SkDebugCanvas.cpp",
2074 "tools/debugger/SkDrawCommand.cpp",
2075 "tools/debugger/SkJsonWriteBuffer.cpp",
2076 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002077 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002078 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002079 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002080 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002081
2082 # generated files
2083 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2084 "$target_gen_dir/mdbviz/resources_res.cpp",
2085 ]
2086 lib_dirs = [ "$skia_qt_path/lib" ]
2087 libs = [
2088 "Qt5Core.lib",
2089 "Qt5Gui.lib",
2090 "Qt5Widgets.lib",
2091 ]
2092 include_dirs = [
2093 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002094 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002095 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002096 "tools",
2097 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002098 ]
2099 deps = [
2100 ":generate_mocs",
2101 ":generate_resources",
2102 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002103 "//third_party/jsoncpp",
2104 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002105 ]
2106 }
2107 }
2108
Mike Kleine459afd2017-03-03 09:21:30 -05002109 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002110 copy("gdbserver") {
2111 sources = [
2112 "$ndk/$ndk_gdbserver",
2113 ]
2114 outputs = [
2115 "$root_out_dir/gdbserver",
2116 ]
2117 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002118 }
mtklein25c81d42016-07-27 13:55:26 -07002119}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002120
2121if (skia_jumper_clang != "") {
2122 action("regen_jumper") {
2123 script = "src/jumper/build_stages.py"
2124
2125 inputs = [
2126 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002127 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002128 ]
2129
2130 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2131 outputs = [
2132 "$target_out_dir/" +
2133 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2134 "$target_out_dir/" +
2135 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2136 ]
2137
2138 args = [
2139 skia_jumper_clang,
2140 skia_jumper_objdump,
2141 skia_jumper_ccache,
2142 ] + rebase_path(inputs) + rebase_path(outputs)
2143 }
2144}