blob: 8b30c411d4fe00b7cb87ac011ec15c444dee55b6 [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
Brian Osman74511012018-04-02 20:13:46 +000040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
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
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040053
54 skia_llvm_path = ""
55 skia_llvm_lib = "LLVM"
mtkleinc04ff472016-06-23 10:29:30 -070056}
Brian Salomon23d73ea2016-10-27 13:31:37 -040057declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040058 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040059 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050060 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040061
Brian Salomon5f33a8c2018-02-26 14:32:39 -050062 skia_use_legacy_gpu_pixel_ops = is_skia_dev_build && is_win # Arbitrary to keep old code path tested until deletion.
63
Mike Klein4d598a32016-10-31 13:44:49 -040064 if (is_android) {
65 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070066 } else if (is_fuchsia) {
67 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040068 } else {
69 skia_use_vulkan = skia_vulkan_sdk != ""
70 }
Jim Van Verth4e502972017-12-07 15:16:10 -050071
72 if (is_ios) {
73 skia_ios_identity = ".*Google.*"
74 skia_ios_profile = "Google Development"
75 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040076}
Greg Danielec6ae522017-04-25 13:38:26 -040077declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050078 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040079 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000080 # 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 -040081 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050082 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040083 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050084 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040085 }
Greg Danielec6ae522017-04-25 13:38:26 -040086 }
87}
Brian Salomon789e25e2016-09-30 13:41:03 -040088
Adam Barth54ef74a2017-10-13 10:59:38 -070089if (defined(skia_settings)) {
90 import(skia_settings)
91}
92
mtklein38925aa2016-09-21 10:11:25 -070093# Our tools require static linking (they use non-exported symbols).
94skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070095
mtkleina45be612016-08-29 15:22:10 -070096fontmgr_android_enabled = skia_use_expat && skia_use_freetype
97
mtklein1211e0c2016-07-26 13:55:45 -070098skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070099 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700100 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/codec",
102 "include/config",
103 "include/core",
104 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400105 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/gpu",
107 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500108 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700109 "include/pathops",
110 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700111 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700112 "include/utils",
113 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700114]
115
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000116if (skia_use_vulkan) {
117 skia_public_includes += [ "include/gpu/vk" ]
118}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500119if (skia_enable_atlas_text) {
120 skia_public_includes += [ "include/atlastext" ]
121}
Greg Daniele5ddff52017-07-05 16:49:36 -0400122if (skia_use_metal) {
123 skia_public_includes += [ "include/gpu/mtl" ]
124}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000125
mtkleinc04ff472016-06-23 10:29:30 -0700126# Skia public API, generally provided by :skia.
127config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700128 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500129 if (skia_tools_vulkan_header_dir != "") {
130 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400131 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400132 defines = []
133 if (is_component_build) {
134 defines += [ "SKIA_DLL" ]
135 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400136 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700137 defines += [ "SK_SAMPLES_FOR_X" ]
138 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400139 if (skia_enable_flutter_defines) {
140 defines += flutter_defines
141 }
mtklein06c35c02016-09-20 12:28:12 -0700142 if (!skia_enable_gpu) {
143 defines += [ "SK_SUPPORT_GPU=0" ]
144 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500145 if (skia_enable_atlas_text) {
146 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
147 }
mtkleinc04ff472016-06-23 10:29:30 -0700148}
149
150# Skia internal APIs, used by Skia itself and a few test tools.
151config("skia_private") {
152 visibility = [ ":*" ]
153
154 include_dirs = [
155 "include/private",
156 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700157 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700158 "src/core",
159 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700160 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700161 "src/image",
162 "src/images",
163 "src/lazy",
164 "src/opts",
165 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700166 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700167 "src/ports",
168 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400169 "src/shaders",
170 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700171 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700172 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700173 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500174 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700175 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700176 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400177 if (skia_llvm_path != "") {
178 include_dirs += [ "$skia_llvm_path/include" ]
179 }
mtklein150d1132016-08-01 06:56:40 -0700180
Mike Reeda9e241d2017-05-03 10:52:00 -0400181 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700182 if (is_android) {
183 defines += [
184 "SK_GAMMA_EXPONENT=1.4",
185 "SK_GAMMA_CONTRAST=0.0",
186 ]
187 }
mtklein88a7ac02016-09-14 11:16:49 -0700188 if (is_official_build || is_android) {
189 # TODO(bsalomon): it'd be nice to make Android normal.
190 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
191 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400192 libs = []
193 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500194 if (skia_enable_gpu) {
195 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500196 if (is_skia_dev_build && skia_use_vulkan) {
197 include_dirs += [ "tools/gpu/vk" ]
198 }
Brian Salomon03e05842017-02-23 12:23:47 -0500199 }
Brian Osman34755e22016-12-05 09:46:02 -0500200 if (skia_use_angle) {
201 defines += [ "SK_ANGLE" ]
202 }
Brian Osman3f375d02016-12-28 11:19:22 -0500203 if (skia_enable_discrete_gpu) {
204 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
205 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400206 if (!is_official_build) {
207 defines += [ "GR_TEST_UTILS=1" ]
208 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400209 if (skia_llvm_path != "") {
210 defines += [ "SK_LLVM_AVAILABLE" ]
211 include_dirs += [ "$skia_llvm_path/include" ]
212 libs += [ skia_llvm_lib ]
213 lib_dirs += [ "$skia_llvm_path/lib/" ]
214 }
mtkleinc04ff472016-06-23 10:29:30 -0700215}
216
217# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
218config("skia_library") {
219 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700220 defines = [ "SKIA_IMPLEMENTATION=1" ]
221}
222
223skia_library_configs = [
224 ":skia_public",
225 ":skia_private",
226 ":skia_library",
227]
228
mtklein9b8583d2016-08-24 17:32:30 -0700229# Use for CPU-specific Skia code that needs particular compiler flags.
230template("opts") {
231 if (invoker.enabled) {
232 source_set(target_name) {
233 forward_variables_from(invoker, "*")
234 configs += skia_library_configs
235 }
236 } else {
237 # If not enabled, a phony empty target that swallows all otherwise unused variables.
238 source_set(target_name) {
239 forward_variables_from(invoker,
240 "*",
241 [
242 "sources",
243 "cflags",
244 ])
245 }
246 }
anmittala7eaf2e2016-08-17 13:57:26 -0700247}
248
mtklein422310d2016-08-16 18:28:43 -0700249is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700250
mtklein7d6fb2c2016-08-25 14:50:44 -0700251opts("none") {
252 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700254 cflags = []
255}
256
mtklein7d6fb2c2016-08-25 14:50:44 -0700257opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700258 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700260 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700261}
262
263opts("arm64") {
264 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700265 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700266 cflags = []
267}
268
269opts("crc32") {
270 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700271 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700272 cflags = [ "-march=armv8-a+crc" ]
273}
274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("sse2") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-msse2" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtkleinc04ff472016-06-23 10:29:30 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("ssse3") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400289 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-mssse3" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
mtkleinc04ff472016-06-23 10:29:30 -0700294
mtklein9b8583d2016-08-24 17:32:30 -0700295opts("sse41") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400298 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400299 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
300 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400301 cflags = [ "-msse4.1" ]
302 }
mtklein9b8583d2016-08-24 17:32:30 -0700303}
mtklein4e976072016-08-08 09:06:27 -0700304
mtklein9b8583d2016-08-24 17:32:30 -0700305opts("sse42") {
306 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700307 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400308 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400309 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
310 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400311 cflags = [ "-msse4.2" ]
312 }
mtklein9b8583d2016-08-24 17:32:30 -0700313}
314
315opts("avx") {
316 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700317 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400318 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000319 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400320 } else {
321 cflags = [ "-mavx" ]
322 }
mtkleinc04ff472016-06-23 10:29:30 -0700323}
324
Mike Klein1b9b7d52018-02-27 10:37:40 -0500325opts("hsw") {
326 enabled = is_x86
327 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400328 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500329 cflags = [ "/arch:AVX2" ]
330 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000331 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500332 }
333
334 # Oddly, clang-cl doesn't recognize this as a valid flag.
335 # If it ever does, it'd nice to move this up with -mavx2 and co.
336 if (is_clang && !is_win) {
337 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
338 # but nice to have, generating slightly better code for paths without explicit FMAs.
339 cflags += [ "-ffp-contract=fast" ]
340 }
341}
342
mtkleinc095df52016-08-24 12:23:52 -0700343# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700344template("optional") {
345 if (invoker.enabled) {
346 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700347 if (defined(invoker.public_defines)) {
348 defines = invoker.public_defines
349 }
mtklein457b42a2016-08-23 13:56:37 -0700350 }
351 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700352 forward_variables_from(invoker,
353 "*",
354 [
355 "public_defines",
356 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700357 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700358 ])
mtklein457b42a2016-08-23 13:56:37 -0700359 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700360 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700361 if (defined(invoker.configs_to_remove)) {
362 configs -= invoker.configs_to_remove
363 }
mtklein457b42a2016-08-23 13:56:37 -0700364 }
365 } else {
mtklein457b42a2016-08-23 13:56:37 -0700366 source_set(target_name) {
367 forward_variables_from(invoker,
368 "*",
369 [
370 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700371 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700372 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700373 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700374 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700375 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700376 ])
mtkleincd01b032016-08-31 04:58:19 -0700377 if (defined(invoker.sources_when_disabled)) {
378 sources = invoker.sources_when_disabled
379 }
380 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700381 }
mtkleineb3c4252016-08-23 07:38:09 -0700382 }
mtklein457b42a2016-08-23 13:56:37 -0700383}
mtklein457b42a2016-08-23 13:56:37 -0700384
Mike Kleina04bb452017-02-09 12:24:07 -0500385optional("effects") {
386 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400387 deps = [
388 ":compile_processors",
389 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500390 sources =
391 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
392 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
393}
394
mtkleina45be612016-08-29 15:22:10 -0700395optional("fontmgr_android") {
396 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700397
398 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500399 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700400 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700401 ]
402 sources = [
403 "src/ports/SkFontMgr_android.cpp",
404 "src/ports/SkFontMgr_android_factory.cpp",
405 "src/ports/SkFontMgr_android_parser.cpp",
406 ]
407}
408
mtkleind2e39db2016-09-07 07:52:55 -0700409optional("fontmgr_custom") {
410 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
411
412 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500413 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700414 ]
415 sources = [
416 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500417 "src/ports/SkFontMgr_custom.h",
418 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700419 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500420 "src/ports/SkFontMgr_custom_embedded.cpp",
421 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700422 ]
423}
424
Hal Canaryff2742e2018-01-30 11:35:47 -0500425optional("fontmgr_empty") {
426 enabled = skia_enable_fontmgr_empty
427 sources = [
428 "src/ports/SkFontMgr_empty_factory.cpp",
429 ]
430}
431
mtklein3cc22182016-08-29 13:26:14 -0700432optional("fontmgr_fontconfig") {
433 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700434
435 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500436 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700437 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700438 ]
439 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700440 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700441 "src/ports/SkFontConfigInterface_direct.cpp",
442 "src/ports/SkFontConfigInterface_direct_factory.cpp",
443 "src/ports/SkFontMgr_FontConfigInterface.cpp",
444 "src/ports/SkFontMgr_fontconfig.cpp",
445 "src/ports/SkFontMgr_fontconfig_factory.cpp",
446 ]
447}
448
mtkleincdedd0e2016-09-12 15:15:44 -0700449optional("fontmgr_fuchsia") {
450 enabled = is_fuchsia && skia_use_freetype
451
452 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500453 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700454 ]
455 sources = [
456 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500457 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700458 "src/ports/SkFontMgr_custom_empty_factory.cpp",
459 ]
460}
461
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700462if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400463 executable("sksllex") {
464 sources = [
465 "src/sksl/lex/Main.cpp",
466 "src/sksl/lex/NFA.cpp",
467 "src/sksl/lex/RegexNode.cpp",
468 "src/sksl/lex/RegexParser.cpp",
469 ]
470 include_dirs = [ "src/sksl/lex" ]
471 }
472
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700473 action("run_sksllex") {
474 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400475 deps = [
476 ":sksllex(//gn/toolchain:$host_toolchain)",
477 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700478 sources = [
479 "src/sksl/lex/layout.lex",
480 "src/sksl/lex/sksl.lex",
481 ]
482
483 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
484 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
485 outputs = [
486 "$target_out_dir/" +
487 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
488 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
489 # confused due to the same file being named by two different paths
490 ]
491 sksllex_path = "$root_out_dir/"
492 sksllex_path += "sksllex"
493 if (host_os == "win") {
494 sksllex_path += ".exe"
495 }
496 args = [
497 rebase_path(sksllex_path),
498 rebase_path("bin/clang-format"),
499 rebase_path("src"),
500 ]
501 }
502} else {
503 group("run_sksllex") {
504 }
505}
506
507if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 executable("skslc") {
509 defines = [ "SKSL_STANDALONE" ]
510 sources = [
511 "src/sksl/SkSLMain.cpp",
512 ]
513 sources += skia_sksl_sources
514 include_dirs = [
515 "src/gpu",
516 "src/sksl",
517 ]
518 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500519 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400520 "//third_party/spirv-tools",
521 ]
522 }
523
524 skia_gpu_processor_outputs = []
525 foreach(src, skia_gpu_processor_sources) {
526 dir = get_path_info(src, "dir")
527 name = get_path_info(src, "name")
528
529 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
530 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
531 skia_gpu_processor_outputs += [
532 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
533 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
534 # confused due to the same file being named by two different paths
535 ]
536 }
537
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500538 action("create_sksl_enums") {
539 script = "gn/create_sksl_enums.py"
540 sources = [
541 "include/private/GrSharedEnums.h",
542 ]
543 outputs = [
544 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500545 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500546 ]
547 args = [
548 rebase_path(sources[0]),
549 rebase_path(outputs[0]),
550 ]
551 }
552
Ethan Nicholas762466e2017-06-29 10:03:38 -0400553 action("compile_processors") {
554 script = "gn/compile_processors.py"
555 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500556 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400557 ":skslc(//gn/toolchain:$host_toolchain)",
558 ]
559 sources = skia_gpu_processor_sources
560 outputs = skia_gpu_processor_outputs
561 skslc_path = "$root_out_dir/"
562 if (host_toolchain != default_toolchain_name) {
563 skslc_path += "$host_toolchain/"
564 }
565 skslc_path += "skslc"
566 if (host_os == "win") {
567 skslc_path += ".exe"
568 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400569 args = [
570 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400571 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400572 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400573 args += rebase_path(skia_gpu_processor_sources)
574 }
575} else {
576 skia_gpu_processor_outputs = []
577 group("compile_processors") {
578 }
579}
580
mtklein06c35c02016-09-20 12:28:12 -0700581optional("gpu") {
582 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400583 deps = [
584 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700585 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400586 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700587 public_defines = []
588
Brian Salomon3d6801e2017-12-11 10:06:31 -0500589 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700590
591 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500592 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700593 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400594 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700595 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400596 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400597
598 # this lib is required to link against AHardwareBuffer
599 if (defined(ndk_api) && ndk_api >= 26) {
600 libs += [ "android" ]
601 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400602 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500603 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400604 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700605 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500607 libs += [
608 "GL",
609 "GLU",
610 ]
mtklein06c35c02016-09-20 12:28:12 -0700611 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800613 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500614 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400615 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500616 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400617 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700618 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500619 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700620 }
mtkleine9fb3d52016-09-20 15:11:46 -0700621
622 if (skia_use_vulkan) {
623 public_defines += [ "SK_VULKAN" ]
624 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700625 if (skia_enable_vulkan_debug_layers) {
626 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
627 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500628 if (skia_vulkan_header != "") {
629 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
630 } else {
631 if (is_skia_dev_build) {
632 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
633 }
634 }
mtkleine9fb3d52016-09-20 15:11:46 -0700635 }
Brian Salomon5f33a8c2018-02-26 14:32:39 -0500636 if (skia_use_legacy_gpu_pixel_ops) {
637 public_defines += [ "SK_LEGACY_GPU_PIXEL_OPS" ]
638 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400639 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400640 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400641 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
642 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400643
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400644 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400645 if (skia_use_metal) {
646 public_defines += [ "SK_METAL" ]
647 sources += skia_metal_sources
648 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400649 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400650 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500651
652 if (skia_enable_atlas_text) {
653 sources += skia_atlas_text_sources
654 }
mtklein06c35c02016-09-20 12:28:12 -0700655}
656
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400657optional("heif") {
658 enabled = skia_use_libheif
659 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
660
661 deps = []
662
663 sources = [
664 "src/codec/SkHeifCodec.cpp",
665 ]
666}
667
mtklein63213812016-08-24 09:55:56 -0700668optional("jpeg") {
669 enabled = skia_use_libjpeg_turbo
670 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
671
mtklein63213812016-08-24 09:55:56 -0700672 deps = [
673 "//third_party/libjpeg-turbo:libjpeg",
674 ]
675 sources = [
676 "src/codec/SkJpegCodec.cpp",
677 "src/codec/SkJpegDecoderMgr.cpp",
678 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700679 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400680 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700681 ]
682}
683
684optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500685 enabled = skia_use_zlib && skia_enable_pdf
686 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700687
mtklein63213812016-08-24 09:55:56 -0700688 deps = [
689 "//third_party/zlib",
690 ]
brettwb9447282016-09-01 14:24:39 -0700691 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700692 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700693
694 if (skia_use_sfntly) {
695 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500696 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700697 }
698}
699
700optional("png") {
701 enabled = skia_use_libpng
702 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
703
mtklein63213812016-08-24 09:55:56 -0700704 deps = [
705 "//third_party/libpng",
706 ]
707 sources = [
708 "src/codec/SkIcoCodec.cpp",
709 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400710 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700711 ]
712}
713
scroggof84ad642016-10-31 09:02:57 -0700714optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400715 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700716 public_defines = [ "SK_CODEC_DECODES_RAW" ]
717
718 deps = [
719 "//third_party/dng_sdk",
720 "//third_party/libjpeg-turbo:libjpeg",
721 "//third_party/piex",
722 ]
723
724 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
725 # Skia.
726 configs_to_remove = [ "//gn:no_exceptions" ]
727
728 sources = [
729 "src/codec/SkRawAdapterCodec.cpp",
730 "src/codec/SkRawCodec.cpp",
731 ]
732}
733
Mike Kleinfb333552018-01-25 12:49:37 -0500734optional("skcms") {
735 enabled = skia_use_skcms
736
Brian Osman094fba92018-03-26 17:05:48 -0400737 public_defines = [ "SK_USE_SKCMS" ]
Mike Kleinfb333552018-01-25 12:49:37 -0500738 deps = [
739 "//third_party/skcms",
740 ]
741 sources = [
Brian Osman094fba92018-03-26 17:05:48 -0400742 "src/core/SkColorSpaceXform_skcms.cpp",
Mike Kleinfb333552018-01-25 12:49:37 -0500743 ]
744}
745
mtklein3cc22182016-08-29 13:26:14 -0700746optional("typeface_freetype") {
747 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700748
749 deps = [
750 "//third_party/freetype2",
751 ]
752 sources = [
753 "src/ports/SkFontHost_FreeType.cpp",
754 "src/ports/SkFontHost_FreeType_common.cpp",
755 ]
756}
757
mtklein457b42a2016-08-23 13:56:37 -0700758optional("webp") {
759 enabled = skia_use_libwebp
760 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
761
mtklein457b42a2016-08-23 13:56:37 -0700762 deps = [
763 "//third_party/libwebp",
764 ]
765 sources = [
766 "src/codec/SkWebpAdapterCodec.cpp",
767 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400768 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700769 ]
mtkleineb3c4252016-08-23 07:38:09 -0700770}
771
mtklein63213812016-08-24 09:55:56 -0700772optional("xml") {
773 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000774 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700775
mtklein63213812016-08-24 09:55:56 -0700776 deps = [
777 "//third_party/expat",
778 ]
779 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500780 "src/svg/SkSVGCanvas.cpp",
781 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700782 "src/xml/SkDOM.cpp",
783 "src/xml/SkXMLParser.cpp",
784 "src/xml/SkXMLWriter.cpp",
785 ]
786}
787
mtkleinc04ff472016-06-23 10:29:30 -0700788component("skia") {
789 public_configs = [ ":skia_public" ]
790 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700791
792 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700793 ":arm64",
794 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700795 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700796 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500797 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700798 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700799 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500800 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700801 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700802 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700803 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400804 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500805 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700806 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700807 ":none",
mtklein63213812016-08-24 09:55:56 -0700808 ":pdf",
809 ":png",
scroggof84ad642016-10-31 09:02:57 -0700810 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500811 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700812 ":sse2",
813 ":sse41",
814 ":sse42",
815 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700816 ":webp",
mtklein63213812016-08-24 09:55:56 -0700817 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700818 ]
819
Chinmay Garde43f115c2016-11-16 15:04:12 -0800820 # This file (and all GN files in Skia) are designed to work with an
821 # empty sources assignment filter; we handle all that explicitly.
822 # We clear the filter here for clients who may have set up a global filter.
823 set_sources_assignment_filter([])
824
mtkleinc04ff472016-06-23 10:29:30 -0700825 sources = []
brettwb9447282016-09-01 14:24:39 -0700826 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700827 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500828 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700829 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400830 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500831 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700832 "src/android/SkBitmapRegionCodec.cpp",
833 "src/android/SkBitmapRegionDecoder.cpp",
834 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400835 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700836 "src/codec/SkBmpCodec.cpp",
837 "src/codec/SkBmpMaskCodec.cpp",
838 "src/codec/SkBmpRLECodec.cpp",
839 "src/codec/SkBmpStandardCodec.cpp",
840 "src/codec/SkCodec.cpp",
841 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700842 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700843 "src/codec/SkMaskSwizzler.cpp",
844 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700845 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700846 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700847 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700848 "src/codec/SkSwizzler.cpp",
849 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700850 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700851 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700852 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700853 "src/ports/SkMemory_malloc.cpp",
854 "src/ports/SkOSFile_stdio.cpp",
855 "src/sfnt/SkOTTable_name.cpp",
856 "src/sfnt/SkOTUtils.cpp",
857 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700858 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700859 ]
brettwb9447282016-09-01 14:24:39 -0700860
mtklein7d6fb2c2016-08-25 14:50:44 -0700861 libs = []
862
mtkleinc04ff472016-06-23 10:29:30 -0700863 if (is_win) {
864 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400865 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700866 "src/ports/SkDebug_win.cpp",
867 "src/ports/SkFontHost_win.cpp",
868 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500869 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700870 "src/ports/SkImageEncoder_WIC.cpp",
871 "src/ports/SkImageGeneratorWIC.cpp",
872 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700873 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700874 "src/ports/SkScalerContext_win_dw.cpp",
875 "src/ports/SkTLS_win.cpp",
876 "src/ports/SkTypeface_win_dw.cpp",
877 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400878 libs += [
879 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500880 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400881 "Ole32.lib",
882 "OleAut32.lib",
883 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500884 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400885 ]
mtkleinc04ff472016-06-23 10:29:30 -0700886 } else {
887 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700888 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700889 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700890 "src/ports/SkTLS_pthread.cpp",
891 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400892 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700893 }
894
mtklein7d6fb2c2016-08-25 14:50:44 -0700895 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500896 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500897 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500898 deps += [ "//third_party/cpu-features" ]
899 }
mtklein06c35c02016-09-20 12:28:12 -0700900 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700901 libs += [
902 "EGL",
903 "GLESv2",
904 "log",
905 ]
906 }
907
mtkleinc04ff472016-06-23 10:29:30 -0700908 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700909 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400910 if (skia_use_egl) {
911 libs += [ "GLESv2" ]
912 }
mtkleinc04ff472016-06-23 10:29:30 -0700913 }
914
915 if (is_mac) {
916 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700917 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700918 "src/ports/SkFontHost_mac.cpp",
919 "src/ports/SkImageEncoder_CG.cpp",
920 "src/ports/SkImageGeneratorCG.cpp",
921 ]
mtklein09e61f72016-08-23 13:35:28 -0700922 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400923 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
924 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700925 "ApplicationServices.framework",
926 "OpenGL.framework",
927 ]
mtkleinc04ff472016-06-23 10:29:30 -0700928 }
abarth6fc8ff02016-07-15 15:15:15 -0700929
Mike Klein7d302882016-11-03 14:06:31 -0400930 if (is_ios) {
931 sources += [
932 "src/ports/SkDebug_stdio.cpp",
933 "src/ports/SkFontHost_mac.cpp",
934 "src/ports/SkImageEncoder_CG.cpp",
935 "src/ports/SkImageGeneratorCG.cpp",
936 ]
937 libs += [
938 "CoreFoundation.framework",
939 "CoreGraphics.framework",
940 "CoreText.framework",
941 "ImageIO.framework",
942 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400943
944 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
945 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400946 ]
947 }
948
abarth6fc8ff02016-07-15 15:15:15 -0700949 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700950 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700951 }
mtkleinc04ff472016-06-23 10:29:30 -0700952}
953
mtkleinc095df52016-08-24 12:23:52 -0700954# Targets guarded by skia_enable_tools may use //third_party freely.
955if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500956 # Used by gn_to_bp.py to list our public include dirs.
957 source_set("public") {
958 configs += [ ":skia_public" ]
959 }
960
Mike Kleinc36dedf2016-11-18 09:35:28 -0500961 config("skia.h_config") {
962 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500963 if (skia_use_vulkan) {
964 # So we can get the header which includes vulkan
965 include_dirs += [ "tools/gpu/vk" ]
966 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500967 }
968 action("skia.h") {
969 public_configs = [ ":skia.h_config" ]
970 skia_h = "$target_gen_dir/skia.h"
971 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400972 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000973 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500974 depfile = "$skia_h.deps"
975 outputs = [
976 skia_h,
977 ]
978 }
979
980 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500981 executable("fiddle") {
982 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500983 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500984 "tools/fiddle/draw.cpp",
985 "tools/fiddle/fiddle_main.cpp",
986 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400987
988 if (skia_use_egl) {
989 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400990 } else {
991 sources += [ "tools/fiddle/null_context.cpp" ]
992 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400993 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500994 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400995 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500996 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500997 ":skia",
998 ":skia.h",
999 ]
1000 }
1001 }
1002
1003 if (skia_enable_gpu) {
1004 source_set("public_headers_warnings_check") {
1005 sources = [
1006 "tools/public_headers_warnings_check.cpp",
1007 ]
1008 configs -= [ "//gn:warnings_except_public_headers" ]
1009 deps = [
1010 ":skia",
1011 ":skia.h",
1012 ]
1013 }
1014 }
1015
mtkleinc095df52016-08-24 12:23:52 -07001016 template("test_lib") {
1017 config(target_name + "_config") {
1018 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001019 if (defined(invoker.public_defines)) {
1020 defines = invoker.public_defines
1021 }
mtklein25c81d42016-07-27 13:55:26 -07001022 }
mtkleinc095df52016-08-24 12:23:52 -07001023 source_set(target_name) {
1024 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1025 public_configs = [
1026 ":" + target_name + "_config",
1027 ":skia_private",
1028 ]
1029
1030 if (!defined(deps)) {
1031 deps = []
1032 }
1033 deps += [ ":skia" ]
1034 testonly = true
1035 }
mtklein25c81d42016-07-27 13:55:26 -07001036 }
mtklein25c81d42016-07-27 13:55:26 -07001037
Mike Kleine6682eb2017-01-05 10:54:57 -05001038 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001039 if (is_ios) {
1040 app_name = target_name
1041 gen_path = target_gen_dir
1042
1043 action("${app_name}_generate_info_plist") {
1044 script = "//gn/gen_plist_ios.py"
1045 outputs = [
1046 "$gen_path/${app_name}_Info.plist",
1047 ]
1048 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1049 }
1050
1051 bundle_data("${app_name}_bundle_info_plist") {
1052 public_deps = [
1053 ":${app_name}_generate_info_plist",
1054 ]
1055 sources = [
1056 "$gen_path/${app_name}_Info.plist",
1057 ]
1058 outputs = [
1059 "{{bundle_root_dir}}/Info.plist",
1060 ]
1061 }
1062
Jim Van Verth329c5a62017-11-29 11:42:33 -05001063 bundle_ios_data =
1064 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1065
1066 if (bundle_ios_data) {
1067 has_skps =
1068 "True" == exec_script("//gn/checkdir.py",
1069 [ rebase_path("skps", root_build_dir) ],
1070 "trim string")
1071 bundle_data("${app_name}_bundle_resources") {
1072 sources = [
1073 "resources",
1074 ]
1075 outputs = [
1076 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1077 "{{bundle_resources_dir}}/data/resources",
1078 ]
1079 }
1080
1081 if (has_skps) {
1082 bundle_data("${app_name}_bundle_skps") {
1083 sources = [
1084 "skps",
1085 ]
1086 outputs = [
1087 # Store in same folder as resources
1088 "{{bundle_resources_dir}}/data/skps",
1089 ]
1090 }
1091 }
1092 }
1093
Jim Van Verth443a9132017-11-28 09:45:26 -05001094 executable("${app_name}_generate_executable") {
1095 forward_variables_from(invoker,
1096 "*",
1097 [
1098 "output_name",
1099 "visibility",
1100 "is_shared_library",
1101 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001102 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001103 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001104 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1105 }
1106
1107 bundle_data("${app_name}_bundle_executable") {
1108 public_deps = [
1109 ":${app_name}_generate_executable",
1110 ]
1111 sources = [
1112 "$gen_path/$app_name",
1113 ]
1114 outputs = [
1115 "{{bundle_executable_dir}}/$app_name",
1116 ]
1117 testonly = true
1118 }
1119
1120 create_bundle("$app_name") {
1121 product_type = "com.apple.product-type.application"
1122 testonly = true
1123
1124 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1125 bundle_resources_dir = bundle_root_dir
1126 bundle_executable_dir = bundle_root_dir
1127 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1128
1129 deps = [
1130 ":${app_name}_bundle_executable",
1131 ":${app_name}_bundle_info_plist",
1132 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001133 if (bundle_ios_data) {
1134 deps += [ ":${app_name}_bundle_resources" ]
1135 if (has_skps) {
1136 deps += [ ":${app_name}_bundle_skps" ]
1137 }
1138 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001139
1140 # should only code sign when running on a device, not the simulator
1141 if (target_cpu != "x64") {
1142 code_signing_script = "//gn/codesign_ios.py"
1143 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1144 code_signing_outputs = [
1145 "$bundle_root_dir/_CodeSignature/CodeResources",
1146 "$bundle_root_dir/embedded.mobileprovision",
1147 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001148 code_signing_args = [
1149 rebase_path("$bundle_root_dir", root_build_dir),
1150 skia_ios_identity,
1151 skia_ios_profile,
1152 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001153 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001154 }
1155 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001156 # !is_ios
1157
1158 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1159 shared_library("lib" + target_name) {
1160 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1161 configs += [ ":skia_private" ]
1162 testonly = true
1163 }
1164 } else {
1165 _executable = target_name
1166 executable(_executable) {
1167 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1168 configs += [ ":skia_private" ]
1169 testonly = true
1170 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001171 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001172 if (is_android && skia_android_serial != "" && defined(_executable)) {
1173 action("push_" + target_name) {
1174 script = "gn/push_to_android.py"
1175 deps = [
1176 ":" + _executable,
1177 ]
1178 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1179 outputs = [
1180 _stamp,
1181 ]
1182 args = [
1183 rebase_path("$root_build_dir/$_executable"),
1184 skia_android_serial,
1185 rebase_path(_stamp),
1186 ]
1187 testonly = true
1188 }
Mike Klein7d921032017-01-05 12:20:41 -05001189 }
1190 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001191 }
1192
mtkleinc095df52016-08-24 12:23:52 -07001193 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001194 public_include_dirs = []
1195 if (skia_enable_gpu) {
1196 public_defines = []
1197 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001198
1199 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001200 sources = [
1201 "tools/gpu/GrContextFactory.cpp",
1202 "tools/gpu/GrTest.cpp",
Brian Salomon58389b92018-03-07 13:01:25 -05001203 "tools/gpu/ProxyUtils.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001204 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001205 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001206 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001207 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001208 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1209 "tools/gpu/gl/debug/GrBufferObj.cpp",
1210 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1211 "tools/gpu/gl/debug/GrProgramObj.cpp",
1212 "tools/gpu/gl/debug/GrShaderObj.cpp",
1213 "tools/gpu/gl/debug/GrTextureObj.cpp",
1214 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1215 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001216 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001217 ]
1218 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001219
Kevin Lubick4a24e102017-03-29 11:19:01 -04001220 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001221 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001222 } else if (is_ios) {
1223 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1224 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001225 } else if (is_linux) {
1226 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001227 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001228 } else if (is_mac) {
1229 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001230 } else if (is_win) {
1231 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1232 libs += [
1233 "Gdi32.lib",
1234 "OpenGL32.lib",
1235 ]
mtklein38925aa2016-09-21 10:11:25 -07001236 }
mtklein6ef69992016-09-14 06:12:09 -07001237
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001238 cflags_objcc = [ "-fobjc-arc" ]
1239
Mike Kleinc168a3a2016-11-14 14:53:13 +00001240 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001241 deps += [ "//third_party/angle2" ]
1242 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1243 }
mtkleind68f9b02016-09-23 13:18:41 -07001244 if (skia_use_vulkan) {
1245 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001246 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001247 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001248 if (skia_use_metal) {
1249 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1250 }
mtkleina627b5c2016-09-20 13:36:47 -07001251 }
mtklein25c81d42016-07-27 13:55:26 -07001252 }
mtklein25c81d42016-07-27 13:55:26 -07001253
mtkleinc095df52016-08-24 12:23:52 -07001254 test_lib("flags") {
1255 public_include_dirs = [ "tools/flags" ]
1256 sources = [
1257 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001258 ]
1259 }
1260 test_lib("common_flags") {
1261 public_include_dirs = [ "tools/flags" ]
1262 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001263 "tools/flags/SkCommonFlags.cpp",
1264 "tools/flags/SkCommonFlagsConfig.cpp",
1265 ]
1266 deps = [
mtklein046cb562016-09-16 10:23:12 -07001267 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001268 ":gpu_tool_utils",
1269 ]
1270 }
mtklein25c81d42016-07-27 13:55:26 -07001271
mtkleinc095df52016-08-24 12:23:52 -07001272 test_lib("tool_utils") {
1273 public_include_dirs = [
1274 "tools",
1275 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001276 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001277 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001278 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001279 ]
1280 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001281 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001282 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001283 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001284 "tools/ProcStats.cpp",
1285 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001286 "tools/UrlDataManager.cpp",
1287 "tools/debugger/SkDebugCanvas.cpp",
1288 "tools/debugger/SkDrawCommand.cpp",
1289 "tools/debugger/SkJsonWriteBuffer.cpp",
1290 "tools/debugger/SkObjectParser.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001291 "tools/fonts/SkRandomScalerContext.cpp",
1292 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001293 "tools/fonts/SkTestFontMgr.h",
1294 "tools/fonts/SkTestSVGTypeface.cpp",
1295 "tools/fonts/SkTestSVGTypeface.h",
1296 "tools/fonts/SkTestTypeface.cpp",
1297 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001298 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001299 "tools/picture_utils.cpp",
1300 "tools/random_parse_path.cpp",
1301 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001302 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001303 "tools/trace/SkChromeTracingTracer.cpp",
1304 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001305 "tools/trace/SkDebugfTracer.cpp",
1306 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001307 "tools/trace/SkEventTracingPriv.cpp",
1308 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001309 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001310 libs = []
1311 if (is_ios) {
1312 sources += [ "tools/ios_utils.m" ]
1313 libs += [ "Foundation.framework" ]
1314 }
mtkleinc095df52016-08-24 12:23:52 -07001315 deps = [
mtklein046cb562016-09-16 10:23:12 -07001316 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001317 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001318 ":flags",
1319 "//third_party/libpng",
1320 ]
1321 public_deps = [
1322 "//third_party/jsoncpp",
1323 ]
1324 }
mtklein25c81d42016-07-27 13:55:26 -07001325
Mike Klein6e744122016-10-27 12:21:40 -04001326 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001327 test_lib("gm") {
1328 public_include_dirs = [ "gm" ]
1329 sources = gm_sources
1330 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001331 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001332 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001333 ":gpu_tool_utils",
1334 ":skia",
1335 ":tool_utils",
1336 ]
1337 }
mtklein25c81d42016-07-27 13:55:26 -07001338
Mike Klein6e744122016-10-27 12:21:40 -04001339 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001340 test_lib("tests") {
1341 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001342 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001343 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001344 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001345 }
mtkleinc095df52016-08-24 12:23:52 -07001346 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001347 ":experimental_sksg",
Hal Canary0f666812018-03-22 15:21:12 -04001348 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001349 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001350 ":skia",
1351 ":tool_utils",
1352 "//third_party/libpng",
1353 "//third_party/zlib",
1354 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001355 public_deps = [
1356 ":gpu_tool_utils", # Test.h #includes headers from this target.
1357 ]
mtkleinc095df52016-08-24 12:23:52 -07001358 }
mtklein2f3416d2016-08-02 16:02:05 -07001359
Mike Klein6e744122016-10-27 12:21:40 -04001360 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001361 test_lib("bench") {
1362 public_include_dirs = [ "bench" ]
1363 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001364 deps = [
1365 ":flags",
1366 ":gm",
1367 ":gpu_tool_utils",
1368 ":skia",
1369 ":tool_utils",
1370 ]
1371 }
mtklein2b6870c2016-07-28 14:17:33 -07001372
Florin Malita54f65c42018-01-16 17:04:30 -05001373 test_lib("experimental_skottie") {
1374 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001375 include_dirs = [ "tools" ]
1376 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001377 "experimental/skottie/Skottie.cpp",
Florin Malitaa6e30f72018-03-23 13:41:58 -04001378 "experimental/skottie/SkottieAdapter.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001379 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001380 "experimental/skottie/SkottieParser.cpp",
Florin Malitaa6e30f72018-03-23 13:41:58 -04001381 "experimental/skottie/SkottieValue.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001382 ]
1383 deps = [
1384 ":experimental_sksg",
1385 ":skia",
1386 "//third_party/jsoncpp",
1387 ]
1388 }
1389
mtkleinc095df52016-08-24 12:23:52 -07001390 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001391 public_include_dirs = []
1392 if (skia_use_expat) {
1393 public_include_dirs += [ "experimental/svg/model" ]
1394 sources = [
1395 "experimental/svg/model/SkSVGAttribute.cpp",
1396 "experimental/svg/model/SkSVGAttributeParser.cpp",
1397 "experimental/svg/model/SkSVGCircle.cpp",
1398 "experimental/svg/model/SkSVGClipPath.cpp",
1399 "experimental/svg/model/SkSVGContainer.cpp",
1400 "experimental/svg/model/SkSVGDOM.cpp",
1401 "experimental/svg/model/SkSVGEllipse.cpp",
1402 "experimental/svg/model/SkSVGGradient.cpp",
1403 "experimental/svg/model/SkSVGLine.cpp",
1404 "experimental/svg/model/SkSVGLinearGradient.cpp",
1405 "experimental/svg/model/SkSVGNode.cpp",
1406 "experimental/svg/model/SkSVGPath.cpp",
1407 "experimental/svg/model/SkSVGPattern.cpp",
1408 "experimental/svg/model/SkSVGPoly.cpp",
1409 "experimental/svg/model/SkSVGRadialGradient.cpp",
1410 "experimental/svg/model/SkSVGRect.cpp",
1411 "experimental/svg/model/SkSVGRenderContext.cpp",
1412 "experimental/svg/model/SkSVGSVG.cpp",
1413 "experimental/svg/model/SkSVGShape.cpp",
1414 "experimental/svg/model/SkSVGStop.cpp",
1415 "experimental/svg/model/SkSVGTransformableNode.cpp",
1416 "experimental/svg/model/SkSVGUse.cpp",
1417 "experimental/svg/model/SkSVGValue.cpp",
1418 ]
1419 deps = [
1420 ":skia",
1421 ":xml",
1422 ]
1423 }
mtkleinc095df52016-08-24 12:23:52 -07001424 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001425
Florin Malita4aa44412017-12-19 12:21:02 -05001426 test_lib("experimental_sksg") {
1427 public_include_dirs = [
1428 "experimental/sksg",
1429 "experimental/sksg/effects",
1430 "experimental/sksg/geometry",
1431 "experimental/sksg/paint",
1432 ]
1433 sources = [
1434 "experimental/sksg/SkSGDraw.cpp",
1435 "experimental/sksg/SkSGEffectNode.cpp",
1436 "experimental/sksg/SkSGGeometryNode.cpp",
1437 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001438 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001439 "experimental/sksg/SkSGInvalidationController.cpp",
1440 "experimental/sksg/SkSGNode.cpp",
1441 "experimental/sksg/SkSGPaintNode.cpp",
1442 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001443 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001444 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001445 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001446 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001447 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001448 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001449 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001450 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001451 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001452 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001453 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001454 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001455 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001456 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001457 ]
1458 deps = [
1459 ":skia",
1460 ]
1461 }
1462
Kevin Lubickebf648e2017-09-21 13:45:16 -04001463 if (target_cpu != "wasm") {
1464 test_lib("views") {
1465 public_include_dirs = [ "include/views" ]
1466 sources = [
1467 "src/views/SkEvent.cpp",
1468 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001469 "src/views/SkTouchGesture.cpp",
1470 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001471 ]
Brian Osman34755e22016-12-05 09:46:02 -05001472 }
Brian Osman16adfa32016-10-18 14:42:44 -04001473 }
1474
Mike Klein38af9432016-11-11 11:39:44 -05001475 if (skia_use_lua) {
1476 test_lib("lua") {
1477 public_include_dirs = []
1478 sources = [
1479 "src/utils/SkLua.cpp",
1480 "src/utils/SkLuaCanvas.cpp",
1481 ]
1482 deps = [
1483 "//third_party/lua",
1484 ]
1485 }
1486
Mike Kleine6682eb2017-01-05 10:54:57 -05001487 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001488 sources = [
1489 "tools/lua/lua_app.cpp",
1490 ]
1491 deps = [
1492 ":lua",
1493 ":skia",
1494 "//third_party/lua",
1495 ]
Mike Klein38af9432016-11-11 11:39:44 -05001496 }
1497
Mike Kleine6682eb2017-01-05 10:54:57 -05001498 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001499 sources = [
1500 "tools/lua/lua_pictures.cpp",
1501 ]
1502 deps = [
1503 ":flags",
1504 ":lua",
1505 ":skia",
1506 ":tool_utils",
1507 "//third_party/lua",
1508 ]
Mike Klein38af9432016-11-11 11:39:44 -05001509 }
1510 }
1511
Cary Clark8032b982017-07-28 11:04:54 -04001512 test_app("bookmaker") {
1513 sources = [
1514 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001515 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001516 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001517 "tools/bookmaker/fiddleParser.cpp",
1518 "tools/bookmaker/includeParser.cpp",
1519 "tools/bookmaker/includeWriter.cpp",
1520 "tools/bookmaker/mdOut.cpp",
1521 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001522 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001523 "tools/bookmaker/spellCheck.cpp",
1524 ]
1525 deps = [
1526 ":flags",
1527 ":skia",
1528 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001529 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001530 ]
1531 }
1532
Kevin Lubickebf648e2017-09-21 13:45:16 -04001533 if (target_cpu != "wasm") {
1534 import("gn/samples.gni")
1535 test_lib("samples") {
1536 public_include_dirs = [ "samplecode" ]
1537 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001538 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001539 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001540 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001541 ":experimental_svg_model",
1542 ":flags",
1543 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001544 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001545 ":tool_utils",
1546 ":views",
1547 ":xml",
1548 ]
Mike Klein38af9432016-11-11 11:39:44 -05001549
Kevin Lubickebf648e2017-09-21 13:45:16 -04001550 if (skia_use_lua) {
1551 sources += [ "samplecode/SampleLua.cpp" ]
1552 deps += [
1553 ":lua",
1554 "//third_party/lua",
1555 ]
1556 }
1557 }
1558 test_app("dm") {
1559 sources = [
1560 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001561 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001562 "dm/DMJsonWriter.cpp",
1563 "dm/DMSrcSink.cpp",
1564 ]
1565 include_dirs = [ "tests" ]
1566 deps = [
1567 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001568 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001569 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001570 ":experimental_svg_model",
1571 ":flags",
1572 ":gm",
1573 ":gpu_tool_utils",
1574 ":skia",
1575 ":tests",
1576 ":tool_utils",
1577 "//third_party/jsoncpp",
1578 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001579 ]
1580 }
Brian Osman16adfa32016-10-18 14:42:44 -04001581 }
1582
Mike Kleina8a51ce2018-01-09 12:34:11 -05001583 if (!is_win) {
1584 test_app("remote_demo") {
1585 sources = [
1586 "tools/remote_demo.cpp",
1587 ]
1588 deps = [
1589 ":skia",
1590 ]
1591 }
1592 }
1593
Mike Kleine6682eb2017-01-05 10:54:57 -05001594 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001595 sources = [
1596 "bench/nanobench.cpp",
1597 ]
1598 deps = [
1599 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001600 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001601 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001602 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001603 ":flags",
1604 ":gm",
1605 ":gpu_tool_utils",
1606 ":skia",
1607 ":tool_utils",
1608 "//third_party/jsoncpp",
1609 ]
mtklein2b6870c2016-07-28 14:17:33 -07001610 }
halcanary19a97202016-08-03 15:08:04 -07001611
Ravi Mistry10d36c52017-01-31 09:49:18 -05001612 test_app("skpinfo") {
1613 sources = [
1614 "tools/skpinfo.cpp",
1615 ]
1616 deps = [
1617 ":flags",
1618 ":skia",
1619 ]
1620 }
1621
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001622 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001623 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001624 sources = [
1625 "tools/skpbench/skpbench.cpp",
1626 ]
1627 deps = [
1628 ":flags",
1629 ":gpu_tool_utils",
1630 ":skia",
1631 ":tool_utils",
1632 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001633 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001634 }
1635
Hal Canary96c57252018-02-09 11:43:05 -05001636 test_lib("skshaper") {
1637 public_include_dirs = [ "tools/shape" ]
1638 deps = [
1639 ":skia",
1640 ]
1641
Hal Canary8bb40832018-02-08 15:16:28 -05001642 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001643 sources = [
1644 "tools/shape/SkShaper_primitive.cpp",
1645 ]
1646 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001647 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001648 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001649 ]
Hal Canary96c57252018-02-09 11:43:05 -05001650 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001651 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001652 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001653 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001654 }
halcanary19a97202016-08-03 15:08:04 -07001655 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001656 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001657 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001658 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001659 ]
1660 deps = [
1661 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001662 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001663 ]
halcanary3eee9d92016-09-10 07:01:53 -07001664 }
mtklein046cb562016-09-16 10:23:12 -07001665
Matt Sarett9f1c4032017-05-17 10:06:32 -04001666 test_app("create_flutter_test_images") {
1667 sources = [
1668 "tools/create_flutter_test_images.cpp",
1669 ]
1670 deps = [
1671 ":skia",
1672 ":tool_utils",
1673 ]
1674 }
1675
Ben Wagner219f3622017-07-17 15:32:25 -04001676 test_app("create_test_font") {
1677 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001678 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001679 ]
1680 deps = [
1681 ":skia",
1682 ]
1683 assert_no_deps = [
1684 # tool_utils requires the output of this app.
1685 ":tool_utils",
1686 ]
1687 }
1688
Ben Wagner97182cc2018-02-15 10:20:04 -05001689 test_app("create_test_font_color") {
1690 sources = [
1691 "tools/fonts/create_test_font_color.cpp",
1692 ]
1693 deps = [
1694 ":flags",
1695 ":skia",
Brian Osman74511012018-04-02 20:13:46 +00001696 ":tool_utils"
Ben Wagner97182cc2018-02-15 10:20:04 -05001697 ]
1698 }
1699
Mike Kleine6682eb2017-01-05 10:54:57 -05001700 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001701 sources = [
1702 "tools/get_images_from_skps.cpp",
1703 ]
1704 deps = [
1705 ":flags",
1706 ":skia",
1707 "//third_party/jsoncpp",
1708 ]
mtklein046cb562016-09-16 10:23:12 -07001709 }
mtkleinecbc5262016-09-22 11:51:24 -07001710
Mike Kleine6682eb2017-01-05 10:54:57 -05001711 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001712 sources = [
1713 "tools/colorspaceinfo.cpp",
1714 ]
1715 deps = [
1716 ":flags",
1717 ":skia",
1718 ":tool_utils",
1719 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001720 }
1721
Kevin Lubickebf648e2017-09-21 13:45:16 -04001722 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001723 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001724 sources = [
1725 "tools/skiaserve/Request.cpp",
1726 "tools/skiaserve/Response.cpp",
1727 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001728 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1729 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1730 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1731 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1732 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1733 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1734 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1735 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1736 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001737 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1738 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001739 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1740 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1741 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1742 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1743 ]
1744 deps = [
1745 ":flags",
1746 ":gpu_tool_utils",
1747 ":skia",
1748 ":tool_utils",
1749 "//third_party/jsoncpp",
1750 "//third_party/libmicrohttpd",
1751 "//third_party/libpng",
1752 ]
Mike Klein7d302882016-11-03 14:06:31 -04001753 }
mtkleinecbc5262016-09-22 11:51:24 -07001754 }
kjlubick14f984b2016-10-03 11:49:45 -07001755
Mike Kleine6682eb2017-01-05 10:54:57 -05001756 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001757 include_dirs = [
1758 "tools",
1759 "tools/debugger",
1760 ]
kjlubick14f984b2016-10-03 11:49:45 -07001761 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001762 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001763 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001764 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001765 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001766 "fuzz/FuzzGradients.cpp",
1767 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001768 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001769 "fuzz/FuzzPathop.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001770 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001771 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1772 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001773 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1774 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001775 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1776 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001777 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001778 "tools/UrlDataManager.cpp",
1779 "tools/debugger/SkDebugCanvas.cpp",
1780 "tools/debugger/SkDrawCommand.cpp",
1781 "tools/debugger/SkJsonWriteBuffer.cpp",
1782 "tools/debugger/SkObjectParser.cpp",
1783 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001784 ]
1785 deps = [
1786 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001787 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001788 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001789 "//third_party/jsoncpp",
1790 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001791 ]
kjlubick14f984b2016-10-03 11:49:45 -07001792 }
Mike Klein38312422016-10-05 15:41:01 -04001793
Mike Kleine6682eb2017-01-05 10:54:57 -05001794 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001795 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001796 rebase_path("tests/skia_test.cpp"),
1797 rebase_path("tests/Test.cpp"),
1798 ]
caryclark9feb6322016-10-25 08:58:26 -07001799 deps = [
1800 ":flags",
1801 ":gpu_tool_utils",
1802 ":skia",
1803 ":tool_utils",
1804 ]
caryclark9feb6322016-10-25 08:58:26 -07001805 }
1806
Mike Kleine6682eb2017-01-05 10:54:57 -05001807 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001808 sources = [
1809 "tools/DumpRecord.cpp",
1810 "tools/dump_record.cpp",
1811 ]
1812 deps = [
1813 ":flags",
1814 ":skia",
1815 ]
Mike Klein38312422016-10-05 15:41:01 -04001816 }
bungemanfe917272016-10-13 17:36:40 -04001817
Mike Kleine6682eb2017-01-05 10:54:57 -05001818 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001819 sources = [
1820 "tools/skdiff/skdiff.cpp",
1821 "tools/skdiff/skdiff_html.cpp",
1822 "tools/skdiff/skdiff_main.cpp",
1823 "tools/skdiff/skdiff_utils.cpp",
1824 ]
1825 deps = [
1826 ":skia",
1827 ":tool_utils",
1828 ]
bungemanfe917272016-10-13 17:36:40 -04001829 }
halcanarya73d76a2016-10-17 13:19:02 -07001830
Mike Kleine6682eb2017-01-05 10:54:57 -05001831 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001832 sources = [
1833 "tools/skp_parser.cpp",
1834 ]
1835 deps = [
1836 ":skia",
1837 ":tool_utils",
1838 "//third_party/jsoncpp",
1839 ]
halcanarya73d76a2016-10-17 13:19:02 -07001840 }
Brian Osman16adfa32016-10-18 14:42:44 -04001841
Hal Canaryd7b38452017-12-11 17:46:26 -05001842 if (!is_win && skia_enable_gpu) {
1843 test_lib("skqp_lib") {
1844 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001845 defines =
1846 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001847 if (skia_skqp_enable_driver_correctness_workarounds) {
1848 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1849 }
Hal Canary75427132017-10-11 16:00:31 -04001850 sources = [
1851 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001852 "tools/skqp/gm_knowledge.cpp",
1853 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001854 ]
1855 deps = [
1856 ":gm",
1857 ":gpu_tool_utils",
1858 ":skia",
1859 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001860 ":tool_utils",
1861 ]
1862 }
1863 test_app("skqp") {
1864 sources = [
1865 "tools/skqp/skqp.cpp",
1866 ]
1867 deps = [
1868 ":skia",
1869 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001870 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001871 "//third_party/googletest",
1872 ]
1873 }
1874 }
Hal Canary28f89382017-12-12 09:42:14 -05001875 if (is_android && skia_enable_gpu) {
1876 test_app("skqp_app") {
1877 is_shared_library = true
1878 sources = [
1879 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1880 ]
1881 deps = [
1882 ":skia",
1883 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001884 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001885 ]
1886 libs = [ "android" ]
1887 }
1888 }
Hal Canary75427132017-10-11 16:00:31 -04001889
Hal Canarya9de7602018-01-19 13:08:23 -05001890 test_app("list_gms") {
1891 sources = [
1892 "tools/list_gms.cpp",
1893 ]
1894 deps = [
1895 ":gm",
1896 ":skia",
1897 ]
1898 }
1899 test_app("list_gpu_unit_tests") {
1900 sources = [
1901 "dm/DMGpuTestProcs.cpp",
1902 "tools/list_gpu_unit_tests.cpp",
1903 ]
1904 deps = [
1905 ":skia",
1906 ":tests",
1907 ]
1908 }
1909
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001910 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001911 test_lib("sk_app") {
1912 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001913 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001914 "tools/sk_app/CommandSet.cpp",
1915 "tools/sk_app/GLWindowContext.cpp",
1916 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001917 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001918 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001919
Jim Van Verth4e56a912016-10-21 10:58:52 -04001920 if (is_android) {
1921 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001922 "tools/sk_app/android/GLWindowContext_android.cpp",
1923 "tools/sk_app/android/RasterWindowContext_android.cpp",
1924 "tools/sk_app/android/Window_android.cpp",
1925 "tools/sk_app/android/main_android.cpp",
1926 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001927 ]
Brian Osman462334e2017-02-09 11:22:57 -05001928 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001929 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001930 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001931 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1932 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1933 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001934 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001935 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001936 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001937 libs += [
1938 "GL",
1939 "X11",
1940 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001941 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001942 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001943 "tools/sk_app/win/GLWindowContext_win.cpp",
1944 "tools/sk_app/win/RasterWindowContext_win.cpp",
1945 "tools/sk_app/win/Window_win.cpp",
1946 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001947 ]
Brian Salomon194db172017-08-17 14:37:06 -04001948 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001949 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001950 }
Mike Klein43c25262016-10-20 10:17:47 -04001951 } else if (is_mac) {
1952 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001953 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1954 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1955 "tools/sk_app/mac/Window_mac.cpp",
1956 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001957 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001958 libs += [
1959 "QuartzCore.framework",
1960 "Cocoa.framework",
1961 "Foundation.framework",
1962 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001963 } else if (is_ios) {
1964 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001965 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1966 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1967 "tools/sk_app/ios/Window_ios.cpp",
1968 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001969 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001970 }
1971
1972 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001973 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001974 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001975 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001976 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001977 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001978 libs += [ "X11-xcb" ]
1979 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001980 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001981 }
1982 }
1983
Brian Osman16adfa32016-10-18 14:42:44 -04001984 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001985 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001986 ":skia",
1987 ":tool_utils",
1988 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001989 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001990 if (is_android) {
1991 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001992 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001993 deps += [ "//third_party/libsdl" ]
1994 }
Brian Salomon194db172017-08-17 14:37:06 -04001995 if (skia_use_angle) {
1996 deps += [ "//third_party/angle2" ]
1997 }
Mike Kleina92c3832016-12-08 09:49:39 -05001998 }
Brian Osman16adfa32016-10-18 14:42:44 -04001999 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002000
Brian Osmaneff04b52017-11-21 13:18:02 -05002001 if (skia_enable_gpu) {
2002 test_app("viewer") {
2003 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05002004 if (is_ios) {
2005 bundle_ios_data = true
2006 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002007 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07002008 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002009 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05002010 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002011 "tools/viewer/ImageSlide.cpp",
2012 "tools/viewer/SKPSlide.cpp",
2013 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05002014 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05002015 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05002016 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002017 "tools/viewer/Viewer.cpp",
2018 ]
2019 libs = []
2020
2021 include_dirs = []
2022 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05002023 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05002024 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05002025 ":flags",
2026 ":gm",
2027 ":gpu_tool_utils",
2028 ":samples",
2029 ":sk_app",
2030 ":skia",
2031 ":tool_utils",
2032 ":views",
2033 "//third_party/imgui",
2034 "//third_party/jsoncpp",
2035 ]
2036 }
2037 }
2038
2039 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2040 test_app("HelloWorld") {
2041 sources = [
2042 "example/HelloWorld.cpp",
2043 ]
2044 libs = []
2045
2046 include_dirs = []
2047 deps = [
2048 ":flags",
2049 ":gpu_tool_utils",
2050 ":sk_app",
2051 ":skia",
2052 ":tool_utils",
2053 ":views",
2054 ]
2055 }
2056 }
2057
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002058 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002059 test_app("SkiaSDLExample") {
2060 sources = [
2061 "example/SkiaSDLExample.cpp",
2062 ]
2063 libs = []
2064 include_dirs = []
2065 deps = [
2066 ":gpu_tool_utils",
2067 ":skia",
2068 "//third_party/libsdl",
2069 ]
2070 }
2071 }
2072
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002073 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2074 action_foreach("generate_mocs") {
2075 script = "gn/call.py"
2076 sources = [
2077 "tools/mdbviz/MainWindow.h",
2078 ]
2079 outputs = [
2080 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2081 ]
2082 args = [
2083 "$skia_qt_path" + "/bin/moc",
2084 "{{source}}",
2085 "-o",
2086 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2087 ]
2088 }
2089 action_foreach("generate_resources") {
2090 script = "gn/call.py"
2091 sources = [
2092 "tools/mdbviz/resources.qrc",
2093 ]
2094 outputs = [
2095 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2096 ]
2097 args = [
2098 "$skia_qt_path" + "/bin/rcc",
2099 "{{source}}",
2100 "-o",
2101 "gen/mdbviz/{{source_name_part}}_res.cpp",
2102 ]
2103 }
2104 test_app("mdbviz") {
2105 if (is_win) {
2106 # on Windows we need to disable some exception handling warnings due to the Qt headers
2107 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2108 }
2109 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002110 "tools/UrlDataManager.cpp",
2111 "tools/debugger/SkDebugCanvas.cpp",
2112 "tools/debugger/SkDrawCommand.cpp",
2113 "tools/debugger/SkJsonWriteBuffer.cpp",
2114 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002115 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002116 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002117 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002118 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002119
2120 # generated files
2121 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2122 "$target_gen_dir/mdbviz/resources_res.cpp",
2123 ]
2124 lib_dirs = [ "$skia_qt_path/lib" ]
2125 libs = [
2126 "Qt5Core.lib",
2127 "Qt5Gui.lib",
2128 "Qt5Widgets.lib",
2129 ]
2130 include_dirs = [
2131 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002132 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002133 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002134 "tools",
2135 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002136 ]
2137 deps = [
2138 ":generate_mocs",
2139 ":generate_resources",
2140 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002141 "//third_party/jsoncpp",
2142 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002143 ]
2144 }
2145 }
2146
Mike Kleine459afd2017-03-03 09:21:30 -05002147 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002148 copy("gdbserver") {
2149 sources = [
2150 "$ndk/$ndk_gdbserver",
2151 ]
2152 outputs = [
2153 "$root_out_dir/gdbserver",
2154 ]
2155 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002156 }
mtklein25c81d42016-07-27 13:55:26 -07002157}