blob: 30af60093e651c0ec59d2af27dd3250743556fa7 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Mike Kleinfb333552018-01-25 12:49:37 -050033 skia_use_skcms = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050045 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040046 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
51 skia_jumper_clang = ""
52 skia_jumper_objdump = ""
53 skia_jumper_ccache = ""
Hal Canary4689b542018-01-31 11:54:14 -050054
55 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050056 skia_skqp_global_error_tolerance = 0
mtkleinc04ff472016-06-23 10:29:30 -070057}
Brian Salomon23d73ea2016-10-27 13:31:37 -040058declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040059 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040060 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050061 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040062
Mike Klein4d598a32016-10-31 13:44:49 -040063 if (is_android) {
64 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070065 } else if (is_fuchsia) {
66 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040067 } else {
68 skia_use_vulkan = skia_vulkan_sdk != ""
69 }
Jim Van Verth4e502972017-12-07 15:16:10 -050070
71 if (is_ios) {
72 skia_ios_identity = ".*Google.*"
73 skia_ios_profile = "Google Development"
74 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040075}
Greg Danielec6ae522017-04-25 13:38:26 -040076declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050077 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040078 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000079 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040080 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050081 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040082 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050083 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040084 }
Greg Danielec6ae522017-04-25 13:38:26 -040085 }
86}
Brian Salomon789e25e2016-09-30 13:41:03 -040087
Adam Barth54ef74a2017-10-13 10:59:38 -070088if (defined(skia_settings)) {
89 import(skia_settings)
90}
91
mtklein38925aa2016-09-21 10:11:25 -070092# Our tools require static linking (they use non-exported symbols).
93skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070094
mtkleina45be612016-08-29 15:22:10 -070095fontmgr_android_enabled = skia_use_expat && skia_use_freetype
96
mtklein1211e0c2016-07-26 13:55:45 -070097skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070098 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070099 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/codec",
101 "include/config",
102 "include/core",
103 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400104 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "include/gpu",
106 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500107 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700108 "include/pathops",
109 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700110 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700111 "include/utils",
112 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700113]
114
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000115if (skia_use_vulkan) {
116 skia_public_includes += [ "include/gpu/vk" ]
117}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500118if (skia_enable_atlas_text) {
119 skia_public_includes += [ "include/atlastext" ]
120}
Greg Daniele5ddff52017-07-05 16:49:36 -0400121if (skia_use_metal) {
122 skia_public_includes += [ "include/gpu/mtl" ]
123}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000124
mtkleinc04ff472016-06-23 10:29:30 -0700125# Skia public API, generally provided by :skia.
126config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700127 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500128 if (skia_tools_vulkan_header_dir != "") {
129 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400130 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400131 defines = []
132 if (is_component_build) {
133 defines += [ "SKIA_DLL" ]
134 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400135 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700136 defines += [ "SK_SAMPLES_FOR_X" ]
137 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400138 if (skia_enable_flutter_defines) {
139 defines += flutter_defines
140 }
mtklein06c35c02016-09-20 12:28:12 -0700141 if (!skia_enable_gpu) {
142 defines += [ "SK_SUPPORT_GPU=0" ]
143 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500144 if (skia_enable_atlas_text) {
145 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
146 }
mtkleinc04ff472016-06-23 10:29:30 -0700147}
148
149# Skia internal APIs, used by Skia itself and a few test tools.
150config("skia_private") {
151 visibility = [ ":*" ]
152
153 include_dirs = [
154 "include/private",
155 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700156 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700157 "src/core",
158 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700159 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/image",
161 "src/images",
162 "src/lazy",
163 "src/opts",
164 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700165 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700166 "src/ports",
167 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400168 "src/shaders",
169 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700170 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700171 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700172 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500173 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700174 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700175 ]
mtklein150d1132016-08-01 06:56:40 -0700176
Mike Reeda9e241d2017-05-03 10:52:00 -0400177 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700178 if (is_android) {
179 defines += [
180 "SK_GAMMA_EXPONENT=1.4",
181 "SK_GAMMA_CONTRAST=0.0",
182 ]
183 }
mtklein88a7ac02016-09-14 11:16:49 -0700184 if (is_official_build || is_android) {
185 # TODO(bsalomon): it'd be nice to make Android normal.
186 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
187 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400188 libs = []
189 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500190 if (skia_enable_gpu) {
191 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500192 if (is_skia_dev_build && skia_use_vulkan) {
193 include_dirs += [ "tools/gpu/vk" ]
194 }
Brian Salomon03e05842017-02-23 12:23:47 -0500195 }
Brian Osman34755e22016-12-05 09:46:02 -0500196 if (skia_use_angle) {
197 defines += [ "SK_ANGLE" ]
198 }
Brian Osman3f375d02016-12-28 11:19:22 -0500199 if (skia_enable_discrete_gpu) {
200 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
201 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400202 if (!is_official_build) {
203 defines += [ "GR_TEST_UTILS=1" ]
204 }
mtkleinc04ff472016-06-23 10:29:30 -0700205}
206
207# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
208config("skia_library") {
209 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700210 defines = [ "SKIA_IMPLEMENTATION=1" ]
211}
212
213skia_library_configs = [
214 ":skia_public",
215 ":skia_private",
216 ":skia_library",
217]
218
mtklein9b8583d2016-08-24 17:32:30 -0700219# Use for CPU-specific Skia code that needs particular compiler flags.
220template("opts") {
221 if (invoker.enabled) {
222 source_set(target_name) {
223 forward_variables_from(invoker, "*")
224 configs += skia_library_configs
225 }
226 } else {
227 # If not enabled, a phony empty target that swallows all otherwise unused variables.
228 source_set(target_name) {
229 forward_variables_from(invoker,
230 "*",
231 [
232 "sources",
233 "cflags",
234 ])
235 }
236 }
anmittala7eaf2e2016-08-17 13:57:26 -0700237}
238
mtklein422310d2016-08-16 18:28:43 -0700239is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700240
mtklein7d6fb2c2016-08-25 14:50:44 -0700241opts("none") {
242 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700244 cflags = []
245}
246
mtklein7d6fb2c2016-08-25 14:50:44 -0700247opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700248 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700250 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700251}
252
253opts("arm64") {
254 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700255 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700256 cflags = []
257}
258
259opts("crc32") {
260 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700261 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700262 cflags = [ "-march=armv8-a+crc" ]
263}
264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("sse2") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-msse2" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtkleinc04ff472016-06-23 10:29:30 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("ssse3") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.ssse3_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_SSSE3" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-mssse3" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtkleinc04ff472016-06-23 10:29:30 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("sse41") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.sse41_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_SSE41" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-msse4.1" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
mtklein4e976072016-08-08 09:06:27 -0700294
mtklein9b8583d2016-08-24 17:32:30 -0700295opts("sse42") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.sse42_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_SSE42" ]
300 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400301 cflags = [ "-msse4.2" ]
302 }
mtklein9b8583d2016-08-24 17:32:30 -0700303}
304
305opts("avx") {
306 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700307 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400308 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000309 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400310 } else {
311 cflags = [ "-mavx" ]
312 }
mtkleinc04ff472016-06-23 10:29:30 -0700313}
314
mtkleinc095df52016-08-24 12:23:52 -0700315# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700316template("optional") {
317 if (invoker.enabled) {
318 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700319 if (defined(invoker.public_defines)) {
320 defines = invoker.public_defines
321 }
mtklein457b42a2016-08-23 13:56:37 -0700322 }
323 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700324 forward_variables_from(invoker,
325 "*",
326 [
327 "public_defines",
328 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700329 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700330 ])
mtklein457b42a2016-08-23 13:56:37 -0700331 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700332 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700333 if (defined(invoker.configs_to_remove)) {
334 configs -= invoker.configs_to_remove
335 }
mtklein457b42a2016-08-23 13:56:37 -0700336 }
337 } else {
mtklein457b42a2016-08-23 13:56:37 -0700338 source_set(target_name) {
339 forward_variables_from(invoker,
340 "*",
341 [
342 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700343 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700344 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700345 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700346 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700347 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700348 ])
mtkleincd01b032016-08-31 04:58:19 -0700349 if (defined(invoker.sources_when_disabled)) {
350 sources = invoker.sources_when_disabled
351 }
352 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700353 }
mtkleineb3c4252016-08-23 07:38:09 -0700354 }
mtklein457b42a2016-08-23 13:56:37 -0700355}
mtklein457b42a2016-08-23 13:56:37 -0700356
Mike Kleina04bb452017-02-09 12:24:07 -0500357optional("effects") {
358 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400359 deps = [
360 ":compile_processors",
361 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500362 sources =
363 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
364 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
365}
366
mtkleina45be612016-08-29 15:22:10 -0700367optional("fontmgr_android") {
368 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700369
370 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500371 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700372 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700373 ]
374 sources = [
375 "src/ports/SkFontMgr_android.cpp",
376 "src/ports/SkFontMgr_android_factory.cpp",
377 "src/ports/SkFontMgr_android_parser.cpp",
378 ]
379}
380
mtkleind2e39db2016-09-07 07:52:55 -0700381optional("fontmgr_custom") {
382 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
383
384 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500385 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700386 ]
387 sources = [
388 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500389 "src/ports/SkFontMgr_custom.h",
390 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700391 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500392 "src/ports/SkFontMgr_custom_embedded.cpp",
393 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700394 ]
395}
396
Hal Canaryff2742e2018-01-30 11:35:47 -0500397optional("fontmgr_empty") {
398 enabled = skia_enable_fontmgr_empty
399 sources = [
400 "src/ports/SkFontMgr_empty_factory.cpp",
401 ]
402}
403
mtklein3cc22182016-08-29 13:26:14 -0700404optional("fontmgr_fontconfig") {
405 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700406
407 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500408 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700409 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700410 ]
411 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700412 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700413 "src/ports/SkFontConfigInterface_direct.cpp",
414 "src/ports/SkFontConfigInterface_direct_factory.cpp",
415 "src/ports/SkFontMgr_FontConfigInterface.cpp",
416 "src/ports/SkFontMgr_fontconfig.cpp",
417 "src/ports/SkFontMgr_fontconfig_factory.cpp",
418 ]
419}
420
mtkleincdedd0e2016-09-12 15:15:44 -0700421optional("fontmgr_fuchsia") {
422 enabled = is_fuchsia && skia_use_freetype
423
424 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500425 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700426 ]
427 sources = [
428 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500429 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700430 "src/ports/SkFontMgr_custom_empty_factory.cpp",
431 ]
432}
433
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700434if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400435 executable("sksllex") {
436 sources = [
437 "src/sksl/lex/Main.cpp",
438 "src/sksl/lex/NFA.cpp",
439 "src/sksl/lex/RegexNode.cpp",
440 "src/sksl/lex/RegexParser.cpp",
441 ]
442 include_dirs = [ "src/sksl/lex" ]
443 }
444
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700445 action("run_sksllex") {
446 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400447 deps = [
448 ":sksllex(//gn/toolchain:$host_toolchain)",
449 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700450 sources = [
451 "src/sksl/lex/layout.lex",
452 "src/sksl/lex/sksl.lex",
453 ]
454
455 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
456 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
457 outputs = [
458 "$target_out_dir/" +
459 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
460 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
461 # confused due to the same file being named by two different paths
462 ]
463 sksllex_path = "$root_out_dir/"
464 sksllex_path += "sksllex"
465 if (host_os == "win") {
466 sksllex_path += ".exe"
467 }
468 args = [
469 rebase_path(sksllex_path),
470 rebase_path("bin/clang-format"),
471 rebase_path("src"),
472 ]
473 }
474} else {
475 group("run_sksllex") {
476 }
477}
478
479if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400480 executable("skslc") {
481 defines = [ "SKSL_STANDALONE" ]
482 sources = [
483 "src/sksl/SkSLMain.cpp",
484 ]
485 sources += skia_sksl_sources
486 include_dirs = [
487 "src/gpu",
488 "src/sksl",
489 ]
490 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500491 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400492 "//third_party/spirv-tools",
493 ]
494 }
495
496 skia_gpu_processor_outputs = []
497 foreach(src, skia_gpu_processor_sources) {
498 dir = get_path_info(src, "dir")
499 name = get_path_info(src, "name")
500
501 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
502 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
503 skia_gpu_processor_outputs += [
504 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
505 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
506 # confused due to the same file being named by two different paths
507 ]
508 }
509
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500510 action("create_sksl_enums") {
511 script = "gn/create_sksl_enums.py"
512 sources = [
513 "include/private/GrSharedEnums.h",
514 ]
515 outputs = [
516 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500517 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500518 ]
519 args = [
520 rebase_path(sources[0]),
521 rebase_path(outputs[0]),
522 ]
523 }
524
Ethan Nicholas762466e2017-06-29 10:03:38 -0400525 action("compile_processors") {
526 script = "gn/compile_processors.py"
527 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500528 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400529 ":skslc(//gn/toolchain:$host_toolchain)",
530 ]
531 sources = skia_gpu_processor_sources
532 outputs = skia_gpu_processor_outputs
533 skslc_path = "$root_out_dir/"
534 if (host_toolchain != default_toolchain_name) {
535 skslc_path += "$host_toolchain/"
536 }
537 skslc_path += "skslc"
538 if (host_os == "win") {
539 skslc_path += ".exe"
540 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400541 args = [
542 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400543 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400544 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 args += rebase_path(skia_gpu_processor_sources)
546 }
547} else {
548 skia_gpu_processor_outputs = []
549 group("compile_processors") {
550 }
551}
552
mtklein06c35c02016-09-20 12:28:12 -0700553optional("gpu") {
554 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400555 deps = [
556 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700557 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400558 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700559 public_defines = []
560
Brian Salomon3d6801e2017-12-11 10:06:31 -0500561 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700562
563 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500564 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700565 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400566 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700567 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500568 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400569
570 # this lib is required to link against AHardwareBuffer
571 if (defined(ndk_api) && ndk_api >= 26) {
572 libs += [ "android" ]
573 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400574 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500575 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400576 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700577 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500578 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500579 libs += [
580 "GL",
581 "GLU",
582 ]
mtklein06c35c02016-09-20 12:28:12 -0700583 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500584 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800585 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400587 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500588 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400589 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700590 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500591 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700592 }
mtkleine9fb3d52016-09-20 15:11:46 -0700593
594 if (skia_use_vulkan) {
595 public_defines += [ "SK_VULKAN" ]
596 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700597 if (skia_enable_vulkan_debug_layers) {
598 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
599 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500600 if (skia_vulkan_header != "") {
601 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
602 } else {
603 if (is_skia_dev_build) {
604 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
605 }
606 }
mtkleine9fb3d52016-09-20 15:11:46 -0700607 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400608 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400609 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400610 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
611 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400612
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400613 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400614 if (skia_use_metal) {
615 public_defines += [ "SK_METAL" ]
616 sources += skia_metal_sources
617 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400618 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400619 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500620
621 if (skia_enable_atlas_text) {
622 sources += skia_atlas_text_sources
623 }
mtklein06c35c02016-09-20 12:28:12 -0700624}
625
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400626optional("heif") {
627 enabled = skia_use_libheif
628 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
629
630 deps = []
631
632 sources = [
633 "src/codec/SkHeifCodec.cpp",
634 ]
635}
636
mtklein63213812016-08-24 09:55:56 -0700637optional("jpeg") {
638 enabled = skia_use_libjpeg_turbo
639 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
640
mtklein63213812016-08-24 09:55:56 -0700641 deps = [
642 "//third_party/libjpeg-turbo:libjpeg",
643 ]
644 sources = [
645 "src/codec/SkJpegCodec.cpp",
646 "src/codec/SkJpegDecoderMgr.cpp",
647 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700648 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400649 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700650 ]
651}
652
653optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500654 enabled = skia_use_zlib && skia_enable_pdf
655 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700656
mtklein63213812016-08-24 09:55:56 -0700657 deps = [
658 "//third_party/zlib",
659 ]
brettwb9447282016-09-01 14:24:39 -0700660 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700661 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700662
663 if (skia_use_sfntly) {
664 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500665 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700666 }
667}
668
669optional("png") {
670 enabled = skia_use_libpng
671 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
672
mtklein63213812016-08-24 09:55:56 -0700673 deps = [
674 "//third_party/libpng",
675 ]
676 sources = [
677 "src/codec/SkIcoCodec.cpp",
678 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400679 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700680 ]
681}
682
scroggof84ad642016-10-31 09:02:57 -0700683optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400684 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700685 public_defines = [ "SK_CODEC_DECODES_RAW" ]
686
687 deps = [
688 "//third_party/dng_sdk",
689 "//third_party/libjpeg-turbo:libjpeg",
690 "//third_party/piex",
691 ]
692
693 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
694 # Skia.
695 configs_to_remove = [ "//gn:no_exceptions" ]
696
697 sources = [
698 "src/codec/SkRawAdapterCodec.cpp",
699 "src/codec/SkRawCodec.cpp",
700 ]
701}
702
Mike Kleinfb333552018-01-25 12:49:37 -0500703optional("skcms") {
704 enabled = skia_use_skcms
705
706 deps = [
707 "//third_party/skcms",
708 ]
709 sources = [
710 # TODO
711 ]
712}
713
mtklein3cc22182016-08-29 13:26:14 -0700714optional("typeface_freetype") {
715 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700716
717 deps = [
718 "//third_party/freetype2",
719 ]
720 sources = [
721 "src/ports/SkFontHost_FreeType.cpp",
722 "src/ports/SkFontHost_FreeType_common.cpp",
723 ]
724}
725
mtklein457b42a2016-08-23 13:56:37 -0700726optional("webp") {
727 enabled = skia_use_libwebp
728 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
729
mtklein457b42a2016-08-23 13:56:37 -0700730 deps = [
731 "//third_party/libwebp",
732 ]
733 sources = [
734 "src/codec/SkWebpAdapterCodec.cpp",
735 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400736 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700737 ]
mtkleineb3c4252016-08-23 07:38:09 -0700738}
739
mtklein63213812016-08-24 09:55:56 -0700740optional("xml") {
741 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000742 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700743
mtklein63213812016-08-24 09:55:56 -0700744 deps = [
745 "//third_party/expat",
746 ]
747 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500748 "src/svg/SkSVGCanvas.cpp",
749 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700750 "src/xml/SkDOM.cpp",
751 "src/xml/SkXMLParser.cpp",
752 "src/xml/SkXMLWriter.cpp",
753 ]
754}
755
mtkleinc04ff472016-06-23 10:29:30 -0700756component("skia") {
757 public_configs = [ ":skia_public" ]
758 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700759
760 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700761 ":arm64",
762 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700763 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700764 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500765 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700766 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700767 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500768 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700769 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700770 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700771 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400772 ":heif",
mtklein63213812016-08-24 09:55:56 -0700773 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700774 ":none",
mtklein63213812016-08-24 09:55:56 -0700775 ":pdf",
776 ":png",
scroggof84ad642016-10-31 09:02:57 -0700777 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500778 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700779 ":sse2",
780 ":sse41",
781 ":sse42",
782 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700783 ":webp",
mtklein63213812016-08-24 09:55:56 -0700784 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700785 ]
786
Chinmay Garde43f115c2016-11-16 15:04:12 -0800787 # This file (and all GN files in Skia) are designed to work with an
788 # empty sources assignment filter; we handle all that explicitly.
789 # We clear the filter here for clients who may have set up a global filter.
790 set_sources_assignment_filter([])
791
mtkleinc04ff472016-06-23 10:29:30 -0700792 sources = []
brettwb9447282016-09-01 14:24:39 -0700793 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700794 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500795 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700796 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400797 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500798 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700799 "src/android/SkBitmapRegionCodec.cpp",
800 "src/android/SkBitmapRegionDecoder.cpp",
801 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400802 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700803 "src/codec/SkBmpCodec.cpp",
804 "src/codec/SkBmpMaskCodec.cpp",
805 "src/codec/SkBmpRLECodec.cpp",
806 "src/codec/SkBmpStandardCodec.cpp",
807 "src/codec/SkCodec.cpp",
808 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700809 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700810 "src/codec/SkMaskSwizzler.cpp",
811 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700812 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700813 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700814 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700815 "src/codec/SkSwizzler.cpp",
816 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700817 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700818 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700819 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700820 "src/ports/SkMemory_malloc.cpp",
821 "src/ports/SkOSFile_stdio.cpp",
822 "src/sfnt/SkOTTable_name.cpp",
823 "src/sfnt/SkOTUtils.cpp",
824 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700825 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700826 ]
brettwb9447282016-09-01 14:24:39 -0700827
mtklein7d6fb2c2016-08-25 14:50:44 -0700828 libs = []
829
mtkleinc04ff472016-06-23 10:29:30 -0700830 if (is_win) {
831 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400832 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700833 "src/ports/SkDebug_win.cpp",
834 "src/ports/SkFontHost_win.cpp",
835 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500836 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700837 "src/ports/SkImageEncoder_WIC.cpp",
838 "src/ports/SkImageGeneratorWIC.cpp",
839 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700840 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700841 "src/ports/SkScalerContext_win_dw.cpp",
842 "src/ports/SkTLS_win.cpp",
843 "src/ports/SkTypeface_win_dw.cpp",
844 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400845 libs += [
846 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500847 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400848 "Ole32.lib",
849 "OleAut32.lib",
850 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500851 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400852 ]
mtkleinc04ff472016-06-23 10:29:30 -0700853 } else {
854 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700855 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700856 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700857 "src/ports/SkTLS_pthread.cpp",
858 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400859 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700860 }
861
mtklein7d6fb2c2016-08-25 14:50:44 -0700862 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500863 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500864 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500865 deps += [ "//third_party/cpu-features" ]
866 }
mtklein06c35c02016-09-20 12:28:12 -0700867 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700868 libs += [
869 "EGL",
870 "GLESv2",
871 "log",
872 ]
873 }
874
mtkleinc04ff472016-06-23 10:29:30 -0700875 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700876 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700877 }
878
879 if (is_mac) {
880 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700881 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700882 "src/ports/SkFontHost_mac.cpp",
883 "src/ports/SkImageEncoder_CG.cpp",
884 "src/ports/SkImageGeneratorCG.cpp",
885 ]
mtklein09e61f72016-08-23 13:35:28 -0700886 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400887 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
888 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700889 "ApplicationServices.framework",
890 "OpenGL.framework",
891 ]
mtkleinc04ff472016-06-23 10:29:30 -0700892 }
abarth6fc8ff02016-07-15 15:15:15 -0700893
Mike Klein7d302882016-11-03 14:06:31 -0400894 if (is_ios) {
895 sources += [
896 "src/ports/SkDebug_stdio.cpp",
897 "src/ports/SkFontHost_mac.cpp",
898 "src/ports/SkImageEncoder_CG.cpp",
899 "src/ports/SkImageGeneratorCG.cpp",
900 ]
901 libs += [
902 "CoreFoundation.framework",
903 "CoreGraphics.framework",
904 "CoreText.framework",
905 "ImageIO.framework",
906 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400907
908 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
909 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400910 ]
911 }
912
abarth6fc8ff02016-07-15 15:15:15 -0700913 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700914 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700915 }
mtkleinc04ff472016-06-23 10:29:30 -0700916}
917
mtkleinc095df52016-08-24 12:23:52 -0700918# Targets guarded by skia_enable_tools may use //third_party freely.
919if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500920 # Used by gn_to_bp.py to list our public include dirs.
921 source_set("public") {
922 configs += [ ":skia_public" ]
923 }
924
Mike Kleinc36dedf2016-11-18 09:35:28 -0500925 config("skia.h_config") {
926 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500927 if (skia_use_vulkan) {
928 # So we can get the header which includes vulkan
929 include_dirs += [ "tools/gpu/vk" ]
930 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500931 }
932 action("skia.h") {
933 public_configs = [ ":skia.h_config" ]
934 skia_h = "$target_gen_dir/skia.h"
935 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400936 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000937 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500938 depfile = "$skia_h.deps"
939 outputs = [
940 skia_h,
941 ]
942 }
943
944 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500945 executable("fiddle") {
946 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500947 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500948 "tools/fiddle/draw.cpp",
949 "tools/fiddle/fiddle_main.cpp",
950 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400951
952 if (skia_use_egl) {
953 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400954 } else {
955 sources += [ "tools/fiddle/null_context.cpp" ]
956 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400957 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500958 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400959 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500960 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500961 ":skia",
962 ":skia.h",
963 ]
964 }
965 }
966
967 if (skia_enable_gpu) {
968 source_set("public_headers_warnings_check") {
969 sources = [
970 "tools/public_headers_warnings_check.cpp",
971 ]
972 configs -= [ "//gn:warnings_except_public_headers" ]
973 deps = [
974 ":skia",
975 ":skia.h",
976 ]
977 }
978 }
979
mtkleinc095df52016-08-24 12:23:52 -0700980 template("test_lib") {
981 config(target_name + "_config") {
982 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700983 if (defined(invoker.public_defines)) {
984 defines = invoker.public_defines
985 }
mtklein25c81d42016-07-27 13:55:26 -0700986 }
mtkleinc095df52016-08-24 12:23:52 -0700987 source_set(target_name) {
988 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
989 public_configs = [
990 ":" + target_name + "_config",
991 ":skia_private",
992 ]
993
994 if (!defined(deps)) {
995 deps = []
996 }
997 deps += [ ":skia" ]
998 testonly = true
999 }
mtklein25c81d42016-07-27 13:55:26 -07001000 }
mtklein25c81d42016-07-27 13:55:26 -07001001
Mike Kleine6682eb2017-01-05 10:54:57 -05001002 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001003 if (is_ios) {
1004 app_name = target_name
1005 gen_path = target_gen_dir
1006
1007 action("${app_name}_generate_info_plist") {
1008 script = "//gn/gen_plist_ios.py"
1009 outputs = [
1010 "$gen_path/${app_name}_Info.plist",
1011 ]
1012 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1013 }
1014
1015 bundle_data("${app_name}_bundle_info_plist") {
1016 public_deps = [
1017 ":${app_name}_generate_info_plist",
1018 ]
1019 sources = [
1020 "$gen_path/${app_name}_Info.plist",
1021 ]
1022 outputs = [
1023 "{{bundle_root_dir}}/Info.plist",
1024 ]
1025 }
1026
Jim Van Verth329c5a62017-11-29 11:42:33 -05001027 bundle_ios_data =
1028 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1029
1030 if (bundle_ios_data) {
1031 has_skps =
1032 "True" == exec_script("//gn/checkdir.py",
1033 [ rebase_path("skps", root_build_dir) ],
1034 "trim string")
1035 bundle_data("${app_name}_bundle_resources") {
1036 sources = [
1037 "resources",
1038 ]
1039 outputs = [
1040 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1041 "{{bundle_resources_dir}}/data/resources",
1042 ]
1043 }
1044
1045 if (has_skps) {
1046 bundle_data("${app_name}_bundle_skps") {
1047 sources = [
1048 "skps",
1049 ]
1050 outputs = [
1051 # Store in same folder as resources
1052 "{{bundle_resources_dir}}/data/skps",
1053 ]
1054 }
1055 }
1056 }
1057
Jim Van Verth443a9132017-11-28 09:45:26 -05001058 executable("${app_name}_generate_executable") {
1059 forward_variables_from(invoker,
1060 "*",
1061 [
1062 "output_name",
1063 "visibility",
1064 "is_shared_library",
1065 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001066 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001067 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001068 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1069 }
1070
1071 bundle_data("${app_name}_bundle_executable") {
1072 public_deps = [
1073 ":${app_name}_generate_executable",
1074 ]
1075 sources = [
1076 "$gen_path/$app_name",
1077 ]
1078 outputs = [
1079 "{{bundle_executable_dir}}/$app_name",
1080 ]
1081 testonly = true
1082 }
1083
1084 create_bundle("$app_name") {
1085 product_type = "com.apple.product-type.application"
1086 testonly = true
1087
1088 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1089 bundle_resources_dir = bundle_root_dir
1090 bundle_executable_dir = bundle_root_dir
1091 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1092
1093 deps = [
1094 ":${app_name}_bundle_executable",
1095 ":${app_name}_bundle_info_plist",
1096 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001097 if (bundle_ios_data) {
1098 deps += [ ":${app_name}_bundle_resources" ]
1099 if (has_skps) {
1100 deps += [ ":${app_name}_bundle_skps" ]
1101 }
1102 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001103
1104 # should only code sign when running on a device, not the simulator
1105 if (target_cpu != "x64") {
1106 code_signing_script = "//gn/codesign_ios.py"
1107 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1108 code_signing_outputs = [
1109 "$bundle_root_dir/_CodeSignature/CodeResources",
1110 "$bundle_root_dir/embedded.mobileprovision",
1111 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001112 code_signing_args = [
1113 rebase_path("$bundle_root_dir", root_build_dir),
1114 skia_ios_identity,
1115 skia_ios_profile,
1116 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001117 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001118 }
1119 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001120 # !is_ios
1121
1122 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1123 shared_library("lib" + target_name) {
1124 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1125 configs += [ ":skia_private" ]
1126 testonly = true
1127 }
1128 } else {
1129 _executable = target_name
1130 executable(_executable) {
1131 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1132 configs += [ ":skia_private" ]
1133 testonly = true
1134 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001135 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001136 if (is_android && skia_android_serial != "" && defined(_executable)) {
1137 action("push_" + target_name) {
1138 script = "gn/push_to_android.py"
1139 deps = [
1140 ":" + _executable,
1141 ]
1142 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1143 outputs = [
1144 _stamp,
1145 ]
1146 args = [
1147 rebase_path("$root_build_dir/$_executable"),
1148 skia_android_serial,
1149 rebase_path(_stamp),
1150 ]
1151 testonly = true
1152 }
Mike Klein7d921032017-01-05 12:20:41 -05001153 }
1154 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001155 }
1156
mtkleinc095df52016-08-24 12:23:52 -07001157 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001158 public_include_dirs = []
1159 if (skia_enable_gpu) {
1160 public_defines = []
1161 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001162
1163 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001164 sources = [
1165 "tools/gpu/GrContextFactory.cpp",
1166 "tools/gpu/GrTest.cpp",
1167 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001168 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001169 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001170 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001171 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1172 "tools/gpu/gl/debug/GrBufferObj.cpp",
1173 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1174 "tools/gpu/gl/debug/GrProgramObj.cpp",
1175 "tools/gpu/gl/debug/GrShaderObj.cpp",
1176 "tools/gpu/gl/debug/GrTextureObj.cpp",
1177 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1178 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001179 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001180 ]
1181 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001182
Kevin Lubick4a24e102017-03-29 11:19:01 -04001183 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001184 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001185 } else if (is_ios) {
1186 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1187 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001188 } else if (is_linux) {
1189 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001190 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001191 } else if (is_mac) {
1192 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001193 } else if (is_win) {
1194 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1195 libs += [
1196 "Gdi32.lib",
1197 "OpenGL32.lib",
1198 ]
mtklein38925aa2016-09-21 10:11:25 -07001199 }
mtklein6ef69992016-09-14 06:12:09 -07001200
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001201 cflags_objcc = [ "-fobjc-arc" ]
1202
Mike Kleinc168a3a2016-11-14 14:53:13 +00001203 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001204 deps += [ "//third_party/angle2" ]
1205 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1206 }
mtkleind68f9b02016-09-23 13:18:41 -07001207 if (skia_use_vulkan) {
1208 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001209 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001210 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001211 if (skia_use_metal) {
1212 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1213 }
mtkleina627b5c2016-09-20 13:36:47 -07001214 }
mtklein25c81d42016-07-27 13:55:26 -07001215 }
mtklein25c81d42016-07-27 13:55:26 -07001216
mtkleinc095df52016-08-24 12:23:52 -07001217 test_lib("flags") {
1218 public_include_dirs = [ "tools/flags" ]
1219 sources = [
1220 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001221 ]
1222 }
1223 test_lib("common_flags") {
1224 public_include_dirs = [ "tools/flags" ]
1225 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001226 "tools/flags/SkCommonFlags.cpp",
1227 "tools/flags/SkCommonFlagsConfig.cpp",
1228 ]
1229 deps = [
mtklein046cb562016-09-16 10:23:12 -07001230 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001231 ":gpu_tool_utils",
1232 ]
1233 }
mtklein25c81d42016-07-27 13:55:26 -07001234
mtkleinc095df52016-08-24 12:23:52 -07001235 test_lib("tool_utils") {
1236 public_include_dirs = [
1237 "tools",
1238 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001239 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001240 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001241 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001242 ]
1243 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001244 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001245 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001246 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001247 "tools/ProcStats.cpp",
1248 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001249 "tools/UrlDataManager.cpp",
1250 "tools/debugger/SkDebugCanvas.cpp",
1251 "tools/debugger/SkDrawCommand.cpp",
1252 "tools/debugger/SkJsonWriteBuffer.cpp",
1253 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001254 "tools/picture_utils.cpp",
1255 "tools/random_parse_path.cpp",
1256 "tools/sk_tool_utils.cpp",
Ben Wagner483c7722018-02-20 17:06:07 -05001257 "tools/fonts/sk_tool_utils_font.cpp",
1258 "tools/fonts/SkRandomScalerContext.cpp",
1259 "tools/fonts/SkTestScalerContext.cpp",
1260 "tools/fonts/SkTestFontMgr.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001261 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001262 "tools/trace/SkChromeTracingTracer.cpp",
1263 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001264 "tools/trace/SkDebugfTracer.cpp",
1265 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001266 "tools/trace/SkEventTracingPriv.cpp",
1267 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001268 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001269 libs = []
1270 if (is_ios) {
1271 sources += [ "tools/ios_utils.m" ]
1272 libs += [ "Foundation.framework" ]
1273 }
mtkleinc095df52016-08-24 12:23:52 -07001274 deps = [
mtklein046cb562016-09-16 10:23:12 -07001275 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001276 ":flags",
1277 "//third_party/libpng",
1278 ]
1279 public_deps = [
1280 "//third_party/jsoncpp",
1281 ]
1282 }
mtklein25c81d42016-07-27 13:55:26 -07001283
Mike Klein6e744122016-10-27 12:21:40 -04001284 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001285 test_lib("gm") {
1286 public_include_dirs = [ "gm" ]
1287 sources = gm_sources
1288 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001289 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001290 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001291 ":gpu_tool_utils",
1292 ":skia",
1293 ":tool_utils",
1294 ]
1295 }
mtklein25c81d42016-07-27 13:55:26 -07001296
Mike Klein6e744122016-10-27 12:21:40 -04001297 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001298 test_lib("tests") {
1299 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001300 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001301 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001302 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001303 }
mtkleinc095df52016-08-24 12:23:52 -07001304 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001305 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001306 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001307 ":skia",
1308 ":tool_utils",
1309 "//third_party/libpng",
1310 "//third_party/zlib",
1311 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001312 if (skia_use_expat) {
1313 deps += [ ":experimental_svg_model" ]
1314 }
Mike Kleind63442d2017-03-27 14:16:04 -04001315 public_deps = [
1316 ":gpu_tool_utils", # Test.h #includes headers from this target.
1317 ]
mtkleinc095df52016-08-24 12:23:52 -07001318 }
mtklein2f3416d2016-08-02 16:02:05 -07001319
Mike Klein6e744122016-10-27 12:21:40 -04001320 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001321 test_lib("bench") {
1322 public_include_dirs = [ "bench" ]
1323 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001324 deps = [
1325 ":flags",
1326 ":gm",
1327 ":gpu_tool_utils",
1328 ":skia",
1329 ":tool_utils",
1330 ]
1331 }
mtklein2b6870c2016-07-28 14:17:33 -07001332
Florin Malita54f65c42018-01-16 17:04:30 -05001333 test_lib("experimental_skottie") {
1334 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001335 include_dirs = [ "tools" ]
1336 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001337 "experimental/skottie/Skottie.cpp",
1338 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001339 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001340 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001341 ]
1342 deps = [
1343 ":experimental_sksg",
1344 ":skia",
1345 "//third_party/jsoncpp",
1346 ]
1347 }
1348
mtkleinc095df52016-08-24 12:23:52 -07001349 test_lib("experimental_svg_model") {
1350 public_include_dirs = [ "experimental/svg/model" ]
1351 sources = [
1352 "experimental/svg/model/SkSVGAttribute.cpp",
1353 "experimental/svg/model/SkSVGAttributeParser.cpp",
1354 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001355 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001356 "experimental/svg/model/SkSVGContainer.cpp",
1357 "experimental/svg/model/SkSVGDOM.cpp",
1358 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001359 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001360 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001361 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001362 "experimental/svg/model/SkSVGNode.cpp",
1363 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001364 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001365 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001366 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001367 "experimental/svg/model/SkSVGRect.cpp",
1368 "experimental/svg/model/SkSVGRenderContext.cpp",
1369 "experimental/svg/model/SkSVGSVG.cpp",
1370 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001371 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001372 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001373 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001374 "experimental/svg/model/SkSVGValue.cpp",
1375 ]
1376 deps = [
1377 ":skia",
1378 ]
1379 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001380
Florin Malita4aa44412017-12-19 12:21:02 -05001381 test_lib("experimental_sksg") {
1382 public_include_dirs = [
1383 "experimental/sksg",
1384 "experimental/sksg/effects",
1385 "experimental/sksg/geometry",
1386 "experimental/sksg/paint",
1387 ]
1388 sources = [
1389 "experimental/sksg/SkSGDraw.cpp",
1390 "experimental/sksg/SkSGEffectNode.cpp",
1391 "experimental/sksg/SkSGGeometryNode.cpp",
1392 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001393 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001394 "experimental/sksg/SkSGInvalidationController.cpp",
1395 "experimental/sksg/SkSGNode.cpp",
1396 "experimental/sksg/SkSGPaintNode.cpp",
1397 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001398 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001399 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001400 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001401 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001402 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001403 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001404 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001405 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001406 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001407 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001408 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001409 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001410 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001411 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001412 ]
1413 deps = [
1414 ":skia",
1415 ]
1416 }
1417
Kevin Lubickebf648e2017-09-21 13:45:16 -04001418 if (target_cpu != "wasm") {
1419 test_lib("views") {
1420 public_include_dirs = [ "include/views" ]
1421 sources = [
1422 "src/views/SkEvent.cpp",
1423 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001424 "src/views/SkTouchGesture.cpp",
1425 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001426 ]
Brian Osman34755e22016-12-05 09:46:02 -05001427 }
Brian Osman16adfa32016-10-18 14:42:44 -04001428 }
1429
Mike Klein38af9432016-11-11 11:39:44 -05001430 if (skia_use_lua) {
1431 test_lib("lua") {
1432 public_include_dirs = []
1433 sources = [
1434 "src/utils/SkLua.cpp",
1435 "src/utils/SkLuaCanvas.cpp",
1436 ]
1437 deps = [
1438 "//third_party/lua",
1439 ]
1440 }
1441
Mike Kleine6682eb2017-01-05 10:54:57 -05001442 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001443 sources = [
1444 "tools/lua/lua_app.cpp",
1445 ]
1446 deps = [
1447 ":lua",
1448 ":skia",
1449 "//third_party/lua",
1450 ]
Mike Klein38af9432016-11-11 11:39:44 -05001451 }
1452
Mike Kleine6682eb2017-01-05 10:54:57 -05001453 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001454 sources = [
1455 "tools/lua/lua_pictures.cpp",
1456 ]
1457 deps = [
1458 ":flags",
1459 ":lua",
1460 ":skia",
1461 ":tool_utils",
1462 "//third_party/lua",
1463 ]
Mike Klein38af9432016-11-11 11:39:44 -05001464 }
1465 }
1466
Cary Clark8032b982017-07-28 11:04:54 -04001467 test_app("bookmaker") {
1468 sources = [
1469 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001470 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001471 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001472 "tools/bookmaker/fiddleParser.cpp",
1473 "tools/bookmaker/includeParser.cpp",
1474 "tools/bookmaker/includeWriter.cpp",
1475 "tools/bookmaker/mdOut.cpp",
1476 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001477 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001478 "tools/bookmaker/spellCheck.cpp",
1479 ]
1480 deps = [
1481 ":flags",
1482 ":skia",
1483 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001484 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001485 ]
1486 }
1487
Kevin Lubickebf648e2017-09-21 13:45:16 -04001488 if (target_cpu != "wasm") {
1489 import("gn/samples.gni")
1490 test_lib("samples") {
1491 public_include_dirs = [ "samplecode" ]
1492 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001493 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001494 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001495 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001496 ":experimental_svg_model",
1497 ":flags",
1498 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001499 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001500 ":tool_utils",
1501 ":views",
1502 ":xml",
1503 ]
Mike Klein38af9432016-11-11 11:39:44 -05001504
Kevin Lubickebf648e2017-09-21 13:45:16 -04001505 if (skia_use_lua) {
1506 sources += [ "samplecode/SampleLua.cpp" ]
1507 deps += [
1508 ":lua",
1509 "//third_party/lua",
1510 ]
1511 }
1512 }
1513 test_app("dm") {
1514 sources = [
1515 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001516 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001517 "dm/DMJsonWriter.cpp",
1518 "dm/DMSrcSink.cpp",
1519 ]
1520 include_dirs = [ "tests" ]
1521 deps = [
1522 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001523 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001524 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001525 ":experimental_svg_model",
1526 ":flags",
1527 ":gm",
1528 ":gpu_tool_utils",
1529 ":skia",
1530 ":tests",
1531 ":tool_utils",
1532 "//third_party/jsoncpp",
1533 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001534 ]
1535 }
Brian Osman16adfa32016-10-18 14:42:44 -04001536 }
1537
Mike Kleina8a51ce2018-01-09 12:34:11 -05001538 if (!is_win) {
1539 test_app("remote_demo") {
1540 sources = [
1541 "tools/remote_demo.cpp",
1542 ]
1543 deps = [
1544 ":skia",
1545 ]
1546 }
1547 }
1548
Mike Kleine6682eb2017-01-05 10:54:57 -05001549 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001550 sources = [
1551 "bench/nanobench.cpp",
1552 ]
1553 deps = [
1554 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001555 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001556 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001557 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001558 ":flags",
1559 ":gm",
1560 ":gpu_tool_utils",
1561 ":skia",
1562 ":tool_utils",
1563 "//third_party/jsoncpp",
1564 ]
mtklein2b6870c2016-07-28 14:17:33 -07001565 }
halcanary19a97202016-08-03 15:08:04 -07001566
Ravi Mistry10d36c52017-01-31 09:49:18 -05001567 test_app("skpinfo") {
1568 sources = [
1569 "tools/skpinfo.cpp",
1570 ]
1571 deps = [
1572 ":flags",
1573 ":skia",
1574 ]
1575 }
1576
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001577 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001578 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001579 sources = [
1580 "tools/skpbench/skpbench.cpp",
1581 ]
1582 deps = [
1583 ":flags",
1584 ":gpu_tool_utils",
1585 ":skia",
1586 ":tool_utils",
1587 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001588 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001589 }
1590
Hal Canary96c57252018-02-09 11:43:05 -05001591 test_lib("skshaper") {
1592 public_include_dirs = [ "tools/shape" ]
1593 deps = [
1594 ":skia",
1595 ]
1596
Hal Canary8bb40832018-02-08 15:16:28 -05001597 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001598 sources = [
1599 "tools/shape/SkShaper_primitive.cpp",
1600 ]
1601 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001602 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001603 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001604 ]
Hal Canary96c57252018-02-09 11:43:05 -05001605 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001606 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001607 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001608 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001609 }
halcanary19a97202016-08-03 15:08:04 -07001610 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001611 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001612 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001613 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001614 ]
1615 deps = [
1616 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001617 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001618 ]
halcanary3eee9d92016-09-10 07:01:53 -07001619 }
mtklein046cb562016-09-16 10:23:12 -07001620
Matt Sarett9f1c4032017-05-17 10:06:32 -04001621 test_app("create_flutter_test_images") {
1622 sources = [
1623 "tools/create_flutter_test_images.cpp",
1624 ]
1625 deps = [
1626 ":skia",
1627 ":tool_utils",
1628 ]
1629 }
1630
Ben Wagner219f3622017-07-17 15:32:25 -04001631 test_app("create_test_font") {
1632 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001633 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001634 ]
1635 deps = [
1636 ":skia",
1637 ]
1638 assert_no_deps = [
1639 # tool_utils requires the output of this app.
1640 ":tool_utils",
1641 ]
1642 }
1643
Mike Kleine6682eb2017-01-05 10:54:57 -05001644 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001645 sources = [
1646 "tools/get_images_from_skps.cpp",
1647 ]
1648 deps = [
1649 ":flags",
1650 ":skia",
1651 "//third_party/jsoncpp",
1652 ]
mtklein046cb562016-09-16 10:23:12 -07001653 }
mtkleinecbc5262016-09-22 11:51:24 -07001654
Mike Kleine6682eb2017-01-05 10:54:57 -05001655 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001656 sources = [
1657 "tools/colorspaceinfo.cpp",
1658 ]
1659 deps = [
1660 ":flags",
1661 ":skia",
1662 ":tool_utils",
1663 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001664 }
1665
Kevin Lubickebf648e2017-09-21 13:45:16 -04001666 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001667 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001668 sources = [
1669 "tools/skiaserve/Request.cpp",
1670 "tools/skiaserve/Response.cpp",
1671 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001672 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1673 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1674 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1675 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1676 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1677 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1678 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1679 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1680 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001681 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1682 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001683 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1684 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1685 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1686 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1687 ]
1688 deps = [
1689 ":flags",
1690 ":gpu_tool_utils",
1691 ":skia",
1692 ":tool_utils",
1693 "//third_party/jsoncpp",
1694 "//third_party/libmicrohttpd",
1695 "//third_party/libpng",
1696 ]
Mike Klein7d302882016-11-03 14:06:31 -04001697 }
mtkleinecbc5262016-09-22 11:51:24 -07001698 }
kjlubick14f984b2016-10-03 11:49:45 -07001699
Mike Kleine6682eb2017-01-05 10:54:57 -05001700 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001701 include_dirs = [
1702 "tools",
1703 "tools/debugger",
1704 ]
kjlubick14f984b2016-10-03 11:49:45 -07001705 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001706 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001707 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001708 "fuzz/FuzzGradients.cpp",
1709 "fuzz/FuzzParsePath.cpp",
1710 "fuzz/FuzzPathop.cpp",
1711 "fuzz/FuzzScaleToSides.cpp",
1712 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001713 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1714 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001715 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1716 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001717 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1718 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001719 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001720 "tools/UrlDataManager.cpp",
1721 "tools/debugger/SkDebugCanvas.cpp",
1722 "tools/debugger/SkDrawCommand.cpp",
1723 "tools/debugger/SkJsonWriteBuffer.cpp",
1724 "tools/debugger/SkObjectParser.cpp",
1725 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001726 ]
1727 deps = [
1728 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001729 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001730 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001731 "//third_party/jsoncpp",
1732 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001733 ]
kjlubick14f984b2016-10-03 11:49:45 -07001734 }
Mike Klein38312422016-10-05 15:41:01 -04001735
Mike Kleine6682eb2017-01-05 10:54:57 -05001736 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001737 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001738 rebase_path("tests/skia_test.cpp"),
1739 rebase_path("tests/Test.cpp"),
1740 ]
caryclark9feb6322016-10-25 08:58:26 -07001741 deps = [
1742 ":flags",
1743 ":gpu_tool_utils",
1744 ":skia",
1745 ":tool_utils",
1746 ]
caryclark9feb6322016-10-25 08:58:26 -07001747 }
1748
Mike Kleine6682eb2017-01-05 10:54:57 -05001749 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001750 sources = [
1751 "tools/DumpRecord.cpp",
1752 "tools/dump_record.cpp",
1753 ]
1754 deps = [
1755 ":flags",
1756 ":skia",
1757 ]
Mike Klein38312422016-10-05 15:41:01 -04001758 }
bungemanfe917272016-10-13 17:36:40 -04001759
Mike Kleine6682eb2017-01-05 10:54:57 -05001760 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001761 sources = [
1762 "tools/skdiff/skdiff.cpp",
1763 "tools/skdiff/skdiff_html.cpp",
1764 "tools/skdiff/skdiff_main.cpp",
1765 "tools/skdiff/skdiff_utils.cpp",
1766 ]
1767 deps = [
1768 ":skia",
1769 ":tool_utils",
1770 ]
bungemanfe917272016-10-13 17:36:40 -04001771 }
halcanarya73d76a2016-10-17 13:19:02 -07001772
Mike Kleine6682eb2017-01-05 10:54:57 -05001773 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001774 sources = [
1775 "tools/skp_parser.cpp",
1776 ]
1777 deps = [
1778 ":skia",
1779 ":tool_utils",
1780 "//third_party/jsoncpp",
1781 ]
halcanarya73d76a2016-10-17 13:19:02 -07001782 }
Brian Osman16adfa32016-10-18 14:42:44 -04001783
Hal Canaryd7b38452017-12-11 17:46:26 -05001784 if (!is_win && skia_enable_gpu) {
1785 test_lib("skqp_lib") {
1786 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001787 defines =
1788 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001789 if (skia_skqp_enable_driver_correctness_workarounds) {
1790 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1791 }
Hal Canary75427132017-10-11 16:00:31 -04001792 sources = [
1793 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001794 "tools/skqp/gm_knowledge.cpp",
1795 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001796 ]
1797 deps = [
1798 ":gm",
1799 ":gpu_tool_utils",
1800 ":skia",
1801 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001802 ":tool_utils",
1803 ]
1804 }
1805 test_app("skqp") {
1806 sources = [
1807 "tools/skqp/skqp.cpp",
1808 ]
1809 deps = [
1810 ":skia",
1811 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001812 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001813 "//third_party/googletest",
1814 ]
1815 }
1816 }
Hal Canary28f89382017-12-12 09:42:14 -05001817 if (is_android && skia_enable_gpu) {
1818 test_app("skqp_app") {
1819 is_shared_library = true
1820 sources = [
1821 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1822 ]
1823 deps = [
1824 ":skia",
1825 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001826 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001827 ]
1828 libs = [ "android" ]
1829 }
1830 }
Hal Canary75427132017-10-11 16:00:31 -04001831
Hal Canarya9de7602018-01-19 13:08:23 -05001832 test_app("list_gms") {
1833 sources = [
1834 "tools/list_gms.cpp",
1835 ]
1836 deps = [
1837 ":gm",
1838 ":skia",
1839 ]
1840 }
1841 test_app("list_gpu_unit_tests") {
1842 sources = [
1843 "dm/DMGpuTestProcs.cpp",
1844 "tools/list_gpu_unit_tests.cpp",
1845 ]
1846 deps = [
1847 ":skia",
1848 ":tests",
1849 ]
1850 }
1851
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001852 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001853 test_lib("sk_app") {
1854 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001855 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001856 "tools/sk_app/CommandSet.cpp",
1857 "tools/sk_app/GLWindowContext.cpp",
1858 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001859 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001860 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001861
Jim Van Verth4e56a912016-10-21 10:58:52 -04001862 if (is_android) {
1863 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001864 "tools/sk_app/android/GLWindowContext_android.cpp",
1865 "tools/sk_app/android/RasterWindowContext_android.cpp",
1866 "tools/sk_app/android/Window_android.cpp",
1867 "tools/sk_app/android/main_android.cpp",
1868 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001869 ]
Brian Osman462334e2017-02-09 11:22:57 -05001870 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001871 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001872 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001873 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1874 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1875 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001876 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001877 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001878 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001879 libs += [
1880 "GL",
1881 "X11",
1882 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001883 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001884 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001885 "tools/sk_app/win/GLWindowContext_win.cpp",
1886 "tools/sk_app/win/RasterWindowContext_win.cpp",
1887 "tools/sk_app/win/Window_win.cpp",
1888 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001889 ]
Brian Salomon194db172017-08-17 14:37:06 -04001890 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001891 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001892 }
Mike Klein43c25262016-10-20 10:17:47 -04001893 } else if (is_mac) {
1894 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001895 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1896 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1897 "tools/sk_app/mac/Window_mac.cpp",
1898 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001899 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001900 libs += [
1901 "QuartzCore.framework",
1902 "Cocoa.framework",
1903 "Foundation.framework",
1904 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001905 } else if (is_ios) {
1906 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001907 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1908 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1909 "tools/sk_app/ios/Window_ios.cpp",
1910 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001911 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001912 }
1913
1914 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001915 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001916 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001917 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001918 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001919 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001920 libs += [ "X11-xcb" ]
1921 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001922 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001923 }
1924 }
1925
Brian Osman16adfa32016-10-18 14:42:44 -04001926 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001927 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001928 ":skia",
1929 ":tool_utils",
1930 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001931 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001932 if (is_android) {
1933 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001934 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001935 deps += [ "//third_party/libsdl" ]
1936 }
Brian Salomon194db172017-08-17 14:37:06 -04001937 if (skia_use_angle) {
1938 deps += [ "//third_party/angle2" ]
1939 }
Mike Kleina92c3832016-12-08 09:49:39 -05001940 }
Brian Osman16adfa32016-10-18 14:42:44 -04001941 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001942
Brian Osmaneff04b52017-11-21 13:18:02 -05001943 if (skia_enable_gpu) {
1944 test_app("viewer") {
1945 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001946 if (is_ios) {
1947 bundle_ios_data = true
1948 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001949 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07001950 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001951 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001952 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001953 "tools/viewer/ImageSlide.cpp",
1954 "tools/viewer/SKPSlide.cpp",
1955 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001956 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05001957 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001958 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001959 "tools/viewer/Viewer.cpp",
1960 ]
1961 libs = []
1962
1963 include_dirs = []
1964 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001965 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05001966 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05001967 ":flags",
1968 ":gm",
1969 ":gpu_tool_utils",
1970 ":samples",
1971 ":sk_app",
1972 ":skia",
1973 ":tool_utils",
1974 ":views",
1975 "//third_party/imgui",
1976 "//third_party/jsoncpp",
1977 ]
1978 }
1979 }
1980
1981 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1982 test_app("HelloWorld") {
1983 sources = [
1984 "example/HelloWorld.cpp",
1985 ]
1986 libs = []
1987
1988 include_dirs = []
1989 deps = [
1990 ":flags",
1991 ":gpu_tool_utils",
1992 ":sk_app",
1993 ":skia",
1994 ":tool_utils",
1995 ":views",
1996 ]
1997 }
1998 }
1999
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002000 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002001 test_app("SkiaSDLExample") {
2002 sources = [
2003 "example/SkiaSDLExample.cpp",
2004 ]
2005 libs = []
2006 include_dirs = []
2007 deps = [
2008 ":gpu_tool_utils",
2009 ":skia",
2010 "//third_party/libsdl",
2011 ]
2012 }
2013 }
2014
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002015 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2016 action_foreach("generate_mocs") {
2017 script = "gn/call.py"
2018 sources = [
2019 "tools/mdbviz/MainWindow.h",
2020 ]
2021 outputs = [
2022 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2023 ]
2024 args = [
2025 "$skia_qt_path" + "/bin/moc",
2026 "{{source}}",
2027 "-o",
2028 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2029 ]
2030 }
2031 action_foreach("generate_resources") {
2032 script = "gn/call.py"
2033 sources = [
2034 "tools/mdbviz/resources.qrc",
2035 ]
2036 outputs = [
2037 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2038 ]
2039 args = [
2040 "$skia_qt_path" + "/bin/rcc",
2041 "{{source}}",
2042 "-o",
2043 "gen/mdbviz/{{source_name_part}}_res.cpp",
2044 ]
2045 }
2046 test_app("mdbviz") {
2047 if (is_win) {
2048 # on Windows we need to disable some exception handling warnings due to the Qt headers
2049 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2050 }
2051 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002052 "tools/UrlDataManager.cpp",
2053 "tools/debugger/SkDebugCanvas.cpp",
2054 "tools/debugger/SkDrawCommand.cpp",
2055 "tools/debugger/SkJsonWriteBuffer.cpp",
2056 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002057 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002058 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002059 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002060 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002061
2062 # generated files
2063 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2064 "$target_gen_dir/mdbviz/resources_res.cpp",
2065 ]
2066 lib_dirs = [ "$skia_qt_path/lib" ]
2067 libs = [
2068 "Qt5Core.lib",
2069 "Qt5Gui.lib",
2070 "Qt5Widgets.lib",
2071 ]
2072 include_dirs = [
2073 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002074 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002075 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002076 "tools",
2077 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002078 ]
2079 deps = [
2080 ":generate_mocs",
2081 ":generate_resources",
2082 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002083 "//third_party/jsoncpp",
2084 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002085 ]
2086 }
2087 }
2088
Mike Kleine459afd2017-03-03 09:21:30 -05002089 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002090 copy("gdbserver") {
2091 sources = [
2092 "$ndk/$ndk_gdbserver",
2093 ]
2094 outputs = [
2095 "$root_out_dir/gdbserver",
2096 ]
2097 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002098 }
mtklein25c81d42016-07-27 13:55:26 -07002099}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002100
2101if (skia_jumper_clang != "") {
2102 action("regen_jumper") {
2103 script = "src/jumper/build_stages.py"
2104
2105 inputs = [
2106 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002107 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002108 ]
2109
2110 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2111 outputs = [
2112 "$target_out_dir/" +
2113 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2114 "$target_out_dir/" +
2115 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2116 ]
2117
2118 args = [
2119 skia_jumper_clang,
2120 skia_jumper_objdump,
2121 skia_jumper_ccache,
2122 ] + rebase_path(inputs) + rebase_path(outputs)
2123 }
2124}