blob: c718dedb7023742a59c01aae56b35f035fbe9a8c [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 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400691 if (skia_use_libjpeg_turbo) {
692 deps += [ ":jpeg"]
693 }
brettwb9447282016-09-01 14:24:39 -0700694 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700695 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700696
697 if (skia_use_sfntly) {
698 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500699 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700700 }
701}
702
703optional("png") {
704 enabled = skia_use_libpng
705 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
706
mtklein63213812016-08-24 09:55:56 -0700707 deps = [
708 "//third_party/libpng",
709 ]
710 sources = [
711 "src/codec/SkIcoCodec.cpp",
712 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400713 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700714 ]
715}
716
scroggof84ad642016-10-31 09:02:57 -0700717optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400718 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700719 public_defines = [ "SK_CODEC_DECODES_RAW" ]
720
721 deps = [
722 "//third_party/dng_sdk",
723 "//third_party/libjpeg-turbo:libjpeg",
724 "//third_party/piex",
725 ]
726
727 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
728 # Skia.
729 configs_to_remove = [ "//gn:no_exceptions" ]
730
731 sources = [
732 "src/codec/SkRawAdapterCodec.cpp",
733 "src/codec/SkRawCodec.cpp",
734 ]
735}
736
Mike Kleinfb333552018-01-25 12:49:37 -0500737optional("skcms") {
738 enabled = skia_use_skcms
739
Brian Osman094fba92018-03-26 17:05:48 -0400740 public_defines = [ "SK_USE_SKCMS" ]
Mike Kleinfb333552018-01-25 12:49:37 -0500741 deps = [
742 "//third_party/skcms",
743 ]
744 sources = [
Brian Osman094fba92018-03-26 17:05:48 -0400745 "src/core/SkColorSpaceXform_skcms.cpp",
Mike Kleinfb333552018-01-25 12:49:37 -0500746 ]
747}
748
mtklein3cc22182016-08-29 13:26:14 -0700749optional("typeface_freetype") {
750 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700751
752 deps = [
753 "//third_party/freetype2",
754 ]
755 sources = [
756 "src/ports/SkFontHost_FreeType.cpp",
757 "src/ports/SkFontHost_FreeType_common.cpp",
758 ]
759}
760
mtklein457b42a2016-08-23 13:56:37 -0700761optional("webp") {
762 enabled = skia_use_libwebp
763 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
764
mtklein457b42a2016-08-23 13:56:37 -0700765 deps = [
766 "//third_party/libwebp",
767 ]
768 sources = [
769 "src/codec/SkWebpAdapterCodec.cpp",
770 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400771 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700772 ]
mtkleineb3c4252016-08-23 07:38:09 -0700773}
774
mtklein63213812016-08-24 09:55:56 -0700775optional("xml") {
776 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000777 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700778
mtklein63213812016-08-24 09:55:56 -0700779 deps = [
780 "//third_party/expat",
781 ]
782 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500783 "src/svg/SkSVGCanvas.cpp",
784 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700785 "src/xml/SkDOM.cpp",
786 "src/xml/SkXMLParser.cpp",
787 "src/xml/SkXMLWriter.cpp",
788 ]
789}
790
mtkleinc04ff472016-06-23 10:29:30 -0700791component("skia") {
792 public_configs = [ ":skia_public" ]
793 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700794
795 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700796 ":arm64",
797 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700798 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700799 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500800 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700801 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700802 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500803 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700804 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700805 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700806 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400807 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500808 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700809 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700810 ":none",
mtklein63213812016-08-24 09:55:56 -0700811 ":pdf",
812 ":png",
scroggof84ad642016-10-31 09:02:57 -0700813 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500814 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700815 ":sse2",
816 ":sse41",
817 ":sse42",
818 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700819 ":webp",
mtklein63213812016-08-24 09:55:56 -0700820 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700821 ]
822
Chinmay Garde43f115c2016-11-16 15:04:12 -0800823 # This file (and all GN files in Skia) are designed to work with an
824 # empty sources assignment filter; we handle all that explicitly.
825 # We clear the filter here for clients who may have set up a global filter.
826 set_sources_assignment_filter([])
827
mtkleinc04ff472016-06-23 10:29:30 -0700828 sources = []
brettwb9447282016-09-01 14:24:39 -0700829 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700830 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500831 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700832 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400833 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500834 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700835 "src/android/SkBitmapRegionCodec.cpp",
836 "src/android/SkBitmapRegionDecoder.cpp",
837 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400838 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700839 "src/codec/SkBmpCodec.cpp",
840 "src/codec/SkBmpMaskCodec.cpp",
841 "src/codec/SkBmpRLECodec.cpp",
842 "src/codec/SkBmpStandardCodec.cpp",
843 "src/codec/SkCodec.cpp",
844 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700845 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700846 "src/codec/SkMaskSwizzler.cpp",
847 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700848 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700849 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700850 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700851 "src/codec/SkSwizzler.cpp",
852 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700853 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700854 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700855 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700856 "src/ports/SkMemory_malloc.cpp",
857 "src/ports/SkOSFile_stdio.cpp",
858 "src/sfnt/SkOTTable_name.cpp",
859 "src/sfnt/SkOTUtils.cpp",
860 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700861 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700862 ]
brettwb9447282016-09-01 14:24:39 -0700863
mtklein7d6fb2c2016-08-25 14:50:44 -0700864 libs = []
865
mtkleinc04ff472016-06-23 10:29:30 -0700866 if (is_win) {
867 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400868 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700869 "src/ports/SkDebug_win.cpp",
870 "src/ports/SkFontHost_win.cpp",
871 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500872 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700873 "src/ports/SkImageEncoder_WIC.cpp",
874 "src/ports/SkImageGeneratorWIC.cpp",
875 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700876 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700877 "src/ports/SkScalerContext_win_dw.cpp",
878 "src/ports/SkTLS_win.cpp",
879 "src/ports/SkTypeface_win_dw.cpp",
880 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400881 libs += [
882 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500883 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400884 "Ole32.lib",
885 "OleAut32.lib",
886 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500887 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400888 ]
mtkleinc04ff472016-06-23 10:29:30 -0700889 } else {
890 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700891 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700892 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700893 "src/ports/SkTLS_pthread.cpp",
894 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400895 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700896 }
897
mtklein7d6fb2c2016-08-25 14:50:44 -0700898 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500899 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500900 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500901 deps += [ "//third_party/cpu-features" ]
902 }
mtklein06c35c02016-09-20 12:28:12 -0700903 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700904 libs += [
905 "EGL",
906 "GLESv2",
907 "log",
908 ]
909 }
910
mtkleinc04ff472016-06-23 10:29:30 -0700911 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700912 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400913 if (skia_use_egl) {
914 libs += [ "GLESv2" ]
915 }
mtkleinc04ff472016-06-23 10:29:30 -0700916 }
917
918 if (is_mac) {
919 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700920 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700921 "src/ports/SkFontHost_mac.cpp",
922 "src/ports/SkImageEncoder_CG.cpp",
923 "src/ports/SkImageGeneratorCG.cpp",
924 ]
mtklein09e61f72016-08-23 13:35:28 -0700925 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400926 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
927 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700928 "ApplicationServices.framework",
929 "OpenGL.framework",
930 ]
mtkleinc04ff472016-06-23 10:29:30 -0700931 }
abarth6fc8ff02016-07-15 15:15:15 -0700932
Mike Klein7d302882016-11-03 14:06:31 -0400933 if (is_ios) {
934 sources += [
935 "src/ports/SkDebug_stdio.cpp",
936 "src/ports/SkFontHost_mac.cpp",
937 "src/ports/SkImageEncoder_CG.cpp",
938 "src/ports/SkImageGeneratorCG.cpp",
939 ]
940 libs += [
941 "CoreFoundation.framework",
942 "CoreGraphics.framework",
943 "CoreText.framework",
944 "ImageIO.framework",
945 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400946
947 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
948 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400949 ]
950 }
951
abarth6fc8ff02016-07-15 15:15:15 -0700952 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700953 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700954 }
mtkleinc04ff472016-06-23 10:29:30 -0700955}
956
mtkleinc095df52016-08-24 12:23:52 -0700957# Targets guarded by skia_enable_tools may use //third_party freely.
958if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500959 # Used by gn_to_bp.py to list our public include dirs.
960 source_set("public") {
961 configs += [ ":skia_public" ]
962 }
963
Mike Kleinc36dedf2016-11-18 09:35:28 -0500964 config("skia.h_config") {
965 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500966 if (skia_use_vulkan) {
967 # So we can get the header which includes vulkan
968 include_dirs += [ "tools/gpu/vk" ]
969 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500970 }
971 action("skia.h") {
972 public_configs = [ ":skia.h_config" ]
973 skia_h = "$target_gen_dir/skia.h"
974 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400975 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000976 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500977 depfile = "$skia_h.deps"
978 outputs = [
979 skia_h,
980 ]
981 }
982
983 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500984 executable("fiddle") {
985 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500986 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500987 "tools/fiddle/draw.cpp",
988 "tools/fiddle/fiddle_main.cpp",
989 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400990
991 if (skia_use_egl) {
992 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400993 } else {
994 sources += [ "tools/fiddle/null_context.cpp" ]
995 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400996 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500997 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400998 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500999 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001000 ":skia",
1001 ":skia.h",
1002 ]
1003 }
1004 }
1005
1006 if (skia_enable_gpu) {
1007 source_set("public_headers_warnings_check") {
1008 sources = [
1009 "tools/public_headers_warnings_check.cpp",
1010 ]
1011 configs -= [ "//gn:warnings_except_public_headers" ]
1012 deps = [
1013 ":skia",
1014 ":skia.h",
1015 ]
1016 }
1017 }
1018
mtkleinc095df52016-08-24 12:23:52 -07001019 template("test_lib") {
1020 config(target_name + "_config") {
1021 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001022 if (defined(invoker.public_defines)) {
1023 defines = invoker.public_defines
1024 }
mtklein25c81d42016-07-27 13:55:26 -07001025 }
mtkleinc095df52016-08-24 12:23:52 -07001026 source_set(target_name) {
1027 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1028 public_configs = [
1029 ":" + target_name + "_config",
1030 ":skia_private",
1031 ]
1032
1033 if (!defined(deps)) {
1034 deps = []
1035 }
1036 deps += [ ":skia" ]
1037 testonly = true
1038 }
mtklein25c81d42016-07-27 13:55:26 -07001039 }
mtklein25c81d42016-07-27 13:55:26 -07001040
Mike Kleine6682eb2017-01-05 10:54:57 -05001041 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001042 if (is_ios) {
1043 app_name = target_name
1044 gen_path = target_gen_dir
1045
1046 action("${app_name}_generate_info_plist") {
1047 script = "//gn/gen_plist_ios.py"
1048 outputs = [
1049 "$gen_path/${app_name}_Info.plist",
1050 ]
1051 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1052 }
1053
1054 bundle_data("${app_name}_bundle_info_plist") {
1055 public_deps = [
1056 ":${app_name}_generate_info_plist",
1057 ]
1058 sources = [
1059 "$gen_path/${app_name}_Info.plist",
1060 ]
1061 outputs = [
1062 "{{bundle_root_dir}}/Info.plist",
1063 ]
1064 }
1065
Jim Van Verth329c5a62017-11-29 11:42:33 -05001066 bundle_ios_data =
1067 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1068
1069 if (bundle_ios_data) {
1070 has_skps =
1071 "True" == exec_script("//gn/checkdir.py",
1072 [ rebase_path("skps", root_build_dir) ],
1073 "trim string")
1074 bundle_data("${app_name}_bundle_resources") {
1075 sources = [
1076 "resources",
1077 ]
1078 outputs = [
1079 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1080 "{{bundle_resources_dir}}/data/resources",
1081 ]
1082 }
1083
1084 if (has_skps) {
1085 bundle_data("${app_name}_bundle_skps") {
1086 sources = [
1087 "skps",
1088 ]
1089 outputs = [
1090 # Store in same folder as resources
1091 "{{bundle_resources_dir}}/data/skps",
1092 ]
1093 }
1094 }
1095 }
1096
Jim Van Verth443a9132017-11-28 09:45:26 -05001097 executable("${app_name}_generate_executable") {
1098 forward_variables_from(invoker,
1099 "*",
1100 [
1101 "output_name",
1102 "visibility",
1103 "is_shared_library",
1104 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001105 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001106 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001107 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1108 }
1109
1110 bundle_data("${app_name}_bundle_executable") {
1111 public_deps = [
1112 ":${app_name}_generate_executable",
1113 ]
1114 sources = [
1115 "$gen_path/$app_name",
1116 ]
1117 outputs = [
1118 "{{bundle_executable_dir}}/$app_name",
1119 ]
1120 testonly = true
1121 }
1122
1123 create_bundle("$app_name") {
1124 product_type = "com.apple.product-type.application"
1125 testonly = true
1126
1127 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1128 bundle_resources_dir = bundle_root_dir
1129 bundle_executable_dir = bundle_root_dir
1130 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1131
1132 deps = [
1133 ":${app_name}_bundle_executable",
1134 ":${app_name}_bundle_info_plist",
1135 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001136 if (bundle_ios_data) {
1137 deps += [ ":${app_name}_bundle_resources" ]
1138 if (has_skps) {
1139 deps += [ ":${app_name}_bundle_skps" ]
1140 }
1141 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001142
1143 # should only code sign when running on a device, not the simulator
1144 if (target_cpu != "x64") {
1145 code_signing_script = "//gn/codesign_ios.py"
1146 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1147 code_signing_outputs = [
1148 "$bundle_root_dir/_CodeSignature/CodeResources",
1149 "$bundle_root_dir/embedded.mobileprovision",
1150 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001151 code_signing_args = [
1152 rebase_path("$bundle_root_dir", root_build_dir),
1153 skia_ios_identity,
1154 skia_ios_profile,
1155 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001156 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001157 }
1158 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001159 # !is_ios
1160
1161 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1162 shared_library("lib" + target_name) {
1163 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1164 configs += [ ":skia_private" ]
1165 testonly = true
1166 }
1167 } else {
1168 _executable = target_name
1169 executable(_executable) {
1170 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1171 configs += [ ":skia_private" ]
1172 testonly = true
1173 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001174 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001175 if (is_android && skia_android_serial != "" && defined(_executable)) {
1176 action("push_" + target_name) {
1177 script = "gn/push_to_android.py"
1178 deps = [
1179 ":" + _executable,
1180 ]
1181 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1182 outputs = [
1183 _stamp,
1184 ]
1185 args = [
1186 rebase_path("$root_build_dir/$_executable"),
1187 skia_android_serial,
1188 rebase_path(_stamp),
1189 ]
1190 testonly = true
1191 }
Mike Klein7d921032017-01-05 12:20:41 -05001192 }
1193 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001194 }
1195
mtkleinc095df52016-08-24 12:23:52 -07001196 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001197 public_include_dirs = []
1198 if (skia_enable_gpu) {
1199 public_defines = []
1200 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001201
1202 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001203 sources = [
1204 "tools/gpu/GrContextFactory.cpp",
1205 "tools/gpu/GrTest.cpp",
Brian Salomon58389b92018-03-07 13:01:25 -05001206 "tools/gpu/ProxyUtils.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001207 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001208 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001209 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001210 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001211 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1212 "tools/gpu/gl/debug/GrBufferObj.cpp",
1213 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1214 "tools/gpu/gl/debug/GrProgramObj.cpp",
1215 "tools/gpu/gl/debug/GrShaderObj.cpp",
1216 "tools/gpu/gl/debug/GrTextureObj.cpp",
1217 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1218 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001219 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001220 ]
1221 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001222
Kevin Lubick4a24e102017-03-29 11:19:01 -04001223 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001224 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001225 } else if (is_ios) {
1226 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1227 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001228 } else if (is_linux) {
1229 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001230 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001231 } else if (is_mac) {
1232 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001233 } else if (is_win) {
1234 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1235 libs += [
1236 "Gdi32.lib",
1237 "OpenGL32.lib",
1238 ]
mtklein38925aa2016-09-21 10:11:25 -07001239 }
mtklein6ef69992016-09-14 06:12:09 -07001240
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001241 cflags_objcc = [ "-fobjc-arc" ]
1242
Mike Kleinc168a3a2016-11-14 14:53:13 +00001243 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001244 deps += [ "//third_party/angle2" ]
1245 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1246 }
mtkleind68f9b02016-09-23 13:18:41 -07001247 if (skia_use_vulkan) {
1248 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001249 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001250 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001251 if (skia_use_metal) {
1252 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1253 }
mtkleina627b5c2016-09-20 13:36:47 -07001254 }
mtklein25c81d42016-07-27 13:55:26 -07001255 }
mtklein25c81d42016-07-27 13:55:26 -07001256
mtkleinc095df52016-08-24 12:23:52 -07001257 test_lib("flags") {
1258 public_include_dirs = [ "tools/flags" ]
1259 sources = [
1260 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001261 ]
1262 }
1263 test_lib("common_flags") {
1264 public_include_dirs = [ "tools/flags" ]
1265 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001266 "tools/flags/SkCommonFlags.cpp",
1267 "tools/flags/SkCommonFlagsConfig.cpp",
1268 ]
1269 deps = [
mtklein046cb562016-09-16 10:23:12 -07001270 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001271 ":gpu_tool_utils",
1272 ]
1273 }
mtklein25c81d42016-07-27 13:55:26 -07001274
mtkleinc095df52016-08-24 12:23:52 -07001275 test_lib("tool_utils") {
1276 public_include_dirs = [
1277 "tools",
1278 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001279 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001280 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001281 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001282 ]
1283 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001284 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001285 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001286 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001287 "tools/ProcStats.cpp",
1288 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001289 "tools/UrlDataManager.cpp",
1290 "tools/debugger/SkDebugCanvas.cpp",
1291 "tools/debugger/SkDrawCommand.cpp",
1292 "tools/debugger/SkJsonWriteBuffer.cpp",
1293 "tools/debugger/SkObjectParser.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001294 "tools/fonts/SkRandomScalerContext.cpp",
1295 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001296 "tools/fonts/SkTestFontMgr.h",
1297 "tools/fonts/SkTestSVGTypeface.cpp",
1298 "tools/fonts/SkTestSVGTypeface.h",
1299 "tools/fonts/SkTestTypeface.cpp",
1300 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001301 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001302 "tools/picture_utils.cpp",
1303 "tools/random_parse_path.cpp",
1304 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001305 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001306 "tools/trace/SkChromeTracingTracer.cpp",
1307 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001308 "tools/trace/SkDebugfTracer.cpp",
1309 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001310 "tools/trace/SkEventTracingPriv.cpp",
1311 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001312 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001313 libs = []
1314 if (is_ios) {
1315 sources += [ "tools/ios_utils.m" ]
1316 libs += [ "Foundation.framework" ]
1317 }
mtkleinc095df52016-08-24 12:23:52 -07001318 deps = [
mtklein046cb562016-09-16 10:23:12 -07001319 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001320 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001321 ":flags",
1322 "//third_party/libpng",
1323 ]
1324 public_deps = [
1325 "//third_party/jsoncpp",
1326 ]
1327 }
mtklein25c81d42016-07-27 13:55:26 -07001328
Mike Klein6e744122016-10-27 12:21:40 -04001329 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001330 test_lib("gm") {
1331 public_include_dirs = [ "gm" ]
1332 sources = gm_sources
1333 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001334 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001335 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001336 ":gpu_tool_utils",
1337 ":skia",
1338 ":tool_utils",
1339 ]
1340 }
mtklein25c81d42016-07-27 13:55:26 -07001341
Mike Klein6e744122016-10-27 12:21:40 -04001342 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001343 test_lib("tests") {
1344 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001345 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001346 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001347 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001348 }
mtkleinc095df52016-08-24 12:23:52 -07001349 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001350 ":experimental_sksg",
Hal Canary0f666812018-03-22 15:21:12 -04001351 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001352 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001353 ":skia",
1354 ":tool_utils",
1355 "//third_party/libpng",
1356 "//third_party/zlib",
1357 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001358 public_deps = [
1359 ":gpu_tool_utils", # Test.h #includes headers from this target.
1360 ]
mtkleinc095df52016-08-24 12:23:52 -07001361 }
mtklein2f3416d2016-08-02 16:02:05 -07001362
Mike Klein6e744122016-10-27 12:21:40 -04001363 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001364 test_lib("bench") {
1365 public_include_dirs = [ "bench" ]
1366 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001367 deps = [
1368 ":flags",
1369 ":gm",
1370 ":gpu_tool_utils",
1371 ":skia",
1372 ":tool_utils",
1373 ]
1374 }
mtklein2b6870c2016-07-28 14:17:33 -07001375
Florin Malita54f65c42018-01-16 17:04:30 -05001376 test_lib("experimental_skottie") {
1377 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001378 include_dirs = [ "tools" ]
1379 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001380 "experimental/skottie/Skottie.cpp",
Florin Malitaa6e30f72018-03-23 13:41:58 -04001381 "experimental/skottie/SkottieAdapter.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001382 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001383 "experimental/skottie/SkottieParser.cpp",
Florin Malitaa6e30f72018-03-23 13:41:58 -04001384 "experimental/skottie/SkottieValue.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001385 ]
1386 deps = [
1387 ":experimental_sksg",
1388 ":skia",
1389 "//third_party/jsoncpp",
1390 ]
1391 }
1392
mtkleinc095df52016-08-24 12:23:52 -07001393 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001394 public_include_dirs = []
1395 if (skia_use_expat) {
1396 public_include_dirs += [ "experimental/svg/model" ]
1397 sources = [
1398 "experimental/svg/model/SkSVGAttribute.cpp",
1399 "experimental/svg/model/SkSVGAttributeParser.cpp",
1400 "experimental/svg/model/SkSVGCircle.cpp",
1401 "experimental/svg/model/SkSVGClipPath.cpp",
1402 "experimental/svg/model/SkSVGContainer.cpp",
1403 "experimental/svg/model/SkSVGDOM.cpp",
1404 "experimental/svg/model/SkSVGEllipse.cpp",
1405 "experimental/svg/model/SkSVGGradient.cpp",
1406 "experimental/svg/model/SkSVGLine.cpp",
1407 "experimental/svg/model/SkSVGLinearGradient.cpp",
1408 "experimental/svg/model/SkSVGNode.cpp",
1409 "experimental/svg/model/SkSVGPath.cpp",
1410 "experimental/svg/model/SkSVGPattern.cpp",
1411 "experimental/svg/model/SkSVGPoly.cpp",
1412 "experimental/svg/model/SkSVGRadialGradient.cpp",
1413 "experimental/svg/model/SkSVGRect.cpp",
1414 "experimental/svg/model/SkSVGRenderContext.cpp",
1415 "experimental/svg/model/SkSVGSVG.cpp",
1416 "experimental/svg/model/SkSVGShape.cpp",
1417 "experimental/svg/model/SkSVGStop.cpp",
1418 "experimental/svg/model/SkSVGTransformableNode.cpp",
1419 "experimental/svg/model/SkSVGUse.cpp",
1420 "experimental/svg/model/SkSVGValue.cpp",
1421 ]
1422 deps = [
1423 ":skia",
1424 ":xml",
1425 ]
1426 }
mtkleinc095df52016-08-24 12:23:52 -07001427 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001428
Florin Malita4aa44412017-12-19 12:21:02 -05001429 test_lib("experimental_sksg") {
1430 public_include_dirs = [
1431 "experimental/sksg",
1432 "experimental/sksg/effects",
1433 "experimental/sksg/geometry",
1434 "experimental/sksg/paint",
1435 ]
1436 sources = [
1437 "experimental/sksg/SkSGDraw.cpp",
1438 "experimental/sksg/SkSGEffectNode.cpp",
1439 "experimental/sksg/SkSGGeometryNode.cpp",
1440 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001441 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001442 "experimental/sksg/SkSGInvalidationController.cpp",
1443 "experimental/sksg/SkSGNode.cpp",
1444 "experimental/sksg/SkSGPaintNode.cpp",
1445 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001446 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001447 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001448 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001449 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001450 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001451 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001452 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001453 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001454 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001455 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001456 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001457 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001458 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001459 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001460 ]
1461 deps = [
1462 ":skia",
1463 ]
1464 }
1465
Kevin Lubickebf648e2017-09-21 13:45:16 -04001466 if (target_cpu != "wasm") {
1467 test_lib("views") {
1468 public_include_dirs = [ "include/views" ]
1469 sources = [
1470 "src/views/SkEvent.cpp",
1471 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001472 "src/views/SkTouchGesture.cpp",
1473 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001474 ]
Brian Osman34755e22016-12-05 09:46:02 -05001475 }
Brian Osman16adfa32016-10-18 14:42:44 -04001476 }
1477
Mike Klein38af9432016-11-11 11:39:44 -05001478 if (skia_use_lua) {
1479 test_lib("lua") {
1480 public_include_dirs = []
1481 sources = [
1482 "src/utils/SkLua.cpp",
1483 "src/utils/SkLuaCanvas.cpp",
1484 ]
1485 deps = [
1486 "//third_party/lua",
1487 ]
1488 }
1489
Mike Kleine6682eb2017-01-05 10:54:57 -05001490 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001491 sources = [
1492 "tools/lua/lua_app.cpp",
1493 ]
1494 deps = [
1495 ":lua",
1496 ":skia",
1497 "//third_party/lua",
1498 ]
Mike Klein38af9432016-11-11 11:39:44 -05001499 }
1500
Mike Kleine6682eb2017-01-05 10:54:57 -05001501 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001502 sources = [
1503 "tools/lua/lua_pictures.cpp",
1504 ]
1505 deps = [
1506 ":flags",
1507 ":lua",
1508 ":skia",
1509 ":tool_utils",
1510 "//third_party/lua",
1511 ]
Mike Klein38af9432016-11-11 11:39:44 -05001512 }
1513 }
1514
Cary Clark8032b982017-07-28 11:04:54 -04001515 test_app("bookmaker") {
1516 sources = [
1517 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001518 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001519 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001520 "tools/bookmaker/fiddleParser.cpp",
1521 "tools/bookmaker/includeParser.cpp",
1522 "tools/bookmaker/includeWriter.cpp",
1523 "tools/bookmaker/mdOut.cpp",
1524 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001525 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001526 "tools/bookmaker/spellCheck.cpp",
1527 ]
1528 deps = [
1529 ":flags",
1530 ":skia",
1531 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001532 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001533 ]
1534 }
1535
Kevin Lubickebf648e2017-09-21 13:45:16 -04001536 if (target_cpu != "wasm") {
1537 import("gn/samples.gni")
1538 test_lib("samples") {
1539 public_include_dirs = [ "samplecode" ]
1540 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001541 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001542 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001543 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001544 ":experimental_svg_model",
1545 ":flags",
1546 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001547 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001548 ":tool_utils",
1549 ":views",
1550 ":xml",
1551 ]
Mike Klein38af9432016-11-11 11:39:44 -05001552
Kevin Lubickebf648e2017-09-21 13:45:16 -04001553 if (skia_use_lua) {
1554 sources += [ "samplecode/SampleLua.cpp" ]
1555 deps += [
1556 ":lua",
1557 "//third_party/lua",
1558 ]
1559 }
1560 }
1561 test_app("dm") {
1562 sources = [
1563 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001564 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001565 "dm/DMJsonWriter.cpp",
1566 "dm/DMSrcSink.cpp",
1567 ]
1568 include_dirs = [ "tests" ]
1569 deps = [
1570 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001571 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001572 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001573 ":experimental_svg_model",
1574 ":flags",
1575 ":gm",
1576 ":gpu_tool_utils",
1577 ":skia",
1578 ":tests",
1579 ":tool_utils",
1580 "//third_party/jsoncpp",
1581 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001582 ]
1583 }
Brian Osman16adfa32016-10-18 14:42:44 -04001584 }
1585
Mike Kleina8a51ce2018-01-09 12:34:11 -05001586 if (!is_win) {
1587 test_app("remote_demo") {
1588 sources = [
1589 "tools/remote_demo.cpp",
1590 ]
1591 deps = [
1592 ":skia",
1593 ]
1594 }
1595 }
1596
Mike Kleine6682eb2017-01-05 10:54:57 -05001597 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001598 sources = [
1599 "bench/nanobench.cpp",
1600 ]
1601 deps = [
1602 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001603 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001604 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001605 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001606 ":flags",
1607 ":gm",
1608 ":gpu_tool_utils",
1609 ":skia",
1610 ":tool_utils",
1611 "//third_party/jsoncpp",
1612 ]
mtklein2b6870c2016-07-28 14:17:33 -07001613 }
halcanary19a97202016-08-03 15:08:04 -07001614
Ravi Mistry10d36c52017-01-31 09:49:18 -05001615 test_app("skpinfo") {
1616 sources = [
1617 "tools/skpinfo.cpp",
1618 ]
1619 deps = [
1620 ":flags",
1621 ":skia",
1622 ]
1623 }
1624
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001625 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001626 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001627 sources = [
1628 "tools/skpbench/skpbench.cpp",
1629 ]
1630 deps = [
1631 ":flags",
1632 ":gpu_tool_utils",
1633 ":skia",
1634 ":tool_utils",
1635 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001636 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001637 }
1638
Hal Canary96c57252018-02-09 11:43:05 -05001639 test_lib("skshaper") {
1640 public_include_dirs = [ "tools/shape" ]
1641 deps = [
1642 ":skia",
1643 ]
1644
Hal Canary8bb40832018-02-08 15:16:28 -05001645 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001646 sources = [
1647 "tools/shape/SkShaper_primitive.cpp",
1648 ]
1649 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001650 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001651 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001652 ]
Hal Canary96c57252018-02-09 11:43:05 -05001653 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001654 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001655 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001656 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001657 }
halcanary19a97202016-08-03 15:08:04 -07001658 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001659 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001660 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001661 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001662 ]
1663 deps = [
1664 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001665 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001666 ]
halcanary3eee9d92016-09-10 07:01:53 -07001667 }
mtklein046cb562016-09-16 10:23:12 -07001668
Matt Sarett9f1c4032017-05-17 10:06:32 -04001669 test_app("create_flutter_test_images") {
1670 sources = [
1671 "tools/create_flutter_test_images.cpp",
1672 ]
1673 deps = [
1674 ":skia",
1675 ":tool_utils",
1676 ]
1677 }
1678
Ben Wagner219f3622017-07-17 15:32:25 -04001679 test_app("create_test_font") {
1680 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001681 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001682 ]
1683 deps = [
1684 ":skia",
1685 ]
1686 assert_no_deps = [
1687 # tool_utils requires the output of this app.
1688 ":tool_utils",
1689 ]
1690 }
1691
Ben Wagner97182cc2018-02-15 10:20:04 -05001692 test_app("create_test_font_color") {
1693 sources = [
1694 "tools/fonts/create_test_font_color.cpp",
1695 ]
1696 deps = [
1697 ":flags",
1698 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001699 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001700 ]
1701 }
1702
Mike Kleine6682eb2017-01-05 10:54:57 -05001703 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001704 sources = [
1705 "tools/get_images_from_skps.cpp",
1706 ]
1707 deps = [
1708 ":flags",
1709 ":skia",
1710 "//third_party/jsoncpp",
1711 ]
mtklein046cb562016-09-16 10:23:12 -07001712 }
mtkleinecbc5262016-09-22 11:51:24 -07001713
Mike Kleine6682eb2017-01-05 10:54:57 -05001714 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001715 sources = [
1716 "tools/colorspaceinfo.cpp",
1717 ]
1718 deps = [
1719 ":flags",
1720 ":skia",
1721 ":tool_utils",
1722 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001723 }
1724
Kevin Lubickebf648e2017-09-21 13:45:16 -04001725 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001726 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001727 sources = [
1728 "tools/skiaserve/Request.cpp",
1729 "tools/skiaserve/Response.cpp",
1730 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001731 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1732 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1733 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1734 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1735 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1736 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1737 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1738 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1739 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001740 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1741 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001742 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1743 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1744 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1745 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1746 ]
1747 deps = [
1748 ":flags",
1749 ":gpu_tool_utils",
1750 ":skia",
1751 ":tool_utils",
1752 "//third_party/jsoncpp",
1753 "//third_party/libmicrohttpd",
1754 "//third_party/libpng",
1755 ]
Mike Klein7d302882016-11-03 14:06:31 -04001756 }
mtkleinecbc5262016-09-22 11:51:24 -07001757 }
kjlubick14f984b2016-10-03 11:49:45 -07001758
Mike Kleine6682eb2017-01-05 10:54:57 -05001759 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001760 include_dirs = [
1761 "tools",
1762 "tools/debugger",
1763 ]
kjlubick14f984b2016-10-03 11:49:45 -07001764 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001765 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001766 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001767 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001768 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001769 "fuzz/FuzzGradients.cpp",
1770 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001771 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001772 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001773 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001774 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001775 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1776 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001777 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1778 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001779 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1780 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001781 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001782 "tools/UrlDataManager.cpp",
1783 "tools/debugger/SkDebugCanvas.cpp",
1784 "tools/debugger/SkDrawCommand.cpp",
1785 "tools/debugger/SkJsonWriteBuffer.cpp",
1786 "tools/debugger/SkObjectParser.cpp",
1787 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001788 ]
1789 deps = [
1790 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001791 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001792 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001793 "//third_party/jsoncpp",
1794 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001795 ]
kjlubick14f984b2016-10-03 11:49:45 -07001796 }
Mike Klein38312422016-10-05 15:41:01 -04001797
Mike Kleine6682eb2017-01-05 10:54:57 -05001798 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001799 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001800 rebase_path("tests/skia_test.cpp"),
1801 rebase_path("tests/Test.cpp"),
1802 ]
caryclark9feb6322016-10-25 08:58:26 -07001803 deps = [
1804 ":flags",
1805 ":gpu_tool_utils",
1806 ":skia",
1807 ":tool_utils",
1808 ]
caryclark9feb6322016-10-25 08:58:26 -07001809 }
1810
Mike Kleine6682eb2017-01-05 10:54:57 -05001811 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001812 sources = [
1813 "tools/DumpRecord.cpp",
1814 "tools/dump_record.cpp",
1815 ]
1816 deps = [
1817 ":flags",
1818 ":skia",
1819 ]
Mike Klein38312422016-10-05 15:41:01 -04001820 }
bungemanfe917272016-10-13 17:36:40 -04001821
Mike Kleine6682eb2017-01-05 10:54:57 -05001822 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001823 sources = [
1824 "tools/skdiff/skdiff.cpp",
1825 "tools/skdiff/skdiff_html.cpp",
1826 "tools/skdiff/skdiff_main.cpp",
1827 "tools/skdiff/skdiff_utils.cpp",
1828 ]
1829 deps = [
1830 ":skia",
1831 ":tool_utils",
1832 ]
bungemanfe917272016-10-13 17:36:40 -04001833 }
halcanarya73d76a2016-10-17 13:19:02 -07001834
Mike Kleine6682eb2017-01-05 10:54:57 -05001835 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001836 sources = [
1837 "tools/skp_parser.cpp",
1838 ]
1839 deps = [
1840 ":skia",
1841 ":tool_utils",
1842 "//third_party/jsoncpp",
1843 ]
halcanarya73d76a2016-10-17 13:19:02 -07001844 }
Brian Osman16adfa32016-10-18 14:42:44 -04001845
Hal Canaryd7b38452017-12-11 17:46:26 -05001846 if (!is_win && skia_enable_gpu) {
1847 test_lib("skqp_lib") {
1848 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001849 defines =
1850 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001851 if (skia_skqp_enable_driver_correctness_workarounds) {
1852 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1853 }
Hal Canary75427132017-10-11 16:00:31 -04001854 sources = [
1855 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001856 "tools/skqp/gm_knowledge.cpp",
1857 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001858 ]
1859 deps = [
1860 ":gm",
1861 ":gpu_tool_utils",
1862 ":skia",
1863 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001864 ":tool_utils",
1865 ]
1866 }
1867 test_app("skqp") {
1868 sources = [
1869 "tools/skqp/skqp.cpp",
1870 ]
1871 deps = [
1872 ":skia",
1873 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001874 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001875 "//third_party/googletest",
1876 ]
1877 }
1878 }
Hal Canary28f89382017-12-12 09:42:14 -05001879 if (is_android && skia_enable_gpu) {
1880 test_app("skqp_app") {
1881 is_shared_library = true
1882 sources = [
1883 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1884 ]
1885 deps = [
1886 ":skia",
1887 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001888 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001889 ]
1890 libs = [ "android" ]
1891 }
1892 }
Hal Canary75427132017-10-11 16:00:31 -04001893
Hal Canarya9de7602018-01-19 13:08:23 -05001894 test_app("list_gms") {
1895 sources = [
1896 "tools/list_gms.cpp",
1897 ]
1898 deps = [
1899 ":gm",
1900 ":skia",
1901 ]
1902 }
1903 test_app("list_gpu_unit_tests") {
1904 sources = [
1905 "dm/DMGpuTestProcs.cpp",
1906 "tools/list_gpu_unit_tests.cpp",
1907 ]
1908 deps = [
1909 ":skia",
1910 ":tests",
1911 ]
1912 }
1913
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001914 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001915 test_lib("sk_app") {
1916 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001917 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001918 "tools/sk_app/CommandSet.cpp",
1919 "tools/sk_app/GLWindowContext.cpp",
1920 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001921 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001922 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001923
Jim Van Verth4e56a912016-10-21 10:58:52 -04001924 if (is_android) {
1925 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001926 "tools/sk_app/android/GLWindowContext_android.cpp",
1927 "tools/sk_app/android/RasterWindowContext_android.cpp",
1928 "tools/sk_app/android/Window_android.cpp",
1929 "tools/sk_app/android/main_android.cpp",
1930 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001931 ]
Brian Osman462334e2017-02-09 11:22:57 -05001932 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001933 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001934 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001935 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1936 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1937 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001938 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001939 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001940 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001941 libs += [
1942 "GL",
1943 "X11",
1944 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001945 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001946 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001947 "tools/sk_app/win/GLWindowContext_win.cpp",
1948 "tools/sk_app/win/RasterWindowContext_win.cpp",
1949 "tools/sk_app/win/Window_win.cpp",
1950 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001951 ]
Brian Salomon194db172017-08-17 14:37:06 -04001952 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001953 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001954 }
Mike Klein43c25262016-10-20 10:17:47 -04001955 } else if (is_mac) {
1956 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001957 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1958 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1959 "tools/sk_app/mac/Window_mac.cpp",
1960 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001961 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001962 libs += [
1963 "QuartzCore.framework",
1964 "Cocoa.framework",
1965 "Foundation.framework",
1966 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001967 } else if (is_ios) {
1968 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001969 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1970 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1971 "tools/sk_app/ios/Window_ios.cpp",
1972 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001973 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001974 }
1975
1976 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001977 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001978 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001979 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001980 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001981 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001982 libs += [ "X11-xcb" ]
1983 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001984 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001985 }
1986 }
1987
Brian Osman16adfa32016-10-18 14:42:44 -04001988 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001989 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001990 ":skia",
1991 ":tool_utils",
1992 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001993 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001994 if (is_android) {
1995 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001996 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001997 deps += [ "//third_party/libsdl" ]
1998 }
Brian Salomon194db172017-08-17 14:37:06 -04001999 if (skia_use_angle) {
2000 deps += [ "//third_party/angle2" ]
2001 }
Mike Kleina92c3832016-12-08 09:49:39 -05002002 }
Brian Osman16adfa32016-10-18 14:42:44 -04002003 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002004
Brian Osmaneff04b52017-11-21 13:18:02 -05002005 if (skia_enable_gpu) {
2006 test_app("viewer") {
2007 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05002008 if (is_ios) {
2009 bundle_ios_data = true
2010 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002011 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07002012 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002013 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05002014 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002015 "tools/viewer/ImageSlide.cpp",
2016 "tools/viewer/SKPSlide.cpp",
2017 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05002018 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05002019 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05002020 "tools/viewer/StatsLayer.cpp",
Florin Malitac659c2c2018-04-05 11:57:21 -04002021 "tools/viewer/SvgSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002022 "tools/viewer/Viewer.cpp",
2023 ]
2024 libs = []
2025
2026 include_dirs = []
2027 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05002028 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05002029 ":experimental_sksg",
Florin Malitac659c2c2018-04-05 11:57:21 -04002030 ":experimental_svg_model",
Brian Osmaneff04b52017-11-21 13:18:02 -05002031 ":flags",
2032 ":gm",
2033 ":gpu_tool_utils",
2034 ":samples",
2035 ":sk_app",
2036 ":skia",
2037 ":tool_utils",
2038 ":views",
2039 "//third_party/imgui",
2040 "//third_party/jsoncpp",
2041 ]
2042 }
2043 }
2044
2045 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2046 test_app("HelloWorld") {
2047 sources = [
2048 "example/HelloWorld.cpp",
2049 ]
2050 libs = []
2051
2052 include_dirs = []
2053 deps = [
2054 ":flags",
2055 ":gpu_tool_utils",
2056 ":sk_app",
2057 ":skia",
2058 ":tool_utils",
2059 ":views",
2060 ]
2061 }
2062 }
2063
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002064 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002065 test_app("SkiaSDLExample") {
2066 sources = [
2067 "example/SkiaSDLExample.cpp",
2068 ]
2069 libs = []
2070 include_dirs = []
2071 deps = [
2072 ":gpu_tool_utils",
2073 ":skia",
2074 "//third_party/libsdl",
2075 ]
2076 }
2077 }
2078
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002079 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2080 action_foreach("generate_mocs") {
2081 script = "gn/call.py"
2082 sources = [
2083 "tools/mdbviz/MainWindow.h",
2084 ]
2085 outputs = [
2086 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2087 ]
2088 args = [
2089 "$skia_qt_path" + "/bin/moc",
2090 "{{source}}",
2091 "-o",
2092 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2093 ]
2094 }
2095 action_foreach("generate_resources") {
2096 script = "gn/call.py"
2097 sources = [
2098 "tools/mdbviz/resources.qrc",
2099 ]
2100 outputs = [
2101 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2102 ]
2103 args = [
2104 "$skia_qt_path" + "/bin/rcc",
2105 "{{source}}",
2106 "-o",
2107 "gen/mdbviz/{{source_name_part}}_res.cpp",
2108 ]
2109 }
2110 test_app("mdbviz") {
2111 if (is_win) {
2112 # on Windows we need to disable some exception handling warnings due to the Qt headers
2113 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2114 }
2115 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002116 "tools/UrlDataManager.cpp",
2117 "tools/debugger/SkDebugCanvas.cpp",
2118 "tools/debugger/SkDrawCommand.cpp",
2119 "tools/debugger/SkJsonWriteBuffer.cpp",
2120 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002121 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002122 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002123 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002124 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002125
2126 # generated files
2127 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2128 "$target_gen_dir/mdbviz/resources_res.cpp",
2129 ]
2130 lib_dirs = [ "$skia_qt_path/lib" ]
2131 libs = [
2132 "Qt5Core.lib",
2133 "Qt5Gui.lib",
2134 "Qt5Widgets.lib",
2135 ]
2136 include_dirs = [
2137 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002138 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002139 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002140 "tools",
2141 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002142 ]
2143 deps = [
2144 ":generate_mocs",
2145 ":generate_resources",
2146 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002147 "//third_party/jsoncpp",
2148 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002149 ]
2150 }
2151 }
2152
Mike Kleine459afd2017-03-03 09:21:30 -05002153 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002154 copy("gdbserver") {
2155 sources = [
2156 "$ndk/$ndk_gdbserver",
2157 ]
2158 outputs = [
2159 "$root_out_dir/gdbserver",
2160 ]
2161 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002162 }
mtklein25c81d42016-07-27 13:55:26 -07002163}