blob: 4dcfeb1cc19e3fbf7582eba93c2424780f00a202 [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
Mike Klein3669a822017-03-03 10:55:02 -050015if (!defined(is_skia_standalone)) {
16 is_skia_standalone = false
17}
18is_skia_dev_build = is_skia_standalone && !is_official_build
19
mtkleinc04ff472016-06-23 10:29:30 -070020declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040021 skia_enable_flutter_defines = false
22}
23
24declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000025 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040026 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070027 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070028 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050029 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070030 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050031 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070032 skia_use_libjpeg_turbo = true
33 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070034 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050035 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040036 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040037 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040038 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070039 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040040 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040041 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070042 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070043
Mike Klein7d921032017-01-05 12:20:41 -050044 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040045 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000046 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050047 skia_enable_discrete_gpu = true
Brian Osman74511012018-04-02 20:13:46 +000048 skia_enable_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040049 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050050 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040051 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040052 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050053 skia_enable_tools = is_skia_dev_build
54 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040055 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040056 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070057 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070058 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040059
Hal Canary2331c822018-02-01 14:06:13 -050060 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040061
62 skia_llvm_path = ""
63 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040064
65 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070066}
Brian Salomon23d73ea2016-10-27 13:31:37 -040067declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040068 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040069 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050070 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050071 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050072 skia_enable_fontmgr_custom =
73 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050074 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
75 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080076 skia_enable_fontmgr_fuchsia = is_fuchsia
Mike Klein10d665d2016-11-01 11:46:10 -040077
Mike Klein4d598a32016-10-31 13:44:49 -040078 if (is_android) {
79 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070080 } else if (is_fuchsia) {
81 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040082 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050083 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040084 }
Jim Van Verth4e502972017-12-07 15:16:10 -050085
86 if (is_ios) {
87 skia_ios_identity = ".*Google.*"
88 skia_ios_profile = "Google Development"
89 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040090}
Brian Salomon789e25e2016-09-30 13:41:03 -040091
Adam Barth54ef74a2017-10-13 10:59:38 -070092if (defined(skia_settings)) {
93 import(skia_settings)
94}
95
Brian Osmanc9a42472018-05-31 13:17:12 -040096# Our tools require static linking (they use non-exported symbols), and the GPU backend.
97skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070098
mtklein1211e0c2016-07-26 13:55:45 -070099skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -0700100 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700101 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700102 "include/codec",
103 "include/config",
104 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -0400105 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400107 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700108 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500109 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700110 "include/pathops",
111 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700112 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700113 "include/utils",
114 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700115]
116
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500117if (skia_enable_atlas_text) {
118 skia_public_includes += [ "include/atlastext" ]
119}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000120
mtkleinc04ff472016-06-23 10:29:30 -0700121# Skia public API, generally provided by :skia.
122config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700123 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400124 defines = []
125 if (is_component_build) {
126 defines += [ "SKIA_DLL" ]
127 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400128 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700129 defines += [ "SK_SAMPLES_FOR_X" ]
130 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400131 if (skia_enable_flutter_defines) {
132 defines += flutter_defines
133 }
mtklein06c35c02016-09-20 12:28:12 -0700134 if (!skia_enable_gpu) {
135 defines += [ "SK_SUPPORT_GPU=0" ]
136 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500137 if (skia_enable_atlas_text) {
138 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
139 }
Mike Reed025f7832018-11-12 09:27:05 -0500140 if (is_fuchsia) {
141 defines += fuchsia_defines
142 }
mtkleinc04ff472016-06-23 10:29:30 -0700143}
144
145# Skia internal APIs, used by Skia itself and a few test tools.
146config("skia_private") {
147 visibility = [ ":*" ]
148
149 include_dirs = [
150 "include/private",
151 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700152 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700153 "src/core",
154 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700155 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/image",
157 "src/images",
158 "src/lazy",
159 "src/opts",
160 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700161 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700162 "src/ports",
163 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400164 "src/shaders",
165 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700166 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700167 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700168 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500169 "src/xml",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500170 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700171 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700172 ]
mtklein150d1132016-08-01 06:56:40 -0700173
Mike Reeda9e241d2017-05-03 10:52:00 -0400174 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500175 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700176 defines += [
177 "SK_GAMMA_EXPONENT=1.4",
178 "SK_GAMMA_CONTRAST=0.0",
179 ]
180 }
mtklein88a7ac02016-09-14 11:16:49 -0700181 if (is_official_build || is_android) {
182 # TODO(bsalomon): it'd be nice to make Android normal.
183 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
184 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400185 libs = []
186 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500187 if (skia_enable_gpu) {
188 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500189 if (is_skia_dev_build && skia_use_vulkan) {
190 include_dirs += [ "tools/gpu/vk" ]
191 }
Brian Salomon03e05842017-02-23 12:23:47 -0500192 }
Brian Osman34755e22016-12-05 09:46:02 -0500193 if (skia_use_angle) {
194 defines += [ "SK_ANGLE" ]
195 }
Brian Osman3f375d02016-12-28 11:19:22 -0500196 if (skia_enable_discrete_gpu) {
197 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
198 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400199 if (!is_official_build) {
200 defines += [ "GR_TEST_UTILS=1" ]
201 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400202 if (skia_llvm_path != "") {
203 defines += [ "SK_LLVM_AVAILABLE" ]
204 include_dirs += [ "$skia_llvm_path/include" ]
205 libs += [ skia_llvm_lib ]
206 lib_dirs += [ "$skia_llvm_path/lib/" ]
207 }
mtkleinc04ff472016-06-23 10:29:30 -0700208}
209
210# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
211config("skia_library") {
212 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700213 defines = [ "SKIA_IMPLEMENTATION=1" ]
214}
215
216skia_library_configs = [
217 ":skia_public",
218 ":skia_private",
219 ":skia_library",
220]
221
mtklein9b8583d2016-08-24 17:32:30 -0700222# Use for CPU-specific Skia code that needs particular compiler flags.
223template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500224 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700225 if (invoker.enabled) {
226 source_set(target_name) {
227 forward_variables_from(invoker, "*")
228 configs += skia_library_configs
229 }
230 } else {
231 # If not enabled, a phony empty target that swallows all otherwise unused variables.
232 source_set(target_name) {
233 forward_variables_from(invoker,
234 "*",
235 [
236 "sources",
237 "cflags",
238 ])
239 }
240 }
anmittala7eaf2e2016-08-17 13:57:26 -0700241}
242
mtklein422310d2016-08-16 18:28:43 -0700243is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700244
mtklein7d6fb2c2016-08-25 14:50:44 -0700245opts("none") {
246 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700248 cflags = []
249}
250
mtklein7d6fb2c2016-08-25 14:50:44 -0700251opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700252 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700254 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700255}
256
257opts("arm64") {
258 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700260 cflags = []
261}
262
263opts("crc32") {
264 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700265 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700266 cflags = [ "-march=armv8-a+crc" ]
267}
268
mtklein9b8583d2016-08-24 17:32:30 -0700269opts("sse2") {
270 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700271 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400272 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400273 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
274 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400275 cflags = [ "-msse2" ]
276 }
mtklein9b8583d2016-08-24 17:32:30 -0700277}
mtkleinc04ff472016-06-23 10:29:30 -0700278
mtklein9b8583d2016-08-24 17:32:30 -0700279opts("ssse3") {
280 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700281 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400282 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400283 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
284 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400285 cflags = [ "-mssse3" ]
286 }
mtklein9b8583d2016-08-24 17:32:30 -0700287}
mtkleinc04ff472016-06-23 10:29:30 -0700288
mtklein9b8583d2016-08-24 17:32:30 -0700289opts("sse41") {
290 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700291 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400292 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400293 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
294 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400295 cflags = [ "-msse4.1" ]
296 }
mtklein9b8583d2016-08-24 17:32:30 -0700297}
mtklein4e976072016-08-08 09:06:27 -0700298
mtklein9b8583d2016-08-24 17:32:30 -0700299opts("sse42") {
300 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700301 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400302 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400303 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
304 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400305 cflags = [ "-msse4.2" ]
306 }
mtklein9b8583d2016-08-24 17:32:30 -0700307}
308
309opts("avx") {
310 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700311 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400312 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000313 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400314 } else {
315 cflags = [ "-mavx" ]
316 }
mtkleinc04ff472016-06-23 10:29:30 -0700317}
318
Mike Klein1b9b7d52018-02-27 10:37:40 -0500319opts("hsw") {
320 enabled = is_x86
321 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400322 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500323 cflags = [ "/arch:AVX2" ]
324 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000325 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500326 }
327
328 # Oddly, clang-cl doesn't recognize this as a valid flag.
329 # If it ever does, it'd nice to move this up with -mavx2 and co.
330 if (is_clang && !is_win) {
331 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
332 # but nice to have, generating slightly better code for paths without explicit FMAs.
333 cflags += [ "-ffp-contract=fast" ]
334 }
335}
336
mtkleinc095df52016-08-24 12:23:52 -0700337# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700338template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500339 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700340 if (invoker.enabled) {
341 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700342 if (defined(invoker.public_defines)) {
343 defines = invoker.public_defines
344 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600345 if (defined(invoker.public_configs)) {
346 configs = invoker.public_configs
347 }
mtklein457b42a2016-08-23 13:56:37 -0700348 }
349 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700350 forward_variables_from(invoker,
351 "*",
352 [
353 "public_defines",
354 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700355 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700356 ])
mtklein457b42a2016-08-23 13:56:37 -0700357 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700358 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700359 if (defined(invoker.configs_to_remove)) {
360 configs -= invoker.configs_to_remove
361 }
mtklein457b42a2016-08-23 13:56:37 -0700362 }
363 } else {
mtklein457b42a2016-08-23 13:56:37 -0700364 source_set(target_name) {
365 forward_variables_from(invoker,
366 "*",
367 [
368 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400369 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700370 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700371 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700372 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700373 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700374 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700375 ])
mtkleincd01b032016-08-31 04:58:19 -0700376 if (defined(invoker.sources_when_disabled)) {
377 sources = invoker.sources_when_disabled
378 }
379 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700380 }
mtkleineb3c4252016-08-23 07:38:09 -0700381 }
mtklein457b42a2016-08-23 13:56:37 -0700382}
mtklein457b42a2016-08-23 13:56:37 -0700383
mtkleina45be612016-08-29 15:22:10 -0700384optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500385 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700386
387 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500388 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700389 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700390 ]
391 sources = [
392 "src/ports/SkFontMgr_android.cpp",
393 "src/ports/SkFontMgr_android_factory.cpp",
394 "src/ports/SkFontMgr_android_parser.cpp",
395 ]
396}
397
mtkleind2e39db2016-09-07 07:52:55 -0700398optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500399 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700400
401 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500402 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700403 ]
404 sources = [
405 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500406 "src/ports/SkFontMgr_custom.h",
407 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700408 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500409 "src/ports/SkFontMgr_custom_embedded.cpp",
410 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700411 ]
412}
413
Kevin Lubickddd0a332018-12-12 10:35:13 -0500414optional("fontmgr_wasm") {
415 enabled = target_cpu == "wasm"
416
417 deps = [
418 ":typeface_freetype",
419 ]
420 sources = [
421 "src/ports/SkFontMgr_custom.cpp",
422 "src/ports/SkFontMgr_custom.h",
423 "src/ports/SkFontMgr_custom_embedded.cpp",
424 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
425 ]
426}
427
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800428optional("fontmgr_fuchsia") {
429 enabled = skia_enable_fontmgr_fuchsia
430
431 deps = [
Adam Barthf4766752019-02-07 09:08:54 -0800432 "//sdk/fidl/fuchsia.fonts",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800433 ]
434 sources = [
435 "src/ports/SkFontMgr_fuchsia.cpp",
436 "src/ports/SkFontMgr_fuchsia.h",
437 ]
438}
439
Hal Canaryff2742e2018-01-30 11:35:47 -0500440optional("fontmgr_empty") {
441 enabled = skia_enable_fontmgr_empty
442 sources = [
443 "src/ports/SkFontMgr_empty_factory.cpp",
444 ]
445}
446
mtklein3cc22182016-08-29 13:26:14 -0700447optional("fontmgr_fontconfig") {
448 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700449
450 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500451 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700452 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700453 ]
454 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700455 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700456 "src/ports/SkFontConfigInterface_direct.cpp",
457 "src/ports/SkFontConfigInterface_direct_factory.cpp",
458 "src/ports/SkFontMgr_FontConfigInterface.cpp",
459 "src/ports/SkFontMgr_fontconfig.cpp",
460 "src/ports/SkFontMgr_fontconfig_factory.cpp",
461 ]
462}
463
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500464optional("fontmgr_custom_empty") {
465 enabled = skia_enable_fontmgr_custom_empty
mtkleincdedd0e2016-09-12 15:15:44 -0700466
467 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500468 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700469 ]
470 sources = [
471 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500472 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700473 "src/ports/SkFontMgr_custom_empty_factory.cpp",
474 ]
475}
476
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700477if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400478 executable("sksllex") {
479 sources = [
480 "src/sksl/lex/Main.cpp",
481 "src/sksl/lex/NFA.cpp",
482 "src/sksl/lex/RegexNode.cpp",
483 "src/sksl/lex/RegexParser.cpp",
484 ]
485 include_dirs = [ "src/sksl/lex" ]
486 }
487
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700488 action("run_sksllex") {
489 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400490 deps = [
491 ":sksllex(//gn/toolchain:$host_toolchain)",
492 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700493 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700494 "src/sksl/lex/sksl.lex",
495 ]
496
497 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
498 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
499 outputs = [
500 "$target_out_dir/" +
501 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
502 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
503 # confused due to the same file being named by two different paths
504 ]
505 sksllex_path = "$root_out_dir/"
506 sksllex_path += "sksllex"
507 if (host_os == "win") {
508 sksllex_path += ".exe"
509 }
510 args = [
511 rebase_path(sksllex_path),
512 rebase_path("bin/clang-format"),
513 rebase_path("src"),
514 ]
515 }
516} else {
517 group("run_sksllex") {
518 }
519}
520
521if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400522 executable("skslc") {
523 defines = [ "SKSL_STANDALONE" ]
524 sources = [
525 "src/sksl/SkSLMain.cpp",
526 ]
527 sources += skia_sksl_sources
528 include_dirs = [
529 "src/gpu",
530 "src/sksl",
531 ]
532 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500533 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400534 "//third_party/spirv-tools",
535 ]
536 }
537
538 skia_gpu_processor_outputs = []
539 foreach(src, skia_gpu_processor_sources) {
540 dir = get_path_info(src, "dir")
541 name = get_path_info(src, "name")
542
543 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
544 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
545 skia_gpu_processor_outputs += [
546 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
547 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
548 # confused due to the same file being named by two different paths
549 ]
550 }
551
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500552 action("create_sksl_enums") {
553 script = "gn/create_sksl_enums.py"
554 sources = [
555 "include/private/GrSharedEnums.h",
556 ]
557 outputs = [
558 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500559 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500560 ]
561 args = [
562 rebase_path(sources[0]),
563 rebase_path(outputs[0]),
564 ]
565 }
566
Ethan Nicholas762466e2017-06-29 10:03:38 -0400567 action("compile_processors") {
568 script = "gn/compile_processors.py"
569 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500570 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400571 ":skslc(//gn/toolchain:$host_toolchain)",
572 ]
573 sources = skia_gpu_processor_sources
574 outputs = skia_gpu_processor_outputs
575 skslc_path = "$root_out_dir/"
576 if (host_toolchain != default_toolchain_name) {
577 skslc_path += "$host_toolchain/"
578 }
579 skslc_path += "skslc"
580 if (host_os == "win") {
581 skslc_path += ".exe"
582 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400583 args = [
584 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400585 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400586 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400587 args += rebase_path(skia_gpu_processor_sources)
588 }
589} else {
590 skia_gpu_processor_outputs = []
591 group("compile_processors") {
592 }
593}
594
Mike Klein33ad63a2018-11-11 07:17:00 -0500595optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700596 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400597 deps = [
598 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700599 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400600 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700601 if (skia_generate_workarounds) {
602 deps += [ ":workaround_list" ]
603 }
mtkleine9fb3d52016-09-20 15:11:46 -0700604 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600605 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400606 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700607
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400609 if (!skia_enable_ccpr) {
610 sources -= skia_ccpr_sources
611 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
612 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400613 if (!skia_enable_nvpr) {
614 sources -= skia_nvpr_sources
615 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
616 }
mtklein06c35c02016-09-20 12:28:12 -0700617
618 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500619 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700620 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400621 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700622 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400623 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400624
625 # this lib is required to link against AHardwareBuffer
626 if (defined(ndk_api) && ndk_api >= 26) {
627 libs += [ "android" ]
628 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400629 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500630 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400631 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700632 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500633 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400634 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700635 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500636 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800637 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500638 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400639 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500640 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500641 if (target_cpu != "arm64") {
642 libs += [ "OpenGL32.lib" ]
643 }
mtklein06c35c02016-09-20 12:28:12 -0700644 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500645 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700646 }
mtkleine9fb3d52016-09-20 15:11:46 -0700647
648 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400649 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400650 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700651 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700652 if (skia_enable_vulkan_debug_layers) {
653 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
654 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800655 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500656 public_deps +=
657 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800658 }
mtkleine9fb3d52016-09-20 15:11:46 -0700659 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400660
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400661 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400662 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400663 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
664 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400665
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400666 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400667 if (skia_use_metal) {
668 public_defines += [ "SK_METAL" ]
669 sources += skia_metal_sources
670 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400671 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400672 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400673 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500674
675 if (skia_enable_atlas_text) {
676 sources += skia_atlas_text_sources
677 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400678
679 if (is_debug) {
680 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
681 }
mtklein06c35c02016-09-20 12:28:12 -0700682}
683
Leon Scroggins III41169202019-01-29 09:29:57 -0500684optional("gif") {
685 enabled = !skia_use_wuffs
686 sources = [
687 "src/codec/SkGifCodec.cpp",
688 "third_party/gif/SkGifImageReader.cpp",
689 ]
690}
691
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400692optional("heif") {
693 enabled = skia_use_libheif
694 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
695
696 deps = []
697
698 sources = [
699 "src/codec/SkHeifCodec.cpp",
700 ]
701}
702
mtklein63213812016-08-24 09:55:56 -0700703optional("jpeg") {
704 enabled = skia_use_libjpeg_turbo
705 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
706
mtklein63213812016-08-24 09:55:56 -0700707 deps = [
708 "//third_party/libjpeg-turbo:libjpeg",
709 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400710 public = [
711 "include/encode/SkJpegEncoder.h",
712 ]
mtklein63213812016-08-24 09:55:56 -0700713 sources = [
714 "src/codec/SkJpegCodec.cpp",
715 "src/codec/SkJpegDecoderMgr.cpp",
716 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700717 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400718 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700719 ]
720}
721
722optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500723 enabled = skia_use_zlib && skia_enable_pdf
724 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700725
mtklein63213812016-08-24 09:55:56 -0700726 deps = [
727 "//third_party/zlib",
728 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400729 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700730 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400731 }
brettwb9447282016-09-01 14:24:39 -0700732 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700733 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700734
735 if (skia_use_sfntly) {
736 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500737 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700738 }
739}
740
741optional("png") {
742 enabled = skia_use_libpng
743 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
744
mtklein63213812016-08-24 09:55:56 -0700745 deps = [
746 "//third_party/libpng",
747 ]
748 sources = [
749 "src/codec/SkIcoCodec.cpp",
750 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400751 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700752 ]
753}
754
scroggof84ad642016-10-31 09:02:57 -0700755optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400756 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700757 public_defines = [ "SK_CODEC_DECODES_RAW" ]
758
759 deps = [
760 "//third_party/dng_sdk",
761 "//third_party/libjpeg-turbo:libjpeg",
762 "//third_party/piex",
763 ]
764
765 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
766 # Skia.
767 configs_to_remove = [ "//gn:no_exceptions" ]
768
769 sources = [
scroggof84ad642016-10-31 09:02:57 -0700770 "src/codec/SkRawCodec.cpp",
771 ]
772}
773
Mike Klein852a8cb2018-05-15 10:46:58 -0400774import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400775source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400776 cflags = []
777 if (!is_win || is_clang) {
778 cflags += [
779 "-w",
780 "-std=c11",
781 ]
782 }
783
784 public = [
785 "third_party/skcms/skcms.h",
786 ]
787 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
788}
789
mtklein3cc22182016-08-29 13:26:14 -0700790optional("typeface_freetype") {
791 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700792
793 deps = [
794 "//third_party/freetype2",
795 ]
796 sources = [
797 "src/ports/SkFontHost_FreeType.cpp",
798 "src/ports/SkFontHost_FreeType_common.cpp",
799 ]
800}
801
mtklein457b42a2016-08-23 13:56:37 -0700802optional("webp") {
803 enabled = skia_use_libwebp
804 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
805
mtklein457b42a2016-08-23 13:56:37 -0700806 deps = [
807 "//third_party/libwebp",
808 ]
809 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700810 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400811 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700812 ]
mtkleineb3c4252016-08-23 07:38:09 -0700813}
814
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400815optional("wuffs") {
816 enabled = skia_use_wuffs
817 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
818
819 deps = [
820 "//third_party/wuffs",
821 ]
822 sources = [
823 "src/codec/SkWuffsCodec.cpp",
824 ]
825}
826
mtklein63213812016-08-24 09:55:56 -0700827optional("xml") {
828 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000829 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700830
mtklein63213812016-08-24 09:55:56 -0700831 deps = [
832 "//third_party/expat",
833 ]
834 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500835 "src/svg/SkSVGCanvas.cpp",
836 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700837 "src/xml/SkDOM.cpp",
838 "src/xml/SkXMLParser.cpp",
839 "src/xml/SkXMLWriter.cpp",
840 ]
841}
842
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700843if (skia_enable_gpu && skia_generate_workarounds) {
844 action("workaround_list") {
845 script = "tools/build_workaround_header.py"
846
847 inputs = [
848 "src/gpu/gpu_workaround_list.txt",
849 ]
850
851 # see comments in skia_compile_processors about out dir path shenanigans.
852 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700853 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700854
855 outputs = [
856 "$root_out_dir/$output_file",
857 ]
858 args = [
859 "--output-file",
860 "$output_file",
861 ]
862
863 foreach(file, inputs) {
864 args += [ rebase_path(file, root_build_dir) ]
865 }
866 }
867}
868
Mike Klein33ad63a2018-11-11 07:17:00 -0500869# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
870# TODO: rename :gpu_for_real back to :gpu when cleaning up.
871source_set("effects") {
872}
873source_set("gpu") {
874}
875
mtkleinc04ff472016-06-23 10:29:30 -0700876component("skia") {
877 public_configs = [ ":skia_public" ]
878 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700879
Mike Klein607b0a72018-11-07 16:17:34 -0500880 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500881 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500882 ":pdf",
883 ":skcms",
884 ]
885
mtkleinc04ff472016-06-23 10:29:30 -0700886 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700887 ":arm64",
888 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700889 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000890 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700891 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700892 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700893 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500894 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500895 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700896 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800897 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500898 ":fontmgr_wasm",
Leon Scroggins III41169202019-01-29 09:29:57 -0500899 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400900 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500901 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700902 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700903 ":none",
mtklein63213812016-08-24 09:55:56 -0700904 ":png",
scroggof84ad642016-10-31 09:02:57 -0700905 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700906 ":sse2",
907 ":sse41",
908 ":sse42",
909 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700910 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400911 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700912 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700913 ]
914
Kevin Lubick134be1d2018-10-30 15:05:04 -0400915 if (skia_enable_nima) {
916 deps += [ "//third_party/Nima-Cpp" ]
917 }
918
Chinmay Garde43f115c2016-11-16 15:04:12 -0800919 # This file (and all GN files in Skia) are designed to work with an
920 # empty sources assignment filter; we handle all that explicitly.
921 # We clear the filter here for clients who may have set up a global filter.
922 set_sources_assignment_filter([])
923
mtkleinc04ff472016-06-23 10:29:30 -0700924 sources = []
brettwb9447282016-09-01 14:24:39 -0700925 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700926 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500927 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000928 sources += skia_effects_sources
929 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700930 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400931 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500932 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700933 "src/android/SkBitmapRegionCodec.cpp",
934 "src/android/SkBitmapRegionDecoder.cpp",
935 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100936 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400937 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700938 "src/codec/SkBmpCodec.cpp",
939 "src/codec/SkBmpMaskCodec.cpp",
940 "src/codec/SkBmpRLECodec.cpp",
941 "src/codec/SkBmpStandardCodec.cpp",
942 "src/codec/SkCodec.cpp",
943 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400944 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400945 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700946 "src/codec/SkMaskSwizzler.cpp",
947 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700948 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700949 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700950 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700951 "src/codec/SkSwizzler.cpp",
952 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700953 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700954 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000955 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700956 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700957 "src/ports/SkMemory_malloc.cpp",
958 "src/ports/SkOSFile_stdio.cpp",
959 "src/sfnt/SkOTTable_name.cpp",
960 "src/sfnt/SkOTUtils.cpp",
961 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500962 "third_party/etc1/etc1.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700963 ]
brettwb9447282016-09-01 14:24:39 -0700964
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400965 defines = []
966 if (!skia_enable_skpicture) {
967 defines = [ "SK_DISABLE_SKPICTURE" ]
968 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000969 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400970 sources += [ "src/core/SkPicture_none.cpp" ]
971 }
972
mtklein7d6fb2c2016-08-25 14:50:44 -0700973 libs = []
974
mtkleinc04ff472016-06-23 10:29:30 -0700975 if (is_win) {
976 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400977 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700978 "src/ports/SkDebug_win.cpp",
979 "src/ports/SkFontHost_win.cpp",
980 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500981 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700982 "src/ports/SkImageEncoder_WIC.cpp",
983 "src/ports/SkImageGeneratorWIC.cpp",
984 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700985 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700986 "src/ports/SkScalerContext_win_dw.cpp",
987 "src/ports/SkTLS_win.cpp",
988 "src/ports/SkTypeface_win_dw.cpp",
989 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400990 libs += [
991 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500992 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400993 "Ole32.lib",
994 "OleAut32.lib",
995 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500996 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400997 ]
mtkleinc04ff472016-06-23 10:29:30 -0700998 } else {
999 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001000 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001001 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001002 "src/ports/SkTLS_pthread.cpp",
1003 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001004 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001005 }
1006
mtklein7d6fb2c2016-08-25 14:50:44 -07001007 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001008 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001009 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001010 deps += [ "//third_party/cpu-features" ]
1011 }
mtklein06c35c02016-09-20 12:28:12 -07001012 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001013 libs += [
1014 "EGL",
1015 "GLESv2",
1016 "log",
1017 ]
1018 }
1019
Kevin Lubick217056c2018-09-20 17:39:31 -04001020 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001021 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001022 if (skia_use_egl) {
1023 libs += [ "GLESv2" ]
1024 }
mtkleinc04ff472016-06-23 10:29:30 -07001025 }
1026
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001027 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001028 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001029 }
1030
mtkleinc04ff472016-06-23 10:29:30 -07001031 if (is_mac) {
1032 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001033 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001034 "src/ports/SkImageEncoder_CG.cpp",
1035 "src/ports/SkImageGeneratorCG.cpp",
1036 ]
mtklein09e61f72016-08-23 13:35:28 -07001037 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001038 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1039 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001040 "ApplicationServices.framework",
1041 "OpenGL.framework",
1042 ]
mtkleinc04ff472016-06-23 10:29:30 -07001043 }
abarth6fc8ff02016-07-15 15:15:15 -07001044
Mike Klein7d302882016-11-03 14:06:31 -04001045 if (is_ios) {
1046 sources += [
1047 "src/ports/SkDebug_stdio.cpp",
1048 "src/ports/SkFontHost_mac.cpp",
1049 "src/ports/SkImageEncoder_CG.cpp",
1050 "src/ports/SkImageGeneratorCG.cpp",
1051 ]
1052 libs += [
1053 "CoreFoundation.framework",
1054 "CoreGraphics.framework",
1055 "CoreText.framework",
1056 "ImageIO.framework",
1057 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001058
1059 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1060 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001061 ]
1062 }
1063
abarth6fc8ff02016-07-15 15:15:15 -07001064 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001065 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001066 }
mtkleinc04ff472016-06-23 10:29:30 -07001067}
1068
Kevin Lubickcbcff382018-10-02 09:02:18 -04001069static_library("pathkit") {
1070 public_configs = [ ":skia_public" ]
1071 configs += skia_library_configs
1072
1073 deps = [
1074 ":arm64",
1075 ":armv7",
1076 ":avx",
1077 ":crc32",
1078 ":hsw",
1079 ":none",
1080 ":sse2",
1081 ":sse41",
1082 ":sse42",
1083 ":ssse3",
1084 ]
1085
1086 # This file (and all GN files in Skia) are designed to work with an
1087 # empty sources assignment filter; we handle all that explicitly.
1088 # We clear the filter here for clients who may have set up a global filter.
1089 set_sources_assignment_filter([])
1090
1091 sources = []
1092 sources += skia_pathops_sources
1093 sources += [
1094 "src/core/SkAnalyticEdge.cpp",
1095 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001096 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001097 "src/core/SkCubicMap.cpp",
1098 "src/core/SkEdge.cpp",
1099 "src/core/SkEdgeBuilder.cpp",
1100 "src/core/SkEdgeClipper.cpp",
1101 "src/core/SkGeometry.cpp",
1102 "src/core/SkLineClipper.cpp",
1103 "src/core/SkMallocPixelRef.cpp",
1104 "src/core/SkMath.cpp",
1105 "src/core/SkMatrix.cpp",
1106 "src/core/SkOpts.cpp",
1107 "src/core/SkPaint.cpp",
1108 "src/core/SkPath.cpp",
1109 "src/core/SkPathEffect.cpp",
1110 "src/core/SkPathMeasure.cpp",
1111 "src/core/SkPathRef.cpp",
1112 "src/core/SkPoint.cpp",
1113 "src/core/SkRRect.cpp",
1114 "src/core/SkRect.cpp",
1115 "src/core/SkSemaphore.cpp",
1116 "src/core/SkStream.cpp",
1117 "src/core/SkString.cpp",
1118 "src/core/SkStringUtils.cpp",
1119 "src/core/SkStroke.cpp",
1120 "src/core/SkStrokeRec.cpp",
1121 "src/core/SkStrokerPriv.cpp",
1122 "src/core/SkThreadID.cpp",
1123 "src/core/SkUtils.cpp",
1124 "src/effects/SkDashPathEffect.cpp",
1125 "src/effects/SkTrimPathEffect.cpp",
1126 "src/ports/SkDebug_stdio.cpp",
1127 "src/ports/SkMemory_malloc.cpp",
1128 "src/utils/SkDashPath.cpp",
1129 "src/utils/SkParse.cpp",
1130 "src/utils/SkParsePath.cpp",
1131 "src/utils/SkUTF.cpp",
1132 ]
1133}
1134
mtkleinc095df52016-08-24 12:23:52 -07001135# Targets guarded by skia_enable_tools may use //third_party freely.
1136if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001137 # Used by gn_to_bp.py to list our public include dirs.
1138 source_set("public") {
1139 configs += [ ":skia_public" ]
1140 }
1141
Mike Kleinc36dedf2016-11-18 09:35:28 -05001142 config("skia.h_config") {
1143 include_dirs = [ "$target_gen_dir" ]
1144 }
1145 action("skia.h") {
1146 public_configs = [ ":skia.h_config" ]
1147 skia_h = "$target_gen_dir/skia.h"
1148 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001149
1150 # TODO: would be cool to not hard-code these here, but how?
1151 module_public_includes = [
1152 "modules/sksg/include",
1153 "modules/skottie/include",
1154 ]
1155 args =
1156 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1157 [ rebase_path(skia_h, root_build_dir) ] +
1158 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001159 depfile = "$skia_h.deps"
1160 outputs = [
1161 skia_h,
1162 ]
1163 }
1164
Brian Osmanc9a42472018-05-31 13:17:12 -04001165 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001166 executable("fiddle") {
1167 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001168 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001169 "tools/fiddle/draw.cpp",
1170 "tools/fiddle/fiddle_main.cpp",
1171 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001172
1173 if (skia_use_egl) {
1174 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001175 } else {
1176 sources += [ "tools/fiddle/null_context.cpp" ]
1177 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001178 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001179 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001180 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001181 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001182 ":skia",
1183 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001184 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001185 ]
1186 }
1187 }
1188
Brian Osmanc9a42472018-05-31 13:17:12 -04001189 source_set("public_headers_warnings_check") {
1190 sources = [
1191 "tools/public_headers_warnings_check.cpp",
1192 ]
1193 configs -= [ "//gn:warnings_except_public_headers" ]
1194 deps = [
1195 ":skia",
1196 ":skia.h",
1197 "modules/skottie",
1198 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001199
1200 # We add this directory to simulate the client already have
1201 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001202 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001203 }
1204
mtkleinc095df52016-08-24 12:23:52 -07001205 template("test_lib") {
1206 config(target_name + "_config") {
1207 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001208 if (defined(invoker.public_defines)) {
1209 defines = invoker.public_defines
1210 }
mtklein25c81d42016-07-27 13:55:26 -07001211 }
mtkleinc095df52016-08-24 12:23:52 -07001212 source_set(target_name) {
1213 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1214 public_configs = [
1215 ":" + target_name + "_config",
1216 ":skia_private",
1217 ]
1218
1219 if (!defined(deps)) {
1220 deps = []
1221 }
1222 deps += [ ":skia" ]
1223 testonly = true
1224 }
mtklein25c81d42016-07-27 13:55:26 -07001225 }
mtklein25c81d42016-07-27 13:55:26 -07001226
Mike Kleine6682eb2017-01-05 10:54:57 -05001227 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001228 if (is_ios) {
1229 app_name = target_name
1230 gen_path = target_gen_dir
1231
1232 action("${app_name}_generate_info_plist") {
1233 script = "//gn/gen_plist_ios.py"
1234 outputs = [
1235 "$gen_path/${app_name}_Info.plist",
1236 ]
1237 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1238 }
1239
1240 bundle_data("${app_name}_bundle_info_plist") {
1241 public_deps = [
1242 ":${app_name}_generate_info_plist",
1243 ]
1244 sources = [
1245 "$gen_path/${app_name}_Info.plist",
1246 ]
1247 outputs = [
1248 "{{bundle_root_dir}}/Info.plist",
1249 ]
1250 }
1251
Jim Van Verth329c5a62017-11-29 11:42:33 -05001252 bundle_ios_data =
1253 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1254
1255 if (bundle_ios_data) {
1256 has_skps =
1257 "True" == exec_script("//gn/checkdir.py",
1258 [ rebase_path("skps", root_build_dir) ],
1259 "trim string")
1260 bundle_data("${app_name}_bundle_resources") {
1261 sources = [
1262 "resources",
1263 ]
1264 outputs = [
1265 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1266 "{{bundle_resources_dir}}/data/resources",
1267 ]
1268 }
1269
1270 if (has_skps) {
1271 bundle_data("${app_name}_bundle_skps") {
1272 sources = [
1273 "skps",
1274 ]
1275 outputs = [
1276 # Store in same folder as resources
1277 "{{bundle_resources_dir}}/data/skps",
1278 ]
1279 }
1280 }
1281 }
1282
Jim Van Verth443a9132017-11-28 09:45:26 -05001283 executable("${app_name}_generate_executable") {
1284 forward_variables_from(invoker,
1285 "*",
1286 [
1287 "output_name",
1288 "visibility",
1289 "is_shared_library",
1290 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001291 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001292 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001293 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1294 }
1295
1296 bundle_data("${app_name}_bundle_executable") {
1297 public_deps = [
1298 ":${app_name}_generate_executable",
1299 ]
1300 sources = [
1301 "$gen_path/$app_name",
1302 ]
1303 outputs = [
1304 "{{bundle_executable_dir}}/$app_name",
1305 ]
1306 testonly = true
1307 }
1308
1309 create_bundle("$app_name") {
1310 product_type = "com.apple.product-type.application"
1311 testonly = true
1312
1313 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1314 bundle_resources_dir = bundle_root_dir
1315 bundle_executable_dir = bundle_root_dir
1316 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1317
1318 deps = [
1319 ":${app_name}_bundle_executable",
1320 ":${app_name}_bundle_info_plist",
1321 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001322 if (bundle_ios_data) {
1323 deps += [ ":${app_name}_bundle_resources" ]
1324 if (has_skps) {
1325 deps += [ ":${app_name}_bundle_skps" ]
1326 }
1327 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001328
1329 # should only code sign when running on a device, not the simulator
1330 if (target_cpu != "x64") {
1331 code_signing_script = "//gn/codesign_ios.py"
1332 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1333 code_signing_outputs = [
1334 "$bundle_root_dir/_CodeSignature/CodeResources",
1335 "$bundle_root_dir/embedded.mobileprovision",
1336 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001337 code_signing_args = [
1338 rebase_path("$bundle_root_dir", root_build_dir),
1339 skia_ios_identity,
1340 skia_ios_profile,
1341 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001342 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001343 }
1344 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001345 # !is_ios
1346
1347 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1348 shared_library("lib" + target_name) {
1349 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1350 configs += [ ":skia_private" ]
1351 testonly = true
1352 }
1353 } else {
1354 _executable = target_name
1355 executable(_executable) {
1356 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1357 configs += [ ":skia_private" ]
1358 testonly = true
1359 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001360 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001361 if (is_android && skia_android_serial != "" && defined(_executable)) {
1362 action("push_" + target_name) {
1363 script = "gn/push_to_android.py"
1364 deps = [
1365 ":" + _executable,
1366 ]
1367 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1368 outputs = [
1369 _stamp,
1370 ]
1371 args = [
1372 rebase_path("$root_build_dir/$_executable"),
1373 skia_android_serial,
1374 rebase_path(_stamp),
1375 ]
1376 testonly = true
1377 }
Mike Klein7d921032017-01-05 12:20:41 -05001378 }
1379 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001380 }
1381
Greg Danielda16cce2018-08-01 09:23:57 -04001382 config("moltenvk_config") {
1383 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1384 if (is_ios) {
1385 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1386 } else {
1387 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1388 }
1389 cflags = [ "-F$moltenvk_framework_path" ]
1390 ldflags = [ "-F$moltenvk_framework_path" ]
1391 libs = [
1392 "MoltenVK.framework",
1393 "Metal.framework",
1394 "IOSurface.framework",
1395 "QuartzCore.framework",
1396 "Foundation.framework",
1397 ]
1398 if (is_ios) {
1399 libs += [ "UIKit.framework" ]
1400 } else {
1401 libs += [ "IOKit.framework" ]
1402 }
1403 defines = [ "SK_MOLTENVK" ]
1404 }
1405 }
1406
1407 source_set("moltenvk") {
1408 public_configs = [ ":moltenvk_config" ]
1409 }
1410
mtkleinc095df52016-08-24 12:23:52 -07001411 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001412 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001413 public_defines = []
1414 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001415
Brian Osmanc9a42472018-05-31 13:17:12 -04001416 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001417 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001418 sources = [
1419 "tools/gpu/GrContextFactory.cpp",
1420 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001421 "tools/gpu/MemoryCache.cpp",
1422 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001423 "tools/gpu/ProxyUtils.cpp",
1424 "tools/gpu/TestContext.cpp",
1425 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1426 "tools/gpu/gl/GLTestContext.cpp",
1427 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001428 "tools/gpu/gl/null/NullGLTestContext.cpp",
1429 "tools/gpu/mock/MockTestContext.cpp",
1430 ]
1431 libs = []
1432
1433 if (is_android || skia_use_egl) {
1434 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1435 } else if (is_ios) {
1436 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1437 libs += [ "OpenGLES.framework" ]
1438 } else if (is_linux) {
1439 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001440 libs += [
1441 "GLU",
1442 "X11",
1443 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001444 } else if (is_mac) {
1445 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1446 } else if (is_win) {
1447 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001448 libs += [ "Gdi32.lib" ]
1449 if (target_cpu != "arm64") {
1450 libs += [ "OpenGL32.lib" ]
1451 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001452 }
mtklein25c81d42016-07-27 13:55:26 -07001453
Brian Osmanc9a42472018-05-31 13:17:12 -04001454 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001455
Brian Osmanc9a42472018-05-31 13:17:12 -04001456 if (skia_use_angle) {
1457 deps += [ "//third_party/angle2" ]
1458 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1459 }
Greg Daniel54200e42018-12-11 17:03:39 -05001460
Greg Daniel487132b2018-12-20 14:09:36 -05001461 public_include_dirs += [ "include/third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001462 if (skia_use_vulkan) {
1463 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1464 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001465 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1466 public_deps += [ ":moltenvk" ]
1467 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001468 }
1469 if (skia_use_metal) {
1470 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001471 }
mtklein25c81d42016-07-27 13:55:26 -07001472 }
mtklein25c81d42016-07-27 13:55:26 -07001473
mtkleinc095df52016-08-24 12:23:52 -07001474 test_lib("flags") {
1475 public_include_dirs = [ "tools/flags" ]
1476 sources = [
1477 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001478 ]
1479 }
1480 test_lib("common_flags") {
1481 public_include_dirs = [ "tools/flags" ]
1482 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001483 "tools/flags/SkCommonFlags.cpp",
1484 "tools/flags/SkCommonFlagsConfig.cpp",
1485 ]
1486 deps = [
mtklein046cb562016-09-16 10:23:12 -07001487 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001488 ]
1489 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001490 ":gpu_tool_utils",
1491 ]
1492 }
mtklein25c81d42016-07-27 13:55:26 -07001493
mtkleinc095df52016-08-24 12:23:52 -07001494 test_lib("tool_utils") {
1495 public_include_dirs = [
1496 "tools",
1497 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001498 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001499 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001500 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001501 ]
1502 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001503 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001504 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001505 "tools/DDLPromiseImageHelper.cpp",
1506 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001507 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001508 "tools/ProcStats.cpp",
1509 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001510 "tools/UrlDataManager.cpp",
1511 "tools/debugger/SkDebugCanvas.cpp",
1512 "tools/debugger/SkDrawCommand.cpp",
1513 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001514 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001515 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001516 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001517 "tools/fonts/SkTestFontMgr.h",
1518 "tools/fonts/SkTestSVGTypeface.cpp",
1519 "tools/fonts/SkTestSVGTypeface.h",
1520 "tools/fonts/SkTestTypeface.cpp",
1521 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001522 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001523 "tools/random_parse_path.cpp",
1524 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001525 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001526 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001527 "tools/trace/SkChromeTracingTracer.cpp",
1528 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001529 "tools/trace/SkDebugfTracer.cpp",
1530 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001531 "tools/trace/SkEventTracingPriv.cpp",
1532 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001533 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001534 libs = []
1535 if (is_ios) {
1536 sources += [ "tools/ios_utils.m" ]
1537 libs += [ "Foundation.framework" ]
1538 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001539 defines = []
1540 if (skia_tools_require_resources) {
1541 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1542 }
mtkleinc095df52016-08-24 12:23:52 -07001543 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001544 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001545 ":flags",
1546 "//third_party/libpng",
1547 ]
1548 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001549 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001550 ]
1551 }
mtklein25c81d42016-07-27 13:55:26 -07001552
Mike Klein6e744122016-10-27 12:21:40 -04001553 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001554 test_lib("gm") {
1555 public_include_dirs = [ "gm" ]
1556 sources = gm_sources
1557 deps = [
scroggo19b91532016-10-24 09:03:26 -07001558 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001559 ":skia",
1560 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001561 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001562 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001563 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001564 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001565 public_deps = [
1566 ":gpu_tool_utils",
1567 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001568 if (skia_enable_skshaper) {
1569 deps += [ "modules/skshaper" ]
1570 defines = [ "SK_USING_SKSHAPER" ]
1571 }
mtkleinc095df52016-08-24 12:23:52 -07001572 }
mtklein25c81d42016-07-27 13:55:26 -07001573
Mike Klein6e744122016-10-27 12:21:40 -04001574 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001575 test_lib("tests") {
1576 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001577 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001578 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001579 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001580 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001581 if (!(skia_use_freetype && skia_use_fontconfig)) {
1582 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1583 }
mtkleinc095df52016-08-24 12:23:52 -07001584 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001585 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001586 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001587 ":skia",
1588 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001589 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001590 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001591 "//third_party/libpng",
1592 "//third_party/zlib",
1593 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001594 public_deps = [
1595 ":gpu_tool_utils", # Test.h #includes headers from this target.
1596 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001597 if (skia_enable_skshaper) {
1598 deps += [ "modules/skshaper" ]
1599 defines = [ "SK_USING_SKSHAPER" ]
1600 }
mtkleinc095df52016-08-24 12:23:52 -07001601 }
mtklein2f3416d2016-08-02 16:02:05 -07001602
Mike Klein6e744122016-10-27 12:21:40 -04001603 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001604 test_lib("bench") {
1605 public_include_dirs = [ "bench" ]
1606 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001607 deps = [
1608 ":flags",
1609 ":gm",
1610 ":gpu_tool_utils",
1611 ":skia",
1612 ":tool_utils",
1613 ]
1614 }
mtklein2b6870c2016-07-28 14:17:33 -07001615
mtkleinc095df52016-08-24 12:23:52 -07001616 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001617 public_include_dirs = []
1618 if (skia_use_expat) {
1619 public_include_dirs += [ "experimental/svg/model" ]
1620 sources = [
1621 "experimental/svg/model/SkSVGAttribute.cpp",
1622 "experimental/svg/model/SkSVGAttributeParser.cpp",
1623 "experimental/svg/model/SkSVGCircle.cpp",
1624 "experimental/svg/model/SkSVGClipPath.cpp",
1625 "experimental/svg/model/SkSVGContainer.cpp",
1626 "experimental/svg/model/SkSVGDOM.cpp",
1627 "experimental/svg/model/SkSVGEllipse.cpp",
1628 "experimental/svg/model/SkSVGGradient.cpp",
1629 "experimental/svg/model/SkSVGLine.cpp",
1630 "experimental/svg/model/SkSVGLinearGradient.cpp",
1631 "experimental/svg/model/SkSVGNode.cpp",
1632 "experimental/svg/model/SkSVGPath.cpp",
1633 "experimental/svg/model/SkSVGPattern.cpp",
1634 "experimental/svg/model/SkSVGPoly.cpp",
1635 "experimental/svg/model/SkSVGRadialGradient.cpp",
1636 "experimental/svg/model/SkSVGRect.cpp",
1637 "experimental/svg/model/SkSVGRenderContext.cpp",
1638 "experimental/svg/model/SkSVGSVG.cpp",
1639 "experimental/svg/model/SkSVGShape.cpp",
1640 "experimental/svg/model/SkSVGStop.cpp",
1641 "experimental/svg/model/SkSVGTransformableNode.cpp",
1642 "experimental/svg/model/SkSVGUse.cpp",
1643 "experimental/svg/model/SkSVGValue.cpp",
1644 ]
1645 deps = [
1646 ":skia",
1647 ":xml",
1648 ]
1649 }
mtkleinc095df52016-08-24 12:23:52 -07001650 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001651
Mike Klein38af9432016-11-11 11:39:44 -05001652 if (skia_use_lua) {
1653 test_lib("lua") {
1654 public_include_dirs = []
1655 sources = [
1656 "src/utils/SkLua.cpp",
1657 "src/utils/SkLuaCanvas.cpp",
1658 ]
1659 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001660 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001661 "//third_party/lua",
1662 ]
1663 }
1664
Mike Kleine6682eb2017-01-05 10:54:57 -05001665 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001666 sources = [
1667 "tools/lua/lua_app.cpp",
1668 ]
1669 deps = [
1670 ":lua",
1671 ":skia",
1672 "//third_party/lua",
1673 ]
Mike Klein38af9432016-11-11 11:39:44 -05001674 }
1675
Mike Kleine6682eb2017-01-05 10:54:57 -05001676 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001677 sources = [
1678 "tools/lua/lua_pictures.cpp",
1679 ]
1680 deps = [
1681 ":flags",
1682 ":lua",
1683 ":skia",
1684 ":tool_utils",
1685 "//third_party/lua",
1686 ]
Mike Klein38af9432016-11-11 11:39:44 -05001687 }
1688 }
1689
Cary Clark8032b982017-07-28 11:04:54 -04001690 test_app("bookmaker") {
1691 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001692 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001693 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001694 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001695 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001696 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001697 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001698 "tools/bookmaker/includeParser.cpp",
1699 "tools/bookmaker/includeWriter.cpp",
1700 "tools/bookmaker/mdOut.cpp",
1701 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001702 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001703 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001704 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001705 ]
1706 deps = [
1707 ":flags",
1708 ":skia",
1709 ":tool_utils",
1710 ]
1711 }
1712
Florin Malitabfe876a2018-09-02 12:33:59 -04001713 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001714 test_app("skottie_tool") {
1715 deps = [
1716 "modules/skottie:tool",
1717 ]
1718 }
1719 }
1720
Kevin Lubickebf648e2017-09-21 13:45:16 -04001721 if (target_cpu != "wasm") {
1722 import("gn/samples.gni")
1723 test_lib("samples") {
1724 public_include_dirs = [ "samplecode" ]
1725 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001726 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001727 public_deps = [
1728 ":tool_utils",
1729 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001730 deps = [
1731 ":experimental_svg_model",
1732 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001733 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001734 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001735 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001736 ]
Mike Klein38af9432016-11-11 11:39:44 -05001737
Ruiqi Maof5101492018-06-29 14:32:21 -04001738 # NIMA does not build on Windows clang
1739 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001740 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001741 deps += [ "//third_party/Nima-Cpp" ]
1742 }
1743
Kevin Lubickebf648e2017-09-21 13:45:16 -04001744 if (skia_use_lua) {
1745 sources += [ "samplecode/SampleLua.cpp" ]
1746 deps += [
1747 ":lua",
1748 "//third_party/lua",
1749 ]
1750 }
1751 }
Mike Klein7af351a2018-07-27 09:54:43 -04001752 test_app("imgcvt") {
1753 sources = [
1754 "tools/imgcvt.cpp",
1755 ]
1756 deps = [
1757 ":skcms",
1758 ":skia",
1759 ]
1760 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001761 test_app("dm") {
1762 sources = [
1763 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001764 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001765 "dm/DMJsonWriter.cpp",
1766 "dm/DMSrcSink.cpp",
1767 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001768 deps = [
1769 ":common_flags",
1770 ":experimental_svg_model",
1771 ":flags",
1772 ":gm",
1773 ":gpu_tool_utils",
1774 ":skia",
1775 ":tests",
1776 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001777 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001778 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001779 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001780 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001781 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001782
1783 # NIMA does not build on Windows clang
1784 if (!is_win || !is_clang) {
1785 deps += [ "//third_party/Nima-Cpp" ]
1786 }
Mike Klein38af9432016-11-11 11:39:44 -05001787 }
Brian Osman16adfa32016-10-18 14:42:44 -04001788 }
1789
Mike Kleina8a51ce2018-01-09 12:34:11 -05001790 if (!is_win) {
1791 test_app("remote_demo") {
1792 sources = [
1793 "tools/remote_demo.cpp",
1794 ]
1795 deps = [
1796 ":skia",
1797 ]
1798 }
1799 }
1800
Mike Kleine6682eb2017-01-05 10:54:57 -05001801 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001802 sources = [
1803 "bench/nanobench.cpp",
1804 ]
1805 deps = [
1806 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001807 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001808 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001809 ":flags",
1810 ":gm",
1811 ":gpu_tool_utils",
1812 ":skia",
1813 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001814 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001815 ]
mtklein2b6870c2016-07-28 14:17:33 -07001816 }
halcanary19a97202016-08-03 15:08:04 -07001817
Ravi Mistry10d36c52017-01-31 09:49:18 -05001818 test_app("skpinfo") {
1819 sources = [
1820 "tools/skpinfo.cpp",
1821 ]
1822 deps = [
1823 ":flags",
1824 ":skia",
1825 ]
1826 }
1827
Brian Osmanc9a42472018-05-31 13:17:12 -04001828 test_app("skpbench") {
1829 sources = [
1830 "tools/skpbench/skpbench.cpp",
1831 ]
1832 deps = [
1833 ":flags",
1834 ":gpu_tool_utils",
1835 ":skia",
1836 ":tool_utils",
1837 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001838 }
1839
Mike Kleine6682eb2017-01-05 10:54:57 -05001840 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001841 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001842 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001843 ]
1844 deps = [
1845 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001846 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001847 ]
halcanary3eee9d92016-09-10 07:01:53 -07001848 }
mtklein046cb562016-09-16 10:23:12 -07001849
Ben Wagner219f3622017-07-17 15:32:25 -04001850 test_app("create_test_font") {
1851 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001852 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001853 ]
1854 deps = [
1855 ":skia",
1856 ]
1857 assert_no_deps = [
1858 # tool_utils requires the output of this app.
1859 ":tool_utils",
1860 ]
1861 }
1862
Florin Malita5d3ff432018-07-31 16:38:43 -04001863 if (skia_use_expat) {
1864 test_app("create_test_font_color") {
1865 sources = [
1866 "tools/fonts/create_test_font_color.cpp",
1867 ]
1868 deps = [
1869 ":flags",
1870 ":skia",
1871 ":tool_utils",
1872 ]
1873 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001874 }
1875
Mike Kleine6682eb2017-01-05 10:54:57 -05001876 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001877 sources = [
1878 "tools/get_images_from_skps.cpp",
1879 ]
1880 deps = [
1881 ":flags",
1882 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001883 ]
mtklein046cb562016-09-16 10:23:12 -07001884 }
mtkleinecbc5262016-09-22 11:51:24 -07001885
Brian Osman6788a542018-12-10 11:56:01 -05001886 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001887 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001888 sources = [
1889 "tools/skiaserve/Request.cpp",
1890 "tools/skiaserve/Response.cpp",
1891 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001892 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1893 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1894 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1895 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1896 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1897 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1898 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1899 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1900 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001901 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1902 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001903 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1904 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1905 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1906 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1907 ]
1908 deps = [
1909 ":flags",
1910 ":gpu_tool_utils",
1911 ":skia",
1912 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001913 "//third_party/libmicrohttpd",
1914 "//third_party/libpng",
1915 ]
Mike Klein7d302882016-11-03 14:06:31 -04001916 }
mtkleinecbc5262016-09-22 11:51:24 -07001917 }
kjlubick14f984b2016-10-03 11:49:45 -07001918
Mike Kleine6682eb2017-01-05 10:54:57 -05001919 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001920 include_dirs = [
1921 "tools",
1922 "tools/debugger",
Kevin Lubickec1c6202018-12-14 11:42:53 -05001923 "tools/fonts",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001924 ]
kjlubick14f984b2016-10-03 11:49:45 -07001925 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001926 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001927 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001928 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001929 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001930 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001931 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001932 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001933 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001934 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001935 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001936 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001937 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001938 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001939 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1940 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001941 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001942 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001943 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001944 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001945 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1946 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001947 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001948 "tools/UrlDataManager.cpp",
1949 "tools/debugger/SkDebugCanvas.cpp",
1950 "tools/debugger/SkDrawCommand.cpp",
1951 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001952 ]
1953 deps = [
1954 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001955 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001956 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001957 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001958 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001959 ]
kjlubick14f984b2016-10-03 11:49:45 -07001960 }
Mike Klein38312422016-10-05 15:41:01 -04001961
Mike Kleine6682eb2017-01-05 10:54:57 -05001962 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001963 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001964 rebase_path("tests/skia_test.cpp"),
1965 rebase_path("tests/Test.cpp"),
1966 ]
caryclark9feb6322016-10-25 08:58:26 -07001967 deps = [
1968 ":flags",
1969 ":gpu_tool_utils",
1970 ":skia",
1971 ":tool_utils",
1972 ]
caryclark9feb6322016-10-25 08:58:26 -07001973 }
1974
Mike Kleine6682eb2017-01-05 10:54:57 -05001975 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001976 sources = [
1977 "tools/DumpRecord.cpp",
1978 "tools/dump_record.cpp",
1979 ]
1980 deps = [
1981 ":flags",
1982 ":skia",
1983 ]
Mike Klein38312422016-10-05 15:41:01 -04001984 }
bungemanfe917272016-10-13 17:36:40 -04001985
Mike Kleine6682eb2017-01-05 10:54:57 -05001986 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001987 sources = [
1988 "tools/skdiff/skdiff.cpp",
1989 "tools/skdiff/skdiff_html.cpp",
1990 "tools/skdiff/skdiff_main.cpp",
1991 "tools/skdiff/skdiff_utils.cpp",
1992 ]
1993 deps = [
1994 ":skia",
1995 ":tool_utils",
1996 ]
bungemanfe917272016-10-13 17:36:40 -04001997 }
halcanarya73d76a2016-10-17 13:19:02 -07001998
Mike Kleine6682eb2017-01-05 10:54:57 -05001999 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002000 sources = [
2001 "tools/skp_parser.cpp",
2002 ]
2003 deps = [
2004 ":skia",
2005 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002006 ]
halcanarya73d76a2016-10-17 13:19:02 -07002007 }
Brian Osman16adfa32016-10-18 14:42:44 -04002008
Brian Osmanc9a42472018-05-31 13:17:12 -04002009 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002010 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05002011 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002012 defines =
2013 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002014 sources = [
2015 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002016 "tools/skqp/src/skqp.cpp",
2017 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002018 ]
2019 deps = [
2020 ":gm",
2021 ":gpu_tool_utils",
2022 ":skia",
2023 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002024 ":tool_utils",
2025 ]
2026 }
2027 test_app("skqp") {
2028 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002029 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002030 ]
2031 deps = [
2032 ":skia",
2033 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002034 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002035 ]
2036 }
2037 test_app("jitter_gms") {
2038 sources = [
2039 "tools/skqp/jitter_gms.cpp",
2040 ]
2041 deps = [
2042 ":gm",
2043 ":skia",
2044 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002045 ]
2046 }
2047 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002048 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002049 test_app("skqp_app") {
2050 is_shared_library = true
2051 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002052 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002053 ]
2054 deps = [
2055 ":skia",
2056 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002057 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002058 ]
2059 libs = [ "android" ]
2060 }
2061 }
Stan Iliev93151722018-08-02 11:10:52 -04002062 if (is_android && skia_enable_gpu) {
2063 test_app("skottie_android") {
2064 is_shared_library = true
2065
2066 sources = [
2067 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2068 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2069 ]
2070 libs = []
2071
2072 include_dirs = []
2073 deps = [
2074 ":skia",
2075 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002076 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002077 ]
2078 }
2079 }
Hal Canary75427132017-10-11 16:00:31 -04002080
Hal Canarya9de7602018-01-19 13:08:23 -05002081 test_app("list_gms") {
2082 sources = [
2083 "tools/list_gms.cpp",
2084 ]
2085 deps = [
2086 ":gm",
2087 ":skia",
2088 ]
2089 }
2090 test_app("list_gpu_unit_tests") {
2091 sources = [
2092 "dm/DMGpuTestProcs.cpp",
2093 "tools/list_gpu_unit_tests.cpp",
2094 ]
2095 deps = [
2096 ":skia",
2097 ":tests",
2098 ]
2099 }
2100
Brian Osmanc9a42472018-05-31 13:17:12 -04002101 test_lib("sk_app") {
2102 public_include_dirs = [ "tools/sk_app" ]
2103 sources = [
2104 "tools/sk_app/CommandSet.cpp",
2105 "tools/sk_app/GLWindowContext.cpp",
2106 "tools/sk_app/Window.cpp",
2107 ]
2108 libs = []
2109
2110 if (is_android) {
2111 sources += [
2112 "tools/sk_app/android/GLWindowContext_android.cpp",
2113 "tools/sk_app/android/RasterWindowContext_android.cpp",
2114 "tools/sk_app/android/Window_android.cpp",
2115 "tools/sk_app/android/main_android.cpp",
2116 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002117 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002118 libs += [ "android" ]
2119 } else if (is_linux) {
2120 sources += [
2121 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2122 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2123 "tools/sk_app/unix/Window_unix.cpp",
2124 "tools/sk_app/unix/keysym2ucs.c",
2125 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002126 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002127 libs += [
2128 "GL",
2129 "X11",
2130 ]
2131 } else if (is_win) {
2132 sources += [
2133 "tools/sk_app/win/GLWindowContext_win.cpp",
2134 "tools/sk_app/win/RasterWindowContext_win.cpp",
2135 "tools/sk_app/win/Window_win.cpp",
2136 "tools/sk_app/win/main_win.cpp",
2137 ]
Brian Salomon194db172017-08-17 14:37:06 -04002138 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002139 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002140 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002141 } else if (is_mac) {
2142 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002143 "tools/sk_app/mac/GLWindowContext_mac.mm",
2144 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2145 "tools/sk_app/mac/Window_mac.mm",
2146 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002147 ]
2148 libs += [
2149 "QuartzCore.framework",
2150 "Cocoa.framework",
2151 "Foundation.framework",
2152 ]
2153 } else if (is_ios) {
2154 sources += [
2155 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2156 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2157 "tools/sk_app/ios/Window_ios.cpp",
2158 "tools/sk_app/ios/main_ios.cpp",
2159 ]
2160 }
2161
2162 if (skia_use_vulkan) {
2163 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2164 if (is_android) {
2165 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2166 } else if (is_linux) {
2167 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2168 libs += [ "X11-xcb" ]
2169 } else if (is_win) {
2170 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002171 } else if (is_mac) {
2172 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2173 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002174 }
2175 }
2176
Jim Van Verthbe39f712019-02-08 15:36:14 -05002177 if (skia_use_metal) {
2178 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2179 if (is_mac) {
2180 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2181 }
2182 libs += [ "MetalKit.framework" ]
2183 }
2184
Brian Osmanc9a42472018-05-31 13:17:12 -04002185 deps = [
2186 ":gpu_tool_utils",
2187 ":skia",
2188 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002189 ]
2190 if (is_android) {
2191 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002192 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002193 deps += [ "//third_party/libsdl" ]
2194 }
2195 if (skia_use_angle) {
2196 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002197 }
Brian Osman16adfa32016-10-18 14:42:44 -04002198 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002199
Brian Osmanc9a42472018-05-31 13:17:12 -04002200 test_app("viewer") {
2201 is_shared_library = is_android
2202 if (is_ios) {
2203 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002204 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002205 sources = [
2206 "tools/viewer/BisectSlide.cpp",
2207 "tools/viewer/GMSlide.cpp",
2208 "tools/viewer/ImGuiLayer.cpp",
2209 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002210 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002211 "tools/viewer/SKPSlide.cpp",
2212 "tools/viewer/SampleSlide.cpp",
2213 "tools/viewer/SkottieSlide.cpp",
2214 "tools/viewer/SlideDir.cpp",
2215 "tools/viewer/StatsLayer.cpp",
2216 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002217 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002218 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002219 "tools/viewer/Viewer.cpp",
2220 ]
2221 libs = []
2222
Kevin Lubickd9699322018-10-30 15:08:53 -04002223 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002224 deps = [
2225 ":experimental_svg_model",
2226 ":flags",
2227 ":gm",
2228 ":gpu_tool_utils",
2229 ":samples",
2230 ":sk_app",
2231 ":skia",
2232 ":tool_utils",
Brian Osman7c979f52019-02-12 13:27:51 -05002233 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002234 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002235 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002236 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002237 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002238 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002239 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002240
2241 # NIMA does not build on Windows clang
2242 if (!is_win || !is_clang) {
2243 sources += [ "tools/viewer/NIMASlide.cpp" ]
2244 deps += [ "//third_party/Nima-Cpp" ]
2245 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002246 }
2247
ziadbbceddbc2018-06-19 13:57:15 -04002248 if (is_android) {
2249 test_app("arcore") {
2250 is_shared_library = true
2251 configs = [
2252 ":skia_public",
2253 "gn:default",
2254 ]
2255
2256 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2257 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2258 sources = []
2259 sources += skia_core_sources
2260 sources += skia_utils_sources
2261 sources += skia_xps_sources
2262 sources += [
2263 "src/android/SkAndroidFrameworkUtils.cpp",
2264 "src/android/SkAnimatedImage.cpp",
2265 "src/android/SkBitmapRegionCodec.cpp",
2266 "src/android/SkBitmapRegionDecoder.cpp",
2267 "src/codec/SkAndroidCodec.cpp",
2268 "src/codec/SkBmpBaseCodec.cpp",
2269 "src/codec/SkBmpCodec.cpp",
2270 "src/codec/SkBmpMaskCodec.cpp",
2271 "src/codec/SkBmpRLECodec.cpp",
2272 "src/codec/SkBmpStandardCodec.cpp",
2273 "src/codec/SkCodec.cpp",
2274 "src/codec/SkCodecImageGenerator.cpp",
2275 "src/codec/SkColorTable.cpp",
2276 "src/codec/SkGifCodec.cpp",
2277 "src/codec/SkMaskSwizzler.cpp",
2278 "src/codec/SkMasks.cpp",
2279 "src/codec/SkSampledCodec.cpp",
2280 "src/codec/SkSampler.cpp",
2281 "src/codec/SkStreamBuffer.cpp",
2282 "src/codec/SkSwizzler.cpp",
2283 "src/codec/SkWbmpCodec.cpp",
2284 "src/images/SkImageEncoder.cpp",
2285 "src/ports/SkDiscardableMemory_none.cpp",
2286 "src/ports/SkImageGenerator_skia.cpp",
2287 "src/ports/SkMemory_malloc.cpp",
2288 "src/ports/SkOSFile_stdio.cpp",
2289 "src/sfnt/SkOTTable_name.cpp",
2290 "src/sfnt/SkOTUtils.cpp",
2291 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -05002292 "third_party/etc1/etc1.cpp",
ziadbbceddbc2018-06-19 13:57:15 -04002293 "third_party/gif/SkGifImageReader.cpp",
2294 ]
2295 deps = [
2296 ":tool_utils",
2297 "modules/skottie",
2298 "modules/skshaper",
2299 ]
2300 }
2301 }
2302
Brian Osmanc9a42472018-05-31 13:17:12 -04002303 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002304 test_app("HelloWorld") {
2305 sources = [
2306 "example/HelloWorld.cpp",
2307 ]
2308 libs = []
2309
2310 include_dirs = []
2311 deps = [
2312 ":flags",
2313 ":gpu_tool_utils",
2314 ":sk_app",
2315 ":skia",
2316 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002317 ]
2318 }
2319 }
2320
Brian Osmanc9a42472018-05-31 13:17:12 -04002321 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002322 test_app("SkiaSDLExample") {
2323 sources = [
2324 "example/SkiaSDLExample.cpp",
2325 ]
2326 libs = []
2327 include_dirs = []
2328 deps = [
2329 ":gpu_tool_utils",
2330 ":skia",
2331 "//third_party/libsdl",
2332 ]
2333 }
2334 }
2335
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002336 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2337 action_foreach("generate_mocs") {
2338 script = "gn/call.py"
2339 sources = [
2340 "tools/mdbviz/MainWindow.h",
2341 ]
2342 outputs = [
2343 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2344 ]
2345 args = [
2346 "$skia_qt_path" + "/bin/moc",
2347 "{{source}}",
2348 "-o",
2349 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2350 ]
2351 }
2352 action_foreach("generate_resources") {
2353 script = "gn/call.py"
2354 sources = [
2355 "tools/mdbviz/resources.qrc",
2356 ]
2357 outputs = [
2358 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2359 ]
2360 args = [
2361 "$skia_qt_path" + "/bin/rcc",
2362 "{{source}}",
2363 "-o",
2364 "gen/mdbviz/{{source_name_part}}_res.cpp",
2365 ]
2366 }
2367 test_app("mdbviz") {
2368 if (is_win) {
2369 # on Windows we need to disable some exception handling warnings due to the Qt headers
2370 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2371 }
2372 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002373 "tools/UrlDataManager.cpp",
2374 "tools/debugger/SkDebugCanvas.cpp",
2375 "tools/debugger/SkDrawCommand.cpp",
2376 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002377 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002378 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002379 "tools/mdbviz/main.cpp",
2380
2381 # generated files
2382 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2383 "$target_gen_dir/mdbviz/resources_res.cpp",
2384 ]
2385 lib_dirs = [ "$skia_qt_path/lib" ]
2386 libs = [
2387 "Qt5Core.lib",
2388 "Qt5Gui.lib",
2389 "Qt5Widgets.lib",
2390 ]
2391 include_dirs = [
2392 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002393 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002394 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002395 "tools",
2396 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002397 ]
2398 deps = [
2399 ":generate_mocs",
2400 ":generate_resources",
2401 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002402 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002403 ]
2404 }
2405 }
2406
Mike Kleine459afd2017-03-03 09:21:30 -05002407 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002408 copy("gdbserver") {
2409 sources = [
2410 "$ndk/$ndk_gdbserver",
2411 ]
2412 outputs = [
2413 "$root_out_dir/gdbserver",
2414 ]
2415 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002416 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002417
2418 if (skia_use_opencl) {
2419 test_app("hello-opencl") {
2420 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002421 "tools/hello-opencl.cpp",
2422 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002423 deps = [
2424 "//third_party/opencl",
2425 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002426 }
2427 }
mtklein25c81d42016-07-27 13:55:26 -07002428}