blob: b7c3c4b36bf9b502e9ba25378e0ef9ca678d5740 [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
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050028 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070029 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050030 skia_use_fixed_gamma_text = is_android
Mike Klein7d302882016-11-03 14:06:31 -040031 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070032 skia_use_libjpeg_turbo = true
33 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070034 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050035 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040036 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040037 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040038 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070039 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040040 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040041 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070042 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070043
Mike Klein7d921032017-01-05 12:20:41 -050044 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040045 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000046 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050047 skia_enable_discrete_gpu = true
Brian Osman74511012018-04-02 20:13:46 +000048 skia_enable_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040049 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050050 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040051 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040052 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050053 skia_enable_tools = is_skia_dev_build
54 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
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) {
Greg Daniel54bfb182018-11-20 17:12:36 -0500190 include_dirs += [ "third_party/vulkan" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500191 include_dirs += [ "tools/gpu/vk" ]
192 }
Brian Salomon03e05842017-02-23 12:23:47 -0500193 }
Brian Osman34755e22016-12-05 09:46:02 -0500194 if (skia_use_angle) {
195 defines += [ "SK_ANGLE" ]
196 }
Brian Osman3f375d02016-12-28 11:19:22 -0500197 if (skia_enable_discrete_gpu) {
198 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
199 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400200 if (!is_official_build) {
201 defines += [ "GR_TEST_UTILS=1" ]
202 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400203 if (skia_llvm_path != "") {
204 defines += [ "SK_LLVM_AVAILABLE" ]
205 include_dirs += [ "$skia_llvm_path/include" ]
206 libs += [ skia_llvm_lib ]
207 lib_dirs += [ "$skia_llvm_path/lib/" ]
208 }
mtkleinc04ff472016-06-23 10:29:30 -0700209}
210
211# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
212config("skia_library") {
213 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700214 defines = [ "SKIA_IMPLEMENTATION=1" ]
215}
216
217skia_library_configs = [
218 ":skia_public",
219 ":skia_private",
220 ":skia_library",
221]
222
mtklein9b8583d2016-08-24 17:32:30 -0700223# Use for CPU-specific Skia code that needs particular compiler flags.
224template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500225 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700226 if (invoker.enabled) {
227 source_set(target_name) {
228 forward_variables_from(invoker, "*")
229 configs += skia_library_configs
230 }
231 } else {
232 # If not enabled, a phony empty target that swallows all otherwise unused variables.
233 source_set(target_name) {
234 forward_variables_from(invoker,
235 "*",
236 [
237 "sources",
238 "cflags",
239 ])
240 }
241 }
anmittala7eaf2e2016-08-17 13:57:26 -0700242}
243
mtklein422310d2016-08-16 18:28:43 -0700244is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700245
mtklein7d6fb2c2016-08-25 14:50:44 -0700246opts("none") {
247 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700248 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700249 cflags = []
250}
251
mtklein7d6fb2c2016-08-25 14:50:44 -0700252opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700253 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700254 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700255 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700256}
257
258opts("arm64") {
259 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700260 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700261 cflags = []
262}
263
264opts("crc32") {
265 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700267 cflags = [ "-march=armv8-a+crc" ]
268}
269
mtklein9b8583d2016-08-24 17:32:30 -0700270opts("sse2") {
271 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700272 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400273 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400274 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
275 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400276 cflags = [ "-msse2" ]
277 }
mtklein9b8583d2016-08-24 17:32:30 -0700278}
mtkleinc04ff472016-06-23 10:29:30 -0700279
mtklein9b8583d2016-08-24 17:32:30 -0700280opts("ssse3") {
281 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700282 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400283 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400284 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
285 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400286 cflags = [ "-mssse3" ]
287 }
mtklein9b8583d2016-08-24 17:32:30 -0700288}
mtkleinc04ff472016-06-23 10:29:30 -0700289
mtklein9b8583d2016-08-24 17:32:30 -0700290opts("sse41") {
291 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700292 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400293 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400294 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
295 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400296 cflags = [ "-msse4.1" ]
297 }
mtklein9b8583d2016-08-24 17:32:30 -0700298}
mtklein4e976072016-08-08 09:06:27 -0700299
mtklein9b8583d2016-08-24 17:32:30 -0700300opts("sse42") {
301 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700302 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400303 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400304 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
305 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400306 cflags = [ "-msse4.2" ]
307 }
mtklein9b8583d2016-08-24 17:32:30 -0700308}
309
310opts("avx") {
311 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700312 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400313 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000314 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400315 } else {
316 cflags = [ "-mavx" ]
317 }
mtkleinc04ff472016-06-23 10:29:30 -0700318}
319
Mike Klein1b9b7d52018-02-27 10:37:40 -0500320opts("hsw") {
321 enabled = is_x86
322 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400323 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500324 cflags = [ "/arch:AVX2" ]
325 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000326 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500327 }
328
329 # Oddly, clang-cl doesn't recognize this as a valid flag.
330 # If it ever does, it'd nice to move this up with -mavx2 and co.
331 if (is_clang && !is_win) {
332 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
333 # but nice to have, generating slightly better code for paths without explicit FMAs.
334 cflags += [ "-ffp-contract=fast" ]
335 }
336}
337
mtkleinc095df52016-08-24 12:23:52 -0700338# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700339template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500340 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700341 if (invoker.enabled) {
342 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700343 if (defined(invoker.public_defines)) {
344 defines = invoker.public_defines
345 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600346 if (defined(invoker.public_configs)) {
347 configs = invoker.public_configs
348 }
mtklein457b42a2016-08-23 13:56:37 -0700349 }
350 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700351 forward_variables_from(invoker,
352 "*",
353 [
354 "public_defines",
355 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700356 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700357 ])
mtklein457b42a2016-08-23 13:56:37 -0700358 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700359 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700360 if (defined(invoker.configs_to_remove)) {
361 configs -= invoker.configs_to_remove
362 }
mtklein457b42a2016-08-23 13:56:37 -0700363 }
364 } else {
mtklein457b42a2016-08-23 13:56:37 -0700365 source_set(target_name) {
366 forward_variables_from(invoker,
367 "*",
368 [
369 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400370 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700371 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700372 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700373 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700374 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700375 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700376 ])
mtkleincd01b032016-08-31 04:58:19 -0700377 if (defined(invoker.sources_when_disabled)) {
378 sources = invoker.sources_when_disabled
379 }
380 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700381 }
mtkleineb3c4252016-08-23 07:38:09 -0700382 }
mtklein457b42a2016-08-23 13:56:37 -0700383}
mtklein457b42a2016-08-23 13:56:37 -0700384
mtkleina45be612016-08-29 15:22:10 -0700385optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500386 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700387
388 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500389 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700390 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700391 ]
392 sources = [
393 "src/ports/SkFontMgr_android.cpp",
394 "src/ports/SkFontMgr_android_factory.cpp",
395 "src/ports/SkFontMgr_android_parser.cpp",
396 ]
397}
398
mtkleind2e39db2016-09-07 07:52:55 -0700399optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500400 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700401
402 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500403 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700404 ]
405 sources = [
406 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500407 "src/ports/SkFontMgr_custom.h",
408 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700409 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500410 "src/ports/SkFontMgr_custom_embedded.cpp",
411 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700412 ]
413}
414
Hal Canaryff2742e2018-01-30 11:35:47 -0500415optional("fontmgr_empty") {
416 enabled = skia_enable_fontmgr_empty
417 sources = [
418 "src/ports/SkFontMgr_empty_factory.cpp",
419 ]
420}
421
mtklein3cc22182016-08-29 13:26:14 -0700422optional("fontmgr_fontconfig") {
423 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700424
425 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500426 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700427 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700428 ]
429 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700430 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700431 "src/ports/SkFontConfigInterface_direct.cpp",
432 "src/ports/SkFontConfigInterface_direct_factory.cpp",
433 "src/ports/SkFontMgr_FontConfigInterface.cpp",
434 "src/ports/SkFontMgr_fontconfig.cpp",
435 "src/ports/SkFontMgr_fontconfig_factory.cpp",
436 ]
437}
438
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500439optional("fontmgr_custom_empty") {
440 enabled = skia_enable_fontmgr_custom_empty
mtkleincdedd0e2016-09-12 15:15:44 -0700441
442 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500443 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700444 ]
445 sources = [
446 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500447 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700448 "src/ports/SkFontMgr_custom_empty_factory.cpp",
449 ]
450}
451
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700452if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400453 executable("sksllex") {
454 sources = [
455 "src/sksl/lex/Main.cpp",
456 "src/sksl/lex/NFA.cpp",
457 "src/sksl/lex/RegexNode.cpp",
458 "src/sksl/lex/RegexParser.cpp",
459 ]
460 include_dirs = [ "src/sksl/lex" ]
461 }
462
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700463 action("run_sksllex") {
464 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400465 deps = [
466 ":sksllex(//gn/toolchain:$host_toolchain)",
467 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700468 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700469 "src/sksl/lex/sksl.lex",
470 ]
471
472 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
473 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
474 outputs = [
475 "$target_out_dir/" +
476 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
477 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
478 # confused due to the same file being named by two different paths
479 ]
480 sksllex_path = "$root_out_dir/"
481 sksllex_path += "sksllex"
482 if (host_os == "win") {
483 sksllex_path += ".exe"
484 }
485 args = [
486 rebase_path(sksllex_path),
487 rebase_path("bin/clang-format"),
488 rebase_path("src"),
489 ]
490 }
491} else {
492 group("run_sksllex") {
493 }
494}
495
496if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400497 executable("skslc") {
498 defines = [ "SKSL_STANDALONE" ]
499 sources = [
500 "src/sksl/SkSLMain.cpp",
501 ]
502 sources += skia_sksl_sources
503 include_dirs = [
504 "src/gpu",
505 "src/sksl",
506 ]
507 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500508 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400509 "//third_party/spirv-tools",
510 ]
511 }
512
513 skia_gpu_processor_outputs = []
514 foreach(src, skia_gpu_processor_sources) {
515 dir = get_path_info(src, "dir")
516 name = get_path_info(src, "name")
517
518 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
519 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
520 skia_gpu_processor_outputs += [
521 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
522 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
523 # confused due to the same file being named by two different paths
524 ]
525 }
526
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500527 action("create_sksl_enums") {
528 script = "gn/create_sksl_enums.py"
529 sources = [
530 "include/private/GrSharedEnums.h",
531 ]
532 outputs = [
533 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500534 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500535 ]
536 args = [
537 rebase_path(sources[0]),
538 rebase_path(outputs[0]),
539 ]
540 }
541
Ethan Nicholas762466e2017-06-29 10:03:38 -0400542 action("compile_processors") {
543 script = "gn/compile_processors.py"
544 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500545 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400546 ":skslc(//gn/toolchain:$host_toolchain)",
547 ]
548 sources = skia_gpu_processor_sources
549 outputs = skia_gpu_processor_outputs
550 skslc_path = "$root_out_dir/"
551 if (host_toolchain != default_toolchain_name) {
552 skslc_path += "$host_toolchain/"
553 }
554 skslc_path += "skslc"
555 if (host_os == "win") {
556 skslc_path += ".exe"
557 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400558 args = [
559 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400560 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400561 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400562 args += rebase_path(skia_gpu_processor_sources)
563 }
564} else {
565 skia_gpu_processor_outputs = []
566 group("compile_processors") {
567 }
568}
569
Mike Klein33ad63a2018-11-11 07:17:00 -0500570optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700571 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400572 deps = [
573 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700574 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700576 if (skia_generate_workarounds) {
577 deps += [ ":workaround_list" ]
578 }
mtkleine9fb3d52016-09-20 15:11:46 -0700579 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600580 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400581 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700582
Brian Salomon3d6801e2017-12-11 10:06:31 -0500583 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400584 if (!skia_enable_ccpr) {
585 sources -= skia_ccpr_sources
586 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
587 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400588 if (!skia_enable_nvpr) {
589 sources -= skia_nvpr_sources
590 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
591 }
mtklein06c35c02016-09-20 12:28:12 -0700592
593 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500594 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700595 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400596 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700597 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400598 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400599
600 # this lib is required to link against AHardwareBuffer
601 if (defined(ndk_api) && ndk_api >= 26) {
602 libs += [ "android" ]
603 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400604 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500605 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400606 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700607 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400609 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700610 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800612 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500613 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400614 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500615 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400616 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700617 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500618 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700619 }
mtkleine9fb3d52016-09-20 15:11:46 -0700620
621 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400622 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400623 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700624 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700625 if (skia_enable_vulkan_debug_layers) {
626 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
627 }
mtkleine9fb3d52016-09-20 15:11:46 -0700628 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400629
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400630 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400631 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400632 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
633 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400634
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400635 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400636 if (skia_use_metal) {
637 public_defines += [ "SK_METAL" ]
638 sources += skia_metal_sources
639 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400640 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400641 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400642 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500643
644 if (skia_enable_atlas_text) {
645 sources += skia_atlas_text_sources
646 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400647
648 if (is_debug) {
649 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
650 }
mtklein06c35c02016-09-20 12:28:12 -0700651}
652
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400653optional("heif") {
654 enabled = skia_use_libheif
655 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
656
657 deps = []
658
659 sources = [
660 "src/codec/SkHeifCodec.cpp",
661 ]
662}
663
mtklein63213812016-08-24 09:55:56 -0700664optional("jpeg") {
665 enabled = skia_use_libjpeg_turbo
666 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
667
mtklein63213812016-08-24 09:55:56 -0700668 deps = [
669 "//third_party/libjpeg-turbo:libjpeg",
670 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400671 public = [
672 "include/encode/SkJpegEncoder.h",
673 ]
mtklein63213812016-08-24 09:55:56 -0700674 sources = [
675 "src/codec/SkJpegCodec.cpp",
676 "src/codec/SkJpegDecoderMgr.cpp",
677 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700678 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400679 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700680 ]
681}
682
683optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500684 enabled = skia_use_zlib && skia_enable_pdf
685 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700686
mtklein63213812016-08-24 09:55:56 -0700687 deps = [
688 "//third_party/zlib",
689 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400690 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700691 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400692 }
brettwb9447282016-09-01 14:24:39 -0700693 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700694 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700695
696 if (skia_use_sfntly) {
697 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500698 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700699 }
700}
701
702optional("png") {
703 enabled = skia_use_libpng
704 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
705
mtklein63213812016-08-24 09:55:56 -0700706 deps = [
707 "//third_party/libpng",
708 ]
709 sources = [
710 "src/codec/SkIcoCodec.cpp",
711 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400712 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700713 ]
714}
715
scroggof84ad642016-10-31 09:02:57 -0700716optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400717 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700718 public_defines = [ "SK_CODEC_DECODES_RAW" ]
719
720 deps = [
721 "//third_party/dng_sdk",
722 "//third_party/libjpeg-turbo:libjpeg",
723 "//third_party/piex",
724 ]
725
726 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
727 # Skia.
728 configs_to_remove = [ "//gn:no_exceptions" ]
729
730 sources = [
scroggof84ad642016-10-31 09:02:57 -0700731 "src/codec/SkRawCodec.cpp",
732 ]
733}
734
Mike Klein852a8cb2018-05-15 10:46:58 -0400735import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400736source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400737 cflags = []
738 if (!is_win || is_clang) {
739 cflags += [
740 "-w",
741 "-std=c11",
742 ]
743 }
744
745 public = [
746 "third_party/skcms/skcms.h",
747 ]
748 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
749}
750
mtklein3cc22182016-08-29 13:26:14 -0700751optional("typeface_freetype") {
752 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700753
754 deps = [
755 "//third_party/freetype2",
756 ]
757 sources = [
758 "src/ports/SkFontHost_FreeType.cpp",
759 "src/ports/SkFontHost_FreeType_common.cpp",
760 ]
761}
762
mtklein457b42a2016-08-23 13:56:37 -0700763optional("webp") {
764 enabled = skia_use_libwebp
765 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
766
mtklein457b42a2016-08-23 13:56:37 -0700767 deps = [
768 "//third_party/libwebp",
769 ]
770 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700771 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400772 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700773 ]
mtkleineb3c4252016-08-23 07:38:09 -0700774}
775
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400776optional("wuffs") {
777 enabled = skia_use_wuffs
778 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
779
780 deps = [
781 "//third_party/wuffs",
782 ]
783 sources = [
784 "src/codec/SkWuffsCodec.cpp",
785 ]
786}
787
mtklein63213812016-08-24 09:55:56 -0700788optional("xml") {
789 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000790 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700791
mtklein63213812016-08-24 09:55:56 -0700792 deps = [
793 "//third_party/expat",
794 ]
795 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500796 "src/svg/SkSVGCanvas.cpp",
797 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700798 "src/xml/SkDOM.cpp",
799 "src/xml/SkXMLParser.cpp",
800 "src/xml/SkXMLWriter.cpp",
801 ]
802}
803
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700804if (skia_enable_gpu && skia_generate_workarounds) {
805 action("workaround_list") {
806 script = "tools/build_workaround_header.py"
807
808 inputs = [
809 "src/gpu/gpu_workaround_list.txt",
810 ]
811
812 # see comments in skia_compile_processors about out dir path shenanigans.
813 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700814 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700815
816 outputs = [
817 "$root_out_dir/$output_file",
818 ]
819 args = [
820 "--output-file",
821 "$output_file",
822 ]
823
824 foreach(file, inputs) {
825 args += [ rebase_path(file, root_build_dir) ]
826 }
827 }
828}
829
Mike Klein33ad63a2018-11-11 07:17:00 -0500830# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
831# TODO: rename :gpu_for_real back to :gpu when cleaning up.
832source_set("effects") {
833}
834source_set("gpu") {
835}
836
mtkleinc04ff472016-06-23 10:29:30 -0700837component("skia") {
838 public_configs = [ ":skia_public" ]
839 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700840
Mike Klein607b0a72018-11-07 16:17:34 -0500841 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500842 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500843 ":pdf",
844 ":skcms",
845 ]
846
mtkleinc04ff472016-06-23 10:29:30 -0700847 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700848 ":arm64",
849 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700850 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000851 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700852 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700853 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700854 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500855 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500856 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700857 ":fontmgr_fontconfig",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400858 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500859 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700860 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700861 ":none",
mtklein63213812016-08-24 09:55:56 -0700862 ":png",
scroggof84ad642016-10-31 09:02:57 -0700863 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700864 ":sse2",
865 ":sse41",
866 ":sse42",
867 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700868 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400869 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700870 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700871 ]
872
Kevin Lubick134be1d2018-10-30 15:05:04 -0400873 if (skia_enable_nima) {
874 deps += [ "//third_party/Nima-Cpp" ]
875 }
876
Chinmay Garde43f115c2016-11-16 15:04:12 -0800877 # This file (and all GN files in Skia) are designed to work with an
878 # empty sources assignment filter; we handle all that explicitly.
879 # We clear the filter here for clients who may have set up a global filter.
880 set_sources_assignment_filter([])
881
mtkleinc04ff472016-06-23 10:29:30 -0700882 sources = []
brettwb9447282016-09-01 14:24:39 -0700883 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700884 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500885 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000886 sources += skia_effects_sources
887 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700888 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400889 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500890 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700891 "src/android/SkBitmapRegionCodec.cpp",
892 "src/android/SkBitmapRegionDecoder.cpp",
893 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100894 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400895 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700896 "src/codec/SkBmpCodec.cpp",
897 "src/codec/SkBmpMaskCodec.cpp",
898 "src/codec/SkBmpRLECodec.cpp",
899 "src/codec/SkBmpStandardCodec.cpp",
900 "src/codec/SkCodec.cpp",
901 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400902 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400903 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700904 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700905 "src/codec/SkMaskSwizzler.cpp",
906 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700907 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700908 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700909 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700910 "src/codec/SkSwizzler.cpp",
911 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700912 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700913 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000914 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700915 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700916 "src/ports/SkMemory_malloc.cpp",
917 "src/ports/SkOSFile_stdio.cpp",
918 "src/sfnt/SkOTTable_name.cpp",
919 "src/sfnt/SkOTUtils.cpp",
920 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700921 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700922 ]
brettwb9447282016-09-01 14:24:39 -0700923
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400924 defines = []
925 if (!skia_enable_skpicture) {
926 defines = [ "SK_DISABLE_SKPICTURE" ]
927 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000928 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400929 sources += [ "src/core/SkPicture_none.cpp" ]
930 }
931
mtklein7d6fb2c2016-08-25 14:50:44 -0700932 libs = []
933
mtkleinc04ff472016-06-23 10:29:30 -0700934 if (is_win) {
935 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400936 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700937 "src/ports/SkDebug_win.cpp",
938 "src/ports/SkFontHost_win.cpp",
939 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500940 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700941 "src/ports/SkImageEncoder_WIC.cpp",
942 "src/ports/SkImageGeneratorWIC.cpp",
943 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700944 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700945 "src/ports/SkScalerContext_win_dw.cpp",
946 "src/ports/SkTLS_win.cpp",
947 "src/ports/SkTypeface_win_dw.cpp",
948 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400949 libs += [
950 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500951 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400952 "Ole32.lib",
953 "OleAut32.lib",
954 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500955 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400956 ]
mtkleinc04ff472016-06-23 10:29:30 -0700957 } else {
958 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700959 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700960 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700961 "src/ports/SkTLS_pthread.cpp",
962 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400963 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700964 }
965
mtklein7d6fb2c2016-08-25 14:50:44 -0700966 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500967 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500968 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500969 deps += [ "//third_party/cpu-features" ]
970 }
mtklein06c35c02016-09-20 12:28:12 -0700971 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700972 libs += [
973 "EGL",
974 "GLESv2",
975 "log",
976 ]
977 }
978
Kevin Lubick217056c2018-09-20 17:39:31 -0400979 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700980 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400981 if (skia_use_egl) {
982 libs += [ "GLESv2" ]
983 }
mtkleinc04ff472016-06-23 10:29:30 -0700984 }
985
Leon Scroggins III85e22fc2018-11-28 08:58:47 -0500986 if (skia_use_fonthost_mac) {
987 sources += [
988 "src/ports/SkFontHost_mac.cpp",
989 ]
990 }
991
mtkleinc04ff472016-06-23 10:29:30 -0700992 if (is_mac) {
993 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700994 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700995 "src/ports/SkImageEncoder_CG.cpp",
996 "src/ports/SkImageGeneratorCG.cpp",
997 ]
mtklein09e61f72016-08-23 13:35:28 -0700998 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400999 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1000 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001001 "ApplicationServices.framework",
1002 "OpenGL.framework",
1003 ]
mtkleinc04ff472016-06-23 10:29:30 -07001004 }
abarth6fc8ff02016-07-15 15:15:15 -07001005
Mike Klein7d302882016-11-03 14:06:31 -04001006 if (is_ios) {
1007 sources += [
1008 "src/ports/SkDebug_stdio.cpp",
1009 "src/ports/SkFontHost_mac.cpp",
1010 "src/ports/SkImageEncoder_CG.cpp",
1011 "src/ports/SkImageGeneratorCG.cpp",
1012 ]
1013 libs += [
1014 "CoreFoundation.framework",
1015 "CoreGraphics.framework",
1016 "CoreText.framework",
1017 "ImageIO.framework",
1018 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001019
1020 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1021 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001022 ]
1023 }
1024
abarth6fc8ff02016-07-15 15:15:15 -07001025 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001026 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001027 }
mtkleinc04ff472016-06-23 10:29:30 -07001028}
1029
Kevin Lubickcbcff382018-10-02 09:02:18 -04001030static_library("pathkit") {
1031 public_configs = [ ":skia_public" ]
1032 configs += skia_library_configs
1033
1034 deps = [
1035 ":arm64",
1036 ":armv7",
1037 ":avx",
1038 ":crc32",
1039 ":hsw",
1040 ":none",
1041 ":sse2",
1042 ":sse41",
1043 ":sse42",
1044 ":ssse3",
1045 ]
1046
1047 # This file (and all GN files in Skia) are designed to work with an
1048 # empty sources assignment filter; we handle all that explicitly.
1049 # We clear the filter here for clients who may have set up a global filter.
1050 set_sources_assignment_filter([])
1051
1052 sources = []
1053 sources += skia_pathops_sources
1054 sources += [
1055 "src/core/SkAnalyticEdge.cpp",
1056 "src/core/SkArenaAlloc.cpp",
1057 "src/core/SkCubicMap.cpp",
1058 "src/core/SkEdge.cpp",
1059 "src/core/SkEdgeBuilder.cpp",
1060 "src/core/SkEdgeClipper.cpp",
1061 "src/core/SkGeometry.cpp",
1062 "src/core/SkLineClipper.cpp",
1063 "src/core/SkMallocPixelRef.cpp",
1064 "src/core/SkMath.cpp",
1065 "src/core/SkMatrix.cpp",
1066 "src/core/SkOpts.cpp",
1067 "src/core/SkPaint.cpp",
1068 "src/core/SkPath.cpp",
1069 "src/core/SkPathEffect.cpp",
1070 "src/core/SkPathMeasure.cpp",
1071 "src/core/SkPathRef.cpp",
1072 "src/core/SkPoint.cpp",
1073 "src/core/SkRRect.cpp",
1074 "src/core/SkRect.cpp",
1075 "src/core/SkSemaphore.cpp",
1076 "src/core/SkStream.cpp",
1077 "src/core/SkString.cpp",
1078 "src/core/SkStringUtils.cpp",
1079 "src/core/SkStroke.cpp",
1080 "src/core/SkStrokeRec.cpp",
1081 "src/core/SkStrokerPriv.cpp",
1082 "src/core/SkThreadID.cpp",
1083 "src/core/SkUtils.cpp",
1084 "src/effects/SkDashPathEffect.cpp",
1085 "src/effects/SkTrimPathEffect.cpp",
1086 "src/ports/SkDebug_stdio.cpp",
1087 "src/ports/SkMemory_malloc.cpp",
1088 "src/utils/SkDashPath.cpp",
1089 "src/utils/SkParse.cpp",
1090 "src/utils/SkParsePath.cpp",
1091 "src/utils/SkUTF.cpp",
1092 ]
1093}
1094
mtkleinc095df52016-08-24 12:23:52 -07001095# Targets guarded by skia_enable_tools may use //third_party freely.
1096if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001097 # Used by gn_to_bp.py to list our public include dirs.
1098 source_set("public") {
1099 configs += [ ":skia_public" ]
1100 }
1101
Mike Kleinc36dedf2016-11-18 09:35:28 -05001102 config("skia.h_config") {
1103 include_dirs = [ "$target_gen_dir" ]
1104 }
1105 action("skia.h") {
1106 public_configs = [ ":skia.h_config" ]
1107 skia_h = "$target_gen_dir/skia.h"
1108 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001109
1110 # TODO: would be cool to not hard-code these here, but how?
1111 module_public_includes = [
1112 "modules/sksg/include",
1113 "modules/skottie/include",
1114 ]
1115 args =
1116 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1117 [ rebase_path(skia_h, root_build_dir) ] +
1118 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001119 depfile = "$skia_h.deps"
1120 outputs = [
1121 skia_h,
1122 ]
1123 }
1124
Brian Osmanc9a42472018-05-31 13:17:12 -04001125 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001126 executable("fiddle") {
1127 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001128 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001129 "tools/fiddle/draw.cpp",
1130 "tools/fiddle/fiddle_main.cpp",
1131 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001132
1133 if (skia_use_egl) {
1134 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001135 } else {
1136 sources += [ "tools/fiddle/null_context.cpp" ]
1137 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001138 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001139 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001140 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001141 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001142 ":skia",
1143 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001144 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001145 ]
1146 }
1147 }
1148
Brian Osmanc9a42472018-05-31 13:17:12 -04001149 source_set("public_headers_warnings_check") {
1150 sources = [
1151 "tools/public_headers_warnings_check.cpp",
1152 ]
1153 configs -= [ "//gn:warnings_except_public_headers" ]
1154 deps = [
1155 ":skia",
1156 ":skia.h",
1157 "modules/skottie",
1158 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001159
1160 # We add this directory to simulate the client already have
1161 # vulkan/vulkan_core.h on their path.
1162 include_dirs = [ "third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001163 }
1164
mtkleinc095df52016-08-24 12:23:52 -07001165 template("test_lib") {
1166 config(target_name + "_config") {
1167 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001168 if (defined(invoker.public_defines)) {
1169 defines = invoker.public_defines
1170 }
mtklein25c81d42016-07-27 13:55:26 -07001171 }
mtkleinc095df52016-08-24 12:23:52 -07001172 source_set(target_name) {
1173 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1174 public_configs = [
1175 ":" + target_name + "_config",
1176 ":skia_private",
1177 ]
1178
1179 if (!defined(deps)) {
1180 deps = []
1181 }
1182 deps += [ ":skia" ]
1183 testonly = true
1184 }
mtklein25c81d42016-07-27 13:55:26 -07001185 }
mtklein25c81d42016-07-27 13:55:26 -07001186
Mike Kleine6682eb2017-01-05 10:54:57 -05001187 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001188 if (is_ios) {
1189 app_name = target_name
1190 gen_path = target_gen_dir
1191
1192 action("${app_name}_generate_info_plist") {
1193 script = "//gn/gen_plist_ios.py"
1194 outputs = [
1195 "$gen_path/${app_name}_Info.plist",
1196 ]
1197 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1198 }
1199
1200 bundle_data("${app_name}_bundle_info_plist") {
1201 public_deps = [
1202 ":${app_name}_generate_info_plist",
1203 ]
1204 sources = [
1205 "$gen_path/${app_name}_Info.plist",
1206 ]
1207 outputs = [
1208 "{{bundle_root_dir}}/Info.plist",
1209 ]
1210 }
1211
Jim Van Verth329c5a62017-11-29 11:42:33 -05001212 bundle_ios_data =
1213 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1214
1215 if (bundle_ios_data) {
1216 has_skps =
1217 "True" == exec_script("//gn/checkdir.py",
1218 [ rebase_path("skps", root_build_dir) ],
1219 "trim string")
1220 bundle_data("${app_name}_bundle_resources") {
1221 sources = [
1222 "resources",
1223 ]
1224 outputs = [
1225 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1226 "{{bundle_resources_dir}}/data/resources",
1227 ]
1228 }
1229
1230 if (has_skps) {
1231 bundle_data("${app_name}_bundle_skps") {
1232 sources = [
1233 "skps",
1234 ]
1235 outputs = [
1236 # Store in same folder as resources
1237 "{{bundle_resources_dir}}/data/skps",
1238 ]
1239 }
1240 }
1241 }
1242
Jim Van Verth443a9132017-11-28 09:45:26 -05001243 executable("${app_name}_generate_executable") {
1244 forward_variables_from(invoker,
1245 "*",
1246 [
1247 "output_name",
1248 "visibility",
1249 "is_shared_library",
1250 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001251 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001252 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001253 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1254 }
1255
1256 bundle_data("${app_name}_bundle_executable") {
1257 public_deps = [
1258 ":${app_name}_generate_executable",
1259 ]
1260 sources = [
1261 "$gen_path/$app_name",
1262 ]
1263 outputs = [
1264 "{{bundle_executable_dir}}/$app_name",
1265 ]
1266 testonly = true
1267 }
1268
1269 create_bundle("$app_name") {
1270 product_type = "com.apple.product-type.application"
1271 testonly = true
1272
1273 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1274 bundle_resources_dir = bundle_root_dir
1275 bundle_executable_dir = bundle_root_dir
1276 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1277
1278 deps = [
1279 ":${app_name}_bundle_executable",
1280 ":${app_name}_bundle_info_plist",
1281 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001282 if (bundle_ios_data) {
1283 deps += [ ":${app_name}_bundle_resources" ]
1284 if (has_skps) {
1285 deps += [ ":${app_name}_bundle_skps" ]
1286 }
1287 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001288
1289 # should only code sign when running on a device, not the simulator
1290 if (target_cpu != "x64") {
1291 code_signing_script = "//gn/codesign_ios.py"
1292 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1293 code_signing_outputs = [
1294 "$bundle_root_dir/_CodeSignature/CodeResources",
1295 "$bundle_root_dir/embedded.mobileprovision",
1296 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001297 code_signing_args = [
1298 rebase_path("$bundle_root_dir", root_build_dir),
1299 skia_ios_identity,
1300 skia_ios_profile,
1301 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001302 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001303 }
1304 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001305 # !is_ios
1306
1307 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1308 shared_library("lib" + target_name) {
1309 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1310 configs += [ ":skia_private" ]
1311 testonly = true
1312 }
1313 } else {
1314 _executable = target_name
1315 executable(_executable) {
1316 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1317 configs += [ ":skia_private" ]
1318 testonly = true
1319 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001320 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001321 if (is_android && skia_android_serial != "" && defined(_executable)) {
1322 action("push_" + target_name) {
1323 script = "gn/push_to_android.py"
1324 deps = [
1325 ":" + _executable,
1326 ]
1327 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1328 outputs = [
1329 _stamp,
1330 ]
1331 args = [
1332 rebase_path("$root_build_dir/$_executable"),
1333 skia_android_serial,
1334 rebase_path(_stamp),
1335 ]
1336 testonly = true
1337 }
Mike Klein7d921032017-01-05 12:20:41 -05001338 }
1339 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001340 }
1341
Greg Danielda16cce2018-08-01 09:23:57 -04001342 config("moltenvk_config") {
1343 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1344 if (is_ios) {
1345 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1346 } else {
1347 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1348 }
1349 cflags = [ "-F$moltenvk_framework_path" ]
1350 ldflags = [ "-F$moltenvk_framework_path" ]
1351 libs = [
1352 "MoltenVK.framework",
1353 "Metal.framework",
1354 "IOSurface.framework",
1355 "QuartzCore.framework",
1356 "Foundation.framework",
1357 ]
1358 if (is_ios) {
1359 libs += [ "UIKit.framework" ]
1360 } else {
1361 libs += [ "IOKit.framework" ]
1362 }
1363 defines = [ "SK_MOLTENVK" ]
1364 }
1365 }
1366
1367 source_set("moltenvk") {
1368 public_configs = [ ":moltenvk_config" ]
1369 }
1370
mtkleinc095df52016-08-24 12:23:52 -07001371 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001372 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001373 public_defines = []
1374 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001375
Brian Osmanc9a42472018-05-31 13:17:12 -04001376 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001377 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001378 sources = [
1379 "tools/gpu/GrContextFactory.cpp",
1380 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001381 "tools/gpu/MemoryCache.cpp",
1382 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001383 "tools/gpu/ProxyUtils.cpp",
1384 "tools/gpu/TestContext.cpp",
1385 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1386 "tools/gpu/gl/GLTestContext.cpp",
1387 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001388 "tools/gpu/gl/null/NullGLTestContext.cpp",
1389 "tools/gpu/mock/MockTestContext.cpp",
1390 ]
1391 libs = []
1392
1393 if (is_android || skia_use_egl) {
1394 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1395 } else if (is_ios) {
1396 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1397 libs += [ "OpenGLES.framework" ]
1398 } else if (is_linux) {
1399 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001400 libs += [
1401 "GLU",
1402 "X11",
1403 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001404 } else if (is_mac) {
1405 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1406 } else if (is_win) {
1407 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1408 libs += [
1409 "Gdi32.lib",
1410 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001411 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001412 }
mtklein25c81d42016-07-27 13:55:26 -07001413
Brian Osmanc9a42472018-05-31 13:17:12 -04001414 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001415
Brian Osmanc9a42472018-05-31 13:17:12 -04001416 if (skia_use_angle) {
1417 deps += [ "//third_party/angle2" ]
1418 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1419 }
Greg Danielb4d89562018-10-03 18:44:49 +00001420 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001421 if (skia_use_vulkan) {
1422 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1423 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001424 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1425 public_deps += [ ":moltenvk" ]
1426 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001427 }
1428 if (skia_use_metal) {
1429 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001430 }
mtklein25c81d42016-07-27 13:55:26 -07001431 }
mtklein25c81d42016-07-27 13:55:26 -07001432
mtkleinc095df52016-08-24 12:23:52 -07001433 test_lib("flags") {
1434 public_include_dirs = [ "tools/flags" ]
1435 sources = [
1436 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001437 ]
1438 }
1439 test_lib("common_flags") {
1440 public_include_dirs = [ "tools/flags" ]
1441 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001442 "tools/flags/SkCommonFlags.cpp",
1443 "tools/flags/SkCommonFlagsConfig.cpp",
1444 ]
1445 deps = [
mtklein046cb562016-09-16 10:23:12 -07001446 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001447 ]
1448 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001449 ":gpu_tool_utils",
1450 ]
1451 }
mtklein25c81d42016-07-27 13:55:26 -07001452
mtkleinc095df52016-08-24 12:23:52 -07001453 test_lib("tool_utils") {
1454 public_include_dirs = [
1455 "tools",
1456 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001457 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001458 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001459 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001460 ]
1461 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001462 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001463 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001464 "tools/DDLPromiseImageHelper.cpp",
1465 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001466 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001467 "tools/ProcStats.cpp",
1468 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001469 "tools/UrlDataManager.cpp",
1470 "tools/debugger/SkDebugCanvas.cpp",
1471 "tools/debugger/SkDrawCommand.cpp",
1472 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001473 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001474 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001475 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001476 "tools/fonts/SkTestFontMgr.h",
1477 "tools/fonts/SkTestSVGTypeface.cpp",
1478 "tools/fonts/SkTestSVGTypeface.h",
1479 "tools/fonts/SkTestTypeface.cpp",
1480 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001481 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001482 "tools/random_parse_path.cpp",
1483 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001484 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001485 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001486 "tools/trace/SkChromeTracingTracer.cpp",
1487 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001488 "tools/trace/SkDebugfTracer.cpp",
1489 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001490 "tools/trace/SkEventTracingPriv.cpp",
1491 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001492 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001493 libs = []
1494 if (is_ios) {
1495 sources += [ "tools/ios_utils.m" ]
1496 libs += [ "Foundation.framework" ]
1497 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001498 defines = []
1499 if (skia_tools_require_resources) {
1500 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1501 }
mtkleinc095df52016-08-24 12:23:52 -07001502 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001503 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001504 ":flags",
1505 "//third_party/libpng",
1506 ]
1507 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001508 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001509 "//third_party/jsoncpp",
1510 ]
1511 }
mtklein25c81d42016-07-27 13:55:26 -07001512
Mike Klein6e744122016-10-27 12:21:40 -04001513 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001514 test_lib("gm") {
1515 public_include_dirs = [ "gm" ]
1516 sources = gm_sources
1517 deps = [
scroggo19b91532016-10-24 09:03:26 -07001518 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001519 ":skia",
1520 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001521 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001522 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001523 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001524 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001525 public_deps = [
1526 ":gpu_tool_utils",
1527 ]
mtkleinc095df52016-08-24 12:23:52 -07001528 }
mtklein25c81d42016-07-27 13:55:26 -07001529
Mike Klein6e744122016-10-27 12:21:40 -04001530 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001531 test_lib("tests") {
1532 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001533 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001534 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001535 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001536 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001537 if (!(skia_use_freetype && skia_use_fontconfig)) {
1538 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1539 }
mtkleinc095df52016-08-24 12:23:52 -07001540 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001541 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001542 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001543 ":skia",
1544 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001545 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001546 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001547 "//third_party/libpng",
1548 "//third_party/zlib",
1549 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001550 public_deps = [
1551 ":gpu_tool_utils", # Test.h #includes headers from this target.
1552 ]
mtkleinc095df52016-08-24 12:23:52 -07001553 }
mtklein2f3416d2016-08-02 16:02:05 -07001554
Mike Klein6e744122016-10-27 12:21:40 -04001555 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001556 test_lib("bench") {
1557 public_include_dirs = [ "bench" ]
1558 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001559 deps = [
1560 ":flags",
1561 ":gm",
1562 ":gpu_tool_utils",
1563 ":skia",
1564 ":tool_utils",
1565 ]
1566 }
mtklein2b6870c2016-07-28 14:17:33 -07001567
mtkleinc095df52016-08-24 12:23:52 -07001568 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001569 public_include_dirs = []
1570 if (skia_use_expat) {
1571 public_include_dirs += [ "experimental/svg/model" ]
1572 sources = [
1573 "experimental/svg/model/SkSVGAttribute.cpp",
1574 "experimental/svg/model/SkSVGAttributeParser.cpp",
1575 "experimental/svg/model/SkSVGCircle.cpp",
1576 "experimental/svg/model/SkSVGClipPath.cpp",
1577 "experimental/svg/model/SkSVGContainer.cpp",
1578 "experimental/svg/model/SkSVGDOM.cpp",
1579 "experimental/svg/model/SkSVGEllipse.cpp",
1580 "experimental/svg/model/SkSVGGradient.cpp",
1581 "experimental/svg/model/SkSVGLine.cpp",
1582 "experimental/svg/model/SkSVGLinearGradient.cpp",
1583 "experimental/svg/model/SkSVGNode.cpp",
1584 "experimental/svg/model/SkSVGPath.cpp",
1585 "experimental/svg/model/SkSVGPattern.cpp",
1586 "experimental/svg/model/SkSVGPoly.cpp",
1587 "experimental/svg/model/SkSVGRadialGradient.cpp",
1588 "experimental/svg/model/SkSVGRect.cpp",
1589 "experimental/svg/model/SkSVGRenderContext.cpp",
1590 "experimental/svg/model/SkSVGSVG.cpp",
1591 "experimental/svg/model/SkSVGShape.cpp",
1592 "experimental/svg/model/SkSVGStop.cpp",
1593 "experimental/svg/model/SkSVGTransformableNode.cpp",
1594 "experimental/svg/model/SkSVGUse.cpp",
1595 "experimental/svg/model/SkSVGValue.cpp",
1596 ]
1597 deps = [
1598 ":skia",
1599 ":xml",
1600 ]
1601 }
mtkleinc095df52016-08-24 12:23:52 -07001602 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001603
Mike Klein38af9432016-11-11 11:39:44 -05001604 if (skia_use_lua) {
1605 test_lib("lua") {
1606 public_include_dirs = []
1607 sources = [
1608 "src/utils/SkLua.cpp",
1609 "src/utils/SkLuaCanvas.cpp",
1610 ]
1611 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001612 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001613 "//third_party/lua",
1614 ]
1615 }
1616
Mike Kleine6682eb2017-01-05 10:54:57 -05001617 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001618 sources = [
1619 "tools/lua/lua_app.cpp",
1620 ]
1621 deps = [
1622 ":lua",
1623 ":skia",
1624 "//third_party/lua",
1625 ]
Mike Klein38af9432016-11-11 11:39:44 -05001626 }
1627
Mike Kleine6682eb2017-01-05 10:54:57 -05001628 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001629 sources = [
1630 "tools/lua/lua_pictures.cpp",
1631 ]
1632 deps = [
1633 ":flags",
1634 ":lua",
1635 ":skia",
1636 ":tool_utils",
1637 "//third_party/lua",
1638 ]
Mike Klein38af9432016-11-11 11:39:44 -05001639 }
1640 }
1641
Cary Clark8032b982017-07-28 11:04:54 -04001642 test_app("bookmaker") {
1643 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001644 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001645 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001646 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001647 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001648 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001649 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001650 "tools/bookmaker/includeParser.cpp",
1651 "tools/bookmaker/includeWriter.cpp",
1652 "tools/bookmaker/mdOut.cpp",
1653 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001654 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001655 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001656 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001657 ]
1658 deps = [
1659 ":flags",
1660 ":skia",
1661 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001662 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001663 ]
1664 }
1665
Florin Malitabfe876a2018-09-02 12:33:59 -04001666 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001667 test_app("skottie_tool") {
1668 deps = [
1669 "modules/skottie:tool",
1670 ]
1671 }
1672 }
1673
Kevin Lubickebf648e2017-09-21 13:45:16 -04001674 if (target_cpu != "wasm") {
1675 import("gn/samples.gni")
1676 test_lib("samples") {
1677 public_include_dirs = [ "samplecode" ]
1678 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001679 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001680 public_deps = [
1681 ":tool_utils",
1682 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001683 deps = [
1684 ":experimental_svg_model",
1685 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001686 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001687 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001688 ]
Mike Klein38af9432016-11-11 11:39:44 -05001689
Ruiqi Maof5101492018-06-29 14:32:21 -04001690 # NIMA does not build on Windows clang
1691 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001692 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001693 deps += [ "//third_party/Nima-Cpp" ]
1694 }
1695
Kevin Lubickebf648e2017-09-21 13:45:16 -04001696 if (skia_use_lua) {
1697 sources += [ "samplecode/SampleLua.cpp" ]
1698 deps += [
1699 ":lua",
1700 "//third_party/lua",
1701 ]
1702 }
1703 }
Mike Klein7af351a2018-07-27 09:54:43 -04001704 test_app("imgcvt") {
1705 sources = [
1706 "tools/imgcvt.cpp",
1707 ]
1708 deps = [
1709 ":skcms",
1710 ":skia",
1711 ]
1712 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001713 test_app("dm") {
1714 sources = [
1715 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001716 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001717 "dm/DMJsonWriter.cpp",
1718 "dm/DMSrcSink.cpp",
1719 ]
1720 include_dirs = [ "tests" ]
1721 deps = [
1722 ":common_flags",
1723 ":experimental_svg_model",
1724 ":flags",
1725 ":gm",
1726 ":gpu_tool_utils",
1727 ":skia",
1728 ":tests",
1729 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001730 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001731 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001732 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001733 "//third_party/jsoncpp",
1734 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001735 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001736
1737 # NIMA does not build on Windows clang
1738 if (!is_win || !is_clang) {
1739 deps += [ "//third_party/Nima-Cpp" ]
1740 }
Mike Klein38af9432016-11-11 11:39:44 -05001741 }
Brian Osman16adfa32016-10-18 14:42:44 -04001742 }
1743
Mike Kleina8a51ce2018-01-09 12:34:11 -05001744 if (!is_win) {
1745 test_app("remote_demo") {
1746 sources = [
1747 "tools/remote_demo.cpp",
1748 ]
1749 deps = [
1750 ":skia",
1751 ]
1752 }
1753 }
1754
Mike Kleine6682eb2017-01-05 10:54:57 -05001755 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001756 sources = [
1757 "bench/nanobench.cpp",
1758 ]
1759 deps = [
1760 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001761 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001762 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001763 ":flags",
1764 ":gm",
1765 ":gpu_tool_utils",
1766 ":skia",
1767 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001768 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001769 "//third_party/jsoncpp",
1770 ]
mtklein2b6870c2016-07-28 14:17:33 -07001771 }
halcanary19a97202016-08-03 15:08:04 -07001772
Ravi Mistry10d36c52017-01-31 09:49:18 -05001773 test_app("skpinfo") {
1774 sources = [
1775 "tools/skpinfo.cpp",
1776 ]
1777 deps = [
1778 ":flags",
1779 ":skia",
1780 ]
1781 }
1782
Brian Osmanc9a42472018-05-31 13:17:12 -04001783 test_app("skpbench") {
1784 sources = [
1785 "tools/skpbench/skpbench.cpp",
1786 ]
1787 deps = [
1788 ":flags",
1789 ":gpu_tool_utils",
1790 ":skia",
1791 ":tool_utils",
1792 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001793 }
1794
Mike Kleine6682eb2017-01-05 10:54:57 -05001795 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001796 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001797 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001798 ]
1799 deps = [
1800 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001801 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001802 ]
halcanary3eee9d92016-09-10 07:01:53 -07001803 }
mtklein046cb562016-09-16 10:23:12 -07001804
Ben Wagner219f3622017-07-17 15:32:25 -04001805 test_app("create_test_font") {
1806 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001807 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001808 ]
1809 deps = [
1810 ":skia",
1811 ]
1812 assert_no_deps = [
1813 # tool_utils requires the output of this app.
1814 ":tool_utils",
1815 ]
1816 }
1817
Florin Malita5d3ff432018-07-31 16:38:43 -04001818 if (skia_use_expat) {
1819 test_app("create_test_font_color") {
1820 sources = [
1821 "tools/fonts/create_test_font_color.cpp",
1822 ]
1823 deps = [
1824 ":flags",
1825 ":skia",
1826 ":tool_utils",
1827 ]
1828 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001829 }
1830
Mike Kleine6682eb2017-01-05 10:54:57 -05001831 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001832 sources = [
1833 "tools/get_images_from_skps.cpp",
1834 ]
1835 deps = [
1836 ":flags",
1837 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001838 ]
mtklein046cb562016-09-16 10:23:12 -07001839 }
mtkleinecbc5262016-09-22 11:51:24 -07001840
Kevin Lubickebf648e2017-09-21 13:45:16 -04001841 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001842 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001843 sources = [
1844 "tools/skiaserve/Request.cpp",
1845 "tools/skiaserve/Response.cpp",
1846 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001847 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1848 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1849 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1850 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1851 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1852 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1853 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1854 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1855 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001856 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1857 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001858 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1859 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1860 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1861 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1862 ]
1863 deps = [
1864 ":flags",
1865 ":gpu_tool_utils",
1866 ":skia",
1867 ":tool_utils",
1868 "//third_party/jsoncpp",
1869 "//third_party/libmicrohttpd",
1870 "//third_party/libpng",
1871 ]
Mike Klein7d302882016-11-03 14:06:31 -04001872 }
mtkleinecbc5262016-09-22 11:51:24 -07001873 }
kjlubick14f984b2016-10-03 11:49:45 -07001874
Mike Kleine6682eb2017-01-05 10:54:57 -05001875 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001876 include_dirs = [
1877 "tools",
1878 "tools/debugger",
1879 ]
kjlubick14f984b2016-10-03 11:49:45 -07001880 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001881 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001882 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001883 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001884 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001885 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001886 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001887 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001888 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001889 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001890 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001891 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001892 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001893 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001894 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1895 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001896 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001897 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001898 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001899 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001900 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1901 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001902 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001903 "tools/UrlDataManager.cpp",
1904 "tools/debugger/SkDebugCanvas.cpp",
1905 "tools/debugger/SkDrawCommand.cpp",
1906 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001907 ]
1908 deps = [
1909 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001910 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001911 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001912 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001913 "//third_party/jsoncpp",
1914 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001915 ]
kjlubick14f984b2016-10-03 11:49:45 -07001916 }
Mike Klein38312422016-10-05 15:41:01 -04001917
Mike Kleine6682eb2017-01-05 10:54:57 -05001918 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001919 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001920 rebase_path("tests/skia_test.cpp"),
1921 rebase_path("tests/Test.cpp"),
1922 ]
caryclark9feb6322016-10-25 08:58:26 -07001923 deps = [
1924 ":flags",
1925 ":gpu_tool_utils",
1926 ":skia",
1927 ":tool_utils",
1928 ]
caryclark9feb6322016-10-25 08:58:26 -07001929 }
1930
Mike Kleine6682eb2017-01-05 10:54:57 -05001931 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001932 sources = [
1933 "tools/DumpRecord.cpp",
1934 "tools/dump_record.cpp",
1935 ]
1936 deps = [
1937 ":flags",
1938 ":skia",
1939 ]
Mike Klein38312422016-10-05 15:41:01 -04001940 }
bungemanfe917272016-10-13 17:36:40 -04001941
Mike Kleine6682eb2017-01-05 10:54:57 -05001942 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001943 sources = [
1944 "tools/skdiff/skdiff.cpp",
1945 "tools/skdiff/skdiff_html.cpp",
1946 "tools/skdiff/skdiff_main.cpp",
1947 "tools/skdiff/skdiff_utils.cpp",
1948 ]
1949 deps = [
1950 ":skia",
1951 ":tool_utils",
1952 ]
bungemanfe917272016-10-13 17:36:40 -04001953 }
halcanarya73d76a2016-10-17 13:19:02 -07001954
Mike Kleine6682eb2017-01-05 10:54:57 -05001955 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001956 sources = [
1957 "tools/skp_parser.cpp",
1958 ]
1959 deps = [
1960 ":skia",
1961 ":tool_utils",
1962 "//third_party/jsoncpp",
1963 ]
halcanarya73d76a2016-10-17 13:19:02 -07001964 }
Brian Osman16adfa32016-10-18 14:42:44 -04001965
Brian Osmanc9a42472018-05-31 13:17:12 -04001966 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001967 test_lib("skqp_lib") {
1968 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001969 defines =
1970 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001971 if (skia_skqp_enable_driver_correctness_workarounds) {
1972 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1973 }
Hal Canary75427132017-10-11 16:00:31 -04001974 sources = [
1975 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001976 "tools/skqp/gm_knowledge.cpp",
1977 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001978 ]
1979 deps = [
1980 ":gm",
1981 ":gpu_tool_utils",
1982 ":skia",
1983 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001984 ":tool_utils",
1985 ]
1986 }
1987 test_app("skqp") {
1988 sources = [
1989 "tools/skqp/skqp.cpp",
1990 ]
1991 deps = [
1992 ":skia",
1993 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001994 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001995 "//third_party/googletest",
1996 ]
1997 }
1998 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001999 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002000 test_app("skqp_app") {
2001 is_shared_library = true
2002 sources = [
2003 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
2004 ]
2005 deps = [
2006 ":skia",
2007 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002008 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002009 ]
2010 libs = [ "android" ]
2011 }
2012 }
Stan Iliev93151722018-08-02 11:10:52 -04002013 if (is_android && skia_enable_gpu) {
2014 test_app("skottie_android") {
2015 is_shared_library = true
2016
2017 sources = [
2018 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2019 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2020 ]
2021 libs = []
2022
2023 include_dirs = []
2024 deps = [
2025 ":skia",
2026 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002027 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002028 ]
2029 }
2030 }
Hal Canary75427132017-10-11 16:00:31 -04002031
Hal Canarya9de7602018-01-19 13:08:23 -05002032 test_app("list_gms") {
2033 sources = [
2034 "tools/list_gms.cpp",
2035 ]
2036 deps = [
2037 ":gm",
2038 ":skia",
2039 ]
2040 }
2041 test_app("list_gpu_unit_tests") {
2042 sources = [
2043 "dm/DMGpuTestProcs.cpp",
2044 "tools/list_gpu_unit_tests.cpp",
2045 ]
2046 deps = [
2047 ":skia",
2048 ":tests",
2049 ]
2050 }
2051
Brian Osmanc9a42472018-05-31 13:17:12 -04002052 test_lib("sk_app") {
2053 public_include_dirs = [ "tools/sk_app" ]
2054 sources = [
2055 "tools/sk_app/CommandSet.cpp",
2056 "tools/sk_app/GLWindowContext.cpp",
2057 "tools/sk_app/Window.cpp",
2058 ]
2059 libs = []
2060
2061 if (is_android) {
2062 sources += [
2063 "tools/sk_app/android/GLWindowContext_android.cpp",
2064 "tools/sk_app/android/RasterWindowContext_android.cpp",
2065 "tools/sk_app/android/Window_android.cpp",
2066 "tools/sk_app/android/main_android.cpp",
2067 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002068 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002069 libs += [ "android" ]
2070 } else if (is_linux) {
2071 sources += [
2072 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2073 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2074 "tools/sk_app/unix/Window_unix.cpp",
2075 "tools/sk_app/unix/keysym2ucs.c",
2076 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002077 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002078 libs += [
2079 "GL",
2080 "X11",
2081 ]
2082 } else if (is_win) {
2083 sources += [
2084 "tools/sk_app/win/GLWindowContext_win.cpp",
2085 "tools/sk_app/win/RasterWindowContext_win.cpp",
2086 "tools/sk_app/win/Window_win.cpp",
2087 "tools/sk_app/win/main_win.cpp",
2088 ]
Brian Salomon194db172017-08-17 14:37:06 -04002089 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002090 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002091 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002092 } else if (is_mac) {
2093 sources += [
2094 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2095 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2096 "tools/sk_app/mac/Window_mac.cpp",
2097 "tools/sk_app/mac/main_mac.cpp",
2098 ]
2099 libs += [
2100 "QuartzCore.framework",
2101 "Cocoa.framework",
2102 "Foundation.framework",
2103 ]
2104 } else if (is_ios) {
2105 sources += [
2106 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2107 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2108 "tools/sk_app/ios/Window_ios.cpp",
2109 "tools/sk_app/ios/main_ios.cpp",
2110 ]
2111 }
2112
2113 if (skia_use_vulkan) {
2114 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2115 if (is_android) {
2116 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2117 } else if (is_linux) {
2118 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2119 libs += [ "X11-xcb" ]
2120 } else if (is_win) {
2121 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2122 }
2123 }
2124
2125 deps = [
2126 ":gpu_tool_utils",
2127 ":skia",
2128 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002129 ]
2130 if (is_android) {
2131 deps += [ "//third_party/native_app_glue" ]
2132 } else if (is_mac || is_ios) {
2133 deps += [ "//third_party/libsdl" ]
2134 }
2135 if (skia_use_angle) {
2136 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002137 }
Brian Osman16adfa32016-10-18 14:42:44 -04002138 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002139
Brian Osmanc9a42472018-05-31 13:17:12 -04002140 test_app("viewer") {
2141 is_shared_library = is_android
2142 if (is_ios) {
2143 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002144 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002145 sources = [
2146 "tools/viewer/BisectSlide.cpp",
2147 "tools/viewer/GMSlide.cpp",
2148 "tools/viewer/ImGuiLayer.cpp",
2149 "tools/viewer/ImageSlide.cpp",
2150 "tools/viewer/SKPSlide.cpp",
2151 "tools/viewer/SampleSlide.cpp",
2152 "tools/viewer/SkottieSlide.cpp",
2153 "tools/viewer/SlideDir.cpp",
2154 "tools/viewer/StatsLayer.cpp",
2155 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002156 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002157 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002158 "tools/viewer/Viewer.cpp",
2159 ]
2160 libs = []
2161
Kevin Lubickd9699322018-10-30 15:08:53 -04002162 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002163 deps = [
2164 ":experimental_svg_model",
2165 ":flags",
2166 ":gm",
2167 ":gpu_tool_utils",
2168 ":samples",
2169 ":sk_app",
2170 ":skia",
2171 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002172 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002173 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002174 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002175 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002176 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002177 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002178
2179 # NIMA does not build on Windows clang
2180 if (!is_win || !is_clang) {
2181 sources += [ "tools/viewer/NIMASlide.cpp" ]
2182 deps += [ "//third_party/Nima-Cpp" ]
2183 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002184 }
2185
ziadbbceddbc2018-06-19 13:57:15 -04002186 if (is_android) {
2187 test_app("arcore") {
2188 is_shared_library = true
2189 configs = [
2190 ":skia_public",
2191 "gn:default",
2192 ]
2193
2194 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2195 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2196 sources = []
2197 sources += skia_core_sources
2198 sources += skia_utils_sources
2199 sources += skia_xps_sources
2200 sources += [
2201 "src/android/SkAndroidFrameworkUtils.cpp",
2202 "src/android/SkAnimatedImage.cpp",
2203 "src/android/SkBitmapRegionCodec.cpp",
2204 "src/android/SkBitmapRegionDecoder.cpp",
2205 "src/codec/SkAndroidCodec.cpp",
2206 "src/codec/SkBmpBaseCodec.cpp",
2207 "src/codec/SkBmpCodec.cpp",
2208 "src/codec/SkBmpMaskCodec.cpp",
2209 "src/codec/SkBmpRLECodec.cpp",
2210 "src/codec/SkBmpStandardCodec.cpp",
2211 "src/codec/SkCodec.cpp",
2212 "src/codec/SkCodecImageGenerator.cpp",
2213 "src/codec/SkColorTable.cpp",
2214 "src/codec/SkGifCodec.cpp",
2215 "src/codec/SkMaskSwizzler.cpp",
2216 "src/codec/SkMasks.cpp",
2217 "src/codec/SkSampledCodec.cpp",
2218 "src/codec/SkSampler.cpp",
2219 "src/codec/SkStreamBuffer.cpp",
2220 "src/codec/SkSwizzler.cpp",
2221 "src/codec/SkWbmpCodec.cpp",
2222 "src/images/SkImageEncoder.cpp",
2223 "src/ports/SkDiscardableMemory_none.cpp",
2224 "src/ports/SkImageGenerator_skia.cpp",
2225 "src/ports/SkMemory_malloc.cpp",
2226 "src/ports/SkOSFile_stdio.cpp",
2227 "src/sfnt/SkOTTable_name.cpp",
2228 "src/sfnt/SkOTUtils.cpp",
2229 "src/utils/mac/SkStream_mac.cpp",
2230 "third_party/gif/SkGifImageReader.cpp",
2231 ]
2232 deps = [
2233 ":tool_utils",
2234 "modules/skottie",
2235 "modules/skshaper",
2236 ]
2237 }
2238 }
2239
Brian Osmanc9a42472018-05-31 13:17:12 -04002240 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002241 test_app("HelloWorld") {
2242 sources = [
2243 "example/HelloWorld.cpp",
2244 ]
2245 libs = []
2246
2247 include_dirs = []
2248 deps = [
2249 ":flags",
2250 ":gpu_tool_utils",
2251 ":sk_app",
2252 ":skia",
2253 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002254 ]
2255 }
2256 }
2257
Brian Osmanc9a42472018-05-31 13:17:12 -04002258 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002259 test_app("SkiaSDLExample") {
2260 sources = [
2261 "example/SkiaSDLExample.cpp",
2262 ]
2263 libs = []
2264 include_dirs = []
2265 deps = [
2266 ":gpu_tool_utils",
2267 ":skia",
2268 "//third_party/libsdl",
2269 ]
2270 }
2271 }
2272
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002273 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2274 action_foreach("generate_mocs") {
2275 script = "gn/call.py"
2276 sources = [
2277 "tools/mdbviz/MainWindow.h",
2278 ]
2279 outputs = [
2280 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2281 ]
2282 args = [
2283 "$skia_qt_path" + "/bin/moc",
2284 "{{source}}",
2285 "-o",
2286 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2287 ]
2288 }
2289 action_foreach("generate_resources") {
2290 script = "gn/call.py"
2291 sources = [
2292 "tools/mdbviz/resources.qrc",
2293 ]
2294 outputs = [
2295 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2296 ]
2297 args = [
2298 "$skia_qt_path" + "/bin/rcc",
2299 "{{source}}",
2300 "-o",
2301 "gen/mdbviz/{{source_name_part}}_res.cpp",
2302 ]
2303 }
2304 test_app("mdbviz") {
2305 if (is_win) {
2306 # on Windows we need to disable some exception handling warnings due to the Qt headers
2307 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2308 }
2309 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002310 "tools/UrlDataManager.cpp",
2311 "tools/debugger/SkDebugCanvas.cpp",
2312 "tools/debugger/SkDrawCommand.cpp",
2313 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002314 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002315 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002316 "tools/mdbviz/main.cpp",
2317
2318 # generated files
2319 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2320 "$target_gen_dir/mdbviz/resources_res.cpp",
2321 ]
2322 lib_dirs = [ "$skia_qt_path/lib" ]
2323 libs = [
2324 "Qt5Core.lib",
2325 "Qt5Gui.lib",
2326 "Qt5Widgets.lib",
2327 ]
2328 include_dirs = [
2329 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002330 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002331 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002332 "tools",
2333 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002334 ]
2335 deps = [
2336 ":generate_mocs",
2337 ":generate_resources",
2338 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002339 "//third_party/jsoncpp",
2340 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002341 ]
2342 }
2343 }
2344
Mike Kleine459afd2017-03-03 09:21:30 -05002345 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002346 copy("gdbserver") {
2347 sources = [
2348 "$ndk/$ndk_gdbserver",
2349 ]
2350 outputs = [
2351 "$root_out_dir/gdbserver",
2352 ]
2353 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002354 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002355
2356 if (skia_use_opencl) {
2357 test_app("hello-opencl") {
2358 sources = [
2359 "src/compute/common/cl/assert_cl.c",
2360 "src/compute/common/cl/find_cl.c",
2361 "tools/hello-opencl.cpp",
2362 ]
2363 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002364 if (is_linux) {
2365 libs = [ "OpenCL" ]
2366 } else if (is_win) {
2367 libs = [ "OpenCL.lib" ]
2368 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002369 }
2370 }
mtklein25c81d42016-07-27 13:55:26 -07002371}