blob: a2052c8d94b529d2fe8ae230711f17d2e6d1a319 [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")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07009
Forrest Reiling30229ac2017-04-17 13:36:39 -070010if (is_fuchsia) {
11 import("//build/vulkan/config.gni")
12}
13
Mike Klein3669a822017-03-03 10:55:02 -050014if (!defined(is_skia_standalone)) {
15 is_skia_standalone = false
16}
17is_skia_dev_build = is_skia_standalone && !is_official_build
18
mtkleinc04ff472016-06-23 10:29:30 -070019declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040020 skia_enable_flutter_defines = false
21}
22
23declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000024 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040025 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070026 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070027 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070028 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040029 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070030 skia_use_libjpeg_turbo = true
31 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070032 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050033 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040034 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040035 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040036 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070037 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040038 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040039 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070040 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070041
Mike Klein7d921032017-01-05 12:20:41 -050042 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040043 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000044 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050045 skia_enable_discrete_gpu = true
Hal Canaryff2742e2018-01-30 11:35:47 -050046 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000047 skia_enable_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040048 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050049 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040050 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040051 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050052 skia_enable_tools = is_skia_dev_build
53 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielda16cce2018-08-01 09:23:57 -040054 skia_vulkan_header = "" # temporary as we remove the use from clients
Robert Phillipsa6d2d702017-09-01 12:17:03 -040055 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040056 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070057 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070058 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040059
Hal Canary4689b542018-01-31 11:54:14 -050060 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050061 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040062
63 skia_llvm_path = ""
64 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040065
66 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070067}
Brian Salomon23d73ea2016-10-27 13:31:37 -040068declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040069 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040070 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050071 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040072
Mike Klein4d598a32016-10-31 13:44:49 -040073 if (is_android) {
74 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070075 } else if (is_fuchsia) {
76 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040077 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040078 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
79 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040080 }
Jim Van Verth4e502972017-12-07 15:16:10 -050081
82 if (is_ios) {
83 skia_ios_identity = ".*Google.*"
84 skia_ios_profile = "Google Development"
85 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040086}
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
Brian Osmanc9a42472018-05-31 13:17:12 -040092# Our tools require static linking (they use non-exported symbols), and the GPU backend.
93skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
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",
Hal Canary23564b92018-09-07 14:33:14 -0400103 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -0700104 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400105 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/gpu",
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
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500115if (skia_enable_atlas_text) {
116 skia_public_includes += [ "include/atlastext" ]
117}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000118
mtkleinc04ff472016-06-23 10:29:30 -0700119# Skia public API, generally provided by :skia.
120config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700121 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400122 defines = []
123 if (is_component_build) {
124 defines += [ "SKIA_DLL" ]
125 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400126 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700127 defines += [ "SK_SAMPLES_FOR_X" ]
128 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400129 if (skia_enable_flutter_defines) {
130 defines += flutter_defines
131 }
mtklein06c35c02016-09-20 12:28:12 -0700132 if (!skia_enable_gpu) {
133 defines += [ "SK_SUPPORT_GPU=0" ]
134 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500135 if (skia_enable_atlas_text) {
136 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
137 }
Mike Reed025f7832018-11-12 09:27:05 -0500138 if (is_fuchsia) {
139 defines += fuchsia_defines
140 }
mtkleinc04ff472016-06-23 10:29:30 -0700141}
142
143# Skia internal APIs, used by Skia itself and a few test tools.
144config("skia_private") {
145 visibility = [ ":*" ]
146
147 include_dirs = [
148 "include/private",
149 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700150 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700151 "src/core",
152 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700153 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700154 "src/image",
155 "src/images",
156 "src/lazy",
157 "src/opts",
158 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700159 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/ports",
161 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400162 "src/shaders",
163 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700164 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700165 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700166 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500167 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700168 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700169 ]
mtklein150d1132016-08-01 06:56:40 -0700170
Mike Reeda9e241d2017-05-03 10:52:00 -0400171 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700172 if (is_android) {
173 defines += [
174 "SK_GAMMA_EXPONENT=1.4",
175 "SK_GAMMA_CONTRAST=0.0",
176 ]
177 }
mtklein88a7ac02016-09-14 11:16:49 -0700178 if (is_official_build || is_android) {
179 # TODO(bsalomon): it'd be nice to make Android normal.
180 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
181 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400182 libs = []
183 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500184 if (skia_enable_gpu) {
185 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500186 if (is_skia_dev_build && skia_use_vulkan) {
187 include_dirs += [ "tools/gpu/vk" ]
188 }
Brian Salomon03e05842017-02-23 12:23:47 -0500189 }
Brian Osman34755e22016-12-05 09:46:02 -0500190 if (skia_use_angle) {
191 defines += [ "SK_ANGLE" ]
192 }
Brian Osman3f375d02016-12-28 11:19:22 -0500193 if (skia_enable_discrete_gpu) {
194 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
195 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400196 if (!is_official_build) {
197 defines += [ "GR_TEST_UTILS=1" ]
198 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400199 if (skia_llvm_path != "") {
200 defines += [ "SK_LLVM_AVAILABLE" ]
201 include_dirs += [ "$skia_llvm_path/include" ]
202 libs += [ skia_llvm_lib ]
203 lib_dirs += [ "$skia_llvm_path/lib/" ]
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") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500221 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700222 if (invoker.enabled) {
223 source_set(target_name) {
224 forward_variables_from(invoker, "*")
225 configs += skia_library_configs
226 }
227 } else {
228 # If not enabled, a phony empty target that swallows all otherwise unused variables.
229 source_set(target_name) {
230 forward_variables_from(invoker,
231 "*",
232 [
233 "sources",
234 "cflags",
235 ])
236 }
237 }
anmittala7eaf2e2016-08-17 13:57:26 -0700238}
239
mtklein422310d2016-08-16 18:28:43 -0700240is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700241
mtklein7d6fb2c2016-08-25 14:50:44 -0700242opts("none") {
243 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700245 cflags = []
246}
247
mtklein7d6fb2c2016-08-25 14:50:44 -0700248opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700249 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700251 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700252}
253
254opts("arm64") {
255 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700257 cflags = []
258}
259
260opts("crc32") {
261 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700262 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700263 cflags = [ "-march=armv8-a+crc" ]
264}
265
mtklein9b8583d2016-08-24 17:32:30 -0700266opts("sse2") {
267 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700268 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400269 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400270 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
271 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400272 cflags = [ "-msse2" ]
273 }
mtklein9b8583d2016-08-24 17:32:30 -0700274}
mtkleinc04ff472016-06-23 10:29:30 -0700275
mtklein9b8583d2016-08-24 17:32:30 -0700276opts("ssse3") {
277 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700278 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400279 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400280 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
281 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400282 cflags = [ "-mssse3" ]
283 }
mtklein9b8583d2016-08-24 17:32:30 -0700284}
mtkleinc04ff472016-06-23 10:29:30 -0700285
mtklein9b8583d2016-08-24 17:32:30 -0700286opts("sse41") {
287 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700288 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400289 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400290 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
291 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400292 cflags = [ "-msse4.1" ]
293 }
mtklein9b8583d2016-08-24 17:32:30 -0700294}
mtklein4e976072016-08-08 09:06:27 -0700295
mtklein9b8583d2016-08-24 17:32:30 -0700296opts("sse42") {
297 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700298 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400299 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400300 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
301 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400302 cflags = [ "-msse4.2" ]
303 }
mtklein9b8583d2016-08-24 17:32:30 -0700304}
305
306opts("avx") {
307 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700308 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400309 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000310 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400311 } else {
312 cflags = [ "-mavx" ]
313 }
mtkleinc04ff472016-06-23 10:29:30 -0700314}
315
Mike Klein1b9b7d52018-02-27 10:37:40 -0500316opts("hsw") {
317 enabled = is_x86
318 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400319 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500320 cflags = [ "/arch:AVX2" ]
321 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000322 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500323 }
324
325 # Oddly, clang-cl doesn't recognize this as a valid flag.
326 # If it ever does, it'd nice to move this up with -mavx2 and co.
327 if (is_clang && !is_win) {
328 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
329 # but nice to have, generating slightly better code for paths without explicit FMAs.
330 cflags += [ "-ffp-contract=fast" ]
331 }
332}
333
mtkleinc095df52016-08-24 12:23:52 -0700334# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700335template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500336 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700337 if (invoker.enabled) {
338 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700339 if (defined(invoker.public_defines)) {
340 defines = invoker.public_defines
341 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600342 if (defined(invoker.public_configs)) {
343 configs = invoker.public_configs
344 }
mtklein457b42a2016-08-23 13:56:37 -0700345 }
346 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700347 forward_variables_from(invoker,
348 "*",
349 [
350 "public_defines",
351 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700352 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700353 ])
mtklein457b42a2016-08-23 13:56:37 -0700354 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700355 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700356 if (defined(invoker.configs_to_remove)) {
357 configs -= invoker.configs_to_remove
358 }
mtklein457b42a2016-08-23 13:56:37 -0700359 }
360 } else {
mtklein457b42a2016-08-23 13:56:37 -0700361 source_set(target_name) {
362 forward_variables_from(invoker,
363 "*",
364 [
365 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400366 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700367 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700368 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700369 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700370 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700371 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700372 ])
mtkleincd01b032016-08-31 04:58:19 -0700373 if (defined(invoker.sources_when_disabled)) {
374 sources = invoker.sources_when_disabled
375 }
376 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700377 }
mtkleineb3c4252016-08-23 07:38:09 -0700378 }
mtklein457b42a2016-08-23 13:56:37 -0700379}
mtklein457b42a2016-08-23 13:56:37 -0700380
mtkleina45be612016-08-29 15:22:10 -0700381optional("fontmgr_android") {
382 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700383
384 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500385 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700386 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700387 ]
388 sources = [
389 "src/ports/SkFontMgr_android.cpp",
390 "src/ports/SkFontMgr_android_factory.cpp",
391 "src/ports/SkFontMgr_android_parser.cpp",
392 ]
393}
394
mtkleind2e39db2016-09-07 07:52:55 -0700395optional("fontmgr_custom") {
Kevin Lubick217056c2018-09-20 17:39:31 -0400396 enabled = (is_linux || target_cpu == "wasm") && skia_use_freetype &&
397 !skia_use_fontconfig
mtkleind2e39db2016-09-07 07:52:55 -0700398
399 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500400 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700401 ]
402 sources = [
403 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500404 "src/ports/SkFontMgr_custom.h",
405 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700406 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500407 "src/ports/SkFontMgr_custom_embedded.cpp",
408 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700409 ]
410}
411
Hal Canaryff2742e2018-01-30 11:35:47 -0500412optional("fontmgr_empty") {
413 enabled = skia_enable_fontmgr_empty
414 sources = [
415 "src/ports/SkFontMgr_empty_factory.cpp",
416 ]
417}
418
mtklein3cc22182016-08-29 13:26:14 -0700419optional("fontmgr_fontconfig") {
420 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700421
422 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500423 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700424 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700425 ]
426 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700427 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700428 "src/ports/SkFontConfigInterface_direct.cpp",
429 "src/ports/SkFontConfigInterface_direct_factory.cpp",
430 "src/ports/SkFontMgr_FontConfigInterface.cpp",
431 "src/ports/SkFontMgr_fontconfig.cpp",
432 "src/ports/SkFontMgr_fontconfig_factory.cpp",
433 ]
434}
435
mtkleincdedd0e2016-09-12 15:15:44 -0700436optional("fontmgr_fuchsia") {
437 enabled = is_fuchsia && skia_use_freetype
438
439 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500440 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700441 ]
442 sources = [
443 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500444 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700445 "src/ports/SkFontMgr_custom_empty_factory.cpp",
446 ]
447}
448
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700449if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400450 executable("sksllex") {
451 sources = [
452 "src/sksl/lex/Main.cpp",
453 "src/sksl/lex/NFA.cpp",
454 "src/sksl/lex/RegexNode.cpp",
455 "src/sksl/lex/RegexParser.cpp",
456 ]
457 include_dirs = [ "src/sksl/lex" ]
458 }
459
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700460 action("run_sksllex") {
461 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400462 deps = [
463 ":sksllex(//gn/toolchain:$host_toolchain)",
464 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700465 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700466 "src/sksl/lex/sksl.lex",
467 ]
468
469 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
470 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
471 outputs = [
472 "$target_out_dir/" +
473 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
474 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
475 # confused due to the same file being named by two different paths
476 ]
477 sksllex_path = "$root_out_dir/"
478 sksllex_path += "sksllex"
479 if (host_os == "win") {
480 sksllex_path += ".exe"
481 }
482 args = [
483 rebase_path(sksllex_path),
484 rebase_path("bin/clang-format"),
485 rebase_path("src"),
486 ]
487 }
488} else {
489 group("run_sksllex") {
490 }
491}
492
493if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400494 executable("skslc") {
495 defines = [ "SKSL_STANDALONE" ]
496 sources = [
497 "src/sksl/SkSLMain.cpp",
498 ]
499 sources += skia_sksl_sources
500 include_dirs = [
501 "src/gpu",
502 "src/sksl",
503 ]
504 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500505 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400506 "//third_party/spirv-tools",
507 ]
508 }
509
510 skia_gpu_processor_outputs = []
511 foreach(src, skia_gpu_processor_sources) {
512 dir = get_path_info(src, "dir")
513 name = get_path_info(src, "name")
514
515 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
516 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
517 skia_gpu_processor_outputs += [
518 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
519 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
520 # confused due to the same file being named by two different paths
521 ]
522 }
523
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500524 action("create_sksl_enums") {
525 script = "gn/create_sksl_enums.py"
526 sources = [
527 "include/private/GrSharedEnums.h",
528 ]
529 outputs = [
530 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500531 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500532 ]
533 args = [
534 rebase_path(sources[0]),
535 rebase_path(outputs[0]),
536 ]
537 }
538
Ethan Nicholas762466e2017-06-29 10:03:38 -0400539 action("compile_processors") {
540 script = "gn/compile_processors.py"
541 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500542 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400543 ":skslc(//gn/toolchain:$host_toolchain)",
544 ]
545 sources = skia_gpu_processor_sources
546 outputs = skia_gpu_processor_outputs
547 skslc_path = "$root_out_dir/"
548 if (host_toolchain != default_toolchain_name) {
549 skslc_path += "$host_toolchain/"
550 }
551 skslc_path += "skslc"
552 if (host_os == "win") {
553 skslc_path += ".exe"
554 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400555 args = [
556 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400557 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400558 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400559 args += rebase_path(skia_gpu_processor_sources)
560 }
561} else {
562 skia_gpu_processor_outputs = []
563 group("compile_processors") {
564 }
565}
566
Mike Klein33ad63a2018-11-11 07:17:00 -0500567optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700568 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400569 deps = [
570 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700571 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400572 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700573 if (skia_generate_workarounds) {
574 deps += [ ":workaround_list" ]
575 }
mtkleine9fb3d52016-09-20 15:11:46 -0700576 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600577 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400578 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700579
Brian Salomon3d6801e2017-12-11 10:06:31 -0500580 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400581 if (!skia_enable_ccpr) {
582 sources -= skia_ccpr_sources
583 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
584 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400585 if (!skia_enable_nvpr) {
586 sources -= skia_nvpr_sources
587 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
588 }
mtklein06c35c02016-09-20 12:28:12 -0700589
590 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500591 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700592 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400593 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700594 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400595 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400596
597 # this lib is required to link against AHardwareBuffer
598 if (defined(ndk_api) && ndk_api >= 26) {
599 libs += [ "android" ]
600 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400601 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500602 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400603 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700604 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500605 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400606 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700607 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800609 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400611 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400613 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700614 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500615 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700616 }
mtkleine9fb3d52016-09-20 15:11:46 -0700617
618 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400619 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400620 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700621 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700622 if (skia_enable_vulkan_debug_layers) {
623 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
624 }
mtkleine9fb3d52016-09-20 15:11:46 -0700625 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400626
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400627 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400628 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400629 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
630 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400631
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400632 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400633 if (skia_use_metal) {
634 public_defines += [ "SK_METAL" ]
635 sources += skia_metal_sources
636 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400637 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400638 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400639 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500640
641 if (skia_enable_atlas_text) {
642 sources += skia_atlas_text_sources
643 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400644
645 if (is_debug) {
646 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
647 }
mtklein06c35c02016-09-20 12:28:12 -0700648}
649
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400650optional("heif") {
651 enabled = skia_use_libheif
652 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
653
654 deps = []
655
656 sources = [
657 "src/codec/SkHeifCodec.cpp",
658 ]
659}
660
mtklein63213812016-08-24 09:55:56 -0700661optional("jpeg") {
662 enabled = skia_use_libjpeg_turbo
663 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
664
mtklein63213812016-08-24 09:55:56 -0700665 deps = [
666 "//third_party/libjpeg-turbo:libjpeg",
667 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400668 public = [
669 "include/encode/SkJpegEncoder.h",
670 ]
mtklein63213812016-08-24 09:55:56 -0700671 sources = [
672 "src/codec/SkJpegCodec.cpp",
673 "src/codec/SkJpegDecoderMgr.cpp",
674 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700675 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400676 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700677 ]
678}
679
680optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500681 enabled = skia_use_zlib && skia_enable_pdf
682 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700683
mtklein63213812016-08-24 09:55:56 -0700684 deps = [
685 "//third_party/zlib",
686 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400687 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700688 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400689 }
brettwb9447282016-09-01 14:24:39 -0700690 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700691 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700692
693 if (skia_use_sfntly) {
694 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500695 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700696 }
697}
698
699optional("png") {
700 enabled = skia_use_libpng
701 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
702
mtklein63213812016-08-24 09:55:56 -0700703 deps = [
704 "//third_party/libpng",
705 ]
706 sources = [
707 "src/codec/SkIcoCodec.cpp",
708 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400709 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700710 ]
711}
712
scroggof84ad642016-10-31 09:02:57 -0700713optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400714 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700715 public_defines = [ "SK_CODEC_DECODES_RAW" ]
716
717 deps = [
718 "//third_party/dng_sdk",
719 "//third_party/libjpeg-turbo:libjpeg",
720 "//third_party/piex",
721 ]
722
723 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
724 # Skia.
725 configs_to_remove = [ "//gn:no_exceptions" ]
726
727 sources = [
scroggof84ad642016-10-31 09:02:57 -0700728 "src/codec/SkRawCodec.cpp",
729 ]
730}
731
Mike Klein852a8cb2018-05-15 10:46:58 -0400732import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400733source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400734 cflags = []
735 if (!is_win || is_clang) {
736 cflags += [
737 "-w",
738 "-std=c11",
739 ]
740 }
741
742 public = [
743 "third_party/skcms/skcms.h",
744 ]
745 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
746}
747
mtklein3cc22182016-08-29 13:26:14 -0700748optional("typeface_freetype") {
749 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700750
751 deps = [
752 "//third_party/freetype2",
753 ]
754 sources = [
755 "src/ports/SkFontHost_FreeType.cpp",
756 "src/ports/SkFontHost_FreeType_common.cpp",
757 ]
758}
759
mtklein457b42a2016-08-23 13:56:37 -0700760optional("webp") {
761 enabled = skia_use_libwebp
762 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
763
mtklein457b42a2016-08-23 13:56:37 -0700764 deps = [
765 "//third_party/libwebp",
766 ]
767 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700768 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400769 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700770 ]
mtkleineb3c4252016-08-23 07:38:09 -0700771}
772
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400773optional("wuffs") {
774 enabled = skia_use_wuffs
775 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
776
777 deps = [
778 "//third_party/wuffs",
779 ]
780 sources = [
781 "src/codec/SkWuffsCodec.cpp",
782 ]
783}
784
mtklein63213812016-08-24 09:55:56 -0700785optional("xml") {
786 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000787 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700788
mtklein63213812016-08-24 09:55:56 -0700789 deps = [
790 "//third_party/expat",
791 ]
792 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500793 "src/svg/SkSVGCanvas.cpp",
794 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700795 "src/xml/SkDOM.cpp",
796 "src/xml/SkXMLParser.cpp",
797 "src/xml/SkXMLWriter.cpp",
798 ]
799}
800
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700801if (skia_enable_gpu && skia_generate_workarounds) {
802 action("workaround_list") {
803 script = "tools/build_workaround_header.py"
804
805 inputs = [
806 "src/gpu/gpu_workaround_list.txt",
807 ]
808
809 # see comments in skia_compile_processors about out dir path shenanigans.
810 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700811 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700812
813 outputs = [
814 "$root_out_dir/$output_file",
815 ]
816 args = [
817 "--output-file",
818 "$output_file",
819 ]
820
821 foreach(file, inputs) {
822 args += [ rebase_path(file, root_build_dir) ]
823 }
824 }
825}
826
Mike Klein33ad63a2018-11-11 07:17:00 -0500827# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
828# TODO: rename :gpu_for_real back to :gpu when cleaning up.
829source_set("effects") {
830}
831source_set("gpu") {
832}
833
mtkleinc04ff472016-06-23 10:29:30 -0700834component("skia") {
835 public_configs = [ ":skia_public" ]
836 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700837
Mike Klein607b0a72018-11-07 16:17:34 -0500838 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500839 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500840 ":pdf",
841 ":skcms",
842 ]
843
mtkleinc04ff472016-06-23 10:29:30 -0700844 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700845 ":arm64",
846 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700847 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000848 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700849 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700850 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700851 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500852 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700853 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700854 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400855 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500856 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700857 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700858 ":none",
mtklein63213812016-08-24 09:55:56 -0700859 ":png",
scroggof84ad642016-10-31 09:02:57 -0700860 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700861 ":sse2",
862 ":sse41",
863 ":sse42",
864 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700865 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400866 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700867 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700868 ]
869
Kevin Lubick134be1d2018-10-30 15:05:04 -0400870 if (skia_enable_nima) {
871 deps += [ "//third_party/Nima-Cpp" ]
872 }
873
Chinmay Garde43f115c2016-11-16 15:04:12 -0800874 # This file (and all GN files in Skia) are designed to work with an
875 # empty sources assignment filter; we handle all that explicitly.
876 # We clear the filter here for clients who may have set up a global filter.
877 set_sources_assignment_filter([])
878
mtkleinc04ff472016-06-23 10:29:30 -0700879 sources = []
brettwb9447282016-09-01 14:24:39 -0700880 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700881 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500882 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000883 sources += skia_effects_sources
884 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700885 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400886 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500887 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700888 "src/android/SkBitmapRegionCodec.cpp",
889 "src/android/SkBitmapRegionDecoder.cpp",
890 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100891 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400892 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700893 "src/codec/SkBmpCodec.cpp",
894 "src/codec/SkBmpMaskCodec.cpp",
895 "src/codec/SkBmpRLECodec.cpp",
896 "src/codec/SkBmpStandardCodec.cpp",
897 "src/codec/SkCodec.cpp",
898 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400899 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400900 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700901 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700902 "src/codec/SkMaskSwizzler.cpp",
903 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700904 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700905 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700906 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700907 "src/codec/SkSwizzler.cpp",
908 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700909 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700910 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000911 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700912 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700913 "src/ports/SkMemory_malloc.cpp",
914 "src/ports/SkOSFile_stdio.cpp",
915 "src/sfnt/SkOTTable_name.cpp",
916 "src/sfnt/SkOTUtils.cpp",
917 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700918 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700919 ]
brettwb9447282016-09-01 14:24:39 -0700920
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400921 defines = []
922 if (!skia_enable_skpicture) {
923 defines = [ "SK_DISABLE_SKPICTURE" ]
924 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000925 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400926 sources += [ "src/core/SkPicture_none.cpp" ]
927 }
928
mtklein7d6fb2c2016-08-25 14:50:44 -0700929 libs = []
930
mtkleinc04ff472016-06-23 10:29:30 -0700931 if (is_win) {
932 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400933 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700934 "src/ports/SkDebug_win.cpp",
935 "src/ports/SkFontHost_win.cpp",
936 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500937 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700938 "src/ports/SkImageEncoder_WIC.cpp",
939 "src/ports/SkImageGeneratorWIC.cpp",
940 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700941 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700942 "src/ports/SkScalerContext_win_dw.cpp",
943 "src/ports/SkTLS_win.cpp",
944 "src/ports/SkTypeface_win_dw.cpp",
945 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400946 libs += [
947 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500948 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400949 "Ole32.lib",
950 "OleAut32.lib",
951 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500952 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400953 ]
mtkleinc04ff472016-06-23 10:29:30 -0700954 } else {
955 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700956 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700957 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700958 "src/ports/SkTLS_pthread.cpp",
959 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400960 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700961 }
962
mtklein7d6fb2c2016-08-25 14:50:44 -0700963 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500964 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500965 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500966 deps += [ "//third_party/cpu-features" ]
967 }
mtklein06c35c02016-09-20 12:28:12 -0700968 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700969 libs += [
970 "EGL",
971 "GLESv2",
972 "log",
973 ]
974 }
975
Kevin Lubick217056c2018-09-20 17:39:31 -0400976 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700977 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400978 if (skia_use_egl) {
979 libs += [ "GLESv2" ]
980 }
mtkleinc04ff472016-06-23 10:29:30 -0700981 }
982
983 if (is_mac) {
984 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700985 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700986 "src/ports/SkFontHost_mac.cpp",
987 "src/ports/SkImageEncoder_CG.cpp",
988 "src/ports/SkImageGeneratorCG.cpp",
989 ]
mtklein09e61f72016-08-23 13:35:28 -0700990 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400991 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
992 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700993 "ApplicationServices.framework",
994 "OpenGL.framework",
995 ]
mtkleinc04ff472016-06-23 10:29:30 -0700996 }
abarth6fc8ff02016-07-15 15:15:15 -0700997
Mike Klein7d302882016-11-03 14:06:31 -0400998 if (is_ios) {
999 sources += [
1000 "src/ports/SkDebug_stdio.cpp",
1001 "src/ports/SkFontHost_mac.cpp",
1002 "src/ports/SkImageEncoder_CG.cpp",
1003 "src/ports/SkImageGeneratorCG.cpp",
1004 ]
1005 libs += [
1006 "CoreFoundation.framework",
1007 "CoreGraphics.framework",
1008 "CoreText.framework",
1009 "ImageIO.framework",
1010 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001011
1012 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1013 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001014 ]
1015 }
1016
abarth6fc8ff02016-07-15 15:15:15 -07001017 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001018 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001019 }
mtkleinc04ff472016-06-23 10:29:30 -07001020}
1021
Kevin Lubickcbcff382018-10-02 09:02:18 -04001022static_library("pathkit") {
1023 public_configs = [ ":skia_public" ]
1024 configs += skia_library_configs
1025
1026 deps = [
1027 ":arm64",
1028 ":armv7",
1029 ":avx",
1030 ":crc32",
1031 ":hsw",
1032 ":none",
1033 ":sse2",
1034 ":sse41",
1035 ":sse42",
1036 ":ssse3",
1037 ]
1038
1039 # This file (and all GN files in Skia) are designed to work with an
1040 # empty sources assignment filter; we handle all that explicitly.
1041 # We clear the filter here for clients who may have set up a global filter.
1042 set_sources_assignment_filter([])
1043
1044 sources = []
1045 sources += skia_pathops_sources
1046 sources += [
1047 "src/core/SkAnalyticEdge.cpp",
1048 "src/core/SkArenaAlloc.cpp",
1049 "src/core/SkCubicMap.cpp",
1050 "src/core/SkEdge.cpp",
1051 "src/core/SkEdgeBuilder.cpp",
1052 "src/core/SkEdgeClipper.cpp",
1053 "src/core/SkGeometry.cpp",
1054 "src/core/SkLineClipper.cpp",
1055 "src/core/SkMallocPixelRef.cpp",
1056 "src/core/SkMath.cpp",
1057 "src/core/SkMatrix.cpp",
1058 "src/core/SkOpts.cpp",
1059 "src/core/SkPaint.cpp",
1060 "src/core/SkPath.cpp",
1061 "src/core/SkPathEffect.cpp",
1062 "src/core/SkPathMeasure.cpp",
1063 "src/core/SkPathRef.cpp",
1064 "src/core/SkPoint.cpp",
1065 "src/core/SkRRect.cpp",
1066 "src/core/SkRect.cpp",
1067 "src/core/SkSemaphore.cpp",
1068 "src/core/SkStream.cpp",
1069 "src/core/SkString.cpp",
1070 "src/core/SkStringUtils.cpp",
1071 "src/core/SkStroke.cpp",
1072 "src/core/SkStrokeRec.cpp",
1073 "src/core/SkStrokerPriv.cpp",
1074 "src/core/SkThreadID.cpp",
1075 "src/core/SkUtils.cpp",
1076 "src/effects/SkDashPathEffect.cpp",
1077 "src/effects/SkTrimPathEffect.cpp",
1078 "src/ports/SkDebug_stdio.cpp",
1079 "src/ports/SkMemory_malloc.cpp",
1080 "src/utils/SkDashPath.cpp",
1081 "src/utils/SkParse.cpp",
1082 "src/utils/SkParsePath.cpp",
1083 "src/utils/SkUTF.cpp",
1084 ]
1085}
1086
mtkleinc095df52016-08-24 12:23:52 -07001087# Targets guarded by skia_enable_tools may use //third_party freely.
1088if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001089 # Used by gn_to_bp.py to list our public include dirs.
1090 source_set("public") {
1091 configs += [ ":skia_public" ]
1092 }
1093
Mike Kleinc36dedf2016-11-18 09:35:28 -05001094 config("skia.h_config") {
1095 include_dirs = [ "$target_gen_dir" ]
1096 }
1097 action("skia.h") {
1098 public_configs = [ ":skia.h_config" ]
1099 skia_h = "$target_gen_dir/skia.h"
1100 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001101
1102 # TODO: would be cool to not hard-code these here, but how?
1103 module_public_includes = [
1104 "modules/sksg/include",
1105 "modules/skottie/include",
1106 ]
1107 args =
1108 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1109 [ rebase_path(skia_h, root_build_dir) ] +
1110 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001111 depfile = "$skia_h.deps"
1112 outputs = [
1113 skia_h,
1114 ]
1115 }
1116
Brian Osmanc9a42472018-05-31 13:17:12 -04001117 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001118 executable("fiddle") {
1119 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001120 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001121 "tools/fiddle/draw.cpp",
1122 "tools/fiddle/fiddle_main.cpp",
1123 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001124
1125 if (skia_use_egl) {
1126 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001127 } else {
1128 sources += [ "tools/fiddle/null_context.cpp" ]
1129 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001130 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001131 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001132 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001133 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001134 ":skia",
1135 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001136 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001137 ]
1138 }
1139 }
1140
Brian Osmanc9a42472018-05-31 13:17:12 -04001141 source_set("public_headers_warnings_check") {
1142 sources = [
1143 "tools/public_headers_warnings_check.cpp",
1144 ]
1145 configs -= [ "//gn:warnings_except_public_headers" ]
1146 deps = [
1147 ":skia",
1148 ":skia.h",
1149 "modules/skottie",
1150 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001151 }
1152
mtkleinc095df52016-08-24 12:23:52 -07001153 template("test_lib") {
1154 config(target_name + "_config") {
1155 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001156 if (defined(invoker.public_defines)) {
1157 defines = invoker.public_defines
1158 }
mtklein25c81d42016-07-27 13:55:26 -07001159 }
mtkleinc095df52016-08-24 12:23:52 -07001160 source_set(target_name) {
1161 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1162 public_configs = [
1163 ":" + target_name + "_config",
1164 ":skia_private",
1165 ]
1166
1167 if (!defined(deps)) {
1168 deps = []
1169 }
1170 deps += [ ":skia" ]
1171 testonly = true
1172 }
mtklein25c81d42016-07-27 13:55:26 -07001173 }
mtklein25c81d42016-07-27 13:55:26 -07001174
Mike Kleine6682eb2017-01-05 10:54:57 -05001175 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001176 if (is_ios) {
1177 app_name = target_name
1178 gen_path = target_gen_dir
1179
1180 action("${app_name}_generate_info_plist") {
1181 script = "//gn/gen_plist_ios.py"
1182 outputs = [
1183 "$gen_path/${app_name}_Info.plist",
1184 ]
1185 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1186 }
1187
1188 bundle_data("${app_name}_bundle_info_plist") {
1189 public_deps = [
1190 ":${app_name}_generate_info_plist",
1191 ]
1192 sources = [
1193 "$gen_path/${app_name}_Info.plist",
1194 ]
1195 outputs = [
1196 "{{bundle_root_dir}}/Info.plist",
1197 ]
1198 }
1199
Jim Van Verth329c5a62017-11-29 11:42:33 -05001200 bundle_ios_data =
1201 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1202
1203 if (bundle_ios_data) {
1204 has_skps =
1205 "True" == exec_script("//gn/checkdir.py",
1206 [ rebase_path("skps", root_build_dir) ],
1207 "trim string")
1208 bundle_data("${app_name}_bundle_resources") {
1209 sources = [
1210 "resources",
1211 ]
1212 outputs = [
1213 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1214 "{{bundle_resources_dir}}/data/resources",
1215 ]
1216 }
1217
1218 if (has_skps) {
1219 bundle_data("${app_name}_bundle_skps") {
1220 sources = [
1221 "skps",
1222 ]
1223 outputs = [
1224 # Store in same folder as resources
1225 "{{bundle_resources_dir}}/data/skps",
1226 ]
1227 }
1228 }
1229 }
1230
Jim Van Verth443a9132017-11-28 09:45:26 -05001231 executable("${app_name}_generate_executable") {
1232 forward_variables_from(invoker,
1233 "*",
1234 [
1235 "output_name",
1236 "visibility",
1237 "is_shared_library",
1238 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001239 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001240 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001241 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1242 }
1243
1244 bundle_data("${app_name}_bundle_executable") {
1245 public_deps = [
1246 ":${app_name}_generate_executable",
1247 ]
1248 sources = [
1249 "$gen_path/$app_name",
1250 ]
1251 outputs = [
1252 "{{bundle_executable_dir}}/$app_name",
1253 ]
1254 testonly = true
1255 }
1256
1257 create_bundle("$app_name") {
1258 product_type = "com.apple.product-type.application"
1259 testonly = true
1260
1261 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1262 bundle_resources_dir = bundle_root_dir
1263 bundle_executable_dir = bundle_root_dir
1264 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1265
1266 deps = [
1267 ":${app_name}_bundle_executable",
1268 ":${app_name}_bundle_info_plist",
1269 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001270 if (bundle_ios_data) {
1271 deps += [ ":${app_name}_bundle_resources" ]
1272 if (has_skps) {
1273 deps += [ ":${app_name}_bundle_skps" ]
1274 }
1275 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001276
1277 # should only code sign when running on a device, not the simulator
1278 if (target_cpu != "x64") {
1279 code_signing_script = "//gn/codesign_ios.py"
1280 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1281 code_signing_outputs = [
1282 "$bundle_root_dir/_CodeSignature/CodeResources",
1283 "$bundle_root_dir/embedded.mobileprovision",
1284 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001285 code_signing_args = [
1286 rebase_path("$bundle_root_dir", root_build_dir),
1287 skia_ios_identity,
1288 skia_ios_profile,
1289 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001290 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001291 }
1292 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001293 # !is_ios
1294
1295 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1296 shared_library("lib" + target_name) {
1297 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1298 configs += [ ":skia_private" ]
1299 testonly = true
1300 }
1301 } else {
1302 _executable = target_name
1303 executable(_executable) {
1304 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1305 configs += [ ":skia_private" ]
1306 testonly = true
1307 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001308 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001309 if (is_android && skia_android_serial != "" && defined(_executable)) {
1310 action("push_" + target_name) {
1311 script = "gn/push_to_android.py"
1312 deps = [
1313 ":" + _executable,
1314 ]
1315 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1316 outputs = [
1317 _stamp,
1318 ]
1319 args = [
1320 rebase_path("$root_build_dir/$_executable"),
1321 skia_android_serial,
1322 rebase_path(_stamp),
1323 ]
1324 testonly = true
1325 }
Mike Klein7d921032017-01-05 12:20:41 -05001326 }
1327 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001328 }
1329
Greg Danielda16cce2018-08-01 09:23:57 -04001330 config("moltenvk_config") {
1331 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1332 if (is_ios) {
1333 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1334 } else {
1335 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1336 }
1337 cflags = [ "-F$moltenvk_framework_path" ]
1338 ldflags = [ "-F$moltenvk_framework_path" ]
1339 libs = [
1340 "MoltenVK.framework",
1341 "Metal.framework",
1342 "IOSurface.framework",
1343 "QuartzCore.framework",
1344 "Foundation.framework",
1345 ]
1346 if (is_ios) {
1347 libs += [ "UIKit.framework" ]
1348 } else {
1349 libs += [ "IOKit.framework" ]
1350 }
1351 defines = [ "SK_MOLTENVK" ]
1352 }
1353 }
1354
1355 source_set("moltenvk") {
1356 public_configs = [ ":moltenvk_config" ]
1357 }
1358
mtkleinc095df52016-08-24 12:23:52 -07001359 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001360 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001361 public_defines = []
1362 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001363
Brian Osmanc9a42472018-05-31 13:17:12 -04001364 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001365 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001366 sources = [
1367 "tools/gpu/GrContextFactory.cpp",
1368 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001369 "tools/gpu/MemoryCache.cpp",
1370 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001371 "tools/gpu/ProxyUtils.cpp",
1372 "tools/gpu/TestContext.cpp",
1373 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1374 "tools/gpu/gl/GLTestContext.cpp",
1375 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001376 "tools/gpu/gl/null/NullGLTestContext.cpp",
1377 "tools/gpu/mock/MockTestContext.cpp",
1378 ]
1379 libs = []
1380
1381 if (is_android || skia_use_egl) {
1382 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1383 } else if (is_ios) {
1384 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1385 libs += [ "OpenGLES.framework" ]
1386 } else if (is_linux) {
1387 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001388 libs += [
1389 "GLU",
1390 "X11",
1391 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001392 } else if (is_mac) {
1393 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1394 } else if (is_win) {
1395 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1396 libs += [
1397 "Gdi32.lib",
1398 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001399 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001400 }
mtklein25c81d42016-07-27 13:55:26 -07001401
Brian Osmanc9a42472018-05-31 13:17:12 -04001402 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001403
Brian Osmanc9a42472018-05-31 13:17:12 -04001404 if (skia_use_angle) {
1405 deps += [ "//third_party/angle2" ]
1406 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1407 }
Greg Danielb4d89562018-10-03 18:44:49 +00001408 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001409 if (skia_use_vulkan) {
1410 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1411 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001412 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1413 public_deps += [ ":moltenvk" ]
1414 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001415 }
1416 if (skia_use_metal) {
1417 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001418 }
mtklein25c81d42016-07-27 13:55:26 -07001419 }
mtklein25c81d42016-07-27 13:55:26 -07001420
mtkleinc095df52016-08-24 12:23:52 -07001421 test_lib("flags") {
1422 public_include_dirs = [ "tools/flags" ]
1423 sources = [
1424 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001425 ]
1426 }
1427 test_lib("common_flags") {
1428 public_include_dirs = [ "tools/flags" ]
1429 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001430 "tools/flags/SkCommonFlags.cpp",
1431 "tools/flags/SkCommonFlagsConfig.cpp",
1432 ]
1433 deps = [
mtklein046cb562016-09-16 10:23:12 -07001434 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001435 ]
1436 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001437 ":gpu_tool_utils",
1438 ]
1439 }
mtklein25c81d42016-07-27 13:55:26 -07001440
mtkleinc095df52016-08-24 12:23:52 -07001441 test_lib("tool_utils") {
1442 public_include_dirs = [
1443 "tools",
1444 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001445 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001446 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001447 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001448 ]
1449 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001450 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001451 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001452 "tools/DDLPromiseImageHelper.cpp",
1453 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001454 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001455 "tools/ProcStats.cpp",
1456 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001457 "tools/UrlDataManager.cpp",
1458 "tools/debugger/SkDebugCanvas.cpp",
1459 "tools/debugger/SkDrawCommand.cpp",
1460 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001461 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001462 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001463 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001464 "tools/fonts/SkTestFontMgr.h",
1465 "tools/fonts/SkTestSVGTypeface.cpp",
1466 "tools/fonts/SkTestSVGTypeface.h",
1467 "tools/fonts/SkTestTypeface.cpp",
1468 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001469 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001470 "tools/random_parse_path.cpp",
1471 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001472 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001473 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001474 "tools/trace/SkChromeTracingTracer.cpp",
1475 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001476 "tools/trace/SkDebugfTracer.cpp",
1477 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001478 "tools/trace/SkEventTracingPriv.cpp",
1479 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001480 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001481 libs = []
1482 if (is_ios) {
1483 sources += [ "tools/ios_utils.m" ]
1484 libs += [ "Foundation.framework" ]
1485 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001486 defines = []
1487 if (skia_tools_require_resources) {
1488 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1489 }
mtkleinc095df52016-08-24 12:23:52 -07001490 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001491 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001492 ":flags",
1493 "//third_party/libpng",
1494 ]
1495 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001496 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001497 "//third_party/jsoncpp",
1498 ]
1499 }
mtklein25c81d42016-07-27 13:55:26 -07001500
Mike Klein6e744122016-10-27 12:21:40 -04001501 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001502 test_lib("gm") {
1503 public_include_dirs = [ "gm" ]
1504 sources = gm_sources
1505 deps = [
scroggo19b91532016-10-24 09:03:26 -07001506 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001507 ":skia",
1508 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001509 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001510 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001511 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001512 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001513 public_deps = [
1514 ":gpu_tool_utils",
1515 ]
mtkleinc095df52016-08-24 12:23:52 -07001516 }
mtklein25c81d42016-07-27 13:55:26 -07001517
Mike Klein6e744122016-10-27 12:21:40 -04001518 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001519 test_lib("tests") {
1520 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001521 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001522 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001523 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001524 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001525 if (!(skia_use_freetype && skia_use_fontconfig)) {
1526 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1527 }
mtkleinc095df52016-08-24 12:23:52 -07001528 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001529 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001530 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001531 ":skia",
1532 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001533 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001534 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001535 "//third_party/libpng",
1536 "//third_party/zlib",
1537 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001538 public_deps = [
1539 ":gpu_tool_utils", # Test.h #includes headers from this target.
1540 ]
mtkleinc095df52016-08-24 12:23:52 -07001541 }
mtklein2f3416d2016-08-02 16:02:05 -07001542
Mike Klein6e744122016-10-27 12:21:40 -04001543 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001544 test_lib("bench") {
1545 public_include_dirs = [ "bench" ]
1546 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001547 deps = [
1548 ":flags",
1549 ":gm",
1550 ":gpu_tool_utils",
1551 ":skia",
1552 ":tool_utils",
1553 ]
1554 }
mtklein2b6870c2016-07-28 14:17:33 -07001555
mtkleinc095df52016-08-24 12:23:52 -07001556 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001557 public_include_dirs = []
1558 if (skia_use_expat) {
1559 public_include_dirs += [ "experimental/svg/model" ]
1560 sources = [
1561 "experimental/svg/model/SkSVGAttribute.cpp",
1562 "experimental/svg/model/SkSVGAttributeParser.cpp",
1563 "experimental/svg/model/SkSVGCircle.cpp",
1564 "experimental/svg/model/SkSVGClipPath.cpp",
1565 "experimental/svg/model/SkSVGContainer.cpp",
1566 "experimental/svg/model/SkSVGDOM.cpp",
1567 "experimental/svg/model/SkSVGEllipse.cpp",
1568 "experimental/svg/model/SkSVGGradient.cpp",
1569 "experimental/svg/model/SkSVGLine.cpp",
1570 "experimental/svg/model/SkSVGLinearGradient.cpp",
1571 "experimental/svg/model/SkSVGNode.cpp",
1572 "experimental/svg/model/SkSVGPath.cpp",
1573 "experimental/svg/model/SkSVGPattern.cpp",
1574 "experimental/svg/model/SkSVGPoly.cpp",
1575 "experimental/svg/model/SkSVGRadialGradient.cpp",
1576 "experimental/svg/model/SkSVGRect.cpp",
1577 "experimental/svg/model/SkSVGRenderContext.cpp",
1578 "experimental/svg/model/SkSVGSVG.cpp",
1579 "experimental/svg/model/SkSVGShape.cpp",
1580 "experimental/svg/model/SkSVGStop.cpp",
1581 "experimental/svg/model/SkSVGTransformableNode.cpp",
1582 "experimental/svg/model/SkSVGUse.cpp",
1583 "experimental/svg/model/SkSVGValue.cpp",
1584 ]
1585 deps = [
1586 ":skia",
1587 ":xml",
1588 ]
1589 }
mtkleinc095df52016-08-24 12:23:52 -07001590 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001591
Mike Klein38af9432016-11-11 11:39:44 -05001592 if (skia_use_lua) {
1593 test_lib("lua") {
1594 public_include_dirs = []
1595 sources = [
1596 "src/utils/SkLua.cpp",
1597 "src/utils/SkLuaCanvas.cpp",
1598 ]
1599 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001600 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001601 "//third_party/lua",
1602 ]
1603 }
1604
Mike Kleine6682eb2017-01-05 10:54:57 -05001605 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001606 sources = [
1607 "tools/lua/lua_app.cpp",
1608 ]
1609 deps = [
1610 ":lua",
1611 ":skia",
1612 "//third_party/lua",
1613 ]
Mike Klein38af9432016-11-11 11:39:44 -05001614 }
1615
Mike Kleine6682eb2017-01-05 10:54:57 -05001616 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001617 sources = [
1618 "tools/lua/lua_pictures.cpp",
1619 ]
1620 deps = [
1621 ":flags",
1622 ":lua",
1623 ":skia",
1624 ":tool_utils",
1625 "//third_party/lua",
1626 ]
Mike Klein38af9432016-11-11 11:39:44 -05001627 }
1628 }
1629
Cary Clark8032b982017-07-28 11:04:54 -04001630 test_app("bookmaker") {
1631 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001632 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001633 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001634 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001635 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001636 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001637 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001638 "tools/bookmaker/includeParser.cpp",
1639 "tools/bookmaker/includeWriter.cpp",
1640 "tools/bookmaker/mdOut.cpp",
1641 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001642 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001643 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001644 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001645 ]
1646 deps = [
1647 ":flags",
1648 ":skia",
1649 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001650 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001651 ]
1652 }
1653
Florin Malitabfe876a2018-09-02 12:33:59 -04001654 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001655 test_app("skottie_tool") {
1656 deps = [
1657 "modules/skottie:tool",
1658 ]
1659 }
1660 }
1661
Kevin Lubickebf648e2017-09-21 13:45:16 -04001662 if (target_cpu != "wasm") {
1663 import("gn/samples.gni")
1664 test_lib("samples") {
1665 public_include_dirs = [ "samplecode" ]
1666 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001667 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001668 public_deps = [
1669 ":tool_utils",
1670 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001671 deps = [
1672 ":experimental_svg_model",
1673 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001674 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001675 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001676 ]
Mike Klein38af9432016-11-11 11:39:44 -05001677
Ruiqi Maof5101492018-06-29 14:32:21 -04001678 # NIMA does not build on Windows clang
1679 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001680 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001681 deps += [ "//third_party/Nima-Cpp" ]
1682 }
1683
Kevin Lubickebf648e2017-09-21 13:45:16 -04001684 if (skia_use_lua) {
1685 sources += [ "samplecode/SampleLua.cpp" ]
1686 deps += [
1687 ":lua",
1688 "//third_party/lua",
1689 ]
1690 }
1691 }
Mike Klein7af351a2018-07-27 09:54:43 -04001692 test_app("imgcvt") {
1693 sources = [
1694 "tools/imgcvt.cpp",
1695 ]
1696 deps = [
1697 ":skcms",
1698 ":skia",
1699 ]
1700 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001701 test_app("dm") {
1702 sources = [
1703 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001704 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001705 "dm/DMJsonWriter.cpp",
1706 "dm/DMSrcSink.cpp",
1707 ]
1708 include_dirs = [ "tests" ]
1709 deps = [
1710 ":common_flags",
1711 ":experimental_svg_model",
1712 ":flags",
1713 ":gm",
1714 ":gpu_tool_utils",
1715 ":skia",
1716 ":tests",
1717 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001718 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001719 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001720 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001721 "//third_party/jsoncpp",
1722 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001723 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001724
1725 # NIMA does not build on Windows clang
1726 if (!is_win || !is_clang) {
1727 deps += [ "//third_party/Nima-Cpp" ]
1728 }
Mike Klein38af9432016-11-11 11:39:44 -05001729 }
Brian Osman16adfa32016-10-18 14:42:44 -04001730 }
1731
Mike Kleina8a51ce2018-01-09 12:34:11 -05001732 if (!is_win) {
1733 test_app("remote_demo") {
1734 sources = [
1735 "tools/remote_demo.cpp",
1736 ]
1737 deps = [
1738 ":skia",
1739 ]
1740 }
1741 }
1742
Mike Kleine6682eb2017-01-05 10:54:57 -05001743 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001744 sources = [
1745 "bench/nanobench.cpp",
1746 ]
1747 deps = [
1748 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001749 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001750 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001751 ":flags",
1752 ":gm",
1753 ":gpu_tool_utils",
1754 ":skia",
1755 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001756 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001757 "//third_party/jsoncpp",
1758 ]
mtklein2b6870c2016-07-28 14:17:33 -07001759 }
halcanary19a97202016-08-03 15:08:04 -07001760
Ravi Mistry10d36c52017-01-31 09:49:18 -05001761 test_app("skpinfo") {
1762 sources = [
1763 "tools/skpinfo.cpp",
1764 ]
1765 deps = [
1766 ":flags",
1767 ":skia",
1768 ]
1769 }
1770
Brian Osmanc9a42472018-05-31 13:17:12 -04001771 test_app("skpbench") {
1772 sources = [
1773 "tools/skpbench/skpbench.cpp",
1774 ]
1775 deps = [
1776 ":flags",
1777 ":gpu_tool_utils",
1778 ":skia",
1779 ":tool_utils",
1780 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001781 }
1782
Mike Kleine6682eb2017-01-05 10:54:57 -05001783 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001784 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001785 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001786 ]
1787 deps = [
1788 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001789 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001790 ]
halcanary3eee9d92016-09-10 07:01:53 -07001791 }
mtklein046cb562016-09-16 10:23:12 -07001792
Ben Wagner219f3622017-07-17 15:32:25 -04001793 test_app("create_test_font") {
1794 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001795 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001796 ]
1797 deps = [
1798 ":skia",
1799 ]
1800 assert_no_deps = [
1801 # tool_utils requires the output of this app.
1802 ":tool_utils",
1803 ]
1804 }
1805
Florin Malita5d3ff432018-07-31 16:38:43 -04001806 if (skia_use_expat) {
1807 test_app("create_test_font_color") {
1808 sources = [
1809 "tools/fonts/create_test_font_color.cpp",
1810 ]
1811 deps = [
1812 ":flags",
1813 ":skia",
1814 ":tool_utils",
1815 ]
1816 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001817 }
1818
Mike Kleine6682eb2017-01-05 10:54:57 -05001819 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001820 sources = [
1821 "tools/get_images_from_skps.cpp",
1822 ]
1823 deps = [
1824 ":flags",
1825 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001826 ]
mtklein046cb562016-09-16 10:23:12 -07001827 }
mtkleinecbc5262016-09-22 11:51:24 -07001828
Kevin Lubickebf648e2017-09-21 13:45:16 -04001829 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001830 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001831 sources = [
1832 "tools/skiaserve/Request.cpp",
1833 "tools/skiaserve/Response.cpp",
1834 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001835 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1836 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1837 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1838 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1839 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1840 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1841 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1842 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1843 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001844 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1845 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001846 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1847 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1848 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1849 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1850 ]
1851 deps = [
1852 ":flags",
1853 ":gpu_tool_utils",
1854 ":skia",
1855 ":tool_utils",
1856 "//third_party/jsoncpp",
1857 "//third_party/libmicrohttpd",
1858 "//third_party/libpng",
1859 ]
Mike Klein7d302882016-11-03 14:06:31 -04001860 }
mtkleinecbc5262016-09-22 11:51:24 -07001861 }
kjlubick14f984b2016-10-03 11:49:45 -07001862
Mike Kleine6682eb2017-01-05 10:54:57 -05001863 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001864 include_dirs = [
1865 "tools",
1866 "tools/debugger",
1867 ]
kjlubick14f984b2016-10-03 11:49:45 -07001868 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001869 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001870 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001871 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001872 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001873 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001874 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001875 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001876 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001877 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001878 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001879 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001880 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001881 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001882 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1883 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001884 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001885 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001886 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001887 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001888 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1889 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001890 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001891 "tools/UrlDataManager.cpp",
1892 "tools/debugger/SkDebugCanvas.cpp",
1893 "tools/debugger/SkDrawCommand.cpp",
1894 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001895 ]
1896 deps = [
1897 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001898 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001899 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001900 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001901 "//third_party/jsoncpp",
1902 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001903 ]
kjlubick14f984b2016-10-03 11:49:45 -07001904 }
Mike Klein38312422016-10-05 15:41:01 -04001905
Mike Kleine6682eb2017-01-05 10:54:57 -05001906 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001907 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001908 rebase_path("tests/skia_test.cpp"),
1909 rebase_path("tests/Test.cpp"),
1910 ]
caryclark9feb6322016-10-25 08:58:26 -07001911 deps = [
1912 ":flags",
1913 ":gpu_tool_utils",
1914 ":skia",
1915 ":tool_utils",
1916 ]
caryclark9feb6322016-10-25 08:58:26 -07001917 }
1918
Mike Kleine6682eb2017-01-05 10:54:57 -05001919 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001920 sources = [
1921 "tools/DumpRecord.cpp",
1922 "tools/dump_record.cpp",
1923 ]
1924 deps = [
1925 ":flags",
1926 ":skia",
1927 ]
Mike Klein38312422016-10-05 15:41:01 -04001928 }
bungemanfe917272016-10-13 17:36:40 -04001929
Mike Kleine6682eb2017-01-05 10:54:57 -05001930 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001931 sources = [
1932 "tools/skdiff/skdiff.cpp",
1933 "tools/skdiff/skdiff_html.cpp",
1934 "tools/skdiff/skdiff_main.cpp",
1935 "tools/skdiff/skdiff_utils.cpp",
1936 ]
1937 deps = [
1938 ":skia",
1939 ":tool_utils",
1940 ]
bungemanfe917272016-10-13 17:36:40 -04001941 }
halcanarya73d76a2016-10-17 13:19:02 -07001942
Mike Kleine6682eb2017-01-05 10:54:57 -05001943 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001944 sources = [
1945 "tools/skp_parser.cpp",
1946 ]
1947 deps = [
1948 ":skia",
1949 ":tool_utils",
1950 "//third_party/jsoncpp",
1951 ]
halcanarya73d76a2016-10-17 13:19:02 -07001952 }
Brian Osman16adfa32016-10-18 14:42:44 -04001953
Brian Osmanc9a42472018-05-31 13:17:12 -04001954 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001955 test_lib("skqp_lib") {
1956 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001957 defines =
1958 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001959 if (skia_skqp_enable_driver_correctness_workarounds) {
1960 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1961 }
Hal Canary75427132017-10-11 16:00:31 -04001962 sources = [
1963 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001964 "tools/skqp/gm_knowledge.cpp",
1965 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001966 ]
1967 deps = [
1968 ":gm",
1969 ":gpu_tool_utils",
1970 ":skia",
1971 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001972 ":tool_utils",
1973 ]
1974 }
1975 test_app("skqp") {
1976 sources = [
1977 "tools/skqp/skqp.cpp",
1978 ]
1979 deps = [
1980 ":skia",
1981 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001982 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001983 "//third_party/googletest",
1984 ]
1985 }
1986 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001987 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001988 test_app("skqp_app") {
1989 is_shared_library = true
1990 sources = [
1991 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1992 ]
1993 deps = [
1994 ":skia",
1995 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001996 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001997 ]
1998 libs = [ "android" ]
1999 }
2000 }
Stan Iliev93151722018-08-02 11:10:52 -04002001 if (is_android && skia_enable_gpu) {
2002 test_app("skottie_android") {
2003 is_shared_library = true
2004
2005 sources = [
2006 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2007 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2008 ]
2009 libs = []
2010
2011 include_dirs = []
2012 deps = [
2013 ":skia",
2014 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002015 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002016 ]
2017 }
2018 }
Hal Canary75427132017-10-11 16:00:31 -04002019
Hal Canarya9de7602018-01-19 13:08:23 -05002020 test_app("list_gms") {
2021 sources = [
2022 "tools/list_gms.cpp",
2023 ]
2024 deps = [
2025 ":gm",
2026 ":skia",
2027 ]
2028 }
2029 test_app("list_gpu_unit_tests") {
2030 sources = [
2031 "dm/DMGpuTestProcs.cpp",
2032 "tools/list_gpu_unit_tests.cpp",
2033 ]
2034 deps = [
2035 ":skia",
2036 ":tests",
2037 ]
2038 }
2039
Brian Osmanc9a42472018-05-31 13:17:12 -04002040 test_lib("sk_app") {
2041 public_include_dirs = [ "tools/sk_app" ]
2042 sources = [
2043 "tools/sk_app/CommandSet.cpp",
2044 "tools/sk_app/GLWindowContext.cpp",
2045 "tools/sk_app/Window.cpp",
2046 ]
2047 libs = []
2048
2049 if (is_android) {
2050 sources += [
2051 "tools/sk_app/android/GLWindowContext_android.cpp",
2052 "tools/sk_app/android/RasterWindowContext_android.cpp",
2053 "tools/sk_app/android/Window_android.cpp",
2054 "tools/sk_app/android/main_android.cpp",
2055 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002056 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002057 libs += [ "android" ]
2058 } else if (is_linux) {
2059 sources += [
2060 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2061 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2062 "tools/sk_app/unix/Window_unix.cpp",
2063 "tools/sk_app/unix/keysym2ucs.c",
2064 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002065 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002066 libs += [
2067 "GL",
2068 "X11",
2069 ]
2070 } else if (is_win) {
2071 sources += [
2072 "tools/sk_app/win/GLWindowContext_win.cpp",
2073 "tools/sk_app/win/RasterWindowContext_win.cpp",
2074 "tools/sk_app/win/Window_win.cpp",
2075 "tools/sk_app/win/main_win.cpp",
2076 ]
Brian Salomon194db172017-08-17 14:37:06 -04002077 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002078 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002079 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002080 } else if (is_mac) {
2081 sources += [
2082 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2083 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2084 "tools/sk_app/mac/Window_mac.cpp",
2085 "tools/sk_app/mac/main_mac.cpp",
2086 ]
2087 libs += [
2088 "QuartzCore.framework",
2089 "Cocoa.framework",
2090 "Foundation.framework",
2091 ]
2092 } else if (is_ios) {
2093 sources += [
2094 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2095 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2096 "tools/sk_app/ios/Window_ios.cpp",
2097 "tools/sk_app/ios/main_ios.cpp",
2098 ]
2099 }
2100
2101 if (skia_use_vulkan) {
2102 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2103 if (is_android) {
2104 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2105 } else if (is_linux) {
2106 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2107 libs += [ "X11-xcb" ]
2108 } else if (is_win) {
2109 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2110 }
2111 }
2112
2113 deps = [
2114 ":gpu_tool_utils",
2115 ":skia",
2116 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002117 ]
2118 if (is_android) {
2119 deps += [ "//third_party/native_app_glue" ]
2120 } else if (is_mac || is_ios) {
2121 deps += [ "//third_party/libsdl" ]
2122 }
2123 if (skia_use_angle) {
2124 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002125 }
Brian Osman16adfa32016-10-18 14:42:44 -04002126 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002127
Brian Osmanc9a42472018-05-31 13:17:12 -04002128 test_app("viewer") {
2129 is_shared_library = is_android
2130 if (is_ios) {
2131 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002132 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002133 sources = [
2134 "tools/viewer/BisectSlide.cpp",
2135 "tools/viewer/GMSlide.cpp",
2136 "tools/viewer/ImGuiLayer.cpp",
2137 "tools/viewer/ImageSlide.cpp",
2138 "tools/viewer/SKPSlide.cpp",
2139 "tools/viewer/SampleSlide.cpp",
2140 "tools/viewer/SkottieSlide.cpp",
2141 "tools/viewer/SlideDir.cpp",
2142 "tools/viewer/StatsLayer.cpp",
2143 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002144 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002145 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002146 "tools/viewer/Viewer.cpp",
2147 ]
2148 libs = []
2149
Kevin Lubickd9699322018-10-30 15:08:53 -04002150 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002151 deps = [
2152 ":experimental_svg_model",
2153 ":flags",
2154 ":gm",
2155 ":gpu_tool_utils",
2156 ":samples",
2157 ":sk_app",
2158 ":skia",
2159 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002160 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002161 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002162 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002163 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002164 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002165 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002166
2167 # NIMA does not build on Windows clang
2168 if (!is_win || !is_clang) {
2169 sources += [ "tools/viewer/NIMASlide.cpp" ]
2170 deps += [ "//third_party/Nima-Cpp" ]
2171 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002172 }
2173
ziadbbceddbc2018-06-19 13:57:15 -04002174 if (is_android) {
2175 test_app("arcore") {
2176 is_shared_library = true
2177 configs = [
2178 ":skia_public",
2179 "gn:default",
2180 ]
2181
2182 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2183 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2184 sources = []
2185 sources += skia_core_sources
2186 sources += skia_utils_sources
2187 sources += skia_xps_sources
2188 sources += [
2189 "src/android/SkAndroidFrameworkUtils.cpp",
2190 "src/android/SkAnimatedImage.cpp",
2191 "src/android/SkBitmapRegionCodec.cpp",
2192 "src/android/SkBitmapRegionDecoder.cpp",
2193 "src/codec/SkAndroidCodec.cpp",
2194 "src/codec/SkBmpBaseCodec.cpp",
2195 "src/codec/SkBmpCodec.cpp",
2196 "src/codec/SkBmpMaskCodec.cpp",
2197 "src/codec/SkBmpRLECodec.cpp",
2198 "src/codec/SkBmpStandardCodec.cpp",
2199 "src/codec/SkCodec.cpp",
2200 "src/codec/SkCodecImageGenerator.cpp",
2201 "src/codec/SkColorTable.cpp",
2202 "src/codec/SkGifCodec.cpp",
2203 "src/codec/SkMaskSwizzler.cpp",
2204 "src/codec/SkMasks.cpp",
2205 "src/codec/SkSampledCodec.cpp",
2206 "src/codec/SkSampler.cpp",
2207 "src/codec/SkStreamBuffer.cpp",
2208 "src/codec/SkSwizzler.cpp",
2209 "src/codec/SkWbmpCodec.cpp",
2210 "src/images/SkImageEncoder.cpp",
2211 "src/ports/SkDiscardableMemory_none.cpp",
2212 "src/ports/SkImageGenerator_skia.cpp",
2213 "src/ports/SkMemory_malloc.cpp",
2214 "src/ports/SkOSFile_stdio.cpp",
2215 "src/sfnt/SkOTTable_name.cpp",
2216 "src/sfnt/SkOTUtils.cpp",
2217 "src/utils/mac/SkStream_mac.cpp",
2218 "third_party/gif/SkGifImageReader.cpp",
2219 ]
2220 deps = [
2221 ":tool_utils",
2222 "modules/skottie",
2223 "modules/skshaper",
2224 ]
2225 }
2226 }
2227
Brian Osmanc9a42472018-05-31 13:17:12 -04002228 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002229 test_app("HelloWorld") {
2230 sources = [
2231 "example/HelloWorld.cpp",
2232 ]
2233 libs = []
2234
2235 include_dirs = []
2236 deps = [
2237 ":flags",
2238 ":gpu_tool_utils",
2239 ":sk_app",
2240 ":skia",
2241 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002242 ]
2243 }
2244 }
2245
Brian Osmanc9a42472018-05-31 13:17:12 -04002246 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002247 test_app("SkiaSDLExample") {
2248 sources = [
2249 "example/SkiaSDLExample.cpp",
2250 ]
2251 libs = []
2252 include_dirs = []
2253 deps = [
2254 ":gpu_tool_utils",
2255 ":skia",
2256 "//third_party/libsdl",
2257 ]
2258 }
2259 }
2260
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002261 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2262 action_foreach("generate_mocs") {
2263 script = "gn/call.py"
2264 sources = [
2265 "tools/mdbviz/MainWindow.h",
2266 ]
2267 outputs = [
2268 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2269 ]
2270 args = [
2271 "$skia_qt_path" + "/bin/moc",
2272 "{{source}}",
2273 "-o",
2274 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2275 ]
2276 }
2277 action_foreach("generate_resources") {
2278 script = "gn/call.py"
2279 sources = [
2280 "tools/mdbviz/resources.qrc",
2281 ]
2282 outputs = [
2283 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2284 ]
2285 args = [
2286 "$skia_qt_path" + "/bin/rcc",
2287 "{{source}}",
2288 "-o",
2289 "gen/mdbviz/{{source_name_part}}_res.cpp",
2290 ]
2291 }
2292 test_app("mdbviz") {
2293 if (is_win) {
2294 # on Windows we need to disable some exception handling warnings due to the Qt headers
2295 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2296 }
2297 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002298 "tools/UrlDataManager.cpp",
2299 "tools/debugger/SkDebugCanvas.cpp",
2300 "tools/debugger/SkDrawCommand.cpp",
2301 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002302 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002303 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002304 "tools/mdbviz/main.cpp",
2305
2306 # generated files
2307 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2308 "$target_gen_dir/mdbviz/resources_res.cpp",
2309 ]
2310 lib_dirs = [ "$skia_qt_path/lib" ]
2311 libs = [
2312 "Qt5Core.lib",
2313 "Qt5Gui.lib",
2314 "Qt5Widgets.lib",
2315 ]
2316 include_dirs = [
2317 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002318 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002319 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002320 "tools",
2321 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002322 ]
2323 deps = [
2324 ":generate_mocs",
2325 ":generate_resources",
2326 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002327 "//third_party/jsoncpp",
2328 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002329 ]
2330 }
2331 }
2332
Mike Kleine459afd2017-03-03 09:21:30 -05002333 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002334 copy("gdbserver") {
2335 sources = [
2336 "$ndk/$ndk_gdbserver",
2337 ]
2338 outputs = [
2339 "$root_out_dir/gdbserver",
2340 ]
2341 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002342 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002343
2344 if (skia_use_opencl) {
2345 test_app("hello-opencl") {
2346 sources = [
2347 "src/compute/common/cl/assert_cl.c",
2348 "src/compute/common/cl/find_cl.c",
2349 "tools/hello-opencl.cpp",
2350 ]
2351 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002352 if (is_linux) {
2353 libs = [ "OpenCL" ]
2354 } else if (is_win) {
2355 libs = [ "OpenCL.lib" ]
2356 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002357 }
2358 }
mtklein25c81d42016-07-27 13:55:26 -07002359}