blob: baa34f43e607b03002b137316922fcb80c811371 [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
Mike Klein4d598a32016-10-31 13:44:49 -040074 if (is_android) {
75 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070076 } else if (is_fuchsia) {
77 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040078 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050079 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040080 }
Jim Van Verth4e502972017-12-07 15:16:10 -050081
82 if (is_ios) {
83 skia_ios_identity = ".*Google.*"
84 skia_ios_profile = "Google Development"
85 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040086}
Brian Salomon789e25e2016-09-30 13:41:03 -040087
Adam Barth54ef74a2017-10-13 10:59:38 -070088if (defined(skia_settings)) {
89 import(skia_settings)
90}
91
mtklein1211e0c2016-07-26 13:55:45 -070092skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070093 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070094 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070095 "include/codec",
96 "include/config",
97 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -040098 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400100 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500102 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/pathops",
104 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700105 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/utils",
107 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700108]
109
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500110if (skia_enable_atlas_text) {
111 skia_public_includes += [ "include/atlastext" ]
112}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000113
mtkleinc04ff472016-06-23 10:29:30 -0700114# Skia public API, generally provided by :skia.
115config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700116 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400117 defines = []
118 if (is_component_build) {
119 defines += [ "SKIA_DLL" ]
120 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400121 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700122 defines += [ "SK_SAMPLES_FOR_X" ]
123 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400124 if (skia_enable_flutter_defines) {
125 defines += flutter_defines
126 }
mtklein06c35c02016-09-20 12:28:12 -0700127 if (!skia_enable_gpu) {
128 defines += [ "SK_SUPPORT_GPU=0" ]
129 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500130 if (skia_enable_atlas_text) {
131 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
132 }
Mike Reed025f7832018-11-12 09:27:05 -0500133 if (is_fuchsia) {
134 defines += fuchsia_defines
135 }
mtkleinc04ff472016-06-23 10:29:30 -0700136}
137
138# Skia internal APIs, used by Skia itself and a few test tools.
139config("skia_private") {
140 visibility = [ ":*" ]
141
142 include_dirs = [
143 "include/private",
144 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700145 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700146 "src/core",
147 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700148 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700149 "src/image",
150 "src/images",
151 "src/lazy",
152 "src/opts",
153 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700154 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/ports",
156 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400157 "src/shaders",
158 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700159 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700161 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500162 "src/xml",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500163 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700164 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700165 ]
mtklein150d1132016-08-01 06:56:40 -0700166
Mike Reeda9e241d2017-05-03 10:52:00 -0400167 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500168 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700169 defines += [
170 "SK_GAMMA_EXPONENT=1.4",
171 "SK_GAMMA_CONTRAST=0.0",
172 ]
173 }
mtklein88a7ac02016-09-14 11:16:49 -0700174 if (is_official_build || is_android) {
175 # TODO(bsalomon): it'd be nice to make Android normal.
176 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
177 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400178 libs = []
179 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500180 if (skia_enable_gpu) {
181 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500182 if (is_skia_dev_build && skia_use_vulkan) {
183 include_dirs += [ "tools/gpu/vk" ]
184 }
Brian Salomon03e05842017-02-23 12:23:47 -0500185 }
Brian Osman34755e22016-12-05 09:46:02 -0500186 if (skia_use_angle) {
187 defines += [ "SK_ANGLE" ]
188 }
Brian Osman3f375d02016-12-28 11:19:22 -0500189 if (skia_enable_discrete_gpu) {
190 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
191 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400192 if (!is_official_build) {
193 defines += [ "GR_TEST_UTILS=1" ]
194 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400195 if (skia_llvm_path != "") {
196 defines += [ "SK_LLVM_AVAILABLE" ]
197 include_dirs += [ "$skia_llvm_path/include" ]
198 libs += [ skia_llvm_lib ]
199 lib_dirs += [ "$skia_llvm_path/lib/" ]
200 }
mtkleinc04ff472016-06-23 10:29:30 -0700201}
202
203# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
204config("skia_library") {
205 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700206 defines = [ "SKIA_IMPLEMENTATION=1" ]
207}
208
209skia_library_configs = [
210 ":skia_public",
211 ":skia_private",
212 ":skia_library",
213]
214
mtklein9b8583d2016-08-24 17:32:30 -0700215# Use for CPU-specific Skia code that needs particular compiler flags.
216template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500217 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700218 if (invoker.enabled) {
219 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500220 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700221 forward_variables_from(invoker, "*")
222 configs += skia_library_configs
223 }
224 } else {
225 # If not enabled, a phony empty target that swallows all otherwise unused variables.
226 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500227 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700228 forward_variables_from(invoker,
229 "*",
230 [
231 "sources",
232 "cflags",
233 ])
234 }
235 }
anmittala7eaf2e2016-08-17 13:57:26 -0700236}
237
mtklein422310d2016-08-16 18:28:43 -0700238is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700239
mtklein7d6fb2c2016-08-25 14:50:44 -0700240opts("none") {
241 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700242 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700243 cflags = []
244}
245
mtklein7d6fb2c2016-08-25 14:50:44 -0700246opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700247 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700248 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700249 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700250}
251
252opts("arm64") {
253 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700254 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700255 cflags = []
256}
257
258opts("crc32") {
259 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700260 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700261 cflags = [ "-march=armv8-a+crc" ]
262}
263
mtklein9b8583d2016-08-24 17:32:30 -0700264opts("sse2") {
265 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400267 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400268 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
269 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400270 cflags = [ "-msse2" ]
271 }
mtklein9b8583d2016-08-24 17:32:30 -0700272}
mtkleinc04ff472016-06-23 10:29:30 -0700273
mtklein9b8583d2016-08-24 17:32:30 -0700274opts("ssse3") {
275 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700276 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400277 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400278 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
279 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400280 cflags = [ "-mssse3" ]
281 }
mtklein9b8583d2016-08-24 17:32:30 -0700282}
mtkleinc04ff472016-06-23 10:29:30 -0700283
mtklein9b8583d2016-08-24 17:32:30 -0700284opts("sse41") {
285 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700286 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400287 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400288 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
289 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400290 cflags = [ "-msse4.1" ]
291 }
mtklein9b8583d2016-08-24 17:32:30 -0700292}
mtklein4e976072016-08-08 09:06:27 -0700293
mtklein9b8583d2016-08-24 17:32:30 -0700294opts("sse42") {
295 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700296 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400297 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400298 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
299 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400300 cflags = [ "-msse4.2" ]
301 }
mtklein9b8583d2016-08-24 17:32:30 -0700302}
303
304opts("avx") {
305 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700306 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400307 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000308 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400309 } else {
310 cflags = [ "-mavx" ]
311 }
mtkleinc04ff472016-06-23 10:29:30 -0700312}
313
Mike Klein1b9b7d52018-02-27 10:37:40 -0500314opts("hsw") {
315 enabled = is_x86
316 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400317 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500318 cflags = [ "/arch:AVX2" ]
319 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000320 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500321 }
322
323 # Oddly, clang-cl doesn't recognize this as a valid flag.
324 # If it ever does, it'd nice to move this up with -mavx2 and co.
325 if (is_clang && !is_win) {
326 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
327 # but nice to have, generating slightly better code for paths without explicit FMAs.
328 cflags += [ "-ffp-contract=fast" ]
329 }
330}
331
mtkleinc095df52016-08-24 12:23:52 -0700332# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700333template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500334 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700335 if (invoker.enabled) {
336 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700337 if (defined(invoker.public_defines)) {
338 defines = invoker.public_defines
339 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600340 if (defined(invoker.public_configs)) {
341 configs = invoker.public_configs
342 }
mtklein457b42a2016-08-23 13:56:37 -0700343 }
344 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500345 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700346 forward_variables_from(invoker,
347 "*",
348 [
349 "public_defines",
350 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700351 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700352 ])
mtklein457b42a2016-08-23 13:56:37 -0700353 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700354 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700355 if (defined(invoker.configs_to_remove)) {
356 configs -= invoker.configs_to_remove
357 }
mtklein457b42a2016-08-23 13:56:37 -0700358 }
359 } else {
mtklein457b42a2016-08-23 13:56:37 -0700360 source_set(target_name) {
361 forward_variables_from(invoker,
362 "*",
363 [
364 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400365 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700366 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700367 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700368 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700369 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700370 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700371 ])
mtkleincd01b032016-08-31 04:58:19 -0700372 if (defined(invoker.sources_when_disabled)) {
373 sources = invoker.sources_when_disabled
374 }
375 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700376 }
mtkleineb3c4252016-08-23 07:38:09 -0700377 }
mtklein457b42a2016-08-23 13:56:37 -0700378}
mtklein457b42a2016-08-23 13:56:37 -0700379
mtkleina45be612016-08-29 15:22:10 -0700380optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500381 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700382
383 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500384 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700385 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700386 ]
387 sources = [
388 "src/ports/SkFontMgr_android.cpp",
389 "src/ports/SkFontMgr_android_factory.cpp",
390 "src/ports/SkFontMgr_android_parser.cpp",
391 ]
392}
393
mtkleind2e39db2016-09-07 07:52:55 -0700394optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500395 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700396
397 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500398 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700399 ]
400 sources = [
401 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500402 "src/ports/SkFontMgr_custom.h",
403 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700404 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500405 "src/ports/SkFontMgr_custom_embedded.cpp",
406 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700407 ]
408}
409
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500410optional("fontmgr_custom_empty") {
411 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500412
413 deps = [
414 ":typeface_freetype",
415 ]
416 sources = [
417 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500418 "src/ports/SkFontMgr_custom_empty.cpp",
419 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800420 ]
421}
422
Hal Canaryff2742e2018-01-30 11:35:47 -0500423optional("fontmgr_empty") {
424 enabled = skia_enable_fontmgr_empty
425 sources = [
426 "src/ports/SkFontMgr_empty_factory.cpp",
427 ]
428}
429
mtklein3cc22182016-08-29 13:26:14 -0700430optional("fontmgr_fontconfig") {
431 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700432
433 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500434 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700435 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700436 ]
437 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700438 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700439 "src/ports/SkFontConfigInterface_direct.cpp",
440 "src/ports/SkFontConfigInterface_direct_factory.cpp",
441 "src/ports/SkFontMgr_FontConfigInterface.cpp",
442 "src/ports/SkFontMgr_fontconfig.cpp",
443 "src/ports/SkFontMgr_fontconfig_factory.cpp",
444 ]
445}
446
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500447optional("fontmgr_fuchsia") {
448 enabled = skia_enable_fontmgr_fuchsia
449
450 deps = [
451 "//sdk/fidl/fuchsia.fonts",
452 ]
453 sources = [
454 "src/ports/SkFontMgr_fuchsia.cpp",
455 "src/ports/SkFontMgr_fuchsia.h",
456 ]
457}
458
459optional("fontmgr_wasm") {
460 enabled = target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700461
462 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500463 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700464 ]
465 sources = [
466 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500467 "src/ports/SkFontMgr_custom.h",
468 "src/ports/SkFontMgr_custom_embedded.cpp",
469 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700470 ]
471}
472
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500473optional("fontmgr_win") {
474 enabled = skia_enable_fontmgr_win
475
476 sources = [
477 "src/fonts/SkFontMgr_indirect.cpp",
478 "src/ports/SkFontMgr_win_dw.cpp",
479 "src/ports/SkFontMgr_win_dw_factory.cpp",
480 "src/ports/SkScalerContext_win_dw.cpp",
481 "src/ports/SkTypeface_win_dw.cpp",
482 ]
483}
484
485optional("fontmgr_win_gdi") {
486 enabled = skia_enable_fontmgr_win_gdi
487
488 sources = [
489 "src/ports/SkFontHost_win.cpp",
490 ]
491 libs = [ "Gdi32.lib" ]
492}
493
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700494if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400495 executable("sksllex") {
496 sources = [
497 "src/sksl/lex/Main.cpp",
498 "src/sksl/lex/NFA.cpp",
499 "src/sksl/lex/RegexNode.cpp",
500 "src/sksl/lex/RegexParser.cpp",
501 ]
502 include_dirs = [ "src/sksl/lex" ]
503 }
504
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700505 action("run_sksllex") {
506 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400507 deps = [
508 ":sksllex(//gn/toolchain:$host_toolchain)",
509 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700510 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700511 "src/sksl/lex/sksl.lex",
512 ]
513
514 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
515 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
516 outputs = [
517 "$target_out_dir/" +
518 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
519 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
520 # confused due to the same file being named by two different paths
521 ]
522 sksllex_path = "$root_out_dir/"
523 sksllex_path += "sksllex"
524 if (host_os == "win") {
525 sksllex_path += ".exe"
526 }
527 args = [
528 rebase_path(sksllex_path),
529 rebase_path("bin/clang-format"),
530 rebase_path("src"),
531 ]
532 }
533} else {
534 group("run_sksllex") {
535 }
536}
537
538if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400539 executable("skslc") {
540 defines = [ "SKSL_STANDALONE" ]
541 sources = [
542 "src/sksl/SkSLMain.cpp",
543 ]
544 sources += skia_sksl_sources
545 include_dirs = [
546 "src/gpu",
547 "src/sksl",
548 ]
549 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500550 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400551 "//third_party/spirv-tools",
552 ]
553 }
554
555 skia_gpu_processor_outputs = []
556 foreach(src, skia_gpu_processor_sources) {
557 dir = get_path_info(src, "dir")
558 name = get_path_info(src, "name")
559
560 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
561 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
562 skia_gpu_processor_outputs += [
563 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
564 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
565 # confused due to the same file being named by two different paths
566 ]
567 }
568
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500569 action("create_sksl_enums") {
570 script = "gn/create_sksl_enums.py"
571 sources = [
572 "include/private/GrSharedEnums.h",
573 ]
574 outputs = [
575 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500576 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500577 ]
578 args = [
579 rebase_path(sources[0]),
580 rebase_path(outputs[0]),
581 ]
582 }
583
Ethan Nicholas762466e2017-06-29 10:03:38 -0400584 action("compile_processors") {
585 script = "gn/compile_processors.py"
586 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500587 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400588 ":skslc(//gn/toolchain:$host_toolchain)",
589 ]
590 sources = skia_gpu_processor_sources
591 outputs = skia_gpu_processor_outputs
592 skslc_path = "$root_out_dir/"
593 if (host_toolchain != default_toolchain_name) {
594 skslc_path += "$host_toolchain/"
595 }
596 skslc_path += "skslc"
597 if (host_os == "win") {
598 skslc_path += ".exe"
599 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400600 args = [
601 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400602 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400603 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400604 args += rebase_path(skia_gpu_processor_sources)
605 }
606} else {
607 skia_gpu_processor_outputs = []
608 group("compile_processors") {
609 }
610}
611
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500612optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700613 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400614 deps = [
615 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700616 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400617 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700618 if (skia_generate_workarounds) {
619 deps += [ ":workaround_list" ]
620 }
mtkleine9fb3d52016-09-20 15:11:46 -0700621 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600622 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400623 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700624
Brian Salomon3d6801e2017-12-11 10:06:31 -0500625 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400626 if (!skia_enable_ccpr) {
627 sources -= skia_ccpr_sources
628 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
629 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400630 if (!skia_enable_nvpr) {
631 sources -= skia_nvpr_sources
632 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
633 }
mtklein06c35c02016-09-20 12:28:12 -0700634
635 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500636 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700637 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400638 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700639 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400640 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400641
642 # this lib is required to link against AHardwareBuffer
643 if (defined(ndk_api) && ndk_api >= 26) {
644 libs += [ "android" ]
645 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400646 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500647 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400648 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700649 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500650 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400651 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700652 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500653 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800654 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500655 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400656 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500657 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500658 if (target_cpu != "arm64") {
659 libs += [ "OpenGL32.lib" ]
660 }
mtklein06c35c02016-09-20 12:28:12 -0700661 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500662 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700663 }
mtkleine9fb3d52016-09-20 15:11:46 -0700664
665 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400666 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400667 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700668 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700669 if (skia_enable_vulkan_debug_layers) {
670 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
671 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800672 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500673 public_deps +=
674 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800675 }
mtkleine9fb3d52016-09-20 15:11:46 -0700676 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400677
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400678 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400679 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400680 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
681 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400682
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400683 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400684 if (skia_use_metal) {
685 public_defines += [ "SK_METAL" ]
686 sources += skia_metal_sources
687 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400688 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400689 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400690 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500691
692 if (skia_enable_atlas_text) {
693 sources += skia_atlas_text_sources
694 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400695
696 if (is_debug) {
697 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
698 }
mtklein06c35c02016-09-20 12:28:12 -0700699}
700
Leon Scroggins III41169202019-01-29 09:29:57 -0500701optional("gif") {
702 enabled = !skia_use_wuffs
703 sources = [
704 "src/codec/SkGifCodec.cpp",
705 "third_party/gif/SkGifImageReader.cpp",
706 ]
707}
708
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400709optional("heif") {
710 enabled = skia_use_libheif
711 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
712
713 deps = []
714
715 sources = [
716 "src/codec/SkHeifCodec.cpp",
717 ]
718}
719
mtklein63213812016-08-24 09:55:56 -0700720optional("jpeg") {
721 enabled = skia_use_libjpeg_turbo
722 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
723
mtklein63213812016-08-24 09:55:56 -0700724 deps = [
725 "//third_party/libjpeg-turbo:libjpeg",
726 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400727 public = [
728 "include/encode/SkJpegEncoder.h",
729 ]
mtklein63213812016-08-24 09:55:56 -0700730 sources = [
731 "src/codec/SkJpegCodec.cpp",
732 "src/codec/SkJpegDecoderMgr.cpp",
733 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700734 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400735 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700736 ]
737}
738
739optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500740 enabled = skia_use_zlib && skia_enable_pdf
741 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700742
mtklein63213812016-08-24 09:55:56 -0700743 deps = [
744 "//third_party/zlib",
745 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400746 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700747 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400748 }
brettwb9447282016-09-01 14:24:39 -0700749 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700750 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500751 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
752 deps += [ "//third_party/harfbuzz" ]
753 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
754 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700755 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500756 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700757 }
758}
759
760optional("png") {
761 enabled = skia_use_libpng
762 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
763
mtklein63213812016-08-24 09:55:56 -0700764 deps = [
765 "//third_party/libpng",
766 ]
767 sources = [
768 "src/codec/SkIcoCodec.cpp",
769 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400770 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700771 ]
772}
773
scroggof84ad642016-10-31 09:02:57 -0700774optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400775 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700776 public_defines = [ "SK_CODEC_DECODES_RAW" ]
777
778 deps = [
779 "//third_party/dng_sdk",
780 "//third_party/libjpeg-turbo:libjpeg",
781 "//third_party/piex",
782 ]
783
784 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
785 # Skia.
786 configs_to_remove = [ "//gn:no_exceptions" ]
787
788 sources = [
scroggof84ad642016-10-31 09:02:57 -0700789 "src/codec/SkRawCodec.cpp",
790 ]
791}
792
Mike Klein852a8cb2018-05-15 10:46:58 -0400793import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400794source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400795 cflags = []
796 if (!is_win || is_clang) {
797 cflags += [
798 "-w",
799 "-std=c11",
800 ]
801 }
802
803 public = [
804 "third_party/skcms/skcms.h",
805 ]
806 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
807}
808
mtklein3cc22182016-08-29 13:26:14 -0700809optional("typeface_freetype") {
810 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700811
812 deps = [
813 "//third_party/freetype2",
814 ]
815 sources = [
816 "src/ports/SkFontHost_FreeType.cpp",
817 "src/ports/SkFontHost_FreeType_common.cpp",
818 ]
819}
820
mtklein457b42a2016-08-23 13:56:37 -0700821optional("webp") {
822 enabled = skia_use_libwebp
823 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
824
mtklein457b42a2016-08-23 13:56:37 -0700825 deps = [
826 "//third_party/libwebp",
827 ]
828 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700829 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400830 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700831 ]
mtkleineb3c4252016-08-23 07:38:09 -0700832}
833
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400834optional("wuffs") {
835 enabled = skia_use_wuffs
836 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
837
838 deps = [
839 "//third_party/wuffs",
840 ]
841 sources = [
842 "src/codec/SkWuffsCodec.cpp",
843 ]
844}
845
mtklein63213812016-08-24 09:55:56 -0700846optional("xml") {
847 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000848 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700849
mtklein63213812016-08-24 09:55:56 -0700850 deps = [
851 "//third_party/expat",
852 ]
853 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500854 "src/svg/SkSVGCanvas.cpp",
855 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700856 "src/xml/SkDOM.cpp",
857 "src/xml/SkXMLParser.cpp",
858 "src/xml/SkXMLWriter.cpp",
859 ]
860}
861
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700862if (skia_enable_gpu && skia_generate_workarounds) {
863 action("workaround_list") {
864 script = "tools/build_workaround_header.py"
865
866 inputs = [
867 "src/gpu/gpu_workaround_list.txt",
868 ]
869
870 # see comments in skia_compile_processors about out dir path shenanigans.
871 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700872 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700873
874 outputs = [
875 "$root_out_dir/$output_file",
876 ]
877 args = [
878 "--output-file",
879 "$output_file",
880 ]
881
882 foreach(file, inputs) {
883 args += [ rebase_path(file, root_build_dir) ]
884 }
885 }
886}
887
mtkleinc04ff472016-06-23 10:29:30 -0700888component("skia") {
889 public_configs = [ ":skia_public" ]
890 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700891
Mike Klein607b0a72018-11-07 16:17:34 -0500892 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500893 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500894 ":pdf",
895 ":skcms",
896 ]
897
mtkleinc04ff472016-06-23 10:29:30 -0700898 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700899 ":arm64",
900 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700901 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000902 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700903 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700904 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700905 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500906 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500907 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700908 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800909 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500910 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500911 ":fontmgr_win",
912 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500913 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400914 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500915 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700916 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700917 ":none",
mtklein63213812016-08-24 09:55:56 -0700918 ":png",
scroggof84ad642016-10-31 09:02:57 -0700919 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700920 ":sse2",
921 ":sse41",
922 ":sse42",
923 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700924 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400925 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700926 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700927 ]
928
Kevin Lubick134be1d2018-10-30 15:05:04 -0400929 if (skia_enable_nima) {
930 deps += [ "//third_party/Nima-Cpp" ]
931 }
932
Chinmay Garde43f115c2016-11-16 15:04:12 -0800933 # This file (and all GN files in Skia) are designed to work with an
934 # empty sources assignment filter; we handle all that explicitly.
935 # We clear the filter here for clients who may have set up a global filter.
936 set_sources_assignment_filter([])
937
Hal Canaryc25f4e92019-02-26 11:54:25 -0500938 public = skia_core_public
939 public += skia_utils_public
940 public += skia_effects_public
941 public += skia_effects_imagefilter_public
942 public += skia_xps_public
943
mtkleinc04ff472016-06-23 10:29:30 -0700944 sources = []
brettwb9447282016-09-01 14:24:39 -0700945 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700946 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500947 if (skia_use_xps) {
948 sources += skia_xps_sources
949 }
Mike Klein54378232018-11-08 12:08:05 +0000950 sources += skia_effects_sources
951 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700952 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400953 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500954 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700955 "src/android/SkBitmapRegionCodec.cpp",
956 "src/android/SkBitmapRegionDecoder.cpp",
957 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100958 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400959 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700960 "src/codec/SkBmpCodec.cpp",
961 "src/codec/SkBmpMaskCodec.cpp",
962 "src/codec/SkBmpRLECodec.cpp",
963 "src/codec/SkBmpStandardCodec.cpp",
964 "src/codec/SkCodec.cpp",
965 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400966 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400967 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700968 "src/codec/SkMaskSwizzler.cpp",
969 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700970 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700971 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700972 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700973 "src/codec/SkSwizzler.cpp",
974 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700975 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700976 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000977 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700978 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700979 "src/ports/SkMemory_malloc.cpp",
980 "src/ports/SkOSFile_stdio.cpp",
981 "src/sfnt/SkOTTable_name.cpp",
982 "src/sfnt/SkOTUtils.cpp",
983 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500984 "third_party/etc1/etc1.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700985 ]
brettwb9447282016-09-01 14:24:39 -0700986
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400987 defines = []
988 if (!skia_enable_skpicture) {
989 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500990 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400991 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000992 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400993 sources += [ "src/core/SkPicture_none.cpp" ]
994 }
995
mtklein7d6fb2c2016-08-25 14:50:44 -0700996 libs = []
997
mtkleinc04ff472016-06-23 10:29:30 -0700998 if (is_win) {
999 sources += [
1000 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001001 "src/ports/SkImageEncoder_WIC.cpp",
1002 "src/ports/SkImageGeneratorWIC.cpp",
1003 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -07001004 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001005 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001006 ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001007 libs += [
1008 "FontSub.lib",
1009 "Ole32.lib",
1010 "OleAut32.lib",
1011 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001012 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001013 ]
mtkleinc04ff472016-06-23 10:29:30 -07001014 } else {
1015 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001016 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001017 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001018 "src/ports/SkTLS_pthread.cpp",
1019 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001020 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001021 }
1022
mtklein7d6fb2c2016-08-25 14:50:44 -07001023 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001024 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001025 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001026 deps += [ "//third_party/cpu-features" ]
1027 }
mtklein06c35c02016-09-20 12:28:12 -07001028 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001029 libs += [
1030 "EGL",
1031 "GLESv2",
1032 "log",
1033 ]
1034 }
1035
Kevin Lubick217056c2018-09-20 17:39:31 -04001036 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001037 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001038 if (skia_use_egl) {
1039 libs += [ "GLESv2" ]
1040 }
mtkleinc04ff472016-06-23 10:29:30 -07001041 }
1042
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001043 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001044 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001045 }
1046
mtkleinc04ff472016-06-23 10:29:30 -07001047 if (is_mac) {
1048 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001049 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001050 "src/ports/SkImageEncoder_CG.cpp",
1051 "src/ports/SkImageGeneratorCG.cpp",
1052 ]
mtklein09e61f72016-08-23 13:35:28 -07001053 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001054 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1055 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001056 "ApplicationServices.framework",
1057 "OpenGL.framework",
1058 ]
mtkleinc04ff472016-06-23 10:29:30 -07001059 }
abarth6fc8ff02016-07-15 15:15:15 -07001060
Mike Klein7d302882016-11-03 14:06:31 -04001061 if (is_ios) {
1062 sources += [
1063 "src/ports/SkDebug_stdio.cpp",
1064 "src/ports/SkFontHost_mac.cpp",
1065 "src/ports/SkImageEncoder_CG.cpp",
1066 "src/ports/SkImageGeneratorCG.cpp",
1067 ]
1068 libs += [
1069 "CoreFoundation.framework",
1070 "CoreGraphics.framework",
1071 "CoreText.framework",
1072 "ImageIO.framework",
1073 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001074
1075 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1076 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001077 ]
1078 }
1079
abarth6fc8ff02016-07-15 15:15:15 -07001080 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001081 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001082 }
mtkleinc04ff472016-06-23 10:29:30 -07001083}
1084
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001085# DebugCanvas used in experimental/wasm-skp-debugger
1086if (target_cpu == "wasm") {
1087 static_library("debugcanvas") {
1088 public_configs = [ ":skia_public" ]
1089
1090 include_dirs = [
1091 "include/gpu",
1092 "include/private",
1093 "src/gpu",
1094 "src/core",
1095 "src/shaders",
1096 "src/utils",
1097 "tools",
1098 "tools/debugger",
1099 ]
1100
1101 sources = [
1102 "tools/UrlDataManager.cpp",
1103 "tools/debugger/SkDebugCanvas.cpp",
1104 "tools/debugger/SkDrawCommand.cpp",
1105 "tools/debugger/SkJsonWriteBuffer.cpp",
1106 ]
1107
1108 deps = [
1109 ":fontmgr_wasm",
1110 ]
1111 }
1112}
1113
Kevin Lubickcbcff382018-10-02 09:02:18 -04001114static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001115 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001116 public_configs = [ ":skia_public" ]
1117 configs += skia_library_configs
1118
1119 deps = [
1120 ":arm64",
1121 ":armv7",
1122 ":avx",
1123 ":crc32",
1124 ":hsw",
1125 ":none",
1126 ":sse2",
1127 ":sse41",
1128 ":sse42",
1129 ":ssse3",
1130 ]
1131
1132 # This file (and all GN files in Skia) are designed to work with an
1133 # empty sources assignment filter; we handle all that explicitly.
1134 # We clear the filter here for clients who may have set up a global filter.
1135 set_sources_assignment_filter([])
1136
1137 sources = []
1138 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001139 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001140 sources += [
1141 "src/core/SkAnalyticEdge.cpp",
1142 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001143 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001144 "src/core/SkCubicMap.cpp",
1145 "src/core/SkEdge.cpp",
1146 "src/core/SkEdgeBuilder.cpp",
1147 "src/core/SkEdgeClipper.cpp",
1148 "src/core/SkGeometry.cpp",
1149 "src/core/SkLineClipper.cpp",
1150 "src/core/SkMallocPixelRef.cpp",
1151 "src/core/SkMath.cpp",
1152 "src/core/SkMatrix.cpp",
1153 "src/core/SkOpts.cpp",
1154 "src/core/SkPaint.cpp",
1155 "src/core/SkPath.cpp",
1156 "src/core/SkPathEffect.cpp",
1157 "src/core/SkPathMeasure.cpp",
1158 "src/core/SkPathRef.cpp",
1159 "src/core/SkPoint.cpp",
1160 "src/core/SkRRect.cpp",
1161 "src/core/SkRect.cpp",
1162 "src/core/SkSemaphore.cpp",
1163 "src/core/SkStream.cpp",
1164 "src/core/SkString.cpp",
1165 "src/core/SkStringUtils.cpp",
1166 "src/core/SkStroke.cpp",
1167 "src/core/SkStrokeRec.cpp",
1168 "src/core/SkStrokerPriv.cpp",
1169 "src/core/SkThreadID.cpp",
1170 "src/core/SkUtils.cpp",
1171 "src/effects/SkDashPathEffect.cpp",
1172 "src/effects/SkTrimPathEffect.cpp",
1173 "src/ports/SkDebug_stdio.cpp",
1174 "src/ports/SkMemory_malloc.cpp",
1175 "src/utils/SkDashPath.cpp",
1176 "src/utils/SkParse.cpp",
1177 "src/utils/SkParsePath.cpp",
1178 "src/utils/SkUTF.cpp",
1179 ]
1180}
1181
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001182group("modules") {
1183 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001184 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001185 "modules/skottie",
1186 "modules/skshaper",
1187 ]
1188}
1189
mtkleinc095df52016-08-24 12:23:52 -07001190# Targets guarded by skia_enable_tools may use //third_party freely.
1191if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001192 # Used by gn_to_bp.py to list our public include dirs.
1193 source_set("public") {
1194 configs += [ ":skia_public" ]
1195 }
1196
Mike Kleinc36dedf2016-11-18 09:35:28 -05001197 config("skia.h_config") {
1198 include_dirs = [ "$target_gen_dir" ]
1199 }
1200 action("skia.h") {
1201 public_configs = [ ":skia.h_config" ]
1202 skia_h = "$target_gen_dir/skia.h"
1203 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001204
1205 # TODO: would be cool to not hard-code these here, but how?
1206 module_public_includes = [
1207 "modules/sksg/include",
1208 "modules/skottie/include",
1209 ]
1210 args =
1211 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1212 [ rebase_path(skia_h, root_build_dir) ] +
1213 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001214 depfile = "$skia_h.deps"
1215 outputs = [
1216 skia_h,
1217 ]
1218 }
1219
Brian Osmanc9a42472018-05-31 13:17:12 -04001220 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001221 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001222 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001223 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001224 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001225 "tools/fiddle/draw.cpp",
1226 "tools/fiddle/fiddle_main.cpp",
1227 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001228
1229 if (skia_use_egl) {
1230 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001231 } else {
1232 sources += [ "tools/fiddle/null_context.cpp" ]
1233 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001234 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001235 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001236 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001237 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001238 ":skia",
1239 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001240 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001241 ]
1242 }
1243 }
1244
Brian Osmanc9a42472018-05-31 13:17:12 -04001245 source_set("public_headers_warnings_check") {
1246 sources = [
1247 "tools/public_headers_warnings_check.cpp",
1248 ]
1249 configs -= [ "//gn:warnings_except_public_headers" ]
1250 deps = [
1251 ":skia",
1252 ":skia.h",
1253 "modules/skottie",
1254 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001255
1256 # We add this directory to simulate the client already have
1257 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001258 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001259 }
1260
mtkleinc095df52016-08-24 12:23:52 -07001261 template("test_lib") {
1262 config(target_name + "_config") {
1263 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001264 if (defined(invoker.public_defines)) {
1265 defines = invoker.public_defines
1266 }
mtklein25c81d42016-07-27 13:55:26 -07001267 }
mtkleinc095df52016-08-24 12:23:52 -07001268 source_set(target_name) {
1269 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001270 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001271 public_configs = [
1272 ":" + target_name + "_config",
1273 ":skia_private",
1274 ]
1275
1276 if (!defined(deps)) {
1277 deps = []
1278 }
1279 deps += [ ":skia" ]
1280 testonly = true
1281 }
mtklein25c81d42016-07-27 13:55:26 -07001282 }
mtklein25c81d42016-07-27 13:55:26 -07001283
Mike Kleine6682eb2017-01-05 10:54:57 -05001284 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001285 if (is_ios) {
1286 app_name = target_name
1287 gen_path = target_gen_dir
1288
1289 action("${app_name}_generate_info_plist") {
1290 script = "//gn/gen_plist_ios.py"
1291 outputs = [
1292 "$gen_path/${app_name}_Info.plist",
1293 ]
1294 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1295 }
1296
1297 bundle_data("${app_name}_bundle_info_plist") {
1298 public_deps = [
1299 ":${app_name}_generate_info_plist",
1300 ]
1301 sources = [
1302 "$gen_path/${app_name}_Info.plist",
1303 ]
1304 outputs = [
1305 "{{bundle_root_dir}}/Info.plist",
1306 ]
1307 }
1308
Jim Van Verth329c5a62017-11-29 11:42:33 -05001309 bundle_ios_data =
1310 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1311
1312 if (bundle_ios_data) {
1313 has_skps =
1314 "True" == exec_script("//gn/checkdir.py",
1315 [ rebase_path("skps", root_build_dir) ],
1316 "trim string")
1317 bundle_data("${app_name}_bundle_resources") {
1318 sources = [
1319 "resources",
1320 ]
1321 outputs = [
1322 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1323 "{{bundle_resources_dir}}/data/resources",
1324 ]
1325 }
1326
1327 if (has_skps) {
1328 bundle_data("${app_name}_bundle_skps") {
1329 sources = [
1330 "skps",
1331 ]
1332 outputs = [
1333 # Store in same folder as resources
1334 "{{bundle_resources_dir}}/data/skps",
1335 ]
1336 }
1337 }
1338 }
1339
Jim Van Verth443a9132017-11-28 09:45:26 -05001340 executable("${app_name}_generate_executable") {
1341 forward_variables_from(invoker,
1342 "*",
1343 [
1344 "output_name",
1345 "visibility",
1346 "is_shared_library",
1347 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001348 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001349 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001350 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1351 }
1352
1353 bundle_data("${app_name}_bundle_executable") {
1354 public_deps = [
1355 ":${app_name}_generate_executable",
1356 ]
1357 sources = [
1358 "$gen_path/$app_name",
1359 ]
1360 outputs = [
1361 "{{bundle_executable_dir}}/$app_name",
1362 ]
1363 testonly = true
1364 }
1365
1366 create_bundle("$app_name") {
1367 product_type = "com.apple.product-type.application"
1368 testonly = true
1369
1370 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1371 bundle_resources_dir = bundle_root_dir
1372 bundle_executable_dir = bundle_root_dir
1373 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1374
1375 deps = [
1376 ":${app_name}_bundle_executable",
1377 ":${app_name}_bundle_info_plist",
1378 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001379 if (bundle_ios_data) {
1380 deps += [ ":${app_name}_bundle_resources" ]
1381 if (has_skps) {
1382 deps += [ ":${app_name}_bundle_skps" ]
1383 }
1384 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001385
1386 # should only code sign when running on a device, not the simulator
1387 if (target_cpu != "x64") {
1388 code_signing_script = "//gn/codesign_ios.py"
1389 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1390 code_signing_outputs = [
1391 "$bundle_root_dir/_CodeSignature/CodeResources",
1392 "$bundle_root_dir/embedded.mobileprovision",
1393 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001394 code_signing_args = [
1395 rebase_path("$bundle_root_dir", root_build_dir),
1396 skia_ios_identity,
1397 skia_ios_profile,
1398 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001399 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001400 }
1401 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001402 # !is_ios
1403
1404 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1405 shared_library("lib" + target_name) {
1406 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1407 configs += [ ":skia_private" ]
1408 testonly = true
1409 }
1410 } else {
1411 _executable = target_name
1412 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001413 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001414 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1415 configs += [ ":skia_private" ]
1416 testonly = true
1417 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001418 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001419 if (is_android && skia_android_serial != "" && defined(_executable)) {
1420 action("push_" + target_name) {
1421 script = "gn/push_to_android.py"
1422 deps = [
1423 ":" + _executable,
1424 ]
1425 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1426 outputs = [
1427 _stamp,
1428 ]
1429 args = [
1430 rebase_path("$root_build_dir/$_executable"),
1431 skia_android_serial,
1432 rebase_path(_stamp),
1433 ]
1434 testonly = true
1435 }
Mike Klein7d921032017-01-05 12:20:41 -05001436 }
1437 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001438 }
1439
Greg Danielda16cce2018-08-01 09:23:57 -04001440 config("moltenvk_config") {
1441 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1442 if (is_ios) {
1443 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1444 } else {
1445 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1446 }
1447 cflags = [ "-F$moltenvk_framework_path" ]
1448 ldflags = [ "-F$moltenvk_framework_path" ]
1449 libs = [
1450 "MoltenVK.framework",
1451 "Metal.framework",
1452 "IOSurface.framework",
1453 "QuartzCore.framework",
1454 "Foundation.framework",
1455 ]
1456 if (is_ios) {
1457 libs += [ "UIKit.framework" ]
1458 } else {
1459 libs += [ "IOKit.framework" ]
1460 }
1461 defines = [ "SK_MOLTENVK" ]
1462 }
1463 }
1464
1465 source_set("moltenvk") {
1466 public_configs = [ ":moltenvk_config" ]
1467 }
1468
mtkleinc095df52016-08-24 12:23:52 -07001469 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001470 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001471 public_defines = []
1472 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001473
Brian Osmanc9a42472018-05-31 13:17:12 -04001474 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001475 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001476 sources = [
1477 "tools/gpu/GrContextFactory.cpp",
1478 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001479 "tools/gpu/MemoryCache.cpp",
1480 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001481 "tools/gpu/ProxyUtils.cpp",
1482 "tools/gpu/TestContext.cpp",
1483 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1484 "tools/gpu/gl/GLTestContext.cpp",
1485 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001486 "tools/gpu/gl/null/NullGLTestContext.cpp",
1487 "tools/gpu/mock/MockTestContext.cpp",
1488 ]
1489 libs = []
1490
1491 if (is_android || skia_use_egl) {
1492 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1493 } else if (is_ios) {
1494 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1495 libs += [ "OpenGLES.framework" ]
1496 } else if (is_linux) {
1497 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001498 libs += [
1499 "GLU",
1500 "X11",
1501 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001502 } else if (is_mac) {
1503 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1504 } else if (is_win) {
1505 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001506 libs += [ "Gdi32.lib" ]
1507 if (target_cpu != "arm64") {
1508 libs += [ "OpenGL32.lib" ]
1509 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001510 }
mtklein25c81d42016-07-27 13:55:26 -07001511
Brian Osmanc9a42472018-05-31 13:17:12 -04001512 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001513
Brian Osmanc9a42472018-05-31 13:17:12 -04001514 if (skia_use_angle) {
1515 deps += [ "//third_party/angle2" ]
1516 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1517 }
Greg Daniel54200e42018-12-11 17:03:39 -05001518
Greg Daniel487132b2018-12-20 14:09:36 -05001519 public_include_dirs += [ "include/third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001520 if (skia_use_vulkan) {
1521 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1522 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001523 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1524 public_deps += [ ":moltenvk" ]
1525 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001526 }
1527 if (skia_use_metal) {
1528 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001529 }
mtklein25c81d42016-07-27 13:55:26 -07001530 }
mtklein25c81d42016-07-27 13:55:26 -07001531
mtkleinc095df52016-08-24 12:23:52 -07001532 test_lib("flags") {
1533 public_include_dirs = [ "tools/flags" ]
1534 sources = [
1535 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001536 ]
1537 }
1538 test_lib("common_flags") {
1539 public_include_dirs = [ "tools/flags" ]
1540 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001541 "tools/flags/SkCommonFlags.cpp",
1542 "tools/flags/SkCommonFlagsConfig.cpp",
1543 ]
1544 deps = [
mtklein046cb562016-09-16 10:23:12 -07001545 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001546 ]
1547 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001548 ":gpu_tool_utils",
1549 ]
1550 }
mtklein25c81d42016-07-27 13:55:26 -07001551
mtkleinc095df52016-08-24 12:23:52 -07001552 test_lib("tool_utils") {
1553 public_include_dirs = [
1554 "tools",
1555 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001556 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001557 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001558 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001559 ]
1560 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001561 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001562 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001563 "tools/DDLPromiseImageHelper.cpp",
1564 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001565 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001566 "tools/ProcStats.cpp",
1567 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001568 "tools/UrlDataManager.cpp",
1569 "tools/debugger/SkDebugCanvas.cpp",
1570 "tools/debugger/SkDrawCommand.cpp",
1571 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001572 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001573 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001574 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001575 "tools/fonts/SkTestFontMgr.h",
1576 "tools/fonts/SkTestSVGTypeface.cpp",
1577 "tools/fonts/SkTestSVGTypeface.h",
1578 "tools/fonts/SkTestTypeface.cpp",
1579 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001580 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001581 "tools/random_parse_path.cpp",
1582 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001583 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001584 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001585 "tools/trace/SkChromeTracingTracer.cpp",
1586 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001587 "tools/trace/SkDebugfTracer.cpp",
1588 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001589 "tools/trace/SkEventTracingPriv.cpp",
1590 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001591 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001592 libs = []
1593 if (is_ios) {
1594 sources += [ "tools/ios_utils.m" ]
1595 libs += [ "Foundation.framework" ]
1596 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001597 defines = []
1598 if (skia_tools_require_resources) {
1599 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1600 }
mtkleinc095df52016-08-24 12:23:52 -07001601 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001602 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001603 ":flags",
1604 "//third_party/libpng",
1605 ]
1606 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001607 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001608 ]
1609 }
mtklein25c81d42016-07-27 13:55:26 -07001610
Mike Klein6e744122016-10-27 12:21:40 -04001611 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001612 test_lib("gm") {
1613 public_include_dirs = [ "gm" ]
1614 sources = gm_sources
1615 deps = [
scroggo19b91532016-10-24 09:03:26 -07001616 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001617 ":skia",
1618 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001619 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001620 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001621 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001622 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001623 public_deps = [
1624 ":gpu_tool_utils",
1625 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001626 if (skia_enable_skshaper) {
1627 deps += [ "modules/skshaper" ]
1628 defines = [ "SK_USING_SKSHAPER" ]
1629 }
mtkleinc095df52016-08-24 12:23:52 -07001630 }
mtklein25c81d42016-07-27 13:55:26 -07001631
Mike Klein6e744122016-10-27 12:21:40 -04001632 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001633 test_lib("tests") {
1634 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001635 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001636 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001637 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001638 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001639 if (!(skia_use_freetype && skia_use_fontconfig)) {
1640 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1641 }
mtkleinc095df52016-08-24 12:23:52 -07001642 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001643 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001644 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001645 ":skia",
1646 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001647 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001648 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001649 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001650 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001651 "//third_party/zlib",
1652 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001653 public_deps = [
1654 ":gpu_tool_utils", # Test.h #includes headers from this target.
1655 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001656 if (skia_enable_skshaper) {
1657 deps += [ "modules/skshaper" ]
1658 defines = [ "SK_USING_SKSHAPER" ]
1659 }
mtkleinc095df52016-08-24 12:23:52 -07001660 }
mtklein2f3416d2016-08-02 16:02:05 -07001661
Mike Klein6e744122016-10-27 12:21:40 -04001662 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001663 test_lib("bench") {
1664 public_include_dirs = [ "bench" ]
1665 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001666 deps = [
1667 ":flags",
1668 ":gm",
1669 ":gpu_tool_utils",
1670 ":skia",
1671 ":tool_utils",
1672 ]
1673 }
mtklein2b6870c2016-07-28 14:17:33 -07001674
mtkleinc095df52016-08-24 12:23:52 -07001675 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001676 public_include_dirs = []
1677 if (skia_use_expat) {
1678 public_include_dirs += [ "experimental/svg/model" ]
1679 sources = [
1680 "experimental/svg/model/SkSVGAttribute.cpp",
1681 "experimental/svg/model/SkSVGAttributeParser.cpp",
1682 "experimental/svg/model/SkSVGCircle.cpp",
1683 "experimental/svg/model/SkSVGClipPath.cpp",
1684 "experimental/svg/model/SkSVGContainer.cpp",
1685 "experimental/svg/model/SkSVGDOM.cpp",
1686 "experimental/svg/model/SkSVGEllipse.cpp",
1687 "experimental/svg/model/SkSVGGradient.cpp",
1688 "experimental/svg/model/SkSVGLine.cpp",
1689 "experimental/svg/model/SkSVGLinearGradient.cpp",
1690 "experimental/svg/model/SkSVGNode.cpp",
1691 "experimental/svg/model/SkSVGPath.cpp",
1692 "experimental/svg/model/SkSVGPattern.cpp",
1693 "experimental/svg/model/SkSVGPoly.cpp",
1694 "experimental/svg/model/SkSVGRadialGradient.cpp",
1695 "experimental/svg/model/SkSVGRect.cpp",
1696 "experimental/svg/model/SkSVGRenderContext.cpp",
1697 "experimental/svg/model/SkSVGSVG.cpp",
1698 "experimental/svg/model/SkSVGShape.cpp",
1699 "experimental/svg/model/SkSVGStop.cpp",
1700 "experimental/svg/model/SkSVGTransformableNode.cpp",
1701 "experimental/svg/model/SkSVGUse.cpp",
1702 "experimental/svg/model/SkSVGValue.cpp",
1703 ]
1704 deps = [
1705 ":skia",
1706 ":xml",
1707 ]
1708 }
mtkleinc095df52016-08-24 12:23:52 -07001709 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001710
Mike Klein38af9432016-11-11 11:39:44 -05001711 if (skia_use_lua) {
1712 test_lib("lua") {
1713 public_include_dirs = []
1714 sources = [
1715 "src/utils/SkLua.cpp",
1716 "src/utils/SkLuaCanvas.cpp",
1717 ]
1718 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001719 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001720 "//third_party/lua",
1721 ]
1722 }
1723
Mike Kleine6682eb2017-01-05 10:54:57 -05001724 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001725 sources = [
1726 "tools/lua/lua_app.cpp",
1727 ]
1728 deps = [
1729 ":lua",
1730 ":skia",
1731 "//third_party/lua",
1732 ]
Mike Klein38af9432016-11-11 11:39:44 -05001733 }
1734
Mike Kleine6682eb2017-01-05 10:54:57 -05001735 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001736 sources = [
1737 "tools/lua/lua_pictures.cpp",
1738 ]
1739 deps = [
1740 ":flags",
1741 ":lua",
1742 ":skia",
1743 ":tool_utils",
1744 "//third_party/lua",
1745 ]
Mike Klein38af9432016-11-11 11:39:44 -05001746 }
1747 }
1748
Cary Clark8032b982017-07-28 11:04:54 -04001749 test_app("bookmaker") {
1750 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001751 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001752 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001753 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001754 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001755 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001756 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001757 "tools/bookmaker/includeParser.cpp",
1758 "tools/bookmaker/includeWriter.cpp",
1759 "tools/bookmaker/mdOut.cpp",
1760 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001761 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001762 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001763 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001764 ]
1765 deps = [
1766 ":flags",
1767 ":skia",
1768 ":tool_utils",
1769 ]
1770 }
1771
Florin Malitabfe876a2018-09-02 12:33:59 -04001772 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001773 test_app("skottie_tool") {
1774 deps = [
1775 "modules/skottie:tool",
1776 ]
1777 }
1778 }
1779
Kevin Lubickebf648e2017-09-21 13:45:16 -04001780 if (target_cpu != "wasm") {
1781 import("gn/samples.gni")
1782 test_lib("samples") {
1783 public_include_dirs = [ "samplecode" ]
1784 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001785 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001786 public_deps = [
1787 ":tool_utils",
1788 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001789 deps = [
1790 ":experimental_svg_model",
1791 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001792 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001793 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001794 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001795 ]
Mike Klein38af9432016-11-11 11:39:44 -05001796
Ruiqi Maof5101492018-06-29 14:32:21 -04001797 # NIMA does not build on Windows clang
1798 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001799 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001800 deps += [ "//third_party/Nima-Cpp" ]
1801 }
1802
Kevin Lubickebf648e2017-09-21 13:45:16 -04001803 if (skia_use_lua) {
1804 sources += [ "samplecode/SampleLua.cpp" ]
1805 deps += [
1806 ":lua",
1807 "//third_party/lua",
1808 ]
1809 }
1810 }
Mike Klein7af351a2018-07-27 09:54:43 -04001811 test_app("imgcvt") {
1812 sources = [
1813 "tools/imgcvt.cpp",
1814 ]
1815 deps = [
1816 ":skcms",
1817 ":skia",
1818 ]
1819 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001820 test_app("dm") {
1821 sources = [
1822 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001823 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001824 "dm/DMJsonWriter.cpp",
1825 "dm/DMSrcSink.cpp",
1826 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001827 deps = [
1828 ":common_flags",
1829 ":experimental_svg_model",
1830 ":flags",
1831 ":gm",
1832 ":gpu_tool_utils",
1833 ":skia",
1834 ":tests",
1835 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001836 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001837 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001838 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001839 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001840 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001841
1842 # NIMA does not build on Windows clang
1843 if (!is_win || !is_clang) {
1844 deps += [ "//third_party/Nima-Cpp" ]
1845 }
Mike Klein38af9432016-11-11 11:39:44 -05001846 }
Brian Osman16adfa32016-10-18 14:42:44 -04001847 }
1848
Mike Kleina8a51ce2018-01-09 12:34:11 -05001849 if (!is_win) {
1850 test_app("remote_demo") {
1851 sources = [
1852 "tools/remote_demo.cpp",
1853 ]
1854 deps = [
1855 ":skia",
1856 ]
1857 }
1858 }
1859
Mike Kleine6682eb2017-01-05 10:54:57 -05001860 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001861 sources = [
1862 "bench/nanobench.cpp",
1863 ]
1864 deps = [
1865 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001866 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001867 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001868 ":flags",
1869 ":gm",
1870 ":gpu_tool_utils",
1871 ":skia",
1872 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001873 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001874 ]
mtklein2b6870c2016-07-28 14:17:33 -07001875 }
halcanary19a97202016-08-03 15:08:04 -07001876
Ravi Mistry10d36c52017-01-31 09:49:18 -05001877 test_app("skpinfo") {
1878 sources = [
1879 "tools/skpinfo.cpp",
1880 ]
1881 deps = [
1882 ":flags",
1883 ":skia",
1884 ]
1885 }
1886
Brian Osmanc9a42472018-05-31 13:17:12 -04001887 test_app("skpbench") {
1888 sources = [
1889 "tools/skpbench/skpbench.cpp",
1890 ]
1891 deps = [
1892 ":flags",
1893 ":gpu_tool_utils",
1894 ":skia",
1895 ":tool_utils",
1896 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001897 }
1898
Mike Kleine6682eb2017-01-05 10:54:57 -05001899 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001900 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001901 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001902 ]
1903 deps = [
1904 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001905 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001906 ]
halcanary3eee9d92016-09-10 07:01:53 -07001907 }
mtklein046cb562016-09-16 10:23:12 -07001908
Ben Wagner219f3622017-07-17 15:32:25 -04001909 test_app("create_test_font") {
1910 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001911 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001912 ]
1913 deps = [
1914 ":skia",
1915 ]
1916 assert_no_deps = [
1917 # tool_utils requires the output of this app.
1918 ":tool_utils",
1919 ]
1920 }
1921
Florin Malita5d3ff432018-07-31 16:38:43 -04001922 if (skia_use_expat) {
1923 test_app("create_test_font_color") {
1924 sources = [
1925 "tools/fonts/create_test_font_color.cpp",
1926 ]
1927 deps = [
1928 ":flags",
1929 ":skia",
1930 ":tool_utils",
1931 ]
1932 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001933 }
1934
Mike Kleine6682eb2017-01-05 10:54:57 -05001935 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001936 sources = [
1937 "tools/get_images_from_skps.cpp",
1938 ]
1939 deps = [
1940 ":flags",
1941 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001942 ]
mtklein046cb562016-09-16 10:23:12 -07001943 }
mtkleinecbc5262016-09-22 11:51:24 -07001944
Brian Osman6788a542018-12-10 11:56:01 -05001945 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001946 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001947 sources = [
1948 "tools/skiaserve/Request.cpp",
1949 "tools/skiaserve/Response.cpp",
1950 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001951 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1952 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1953 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1954 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1955 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1956 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1957 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1958 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1959 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001960 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1961 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001962 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1963 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1964 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1965 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1966 ]
1967 deps = [
1968 ":flags",
1969 ":gpu_tool_utils",
1970 ":skia",
1971 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001972 "//third_party/libmicrohttpd",
1973 "//third_party/libpng",
1974 ]
Mike Klein7d302882016-11-03 14:06:31 -04001975 }
mtkleinecbc5262016-09-22 11:51:24 -07001976 }
kjlubick14f984b2016-10-03 11:49:45 -07001977
Mike Kleine6682eb2017-01-05 10:54:57 -05001978 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001979 include_dirs = [
1980 "tools",
1981 "tools/debugger",
Kevin Lubickec1c6202018-12-14 11:42:53 -05001982 "tools/fonts",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04001983 "src/sksl",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001984 ]
kjlubick14f984b2016-10-03 11:49:45 -07001985 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001986 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001987 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001988 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001989 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001990 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001991 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001992 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001993 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001994 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001995 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001996 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001997 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001998 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001999 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2000 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002001 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002002 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002003 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002004 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002005 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2006 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002007 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2008 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
2009 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002010 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002011 "tools/UrlDataManager.cpp",
2012 "tools/debugger/SkDebugCanvas.cpp",
2013 "tools/debugger/SkDrawCommand.cpp",
2014 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002015 ]
2016 deps = [
2017 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002018 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002019 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002020 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002021 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07002022 ]
kjlubick14f984b2016-10-03 11:49:45 -07002023 }
Mike Klein38312422016-10-05 15:41:01 -04002024
Mike Kleine6682eb2017-01-05 10:54:57 -05002025 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002026 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002027 rebase_path("tests/skia_test.cpp"),
2028 rebase_path("tests/Test.cpp"),
2029 ]
caryclark9feb6322016-10-25 08:58:26 -07002030 deps = [
2031 ":flags",
2032 ":gpu_tool_utils",
2033 ":skia",
2034 ":tool_utils",
2035 ]
caryclark9feb6322016-10-25 08:58:26 -07002036 }
2037
Mike Kleine6682eb2017-01-05 10:54:57 -05002038 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002039 sources = [
2040 "tools/DumpRecord.cpp",
2041 "tools/dump_record.cpp",
2042 ]
2043 deps = [
2044 ":flags",
2045 ":skia",
2046 ]
Mike Klein38312422016-10-05 15:41:01 -04002047 }
bungemanfe917272016-10-13 17:36:40 -04002048
Mike Kleine6682eb2017-01-05 10:54:57 -05002049 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002050 sources = [
2051 "tools/skdiff/skdiff.cpp",
2052 "tools/skdiff/skdiff_html.cpp",
2053 "tools/skdiff/skdiff_main.cpp",
2054 "tools/skdiff/skdiff_utils.cpp",
2055 ]
2056 deps = [
2057 ":skia",
2058 ":tool_utils",
2059 ]
bungemanfe917272016-10-13 17:36:40 -04002060 }
halcanarya73d76a2016-10-17 13:19:02 -07002061
Mike Kleine6682eb2017-01-05 10:54:57 -05002062 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002063 sources = [
2064 "tools/skp_parser.cpp",
2065 ]
2066 deps = [
2067 ":skia",
2068 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002069 ]
halcanarya73d76a2016-10-17 13:19:02 -07002070 }
Brian Osman16adfa32016-10-18 14:42:44 -04002071
Brian Osmanc9a42472018-05-31 13:17:12 -04002072 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002073 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05002074 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002075 defines =
2076 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002077 sources = [
2078 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002079 "tools/skqp/src/skqp.cpp",
2080 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002081 ]
2082 deps = [
2083 ":gm",
2084 ":gpu_tool_utils",
2085 ":skia",
2086 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002087 ":tool_utils",
2088 ]
2089 }
2090 test_app("skqp") {
2091 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002092 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002093 ]
2094 deps = [
2095 ":skia",
2096 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002097 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002098 ]
2099 }
2100 test_app("jitter_gms") {
2101 sources = [
2102 "tools/skqp/jitter_gms.cpp",
2103 ]
2104 deps = [
2105 ":gm",
2106 ":skia",
2107 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002108 ]
2109 }
2110 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002111 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002112 test_app("skqp_app") {
2113 is_shared_library = true
2114 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002115 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002116 ]
2117 deps = [
2118 ":skia",
2119 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002120 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002121 ]
2122 libs = [ "android" ]
2123 }
2124 }
Stan Iliev93151722018-08-02 11:10:52 -04002125 if (is_android && skia_enable_gpu) {
2126 test_app("skottie_android") {
2127 is_shared_library = true
2128
2129 sources = [
2130 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2131 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2132 ]
2133 libs = []
2134
2135 include_dirs = []
2136 deps = [
2137 ":skia",
2138 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002139 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002140 ]
2141 }
2142 }
Hal Canary75427132017-10-11 16:00:31 -04002143
Hal Canarya9de7602018-01-19 13:08:23 -05002144 test_app("list_gms") {
2145 sources = [
2146 "tools/list_gms.cpp",
2147 ]
2148 deps = [
2149 ":gm",
2150 ":skia",
2151 ]
2152 }
2153 test_app("list_gpu_unit_tests") {
2154 sources = [
2155 "dm/DMGpuTestProcs.cpp",
2156 "tools/list_gpu_unit_tests.cpp",
2157 ]
2158 deps = [
2159 ":skia",
2160 ":tests",
2161 ]
2162 }
2163
Brian Osmanc9a42472018-05-31 13:17:12 -04002164 test_lib("sk_app") {
2165 public_include_dirs = [ "tools/sk_app" ]
2166 sources = [
2167 "tools/sk_app/CommandSet.cpp",
2168 "tools/sk_app/GLWindowContext.cpp",
2169 "tools/sk_app/Window.cpp",
2170 ]
2171 libs = []
2172
2173 if (is_android) {
2174 sources += [
2175 "tools/sk_app/android/GLWindowContext_android.cpp",
2176 "tools/sk_app/android/RasterWindowContext_android.cpp",
2177 "tools/sk_app/android/Window_android.cpp",
2178 "tools/sk_app/android/main_android.cpp",
2179 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002180 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002181 libs += [ "android" ]
2182 } else if (is_linux) {
2183 sources += [
2184 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2185 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2186 "tools/sk_app/unix/Window_unix.cpp",
2187 "tools/sk_app/unix/keysym2ucs.c",
2188 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002189 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002190 libs += [
2191 "GL",
2192 "X11",
2193 ]
2194 } else if (is_win) {
2195 sources += [
2196 "tools/sk_app/win/GLWindowContext_win.cpp",
2197 "tools/sk_app/win/RasterWindowContext_win.cpp",
2198 "tools/sk_app/win/Window_win.cpp",
2199 "tools/sk_app/win/main_win.cpp",
2200 ]
Brian Salomon194db172017-08-17 14:37:06 -04002201 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002202 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002203 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002204 } else if (is_mac) {
2205 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002206 "tools/sk_app/mac/GLWindowContext_mac.mm",
2207 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2208 "tools/sk_app/mac/Window_mac.mm",
2209 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002210 ]
2211 libs += [
2212 "QuartzCore.framework",
2213 "Cocoa.framework",
2214 "Foundation.framework",
2215 ]
2216 } else if (is_ios) {
2217 sources += [
2218 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2219 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2220 "tools/sk_app/ios/Window_ios.cpp",
2221 "tools/sk_app/ios/main_ios.cpp",
2222 ]
2223 }
2224
2225 if (skia_use_vulkan) {
2226 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2227 if (is_android) {
2228 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2229 } else if (is_linux) {
2230 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2231 libs += [ "X11-xcb" ]
2232 } else if (is_win) {
2233 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002234 } else if (is_mac) {
2235 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2236 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002237 }
2238 }
2239
Jim Van Verthbe39f712019-02-08 15:36:14 -05002240 if (skia_use_metal) {
2241 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2242 if (is_mac) {
2243 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2244 }
2245 libs += [ "MetalKit.framework" ]
2246 }
2247
Brian Osmanc9a42472018-05-31 13:17:12 -04002248 deps = [
2249 ":gpu_tool_utils",
2250 ":skia",
2251 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002252 ]
2253 if (is_android) {
2254 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002255 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002256 deps += [ "//third_party/libsdl" ]
2257 }
2258 if (skia_use_angle) {
2259 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002260 }
Brian Osman16adfa32016-10-18 14:42:44 -04002261 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002262
Hal Canary87515122019-03-15 14:22:51 -04002263 import("gn/examples.gni")
2264 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2265 test_app("fiddle_examples") {
2266 sources = [
2267 "tools/fiddle/examples.cpp",
2268 "tools/fiddle/examples.h"
2269 ]
2270 sources += examples_sources
2271 include_dirs = [ "tools" ]
2272 deps = [
2273 ":skia",
2274 ":skia.h",
2275 "modules/skottie",
2276 ]
2277 }
2278 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002279 test_app("viewer") {
2280 is_shared_library = is_android
2281 if (is_ios) {
2282 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002283 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002284 sources = [
2285 "tools/viewer/BisectSlide.cpp",
2286 "tools/viewer/GMSlide.cpp",
2287 "tools/viewer/ImGuiLayer.cpp",
2288 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002289 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002290 "tools/viewer/SKPSlide.cpp",
2291 "tools/viewer/SampleSlide.cpp",
2292 "tools/viewer/SkottieSlide.cpp",
2293 "tools/viewer/SlideDir.cpp",
2294 "tools/viewer/StatsLayer.cpp",
2295 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002296 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002297 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002298 "tools/viewer/Viewer.cpp",
2299 ]
2300 libs = []
2301
Kevin Lubickd9699322018-10-30 15:08:53 -04002302 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002303 deps = [
2304 ":experimental_svg_model",
2305 ":flags",
2306 ":gm",
2307 ":gpu_tool_utils",
2308 ":samples",
2309 ":sk_app",
2310 ":skia",
2311 ":tool_utils",
Brian Osman7c979f52019-02-12 13:27:51 -05002312 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002313 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002314 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002315 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002316 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002317 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002318 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002319
2320 # NIMA does not build on Windows clang
2321 if (!is_win || !is_clang) {
2322 sources += [ "tools/viewer/NIMASlide.cpp" ]
2323 deps += [ "//third_party/Nima-Cpp" ]
2324 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002325 }
2326
ziadbbceddbc2018-06-19 13:57:15 -04002327 if (is_android) {
2328 test_app("arcore") {
2329 is_shared_library = true
2330 configs = [
2331 ":skia_public",
2332 "gn:default",
2333 ]
2334
2335 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2336 # 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 -05002337 public = skia_core_public
2338 public += skia_utils_public
ziadbbceddbc2018-06-19 13:57:15 -04002339 sources = []
2340 sources += skia_core_sources
2341 sources += skia_utils_sources
2342 sources += skia_xps_sources
2343 sources += [
2344 "src/android/SkAndroidFrameworkUtils.cpp",
2345 "src/android/SkAnimatedImage.cpp",
2346 "src/android/SkBitmapRegionCodec.cpp",
2347 "src/android/SkBitmapRegionDecoder.cpp",
2348 "src/codec/SkAndroidCodec.cpp",
2349 "src/codec/SkBmpBaseCodec.cpp",
2350 "src/codec/SkBmpCodec.cpp",
2351 "src/codec/SkBmpMaskCodec.cpp",
2352 "src/codec/SkBmpRLECodec.cpp",
2353 "src/codec/SkBmpStandardCodec.cpp",
2354 "src/codec/SkCodec.cpp",
2355 "src/codec/SkCodecImageGenerator.cpp",
2356 "src/codec/SkColorTable.cpp",
2357 "src/codec/SkGifCodec.cpp",
2358 "src/codec/SkMaskSwizzler.cpp",
2359 "src/codec/SkMasks.cpp",
2360 "src/codec/SkSampledCodec.cpp",
2361 "src/codec/SkSampler.cpp",
2362 "src/codec/SkStreamBuffer.cpp",
2363 "src/codec/SkSwizzler.cpp",
2364 "src/codec/SkWbmpCodec.cpp",
2365 "src/images/SkImageEncoder.cpp",
2366 "src/ports/SkDiscardableMemory_none.cpp",
2367 "src/ports/SkImageGenerator_skia.cpp",
2368 "src/ports/SkMemory_malloc.cpp",
2369 "src/ports/SkOSFile_stdio.cpp",
2370 "src/sfnt/SkOTTable_name.cpp",
2371 "src/sfnt/SkOTUtils.cpp",
2372 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -05002373 "third_party/etc1/etc1.cpp",
ziadbbceddbc2018-06-19 13:57:15 -04002374 "third_party/gif/SkGifImageReader.cpp",
2375 ]
2376 deps = [
2377 ":tool_utils",
2378 "modules/skottie",
2379 "modules/skshaper",
2380 ]
2381 }
2382 }
2383
Brian Osmanc9a42472018-05-31 13:17:12 -04002384 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002385 test_app("HelloWorld") {
2386 sources = [
2387 "example/HelloWorld.cpp",
2388 ]
2389 libs = []
2390
2391 include_dirs = []
2392 deps = [
2393 ":flags",
2394 ":gpu_tool_utils",
2395 ":sk_app",
2396 ":skia",
2397 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002398 ]
2399 }
2400 }
2401
Brian Osmanc9a42472018-05-31 13:17:12 -04002402 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002403 test_app("SkiaSDLExample") {
2404 sources = [
2405 "example/SkiaSDLExample.cpp",
2406 ]
2407 libs = []
2408 include_dirs = []
2409 deps = [
2410 ":gpu_tool_utils",
2411 ":skia",
2412 "//third_party/libsdl",
2413 ]
2414 }
2415 }
2416
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002417 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2418 action_foreach("generate_mocs") {
2419 script = "gn/call.py"
2420 sources = [
2421 "tools/mdbviz/MainWindow.h",
2422 ]
2423 outputs = [
2424 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2425 ]
2426 args = [
2427 "$skia_qt_path" + "/bin/moc",
2428 "{{source}}",
2429 "-o",
2430 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2431 ]
2432 }
2433 action_foreach("generate_resources") {
2434 script = "gn/call.py"
2435 sources = [
2436 "tools/mdbviz/resources.qrc",
2437 ]
2438 outputs = [
2439 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2440 ]
2441 args = [
2442 "$skia_qt_path" + "/bin/rcc",
2443 "{{source}}",
2444 "-o",
2445 "gen/mdbviz/{{source_name_part}}_res.cpp",
2446 ]
2447 }
2448 test_app("mdbviz") {
2449 if (is_win) {
2450 # on Windows we need to disable some exception handling warnings due to the Qt headers
2451 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2452 }
2453 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002454 "tools/UrlDataManager.cpp",
2455 "tools/debugger/SkDebugCanvas.cpp",
2456 "tools/debugger/SkDrawCommand.cpp",
2457 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002458 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002459 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002460 "tools/mdbviz/main.cpp",
2461
2462 # generated files
2463 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2464 "$target_gen_dir/mdbviz/resources_res.cpp",
2465 ]
2466 lib_dirs = [ "$skia_qt_path/lib" ]
2467 libs = [
2468 "Qt5Core.lib",
2469 "Qt5Gui.lib",
2470 "Qt5Widgets.lib",
2471 ]
2472 include_dirs = [
2473 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002474 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002475 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002476 "tools",
2477 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002478 ]
2479 deps = [
2480 ":generate_mocs",
2481 ":generate_resources",
2482 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002483 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002484 ]
2485 }
2486 }
2487
Mike Kleine459afd2017-03-03 09:21:30 -05002488 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002489 copy("gdbserver") {
2490 sources = [
2491 "$ndk/$ndk_gdbserver",
2492 ]
2493 outputs = [
2494 "$root_out_dir/gdbserver",
2495 ]
2496 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002497 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002498
2499 if (skia_use_opencl) {
2500 test_app("hello-opencl") {
2501 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002502 "tools/hello-opencl.cpp",
2503 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002504 deps = [
2505 "//third_party/opencl",
2506 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002507 }
2508 }
mtklein25c81d42016-07-27 13:55:26 -07002509}