blob: 9faf14dff0c71f2399b7a0e9f741955ed25e3292 [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")
Hal Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
12 import("//build/vulkan/config.gni")
13}
14
mtkleinc04ff472016-06-23 10:29:30 -070015declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040016 skia_enable_flutter_defines = false
17}
18
19declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000020 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040021 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070022 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070023 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050024 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070025 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050026 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070027 skia_use_libjpeg_turbo = true
28 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070029 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050030 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040031 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040032 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040033 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070034 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040035 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040036 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070037 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050038 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070039
Mike Klein7d921032017-01-05 12:20:41 -050040 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040041 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000042 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050043 skia_enable_discrete_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040044 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050045 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040046 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040047 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050048 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040049 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040050 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070051 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070052 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040053
Hal Canary2331c822018-02-01 14:06:13 -050054 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040055
56 skia_llvm_path = ""
57 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040058
59 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070060}
Brian Salomon23d73ea2016-10-27 13:31:37 -040061declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040062 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040063 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050064 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050065 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050066 skia_enable_fontmgr_custom =
67 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050068 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
69 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080070 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050071 skia_enable_fontmgr_win = is_win
72 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040073
Kevin Lubick27ba7032019-03-21 08:13:54 -040074 if (is_mac) {
75 skia_gl_standard = "gl"
76 } else if (is_ios) {
77 skia_gl_standard = "gles"
78 } else {
79 skia_gl_standard = ""
80 }
81
Mike Klein4d598a32016-10-31 13:44:49 -040082 if (is_android) {
83 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070084 } else if (is_fuchsia) {
85 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040086 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050087 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040088 }
Jim Van Verth4e502972017-12-07 15:16:10 -050089
90 if (is_ios) {
91 skia_ios_identity = ".*Google.*"
92 skia_ios_profile = "Google Development"
93 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040094}
Brian Salomon789e25e2016-09-30 13:41:03 -040095
Adam Barth54ef74a2017-10-13 10:59:38 -070096if (defined(skia_settings)) {
97 import(skia_settings)
98}
99
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 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400144 if (skia_gl_standard == "gles") {
145 defines += [ "SK_ASSUME_GL_ES=1" ]
146 } else if (skia_gl_standard == "gl") {
147 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400148 } else if (skia_gl_standard == "webgl") {
149 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400150 }
mtkleinc04ff472016-06-23 10:29:30 -0700151}
152
153# Skia internal APIs, used by Skia itself and a few test tools.
154config("skia_private") {
155 visibility = [ ":*" ]
156
157 include_dirs = [
158 "include/private",
159 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700160 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700161 "src/core",
162 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700163 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700164 "src/image",
165 "src/images",
166 "src/lazy",
167 "src/opts",
168 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700169 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700170 "src/ports",
171 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400172 "src/shaders",
173 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700174 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700175 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700176 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500177 "src/xml",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500178 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700179 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700180 ]
mtklein150d1132016-08-01 06:56:40 -0700181
Mike Reeda9e241d2017-05-03 10:52:00 -0400182 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500183 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700184 defines += [
185 "SK_GAMMA_EXPONENT=1.4",
186 "SK_GAMMA_CONTRAST=0.0",
187 ]
188 }
mtklein88a7ac02016-09-14 11:16:49 -0700189 if (is_official_build || is_android) {
190 # TODO(bsalomon): it'd be nice to make Android normal.
191 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
192 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400193 libs = []
194 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500195 if (skia_enable_gpu) {
196 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500197 if (is_skia_dev_build && skia_use_vulkan) {
198 include_dirs += [ "tools/gpu/vk" ]
199 }
Brian Salomon03e05842017-02-23 12:23:47 -0500200 }
Brian Osman34755e22016-12-05 09:46:02 -0500201 if (skia_use_angle) {
202 defines += [ "SK_ANGLE" ]
203 }
Brian Osman3f375d02016-12-28 11:19:22 -0500204 if (skia_enable_discrete_gpu) {
205 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
206 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400207 if (!is_official_build) {
208 defines += [ "GR_TEST_UTILS=1" ]
209 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400210 if (skia_llvm_path != "") {
211 defines += [ "SK_LLVM_AVAILABLE" ]
212 include_dirs += [ "$skia_llvm_path/include" ]
213 libs += [ skia_llvm_lib ]
214 lib_dirs += [ "$skia_llvm_path/lib/" ]
215 }
mtkleinc04ff472016-06-23 10:29:30 -0700216}
217
218# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
219config("skia_library") {
220 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700221 defines = [ "SKIA_IMPLEMENTATION=1" ]
222}
223
224skia_library_configs = [
225 ":skia_public",
226 ":skia_private",
227 ":skia_library",
228]
229
mtklein9b8583d2016-08-24 17:32:30 -0700230# Use for CPU-specific Skia code that needs particular compiler flags.
231template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500232 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700233 if (invoker.enabled) {
234 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500235 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700236 forward_variables_from(invoker, "*")
237 configs += skia_library_configs
238 }
239 } else {
240 # If not enabled, a phony empty target that swallows all otherwise unused variables.
241 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500242 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700243 forward_variables_from(invoker,
244 "*",
245 [
246 "sources",
247 "cflags",
248 ])
249 }
250 }
anmittala7eaf2e2016-08-17 13:57:26 -0700251}
252
mtklein422310d2016-08-16 18:28:43 -0700253is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700254
mtklein7d6fb2c2016-08-25 14:50:44 -0700255opts("none") {
256 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700258 cflags = []
259}
260
mtklein7d6fb2c2016-08-25 14:50:44 -0700261opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700262 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700264 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700265}
266
267opts("arm64") {
268 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700270 cflags = []
271}
272
273opts("crc32") {
274 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700275 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700276 cflags = [ "-march=armv8-a+crc" ]
277}
278
mtklein9b8583d2016-08-24 17:32:30 -0700279opts("sse2") {
280 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700281 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400282 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400283 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
284 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400285 cflags = [ "-msse2" ]
286 }
mtklein9b8583d2016-08-24 17:32:30 -0700287}
mtkleinc04ff472016-06-23 10:29:30 -0700288
mtklein9b8583d2016-08-24 17:32:30 -0700289opts("ssse3") {
290 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700291 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400292 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400293 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
294 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400295 cflags = [ "-mssse3" ]
296 }
mtklein9b8583d2016-08-24 17:32:30 -0700297}
mtkleinc04ff472016-06-23 10:29:30 -0700298
mtklein9b8583d2016-08-24 17:32:30 -0700299opts("sse41") {
300 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700301 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400302 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400303 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
304 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400305 cflags = [ "-msse4.1" ]
306 }
mtklein9b8583d2016-08-24 17:32:30 -0700307}
mtklein4e976072016-08-08 09:06:27 -0700308
mtklein9b8583d2016-08-24 17:32:30 -0700309opts("sse42") {
310 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700311 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400312 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400313 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
314 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400315 cflags = [ "-msse4.2" ]
316 }
mtklein9b8583d2016-08-24 17:32:30 -0700317}
318
319opts("avx") {
320 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700321 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400322 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000323 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400324 } else {
325 cflags = [ "-mavx" ]
326 }
mtkleinc04ff472016-06-23 10:29:30 -0700327}
328
Mike Klein1b9b7d52018-02-27 10:37:40 -0500329opts("hsw") {
330 enabled = is_x86
331 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400332 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500333 cflags = [ "/arch:AVX2" ]
334 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000335 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500336 }
337
338 # Oddly, clang-cl doesn't recognize this as a valid flag.
339 # If it ever does, it'd nice to move this up with -mavx2 and co.
340 if (is_clang && !is_win) {
341 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
342 # but nice to have, generating slightly better code for paths without explicit FMAs.
343 cflags += [ "-ffp-contract=fast" ]
344 }
345}
346
mtkleinc095df52016-08-24 12:23:52 -0700347# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700348template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500349 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700350 if (invoker.enabled) {
351 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700352 if (defined(invoker.public_defines)) {
353 defines = invoker.public_defines
354 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600355 if (defined(invoker.public_configs)) {
356 configs = invoker.public_configs
357 }
mtklein457b42a2016-08-23 13:56:37 -0700358 }
359 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500360 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700361 forward_variables_from(invoker,
362 "*",
363 [
364 "public_defines",
365 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700366 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700367 ])
mtklein457b42a2016-08-23 13:56:37 -0700368 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700369 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700370 if (defined(invoker.configs_to_remove)) {
371 configs -= invoker.configs_to_remove
372 }
mtklein457b42a2016-08-23 13:56:37 -0700373 }
374 } else {
mtklein457b42a2016-08-23 13:56:37 -0700375 source_set(target_name) {
376 forward_variables_from(invoker,
377 "*",
378 [
379 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400380 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700381 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700382 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700383 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700384 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700385 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700386 ])
mtkleincd01b032016-08-31 04:58:19 -0700387 if (defined(invoker.sources_when_disabled)) {
388 sources = invoker.sources_when_disabled
389 }
390 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700391 }
mtkleineb3c4252016-08-23 07:38:09 -0700392 }
mtklein457b42a2016-08-23 13:56:37 -0700393}
mtklein457b42a2016-08-23 13:56:37 -0700394
mtkleina45be612016-08-29 15:22:10 -0700395optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500396 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700397
398 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500399 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700400 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700401 ]
402 sources = [
403 "src/ports/SkFontMgr_android.cpp",
404 "src/ports/SkFontMgr_android_factory.cpp",
405 "src/ports/SkFontMgr_android_parser.cpp",
406 ]
407}
408
mtkleind2e39db2016-09-07 07:52:55 -0700409optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500410 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700411
412 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500413 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700414 ]
415 sources = [
416 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500417 "src/ports/SkFontMgr_custom.h",
418 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700419 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500420 "src/ports/SkFontMgr_custom_embedded.cpp",
421 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700422 ]
423}
424
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500425optional("fontmgr_custom_empty") {
426 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500427
428 deps = [
429 ":typeface_freetype",
430 ]
431 sources = [
432 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500433 "src/ports/SkFontMgr_custom_empty.cpp",
434 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800435 ]
436}
437
Hal Canaryff2742e2018-01-30 11:35:47 -0500438optional("fontmgr_empty") {
439 enabled = skia_enable_fontmgr_empty
440 sources = [
441 "src/ports/SkFontMgr_empty_factory.cpp",
442 ]
443}
444
mtklein3cc22182016-08-29 13:26:14 -0700445optional("fontmgr_fontconfig") {
446 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700447
448 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500449 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700450 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700451 ]
452 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700453 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700454 "src/ports/SkFontConfigInterface_direct.cpp",
455 "src/ports/SkFontConfigInterface_direct_factory.cpp",
456 "src/ports/SkFontMgr_FontConfigInterface.cpp",
457 "src/ports/SkFontMgr_fontconfig.cpp",
458 "src/ports/SkFontMgr_fontconfig_factory.cpp",
459 ]
460}
461
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500462optional("fontmgr_fuchsia") {
463 enabled = skia_enable_fontmgr_fuchsia
464
465 deps = [
466 "//sdk/fidl/fuchsia.fonts",
467 ]
468 sources = [
469 "src/ports/SkFontMgr_fuchsia.cpp",
470 "src/ports/SkFontMgr_fuchsia.h",
471 ]
472}
473
474optional("fontmgr_wasm") {
475 enabled = target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700476
477 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500478 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700479 ]
480 sources = [
481 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500482 "src/ports/SkFontMgr_custom.h",
483 "src/ports/SkFontMgr_custom_embedded.cpp",
484 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700485 ]
486}
487
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500488optional("fontmgr_win") {
489 enabled = skia_enable_fontmgr_win
490
491 sources = [
492 "src/fonts/SkFontMgr_indirect.cpp",
493 "src/ports/SkFontMgr_win_dw.cpp",
494 "src/ports/SkFontMgr_win_dw_factory.cpp",
495 "src/ports/SkScalerContext_win_dw.cpp",
496 "src/ports/SkTypeface_win_dw.cpp",
497 ]
498}
499
500optional("fontmgr_win_gdi") {
501 enabled = skia_enable_fontmgr_win_gdi
502
503 sources = [
504 "src/ports/SkFontHost_win.cpp",
505 ]
506 libs = [ "Gdi32.lib" ]
507}
508
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700509if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400510 executable("sksllex") {
511 sources = [
512 "src/sksl/lex/Main.cpp",
513 "src/sksl/lex/NFA.cpp",
514 "src/sksl/lex/RegexNode.cpp",
515 "src/sksl/lex/RegexParser.cpp",
516 ]
517 include_dirs = [ "src/sksl/lex" ]
518 }
519
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700520 action("run_sksllex") {
521 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400522 deps = [
523 ":sksllex(//gn/toolchain:$host_toolchain)",
524 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700525 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700526 "src/sksl/lex/sksl.lex",
527 ]
528
529 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
530 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
531 outputs = [
532 "$target_out_dir/" +
533 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
534 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
535 # confused due to the same file being named by two different paths
536 ]
537 sksllex_path = "$root_out_dir/"
538 sksllex_path += "sksllex"
539 if (host_os == "win") {
540 sksllex_path += ".exe"
541 }
542 args = [
543 rebase_path(sksllex_path),
544 rebase_path("bin/clang-format"),
545 rebase_path("src"),
546 ]
547 }
548} else {
549 group("run_sksllex") {
550 }
551}
552
553if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400554 executable("skslc") {
555 defines = [ "SKSL_STANDALONE" ]
556 sources = [
557 "src/sksl/SkSLMain.cpp",
558 ]
559 sources += skia_sksl_sources
560 include_dirs = [
561 "src/gpu",
562 "src/sksl",
563 ]
564 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500565 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400566 "//third_party/spirv-tools",
567 ]
568 }
569
570 skia_gpu_processor_outputs = []
571 foreach(src, skia_gpu_processor_sources) {
572 dir = get_path_info(src, "dir")
573 name = get_path_info(src, "name")
574
575 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
576 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
577 skia_gpu_processor_outputs += [
578 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
579 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
580 # confused due to the same file being named by two different paths
581 ]
582 }
583
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500584 action("create_sksl_enums") {
585 script = "gn/create_sksl_enums.py"
586 sources = [
587 "include/private/GrSharedEnums.h",
588 ]
589 outputs = [
590 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500591 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500592 ]
593 args = [
594 rebase_path(sources[0]),
595 rebase_path(outputs[0]),
596 ]
597 }
598
Ethan Nicholas762466e2017-06-29 10:03:38 -0400599 action("compile_processors") {
600 script = "gn/compile_processors.py"
601 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500602 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400603 ":skslc(//gn/toolchain:$host_toolchain)",
604 ]
605 sources = skia_gpu_processor_sources
606 outputs = skia_gpu_processor_outputs
607 skslc_path = "$root_out_dir/"
608 if (host_toolchain != default_toolchain_name) {
609 skslc_path += "$host_toolchain/"
610 }
611 skslc_path += "skslc"
612 if (host_os == "win") {
613 skslc_path += ".exe"
614 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400615 args = [
616 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400617 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400618 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400619 args += rebase_path(skia_gpu_processor_sources)
620 }
621} else {
622 skia_gpu_processor_outputs = []
623 group("compile_processors") {
624 }
625}
626
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500627optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700628 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400629 deps = [
630 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700631 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400632 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700633 if (skia_generate_workarounds) {
634 deps += [ ":workaround_list" ]
635 }
mtkleine9fb3d52016-09-20 15:11:46 -0700636 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600637 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400638 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700639
Brian Salomon3d6801e2017-12-11 10:06:31 -0500640 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400641 if (!skia_enable_ccpr) {
642 sources -= skia_ccpr_sources
643 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
644 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400645 if (!skia_enable_nvpr) {
646 sources -= skia_nvpr_sources
647 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
648 }
mtklein06c35c02016-09-20 12:28:12 -0700649
650 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500651 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700652 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400653 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700654 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400655 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400656
657 # this lib is required to link against AHardwareBuffer
658 if (defined(ndk_api) && ndk_api >= 26) {
659 libs += [ "android" ]
660 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400661 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500662 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400663 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700664 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500665 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400666 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700667 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500668 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800669 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500670 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400671 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500672 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500673 if (target_cpu != "arm64") {
674 libs += [ "OpenGL32.lib" ]
675 }
mtklein06c35c02016-09-20 12:28:12 -0700676 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500677 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700678 }
mtkleine9fb3d52016-09-20 15:11:46 -0700679
680 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400681 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400682 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700683 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700684 if (skia_enable_vulkan_debug_layers) {
685 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
686 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800687 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500688 public_deps +=
689 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800690 }
mtkleine9fb3d52016-09-20 15:11:46 -0700691 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400692
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400693 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400694 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400695 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
696 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400697
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400698 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400699 if (skia_use_metal) {
700 public_defines += [ "SK_METAL" ]
701 sources += skia_metal_sources
702 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400703 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400704 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400705 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500706
707 if (skia_enable_atlas_text) {
708 sources += skia_atlas_text_sources
709 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400710
711 if (is_debug) {
712 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
713 }
mtklein06c35c02016-09-20 12:28:12 -0700714}
715
Leon Scroggins III41169202019-01-29 09:29:57 -0500716optional("gif") {
717 enabled = !skia_use_wuffs
718 sources = [
719 "src/codec/SkGifCodec.cpp",
720 "third_party/gif/SkGifImageReader.cpp",
721 ]
722}
723
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400724optional("heif") {
725 enabled = skia_use_libheif
726 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
727
728 deps = []
729
730 sources = [
731 "src/codec/SkHeifCodec.cpp",
732 ]
733}
734
mtklein63213812016-08-24 09:55:56 -0700735optional("jpeg") {
736 enabled = skia_use_libjpeg_turbo
737 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
738
mtklein63213812016-08-24 09:55:56 -0700739 deps = [
740 "//third_party/libjpeg-turbo:libjpeg",
741 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400742 public = [
743 "include/encode/SkJpegEncoder.h",
744 ]
mtklein63213812016-08-24 09:55:56 -0700745 sources = [
746 "src/codec/SkJpegCodec.cpp",
747 "src/codec/SkJpegDecoderMgr.cpp",
748 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700749 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400750 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700751 ]
752}
753
754optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500755 enabled = skia_use_zlib && skia_enable_pdf
756 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700757
mtklein63213812016-08-24 09:55:56 -0700758 deps = [
759 "//third_party/zlib",
760 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400761 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700762 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400763 }
brettwb9447282016-09-01 14:24:39 -0700764 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700765 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500766 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
767 deps += [ "//third_party/harfbuzz" ]
768 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
769 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700770 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500771 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700772 }
773}
774
775optional("png") {
776 enabled = skia_use_libpng
777 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
778
mtklein63213812016-08-24 09:55:56 -0700779 deps = [
780 "//third_party/libpng",
781 ]
782 sources = [
783 "src/codec/SkIcoCodec.cpp",
784 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400785 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700786 ]
787}
788
scroggof84ad642016-10-31 09:02:57 -0700789optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400790 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700791 public_defines = [ "SK_CODEC_DECODES_RAW" ]
792
793 deps = [
794 "//third_party/dng_sdk",
795 "//third_party/libjpeg-turbo:libjpeg",
796 "//third_party/piex",
797 ]
798
799 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
800 # Skia.
801 configs_to_remove = [ "//gn:no_exceptions" ]
802
803 sources = [
scroggof84ad642016-10-31 09:02:57 -0700804 "src/codec/SkRawCodec.cpp",
805 ]
806}
807
Mike Klein852a8cb2018-05-15 10:46:58 -0400808import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400809source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400810 cflags = []
811 if (!is_win || is_clang) {
812 cflags += [
813 "-w",
814 "-std=c11",
815 ]
816 }
817
818 public = [
819 "third_party/skcms/skcms.h",
820 ]
821 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
822}
823
mtklein3cc22182016-08-29 13:26:14 -0700824optional("typeface_freetype") {
825 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700826
827 deps = [
828 "//third_party/freetype2",
829 ]
830 sources = [
831 "src/ports/SkFontHost_FreeType.cpp",
832 "src/ports/SkFontHost_FreeType_common.cpp",
833 ]
834}
835
mtklein457b42a2016-08-23 13:56:37 -0700836optional("webp") {
837 enabled = skia_use_libwebp
838 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
839
mtklein457b42a2016-08-23 13:56:37 -0700840 deps = [
841 "//third_party/libwebp",
842 ]
843 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700844 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400845 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700846 ]
mtkleineb3c4252016-08-23 07:38:09 -0700847}
848
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400849optional("wuffs") {
850 enabled = skia_use_wuffs
851 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
852
853 deps = [
854 "//third_party/wuffs",
855 ]
856 sources = [
857 "src/codec/SkWuffsCodec.cpp",
858 ]
859}
860
mtklein63213812016-08-24 09:55:56 -0700861optional("xml") {
862 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000863 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700864
mtklein63213812016-08-24 09:55:56 -0700865 deps = [
866 "//third_party/expat",
867 ]
868 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500869 "src/svg/SkSVGCanvas.cpp",
870 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700871 "src/xml/SkDOM.cpp",
872 "src/xml/SkXMLParser.cpp",
873 "src/xml/SkXMLWriter.cpp",
874 ]
875}
876
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700877if (skia_enable_gpu && skia_generate_workarounds) {
878 action("workaround_list") {
879 script = "tools/build_workaround_header.py"
880
881 inputs = [
882 "src/gpu/gpu_workaround_list.txt",
883 ]
884
885 # see comments in skia_compile_processors about out dir path shenanigans.
886 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700887 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700888
889 outputs = [
890 "$root_out_dir/$output_file",
891 ]
892 args = [
893 "--output-file",
894 "$output_file",
895 ]
896
897 foreach(file, inputs) {
898 args += [ rebase_path(file, root_build_dir) ]
899 }
900 }
901}
902
mtkleinc04ff472016-06-23 10:29:30 -0700903component("skia") {
904 public_configs = [ ":skia_public" ]
905 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700906
Mike Klein607b0a72018-11-07 16:17:34 -0500907 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500908 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500909 ":pdf",
910 ":skcms",
911 ]
912
mtkleinc04ff472016-06-23 10:29:30 -0700913 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700914 ":arm64",
915 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700916 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000917 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700918 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700919 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700920 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500921 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500922 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700923 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800924 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500925 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500926 ":fontmgr_win",
927 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500928 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400929 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500930 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700931 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700932 ":none",
mtklein63213812016-08-24 09:55:56 -0700933 ":png",
scroggof84ad642016-10-31 09:02:57 -0700934 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700935 ":sse2",
936 ":sse41",
937 ":sse42",
938 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700939 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400940 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700941 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700942 ]
943
Kevin Lubick134be1d2018-10-30 15:05:04 -0400944 if (skia_enable_nima) {
945 deps += [ "//third_party/Nima-Cpp" ]
946 }
947
Chinmay Garde43f115c2016-11-16 15:04:12 -0800948 # This file (and all GN files in Skia) are designed to work with an
949 # empty sources assignment filter; we handle all that explicitly.
950 # We clear the filter here for clients who may have set up a global filter.
951 set_sources_assignment_filter([])
952
Hal Canaryc25f4e92019-02-26 11:54:25 -0500953 public = skia_core_public
954 public += skia_utils_public
955 public += skia_effects_public
956 public += skia_effects_imagefilter_public
957 public += skia_xps_public
958
mtkleinc04ff472016-06-23 10:29:30 -0700959 sources = []
brettwb9447282016-09-01 14:24:39 -0700960 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700961 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500962 if (skia_use_xps) {
963 sources += skia_xps_sources
964 }
Mike Klein54378232018-11-08 12:08:05 +0000965 sources += skia_effects_sources
966 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700967 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400968 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500969 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700970 "src/android/SkBitmapRegionCodec.cpp",
971 "src/android/SkBitmapRegionDecoder.cpp",
972 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100973 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400974 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700975 "src/codec/SkBmpCodec.cpp",
976 "src/codec/SkBmpMaskCodec.cpp",
977 "src/codec/SkBmpRLECodec.cpp",
978 "src/codec/SkBmpStandardCodec.cpp",
979 "src/codec/SkCodec.cpp",
980 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400981 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400982 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700983 "src/codec/SkMaskSwizzler.cpp",
984 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700985 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700986 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700987 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700988 "src/codec/SkSwizzler.cpp",
989 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700990 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700991 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000992 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700993 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700994 "src/ports/SkMemory_malloc.cpp",
995 "src/ports/SkOSFile_stdio.cpp",
996 "src/sfnt/SkOTTable_name.cpp",
997 "src/sfnt/SkOTUtils.cpp",
998 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500999 "third_party/etc1/etc1.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001000 ]
brettwb9447282016-09-01 14:24:39 -07001001
Kevin Lubick32dfdbe2018-10-18 09:47:01 -04001002 defines = []
1003 if (!skia_enable_skpicture) {
1004 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -05001005 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -04001006 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +00001007 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -04001008 sources += [ "src/core/SkPicture_none.cpp" ]
1009 }
1010
mtklein7d6fb2c2016-08-25 14:50:44 -07001011 libs = []
1012
mtkleinc04ff472016-06-23 10:29:30 -07001013 if (is_win) {
1014 sources += [
1015 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001016 "src/ports/SkImageEncoder_WIC.cpp",
1017 "src/ports/SkImageGeneratorWIC.cpp",
1018 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001019 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001020 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001021 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001022 libs += [
1023 "FontSub.lib",
1024 "Ole32.lib",
1025 "OleAut32.lib",
1026 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001027 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001028 ]
mtkleinc04ff472016-06-23 10:29:30 -07001029 } else {
1030 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001031 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001032 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001033 "src/ports/SkTLS_pthread.cpp",
1034 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001035 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001036 }
1037
mtklein7d6fb2c2016-08-25 14:50:44 -07001038 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001039 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001040 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001041 deps += [ "//third_party/cpu-features" ]
1042 }
mtklein06c35c02016-09-20 12:28:12 -07001043 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001044 libs += [
1045 "EGL",
1046 "GLESv2",
1047 "log",
1048 ]
1049 }
1050
Kevin Lubick217056c2018-09-20 17:39:31 -04001051 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001052 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001053 if (skia_use_egl) {
1054 libs += [ "GLESv2" ]
1055 }
mtkleinc04ff472016-06-23 10:29:30 -07001056 }
1057
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001058 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001059 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001060 }
1061
mtkleinc04ff472016-06-23 10:29:30 -07001062 if (is_mac) {
1063 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001064 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001065 "src/ports/SkImageEncoder_CG.cpp",
1066 "src/ports/SkImageGeneratorCG.cpp",
1067 ]
mtklein09e61f72016-08-23 13:35:28 -07001068 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001069 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1070 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001071 "ApplicationServices.framework",
1072 "OpenGL.framework",
1073 ]
mtkleinc04ff472016-06-23 10:29:30 -07001074 }
abarth6fc8ff02016-07-15 15:15:15 -07001075
Mike Klein7d302882016-11-03 14:06:31 -04001076 if (is_ios) {
1077 sources += [
1078 "src/ports/SkDebug_stdio.cpp",
1079 "src/ports/SkFontHost_mac.cpp",
1080 "src/ports/SkImageEncoder_CG.cpp",
1081 "src/ports/SkImageGeneratorCG.cpp",
1082 ]
1083 libs += [
1084 "CoreFoundation.framework",
1085 "CoreGraphics.framework",
1086 "CoreText.framework",
1087 "ImageIO.framework",
1088 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001089
1090 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1091 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001092 ]
1093 }
1094
abarth6fc8ff02016-07-15 15:15:15 -07001095 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001096 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001097 }
mtkleinc04ff472016-06-23 10:29:30 -07001098}
1099
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001100# DebugCanvas used in experimental/wasm-skp-debugger
1101if (target_cpu == "wasm") {
1102 static_library("debugcanvas") {
1103 public_configs = [ ":skia_public" ]
1104
1105 include_dirs = [
1106 "include/gpu",
1107 "include/private",
1108 "src/gpu",
1109 "src/core",
1110 "src/shaders",
1111 "src/utils",
1112 "tools",
1113 "tools/debugger",
1114 ]
1115
1116 sources = [
1117 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001118 "tools/debugger/DebugCanvas.cpp",
1119 "tools/debugger/DrawCommand.cpp",
1120 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001121 ]
1122
1123 deps = [
1124 ":fontmgr_wasm",
1125 ]
1126 }
1127}
1128
Kevin Lubickcbcff382018-10-02 09:02:18 -04001129static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001130 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001131 public_configs = [ ":skia_public" ]
1132 configs += skia_library_configs
1133
1134 deps = [
1135 ":arm64",
1136 ":armv7",
1137 ":avx",
1138 ":crc32",
1139 ":hsw",
1140 ":none",
1141 ":sse2",
1142 ":sse41",
1143 ":sse42",
1144 ":ssse3",
1145 ]
1146
1147 # This file (and all GN files in Skia) are designed to work with an
1148 # empty sources assignment filter; we handle all that explicitly.
1149 # We clear the filter here for clients who may have set up a global filter.
1150 set_sources_assignment_filter([])
1151
1152 sources = []
1153 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001154 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001155 sources += [
1156 "src/core/SkAnalyticEdge.cpp",
1157 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001158 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001159 "src/core/SkCubicMap.cpp",
1160 "src/core/SkEdge.cpp",
1161 "src/core/SkEdgeBuilder.cpp",
1162 "src/core/SkEdgeClipper.cpp",
1163 "src/core/SkGeometry.cpp",
1164 "src/core/SkLineClipper.cpp",
1165 "src/core/SkMallocPixelRef.cpp",
1166 "src/core/SkMath.cpp",
1167 "src/core/SkMatrix.cpp",
1168 "src/core/SkOpts.cpp",
1169 "src/core/SkPaint.cpp",
1170 "src/core/SkPath.cpp",
1171 "src/core/SkPathEffect.cpp",
1172 "src/core/SkPathMeasure.cpp",
1173 "src/core/SkPathRef.cpp",
1174 "src/core/SkPoint.cpp",
1175 "src/core/SkRRect.cpp",
1176 "src/core/SkRect.cpp",
1177 "src/core/SkSemaphore.cpp",
1178 "src/core/SkStream.cpp",
1179 "src/core/SkString.cpp",
1180 "src/core/SkStringUtils.cpp",
1181 "src/core/SkStroke.cpp",
1182 "src/core/SkStrokeRec.cpp",
1183 "src/core/SkStrokerPriv.cpp",
1184 "src/core/SkThreadID.cpp",
1185 "src/core/SkUtils.cpp",
1186 "src/effects/SkDashPathEffect.cpp",
1187 "src/effects/SkTrimPathEffect.cpp",
1188 "src/ports/SkDebug_stdio.cpp",
1189 "src/ports/SkMemory_malloc.cpp",
1190 "src/utils/SkDashPath.cpp",
1191 "src/utils/SkParse.cpp",
1192 "src/utils/SkParsePath.cpp",
1193 "src/utils/SkUTF.cpp",
1194 ]
1195}
1196
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001197group("modules") {
1198 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001199 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001200 "modules/skottie",
1201 "modules/skshaper",
1202 ]
1203}
1204
mtkleinc095df52016-08-24 12:23:52 -07001205# Targets guarded by skia_enable_tools may use //third_party freely.
1206if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001207 # Used by gn_to_bp.py to list our public include dirs.
1208 source_set("public") {
1209 configs += [ ":skia_public" ]
1210 }
1211
Mike Kleinc36dedf2016-11-18 09:35:28 -05001212 config("skia.h_config") {
1213 include_dirs = [ "$target_gen_dir" ]
1214 }
1215 action("skia.h") {
1216 public_configs = [ ":skia.h_config" ]
1217 skia_h = "$target_gen_dir/skia.h"
1218 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001219
1220 # TODO: would be cool to not hard-code these here, but how?
1221 module_public_includes = [
1222 "modules/sksg/include",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001223 "modules/skshaper/include",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001224 "modules/skottie/include",
1225 ]
1226 args =
1227 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1228 [ rebase_path(skia_h, root_build_dir) ] +
1229 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001230 depfile = "$skia_h.deps"
1231 outputs = [
1232 skia_h,
1233 ]
1234 }
1235
Brian Osmanc9a42472018-05-31 13:17:12 -04001236 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001237 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001238 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001239 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001240 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001241 "tools/fiddle/draw.cpp",
1242 "tools/fiddle/fiddle_main.cpp",
1243 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001244
1245 if (skia_use_egl) {
1246 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001247 } else {
1248 sources += [ "tools/fiddle/null_context.cpp" ]
1249 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001250 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001251 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001252 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001253 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001254 ":skia",
1255 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001256 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001257 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001258 ]
1259 }
1260 }
1261
Brian Osmanc9a42472018-05-31 13:17:12 -04001262 source_set("public_headers_warnings_check") {
1263 sources = [
1264 "tools/public_headers_warnings_check.cpp",
1265 ]
1266 configs -= [ "//gn:warnings_except_public_headers" ]
1267 deps = [
1268 ":skia",
1269 ":skia.h",
1270 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001271 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001272 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001273
1274 # We add this directory to simulate the client already have
1275 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001276 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001277 }
1278
mtkleinc095df52016-08-24 12:23:52 -07001279 template("test_lib") {
1280 config(target_name + "_config") {
1281 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001282 if (defined(invoker.public_defines)) {
1283 defines = invoker.public_defines
1284 }
mtklein25c81d42016-07-27 13:55:26 -07001285 }
mtkleinc095df52016-08-24 12:23:52 -07001286 source_set(target_name) {
1287 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001288 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001289 public_configs = [
1290 ":" + target_name + "_config",
1291 ":skia_private",
1292 ]
1293
1294 if (!defined(deps)) {
1295 deps = []
1296 }
1297 deps += [ ":skia" ]
1298 testonly = true
1299 }
mtklein25c81d42016-07-27 13:55:26 -07001300 }
mtklein25c81d42016-07-27 13:55:26 -07001301
Mike Kleine6682eb2017-01-05 10:54:57 -05001302 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001303 if (is_ios) {
1304 app_name = target_name
1305 gen_path = target_gen_dir
1306
1307 action("${app_name}_generate_info_plist") {
1308 script = "//gn/gen_plist_ios.py"
1309 outputs = [
1310 "$gen_path/${app_name}_Info.plist",
1311 ]
1312 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1313 }
1314
1315 bundle_data("${app_name}_bundle_info_plist") {
1316 public_deps = [
1317 ":${app_name}_generate_info_plist",
1318 ]
1319 sources = [
1320 "$gen_path/${app_name}_Info.plist",
1321 ]
1322 outputs = [
1323 "{{bundle_root_dir}}/Info.plist",
1324 ]
1325 }
1326
Jim Van Verthffacf652019-04-02 11:59:34 -04001327 has_skps = "True" == exec_script("//gn/checkdir.py",
1328 [ rebase_path("skps", root_build_dir) ],
1329 "trim string")
1330 bundle_data("${app_name}_bundle_resources") {
1331 sources = [
1332 "resources",
1333 ]
1334 outputs = [
1335 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1336 "{{bundle_resources_dir}}/data/resources",
1337 ]
1338 }
1339 if (has_skps) {
1340 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001341 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001342 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001343 ]
1344 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001345 # Store in same folder as resources
1346 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001347 ]
1348 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001349 }
1350
Jim Van Verth443a9132017-11-28 09:45:26 -05001351 executable("${app_name}_generate_executable") {
1352 forward_variables_from(invoker,
1353 "*",
1354 [
1355 "output_name",
1356 "visibility",
1357 "is_shared_library",
1358 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001359 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001360 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001361 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1362 }
1363
1364 bundle_data("${app_name}_bundle_executable") {
1365 public_deps = [
1366 ":${app_name}_generate_executable",
1367 ]
1368 sources = [
1369 "$gen_path/$app_name",
1370 ]
1371 outputs = [
1372 "{{bundle_executable_dir}}/$app_name",
1373 ]
1374 testonly = true
1375 }
1376
Jim Van Verthffacf652019-04-02 11:59:34 -04001377 bundle_data("${app_name}_bundle_symbols") {
1378 public_deps = [
1379 ":${app_name}_generate_executable",
1380 ]
1381 sources = [
1382 "$gen_path/${app_name}.dSYM",
1383 ]
1384 outputs = [
1385 "{{bundle_executable_dir}}/${app_name}.dSYM",
1386 ]
1387 testonly = true
1388 }
1389
Jim Van Verth443a9132017-11-28 09:45:26 -05001390 create_bundle("$app_name") {
1391 product_type = "com.apple.product-type.application"
1392 testonly = true
1393
1394 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1395 bundle_resources_dir = bundle_root_dir
1396 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001397
1398 deps = [
1399 ":${app_name}_bundle_executable",
1400 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001401 ":${app_name}_bundle_resources",
1402 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001403 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001404 if (has_skps) {
1405 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001406 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001407
1408 # should only code sign when running on a device, not the simulator
1409 if (target_cpu != "x64") {
1410 code_signing_script = "//gn/codesign_ios.py"
1411 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1412 code_signing_outputs = [
1413 "$bundle_root_dir/_CodeSignature/CodeResources",
1414 "$bundle_root_dir/embedded.mobileprovision",
1415 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001416 code_signing_args = [
1417 rebase_path("$bundle_root_dir", root_build_dir),
1418 skia_ios_identity,
1419 skia_ios_profile,
1420 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001421 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001422 }
1423 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001424 # !is_ios
1425
1426 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1427 shared_library("lib" + target_name) {
1428 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1429 configs += [ ":skia_private" ]
1430 testonly = true
1431 }
1432 } else {
1433 _executable = target_name
1434 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001435 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001436 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1437 configs += [ ":skia_private" ]
1438 testonly = true
1439 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001440 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001441 if (is_android && skia_android_serial != "" && defined(_executable)) {
1442 action("push_" + target_name) {
1443 script = "gn/push_to_android.py"
1444 deps = [
1445 ":" + _executable,
1446 ]
1447 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1448 outputs = [
1449 _stamp,
1450 ]
1451 args = [
1452 rebase_path("$root_build_dir/$_executable"),
1453 skia_android_serial,
1454 rebase_path(_stamp),
1455 ]
1456 testonly = true
1457 }
Mike Klein7d921032017-01-05 12:20:41 -05001458 }
1459 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001460 }
1461
Greg Danielda16cce2018-08-01 09:23:57 -04001462 config("moltenvk_config") {
1463 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1464 if (is_ios) {
1465 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1466 } else {
1467 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1468 }
1469 cflags = [ "-F$moltenvk_framework_path" ]
1470 ldflags = [ "-F$moltenvk_framework_path" ]
1471 libs = [
1472 "MoltenVK.framework",
1473 "Metal.framework",
1474 "IOSurface.framework",
1475 "QuartzCore.framework",
1476 "Foundation.framework",
1477 ]
1478 if (is_ios) {
1479 libs += [ "UIKit.framework" ]
1480 } else {
1481 libs += [ "IOKit.framework" ]
1482 }
1483 defines = [ "SK_MOLTENVK" ]
1484 }
1485 }
1486
1487 source_set("moltenvk") {
1488 public_configs = [ ":moltenvk_config" ]
1489 }
1490
mtkleinc095df52016-08-24 12:23:52 -07001491 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001492 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001493 public_defines = []
1494 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001495
Brian Osmanc9a42472018-05-31 13:17:12 -04001496 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001497 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001498 sources = [
1499 "tools/gpu/GrContextFactory.cpp",
1500 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001501 "tools/gpu/MemoryCache.cpp",
1502 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001503 "tools/gpu/ProxyUtils.cpp",
1504 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001505 "tools/gpu/YUVUtils.cpp",
1506 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001507 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1508 "tools/gpu/gl/GLTestContext.cpp",
1509 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001510 "tools/gpu/mock/MockTestContext.cpp",
1511 ]
1512 libs = []
1513
1514 if (is_android || skia_use_egl) {
1515 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1516 } else if (is_ios) {
1517 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1518 libs += [ "OpenGLES.framework" ]
1519 } else if (is_linux) {
1520 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001521 libs += [
1522 "GLU",
1523 "X11",
1524 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001525 } else if (is_mac) {
1526 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1527 } else if (is_win) {
1528 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001529 libs += [ "Gdi32.lib" ]
1530 if (target_cpu != "arm64") {
1531 libs += [ "OpenGL32.lib" ]
1532 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001533 }
mtklein25c81d42016-07-27 13:55:26 -07001534
Brian Osmanc9a42472018-05-31 13:17:12 -04001535 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001536
Brian Osmanc9a42472018-05-31 13:17:12 -04001537 if (skia_use_angle) {
1538 deps += [ "//third_party/angle2" ]
1539 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1540 }
Greg Daniel54200e42018-12-11 17:03:39 -05001541
Greg Daniel487132b2018-12-20 14:09:36 -05001542 public_include_dirs += [ "include/third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001543 if (skia_use_vulkan) {
1544 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1545 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001546 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1547 public_deps += [ ":moltenvk" ]
1548 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001549 }
1550 if (skia_use_metal) {
1551 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001552 }
mtklein25c81d42016-07-27 13:55:26 -07001553 }
mtklein25c81d42016-07-27 13:55:26 -07001554
mtkleinc095df52016-08-24 12:23:52 -07001555 test_lib("flags") {
1556 public_include_dirs = [ "tools/flags" ]
1557 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001558 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001559 ]
1560 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001561
1562 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001563 public_include_dirs = [ "tools/flags" ]
1564 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001565 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001566 ]
1567 deps = [
mtklein046cb562016-09-16 10:23:12 -07001568 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001569 ]
1570 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001571 ":gpu_tool_utils",
1572 ]
1573 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001574 test_lib("common_flags_gpu") {
1575 public_include_dirs = [ "tools/flags" ]
1576 sources = [
1577 "tools/flags/CommonFlagsGpu.cpp",
1578 ]
1579 deps = [
1580 ":flags",
1581 ]
1582 public_deps = [
1583 ":gpu_tool_utils",
1584 ]
1585 }
1586 test_lib("common_flags_images") {
1587 public_include_dirs = [ "tools/flags" ]
1588 sources = [
1589 "tools/flags/CommonFlagsImages.cpp",
1590 ]
1591 deps = [
1592 ":flags",
1593 ]
1594 }
1595 test_lib("common_flags_aa") {
1596 public_include_dirs = [ "tools/flags" ]
1597 sources = [
1598 "tools/flags/CommonFlagsAA.cpp",
1599 ]
1600 deps = [
1601 ":flags",
1602 ]
1603 }
mtklein25c81d42016-07-27 13:55:26 -07001604
Mike Klein499f0ac2019-03-25 13:00:12 -05001605 test_lib("trace") {
1606 public_include_dirs = [ "tools/trace" ]
1607 deps = [
1608 ":flags",
1609 ]
1610 sources = [
1611 "tools/trace/ChromeTracingTracer.cpp",
1612 "tools/trace/ChromeTracingTracer.h",
1613 "tools/trace/EventTracingPriv.cpp",
1614 "tools/trace/EventTracingPriv.h",
1615 "tools/trace/SkDebugfTracer.cpp",
1616 "tools/trace/SkDebugfTracer.h",
1617 ]
1618 }
1619
mtkleinc095df52016-08-24 12:23:52 -07001620 test_lib("tool_utils") {
1621 public_include_dirs = [
1622 "tools",
1623 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001624 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001625 "tools/timer",
1626 ]
1627 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001628 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001629 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001630 "tools/DDLPromiseImageHelper.cpp",
1631 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001632 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001633 "tools/ProcStats.cpp",
1634 "tools/Resources.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001635 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001636 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001637 "tools/debugger/DebugCanvas.cpp",
1638 "tools/debugger/DrawCommand.cpp",
1639 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001640 "tools/fonts/RandomScalerContext.cpp",
1641 "tools/fonts/TestEmptyTypeface.h",
1642 "tools/fonts/TestFontMgr.cpp",
1643 "tools/fonts/TestFontMgr.h",
1644 "tools/fonts/TestSVGTypeface.cpp",
1645 "tools/fonts/TestSVGTypeface.h",
1646 "tools/fonts/TestTypeface.cpp",
1647 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001648 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001649 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001650 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001651 "tools/timer/Timer.cpp",
1652 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001653 libs = []
1654 if (is_ios) {
1655 sources += [ "tools/ios_utils.m" ]
1656 libs += [ "Foundation.framework" ]
1657 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001658 defines = []
1659 if (skia_tools_require_resources) {
1660 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1661 }
mtkleinc095df52016-08-24 12:23:52 -07001662 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001663 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001664 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001665 ]
1666 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001667 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001668 ]
mtkleinc095df52016-08-24 12:23:52 -07001669 }
mtklein25c81d42016-07-27 13:55:26 -07001670
Mike Klein6e744122016-10-27 12:21:40 -04001671 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001672 test_lib("gm") {
1673 public_include_dirs = [ "gm" ]
1674 sources = gm_sources
1675 deps = [
scroggo19b91532016-10-24 09:03:26 -07001676 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001677 ":skia",
1678 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001679 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001680 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001681 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001682 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001683 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001684 public_deps = [
1685 ":gpu_tool_utils",
1686 ]
mtkleinc095df52016-08-24 12:23:52 -07001687 }
mtklein25c81d42016-07-27 13:55:26 -07001688
Mike Klein6e744122016-10-27 12:21:40 -04001689 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001690 test_lib("tests") {
1691 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001692 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001693 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001694 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001695 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001696 if (!(skia_use_freetype && skia_use_fontconfig)) {
1697 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1698 }
mtkleinc095df52016-08-24 12:23:52 -07001699 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001700 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001701 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001702 ":skia",
1703 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001704 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001705 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001706 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001707 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001708 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001709 "//third_party/zlib",
1710 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001711 public_deps = [
1712 ":gpu_tool_utils", # Test.h #includes headers from this target.
1713 ]
mtkleinc095df52016-08-24 12:23:52 -07001714 }
mtklein2f3416d2016-08-02 16:02:05 -07001715
Mike Klein6e744122016-10-27 12:21:40 -04001716 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001717 test_lib("bench") {
1718 public_include_dirs = [ "bench" ]
1719 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001720 deps = [
1721 ":flags",
1722 ":gm",
1723 ":gpu_tool_utils",
1724 ":skia",
1725 ":tool_utils",
1726 ]
1727 }
mtklein2b6870c2016-07-28 14:17:33 -07001728
mtkleinc095df52016-08-24 12:23:52 -07001729 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001730 public_include_dirs = []
1731 if (skia_use_expat) {
1732 public_include_dirs += [ "experimental/svg/model" ]
1733 sources = [
1734 "experimental/svg/model/SkSVGAttribute.cpp",
1735 "experimental/svg/model/SkSVGAttributeParser.cpp",
1736 "experimental/svg/model/SkSVGCircle.cpp",
1737 "experimental/svg/model/SkSVGClipPath.cpp",
1738 "experimental/svg/model/SkSVGContainer.cpp",
1739 "experimental/svg/model/SkSVGDOM.cpp",
1740 "experimental/svg/model/SkSVGEllipse.cpp",
1741 "experimental/svg/model/SkSVGGradient.cpp",
1742 "experimental/svg/model/SkSVGLine.cpp",
1743 "experimental/svg/model/SkSVGLinearGradient.cpp",
1744 "experimental/svg/model/SkSVGNode.cpp",
1745 "experimental/svg/model/SkSVGPath.cpp",
1746 "experimental/svg/model/SkSVGPattern.cpp",
1747 "experimental/svg/model/SkSVGPoly.cpp",
1748 "experimental/svg/model/SkSVGRadialGradient.cpp",
1749 "experimental/svg/model/SkSVGRect.cpp",
1750 "experimental/svg/model/SkSVGRenderContext.cpp",
1751 "experimental/svg/model/SkSVGSVG.cpp",
1752 "experimental/svg/model/SkSVGShape.cpp",
1753 "experimental/svg/model/SkSVGStop.cpp",
1754 "experimental/svg/model/SkSVGTransformableNode.cpp",
1755 "experimental/svg/model/SkSVGUse.cpp",
1756 "experimental/svg/model/SkSVGValue.cpp",
1757 ]
1758 deps = [
1759 ":skia",
1760 ":xml",
1761 ]
1762 }
mtkleinc095df52016-08-24 12:23:52 -07001763 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001764
Mike Klein38af9432016-11-11 11:39:44 -05001765 if (skia_use_lua) {
1766 test_lib("lua") {
1767 public_include_dirs = []
1768 sources = [
1769 "src/utils/SkLua.cpp",
1770 "src/utils/SkLuaCanvas.cpp",
1771 ]
1772 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001773 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001774 "//third_party/lua",
1775 ]
1776 }
1777
Mike Kleine6682eb2017-01-05 10:54:57 -05001778 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001779 sources = [
1780 "tools/lua/lua_app.cpp",
1781 ]
1782 deps = [
1783 ":lua",
1784 ":skia",
1785 "//third_party/lua",
1786 ]
Mike Klein38af9432016-11-11 11:39:44 -05001787 }
1788
Mike Kleine6682eb2017-01-05 10:54:57 -05001789 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001790 sources = [
1791 "tools/lua/lua_pictures.cpp",
1792 ]
1793 deps = [
1794 ":flags",
1795 ":lua",
1796 ":skia",
1797 ":tool_utils",
1798 "//third_party/lua",
1799 ]
Mike Klein38af9432016-11-11 11:39:44 -05001800 }
1801 }
1802
Florin Malitabfe876a2018-09-02 12:33:59 -04001803 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001804 test_app("skottie_tool") {
1805 deps = [
1806 "modules/skottie:tool",
1807 ]
1808 }
1809 }
1810
Kevin Lubickebf648e2017-09-21 13:45:16 -04001811 if (target_cpu != "wasm") {
1812 import("gn/samples.gni")
1813 test_lib("samples") {
1814 public_include_dirs = [ "samplecode" ]
1815 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001816 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001817 public_deps = [
1818 ":tool_utils",
1819 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001820 deps = [
1821 ":experimental_svg_model",
1822 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001823 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001824 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001825 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001826 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001827 ]
Mike Klein38af9432016-11-11 11:39:44 -05001828
Ruiqi Maof5101492018-06-29 14:32:21 -04001829 # NIMA does not build on Windows clang
1830 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001831 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001832 deps += [ "//third_party/Nima-Cpp" ]
1833 }
1834
Kevin Lubickebf648e2017-09-21 13:45:16 -04001835 if (skia_use_lua) {
1836 sources += [ "samplecode/SampleLua.cpp" ]
1837 deps += [
1838 ":lua",
1839 "//third_party/lua",
1840 ]
1841 }
1842 }
Mike Klein7af351a2018-07-27 09:54:43 -04001843 test_app("imgcvt") {
1844 sources = [
1845 "tools/imgcvt.cpp",
1846 ]
1847 deps = [
1848 ":skcms",
1849 ":skia",
1850 ]
1851 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001852 test_lib("hash_and_encode") {
1853 public_include_dirs = [ "tools" ]
1854 sources = [
1855 "tools/HashAndEncode.cpp",
1856 "tools/HashAndEncode.h",
1857 ]
1858 deps = [
1859 ":flags",
1860 ":skia",
1861 "//third_party/libpng",
1862 ]
1863 }
1864 test_app("fm") {
1865 sources = [
1866 "tools/fm/fm.cpp",
1867 ]
1868 deps = [
1869 ":common_flags_aa",
1870 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001871 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001872 ":flags",
1873 ":gm",
1874 ":gpu_tool_utils",
1875 ":hash_and_encode",
1876 ":skia",
1877 ":tool_utils",
1878 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001879 "modules/skottie",
1880 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001881 ]
1882 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001883 test_app("dm") {
1884 sources = [
1885 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001886 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001887 "dm/DMJsonWriter.cpp",
1888 "dm/DMSrcSink.cpp",
1889 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001890 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001891 ":common_flags_aa",
1892 ":common_flags_config",
1893 ":common_flags_gpu",
1894 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001895 ":experimental_svg_model",
1896 ":flags",
1897 ":gm",
1898 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001899 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001900 ":skia",
1901 ":tests",
1902 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001903 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001904 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001905 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001906 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001907 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001908
1909 # NIMA does not build on Windows clang
1910 if (!is_win || !is_clang) {
1911 deps += [ "//third_party/Nima-Cpp" ]
1912 }
Mike Klein38af9432016-11-11 11:39:44 -05001913 }
Brian Osman16adfa32016-10-18 14:42:44 -04001914 }
1915
Mike Kleina8a51ce2018-01-09 12:34:11 -05001916 if (!is_win) {
1917 test_app("remote_demo") {
1918 sources = [
1919 "tools/remote_demo.cpp",
1920 ]
1921 deps = [
1922 ":skia",
1923 ]
1924 }
1925 }
1926
Mike Kleine6682eb2017-01-05 10:54:57 -05001927 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001928 sources = [
1929 "bench/nanobench.cpp",
1930 ]
1931 deps = [
1932 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001933 ":common_flags_aa",
1934 ":common_flags_config",
1935 ":common_flags_gpu",
1936 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001937 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001938 ":flags",
1939 ":gm",
1940 ":gpu_tool_utils",
1941 ":skia",
1942 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001943 ":trace",
Florin Malita3b526b02018-05-25 12:43:51 -04001944 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001945 ]
mtklein2b6870c2016-07-28 14:17:33 -07001946 }
halcanary19a97202016-08-03 15:08:04 -07001947
Ravi Mistry10d36c52017-01-31 09:49:18 -05001948 test_app("skpinfo") {
1949 sources = [
1950 "tools/skpinfo.cpp",
1951 ]
1952 deps = [
1953 ":flags",
1954 ":skia",
1955 ]
1956 }
1957
Brian Osmanc9a42472018-05-31 13:17:12 -04001958 test_app("skpbench") {
1959 sources = [
1960 "tools/skpbench/skpbench.cpp",
1961 ]
1962 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001963 ":common_flags_config",
1964 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001965 ":flags",
1966 ":gpu_tool_utils",
1967 ":skia",
1968 ":tool_utils",
1969 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001970 }
1971
Mike Kleine6682eb2017-01-05 10:54:57 -05001972 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001973 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001974 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001975 ]
1976 deps = [
1977 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001978 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001979 ]
halcanary3eee9d92016-09-10 07:01:53 -07001980 }
mtklein046cb562016-09-16 10:23:12 -07001981
Ben Wagner219f3622017-07-17 15:32:25 -04001982 test_app("create_test_font") {
1983 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001984 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001985 ]
1986 deps = [
1987 ":skia",
1988 ]
1989 assert_no_deps = [
1990 # tool_utils requires the output of this app.
1991 ":tool_utils",
1992 ]
1993 }
1994
Florin Malita5d3ff432018-07-31 16:38:43 -04001995 if (skia_use_expat) {
1996 test_app("create_test_font_color") {
1997 sources = [
1998 "tools/fonts/create_test_font_color.cpp",
1999 ]
2000 deps = [
2001 ":flags",
2002 ":skia",
2003 ":tool_utils",
2004 ]
2005 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002006 }
2007
Mike Kleine6682eb2017-01-05 10:54:57 -05002008 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07002009 sources = [
2010 "tools/get_images_from_skps.cpp",
2011 ]
2012 deps = [
2013 ":flags",
2014 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002015 ]
mtklein046cb562016-09-16 10:23:12 -07002016 }
mtkleinecbc5262016-09-22 11:51:24 -07002017
Brian Osman6788a542018-12-10 11:56:01 -05002018 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002019 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002020 sources = [
2021 "tools/skiaserve/Request.cpp",
2022 "tools/skiaserve/Response.cpp",
2023 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002024 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2025 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2026 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2027 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2028 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2029 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2030 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2031 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2032 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002033 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2034 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002035 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2036 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2037 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2038 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2039 ]
2040 deps = [
2041 ":flags",
2042 ":gpu_tool_utils",
2043 ":skia",
2044 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002045 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002046 ]
Mike Klein7d302882016-11-03 14:06:31 -04002047 }
mtkleinecbc5262016-09-22 11:51:24 -07002048 }
kjlubick14f984b2016-10-03 11:49:45 -07002049
Mike Kleine6682eb2017-01-05 10:54:57 -05002050 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002051 include_dirs = [
2052 "tools",
2053 "tools/debugger",
Kevin Lubickec1c6202018-12-14 11:42:53 -05002054 "tools/fonts",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002055 "src/sksl",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002056 ]
kjlubick14f984b2016-10-03 11:49:45 -07002057 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002058 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002059 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002060 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002061 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002062 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002063 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002064 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002065 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002066 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002067 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002068 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002069 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002070 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002071 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2072 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002073 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002074 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002075 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002076 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002077 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2078 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002079 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2080 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002081 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002082 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002083 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002084 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002085 "tools/debugger/DebugCanvas.cpp",
2086 "tools/debugger/DrawCommand.cpp",
2087 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002088 ]
2089 deps = [
2090 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002091 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002092 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002093 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002094 ]
kjlubick14f984b2016-10-03 11:49:45 -07002095 }
Mike Klein38312422016-10-05 15:41:01 -04002096
Mike Kleine6682eb2017-01-05 10:54:57 -05002097 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002098 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002099 rebase_path("tests/skia_test.cpp"),
2100 rebase_path("tests/Test.cpp"),
2101 ]
caryclark9feb6322016-10-25 08:58:26 -07002102 deps = [
2103 ":flags",
2104 ":gpu_tool_utils",
2105 ":skia",
2106 ":tool_utils",
2107 ]
caryclark9feb6322016-10-25 08:58:26 -07002108 }
2109
Mike Kleine6682eb2017-01-05 10:54:57 -05002110 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002111 sources = [
2112 "tools/DumpRecord.cpp",
2113 "tools/dump_record.cpp",
2114 ]
2115 deps = [
2116 ":flags",
2117 ":skia",
2118 ]
Mike Klein38312422016-10-05 15:41:01 -04002119 }
bungemanfe917272016-10-13 17:36:40 -04002120
Mike Kleine6682eb2017-01-05 10:54:57 -05002121 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002122 sources = [
2123 "tools/skdiff/skdiff.cpp",
2124 "tools/skdiff/skdiff_html.cpp",
2125 "tools/skdiff/skdiff_main.cpp",
2126 "tools/skdiff/skdiff_utils.cpp",
2127 ]
2128 deps = [
2129 ":skia",
2130 ":tool_utils",
2131 ]
bungemanfe917272016-10-13 17:36:40 -04002132 }
halcanarya73d76a2016-10-17 13:19:02 -07002133
Mike Kleine6682eb2017-01-05 10:54:57 -05002134 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002135 sources = [
2136 "tools/skp_parser.cpp",
2137 ]
2138 deps = [
2139 ":skia",
2140 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002141 ]
halcanarya73d76a2016-10-17 13:19:02 -07002142 }
Brian Osman16adfa32016-10-18 14:42:44 -04002143
Brian Osmanc9a42472018-05-31 13:17:12 -04002144 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002145 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05002146 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002147 defines =
2148 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002149 sources = [
2150 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002151 "tools/skqp/src/skqp.cpp",
2152 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002153 ]
2154 deps = [
2155 ":gm",
2156 ":gpu_tool_utils",
2157 ":skia",
2158 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002159 ":tool_utils",
2160 ]
2161 }
2162 test_app("skqp") {
2163 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002164 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002165 ]
2166 deps = [
2167 ":skia",
2168 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002169 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002170 ]
2171 }
2172 test_app("jitter_gms") {
2173 sources = [
2174 "tools/skqp/jitter_gms.cpp",
2175 ]
2176 deps = [
2177 ":gm",
2178 ":skia",
2179 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002180 ]
2181 }
2182 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002183 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002184 test_app("skqp_app") {
2185 is_shared_library = true
2186 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002187 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002188 ]
2189 deps = [
2190 ":skia",
2191 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002192 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002193 ]
2194 libs = [ "android" ]
2195 }
2196 }
Stan Iliev93151722018-08-02 11:10:52 -04002197 if (is_android && skia_enable_gpu) {
2198 test_app("skottie_android") {
2199 is_shared_library = true
2200
2201 sources = [
2202 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2203 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2204 ]
2205 libs = []
2206
2207 include_dirs = []
2208 deps = [
2209 ":skia",
2210 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002211 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002212 ]
2213 }
2214 }
Hal Canary75427132017-10-11 16:00:31 -04002215
Hal Canarya9de7602018-01-19 13:08:23 -05002216 test_app("list_gms") {
2217 sources = [
2218 "tools/list_gms.cpp",
2219 ]
2220 deps = [
2221 ":gm",
2222 ":skia",
2223 ]
2224 }
2225 test_app("list_gpu_unit_tests") {
2226 sources = [
2227 "dm/DMGpuTestProcs.cpp",
2228 "tools/list_gpu_unit_tests.cpp",
2229 ]
2230 deps = [
2231 ":skia",
2232 ":tests",
2233 ]
2234 }
2235
Brian Osmanc9a42472018-05-31 13:17:12 -04002236 test_lib("sk_app") {
2237 public_include_dirs = [ "tools/sk_app" ]
2238 sources = [
2239 "tools/sk_app/CommandSet.cpp",
2240 "tools/sk_app/GLWindowContext.cpp",
2241 "tools/sk_app/Window.cpp",
2242 ]
2243 libs = []
2244
2245 if (is_android) {
2246 sources += [
2247 "tools/sk_app/android/GLWindowContext_android.cpp",
2248 "tools/sk_app/android/RasterWindowContext_android.cpp",
2249 "tools/sk_app/android/Window_android.cpp",
2250 "tools/sk_app/android/main_android.cpp",
2251 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002252 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002253 libs += [ "android" ]
2254 } else if (is_linux) {
2255 sources += [
2256 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2257 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2258 "tools/sk_app/unix/Window_unix.cpp",
2259 "tools/sk_app/unix/keysym2ucs.c",
2260 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002261 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002262 libs += [
2263 "GL",
2264 "X11",
2265 ]
2266 } else if (is_win) {
2267 sources += [
2268 "tools/sk_app/win/GLWindowContext_win.cpp",
2269 "tools/sk_app/win/RasterWindowContext_win.cpp",
2270 "tools/sk_app/win/Window_win.cpp",
2271 "tools/sk_app/win/main_win.cpp",
2272 ]
Brian Salomon194db172017-08-17 14:37:06 -04002273 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002274 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002275 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002276 } else if (is_mac) {
2277 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002278 "tools/sk_app/mac/GLWindowContext_mac.mm",
2279 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2280 "tools/sk_app/mac/Window_mac.mm",
2281 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002282 ]
2283 libs += [
2284 "QuartzCore.framework",
2285 "Cocoa.framework",
2286 "Foundation.framework",
2287 ]
2288 } else if (is_ios) {
2289 sources += [
2290 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2291 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2292 "tools/sk_app/ios/Window_ios.cpp",
2293 "tools/sk_app/ios/main_ios.cpp",
2294 ]
2295 }
2296
2297 if (skia_use_vulkan) {
2298 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2299 if (is_android) {
2300 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2301 } else if (is_linux) {
2302 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2303 libs += [ "X11-xcb" ]
2304 } else if (is_win) {
2305 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002306 } else if (is_mac) {
2307 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2308 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002309 }
2310 }
2311
Jim Van Verthbe39f712019-02-08 15:36:14 -05002312 if (skia_use_metal) {
2313 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2314 if (is_mac) {
2315 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2316 }
2317 libs += [ "MetalKit.framework" ]
2318 }
2319
Brian Osmanc9a42472018-05-31 13:17:12 -04002320 deps = [
2321 ":gpu_tool_utils",
2322 ":skia",
2323 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002324 ]
2325 if (is_android) {
2326 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002327 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002328 deps += [ "//third_party/libsdl" ]
2329 }
2330 if (skia_use_angle) {
2331 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002332 }
Brian Osman16adfa32016-10-18 14:42:44 -04002333 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002334
Hal Canary87515122019-03-15 14:22:51 -04002335 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2336 test_app("fiddle_examples") {
2337 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002338 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002339 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002340 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002341 ]
Hal Canary87515122019-03-15 14:22:51 -04002342 include_dirs = [ "tools" ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002343 if (is_win) {
2344 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2345 }
Hal Canary87515122019-03-15 14:22:51 -04002346 deps = [
2347 ":skia",
2348 ":skia.h",
2349 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002350 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002351 ]
2352 }
2353 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002354 test_app("viewer") {
2355 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002356 sources = [
2357 "tools/viewer/BisectSlide.cpp",
2358 "tools/viewer/GMSlide.cpp",
2359 "tools/viewer/ImGuiLayer.cpp",
2360 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002361 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002362 "tools/viewer/SKPSlide.cpp",
2363 "tools/viewer/SampleSlide.cpp",
2364 "tools/viewer/SkottieSlide.cpp",
2365 "tools/viewer/SlideDir.cpp",
2366 "tools/viewer/StatsLayer.cpp",
2367 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002368 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002369 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002370 "tools/viewer/Viewer.cpp",
2371 ]
2372 libs = []
2373
Kevin Lubickd9699322018-10-30 15:08:53 -04002374 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002375 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002376 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002377 ":experimental_svg_model",
2378 ":flags",
2379 ":gm",
2380 ":gpu_tool_utils",
2381 ":samples",
2382 ":sk_app",
2383 ":skia",
2384 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002385 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002386 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002387 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002388 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002389 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002390 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002391 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002392 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002393
2394 # NIMA does not build on Windows clang
2395 if (!is_win || !is_clang) {
2396 sources += [ "tools/viewer/NIMASlide.cpp" ]
2397 deps += [ "//third_party/Nima-Cpp" ]
2398 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002399 }
2400
ziadbbceddbc2018-06-19 13:57:15 -04002401 if (is_android) {
2402 test_app("arcore") {
2403 is_shared_library = true
2404 configs = [
2405 ":skia_public",
2406 "gn:default",
2407 ]
2408
2409 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2410 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
Hal Canaryc25f4e92019-02-26 11:54:25 -05002411 public = skia_core_public
2412 public += skia_utils_public
ziadbbceddbc2018-06-19 13:57:15 -04002413 sources = []
2414 sources += skia_core_sources
2415 sources += skia_utils_sources
2416 sources += skia_xps_sources
2417 sources += [
2418 "src/android/SkAndroidFrameworkUtils.cpp",
2419 "src/android/SkAnimatedImage.cpp",
2420 "src/android/SkBitmapRegionCodec.cpp",
2421 "src/android/SkBitmapRegionDecoder.cpp",
2422 "src/codec/SkAndroidCodec.cpp",
2423 "src/codec/SkBmpBaseCodec.cpp",
2424 "src/codec/SkBmpCodec.cpp",
2425 "src/codec/SkBmpMaskCodec.cpp",
2426 "src/codec/SkBmpRLECodec.cpp",
2427 "src/codec/SkBmpStandardCodec.cpp",
2428 "src/codec/SkCodec.cpp",
2429 "src/codec/SkCodecImageGenerator.cpp",
2430 "src/codec/SkColorTable.cpp",
2431 "src/codec/SkGifCodec.cpp",
2432 "src/codec/SkMaskSwizzler.cpp",
2433 "src/codec/SkMasks.cpp",
2434 "src/codec/SkSampledCodec.cpp",
2435 "src/codec/SkSampler.cpp",
2436 "src/codec/SkStreamBuffer.cpp",
2437 "src/codec/SkSwizzler.cpp",
2438 "src/codec/SkWbmpCodec.cpp",
2439 "src/images/SkImageEncoder.cpp",
2440 "src/ports/SkDiscardableMemory_none.cpp",
2441 "src/ports/SkImageGenerator_skia.cpp",
2442 "src/ports/SkMemory_malloc.cpp",
2443 "src/ports/SkOSFile_stdio.cpp",
2444 "src/sfnt/SkOTTable_name.cpp",
2445 "src/sfnt/SkOTUtils.cpp",
2446 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -05002447 "third_party/etc1/etc1.cpp",
ziadbbceddbc2018-06-19 13:57:15 -04002448 "third_party/gif/SkGifImageReader.cpp",
2449 ]
2450 deps = [
2451 ":tool_utils",
2452 "modules/skottie",
2453 "modules/skshaper",
2454 ]
2455 }
2456 }
2457
Brian Osmanc9a42472018-05-31 13:17:12 -04002458 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002459 test_app("HelloWorld") {
2460 sources = [
2461 "example/HelloWorld.cpp",
2462 ]
2463 libs = []
2464
2465 include_dirs = []
2466 deps = [
2467 ":flags",
2468 ":gpu_tool_utils",
2469 ":sk_app",
2470 ":skia",
2471 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002472 ]
2473 }
2474 }
2475
Brian Osmanc9a42472018-05-31 13:17:12 -04002476 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002477 test_app("SkiaSDLExample") {
2478 sources = [
2479 "example/SkiaSDLExample.cpp",
2480 ]
2481 libs = []
2482 include_dirs = []
2483 deps = [
2484 ":gpu_tool_utils",
2485 ":skia",
2486 "//third_party/libsdl",
2487 ]
2488 }
2489 }
2490
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002491 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2492 action_foreach("generate_mocs") {
2493 script = "gn/call.py"
2494 sources = [
2495 "tools/mdbviz/MainWindow.h",
2496 ]
2497 outputs = [
2498 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2499 ]
2500 args = [
2501 "$skia_qt_path" + "/bin/moc",
2502 "{{source}}",
2503 "-o",
2504 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2505 ]
2506 }
2507 action_foreach("generate_resources") {
2508 script = "gn/call.py"
2509 sources = [
2510 "tools/mdbviz/resources.qrc",
2511 ]
2512 outputs = [
2513 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2514 ]
2515 args = [
2516 "$skia_qt_path" + "/bin/rcc",
2517 "{{source}}",
2518 "-o",
2519 "gen/mdbviz/{{source_name_part}}_res.cpp",
2520 ]
2521 }
2522 test_app("mdbviz") {
2523 if (is_win) {
2524 # on Windows we need to disable some exception handling warnings due to the Qt headers
2525 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2526 }
2527 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002528 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002529 "tools/debugger/DebugCanvas.cpp",
2530 "tools/debugger/DrawCommand.cpp",
2531 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002532 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002533 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002534 "tools/mdbviz/main.cpp",
2535
2536 # generated files
2537 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2538 "$target_gen_dir/mdbviz/resources_res.cpp",
2539 ]
2540 lib_dirs = [ "$skia_qt_path/lib" ]
2541 libs = [
2542 "Qt5Core.lib",
2543 "Qt5Gui.lib",
2544 "Qt5Widgets.lib",
2545 ]
2546 include_dirs = [
2547 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002548 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002549 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002550 "tools",
2551 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002552 ]
2553 deps = [
2554 ":generate_mocs",
2555 ":generate_resources",
2556 ":skia",
2557 ]
2558 }
2559 }
2560
Mike Kleine459afd2017-03-03 09:21:30 -05002561 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002562 copy("gdbserver") {
2563 sources = [
2564 "$ndk/$ndk_gdbserver",
2565 ]
2566 outputs = [
2567 "$root_out_dir/gdbserver",
2568 ]
2569 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002570 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002571
2572 if (skia_use_opencl) {
2573 test_app("hello-opencl") {
2574 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002575 "tools/hello-opencl.cpp",
2576 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002577 deps = [
2578 "//third_party/opencl",
2579 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002580 }
2581 }
mtklein25c81d42016-07-27 13:55:26 -07002582}