blob: c34d99aec39f1164c9e2358089c68da948eccc06 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07009
Forrest Reiling30229ac2017-04-17 13:36:39 -070010if (is_fuchsia) {
11 import("//build/vulkan/config.gni")
12}
13
Mike Klein3669a822017-03-03 10:55:02 -050014if (!defined(is_skia_standalone)) {
15 is_skia_standalone = false
16}
17is_skia_dev_build = is_skia_standalone && !is_official_build
18
mtkleinc04ff472016-06-23 10:29:30 -070019declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040020 skia_enable_flutter_defines = false
21}
22
23declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000024 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040025 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070026 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070027 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050028 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070029 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050030 skia_use_fixed_gamma_text = is_android
Mike Klein7d302882016-11-03 14:06:31 -040031 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070032 skia_use_libjpeg_turbo = true
33 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070034 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050035 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040036 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040037 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040038 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070039 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040040 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040041 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070042 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070043
Mike Klein7d921032017-01-05 12:20:41 -050044 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040045 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000046 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050047 skia_enable_discrete_gpu = true
Brian Osman74511012018-04-02 20:13:46 +000048 skia_enable_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040049 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050050 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040051 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040052 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050053 skia_enable_tools = is_skia_dev_build
54 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040055 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040056 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070057 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070058 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040059
Hal 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",
scroggo19b91532016-10-24 09:03:26 -0700170 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700171 ]
mtklein150d1132016-08-01 06:56:40 -0700172
Mike Reeda9e241d2017-05-03 10:52:00 -0400173 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500174 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700175 defines += [
176 "SK_GAMMA_EXPONENT=1.4",
177 "SK_GAMMA_CONTRAST=0.0",
178 ]
179 }
mtklein88a7ac02016-09-14 11:16:49 -0700180 if (is_official_build || is_android) {
181 # TODO(bsalomon): it'd be nice to make Android normal.
182 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
183 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400184 libs = []
185 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500186 if (skia_enable_gpu) {
187 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500188 if (is_skia_dev_build && skia_use_vulkan) {
189 include_dirs += [ "tools/gpu/vk" ]
190 }
Brian Salomon03e05842017-02-23 12:23:47 -0500191 }
Brian Osman34755e22016-12-05 09:46:02 -0500192 if (skia_use_angle) {
193 defines += [ "SK_ANGLE" ]
194 }
Brian Osman3f375d02016-12-28 11:19:22 -0500195 if (skia_enable_discrete_gpu) {
196 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
197 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400198 if (!is_official_build) {
199 defines += [ "GR_TEST_UTILS=1" ]
200 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400201 if (skia_llvm_path != "") {
202 defines += [ "SK_LLVM_AVAILABLE" ]
203 include_dirs += [ "$skia_llvm_path/include" ]
204 libs += [ skia_llvm_lib ]
205 lib_dirs += [ "$skia_llvm_path/lib/" ]
206 }
mtkleinc04ff472016-06-23 10:29:30 -0700207}
208
209# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
210config("skia_library") {
211 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700212 defines = [ "SKIA_IMPLEMENTATION=1" ]
213}
214
215skia_library_configs = [
216 ":skia_public",
217 ":skia_private",
218 ":skia_library",
219]
220
mtklein9b8583d2016-08-24 17:32:30 -0700221# Use for CPU-specific Skia code that needs particular compiler flags.
222template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500223 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700224 if (invoker.enabled) {
225 source_set(target_name) {
226 forward_variables_from(invoker, "*")
227 configs += skia_library_configs
228 }
229 } else {
230 # If not enabled, a phony empty target that swallows all otherwise unused variables.
231 source_set(target_name) {
232 forward_variables_from(invoker,
233 "*",
234 [
235 "sources",
236 "cflags",
237 ])
238 }
239 }
anmittala7eaf2e2016-08-17 13:57:26 -0700240}
241
mtklein422310d2016-08-16 18:28:43 -0700242is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700243
mtklein7d6fb2c2016-08-25 14:50:44 -0700244opts("none") {
245 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700247 cflags = []
248}
249
mtklein7d6fb2c2016-08-25 14:50:44 -0700250opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700251 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700252 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700253 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700254}
255
256opts("arm64") {
257 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700259 cflags = []
260}
261
262opts("crc32") {
263 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700265 cflags = [ "-march=armv8-a+crc" ]
266}
267
mtklein9b8583d2016-08-24 17:32:30 -0700268opts("sse2") {
269 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700270 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400271 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400272 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
273 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400274 cflags = [ "-msse2" ]
275 }
mtklein9b8583d2016-08-24 17:32:30 -0700276}
mtkleinc04ff472016-06-23 10:29:30 -0700277
mtklein9b8583d2016-08-24 17:32:30 -0700278opts("ssse3") {
279 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700280 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400281 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400282 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
283 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400284 cflags = [ "-mssse3" ]
285 }
mtklein9b8583d2016-08-24 17:32:30 -0700286}
mtkleinc04ff472016-06-23 10:29:30 -0700287
mtklein9b8583d2016-08-24 17:32:30 -0700288opts("sse41") {
289 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700290 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400291 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400292 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
293 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400294 cflags = [ "-msse4.1" ]
295 }
mtklein9b8583d2016-08-24 17:32:30 -0700296}
mtklein4e976072016-08-08 09:06:27 -0700297
mtklein9b8583d2016-08-24 17:32:30 -0700298opts("sse42") {
299 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700300 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400301 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400302 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
303 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400304 cflags = [ "-msse4.2" ]
305 }
mtklein9b8583d2016-08-24 17:32:30 -0700306}
307
308opts("avx") {
309 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700310 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400311 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000312 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400313 } else {
314 cflags = [ "-mavx" ]
315 }
mtkleinc04ff472016-06-23 10:29:30 -0700316}
317
Mike Klein1b9b7d52018-02-27 10:37:40 -0500318opts("hsw") {
319 enabled = is_x86
320 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400321 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500322 cflags = [ "/arch:AVX2" ]
323 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000324 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500325 }
326
327 # Oddly, clang-cl doesn't recognize this as a valid flag.
328 # If it ever does, it'd nice to move this up with -mavx2 and co.
329 if (is_clang && !is_win) {
330 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
331 # but nice to have, generating slightly better code for paths without explicit FMAs.
332 cflags += [ "-ffp-contract=fast" ]
333 }
334}
335
mtkleinc095df52016-08-24 12:23:52 -0700336# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700337template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500338 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700339 if (invoker.enabled) {
340 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700341 if (defined(invoker.public_defines)) {
342 defines = invoker.public_defines
343 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600344 if (defined(invoker.public_configs)) {
345 configs = invoker.public_configs
346 }
mtklein457b42a2016-08-23 13:56:37 -0700347 }
348 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700349 forward_variables_from(invoker,
350 "*",
351 [
352 "public_defines",
353 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700354 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700355 ])
mtklein457b42a2016-08-23 13:56:37 -0700356 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700357 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700358 if (defined(invoker.configs_to_remove)) {
359 configs -= invoker.configs_to_remove
360 }
mtklein457b42a2016-08-23 13:56:37 -0700361 }
362 } else {
mtklein457b42a2016-08-23 13:56:37 -0700363 source_set(target_name) {
364 forward_variables_from(invoker,
365 "*",
366 [
367 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400368 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700369 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700370 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700371 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700372 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700373 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700374 ])
mtkleincd01b032016-08-31 04:58:19 -0700375 if (defined(invoker.sources_when_disabled)) {
376 sources = invoker.sources_when_disabled
377 }
378 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700379 }
mtkleineb3c4252016-08-23 07:38:09 -0700380 }
mtklein457b42a2016-08-23 13:56:37 -0700381}
mtklein457b42a2016-08-23 13:56:37 -0700382
mtkleina45be612016-08-29 15:22:10 -0700383optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500384 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700385
386 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500387 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700388 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700389 ]
390 sources = [
391 "src/ports/SkFontMgr_android.cpp",
392 "src/ports/SkFontMgr_android_factory.cpp",
393 "src/ports/SkFontMgr_android_parser.cpp",
394 ]
395}
396
mtkleind2e39db2016-09-07 07:52:55 -0700397optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500398 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700399
400 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500401 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700402 ]
403 sources = [
404 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500405 "src/ports/SkFontMgr_custom.h",
406 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700407 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500408 "src/ports/SkFontMgr_custom_embedded.cpp",
409 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700410 ]
411}
412
Kevin Lubickddd0a332018-12-12 10:35:13 -0500413optional("fontmgr_wasm") {
414 enabled = target_cpu == "wasm"
415
416 deps = [
417 ":typeface_freetype",
418 ]
419 sources = [
420 "src/ports/SkFontMgr_custom.cpp",
421 "src/ports/SkFontMgr_custom.h",
422 "src/ports/SkFontMgr_custom_embedded.cpp",
423 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
424 ]
425}
426
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800427optional("fontmgr_fuchsia") {
428 enabled = skia_enable_fontmgr_fuchsia
429
430 deps = [
431 "//garnet/public/fidl/fuchsia.fonts",
432 ]
433 sources = [
434 "src/ports/SkFontMgr_fuchsia.cpp",
435 "src/ports/SkFontMgr_fuchsia.h",
436 ]
437}
438
Hal Canaryff2742e2018-01-30 11:35:47 -0500439optional("fontmgr_empty") {
440 enabled = skia_enable_fontmgr_empty
441 sources = [
442 "src/ports/SkFontMgr_empty_factory.cpp",
443 ]
444}
445
mtklein3cc22182016-08-29 13:26:14 -0700446optional("fontmgr_fontconfig") {
447 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700448
449 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500450 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700451 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700452 ]
453 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700454 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700455 "src/ports/SkFontConfigInterface_direct.cpp",
456 "src/ports/SkFontConfigInterface_direct_factory.cpp",
457 "src/ports/SkFontMgr_FontConfigInterface.cpp",
458 "src/ports/SkFontMgr_fontconfig.cpp",
459 "src/ports/SkFontMgr_fontconfig_factory.cpp",
460 ]
461}
462
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500463optional("fontmgr_custom_empty") {
464 enabled = skia_enable_fontmgr_custom_empty
mtkleincdedd0e2016-09-12 15:15:44 -0700465
466 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500467 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700468 ]
469 sources = [
470 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500471 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700472 "src/ports/SkFontMgr_custom_empty_factory.cpp",
473 ]
474}
475
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700476if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400477 executable("sksllex") {
478 sources = [
479 "src/sksl/lex/Main.cpp",
480 "src/sksl/lex/NFA.cpp",
481 "src/sksl/lex/RegexNode.cpp",
482 "src/sksl/lex/RegexParser.cpp",
483 ]
484 include_dirs = [ "src/sksl/lex" ]
485 }
486
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700487 action("run_sksllex") {
488 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400489 deps = [
490 ":sksllex(//gn/toolchain:$host_toolchain)",
491 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700492 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700493 "src/sksl/lex/sksl.lex",
494 ]
495
496 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
497 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
498 outputs = [
499 "$target_out_dir/" +
500 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
501 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
502 # confused due to the same file being named by two different paths
503 ]
504 sksllex_path = "$root_out_dir/"
505 sksllex_path += "sksllex"
506 if (host_os == "win") {
507 sksllex_path += ".exe"
508 }
509 args = [
510 rebase_path(sksllex_path),
511 rebase_path("bin/clang-format"),
512 rebase_path("src"),
513 ]
514 }
515} else {
516 group("run_sksllex") {
517 }
518}
519
520if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400521 executable("skslc") {
522 defines = [ "SKSL_STANDALONE" ]
523 sources = [
524 "src/sksl/SkSLMain.cpp",
525 ]
526 sources += skia_sksl_sources
527 include_dirs = [
528 "src/gpu",
529 "src/sksl",
530 ]
531 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500532 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400533 "//third_party/spirv-tools",
534 ]
535 }
536
537 skia_gpu_processor_outputs = []
538 foreach(src, skia_gpu_processor_sources) {
539 dir = get_path_info(src, "dir")
540 name = get_path_info(src, "name")
541
542 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
543 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
544 skia_gpu_processor_outputs += [
545 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
546 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
547 # confused due to the same file being named by two different paths
548 ]
549 }
550
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500551 action("create_sksl_enums") {
552 script = "gn/create_sksl_enums.py"
553 sources = [
554 "include/private/GrSharedEnums.h",
555 ]
556 outputs = [
557 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500558 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500559 ]
560 args = [
561 rebase_path(sources[0]),
562 rebase_path(outputs[0]),
563 ]
564 }
565
Ethan Nicholas762466e2017-06-29 10:03:38 -0400566 action("compile_processors") {
567 script = "gn/compile_processors.py"
568 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500569 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400570 ":skslc(//gn/toolchain:$host_toolchain)",
571 ]
572 sources = skia_gpu_processor_sources
573 outputs = skia_gpu_processor_outputs
574 skslc_path = "$root_out_dir/"
575 if (host_toolchain != default_toolchain_name) {
576 skslc_path += "$host_toolchain/"
577 }
578 skslc_path += "skslc"
579 if (host_os == "win") {
580 skslc_path += ".exe"
581 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400582 args = [
583 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400584 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400585 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400586 args += rebase_path(skia_gpu_processor_sources)
587 }
588} else {
589 skia_gpu_processor_outputs = []
590 group("compile_processors") {
591 }
592}
593
Mike Klein33ad63a2018-11-11 07:17:00 -0500594optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700595 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400596 deps = [
597 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700598 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400599 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700600 if (skia_generate_workarounds) {
601 deps += [ ":workaround_list" ]
602 }
mtkleine9fb3d52016-09-20 15:11:46 -0700603 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600604 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400605 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700606
Brian Salomon3d6801e2017-12-11 10:06:31 -0500607 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400608 if (!skia_enable_ccpr) {
609 sources -= skia_ccpr_sources
610 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
611 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400612 if (!skia_enable_nvpr) {
613 sources -= skia_nvpr_sources
614 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
615 }
mtklein06c35c02016-09-20 12:28:12 -0700616
617 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500618 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700619 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400620 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700621 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400622 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400623
624 # this lib is required to link against AHardwareBuffer
625 if (defined(ndk_api) && ndk_api >= 26) {
626 libs += [ "android" ]
627 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400628 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500629 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400630 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700631 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500632 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400633 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700634 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500635 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800636 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500637 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400638 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500639 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500640 if (target_cpu != "arm64") {
641 libs += [ "OpenGL32.lib" ]
642 }
mtklein06c35c02016-09-20 12:28:12 -0700643 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500644 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700645 }
mtkleine9fb3d52016-09-20 15:11:46 -0700646
647 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400648 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400649 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700650 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700651 if (skia_enable_vulkan_debug_layers) {
652 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
653 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800654 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500655 public_deps +=
656 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800657 }
mtkleine9fb3d52016-09-20 15:11:46 -0700658 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400659
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400660 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400661 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400662 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
663 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400664
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400665 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400666 if (skia_use_metal) {
667 public_defines += [ "SK_METAL" ]
668 sources += skia_metal_sources
669 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400670 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400671 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400672 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500673
674 if (skia_enable_atlas_text) {
675 sources += skia_atlas_text_sources
676 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400677
678 if (is_debug) {
679 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
680 }
mtklein06c35c02016-09-20 12:28:12 -0700681}
682
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400683optional("heif") {
684 enabled = skia_use_libheif
685 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
686
687 deps = []
688
689 sources = [
690 "src/codec/SkHeifCodec.cpp",
691 ]
692}
693
mtklein63213812016-08-24 09:55:56 -0700694optional("jpeg") {
695 enabled = skia_use_libjpeg_turbo
696 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
697
mtklein63213812016-08-24 09:55:56 -0700698 deps = [
699 "//third_party/libjpeg-turbo:libjpeg",
700 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400701 public = [
702 "include/encode/SkJpegEncoder.h",
703 ]
mtklein63213812016-08-24 09:55:56 -0700704 sources = [
705 "src/codec/SkJpegCodec.cpp",
706 "src/codec/SkJpegDecoderMgr.cpp",
707 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700708 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400709 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700710 ]
711}
712
713optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500714 enabled = skia_use_zlib && skia_enable_pdf
715 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700716
mtklein63213812016-08-24 09:55:56 -0700717 deps = [
718 "//third_party/zlib",
719 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400720 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700721 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400722 }
brettwb9447282016-09-01 14:24:39 -0700723 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700724 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700725
726 if (skia_use_sfntly) {
727 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500728 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700729 }
730}
731
732optional("png") {
733 enabled = skia_use_libpng
734 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
735
mtklein63213812016-08-24 09:55:56 -0700736 deps = [
737 "//third_party/libpng",
738 ]
739 sources = [
740 "src/codec/SkIcoCodec.cpp",
741 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400742 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700743 ]
744}
745
scroggof84ad642016-10-31 09:02:57 -0700746optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400747 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700748 public_defines = [ "SK_CODEC_DECODES_RAW" ]
749
750 deps = [
751 "//third_party/dng_sdk",
752 "//third_party/libjpeg-turbo:libjpeg",
753 "//third_party/piex",
754 ]
755
756 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
757 # Skia.
758 configs_to_remove = [ "//gn:no_exceptions" ]
759
760 sources = [
scroggof84ad642016-10-31 09:02:57 -0700761 "src/codec/SkRawCodec.cpp",
762 ]
763}
764
Mike Klein852a8cb2018-05-15 10:46:58 -0400765import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400766source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400767 cflags = []
768 if (!is_win || is_clang) {
769 cflags += [
770 "-w",
771 "-std=c11",
772 ]
773 }
774
775 public = [
776 "third_party/skcms/skcms.h",
777 ]
778 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
779}
780
mtklein3cc22182016-08-29 13:26:14 -0700781optional("typeface_freetype") {
782 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700783
784 deps = [
785 "//third_party/freetype2",
786 ]
787 sources = [
788 "src/ports/SkFontHost_FreeType.cpp",
789 "src/ports/SkFontHost_FreeType_common.cpp",
790 ]
791}
792
mtklein457b42a2016-08-23 13:56:37 -0700793optional("webp") {
794 enabled = skia_use_libwebp
795 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
796
mtklein457b42a2016-08-23 13:56:37 -0700797 deps = [
798 "//third_party/libwebp",
799 ]
800 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700801 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400802 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700803 ]
mtkleineb3c4252016-08-23 07:38:09 -0700804}
805
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400806optional("wuffs") {
807 enabled = skia_use_wuffs
808 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
809
810 deps = [
811 "//third_party/wuffs",
812 ]
813 sources = [
814 "src/codec/SkWuffsCodec.cpp",
815 ]
816}
817
mtklein63213812016-08-24 09:55:56 -0700818optional("xml") {
819 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000820 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700821
mtklein63213812016-08-24 09:55:56 -0700822 deps = [
823 "//third_party/expat",
824 ]
825 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500826 "src/svg/SkSVGCanvas.cpp",
827 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700828 "src/xml/SkDOM.cpp",
829 "src/xml/SkXMLParser.cpp",
830 "src/xml/SkXMLWriter.cpp",
831 ]
832}
833
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700834if (skia_enable_gpu && skia_generate_workarounds) {
835 action("workaround_list") {
836 script = "tools/build_workaround_header.py"
837
838 inputs = [
839 "src/gpu/gpu_workaround_list.txt",
840 ]
841
842 # see comments in skia_compile_processors about out dir path shenanigans.
843 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700844 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700845
846 outputs = [
847 "$root_out_dir/$output_file",
848 ]
849 args = [
850 "--output-file",
851 "$output_file",
852 ]
853
854 foreach(file, inputs) {
855 args += [ rebase_path(file, root_build_dir) ]
856 }
857 }
858}
859
Mike Klein33ad63a2018-11-11 07:17:00 -0500860# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
861# TODO: rename :gpu_for_real back to :gpu when cleaning up.
862source_set("effects") {
863}
864source_set("gpu") {
865}
866
mtkleinc04ff472016-06-23 10:29:30 -0700867component("skia") {
868 public_configs = [ ":skia_public" ]
869 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700870
Mike Klein607b0a72018-11-07 16:17:34 -0500871 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500872 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500873 ":pdf",
874 ":skcms",
875 ]
876
mtkleinc04ff472016-06-23 10:29:30 -0700877 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700878 ":arm64",
879 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700880 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000881 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700882 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700883 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700884 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500885 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500886 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700887 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800888 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500889 ":fontmgr_wasm",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400890 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500891 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700892 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700893 ":none",
mtklein63213812016-08-24 09:55:56 -0700894 ":png",
scroggof84ad642016-10-31 09:02:57 -0700895 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700896 ":sse2",
897 ":sse41",
898 ":sse42",
899 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700900 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400901 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700902 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700903 ]
904
Kevin Lubick134be1d2018-10-30 15:05:04 -0400905 if (skia_enable_nima) {
906 deps += [ "//third_party/Nima-Cpp" ]
907 }
908
Chinmay Garde43f115c2016-11-16 15:04:12 -0800909 # This file (and all GN files in Skia) are designed to work with an
910 # empty sources assignment filter; we handle all that explicitly.
911 # We clear the filter here for clients who may have set up a global filter.
912 set_sources_assignment_filter([])
913
mtkleinc04ff472016-06-23 10:29:30 -0700914 sources = []
brettwb9447282016-09-01 14:24:39 -0700915 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700916 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500917 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000918 sources += skia_effects_sources
919 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700920 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400921 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500922 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700923 "src/android/SkBitmapRegionCodec.cpp",
924 "src/android/SkBitmapRegionDecoder.cpp",
925 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100926 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400927 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700928 "src/codec/SkBmpCodec.cpp",
929 "src/codec/SkBmpMaskCodec.cpp",
930 "src/codec/SkBmpRLECodec.cpp",
931 "src/codec/SkBmpStandardCodec.cpp",
932 "src/codec/SkCodec.cpp",
933 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400934 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400935 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700936 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700937 "src/codec/SkMaskSwizzler.cpp",
938 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700939 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700940 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700941 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700942 "src/codec/SkSwizzler.cpp",
943 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700945 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000946 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700947 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700948 "src/ports/SkMemory_malloc.cpp",
949 "src/ports/SkOSFile_stdio.cpp",
950 "src/sfnt/SkOTTable_name.cpp",
951 "src/sfnt/SkOTUtils.cpp",
952 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700953 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700954 ]
brettwb9447282016-09-01 14:24:39 -0700955
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400956 defines = []
957 if (!skia_enable_skpicture) {
958 defines = [ "SK_DISABLE_SKPICTURE" ]
959 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000960 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400961 sources += [ "src/core/SkPicture_none.cpp" ]
962 }
963
mtklein7d6fb2c2016-08-25 14:50:44 -0700964 libs = []
965
mtkleinc04ff472016-06-23 10:29:30 -0700966 if (is_win) {
967 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400968 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700969 "src/ports/SkDebug_win.cpp",
970 "src/ports/SkFontHost_win.cpp",
971 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500972 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700973 "src/ports/SkImageEncoder_WIC.cpp",
974 "src/ports/SkImageGeneratorWIC.cpp",
975 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700976 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700977 "src/ports/SkScalerContext_win_dw.cpp",
978 "src/ports/SkTLS_win.cpp",
979 "src/ports/SkTypeface_win_dw.cpp",
980 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400981 libs += [
982 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500983 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400984 "Ole32.lib",
985 "OleAut32.lib",
986 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500987 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400988 ]
mtkleinc04ff472016-06-23 10:29:30 -0700989 } else {
990 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700991 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700992 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700993 "src/ports/SkTLS_pthread.cpp",
994 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400995 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700996 }
997
mtklein7d6fb2c2016-08-25 14:50:44 -0700998 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500999 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001000 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001001 deps += [ "//third_party/cpu-features" ]
1002 }
mtklein06c35c02016-09-20 12:28:12 -07001003 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001004 libs += [
1005 "EGL",
1006 "GLESv2",
1007 "log",
1008 ]
1009 }
1010
Kevin Lubick217056c2018-09-20 17:39:31 -04001011 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001012 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001013 if (skia_use_egl) {
1014 libs += [ "GLESv2" ]
1015 }
mtkleinc04ff472016-06-23 10:29:30 -07001016 }
1017
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001018 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001019 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001020 }
1021
mtkleinc04ff472016-06-23 10:29:30 -07001022 if (is_mac) {
1023 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001024 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001025 "src/ports/SkImageEncoder_CG.cpp",
1026 "src/ports/SkImageGeneratorCG.cpp",
1027 ]
mtklein09e61f72016-08-23 13:35:28 -07001028 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001029 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1030 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001031 "ApplicationServices.framework",
1032 "OpenGL.framework",
1033 ]
mtkleinc04ff472016-06-23 10:29:30 -07001034 }
abarth6fc8ff02016-07-15 15:15:15 -07001035
Mike Klein7d302882016-11-03 14:06:31 -04001036 if (is_ios) {
1037 sources += [
1038 "src/ports/SkDebug_stdio.cpp",
1039 "src/ports/SkFontHost_mac.cpp",
1040 "src/ports/SkImageEncoder_CG.cpp",
1041 "src/ports/SkImageGeneratorCG.cpp",
1042 ]
1043 libs += [
1044 "CoreFoundation.framework",
1045 "CoreGraphics.framework",
1046 "CoreText.framework",
1047 "ImageIO.framework",
1048 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001049
1050 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1051 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001052 ]
1053 }
1054
abarth6fc8ff02016-07-15 15:15:15 -07001055 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001056 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001057 }
mtkleinc04ff472016-06-23 10:29:30 -07001058}
1059
Kevin Lubickcbcff382018-10-02 09:02:18 -04001060static_library("pathkit") {
1061 public_configs = [ ":skia_public" ]
1062 configs += skia_library_configs
1063
1064 deps = [
1065 ":arm64",
1066 ":armv7",
1067 ":avx",
1068 ":crc32",
1069 ":hsw",
1070 ":none",
1071 ":sse2",
1072 ":sse41",
1073 ":sse42",
1074 ":ssse3",
1075 ]
1076
1077 # This file (and all GN files in Skia) are designed to work with an
1078 # empty sources assignment filter; we handle all that explicitly.
1079 # We clear the filter here for clients who may have set up a global filter.
1080 set_sources_assignment_filter([])
1081
1082 sources = []
1083 sources += skia_pathops_sources
1084 sources += [
1085 "src/core/SkAnalyticEdge.cpp",
1086 "src/core/SkArenaAlloc.cpp",
1087 "src/core/SkCubicMap.cpp",
1088 "src/core/SkEdge.cpp",
1089 "src/core/SkEdgeBuilder.cpp",
1090 "src/core/SkEdgeClipper.cpp",
1091 "src/core/SkGeometry.cpp",
1092 "src/core/SkLineClipper.cpp",
1093 "src/core/SkMallocPixelRef.cpp",
1094 "src/core/SkMath.cpp",
1095 "src/core/SkMatrix.cpp",
1096 "src/core/SkOpts.cpp",
1097 "src/core/SkPaint.cpp",
1098 "src/core/SkPath.cpp",
1099 "src/core/SkPathEffect.cpp",
1100 "src/core/SkPathMeasure.cpp",
1101 "src/core/SkPathRef.cpp",
1102 "src/core/SkPoint.cpp",
1103 "src/core/SkRRect.cpp",
1104 "src/core/SkRect.cpp",
1105 "src/core/SkSemaphore.cpp",
1106 "src/core/SkStream.cpp",
1107 "src/core/SkString.cpp",
1108 "src/core/SkStringUtils.cpp",
1109 "src/core/SkStroke.cpp",
1110 "src/core/SkStrokeRec.cpp",
1111 "src/core/SkStrokerPriv.cpp",
1112 "src/core/SkThreadID.cpp",
1113 "src/core/SkUtils.cpp",
1114 "src/effects/SkDashPathEffect.cpp",
1115 "src/effects/SkTrimPathEffect.cpp",
1116 "src/ports/SkDebug_stdio.cpp",
1117 "src/ports/SkMemory_malloc.cpp",
1118 "src/utils/SkDashPath.cpp",
1119 "src/utils/SkParse.cpp",
1120 "src/utils/SkParsePath.cpp",
1121 "src/utils/SkUTF.cpp",
1122 ]
1123}
1124
mtkleinc095df52016-08-24 12:23:52 -07001125# Targets guarded by skia_enable_tools may use //third_party freely.
1126if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001127 # Used by gn_to_bp.py to list our public include dirs.
1128 source_set("public") {
1129 configs += [ ":skia_public" ]
1130 }
1131
Mike Kleinc36dedf2016-11-18 09:35:28 -05001132 config("skia.h_config") {
1133 include_dirs = [ "$target_gen_dir" ]
1134 }
1135 action("skia.h") {
1136 public_configs = [ ":skia.h_config" ]
1137 skia_h = "$target_gen_dir/skia.h"
1138 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001139
1140 # TODO: would be cool to not hard-code these here, but how?
1141 module_public_includes = [
1142 "modules/sksg/include",
1143 "modules/skottie/include",
1144 ]
1145 args =
1146 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1147 [ rebase_path(skia_h, root_build_dir) ] +
1148 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001149 depfile = "$skia_h.deps"
1150 outputs = [
1151 skia_h,
1152 ]
1153 }
1154
Brian Osmanc9a42472018-05-31 13:17:12 -04001155 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001156 executable("fiddle") {
1157 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001158 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001159 "tools/fiddle/draw.cpp",
1160 "tools/fiddle/fiddle_main.cpp",
1161 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001162
1163 if (skia_use_egl) {
1164 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001165 } else {
1166 sources += [ "tools/fiddle/null_context.cpp" ]
1167 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001168 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001169 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001170 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001171 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001172 ":skia",
1173 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001174 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001175 ]
1176 }
1177 }
1178
Brian Osmanc9a42472018-05-31 13:17:12 -04001179 source_set("public_headers_warnings_check") {
1180 sources = [
1181 "tools/public_headers_warnings_check.cpp",
1182 ]
1183 configs -= [ "//gn:warnings_except_public_headers" ]
1184 deps = [
1185 ":skia",
1186 ":skia.h",
1187 "modules/skottie",
1188 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001189
1190 # We add this directory to simulate the client already have
1191 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001192 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001193 }
1194
mtkleinc095df52016-08-24 12:23:52 -07001195 template("test_lib") {
1196 config(target_name + "_config") {
1197 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001198 if (defined(invoker.public_defines)) {
1199 defines = invoker.public_defines
1200 }
mtklein25c81d42016-07-27 13:55:26 -07001201 }
mtkleinc095df52016-08-24 12:23:52 -07001202 source_set(target_name) {
1203 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1204 public_configs = [
1205 ":" + target_name + "_config",
1206 ":skia_private",
1207 ]
1208
1209 if (!defined(deps)) {
1210 deps = []
1211 }
1212 deps += [ ":skia" ]
1213 testonly = true
1214 }
mtklein25c81d42016-07-27 13:55:26 -07001215 }
mtklein25c81d42016-07-27 13:55:26 -07001216
Mike Kleine6682eb2017-01-05 10:54:57 -05001217 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001218 if (is_ios) {
1219 app_name = target_name
1220 gen_path = target_gen_dir
1221
1222 action("${app_name}_generate_info_plist") {
1223 script = "//gn/gen_plist_ios.py"
1224 outputs = [
1225 "$gen_path/${app_name}_Info.plist",
1226 ]
1227 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1228 }
1229
1230 bundle_data("${app_name}_bundle_info_plist") {
1231 public_deps = [
1232 ":${app_name}_generate_info_plist",
1233 ]
1234 sources = [
1235 "$gen_path/${app_name}_Info.plist",
1236 ]
1237 outputs = [
1238 "{{bundle_root_dir}}/Info.plist",
1239 ]
1240 }
1241
Jim Van Verth329c5a62017-11-29 11:42:33 -05001242 bundle_ios_data =
1243 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1244
1245 if (bundle_ios_data) {
1246 has_skps =
1247 "True" == exec_script("//gn/checkdir.py",
1248 [ rebase_path("skps", root_build_dir) ],
1249 "trim string")
1250 bundle_data("${app_name}_bundle_resources") {
1251 sources = [
1252 "resources",
1253 ]
1254 outputs = [
1255 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1256 "{{bundle_resources_dir}}/data/resources",
1257 ]
1258 }
1259
1260 if (has_skps) {
1261 bundle_data("${app_name}_bundle_skps") {
1262 sources = [
1263 "skps",
1264 ]
1265 outputs = [
1266 # Store in same folder as resources
1267 "{{bundle_resources_dir}}/data/skps",
1268 ]
1269 }
1270 }
1271 }
1272
Jim Van Verth443a9132017-11-28 09:45:26 -05001273 executable("${app_name}_generate_executable") {
1274 forward_variables_from(invoker,
1275 "*",
1276 [
1277 "output_name",
1278 "visibility",
1279 "is_shared_library",
1280 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001281 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001282 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001283 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1284 }
1285
1286 bundle_data("${app_name}_bundle_executable") {
1287 public_deps = [
1288 ":${app_name}_generate_executable",
1289 ]
1290 sources = [
1291 "$gen_path/$app_name",
1292 ]
1293 outputs = [
1294 "{{bundle_executable_dir}}/$app_name",
1295 ]
1296 testonly = true
1297 }
1298
1299 create_bundle("$app_name") {
1300 product_type = "com.apple.product-type.application"
1301 testonly = true
1302
1303 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1304 bundle_resources_dir = bundle_root_dir
1305 bundle_executable_dir = bundle_root_dir
1306 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1307
1308 deps = [
1309 ":${app_name}_bundle_executable",
1310 ":${app_name}_bundle_info_plist",
1311 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001312 if (bundle_ios_data) {
1313 deps += [ ":${app_name}_bundle_resources" ]
1314 if (has_skps) {
1315 deps += [ ":${app_name}_bundle_skps" ]
1316 }
1317 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001318
1319 # should only code sign when running on a device, not the simulator
1320 if (target_cpu != "x64") {
1321 code_signing_script = "//gn/codesign_ios.py"
1322 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1323 code_signing_outputs = [
1324 "$bundle_root_dir/_CodeSignature/CodeResources",
1325 "$bundle_root_dir/embedded.mobileprovision",
1326 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001327 code_signing_args = [
1328 rebase_path("$bundle_root_dir", root_build_dir),
1329 skia_ios_identity,
1330 skia_ios_profile,
1331 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001332 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001333 }
1334 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001335 # !is_ios
1336
1337 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1338 shared_library("lib" + target_name) {
1339 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1340 configs += [ ":skia_private" ]
1341 testonly = true
1342 }
1343 } else {
1344 _executable = target_name
1345 executable(_executable) {
1346 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1347 configs += [ ":skia_private" ]
1348 testonly = true
1349 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001350 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001351 if (is_android && skia_android_serial != "" && defined(_executable)) {
1352 action("push_" + target_name) {
1353 script = "gn/push_to_android.py"
1354 deps = [
1355 ":" + _executable,
1356 ]
1357 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1358 outputs = [
1359 _stamp,
1360 ]
1361 args = [
1362 rebase_path("$root_build_dir/$_executable"),
1363 skia_android_serial,
1364 rebase_path(_stamp),
1365 ]
1366 testonly = true
1367 }
Mike Klein7d921032017-01-05 12:20:41 -05001368 }
1369 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001370 }
1371
Greg Danielda16cce2018-08-01 09:23:57 -04001372 config("moltenvk_config") {
1373 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1374 if (is_ios) {
1375 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1376 } else {
1377 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1378 }
1379 cflags = [ "-F$moltenvk_framework_path" ]
1380 ldflags = [ "-F$moltenvk_framework_path" ]
1381 libs = [
1382 "MoltenVK.framework",
1383 "Metal.framework",
1384 "IOSurface.framework",
1385 "QuartzCore.framework",
1386 "Foundation.framework",
1387 ]
1388 if (is_ios) {
1389 libs += [ "UIKit.framework" ]
1390 } else {
1391 libs += [ "IOKit.framework" ]
1392 }
1393 defines = [ "SK_MOLTENVK" ]
1394 }
1395 }
1396
1397 source_set("moltenvk") {
1398 public_configs = [ ":moltenvk_config" ]
1399 }
1400
mtkleinc095df52016-08-24 12:23:52 -07001401 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001402 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001403 public_defines = []
1404 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001405
Brian Osmanc9a42472018-05-31 13:17:12 -04001406 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001407 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001408 sources = [
1409 "tools/gpu/GrContextFactory.cpp",
1410 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001411 "tools/gpu/MemoryCache.cpp",
1412 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001413 "tools/gpu/ProxyUtils.cpp",
1414 "tools/gpu/TestContext.cpp",
1415 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1416 "tools/gpu/gl/GLTestContext.cpp",
1417 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001418 "tools/gpu/gl/null/NullGLTestContext.cpp",
1419 "tools/gpu/mock/MockTestContext.cpp",
1420 ]
1421 libs = []
1422
1423 if (is_android || skia_use_egl) {
1424 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1425 } else if (is_ios) {
1426 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1427 libs += [ "OpenGLES.framework" ]
1428 } else if (is_linux) {
1429 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001430 libs += [
1431 "GLU",
1432 "X11",
1433 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001434 } else if (is_mac) {
1435 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1436 } else if (is_win) {
1437 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001438 libs += [ "Gdi32.lib" ]
1439 if (target_cpu != "arm64") {
1440 libs += [ "OpenGL32.lib" ]
1441 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001442 }
mtklein25c81d42016-07-27 13:55:26 -07001443
Brian Osmanc9a42472018-05-31 13:17:12 -04001444 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001445
Brian Osmanc9a42472018-05-31 13:17:12 -04001446 if (skia_use_angle) {
1447 deps += [ "//third_party/angle2" ]
1448 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1449 }
Greg Daniel54200e42018-12-11 17:03:39 -05001450
Greg Daniel487132b2018-12-20 14:09:36 -05001451 public_include_dirs += [ "include/third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001452 if (skia_use_vulkan) {
1453 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1454 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001455 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1456 public_deps += [ ":moltenvk" ]
1457 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001458 }
1459 if (skia_use_metal) {
1460 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001461 }
mtklein25c81d42016-07-27 13:55:26 -07001462 }
mtklein25c81d42016-07-27 13:55:26 -07001463
mtkleinc095df52016-08-24 12:23:52 -07001464 test_lib("flags") {
1465 public_include_dirs = [ "tools/flags" ]
1466 sources = [
1467 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001468 ]
1469 }
1470 test_lib("common_flags") {
1471 public_include_dirs = [ "tools/flags" ]
1472 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001473 "tools/flags/SkCommonFlags.cpp",
1474 "tools/flags/SkCommonFlagsConfig.cpp",
1475 ]
1476 deps = [
mtklein046cb562016-09-16 10:23:12 -07001477 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001478 ]
1479 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001480 ":gpu_tool_utils",
1481 ]
1482 }
mtklein25c81d42016-07-27 13:55:26 -07001483
mtkleinc095df52016-08-24 12:23:52 -07001484 test_lib("tool_utils") {
1485 public_include_dirs = [
1486 "tools",
1487 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001488 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001489 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001490 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001491 ]
1492 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001493 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001494 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001495 "tools/DDLPromiseImageHelper.cpp",
1496 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001497 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001498 "tools/ProcStats.cpp",
1499 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001500 "tools/UrlDataManager.cpp",
1501 "tools/debugger/SkDebugCanvas.cpp",
1502 "tools/debugger/SkDrawCommand.cpp",
1503 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001504 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001505 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001506 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001507 "tools/fonts/SkTestFontMgr.h",
1508 "tools/fonts/SkTestSVGTypeface.cpp",
1509 "tools/fonts/SkTestSVGTypeface.h",
1510 "tools/fonts/SkTestTypeface.cpp",
1511 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001512 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001513 "tools/random_parse_path.cpp",
1514 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001515 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001516 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001517 "tools/trace/SkChromeTracingTracer.cpp",
1518 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001519 "tools/trace/SkDebugfTracer.cpp",
1520 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001521 "tools/trace/SkEventTracingPriv.cpp",
1522 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001523 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001524 libs = []
1525 if (is_ios) {
1526 sources += [ "tools/ios_utils.m" ]
1527 libs += [ "Foundation.framework" ]
1528 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001529 defines = []
1530 if (skia_tools_require_resources) {
1531 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1532 }
mtkleinc095df52016-08-24 12:23:52 -07001533 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001534 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001535 ":flags",
1536 "//third_party/libpng",
1537 ]
1538 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001539 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001540 "//third_party/jsoncpp",
1541 ]
1542 }
mtklein25c81d42016-07-27 13:55:26 -07001543
Mike Klein6e744122016-10-27 12:21:40 -04001544 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001545 test_lib("gm") {
1546 public_include_dirs = [ "gm" ]
1547 sources = gm_sources
1548 deps = [
scroggo19b91532016-10-24 09:03:26 -07001549 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001550 ":skia",
1551 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001552 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001553 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001554 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001555 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001556 public_deps = [
1557 ":gpu_tool_utils",
1558 ]
mtkleinc095df52016-08-24 12:23:52 -07001559 }
mtklein25c81d42016-07-27 13:55:26 -07001560
Mike Klein6e744122016-10-27 12:21:40 -04001561 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001562 test_lib("tests") {
1563 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001564 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001565 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001566 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001567 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001568 if (!(skia_use_freetype && skia_use_fontconfig)) {
1569 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1570 }
mtkleinc095df52016-08-24 12:23:52 -07001571 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001572 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001573 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001574 ":skia",
1575 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001576 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001577 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001578 "//third_party/libpng",
1579 "//third_party/zlib",
1580 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001581 public_deps = [
1582 ":gpu_tool_utils", # Test.h #includes headers from this target.
1583 ]
mtkleinc095df52016-08-24 12:23:52 -07001584 }
mtklein2f3416d2016-08-02 16:02:05 -07001585
Mike Klein6e744122016-10-27 12:21:40 -04001586 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001587 test_lib("bench") {
1588 public_include_dirs = [ "bench" ]
1589 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001590 deps = [
1591 ":flags",
1592 ":gm",
1593 ":gpu_tool_utils",
1594 ":skia",
1595 ":tool_utils",
1596 ]
1597 }
mtklein2b6870c2016-07-28 14:17:33 -07001598
mtkleinc095df52016-08-24 12:23:52 -07001599 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001600 public_include_dirs = []
1601 if (skia_use_expat) {
1602 public_include_dirs += [ "experimental/svg/model" ]
1603 sources = [
1604 "experimental/svg/model/SkSVGAttribute.cpp",
1605 "experimental/svg/model/SkSVGAttributeParser.cpp",
1606 "experimental/svg/model/SkSVGCircle.cpp",
1607 "experimental/svg/model/SkSVGClipPath.cpp",
1608 "experimental/svg/model/SkSVGContainer.cpp",
1609 "experimental/svg/model/SkSVGDOM.cpp",
1610 "experimental/svg/model/SkSVGEllipse.cpp",
1611 "experimental/svg/model/SkSVGGradient.cpp",
1612 "experimental/svg/model/SkSVGLine.cpp",
1613 "experimental/svg/model/SkSVGLinearGradient.cpp",
1614 "experimental/svg/model/SkSVGNode.cpp",
1615 "experimental/svg/model/SkSVGPath.cpp",
1616 "experimental/svg/model/SkSVGPattern.cpp",
1617 "experimental/svg/model/SkSVGPoly.cpp",
1618 "experimental/svg/model/SkSVGRadialGradient.cpp",
1619 "experimental/svg/model/SkSVGRect.cpp",
1620 "experimental/svg/model/SkSVGRenderContext.cpp",
1621 "experimental/svg/model/SkSVGSVG.cpp",
1622 "experimental/svg/model/SkSVGShape.cpp",
1623 "experimental/svg/model/SkSVGStop.cpp",
1624 "experimental/svg/model/SkSVGTransformableNode.cpp",
1625 "experimental/svg/model/SkSVGUse.cpp",
1626 "experimental/svg/model/SkSVGValue.cpp",
1627 ]
1628 deps = [
1629 ":skia",
1630 ":xml",
1631 ]
1632 }
mtkleinc095df52016-08-24 12:23:52 -07001633 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001634
Mike Klein38af9432016-11-11 11:39:44 -05001635 if (skia_use_lua) {
1636 test_lib("lua") {
1637 public_include_dirs = []
1638 sources = [
1639 "src/utils/SkLua.cpp",
1640 "src/utils/SkLuaCanvas.cpp",
1641 ]
1642 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001643 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001644 "//third_party/lua",
1645 ]
1646 }
1647
Mike Kleine6682eb2017-01-05 10:54:57 -05001648 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001649 sources = [
1650 "tools/lua/lua_app.cpp",
1651 ]
1652 deps = [
1653 ":lua",
1654 ":skia",
1655 "//third_party/lua",
1656 ]
Mike Klein38af9432016-11-11 11:39:44 -05001657 }
1658
Mike Kleine6682eb2017-01-05 10:54:57 -05001659 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001660 sources = [
1661 "tools/lua/lua_pictures.cpp",
1662 ]
1663 deps = [
1664 ":flags",
1665 ":lua",
1666 ":skia",
1667 ":tool_utils",
1668 "//third_party/lua",
1669 ]
Mike Klein38af9432016-11-11 11:39:44 -05001670 }
1671 }
1672
Cary Clark8032b982017-07-28 11:04:54 -04001673 test_app("bookmaker") {
1674 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001675 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001676 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001677 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001678 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001679 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001680 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001681 "tools/bookmaker/includeParser.cpp",
1682 "tools/bookmaker/includeWriter.cpp",
1683 "tools/bookmaker/mdOut.cpp",
1684 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001685 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001686 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001687 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001688 ]
1689 deps = [
1690 ":flags",
1691 ":skia",
1692 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001693 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001694 ]
1695 }
1696
Florin Malitabfe876a2018-09-02 12:33:59 -04001697 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001698 test_app("skottie_tool") {
1699 deps = [
1700 "modules/skottie:tool",
1701 ]
1702 }
1703 }
1704
Kevin Lubickebf648e2017-09-21 13:45:16 -04001705 if (target_cpu != "wasm") {
1706 import("gn/samples.gni")
1707 test_lib("samples") {
1708 public_include_dirs = [ "samplecode" ]
1709 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001710 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001711 public_deps = [
1712 ":tool_utils",
1713 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001714 deps = [
1715 ":experimental_svg_model",
1716 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001717 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001718 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001719 ]
Mike Klein38af9432016-11-11 11:39:44 -05001720
Ruiqi Maof5101492018-06-29 14:32:21 -04001721 # NIMA does not build on Windows clang
1722 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001723 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001724 deps += [ "//third_party/Nima-Cpp" ]
1725 }
1726
Kevin Lubickebf648e2017-09-21 13:45:16 -04001727 if (skia_use_lua) {
1728 sources += [ "samplecode/SampleLua.cpp" ]
1729 deps += [
1730 ":lua",
1731 "//third_party/lua",
1732 ]
1733 }
1734 }
Mike Klein7af351a2018-07-27 09:54:43 -04001735 test_app("imgcvt") {
1736 sources = [
1737 "tools/imgcvt.cpp",
1738 ]
1739 deps = [
1740 ":skcms",
1741 ":skia",
1742 ]
1743 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001744 test_app("dm") {
1745 sources = [
1746 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001747 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001748 "dm/DMJsonWriter.cpp",
1749 "dm/DMSrcSink.cpp",
1750 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001751 deps = [
1752 ":common_flags",
1753 ":experimental_svg_model",
1754 ":flags",
1755 ":gm",
1756 ":gpu_tool_utils",
1757 ":skia",
1758 ":tests",
1759 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001760 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001761 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001762 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001763 "//third_party/jsoncpp",
1764 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001765 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001766
1767 # NIMA does not build on Windows clang
1768 if (!is_win || !is_clang) {
1769 deps += [ "//third_party/Nima-Cpp" ]
1770 }
Mike Klein38af9432016-11-11 11:39:44 -05001771 }
Brian Osman16adfa32016-10-18 14:42:44 -04001772 }
1773
Mike Kleina8a51ce2018-01-09 12:34:11 -05001774 if (!is_win) {
1775 test_app("remote_demo") {
1776 sources = [
1777 "tools/remote_demo.cpp",
1778 ]
1779 deps = [
1780 ":skia",
1781 ]
1782 }
1783 }
1784
Mike Kleine6682eb2017-01-05 10:54:57 -05001785 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001786 sources = [
1787 "bench/nanobench.cpp",
1788 ]
1789 deps = [
1790 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001791 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001792 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001793 ":flags",
1794 ":gm",
1795 ":gpu_tool_utils",
1796 ":skia",
1797 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001798 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001799 "//third_party/jsoncpp",
1800 ]
mtklein2b6870c2016-07-28 14:17:33 -07001801 }
halcanary19a97202016-08-03 15:08:04 -07001802
Ravi Mistry10d36c52017-01-31 09:49:18 -05001803 test_app("skpinfo") {
1804 sources = [
1805 "tools/skpinfo.cpp",
1806 ]
1807 deps = [
1808 ":flags",
1809 ":skia",
1810 ]
1811 }
1812
Brian Osmanc9a42472018-05-31 13:17:12 -04001813 test_app("skpbench") {
1814 sources = [
1815 "tools/skpbench/skpbench.cpp",
1816 ]
1817 deps = [
1818 ":flags",
1819 ":gpu_tool_utils",
1820 ":skia",
1821 ":tool_utils",
1822 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001823 }
1824
Mike Kleine6682eb2017-01-05 10:54:57 -05001825 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001826 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001827 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001828 ]
1829 deps = [
1830 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001831 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001832 ]
halcanary3eee9d92016-09-10 07:01:53 -07001833 }
mtklein046cb562016-09-16 10:23:12 -07001834
Ben Wagner219f3622017-07-17 15:32:25 -04001835 test_app("create_test_font") {
1836 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001837 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001838 ]
1839 deps = [
1840 ":skia",
1841 ]
1842 assert_no_deps = [
1843 # tool_utils requires the output of this app.
1844 ":tool_utils",
1845 ]
1846 }
1847
Florin Malita5d3ff432018-07-31 16:38:43 -04001848 if (skia_use_expat) {
1849 test_app("create_test_font_color") {
1850 sources = [
1851 "tools/fonts/create_test_font_color.cpp",
1852 ]
1853 deps = [
1854 ":flags",
1855 ":skia",
1856 ":tool_utils",
1857 ]
1858 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001859 }
1860
Mike Kleine6682eb2017-01-05 10:54:57 -05001861 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001862 sources = [
1863 "tools/get_images_from_skps.cpp",
1864 ]
1865 deps = [
1866 ":flags",
1867 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001868 ]
mtklein046cb562016-09-16 10:23:12 -07001869 }
mtkleinecbc5262016-09-22 11:51:24 -07001870
Brian Osman6788a542018-12-10 11:56:01 -05001871 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001872 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001873 sources = [
1874 "tools/skiaserve/Request.cpp",
1875 "tools/skiaserve/Response.cpp",
1876 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001877 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1878 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1879 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1880 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1881 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1882 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1883 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1884 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1885 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001886 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1887 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001888 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1889 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1890 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1891 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1892 ]
1893 deps = [
1894 ":flags",
1895 ":gpu_tool_utils",
1896 ":skia",
1897 ":tool_utils",
1898 "//third_party/jsoncpp",
1899 "//third_party/libmicrohttpd",
1900 "//third_party/libpng",
1901 ]
Mike Klein7d302882016-11-03 14:06:31 -04001902 }
mtkleinecbc5262016-09-22 11:51:24 -07001903 }
kjlubick14f984b2016-10-03 11:49:45 -07001904
Mike Kleine6682eb2017-01-05 10:54:57 -05001905 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001906 include_dirs = [
1907 "tools",
1908 "tools/debugger",
Kevin Lubickec1c6202018-12-14 11:42:53 -05001909 "tools/fonts",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001910 ]
kjlubick14f984b2016-10-03 11:49:45 -07001911 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001912 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001913 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001914 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001915 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001916 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001917 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001918 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001919 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001920 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001921 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001922 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001923 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001924 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001925 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1926 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001927 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001928 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001929 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001930 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001931 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1932 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001933 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001934 "tools/UrlDataManager.cpp",
1935 "tools/debugger/SkDebugCanvas.cpp",
1936 "tools/debugger/SkDrawCommand.cpp",
1937 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001938 ]
1939 deps = [
1940 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001941 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001942 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001943 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001944 "//third_party/jsoncpp",
1945 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001946 ]
kjlubick14f984b2016-10-03 11:49:45 -07001947 }
Mike Klein38312422016-10-05 15:41:01 -04001948
Mike Kleine6682eb2017-01-05 10:54:57 -05001949 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001950 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001951 rebase_path("tests/skia_test.cpp"),
1952 rebase_path("tests/Test.cpp"),
1953 ]
caryclark9feb6322016-10-25 08:58:26 -07001954 deps = [
1955 ":flags",
1956 ":gpu_tool_utils",
1957 ":skia",
1958 ":tool_utils",
1959 ]
caryclark9feb6322016-10-25 08:58:26 -07001960 }
1961
Mike Kleine6682eb2017-01-05 10:54:57 -05001962 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001963 sources = [
1964 "tools/DumpRecord.cpp",
1965 "tools/dump_record.cpp",
1966 ]
1967 deps = [
1968 ":flags",
1969 ":skia",
1970 ]
Mike Klein38312422016-10-05 15:41:01 -04001971 }
bungemanfe917272016-10-13 17:36:40 -04001972
Mike Kleine6682eb2017-01-05 10:54:57 -05001973 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001974 sources = [
1975 "tools/skdiff/skdiff.cpp",
1976 "tools/skdiff/skdiff_html.cpp",
1977 "tools/skdiff/skdiff_main.cpp",
1978 "tools/skdiff/skdiff_utils.cpp",
1979 ]
1980 deps = [
1981 ":skia",
1982 ":tool_utils",
1983 ]
bungemanfe917272016-10-13 17:36:40 -04001984 }
halcanarya73d76a2016-10-17 13:19:02 -07001985
Mike Kleine6682eb2017-01-05 10:54:57 -05001986 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001987 sources = [
1988 "tools/skp_parser.cpp",
1989 ]
1990 deps = [
1991 ":skia",
1992 ":tool_utils",
1993 "//third_party/jsoncpp",
1994 ]
halcanarya73d76a2016-10-17 13:19:02 -07001995 }
Brian Osman16adfa32016-10-18 14:42:44 -04001996
Brian Osmanc9a42472018-05-31 13:17:12 -04001997 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001998 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05001999 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002000 defines =
2001 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002002 sources = [
2003 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002004 "tools/skqp/src/skqp.cpp",
2005 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002006 ]
2007 deps = [
2008 ":gm",
2009 ":gpu_tool_utils",
2010 ":skia",
2011 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002012 ":tool_utils",
2013 ]
2014 }
2015 test_app("skqp") {
2016 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002017 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002018 ]
2019 deps = [
2020 ":skia",
2021 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002022 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002023 ]
2024 }
2025 test_app("jitter_gms") {
2026 sources = [
2027 "tools/skqp/jitter_gms.cpp",
2028 ]
2029 deps = [
2030 ":gm",
2031 ":skia",
2032 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002033 ]
2034 }
2035 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002036 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002037 test_app("skqp_app") {
2038 is_shared_library = true
2039 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002040 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002041 ]
2042 deps = [
2043 ":skia",
2044 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002045 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002046 ]
2047 libs = [ "android" ]
2048 }
2049 }
Stan Iliev93151722018-08-02 11:10:52 -04002050 if (is_android && skia_enable_gpu) {
2051 test_app("skottie_android") {
2052 is_shared_library = true
2053
2054 sources = [
2055 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2056 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2057 ]
2058 libs = []
2059
2060 include_dirs = []
2061 deps = [
2062 ":skia",
2063 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002064 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002065 ]
2066 }
2067 }
Hal Canary75427132017-10-11 16:00:31 -04002068
Hal Canarya9de7602018-01-19 13:08:23 -05002069 test_app("list_gms") {
2070 sources = [
2071 "tools/list_gms.cpp",
2072 ]
2073 deps = [
2074 ":gm",
2075 ":skia",
2076 ]
2077 }
2078 test_app("list_gpu_unit_tests") {
2079 sources = [
2080 "dm/DMGpuTestProcs.cpp",
2081 "tools/list_gpu_unit_tests.cpp",
2082 ]
2083 deps = [
2084 ":skia",
2085 ":tests",
2086 ]
2087 }
2088
Brian Osmanc9a42472018-05-31 13:17:12 -04002089 test_lib("sk_app") {
2090 public_include_dirs = [ "tools/sk_app" ]
2091 sources = [
2092 "tools/sk_app/CommandSet.cpp",
2093 "tools/sk_app/GLWindowContext.cpp",
2094 "tools/sk_app/Window.cpp",
2095 ]
2096 libs = []
2097
2098 if (is_android) {
2099 sources += [
2100 "tools/sk_app/android/GLWindowContext_android.cpp",
2101 "tools/sk_app/android/RasterWindowContext_android.cpp",
2102 "tools/sk_app/android/Window_android.cpp",
2103 "tools/sk_app/android/main_android.cpp",
2104 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002105 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002106 libs += [ "android" ]
2107 } else if (is_linux) {
2108 sources += [
2109 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2110 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2111 "tools/sk_app/unix/Window_unix.cpp",
2112 "tools/sk_app/unix/keysym2ucs.c",
2113 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002114 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002115 libs += [
2116 "GL",
2117 "X11",
2118 ]
2119 } else if (is_win) {
2120 sources += [
2121 "tools/sk_app/win/GLWindowContext_win.cpp",
2122 "tools/sk_app/win/RasterWindowContext_win.cpp",
2123 "tools/sk_app/win/Window_win.cpp",
2124 "tools/sk_app/win/main_win.cpp",
2125 ]
Brian Salomon194db172017-08-17 14:37:06 -04002126 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002127 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002128 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002129 } else if (is_mac) {
2130 sources += [
2131 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2132 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2133 "tools/sk_app/mac/Window_mac.cpp",
2134 "tools/sk_app/mac/main_mac.cpp",
2135 ]
2136 libs += [
2137 "QuartzCore.framework",
2138 "Cocoa.framework",
2139 "Foundation.framework",
2140 ]
2141 } else if (is_ios) {
2142 sources += [
2143 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2144 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2145 "tools/sk_app/ios/Window_ios.cpp",
2146 "tools/sk_app/ios/main_ios.cpp",
2147 ]
2148 }
2149
2150 if (skia_use_vulkan) {
2151 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2152 if (is_android) {
2153 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2154 } else if (is_linux) {
2155 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2156 libs += [ "X11-xcb" ]
2157 } else if (is_win) {
2158 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2159 }
2160 }
2161
2162 deps = [
2163 ":gpu_tool_utils",
2164 ":skia",
2165 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002166 ]
2167 if (is_android) {
2168 deps += [ "//third_party/native_app_glue" ]
2169 } else if (is_mac || is_ios) {
2170 deps += [ "//third_party/libsdl" ]
2171 }
2172 if (skia_use_angle) {
2173 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002174 }
Brian Osman16adfa32016-10-18 14:42:44 -04002175 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002176
Brian Osmanc9a42472018-05-31 13:17:12 -04002177 test_app("viewer") {
2178 is_shared_library = is_android
2179 if (is_ios) {
2180 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002181 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002182 sources = [
2183 "tools/viewer/BisectSlide.cpp",
2184 "tools/viewer/GMSlide.cpp",
2185 "tools/viewer/ImGuiLayer.cpp",
2186 "tools/viewer/ImageSlide.cpp",
2187 "tools/viewer/SKPSlide.cpp",
2188 "tools/viewer/SampleSlide.cpp",
2189 "tools/viewer/SkottieSlide.cpp",
2190 "tools/viewer/SlideDir.cpp",
2191 "tools/viewer/StatsLayer.cpp",
2192 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002193 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002194 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002195 "tools/viewer/Viewer.cpp",
2196 ]
2197 libs = []
2198
Kevin Lubickd9699322018-10-30 15:08:53 -04002199 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002200 deps = [
2201 ":experimental_svg_model",
2202 ":flags",
2203 ":gm",
2204 ":gpu_tool_utils",
2205 ":samples",
2206 ":sk_app",
2207 ":skia",
2208 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002209 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002210 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002211 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002212 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002213 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002214 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002215
2216 # NIMA does not build on Windows clang
2217 if (!is_win || !is_clang) {
2218 sources += [ "tools/viewer/NIMASlide.cpp" ]
2219 deps += [ "//third_party/Nima-Cpp" ]
2220 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002221 }
2222
ziadbbceddbc2018-06-19 13:57:15 -04002223 if (is_android) {
2224 test_app("arcore") {
2225 is_shared_library = true
2226 configs = [
2227 ":skia_public",
2228 "gn:default",
2229 ]
2230
2231 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2232 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2233 sources = []
2234 sources += skia_core_sources
2235 sources += skia_utils_sources
2236 sources += skia_xps_sources
2237 sources += [
2238 "src/android/SkAndroidFrameworkUtils.cpp",
2239 "src/android/SkAnimatedImage.cpp",
2240 "src/android/SkBitmapRegionCodec.cpp",
2241 "src/android/SkBitmapRegionDecoder.cpp",
2242 "src/codec/SkAndroidCodec.cpp",
2243 "src/codec/SkBmpBaseCodec.cpp",
2244 "src/codec/SkBmpCodec.cpp",
2245 "src/codec/SkBmpMaskCodec.cpp",
2246 "src/codec/SkBmpRLECodec.cpp",
2247 "src/codec/SkBmpStandardCodec.cpp",
2248 "src/codec/SkCodec.cpp",
2249 "src/codec/SkCodecImageGenerator.cpp",
2250 "src/codec/SkColorTable.cpp",
2251 "src/codec/SkGifCodec.cpp",
2252 "src/codec/SkMaskSwizzler.cpp",
2253 "src/codec/SkMasks.cpp",
2254 "src/codec/SkSampledCodec.cpp",
2255 "src/codec/SkSampler.cpp",
2256 "src/codec/SkStreamBuffer.cpp",
2257 "src/codec/SkSwizzler.cpp",
2258 "src/codec/SkWbmpCodec.cpp",
2259 "src/images/SkImageEncoder.cpp",
2260 "src/ports/SkDiscardableMemory_none.cpp",
2261 "src/ports/SkImageGenerator_skia.cpp",
2262 "src/ports/SkMemory_malloc.cpp",
2263 "src/ports/SkOSFile_stdio.cpp",
2264 "src/sfnt/SkOTTable_name.cpp",
2265 "src/sfnt/SkOTUtils.cpp",
2266 "src/utils/mac/SkStream_mac.cpp",
2267 "third_party/gif/SkGifImageReader.cpp",
2268 ]
2269 deps = [
2270 ":tool_utils",
2271 "modules/skottie",
2272 "modules/skshaper",
2273 ]
2274 }
2275 }
2276
Brian Osmanc9a42472018-05-31 13:17:12 -04002277 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002278 test_app("HelloWorld") {
2279 sources = [
2280 "example/HelloWorld.cpp",
2281 ]
2282 libs = []
2283
2284 include_dirs = []
2285 deps = [
2286 ":flags",
2287 ":gpu_tool_utils",
2288 ":sk_app",
2289 ":skia",
2290 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002291 ]
2292 }
2293 }
2294
Brian Osmanc9a42472018-05-31 13:17:12 -04002295 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002296 test_app("SkiaSDLExample") {
2297 sources = [
2298 "example/SkiaSDLExample.cpp",
2299 ]
2300 libs = []
2301 include_dirs = []
2302 deps = [
2303 ":gpu_tool_utils",
2304 ":skia",
2305 "//third_party/libsdl",
2306 ]
2307 }
2308 }
2309
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002310 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2311 action_foreach("generate_mocs") {
2312 script = "gn/call.py"
2313 sources = [
2314 "tools/mdbviz/MainWindow.h",
2315 ]
2316 outputs = [
2317 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2318 ]
2319 args = [
2320 "$skia_qt_path" + "/bin/moc",
2321 "{{source}}",
2322 "-o",
2323 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2324 ]
2325 }
2326 action_foreach("generate_resources") {
2327 script = "gn/call.py"
2328 sources = [
2329 "tools/mdbviz/resources.qrc",
2330 ]
2331 outputs = [
2332 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2333 ]
2334 args = [
2335 "$skia_qt_path" + "/bin/rcc",
2336 "{{source}}",
2337 "-o",
2338 "gen/mdbviz/{{source_name_part}}_res.cpp",
2339 ]
2340 }
2341 test_app("mdbviz") {
2342 if (is_win) {
2343 # on Windows we need to disable some exception handling warnings due to the Qt headers
2344 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2345 }
2346 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002347 "tools/UrlDataManager.cpp",
2348 "tools/debugger/SkDebugCanvas.cpp",
2349 "tools/debugger/SkDrawCommand.cpp",
2350 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002351 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002352 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002353 "tools/mdbviz/main.cpp",
2354
2355 # generated files
2356 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2357 "$target_gen_dir/mdbviz/resources_res.cpp",
2358 ]
2359 lib_dirs = [ "$skia_qt_path/lib" ]
2360 libs = [
2361 "Qt5Core.lib",
2362 "Qt5Gui.lib",
2363 "Qt5Widgets.lib",
2364 ]
2365 include_dirs = [
2366 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002367 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002368 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002369 "tools",
2370 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002371 ]
2372 deps = [
2373 ":generate_mocs",
2374 ":generate_resources",
2375 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002376 "//third_party/jsoncpp",
2377 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002378 ]
2379 }
2380 }
2381
Mike Kleine459afd2017-03-03 09:21:30 -05002382 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002383 copy("gdbserver") {
2384 sources = [
2385 "$ndk/$ndk_gdbserver",
2386 ]
2387 outputs = [
2388 "$root_out_dir/gdbserver",
2389 ]
2390 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002391 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002392
2393 if (skia_use_opencl) {
2394 test_app("hello-opencl") {
2395 sources = [
2396 "src/compute/common/cl/assert_cl.c",
2397 "src/compute/common/cl/find_cl.c",
2398 "tools/hello-opencl.cpp",
2399 ]
2400 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002401 if (is_linux) {
2402 libs = [ "OpenCL" ]
2403 } else if (is_win) {
2404 libs = [ "OpenCL.lib" ]
2405 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002406 }
2407 }
mtklein25c81d42016-07-27 13:55:26 -07002408}