blob: 9cf1ca87270102b4ba067505c1a52136d63e961d [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
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050029 skia_use_fixed_gamma_text = is_android
Mike Klein7d302882016-11-03 14:06:31 -040030 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070031 skia_use_libjpeg_turbo = true
32 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070033 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050034 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040035 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040036 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040037 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070038 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040039 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040040 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070041 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070042
Mike Klein7d921032017-01-05 12:20:41 -050043 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040044 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000045 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050046 skia_enable_discrete_gpu = true
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
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050072 skia_enable_fontmgr_empty = false
73 skia_enable_fontmgr_custom = (is_linux || target_cpu == "wasm") &&
74 skia_use_freetype && !skia_use_fontconfig
75 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
76 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Mike Klein10d665d2016-11-01 11:46:10 -040077
Mike Klein4d598a32016-10-31 13:44:49 -040078 if (is_android) {
79 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070080 } else if (is_fuchsia) {
81 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040082 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040083 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
84 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040085 }
Jim Van Verth4e502972017-12-07 15:16:10 -050086
87 if (is_ios) {
88 skia_ios_identity = ".*Google.*"
89 skia_ios_profile = "Google Development"
90 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040091}
Brian Salomon789e25e2016-09-30 13:41:03 -040092
Adam Barth54ef74a2017-10-13 10:59:38 -070093if (defined(skia_settings)) {
94 import(skia_settings)
95}
96
Brian Osmanc9a42472018-05-31 13:17:12 -040097# Our tools require static linking (they use non-exported symbols), and the GPU backend.
98skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070099
mtklein1211e0c2016-07-26 13:55:45 -0700100skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -0700101 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700102 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/codec",
104 "include/config",
105 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -0400106 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -0700107 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400108 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700109 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500110 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700111 "include/pathops",
112 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700113 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700114 "include/utils",
115 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700116]
117
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500118if (skia_enable_atlas_text) {
119 skia_public_includes += [ "include/atlastext" ]
120}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000121
mtkleinc04ff472016-06-23 10:29:30 -0700122# Skia public API, generally provided by :skia.
123config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700124 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400125 defines = []
126 if (is_component_build) {
127 defines += [ "SKIA_DLL" ]
128 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400129 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700130 defines += [ "SK_SAMPLES_FOR_X" ]
131 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400132 if (skia_enable_flutter_defines) {
133 defines += flutter_defines
134 }
mtklein06c35c02016-09-20 12:28:12 -0700135 if (!skia_enable_gpu) {
136 defines += [ "SK_SUPPORT_GPU=0" ]
137 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500138 if (skia_enable_atlas_text) {
139 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
140 }
Mike Reed025f7832018-11-12 09:27:05 -0500141 if (is_fuchsia) {
142 defines += fuchsia_defines
143 }
mtkleinc04ff472016-06-23 10:29:30 -0700144}
145
146# Skia internal APIs, used by Skia itself and a few test tools.
147config("skia_private") {
148 visibility = [ ":*" ]
149
150 include_dirs = [
151 "include/private",
152 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700153 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700154 "src/core",
155 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700156 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700157 "src/image",
158 "src/images",
159 "src/lazy",
160 "src/opts",
161 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700162 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700163 "src/ports",
164 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400165 "src/shaders",
166 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700167 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700168 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700169 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500170 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700171 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700172 ]
mtklein150d1132016-08-01 06:56:40 -0700173
Mike Reeda9e241d2017-05-03 10:52:00 -0400174 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500175 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700176 defines += [
177 "SK_GAMMA_EXPONENT=1.4",
178 "SK_GAMMA_CONTRAST=0.0",
179 ]
180 }
mtklein88a7ac02016-09-14 11:16:49 -0700181 if (is_official_build || is_android) {
182 # TODO(bsalomon): it'd be nice to make Android normal.
183 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
184 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400185 libs = []
186 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500187 if (skia_enable_gpu) {
188 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500189 if (is_skia_dev_build && skia_use_vulkan) {
190 include_dirs += [ "tools/gpu/vk" ]
191 }
Brian Salomon03e05842017-02-23 12:23:47 -0500192 }
Brian Osman34755e22016-12-05 09:46:02 -0500193 if (skia_use_angle) {
194 defines += [ "SK_ANGLE" ]
195 }
Brian Osman3f375d02016-12-28 11:19:22 -0500196 if (skia_enable_discrete_gpu) {
197 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
198 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400199 if (!is_official_build) {
200 defines += [ "GR_TEST_UTILS=1" ]
201 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400202 if (skia_llvm_path != "") {
203 defines += [ "SK_LLVM_AVAILABLE" ]
204 include_dirs += [ "$skia_llvm_path/include" ]
205 libs += [ skia_llvm_lib ]
206 lib_dirs += [ "$skia_llvm_path/lib/" ]
207 }
mtkleinc04ff472016-06-23 10:29:30 -0700208}
209
210# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
211config("skia_library") {
212 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700213 defines = [ "SKIA_IMPLEMENTATION=1" ]
214}
215
216skia_library_configs = [
217 ":skia_public",
218 ":skia_private",
219 ":skia_library",
220]
221
mtklein9b8583d2016-08-24 17:32:30 -0700222# Use for CPU-specific Skia code that needs particular compiler flags.
223template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500224 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700225 if (invoker.enabled) {
226 source_set(target_name) {
227 forward_variables_from(invoker, "*")
228 configs += skia_library_configs
229 }
230 } else {
231 # If not enabled, a phony empty target that swallows all otherwise unused variables.
232 source_set(target_name) {
233 forward_variables_from(invoker,
234 "*",
235 [
236 "sources",
237 "cflags",
238 ])
239 }
240 }
anmittala7eaf2e2016-08-17 13:57:26 -0700241}
242
mtklein422310d2016-08-16 18:28:43 -0700243is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700244
mtklein7d6fb2c2016-08-25 14:50:44 -0700245opts("none") {
246 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700248 cflags = []
249}
250
mtklein7d6fb2c2016-08-25 14:50:44 -0700251opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700252 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700254 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700255}
256
257opts("arm64") {
258 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700260 cflags = []
261}
262
263opts("crc32") {
264 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700265 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700266 cflags = [ "-march=armv8-a+crc" ]
267}
268
mtklein9b8583d2016-08-24 17:32:30 -0700269opts("sse2") {
270 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700271 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400272 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400273 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
274 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400275 cflags = [ "-msse2" ]
276 }
mtklein9b8583d2016-08-24 17:32:30 -0700277}
mtkleinc04ff472016-06-23 10:29:30 -0700278
mtklein9b8583d2016-08-24 17:32:30 -0700279opts("ssse3") {
280 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700281 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400282 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400283 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
284 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400285 cflags = [ "-mssse3" ]
286 }
mtklein9b8583d2016-08-24 17:32:30 -0700287}
mtkleinc04ff472016-06-23 10:29:30 -0700288
mtklein9b8583d2016-08-24 17:32:30 -0700289opts("sse41") {
290 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700291 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400292 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400293 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
294 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400295 cflags = [ "-msse4.1" ]
296 }
mtklein9b8583d2016-08-24 17:32:30 -0700297}
mtklein4e976072016-08-08 09:06:27 -0700298
mtklein9b8583d2016-08-24 17:32:30 -0700299opts("sse42") {
300 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700301 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400302 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400303 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
304 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400305 cflags = [ "-msse4.2" ]
306 }
mtklein9b8583d2016-08-24 17:32:30 -0700307}
308
309opts("avx") {
310 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700311 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400312 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000313 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400314 } else {
315 cflags = [ "-mavx" ]
316 }
mtkleinc04ff472016-06-23 10:29:30 -0700317}
318
Mike Klein1b9b7d52018-02-27 10:37:40 -0500319opts("hsw") {
320 enabled = is_x86
321 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400322 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500323 cflags = [ "/arch:AVX2" ]
324 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000325 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500326 }
327
328 # Oddly, clang-cl doesn't recognize this as a valid flag.
329 # If it ever does, it'd nice to move this up with -mavx2 and co.
330 if (is_clang && !is_win) {
331 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
332 # but nice to have, generating slightly better code for paths without explicit FMAs.
333 cflags += [ "-ffp-contract=fast" ]
334 }
335}
336
mtkleinc095df52016-08-24 12:23:52 -0700337# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700338template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500339 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700340 if (invoker.enabled) {
341 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700342 if (defined(invoker.public_defines)) {
343 defines = invoker.public_defines
344 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600345 if (defined(invoker.public_configs)) {
346 configs = invoker.public_configs
347 }
mtklein457b42a2016-08-23 13:56:37 -0700348 }
349 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700350 forward_variables_from(invoker,
351 "*",
352 [
353 "public_defines",
354 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700355 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700356 ])
mtklein457b42a2016-08-23 13:56:37 -0700357 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700358 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700359 if (defined(invoker.configs_to_remove)) {
360 configs -= invoker.configs_to_remove
361 }
mtklein457b42a2016-08-23 13:56:37 -0700362 }
363 } else {
mtklein457b42a2016-08-23 13:56:37 -0700364 source_set(target_name) {
365 forward_variables_from(invoker,
366 "*",
367 [
368 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400369 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700370 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700371 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700372 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700373 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700374 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700375 ])
mtkleincd01b032016-08-31 04:58:19 -0700376 if (defined(invoker.sources_when_disabled)) {
377 sources = invoker.sources_when_disabled
378 }
379 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700380 }
mtkleineb3c4252016-08-23 07:38:09 -0700381 }
mtklein457b42a2016-08-23 13:56:37 -0700382}
mtklein457b42a2016-08-23 13:56:37 -0700383
mtkleina45be612016-08-29 15:22:10 -0700384optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500385 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700386
387 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500388 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700389 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700390 ]
391 sources = [
392 "src/ports/SkFontMgr_android.cpp",
393 "src/ports/SkFontMgr_android_factory.cpp",
394 "src/ports/SkFontMgr_android_parser.cpp",
395 ]
396}
397
mtkleind2e39db2016-09-07 07:52:55 -0700398optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500399 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700400
401 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500402 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700403 ]
404 sources = [
405 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500406 "src/ports/SkFontMgr_custom.h",
407 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700408 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500409 "src/ports/SkFontMgr_custom_embedded.cpp",
410 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700411 ]
412}
413
Hal Canaryff2742e2018-01-30 11:35:47 -0500414optional("fontmgr_empty") {
415 enabled = skia_enable_fontmgr_empty
416 sources = [
417 "src/ports/SkFontMgr_empty_factory.cpp",
418 ]
419}
420
mtklein3cc22182016-08-29 13:26:14 -0700421optional("fontmgr_fontconfig") {
422 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700423
424 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500425 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700426 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700427 ]
428 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700429 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700430 "src/ports/SkFontConfigInterface_direct.cpp",
431 "src/ports/SkFontConfigInterface_direct_factory.cpp",
432 "src/ports/SkFontMgr_FontConfigInterface.cpp",
433 "src/ports/SkFontMgr_fontconfig.cpp",
434 "src/ports/SkFontMgr_fontconfig_factory.cpp",
435 ]
436}
437
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500438optional("fontmgr_custom_empty") {
439 enabled = skia_enable_fontmgr_custom_empty
mtkleincdedd0e2016-09-12 15:15:44 -0700440
441 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500442 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700443 ]
444 sources = [
445 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500446 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700447 "src/ports/SkFontMgr_custom_empty_factory.cpp",
448 ]
449}
450
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700451if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400452 executable("sksllex") {
453 sources = [
454 "src/sksl/lex/Main.cpp",
455 "src/sksl/lex/NFA.cpp",
456 "src/sksl/lex/RegexNode.cpp",
457 "src/sksl/lex/RegexParser.cpp",
458 ]
459 include_dirs = [ "src/sksl/lex" ]
460 }
461
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700462 action("run_sksllex") {
463 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400464 deps = [
465 ":sksllex(//gn/toolchain:$host_toolchain)",
466 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700467 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700468 "src/sksl/lex/sksl.lex",
469 ]
470
471 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
472 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
473 outputs = [
474 "$target_out_dir/" +
475 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
476 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
477 # confused due to the same file being named by two different paths
478 ]
479 sksllex_path = "$root_out_dir/"
480 sksllex_path += "sksllex"
481 if (host_os == "win") {
482 sksllex_path += ".exe"
483 }
484 args = [
485 rebase_path(sksllex_path),
486 rebase_path("bin/clang-format"),
487 rebase_path("src"),
488 ]
489 }
490} else {
491 group("run_sksllex") {
492 }
493}
494
495if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400496 executable("skslc") {
497 defines = [ "SKSL_STANDALONE" ]
498 sources = [
499 "src/sksl/SkSLMain.cpp",
500 ]
501 sources += skia_sksl_sources
502 include_dirs = [
503 "src/gpu",
504 "src/sksl",
505 ]
506 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500507 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 "//third_party/spirv-tools",
509 ]
510 }
511
512 skia_gpu_processor_outputs = []
513 foreach(src, skia_gpu_processor_sources) {
514 dir = get_path_info(src, "dir")
515 name = get_path_info(src, "name")
516
517 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
518 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
519 skia_gpu_processor_outputs += [
520 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
521 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
522 # confused due to the same file being named by two different paths
523 ]
524 }
525
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500526 action("create_sksl_enums") {
527 script = "gn/create_sksl_enums.py"
528 sources = [
529 "include/private/GrSharedEnums.h",
530 ]
531 outputs = [
532 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500533 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500534 ]
535 args = [
536 rebase_path(sources[0]),
537 rebase_path(outputs[0]),
538 ]
539 }
540
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 action("compile_processors") {
542 script = "gn/compile_processors.py"
543 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500544 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 ":skslc(//gn/toolchain:$host_toolchain)",
546 ]
547 sources = skia_gpu_processor_sources
548 outputs = skia_gpu_processor_outputs
549 skslc_path = "$root_out_dir/"
550 if (host_toolchain != default_toolchain_name) {
551 skslc_path += "$host_toolchain/"
552 }
553 skslc_path += "skslc"
554 if (host_os == "win") {
555 skslc_path += ".exe"
556 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400557 args = [
558 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400559 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400560 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400561 args += rebase_path(skia_gpu_processor_sources)
562 }
563} else {
564 skia_gpu_processor_outputs = []
565 group("compile_processors") {
566 }
567}
568
Mike Klein33ad63a2018-11-11 07:17:00 -0500569optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700570 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400571 deps = [
572 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700573 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700575 if (skia_generate_workarounds) {
576 deps += [ ":workaround_list" ]
577 }
mtkleine9fb3d52016-09-20 15:11:46 -0700578 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600579 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400580 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700581
Brian Salomon3d6801e2017-12-11 10:06:31 -0500582 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400583 if (!skia_enable_ccpr) {
584 sources -= skia_ccpr_sources
585 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
586 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400587 if (!skia_enable_nvpr) {
588 sources -= skia_nvpr_sources
589 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
590 }
mtklein06c35c02016-09-20 12:28:12 -0700591
592 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500593 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700594 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400595 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700596 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400597 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400598
599 # this lib is required to link against AHardwareBuffer
600 if (defined(ndk_api) && ndk_api >= 26) {
601 libs += [ "android" ]
602 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400603 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500604 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400605 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700606 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500607 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400608 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700609 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800611 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400613 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500614 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400615 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700616 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500617 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700618 }
mtkleine9fb3d52016-09-20 15:11:46 -0700619
620 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400621 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400622 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700623 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700624 if (skia_enable_vulkan_debug_layers) {
625 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
626 }
mtkleine9fb3d52016-09-20 15:11:46 -0700627 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400628
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400629 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400630 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400631 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
632 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400633
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400634 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400635 if (skia_use_metal) {
636 public_defines += [ "SK_METAL" ]
637 sources += skia_metal_sources
638 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400639 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400640 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400641 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500642
643 if (skia_enable_atlas_text) {
644 sources += skia_atlas_text_sources
645 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400646
647 if (is_debug) {
648 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
649 }
mtklein06c35c02016-09-20 12:28:12 -0700650}
651
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400652optional("heif") {
653 enabled = skia_use_libheif
654 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
655
656 deps = []
657
658 sources = [
659 "src/codec/SkHeifCodec.cpp",
660 ]
661}
662
mtklein63213812016-08-24 09:55:56 -0700663optional("jpeg") {
664 enabled = skia_use_libjpeg_turbo
665 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
666
mtklein63213812016-08-24 09:55:56 -0700667 deps = [
668 "//third_party/libjpeg-turbo:libjpeg",
669 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400670 public = [
671 "include/encode/SkJpegEncoder.h",
672 ]
mtklein63213812016-08-24 09:55:56 -0700673 sources = [
674 "src/codec/SkJpegCodec.cpp",
675 "src/codec/SkJpegDecoderMgr.cpp",
676 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700677 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400678 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700679 ]
680}
681
682optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500683 enabled = skia_use_zlib && skia_enable_pdf
684 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700685
mtklein63213812016-08-24 09:55:56 -0700686 deps = [
687 "//third_party/zlib",
688 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400689 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700690 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400691 }
brettwb9447282016-09-01 14:24:39 -0700692 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700693 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700694
695 if (skia_use_sfntly) {
696 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500697 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700698 }
699}
700
701optional("png") {
702 enabled = skia_use_libpng
703 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
704
mtklein63213812016-08-24 09:55:56 -0700705 deps = [
706 "//third_party/libpng",
707 ]
708 sources = [
709 "src/codec/SkIcoCodec.cpp",
710 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400711 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700712 ]
713}
714
scroggof84ad642016-10-31 09:02:57 -0700715optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400716 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700717 public_defines = [ "SK_CODEC_DECODES_RAW" ]
718
719 deps = [
720 "//third_party/dng_sdk",
721 "//third_party/libjpeg-turbo:libjpeg",
722 "//third_party/piex",
723 ]
724
725 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
726 # Skia.
727 configs_to_remove = [ "//gn:no_exceptions" ]
728
729 sources = [
scroggof84ad642016-10-31 09:02:57 -0700730 "src/codec/SkRawCodec.cpp",
731 ]
732}
733
Mike Klein852a8cb2018-05-15 10:46:58 -0400734import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400735source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400736 cflags = []
737 if (!is_win || is_clang) {
738 cflags += [
739 "-w",
740 "-std=c11",
741 ]
742 }
743
744 public = [
745 "third_party/skcms/skcms.h",
746 ]
747 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
748}
749
mtklein3cc22182016-08-29 13:26:14 -0700750optional("typeface_freetype") {
751 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700752
753 deps = [
754 "//third_party/freetype2",
755 ]
756 sources = [
757 "src/ports/SkFontHost_FreeType.cpp",
758 "src/ports/SkFontHost_FreeType_common.cpp",
759 ]
760}
761
mtklein457b42a2016-08-23 13:56:37 -0700762optional("webp") {
763 enabled = skia_use_libwebp
764 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
765
mtklein457b42a2016-08-23 13:56:37 -0700766 deps = [
767 "//third_party/libwebp",
768 ]
769 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700770 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400771 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700772 ]
mtkleineb3c4252016-08-23 07:38:09 -0700773}
774
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400775optional("wuffs") {
776 enabled = skia_use_wuffs
777 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
778
779 deps = [
780 "//third_party/wuffs",
781 ]
782 sources = [
783 "src/codec/SkWuffsCodec.cpp",
784 ]
785}
786
mtklein63213812016-08-24 09:55:56 -0700787optional("xml") {
788 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000789 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700790
mtklein63213812016-08-24 09:55:56 -0700791 deps = [
792 "//third_party/expat",
793 ]
794 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500795 "src/svg/SkSVGCanvas.cpp",
796 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700797 "src/xml/SkDOM.cpp",
798 "src/xml/SkXMLParser.cpp",
799 "src/xml/SkXMLWriter.cpp",
800 ]
801}
802
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700803if (skia_enable_gpu && skia_generate_workarounds) {
804 action("workaround_list") {
805 script = "tools/build_workaround_header.py"
806
807 inputs = [
808 "src/gpu/gpu_workaround_list.txt",
809 ]
810
811 # see comments in skia_compile_processors about out dir path shenanigans.
812 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700813 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700814
815 outputs = [
816 "$root_out_dir/$output_file",
817 ]
818 args = [
819 "--output-file",
820 "$output_file",
821 ]
822
823 foreach(file, inputs) {
824 args += [ rebase_path(file, root_build_dir) ]
825 }
826 }
827}
828
Mike Klein33ad63a2018-11-11 07:17:00 -0500829# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
830# TODO: rename :gpu_for_real back to :gpu when cleaning up.
831source_set("effects") {
832}
833source_set("gpu") {
834}
835
mtkleinc04ff472016-06-23 10:29:30 -0700836component("skia") {
837 public_configs = [ ":skia_public" ]
838 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700839
Mike Klein607b0a72018-11-07 16:17:34 -0500840 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500841 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500842 ":pdf",
843 ":skcms",
844 ]
845
mtkleinc04ff472016-06-23 10:29:30 -0700846 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700847 ":arm64",
848 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700849 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000850 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700851 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700852 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700853 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500854 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500855 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700856 ":fontmgr_fontconfig",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400857 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500858 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700859 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700860 ":none",
mtklein63213812016-08-24 09:55:56 -0700861 ":png",
scroggof84ad642016-10-31 09:02:57 -0700862 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700863 ":sse2",
864 ":sse41",
865 ":sse42",
866 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700867 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400868 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700869 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700870 ]
871
Kevin Lubick134be1d2018-10-30 15:05:04 -0400872 if (skia_enable_nima) {
873 deps += [ "//third_party/Nima-Cpp" ]
874 }
875
Chinmay Garde43f115c2016-11-16 15:04:12 -0800876 # This file (and all GN files in Skia) are designed to work with an
877 # empty sources assignment filter; we handle all that explicitly.
878 # We clear the filter here for clients who may have set up a global filter.
879 set_sources_assignment_filter([])
880
mtkleinc04ff472016-06-23 10:29:30 -0700881 sources = []
brettwb9447282016-09-01 14:24:39 -0700882 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700883 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500884 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000885 sources += skia_effects_sources
886 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700887 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400888 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500889 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700890 "src/android/SkBitmapRegionCodec.cpp",
891 "src/android/SkBitmapRegionDecoder.cpp",
892 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100893 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400894 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700895 "src/codec/SkBmpCodec.cpp",
896 "src/codec/SkBmpMaskCodec.cpp",
897 "src/codec/SkBmpRLECodec.cpp",
898 "src/codec/SkBmpStandardCodec.cpp",
899 "src/codec/SkCodec.cpp",
900 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400901 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400902 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700903 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700904 "src/codec/SkMaskSwizzler.cpp",
905 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700906 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700907 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700908 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700909 "src/codec/SkSwizzler.cpp",
910 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700911 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700912 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000913 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700914 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700915 "src/ports/SkMemory_malloc.cpp",
916 "src/ports/SkOSFile_stdio.cpp",
917 "src/sfnt/SkOTTable_name.cpp",
918 "src/sfnt/SkOTUtils.cpp",
919 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700920 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700921 ]
brettwb9447282016-09-01 14:24:39 -0700922
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400923 defines = []
924 if (!skia_enable_skpicture) {
925 defines = [ "SK_DISABLE_SKPICTURE" ]
926 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000927 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400928 sources += [ "src/core/SkPicture_none.cpp" ]
929 }
930
mtklein7d6fb2c2016-08-25 14:50:44 -0700931 libs = []
932
mtkleinc04ff472016-06-23 10:29:30 -0700933 if (is_win) {
934 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400935 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700936 "src/ports/SkDebug_win.cpp",
937 "src/ports/SkFontHost_win.cpp",
938 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500939 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700940 "src/ports/SkImageEncoder_WIC.cpp",
941 "src/ports/SkImageGeneratorWIC.cpp",
942 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700943 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 "src/ports/SkScalerContext_win_dw.cpp",
945 "src/ports/SkTLS_win.cpp",
946 "src/ports/SkTypeface_win_dw.cpp",
947 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400948 libs += [
949 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500950 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400951 "Ole32.lib",
952 "OleAut32.lib",
953 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500954 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400955 ]
mtkleinc04ff472016-06-23 10:29:30 -0700956 } else {
957 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700958 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700959 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700960 "src/ports/SkTLS_pthread.cpp",
961 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400962 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700963 }
964
mtklein7d6fb2c2016-08-25 14:50:44 -0700965 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500966 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500967 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500968 deps += [ "//third_party/cpu-features" ]
969 }
mtklein06c35c02016-09-20 12:28:12 -0700970 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700971 libs += [
972 "EGL",
973 "GLESv2",
974 "log",
975 ]
976 }
977
Kevin Lubick217056c2018-09-20 17:39:31 -0400978 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700979 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400980 if (skia_use_egl) {
981 libs += [ "GLESv2" ]
982 }
mtkleinc04ff472016-06-23 10:29:30 -0700983 }
984
985 if (is_mac) {
986 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700987 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700988 "src/ports/SkFontHost_mac.cpp",
989 "src/ports/SkImageEncoder_CG.cpp",
990 "src/ports/SkImageGeneratorCG.cpp",
991 ]
mtklein09e61f72016-08-23 13:35:28 -0700992 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400993 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
994 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700995 "ApplicationServices.framework",
996 "OpenGL.framework",
997 ]
mtkleinc04ff472016-06-23 10:29:30 -0700998 }
abarth6fc8ff02016-07-15 15:15:15 -0700999
Mike Klein7d302882016-11-03 14:06:31 -04001000 if (is_ios) {
1001 sources += [
1002 "src/ports/SkDebug_stdio.cpp",
1003 "src/ports/SkFontHost_mac.cpp",
1004 "src/ports/SkImageEncoder_CG.cpp",
1005 "src/ports/SkImageGeneratorCG.cpp",
1006 ]
1007 libs += [
1008 "CoreFoundation.framework",
1009 "CoreGraphics.framework",
1010 "CoreText.framework",
1011 "ImageIO.framework",
1012 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001013
1014 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1015 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001016 ]
1017 }
1018
abarth6fc8ff02016-07-15 15:15:15 -07001019 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001020 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001021 }
mtkleinc04ff472016-06-23 10:29:30 -07001022}
1023
Kevin Lubickcbcff382018-10-02 09:02:18 -04001024static_library("pathkit") {
1025 public_configs = [ ":skia_public" ]
1026 configs += skia_library_configs
1027
1028 deps = [
1029 ":arm64",
1030 ":armv7",
1031 ":avx",
1032 ":crc32",
1033 ":hsw",
1034 ":none",
1035 ":sse2",
1036 ":sse41",
1037 ":sse42",
1038 ":ssse3",
1039 ]
1040
1041 # This file (and all GN files in Skia) are designed to work with an
1042 # empty sources assignment filter; we handle all that explicitly.
1043 # We clear the filter here for clients who may have set up a global filter.
1044 set_sources_assignment_filter([])
1045
1046 sources = []
1047 sources += skia_pathops_sources
1048 sources += [
1049 "src/core/SkAnalyticEdge.cpp",
1050 "src/core/SkArenaAlloc.cpp",
1051 "src/core/SkCubicMap.cpp",
1052 "src/core/SkEdge.cpp",
1053 "src/core/SkEdgeBuilder.cpp",
1054 "src/core/SkEdgeClipper.cpp",
1055 "src/core/SkGeometry.cpp",
1056 "src/core/SkLineClipper.cpp",
1057 "src/core/SkMallocPixelRef.cpp",
1058 "src/core/SkMath.cpp",
1059 "src/core/SkMatrix.cpp",
1060 "src/core/SkOpts.cpp",
1061 "src/core/SkPaint.cpp",
1062 "src/core/SkPath.cpp",
1063 "src/core/SkPathEffect.cpp",
1064 "src/core/SkPathMeasure.cpp",
1065 "src/core/SkPathRef.cpp",
1066 "src/core/SkPoint.cpp",
1067 "src/core/SkRRect.cpp",
1068 "src/core/SkRect.cpp",
1069 "src/core/SkSemaphore.cpp",
1070 "src/core/SkStream.cpp",
1071 "src/core/SkString.cpp",
1072 "src/core/SkStringUtils.cpp",
1073 "src/core/SkStroke.cpp",
1074 "src/core/SkStrokeRec.cpp",
1075 "src/core/SkStrokerPriv.cpp",
1076 "src/core/SkThreadID.cpp",
1077 "src/core/SkUtils.cpp",
1078 "src/effects/SkDashPathEffect.cpp",
1079 "src/effects/SkTrimPathEffect.cpp",
1080 "src/ports/SkDebug_stdio.cpp",
1081 "src/ports/SkMemory_malloc.cpp",
1082 "src/utils/SkDashPath.cpp",
1083 "src/utils/SkParse.cpp",
1084 "src/utils/SkParsePath.cpp",
1085 "src/utils/SkUTF.cpp",
1086 ]
1087}
1088
mtkleinc095df52016-08-24 12:23:52 -07001089# Targets guarded by skia_enable_tools may use //third_party freely.
1090if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001091 # Used by gn_to_bp.py to list our public include dirs.
1092 source_set("public") {
1093 configs += [ ":skia_public" ]
1094 }
1095
Mike Kleinc36dedf2016-11-18 09:35:28 -05001096 config("skia.h_config") {
1097 include_dirs = [ "$target_gen_dir" ]
1098 }
1099 action("skia.h") {
1100 public_configs = [ ":skia.h_config" ]
1101 skia_h = "$target_gen_dir/skia.h"
1102 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001103
1104 # TODO: would be cool to not hard-code these here, but how?
1105 module_public_includes = [
1106 "modules/sksg/include",
1107 "modules/skottie/include",
1108 ]
1109 args =
1110 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1111 [ rebase_path(skia_h, root_build_dir) ] +
1112 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001113 depfile = "$skia_h.deps"
1114 outputs = [
1115 skia_h,
1116 ]
1117 }
1118
Brian Osmanc9a42472018-05-31 13:17:12 -04001119 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001120 executable("fiddle") {
1121 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001122 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001123 "tools/fiddle/draw.cpp",
1124 "tools/fiddle/fiddle_main.cpp",
1125 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001126
1127 if (skia_use_egl) {
1128 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001129 } else {
1130 sources += [ "tools/fiddle/null_context.cpp" ]
1131 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001132 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001133 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001134 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001135 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001136 ":skia",
1137 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001138 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001139 ]
1140 }
1141 }
1142
Brian Osmanc9a42472018-05-31 13:17:12 -04001143 source_set("public_headers_warnings_check") {
1144 sources = [
1145 "tools/public_headers_warnings_check.cpp",
1146 ]
1147 configs -= [ "//gn:warnings_except_public_headers" ]
1148 deps = [
1149 ":skia",
1150 ":skia.h",
1151 "modules/skottie",
1152 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001153 }
1154
mtkleinc095df52016-08-24 12:23:52 -07001155 template("test_lib") {
1156 config(target_name + "_config") {
1157 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001158 if (defined(invoker.public_defines)) {
1159 defines = invoker.public_defines
1160 }
mtklein25c81d42016-07-27 13:55:26 -07001161 }
mtkleinc095df52016-08-24 12:23:52 -07001162 source_set(target_name) {
1163 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1164 public_configs = [
1165 ":" + target_name + "_config",
1166 ":skia_private",
1167 ]
1168
1169 if (!defined(deps)) {
1170 deps = []
1171 }
1172 deps += [ ":skia" ]
1173 testonly = true
1174 }
mtklein25c81d42016-07-27 13:55:26 -07001175 }
mtklein25c81d42016-07-27 13:55:26 -07001176
Mike Kleine6682eb2017-01-05 10:54:57 -05001177 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001178 if (is_ios) {
1179 app_name = target_name
1180 gen_path = target_gen_dir
1181
1182 action("${app_name}_generate_info_plist") {
1183 script = "//gn/gen_plist_ios.py"
1184 outputs = [
1185 "$gen_path/${app_name}_Info.plist",
1186 ]
1187 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1188 }
1189
1190 bundle_data("${app_name}_bundle_info_plist") {
1191 public_deps = [
1192 ":${app_name}_generate_info_plist",
1193 ]
1194 sources = [
1195 "$gen_path/${app_name}_Info.plist",
1196 ]
1197 outputs = [
1198 "{{bundle_root_dir}}/Info.plist",
1199 ]
1200 }
1201
Jim Van Verth329c5a62017-11-29 11:42:33 -05001202 bundle_ios_data =
1203 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1204
1205 if (bundle_ios_data) {
1206 has_skps =
1207 "True" == exec_script("//gn/checkdir.py",
1208 [ rebase_path("skps", root_build_dir) ],
1209 "trim string")
1210 bundle_data("${app_name}_bundle_resources") {
1211 sources = [
1212 "resources",
1213 ]
1214 outputs = [
1215 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1216 "{{bundle_resources_dir}}/data/resources",
1217 ]
1218 }
1219
1220 if (has_skps) {
1221 bundle_data("${app_name}_bundle_skps") {
1222 sources = [
1223 "skps",
1224 ]
1225 outputs = [
1226 # Store in same folder as resources
1227 "{{bundle_resources_dir}}/data/skps",
1228 ]
1229 }
1230 }
1231 }
1232
Jim Van Verth443a9132017-11-28 09:45:26 -05001233 executable("${app_name}_generate_executable") {
1234 forward_variables_from(invoker,
1235 "*",
1236 [
1237 "output_name",
1238 "visibility",
1239 "is_shared_library",
1240 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001241 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001242 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001243 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1244 }
1245
1246 bundle_data("${app_name}_bundle_executable") {
1247 public_deps = [
1248 ":${app_name}_generate_executable",
1249 ]
1250 sources = [
1251 "$gen_path/$app_name",
1252 ]
1253 outputs = [
1254 "{{bundle_executable_dir}}/$app_name",
1255 ]
1256 testonly = true
1257 }
1258
1259 create_bundle("$app_name") {
1260 product_type = "com.apple.product-type.application"
1261 testonly = true
1262
1263 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1264 bundle_resources_dir = bundle_root_dir
1265 bundle_executable_dir = bundle_root_dir
1266 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1267
1268 deps = [
1269 ":${app_name}_bundle_executable",
1270 ":${app_name}_bundle_info_plist",
1271 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001272 if (bundle_ios_data) {
1273 deps += [ ":${app_name}_bundle_resources" ]
1274 if (has_skps) {
1275 deps += [ ":${app_name}_bundle_skps" ]
1276 }
1277 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001278
1279 # should only code sign when running on a device, not the simulator
1280 if (target_cpu != "x64") {
1281 code_signing_script = "//gn/codesign_ios.py"
1282 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1283 code_signing_outputs = [
1284 "$bundle_root_dir/_CodeSignature/CodeResources",
1285 "$bundle_root_dir/embedded.mobileprovision",
1286 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001287 code_signing_args = [
1288 rebase_path("$bundle_root_dir", root_build_dir),
1289 skia_ios_identity,
1290 skia_ios_profile,
1291 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001292 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001293 }
1294 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001295 # !is_ios
1296
1297 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1298 shared_library("lib" + target_name) {
1299 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1300 configs += [ ":skia_private" ]
1301 testonly = true
1302 }
1303 } else {
1304 _executable = target_name
1305 executable(_executable) {
1306 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1307 configs += [ ":skia_private" ]
1308 testonly = true
1309 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001310 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001311 if (is_android && skia_android_serial != "" && defined(_executable)) {
1312 action("push_" + target_name) {
1313 script = "gn/push_to_android.py"
1314 deps = [
1315 ":" + _executable,
1316 ]
1317 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1318 outputs = [
1319 _stamp,
1320 ]
1321 args = [
1322 rebase_path("$root_build_dir/$_executable"),
1323 skia_android_serial,
1324 rebase_path(_stamp),
1325 ]
1326 testonly = true
1327 }
Mike Klein7d921032017-01-05 12:20:41 -05001328 }
1329 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001330 }
1331
Greg Danielda16cce2018-08-01 09:23:57 -04001332 config("moltenvk_config") {
1333 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1334 if (is_ios) {
1335 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1336 } else {
1337 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1338 }
1339 cflags = [ "-F$moltenvk_framework_path" ]
1340 ldflags = [ "-F$moltenvk_framework_path" ]
1341 libs = [
1342 "MoltenVK.framework",
1343 "Metal.framework",
1344 "IOSurface.framework",
1345 "QuartzCore.framework",
1346 "Foundation.framework",
1347 ]
1348 if (is_ios) {
1349 libs += [ "UIKit.framework" ]
1350 } else {
1351 libs += [ "IOKit.framework" ]
1352 }
1353 defines = [ "SK_MOLTENVK" ]
1354 }
1355 }
1356
1357 source_set("moltenvk") {
1358 public_configs = [ ":moltenvk_config" ]
1359 }
1360
mtkleinc095df52016-08-24 12:23:52 -07001361 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001362 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001363 public_defines = []
1364 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001365
Brian Osmanc9a42472018-05-31 13:17:12 -04001366 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001367 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001368 sources = [
1369 "tools/gpu/GrContextFactory.cpp",
1370 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001371 "tools/gpu/MemoryCache.cpp",
1372 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001373 "tools/gpu/ProxyUtils.cpp",
1374 "tools/gpu/TestContext.cpp",
1375 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1376 "tools/gpu/gl/GLTestContext.cpp",
1377 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001378 "tools/gpu/gl/null/NullGLTestContext.cpp",
1379 "tools/gpu/mock/MockTestContext.cpp",
1380 ]
1381 libs = []
1382
1383 if (is_android || skia_use_egl) {
1384 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1385 } else if (is_ios) {
1386 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1387 libs += [ "OpenGLES.framework" ]
1388 } else if (is_linux) {
1389 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001390 libs += [
1391 "GLU",
1392 "X11",
1393 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001394 } else if (is_mac) {
1395 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1396 } else if (is_win) {
1397 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1398 libs += [
1399 "Gdi32.lib",
1400 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001401 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001402 }
mtklein25c81d42016-07-27 13:55:26 -07001403
Brian Osmanc9a42472018-05-31 13:17:12 -04001404 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001405
Brian Osmanc9a42472018-05-31 13:17:12 -04001406 if (skia_use_angle) {
1407 deps += [ "//third_party/angle2" ]
1408 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1409 }
Greg Danielb4d89562018-10-03 18:44:49 +00001410 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001411 if (skia_use_vulkan) {
1412 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1413 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001414 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1415 public_deps += [ ":moltenvk" ]
1416 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001417 }
1418 if (skia_use_metal) {
1419 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001420 }
mtklein25c81d42016-07-27 13:55:26 -07001421 }
mtklein25c81d42016-07-27 13:55:26 -07001422
mtkleinc095df52016-08-24 12:23:52 -07001423 test_lib("flags") {
1424 public_include_dirs = [ "tools/flags" ]
1425 sources = [
1426 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001427 ]
1428 }
1429 test_lib("common_flags") {
1430 public_include_dirs = [ "tools/flags" ]
1431 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001432 "tools/flags/SkCommonFlags.cpp",
1433 "tools/flags/SkCommonFlagsConfig.cpp",
1434 ]
1435 deps = [
mtklein046cb562016-09-16 10:23:12 -07001436 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001437 ]
1438 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001439 ":gpu_tool_utils",
1440 ]
1441 }
mtklein25c81d42016-07-27 13:55:26 -07001442
mtkleinc095df52016-08-24 12:23:52 -07001443 test_lib("tool_utils") {
1444 public_include_dirs = [
1445 "tools",
1446 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001447 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001448 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001449 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001450 ]
1451 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001452 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001453 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001454 "tools/DDLPromiseImageHelper.cpp",
1455 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001456 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001457 "tools/ProcStats.cpp",
1458 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001459 "tools/UrlDataManager.cpp",
1460 "tools/debugger/SkDebugCanvas.cpp",
1461 "tools/debugger/SkDrawCommand.cpp",
1462 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001463 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001464 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001465 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001466 "tools/fonts/SkTestFontMgr.h",
1467 "tools/fonts/SkTestSVGTypeface.cpp",
1468 "tools/fonts/SkTestSVGTypeface.h",
1469 "tools/fonts/SkTestTypeface.cpp",
1470 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001471 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001472 "tools/random_parse_path.cpp",
1473 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001474 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001475 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001476 "tools/trace/SkChromeTracingTracer.cpp",
1477 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001478 "tools/trace/SkDebugfTracer.cpp",
1479 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001480 "tools/trace/SkEventTracingPriv.cpp",
1481 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001482 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001483 libs = []
1484 if (is_ios) {
1485 sources += [ "tools/ios_utils.m" ]
1486 libs += [ "Foundation.framework" ]
1487 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001488 defines = []
1489 if (skia_tools_require_resources) {
1490 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1491 }
mtkleinc095df52016-08-24 12:23:52 -07001492 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001493 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001494 ":flags",
1495 "//third_party/libpng",
1496 ]
1497 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001498 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001499 "//third_party/jsoncpp",
1500 ]
1501 }
mtklein25c81d42016-07-27 13:55:26 -07001502
Mike Klein6e744122016-10-27 12:21:40 -04001503 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001504 test_lib("gm") {
1505 public_include_dirs = [ "gm" ]
1506 sources = gm_sources
1507 deps = [
scroggo19b91532016-10-24 09:03:26 -07001508 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001509 ":skia",
1510 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001511 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001512 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001513 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001514 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001515 public_deps = [
1516 ":gpu_tool_utils",
1517 ]
mtkleinc095df52016-08-24 12:23:52 -07001518 }
mtklein25c81d42016-07-27 13:55:26 -07001519
Mike Klein6e744122016-10-27 12:21:40 -04001520 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001521 test_lib("tests") {
1522 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001523 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001524 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001525 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001526 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001527 if (!(skia_use_freetype && skia_use_fontconfig)) {
1528 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1529 }
mtkleinc095df52016-08-24 12:23:52 -07001530 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001531 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001532 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001533 ":skia",
1534 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001535 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001536 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001537 "//third_party/libpng",
1538 "//third_party/zlib",
1539 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001540 public_deps = [
1541 ":gpu_tool_utils", # Test.h #includes headers from this target.
1542 ]
mtkleinc095df52016-08-24 12:23:52 -07001543 }
mtklein2f3416d2016-08-02 16:02:05 -07001544
Mike Klein6e744122016-10-27 12:21:40 -04001545 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001546 test_lib("bench") {
1547 public_include_dirs = [ "bench" ]
1548 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001549 deps = [
1550 ":flags",
1551 ":gm",
1552 ":gpu_tool_utils",
1553 ":skia",
1554 ":tool_utils",
1555 ]
1556 }
mtklein2b6870c2016-07-28 14:17:33 -07001557
mtkleinc095df52016-08-24 12:23:52 -07001558 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001559 public_include_dirs = []
1560 if (skia_use_expat) {
1561 public_include_dirs += [ "experimental/svg/model" ]
1562 sources = [
1563 "experimental/svg/model/SkSVGAttribute.cpp",
1564 "experimental/svg/model/SkSVGAttributeParser.cpp",
1565 "experimental/svg/model/SkSVGCircle.cpp",
1566 "experimental/svg/model/SkSVGClipPath.cpp",
1567 "experimental/svg/model/SkSVGContainer.cpp",
1568 "experimental/svg/model/SkSVGDOM.cpp",
1569 "experimental/svg/model/SkSVGEllipse.cpp",
1570 "experimental/svg/model/SkSVGGradient.cpp",
1571 "experimental/svg/model/SkSVGLine.cpp",
1572 "experimental/svg/model/SkSVGLinearGradient.cpp",
1573 "experimental/svg/model/SkSVGNode.cpp",
1574 "experimental/svg/model/SkSVGPath.cpp",
1575 "experimental/svg/model/SkSVGPattern.cpp",
1576 "experimental/svg/model/SkSVGPoly.cpp",
1577 "experimental/svg/model/SkSVGRadialGradient.cpp",
1578 "experimental/svg/model/SkSVGRect.cpp",
1579 "experimental/svg/model/SkSVGRenderContext.cpp",
1580 "experimental/svg/model/SkSVGSVG.cpp",
1581 "experimental/svg/model/SkSVGShape.cpp",
1582 "experimental/svg/model/SkSVGStop.cpp",
1583 "experimental/svg/model/SkSVGTransformableNode.cpp",
1584 "experimental/svg/model/SkSVGUse.cpp",
1585 "experimental/svg/model/SkSVGValue.cpp",
1586 ]
1587 deps = [
1588 ":skia",
1589 ":xml",
1590 ]
1591 }
mtkleinc095df52016-08-24 12:23:52 -07001592 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001593
Mike Klein38af9432016-11-11 11:39:44 -05001594 if (skia_use_lua) {
1595 test_lib("lua") {
1596 public_include_dirs = []
1597 sources = [
1598 "src/utils/SkLua.cpp",
1599 "src/utils/SkLuaCanvas.cpp",
1600 ]
1601 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001602 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001603 "//third_party/lua",
1604 ]
1605 }
1606
Mike Kleine6682eb2017-01-05 10:54:57 -05001607 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001608 sources = [
1609 "tools/lua/lua_app.cpp",
1610 ]
1611 deps = [
1612 ":lua",
1613 ":skia",
1614 "//third_party/lua",
1615 ]
Mike Klein38af9432016-11-11 11:39:44 -05001616 }
1617
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001619 sources = [
1620 "tools/lua/lua_pictures.cpp",
1621 ]
1622 deps = [
1623 ":flags",
1624 ":lua",
1625 ":skia",
1626 ":tool_utils",
1627 "//third_party/lua",
1628 ]
Mike Klein38af9432016-11-11 11:39:44 -05001629 }
1630 }
1631
Cary Clark8032b982017-07-28 11:04:54 -04001632 test_app("bookmaker") {
1633 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001634 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001635 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001636 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001637 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001638 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001639 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001640 "tools/bookmaker/includeParser.cpp",
1641 "tools/bookmaker/includeWriter.cpp",
1642 "tools/bookmaker/mdOut.cpp",
1643 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001644 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001645 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001646 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001647 ]
1648 deps = [
1649 ":flags",
1650 ":skia",
1651 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001652 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001653 ]
1654 }
1655
Florin Malitabfe876a2018-09-02 12:33:59 -04001656 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001657 test_app("skottie_tool") {
1658 deps = [
1659 "modules/skottie:tool",
1660 ]
1661 }
1662 }
1663
Kevin Lubickebf648e2017-09-21 13:45:16 -04001664 if (target_cpu != "wasm") {
1665 import("gn/samples.gni")
1666 test_lib("samples") {
1667 public_include_dirs = [ "samplecode" ]
1668 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001669 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001670 public_deps = [
1671 ":tool_utils",
1672 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001673 deps = [
1674 ":experimental_svg_model",
1675 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001676 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001677 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001678 ]
Mike Klein38af9432016-11-11 11:39:44 -05001679
Ruiqi Maof5101492018-06-29 14:32:21 -04001680 # NIMA does not build on Windows clang
1681 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001682 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001683 deps += [ "//third_party/Nima-Cpp" ]
1684 }
1685
Kevin Lubickebf648e2017-09-21 13:45:16 -04001686 if (skia_use_lua) {
1687 sources += [ "samplecode/SampleLua.cpp" ]
1688 deps += [
1689 ":lua",
1690 "//third_party/lua",
1691 ]
1692 }
1693 }
Mike Klein7af351a2018-07-27 09:54:43 -04001694 test_app("imgcvt") {
1695 sources = [
1696 "tools/imgcvt.cpp",
1697 ]
1698 deps = [
1699 ":skcms",
1700 ":skia",
1701 ]
1702 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001703 test_app("dm") {
1704 sources = [
1705 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001706 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001707 "dm/DMJsonWriter.cpp",
1708 "dm/DMSrcSink.cpp",
1709 ]
1710 include_dirs = [ "tests" ]
1711 deps = [
1712 ":common_flags",
1713 ":experimental_svg_model",
1714 ":flags",
1715 ":gm",
1716 ":gpu_tool_utils",
1717 ":skia",
1718 ":tests",
1719 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001720 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001721 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001722 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001723 "//third_party/jsoncpp",
1724 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001725 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001726
1727 # NIMA does not build on Windows clang
1728 if (!is_win || !is_clang) {
1729 deps += [ "//third_party/Nima-Cpp" ]
1730 }
Mike Klein38af9432016-11-11 11:39:44 -05001731 }
Brian Osman16adfa32016-10-18 14:42:44 -04001732 }
1733
Mike Kleina8a51ce2018-01-09 12:34:11 -05001734 if (!is_win) {
1735 test_app("remote_demo") {
1736 sources = [
1737 "tools/remote_demo.cpp",
1738 ]
1739 deps = [
1740 ":skia",
1741 ]
1742 }
1743 }
1744
Mike Kleine6682eb2017-01-05 10:54:57 -05001745 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001746 sources = [
1747 "bench/nanobench.cpp",
1748 ]
1749 deps = [
1750 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001751 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001752 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001753 ":flags",
1754 ":gm",
1755 ":gpu_tool_utils",
1756 ":skia",
1757 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001758 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001759 "//third_party/jsoncpp",
1760 ]
mtklein2b6870c2016-07-28 14:17:33 -07001761 }
halcanary19a97202016-08-03 15:08:04 -07001762
Ravi Mistry10d36c52017-01-31 09:49:18 -05001763 test_app("skpinfo") {
1764 sources = [
1765 "tools/skpinfo.cpp",
1766 ]
1767 deps = [
1768 ":flags",
1769 ":skia",
1770 ]
1771 }
1772
Brian Osmanc9a42472018-05-31 13:17:12 -04001773 test_app("skpbench") {
1774 sources = [
1775 "tools/skpbench/skpbench.cpp",
1776 ]
1777 deps = [
1778 ":flags",
1779 ":gpu_tool_utils",
1780 ":skia",
1781 ":tool_utils",
1782 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001783 }
1784
Mike Kleine6682eb2017-01-05 10:54:57 -05001785 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001786 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001787 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001788 ]
1789 deps = [
1790 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001791 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001792 ]
halcanary3eee9d92016-09-10 07:01:53 -07001793 }
mtklein046cb562016-09-16 10:23:12 -07001794
Ben Wagner219f3622017-07-17 15:32:25 -04001795 test_app("create_test_font") {
1796 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001797 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001798 ]
1799 deps = [
1800 ":skia",
1801 ]
1802 assert_no_deps = [
1803 # tool_utils requires the output of this app.
1804 ":tool_utils",
1805 ]
1806 }
1807
Florin Malita5d3ff432018-07-31 16:38:43 -04001808 if (skia_use_expat) {
1809 test_app("create_test_font_color") {
1810 sources = [
1811 "tools/fonts/create_test_font_color.cpp",
1812 ]
1813 deps = [
1814 ":flags",
1815 ":skia",
1816 ":tool_utils",
1817 ]
1818 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001819 }
1820
Mike Kleine6682eb2017-01-05 10:54:57 -05001821 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001822 sources = [
1823 "tools/get_images_from_skps.cpp",
1824 ]
1825 deps = [
1826 ":flags",
1827 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001828 ]
mtklein046cb562016-09-16 10:23:12 -07001829 }
mtkleinecbc5262016-09-22 11:51:24 -07001830
Kevin Lubickebf648e2017-09-21 13:45:16 -04001831 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001832 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001833 sources = [
1834 "tools/skiaserve/Request.cpp",
1835 "tools/skiaserve/Response.cpp",
1836 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001837 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1838 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1839 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1840 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1841 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1842 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1843 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1844 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1845 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001846 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1847 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001848 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1849 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1850 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1851 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1852 ]
1853 deps = [
1854 ":flags",
1855 ":gpu_tool_utils",
1856 ":skia",
1857 ":tool_utils",
1858 "//third_party/jsoncpp",
1859 "//third_party/libmicrohttpd",
1860 "//third_party/libpng",
1861 ]
Mike Klein7d302882016-11-03 14:06:31 -04001862 }
mtkleinecbc5262016-09-22 11:51:24 -07001863 }
kjlubick14f984b2016-10-03 11:49:45 -07001864
Mike Kleine6682eb2017-01-05 10:54:57 -05001865 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001866 include_dirs = [
1867 "tools",
1868 "tools/debugger",
1869 ]
kjlubick14f984b2016-10-03 11:49:45 -07001870 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001871 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001872 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001873 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001874 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001875 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001876 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001877 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001878 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001879 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001880 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001881 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001882 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001883 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001884 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1885 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001886 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001887 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001888 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001889 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001890 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1891 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001892 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001893 "tools/UrlDataManager.cpp",
1894 "tools/debugger/SkDebugCanvas.cpp",
1895 "tools/debugger/SkDrawCommand.cpp",
1896 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001897 ]
1898 deps = [
1899 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001900 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001901 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001902 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001903 "//third_party/jsoncpp",
1904 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001905 ]
kjlubick14f984b2016-10-03 11:49:45 -07001906 }
Mike Klein38312422016-10-05 15:41:01 -04001907
Mike Kleine6682eb2017-01-05 10:54:57 -05001908 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001909 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001910 rebase_path("tests/skia_test.cpp"),
1911 rebase_path("tests/Test.cpp"),
1912 ]
caryclark9feb6322016-10-25 08:58:26 -07001913 deps = [
1914 ":flags",
1915 ":gpu_tool_utils",
1916 ":skia",
1917 ":tool_utils",
1918 ]
caryclark9feb6322016-10-25 08:58:26 -07001919 }
1920
Mike Kleine6682eb2017-01-05 10:54:57 -05001921 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001922 sources = [
1923 "tools/DumpRecord.cpp",
1924 "tools/dump_record.cpp",
1925 ]
1926 deps = [
1927 ":flags",
1928 ":skia",
1929 ]
Mike Klein38312422016-10-05 15:41:01 -04001930 }
bungemanfe917272016-10-13 17:36:40 -04001931
Mike Kleine6682eb2017-01-05 10:54:57 -05001932 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001933 sources = [
1934 "tools/skdiff/skdiff.cpp",
1935 "tools/skdiff/skdiff_html.cpp",
1936 "tools/skdiff/skdiff_main.cpp",
1937 "tools/skdiff/skdiff_utils.cpp",
1938 ]
1939 deps = [
1940 ":skia",
1941 ":tool_utils",
1942 ]
bungemanfe917272016-10-13 17:36:40 -04001943 }
halcanarya73d76a2016-10-17 13:19:02 -07001944
Mike Kleine6682eb2017-01-05 10:54:57 -05001945 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001946 sources = [
1947 "tools/skp_parser.cpp",
1948 ]
1949 deps = [
1950 ":skia",
1951 ":tool_utils",
1952 "//third_party/jsoncpp",
1953 ]
halcanarya73d76a2016-10-17 13:19:02 -07001954 }
Brian Osman16adfa32016-10-18 14:42:44 -04001955
Brian Osmanc9a42472018-05-31 13:17:12 -04001956 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001957 test_lib("skqp_lib") {
1958 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001959 defines =
1960 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001961 if (skia_skqp_enable_driver_correctness_workarounds) {
1962 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1963 }
Hal Canary75427132017-10-11 16:00:31 -04001964 sources = [
1965 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001966 "tools/skqp/gm_knowledge.cpp",
1967 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001968 ]
1969 deps = [
1970 ":gm",
1971 ":gpu_tool_utils",
1972 ":skia",
1973 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001974 ":tool_utils",
1975 ]
1976 }
1977 test_app("skqp") {
1978 sources = [
1979 "tools/skqp/skqp.cpp",
1980 ]
1981 deps = [
1982 ":skia",
1983 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001984 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001985 "//third_party/googletest",
1986 ]
1987 }
1988 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001989 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001990 test_app("skqp_app") {
1991 is_shared_library = true
1992 sources = [
1993 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1994 ]
1995 deps = [
1996 ":skia",
1997 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001998 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001999 ]
2000 libs = [ "android" ]
2001 }
2002 }
Stan Iliev93151722018-08-02 11:10:52 -04002003 if (is_android && skia_enable_gpu) {
2004 test_app("skottie_android") {
2005 is_shared_library = true
2006
2007 sources = [
2008 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2009 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2010 ]
2011 libs = []
2012
2013 include_dirs = []
2014 deps = [
2015 ":skia",
2016 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002017 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002018 ]
2019 }
2020 }
Hal Canary75427132017-10-11 16:00:31 -04002021
Hal Canarya9de7602018-01-19 13:08:23 -05002022 test_app("list_gms") {
2023 sources = [
2024 "tools/list_gms.cpp",
2025 ]
2026 deps = [
2027 ":gm",
2028 ":skia",
2029 ]
2030 }
2031 test_app("list_gpu_unit_tests") {
2032 sources = [
2033 "dm/DMGpuTestProcs.cpp",
2034 "tools/list_gpu_unit_tests.cpp",
2035 ]
2036 deps = [
2037 ":skia",
2038 ":tests",
2039 ]
2040 }
2041
Brian Osmanc9a42472018-05-31 13:17:12 -04002042 test_lib("sk_app") {
2043 public_include_dirs = [ "tools/sk_app" ]
2044 sources = [
2045 "tools/sk_app/CommandSet.cpp",
2046 "tools/sk_app/GLWindowContext.cpp",
2047 "tools/sk_app/Window.cpp",
2048 ]
2049 libs = []
2050
2051 if (is_android) {
2052 sources += [
2053 "tools/sk_app/android/GLWindowContext_android.cpp",
2054 "tools/sk_app/android/RasterWindowContext_android.cpp",
2055 "tools/sk_app/android/Window_android.cpp",
2056 "tools/sk_app/android/main_android.cpp",
2057 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002058 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002059 libs += [ "android" ]
2060 } else if (is_linux) {
2061 sources += [
2062 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2063 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2064 "tools/sk_app/unix/Window_unix.cpp",
2065 "tools/sk_app/unix/keysym2ucs.c",
2066 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002067 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002068 libs += [
2069 "GL",
2070 "X11",
2071 ]
2072 } else if (is_win) {
2073 sources += [
2074 "tools/sk_app/win/GLWindowContext_win.cpp",
2075 "tools/sk_app/win/RasterWindowContext_win.cpp",
2076 "tools/sk_app/win/Window_win.cpp",
2077 "tools/sk_app/win/main_win.cpp",
2078 ]
Brian Salomon194db172017-08-17 14:37:06 -04002079 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002080 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002081 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002082 } else if (is_mac) {
2083 sources += [
2084 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2085 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2086 "tools/sk_app/mac/Window_mac.cpp",
2087 "tools/sk_app/mac/main_mac.cpp",
2088 ]
2089 libs += [
2090 "QuartzCore.framework",
2091 "Cocoa.framework",
2092 "Foundation.framework",
2093 ]
2094 } else if (is_ios) {
2095 sources += [
2096 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2097 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2098 "tools/sk_app/ios/Window_ios.cpp",
2099 "tools/sk_app/ios/main_ios.cpp",
2100 ]
2101 }
2102
2103 if (skia_use_vulkan) {
2104 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2105 if (is_android) {
2106 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2107 } else if (is_linux) {
2108 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2109 libs += [ "X11-xcb" ]
2110 } else if (is_win) {
2111 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2112 }
2113 }
2114
2115 deps = [
2116 ":gpu_tool_utils",
2117 ":skia",
2118 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002119 ]
2120 if (is_android) {
2121 deps += [ "//third_party/native_app_glue" ]
2122 } else if (is_mac || is_ios) {
2123 deps += [ "//third_party/libsdl" ]
2124 }
2125 if (skia_use_angle) {
2126 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002127 }
Brian Osman16adfa32016-10-18 14:42:44 -04002128 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002129
Brian Osmanc9a42472018-05-31 13:17:12 -04002130 test_app("viewer") {
2131 is_shared_library = is_android
2132 if (is_ios) {
2133 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002134 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002135 sources = [
2136 "tools/viewer/BisectSlide.cpp",
2137 "tools/viewer/GMSlide.cpp",
2138 "tools/viewer/ImGuiLayer.cpp",
2139 "tools/viewer/ImageSlide.cpp",
2140 "tools/viewer/SKPSlide.cpp",
2141 "tools/viewer/SampleSlide.cpp",
2142 "tools/viewer/SkottieSlide.cpp",
2143 "tools/viewer/SlideDir.cpp",
2144 "tools/viewer/StatsLayer.cpp",
2145 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002146 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002147 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002148 "tools/viewer/Viewer.cpp",
2149 ]
2150 libs = []
2151
Kevin Lubickd9699322018-10-30 15:08:53 -04002152 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002153 deps = [
2154 ":experimental_svg_model",
2155 ":flags",
2156 ":gm",
2157 ":gpu_tool_utils",
2158 ":samples",
2159 ":sk_app",
2160 ":skia",
2161 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002162 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002163 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002164 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002165 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002166 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002167 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002168
2169 # NIMA does not build on Windows clang
2170 if (!is_win || !is_clang) {
2171 sources += [ "tools/viewer/NIMASlide.cpp" ]
2172 deps += [ "//third_party/Nima-Cpp" ]
2173 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002174 }
2175
ziadbbceddbc2018-06-19 13:57:15 -04002176 if (is_android) {
2177 test_app("arcore") {
2178 is_shared_library = true
2179 configs = [
2180 ":skia_public",
2181 "gn:default",
2182 ]
2183
2184 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2185 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2186 sources = []
2187 sources += skia_core_sources
2188 sources += skia_utils_sources
2189 sources += skia_xps_sources
2190 sources += [
2191 "src/android/SkAndroidFrameworkUtils.cpp",
2192 "src/android/SkAnimatedImage.cpp",
2193 "src/android/SkBitmapRegionCodec.cpp",
2194 "src/android/SkBitmapRegionDecoder.cpp",
2195 "src/codec/SkAndroidCodec.cpp",
2196 "src/codec/SkBmpBaseCodec.cpp",
2197 "src/codec/SkBmpCodec.cpp",
2198 "src/codec/SkBmpMaskCodec.cpp",
2199 "src/codec/SkBmpRLECodec.cpp",
2200 "src/codec/SkBmpStandardCodec.cpp",
2201 "src/codec/SkCodec.cpp",
2202 "src/codec/SkCodecImageGenerator.cpp",
2203 "src/codec/SkColorTable.cpp",
2204 "src/codec/SkGifCodec.cpp",
2205 "src/codec/SkMaskSwizzler.cpp",
2206 "src/codec/SkMasks.cpp",
2207 "src/codec/SkSampledCodec.cpp",
2208 "src/codec/SkSampler.cpp",
2209 "src/codec/SkStreamBuffer.cpp",
2210 "src/codec/SkSwizzler.cpp",
2211 "src/codec/SkWbmpCodec.cpp",
2212 "src/images/SkImageEncoder.cpp",
2213 "src/ports/SkDiscardableMemory_none.cpp",
2214 "src/ports/SkImageGenerator_skia.cpp",
2215 "src/ports/SkMemory_malloc.cpp",
2216 "src/ports/SkOSFile_stdio.cpp",
2217 "src/sfnt/SkOTTable_name.cpp",
2218 "src/sfnt/SkOTUtils.cpp",
2219 "src/utils/mac/SkStream_mac.cpp",
2220 "third_party/gif/SkGifImageReader.cpp",
2221 ]
2222 deps = [
2223 ":tool_utils",
2224 "modules/skottie",
2225 "modules/skshaper",
2226 ]
2227 }
2228 }
2229
Brian Osmanc9a42472018-05-31 13:17:12 -04002230 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002231 test_app("HelloWorld") {
2232 sources = [
2233 "example/HelloWorld.cpp",
2234 ]
2235 libs = []
2236
2237 include_dirs = []
2238 deps = [
2239 ":flags",
2240 ":gpu_tool_utils",
2241 ":sk_app",
2242 ":skia",
2243 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002244 ]
2245 }
2246 }
2247
Brian Osmanc9a42472018-05-31 13:17:12 -04002248 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002249 test_app("SkiaSDLExample") {
2250 sources = [
2251 "example/SkiaSDLExample.cpp",
2252 ]
2253 libs = []
2254 include_dirs = []
2255 deps = [
2256 ":gpu_tool_utils",
2257 ":skia",
2258 "//third_party/libsdl",
2259 ]
2260 }
2261 }
2262
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002263 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2264 action_foreach("generate_mocs") {
2265 script = "gn/call.py"
2266 sources = [
2267 "tools/mdbviz/MainWindow.h",
2268 ]
2269 outputs = [
2270 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2271 ]
2272 args = [
2273 "$skia_qt_path" + "/bin/moc",
2274 "{{source}}",
2275 "-o",
2276 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2277 ]
2278 }
2279 action_foreach("generate_resources") {
2280 script = "gn/call.py"
2281 sources = [
2282 "tools/mdbviz/resources.qrc",
2283 ]
2284 outputs = [
2285 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2286 ]
2287 args = [
2288 "$skia_qt_path" + "/bin/rcc",
2289 "{{source}}",
2290 "-o",
2291 "gen/mdbviz/{{source_name_part}}_res.cpp",
2292 ]
2293 }
2294 test_app("mdbviz") {
2295 if (is_win) {
2296 # on Windows we need to disable some exception handling warnings due to the Qt headers
2297 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2298 }
2299 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002300 "tools/UrlDataManager.cpp",
2301 "tools/debugger/SkDebugCanvas.cpp",
2302 "tools/debugger/SkDrawCommand.cpp",
2303 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002304 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002305 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002306 "tools/mdbviz/main.cpp",
2307
2308 # generated files
2309 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2310 "$target_gen_dir/mdbviz/resources_res.cpp",
2311 ]
2312 lib_dirs = [ "$skia_qt_path/lib" ]
2313 libs = [
2314 "Qt5Core.lib",
2315 "Qt5Gui.lib",
2316 "Qt5Widgets.lib",
2317 ]
2318 include_dirs = [
2319 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002320 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002321 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002322 "tools",
2323 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002324 ]
2325 deps = [
2326 ":generate_mocs",
2327 ":generate_resources",
2328 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002329 "//third_party/jsoncpp",
2330 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002331 ]
2332 }
2333 }
2334
Mike Kleine459afd2017-03-03 09:21:30 -05002335 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002336 copy("gdbserver") {
2337 sources = [
2338 "$ndk/$ndk_gdbserver",
2339 ]
2340 outputs = [
2341 "$root_out_dir/gdbserver",
2342 ]
2343 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002344 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002345
2346 if (skia_use_opencl) {
2347 test_app("hello-opencl") {
2348 sources = [
2349 "src/compute/common/cl/assert_cl.c",
2350 "src/compute/common/cl/find_cl.c",
2351 "tools/hello-opencl.cpp",
2352 ]
2353 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002354 if (is_linux) {
2355 libs = [ "OpenCL" ]
2356 } else if (is_win) {
2357 libs = [ "OpenCL.lib" ]
2358 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002359 }
2360 }
mtklein25c81d42016-07-27 13:55:26 -07002361}