blob: 1abb7e6cecee38d04493e4c214d9ca85c71c97d4 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Mike Kleinfb333552018-01-25 12:49:37 -050033 skia_use_skcms = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050045 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040046 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
Hal Canary4689b542018-01-31 11:54:14 -050051 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050052 skia_skqp_global_error_tolerance = 0
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 Wagner3560b582018-03-27 18:15:53 +00001293 "tools/fonts/SkTestScalerContext.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001294 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001295 "tools/picture_utils.cpp",
1296 "tools/random_parse_path.cpp",
1297 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001298 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001299 "tools/trace/SkChromeTracingTracer.cpp",
1300 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001301 "tools/trace/SkDebugfTracer.cpp",
1302 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001303 "tools/trace/SkEventTracingPriv.cpp",
1304 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001305 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001306 libs = []
1307 if (is_ios) {
1308 sources += [ "tools/ios_utils.m" ]
1309 libs += [ "Foundation.framework" ]
1310 }
mtkleinc095df52016-08-24 12:23:52 -07001311 deps = [
mtklein046cb562016-09-16 10:23:12 -07001312 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001313 ":flags",
1314 "//third_party/libpng",
1315 ]
1316 public_deps = [
1317 "//third_party/jsoncpp",
1318 ]
1319 }
mtklein25c81d42016-07-27 13:55:26 -07001320
Mike Klein6e744122016-10-27 12:21:40 -04001321 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001322 test_lib("gm") {
1323 public_include_dirs = [ "gm" ]
1324 sources = gm_sources
1325 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001326 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001327 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001328 ":gpu_tool_utils",
1329 ":skia",
1330 ":tool_utils",
1331 ]
1332 }
mtklein25c81d42016-07-27 13:55:26 -07001333
Mike Klein6e744122016-10-27 12:21:40 -04001334 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001335 test_lib("tests") {
1336 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001337 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001338 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001339 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001340 }
mtkleinc095df52016-08-24 12:23:52 -07001341 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001342 ":experimental_sksg",
Hal Canary0f666812018-03-22 15:21:12 -04001343 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001344 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001345 ":skia",
1346 ":tool_utils",
1347 "//third_party/libpng",
1348 "//third_party/zlib",
1349 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001350 public_deps = [
1351 ":gpu_tool_utils", # Test.h #includes headers from this target.
1352 ]
mtkleinc095df52016-08-24 12:23:52 -07001353 }
mtklein2f3416d2016-08-02 16:02:05 -07001354
Mike Klein6e744122016-10-27 12:21:40 -04001355 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001356 test_lib("bench") {
1357 public_include_dirs = [ "bench" ]
1358 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001359 deps = [
1360 ":flags",
1361 ":gm",
1362 ":gpu_tool_utils",
1363 ":skia",
1364 ":tool_utils",
1365 ]
1366 }
mtklein2b6870c2016-07-28 14:17:33 -07001367
Florin Malita54f65c42018-01-16 17:04:30 -05001368 test_lib("experimental_skottie") {
1369 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001370 include_dirs = [ "tools" ]
1371 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001372 "experimental/skottie/Skottie.cpp",
Florin Malitaa6e30f72018-03-23 13:41:58 -04001373 "experimental/skottie/SkottieAdapter.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001374 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001375 "experimental/skottie/SkottieParser.cpp",
Florin Malitaa6e30f72018-03-23 13:41:58 -04001376 "experimental/skottie/SkottieValue.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001377 ]
1378 deps = [
1379 ":experimental_sksg",
1380 ":skia",
1381 "//third_party/jsoncpp",
1382 ]
1383 }
1384
mtkleinc095df52016-08-24 12:23:52 -07001385 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001386 public_include_dirs = []
1387 if (skia_use_expat) {
1388 public_include_dirs += [ "experimental/svg/model" ]
1389 sources = [
1390 "experimental/svg/model/SkSVGAttribute.cpp",
1391 "experimental/svg/model/SkSVGAttributeParser.cpp",
1392 "experimental/svg/model/SkSVGCircle.cpp",
1393 "experimental/svg/model/SkSVGClipPath.cpp",
1394 "experimental/svg/model/SkSVGContainer.cpp",
1395 "experimental/svg/model/SkSVGDOM.cpp",
1396 "experimental/svg/model/SkSVGEllipse.cpp",
1397 "experimental/svg/model/SkSVGGradient.cpp",
1398 "experimental/svg/model/SkSVGLine.cpp",
1399 "experimental/svg/model/SkSVGLinearGradient.cpp",
1400 "experimental/svg/model/SkSVGNode.cpp",
1401 "experimental/svg/model/SkSVGPath.cpp",
1402 "experimental/svg/model/SkSVGPattern.cpp",
1403 "experimental/svg/model/SkSVGPoly.cpp",
1404 "experimental/svg/model/SkSVGRadialGradient.cpp",
1405 "experimental/svg/model/SkSVGRect.cpp",
1406 "experimental/svg/model/SkSVGRenderContext.cpp",
1407 "experimental/svg/model/SkSVGSVG.cpp",
1408 "experimental/svg/model/SkSVGShape.cpp",
1409 "experimental/svg/model/SkSVGStop.cpp",
1410 "experimental/svg/model/SkSVGTransformableNode.cpp",
1411 "experimental/svg/model/SkSVGUse.cpp",
1412 "experimental/svg/model/SkSVGValue.cpp",
1413 ]
1414 deps = [
1415 ":skia",
1416 ":xml",
1417 ]
1418 }
mtkleinc095df52016-08-24 12:23:52 -07001419 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001420
Florin Malita4aa44412017-12-19 12:21:02 -05001421 test_lib("experimental_sksg") {
1422 public_include_dirs = [
1423 "experimental/sksg",
1424 "experimental/sksg/effects",
1425 "experimental/sksg/geometry",
1426 "experimental/sksg/paint",
1427 ]
1428 sources = [
1429 "experimental/sksg/SkSGDraw.cpp",
1430 "experimental/sksg/SkSGEffectNode.cpp",
1431 "experimental/sksg/SkSGGeometryNode.cpp",
1432 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001433 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001434 "experimental/sksg/SkSGInvalidationController.cpp",
1435 "experimental/sksg/SkSGNode.cpp",
1436 "experimental/sksg/SkSGPaintNode.cpp",
1437 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001438 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001439 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001440 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001441 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001442 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001443 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001444 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001445 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001446 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001447 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001448 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001449 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001450 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001451 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001452 ]
1453 deps = [
1454 ":skia",
1455 ]
1456 }
1457
Kevin Lubickebf648e2017-09-21 13:45:16 -04001458 if (target_cpu != "wasm") {
1459 test_lib("views") {
1460 public_include_dirs = [ "include/views" ]
1461 sources = [
1462 "src/views/SkEvent.cpp",
1463 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001464 "src/views/SkTouchGesture.cpp",
1465 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001466 ]
Brian Osman34755e22016-12-05 09:46:02 -05001467 }
Brian Osman16adfa32016-10-18 14:42:44 -04001468 }
1469
Mike Klein38af9432016-11-11 11:39:44 -05001470 if (skia_use_lua) {
1471 test_lib("lua") {
1472 public_include_dirs = []
1473 sources = [
1474 "src/utils/SkLua.cpp",
1475 "src/utils/SkLuaCanvas.cpp",
1476 ]
1477 deps = [
1478 "//third_party/lua",
1479 ]
1480 }
1481
Mike Kleine6682eb2017-01-05 10:54:57 -05001482 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001483 sources = [
1484 "tools/lua/lua_app.cpp",
1485 ]
1486 deps = [
1487 ":lua",
1488 ":skia",
1489 "//third_party/lua",
1490 ]
Mike Klein38af9432016-11-11 11:39:44 -05001491 }
1492
Mike Kleine6682eb2017-01-05 10:54:57 -05001493 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001494 sources = [
1495 "tools/lua/lua_pictures.cpp",
1496 ]
1497 deps = [
1498 ":flags",
1499 ":lua",
1500 ":skia",
1501 ":tool_utils",
1502 "//third_party/lua",
1503 ]
Mike Klein38af9432016-11-11 11:39:44 -05001504 }
1505 }
1506
Cary Clark8032b982017-07-28 11:04:54 -04001507 test_app("bookmaker") {
1508 sources = [
1509 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001510 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001511 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001512 "tools/bookmaker/fiddleParser.cpp",
1513 "tools/bookmaker/includeParser.cpp",
1514 "tools/bookmaker/includeWriter.cpp",
1515 "tools/bookmaker/mdOut.cpp",
1516 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001517 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001518 "tools/bookmaker/spellCheck.cpp",
1519 ]
1520 deps = [
1521 ":flags",
1522 ":skia",
1523 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001524 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001525 ]
1526 }
1527
Kevin Lubickebf648e2017-09-21 13:45:16 -04001528 if (target_cpu != "wasm") {
1529 import("gn/samples.gni")
1530 test_lib("samples") {
1531 public_include_dirs = [ "samplecode" ]
1532 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001533 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001534 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001535 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001536 ":experimental_svg_model",
1537 ":flags",
1538 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001539 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001540 ":tool_utils",
1541 ":views",
1542 ":xml",
1543 ]
Mike Klein38af9432016-11-11 11:39:44 -05001544
Kevin Lubickebf648e2017-09-21 13:45:16 -04001545 if (skia_use_lua) {
1546 sources += [ "samplecode/SampleLua.cpp" ]
1547 deps += [
1548 ":lua",
1549 "//third_party/lua",
1550 ]
1551 }
1552 }
1553 test_app("dm") {
1554 sources = [
1555 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001556 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001557 "dm/DMJsonWriter.cpp",
1558 "dm/DMSrcSink.cpp",
1559 ]
1560 include_dirs = [ "tests" ]
1561 deps = [
1562 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001563 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001564 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001565 ":experimental_svg_model",
1566 ":flags",
1567 ":gm",
1568 ":gpu_tool_utils",
1569 ":skia",
1570 ":tests",
1571 ":tool_utils",
1572 "//third_party/jsoncpp",
1573 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001574 ]
1575 }
Brian Osman16adfa32016-10-18 14:42:44 -04001576 }
1577
Mike Kleina8a51ce2018-01-09 12:34:11 -05001578 if (!is_win) {
1579 test_app("remote_demo") {
1580 sources = [
1581 "tools/remote_demo.cpp",
1582 ]
1583 deps = [
1584 ":skia",
1585 ]
1586 }
1587 }
1588
Mike Kleine6682eb2017-01-05 10:54:57 -05001589 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001590 sources = [
1591 "bench/nanobench.cpp",
1592 ]
1593 deps = [
1594 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001595 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001596 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001597 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001598 ":flags",
1599 ":gm",
1600 ":gpu_tool_utils",
1601 ":skia",
1602 ":tool_utils",
1603 "//third_party/jsoncpp",
1604 ]
mtklein2b6870c2016-07-28 14:17:33 -07001605 }
halcanary19a97202016-08-03 15:08:04 -07001606
Ravi Mistry10d36c52017-01-31 09:49:18 -05001607 test_app("skpinfo") {
1608 sources = [
1609 "tools/skpinfo.cpp",
1610 ]
1611 deps = [
1612 ":flags",
1613 ":skia",
1614 ]
1615 }
1616
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001617 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001619 sources = [
1620 "tools/skpbench/skpbench.cpp",
1621 ]
1622 deps = [
1623 ":flags",
1624 ":gpu_tool_utils",
1625 ":skia",
1626 ":tool_utils",
1627 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001628 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001629 }
1630
Hal Canary96c57252018-02-09 11:43:05 -05001631 test_lib("skshaper") {
1632 public_include_dirs = [ "tools/shape" ]
1633 deps = [
1634 ":skia",
1635 ]
1636
Hal Canary8bb40832018-02-08 15:16:28 -05001637 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001638 sources = [
1639 "tools/shape/SkShaper_primitive.cpp",
1640 ]
1641 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001642 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001643 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001644 ]
Hal Canary96c57252018-02-09 11:43:05 -05001645 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001646 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001647 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001648 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001649 }
halcanary19a97202016-08-03 15:08:04 -07001650 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001651 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001652 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001653 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001654 ]
1655 deps = [
1656 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001657 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001658 ]
halcanary3eee9d92016-09-10 07:01:53 -07001659 }
mtklein046cb562016-09-16 10:23:12 -07001660
Matt Sarett9f1c4032017-05-17 10:06:32 -04001661 test_app("create_flutter_test_images") {
1662 sources = [
1663 "tools/create_flutter_test_images.cpp",
1664 ]
1665 deps = [
1666 ":skia",
1667 ":tool_utils",
1668 ]
1669 }
1670
Ben Wagner219f3622017-07-17 15:32:25 -04001671 test_app("create_test_font") {
1672 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001673 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001674 ]
1675 deps = [
1676 ":skia",
1677 ]
1678 assert_no_deps = [
1679 # tool_utils requires the output of this app.
1680 ":tool_utils",
1681 ]
1682 }
1683
Mike Kleine6682eb2017-01-05 10:54:57 -05001684 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001685 sources = [
1686 "tools/get_images_from_skps.cpp",
1687 ]
1688 deps = [
1689 ":flags",
1690 ":skia",
1691 "//third_party/jsoncpp",
1692 ]
mtklein046cb562016-09-16 10:23:12 -07001693 }
mtkleinecbc5262016-09-22 11:51:24 -07001694
Mike Kleine6682eb2017-01-05 10:54:57 -05001695 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001696 sources = [
1697 "tools/colorspaceinfo.cpp",
1698 ]
1699 deps = [
1700 ":flags",
1701 ":skia",
1702 ":tool_utils",
1703 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001704 }
1705
Kevin Lubickebf648e2017-09-21 13:45:16 -04001706 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001707 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001708 sources = [
1709 "tools/skiaserve/Request.cpp",
1710 "tools/skiaserve/Response.cpp",
1711 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001712 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1713 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1714 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1715 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1716 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1717 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1718 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1719 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1720 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001721 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1722 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001723 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1724 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1725 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1726 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1727 ]
1728 deps = [
1729 ":flags",
1730 ":gpu_tool_utils",
1731 ":skia",
1732 ":tool_utils",
1733 "//third_party/jsoncpp",
1734 "//third_party/libmicrohttpd",
1735 "//third_party/libpng",
1736 ]
Mike Klein7d302882016-11-03 14:06:31 -04001737 }
mtkleinecbc5262016-09-22 11:51:24 -07001738 }
kjlubick14f984b2016-10-03 11:49:45 -07001739
Mike Kleine6682eb2017-01-05 10:54:57 -05001740 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001741 include_dirs = [
1742 "tools",
1743 "tools/debugger",
1744 ]
kjlubick14f984b2016-10-03 11:49:45 -07001745 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001746 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001747 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001748 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001749 "fuzz/FuzzGradients.cpp",
1750 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001751 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001752 "fuzz/FuzzPathop.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001753 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001754 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1755 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001756 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1757 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001758 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1759 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001760 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001761 "tools/UrlDataManager.cpp",
1762 "tools/debugger/SkDebugCanvas.cpp",
1763 "tools/debugger/SkDrawCommand.cpp",
1764 "tools/debugger/SkJsonWriteBuffer.cpp",
1765 "tools/debugger/SkObjectParser.cpp",
1766 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001767 ]
1768 deps = [
1769 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001770 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001771 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001772 "//third_party/jsoncpp",
1773 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001774 ]
kjlubick14f984b2016-10-03 11:49:45 -07001775 }
Mike Klein38312422016-10-05 15:41:01 -04001776
Mike Kleine6682eb2017-01-05 10:54:57 -05001777 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001778 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001779 rebase_path("tests/skia_test.cpp"),
1780 rebase_path("tests/Test.cpp"),
1781 ]
caryclark9feb6322016-10-25 08:58:26 -07001782 deps = [
1783 ":flags",
1784 ":gpu_tool_utils",
1785 ":skia",
1786 ":tool_utils",
1787 ]
caryclark9feb6322016-10-25 08:58:26 -07001788 }
1789
Mike Kleine6682eb2017-01-05 10:54:57 -05001790 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001791 sources = [
1792 "tools/DumpRecord.cpp",
1793 "tools/dump_record.cpp",
1794 ]
1795 deps = [
1796 ":flags",
1797 ":skia",
1798 ]
Mike Klein38312422016-10-05 15:41:01 -04001799 }
bungemanfe917272016-10-13 17:36:40 -04001800
Mike Kleine6682eb2017-01-05 10:54:57 -05001801 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001802 sources = [
1803 "tools/skdiff/skdiff.cpp",
1804 "tools/skdiff/skdiff_html.cpp",
1805 "tools/skdiff/skdiff_main.cpp",
1806 "tools/skdiff/skdiff_utils.cpp",
1807 ]
1808 deps = [
1809 ":skia",
1810 ":tool_utils",
1811 ]
bungemanfe917272016-10-13 17:36:40 -04001812 }
halcanarya73d76a2016-10-17 13:19:02 -07001813
Mike Kleine6682eb2017-01-05 10:54:57 -05001814 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001815 sources = [
1816 "tools/skp_parser.cpp",
1817 ]
1818 deps = [
1819 ":skia",
1820 ":tool_utils",
1821 "//third_party/jsoncpp",
1822 ]
halcanarya73d76a2016-10-17 13:19:02 -07001823 }
Brian Osman16adfa32016-10-18 14:42:44 -04001824
Hal Canaryd7b38452017-12-11 17:46:26 -05001825 if (!is_win && skia_enable_gpu) {
1826 test_lib("skqp_lib") {
1827 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001828 defines =
1829 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001830 if (skia_skqp_enable_driver_correctness_workarounds) {
1831 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1832 }
Hal Canary75427132017-10-11 16:00:31 -04001833 sources = [
1834 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001835 "tools/skqp/gm_knowledge.cpp",
1836 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001837 ]
1838 deps = [
1839 ":gm",
1840 ":gpu_tool_utils",
1841 ":skia",
1842 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001843 ":tool_utils",
1844 ]
1845 }
1846 test_app("skqp") {
1847 sources = [
1848 "tools/skqp/skqp.cpp",
1849 ]
1850 deps = [
1851 ":skia",
1852 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001853 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001854 "//third_party/googletest",
1855 ]
1856 }
1857 }
Hal Canary28f89382017-12-12 09:42:14 -05001858 if (is_android && skia_enable_gpu) {
1859 test_app("skqp_app") {
1860 is_shared_library = true
1861 sources = [
1862 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1863 ]
1864 deps = [
1865 ":skia",
1866 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001867 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001868 ]
1869 libs = [ "android" ]
1870 }
1871 }
Hal Canary75427132017-10-11 16:00:31 -04001872
Hal Canarya9de7602018-01-19 13:08:23 -05001873 test_app("list_gms") {
1874 sources = [
1875 "tools/list_gms.cpp",
1876 ]
1877 deps = [
1878 ":gm",
1879 ":skia",
1880 ]
1881 }
1882 test_app("list_gpu_unit_tests") {
1883 sources = [
1884 "dm/DMGpuTestProcs.cpp",
1885 "tools/list_gpu_unit_tests.cpp",
1886 ]
1887 deps = [
1888 ":skia",
1889 ":tests",
1890 ]
1891 }
1892
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001893 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001894 test_lib("sk_app") {
1895 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001896 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001897 "tools/sk_app/CommandSet.cpp",
1898 "tools/sk_app/GLWindowContext.cpp",
1899 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001900 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001901 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001902
Jim Van Verth4e56a912016-10-21 10:58:52 -04001903 if (is_android) {
1904 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001905 "tools/sk_app/android/GLWindowContext_android.cpp",
1906 "tools/sk_app/android/RasterWindowContext_android.cpp",
1907 "tools/sk_app/android/Window_android.cpp",
1908 "tools/sk_app/android/main_android.cpp",
1909 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001910 ]
Brian Osman462334e2017-02-09 11:22:57 -05001911 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001912 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001913 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001914 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1915 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1916 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001917 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001918 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001919 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001920 libs += [
1921 "GL",
1922 "X11",
1923 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001924 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001925 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001926 "tools/sk_app/win/GLWindowContext_win.cpp",
1927 "tools/sk_app/win/RasterWindowContext_win.cpp",
1928 "tools/sk_app/win/Window_win.cpp",
1929 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001930 ]
Brian Salomon194db172017-08-17 14:37:06 -04001931 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001932 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001933 }
Mike Klein43c25262016-10-20 10:17:47 -04001934 } else if (is_mac) {
1935 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001936 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1937 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1938 "tools/sk_app/mac/Window_mac.cpp",
1939 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001940 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001941 libs += [
1942 "QuartzCore.framework",
1943 "Cocoa.framework",
1944 "Foundation.framework",
1945 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001946 } else if (is_ios) {
1947 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001948 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1949 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1950 "tools/sk_app/ios/Window_ios.cpp",
1951 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001952 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001953 }
1954
1955 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001956 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001957 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001958 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001959 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001960 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001961 libs += [ "X11-xcb" ]
1962 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001963 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001964 }
1965 }
1966
Brian Osman16adfa32016-10-18 14:42:44 -04001967 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001968 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001969 ":skia",
1970 ":tool_utils",
1971 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001972 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001973 if (is_android) {
1974 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001975 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001976 deps += [ "//third_party/libsdl" ]
1977 }
Brian Salomon194db172017-08-17 14:37:06 -04001978 if (skia_use_angle) {
1979 deps += [ "//third_party/angle2" ]
1980 }
Mike Kleina92c3832016-12-08 09:49:39 -05001981 }
Brian Osman16adfa32016-10-18 14:42:44 -04001982 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001983
Brian Osmaneff04b52017-11-21 13:18:02 -05001984 if (skia_enable_gpu) {
1985 test_app("viewer") {
1986 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001987 if (is_ios) {
1988 bundle_ios_data = true
1989 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001990 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07001991 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001992 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001993 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001994 "tools/viewer/ImageSlide.cpp",
1995 "tools/viewer/SKPSlide.cpp",
1996 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001997 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05001998 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001999 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002000 "tools/viewer/Viewer.cpp",
2001 ]
2002 libs = []
2003
2004 include_dirs = []
2005 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05002006 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05002007 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05002008 ":flags",
2009 ":gm",
2010 ":gpu_tool_utils",
2011 ":samples",
2012 ":sk_app",
2013 ":skia",
2014 ":tool_utils",
2015 ":views",
2016 "//third_party/imgui",
2017 "//third_party/jsoncpp",
2018 ]
2019 }
2020 }
2021
2022 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2023 test_app("HelloWorld") {
2024 sources = [
2025 "example/HelloWorld.cpp",
2026 ]
2027 libs = []
2028
2029 include_dirs = []
2030 deps = [
2031 ":flags",
2032 ":gpu_tool_utils",
2033 ":sk_app",
2034 ":skia",
2035 ":tool_utils",
2036 ":views",
2037 ]
2038 }
2039 }
2040
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002041 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002042 test_app("SkiaSDLExample") {
2043 sources = [
2044 "example/SkiaSDLExample.cpp",
2045 ]
2046 libs = []
2047 include_dirs = []
2048 deps = [
2049 ":gpu_tool_utils",
2050 ":skia",
2051 "//third_party/libsdl",
2052 ]
2053 }
2054 }
2055
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002056 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2057 action_foreach("generate_mocs") {
2058 script = "gn/call.py"
2059 sources = [
2060 "tools/mdbviz/MainWindow.h",
2061 ]
2062 outputs = [
2063 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2064 ]
2065 args = [
2066 "$skia_qt_path" + "/bin/moc",
2067 "{{source}}",
2068 "-o",
2069 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2070 ]
2071 }
2072 action_foreach("generate_resources") {
2073 script = "gn/call.py"
2074 sources = [
2075 "tools/mdbviz/resources.qrc",
2076 ]
2077 outputs = [
2078 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2079 ]
2080 args = [
2081 "$skia_qt_path" + "/bin/rcc",
2082 "{{source}}",
2083 "-o",
2084 "gen/mdbviz/{{source_name_part}}_res.cpp",
2085 ]
2086 }
2087 test_app("mdbviz") {
2088 if (is_win) {
2089 # on Windows we need to disable some exception handling warnings due to the Qt headers
2090 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2091 }
2092 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002093 "tools/UrlDataManager.cpp",
2094 "tools/debugger/SkDebugCanvas.cpp",
2095 "tools/debugger/SkDrawCommand.cpp",
2096 "tools/debugger/SkJsonWriteBuffer.cpp",
2097 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002098 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002099 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002100 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002101 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002102
2103 # generated files
2104 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2105 "$target_gen_dir/mdbviz/resources_res.cpp",
2106 ]
2107 lib_dirs = [ "$skia_qt_path/lib" ]
2108 libs = [
2109 "Qt5Core.lib",
2110 "Qt5Gui.lib",
2111 "Qt5Widgets.lib",
2112 ]
2113 include_dirs = [
2114 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002115 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002116 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002117 "tools",
2118 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002119 ]
2120 deps = [
2121 ":generate_mocs",
2122 ":generate_resources",
2123 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002124 "//third_party/jsoncpp",
2125 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002126 ]
2127 }
2128 }
2129
Mike Kleine459afd2017-03-03 09:21:30 -05002130 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002131 copy("gdbserver") {
2132 sources = [
2133 "$ndk/$ndk_gdbserver",
2134 ]
2135 outputs = [
2136 "$root_out_dir/gdbserver",
2137 ]
2138 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002139 }
mtklein25c81d42016-07-27 13:55:26 -07002140}