blob: 4353580419fcb0709ca3fa28de3a52a30f6cfaba [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
Brian Osman22fabca2018-12-10 11:47:11 -050082 } else if (is_win && target_cpu == "arm64") {
83 skia_use_vulkan = false
Mike Klein4d598a32016-10-31 13:44:49 -040084 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040085 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
86 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040087 }
Jim Van Verth4e502972017-12-07 15:16:10 -050088
89 if (is_ios) {
90 skia_ios_identity = ".*Google.*"
91 skia_ios_profile = "Google Development"
92 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040093}
Brian Salomon789e25e2016-09-30 13:41:03 -040094
Adam Barth54ef74a2017-10-13 10:59:38 -070095if (defined(skia_settings)) {
96 import(skia_settings)
97}
98
Brian Osmanc9a42472018-05-31 13:17:12 -040099# Our tools require static linking (they use non-exported symbols), and the GPU backend.
100skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -0700101
mtklein1211e0c2016-07-26 13:55:45 -0700102skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -0700103 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700104 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "include/codec",
106 "include/config",
107 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -0400108 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -0700109 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400110 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700111 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500112 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700113 "include/pathops",
114 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700115 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700116 "include/utils",
117 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700118]
119
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500120if (skia_enable_atlas_text) {
121 skia_public_includes += [ "include/atlastext" ]
122}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000123
mtkleinc04ff472016-06-23 10:29:30 -0700124# Skia public API, generally provided by :skia.
125config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700126 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400127 defines = []
128 if (is_component_build) {
129 defines += [ "SKIA_DLL" ]
130 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400131 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700132 defines += [ "SK_SAMPLES_FOR_X" ]
133 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400134 if (skia_enable_flutter_defines) {
135 defines += flutter_defines
136 }
mtklein06c35c02016-09-20 12:28:12 -0700137 if (!skia_enable_gpu) {
138 defines += [ "SK_SUPPORT_GPU=0" ]
139 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500140 if (skia_enable_atlas_text) {
141 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
142 }
Mike Reed025f7832018-11-12 09:27:05 -0500143 if (is_fuchsia) {
144 defines += fuchsia_defines
145 }
mtkleinc04ff472016-06-23 10:29:30 -0700146}
147
148# Skia internal APIs, used by Skia itself and a few test tools.
149config("skia_private") {
150 visibility = [ ":*" ]
151
152 include_dirs = [
153 "include/private",
154 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700155 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/core",
157 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700158 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700159 "src/image",
160 "src/images",
161 "src/lazy",
162 "src/opts",
163 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700164 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700165 "src/ports",
166 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400167 "src/shaders",
168 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700169 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700170 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700171 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500172 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700173 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700174 ]
mtklein150d1132016-08-01 06:56:40 -0700175
Mike Reeda9e241d2017-05-03 10:52:00 -0400176 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500177 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700178 defines += [
179 "SK_GAMMA_EXPONENT=1.4",
180 "SK_GAMMA_CONTRAST=0.0",
181 ]
182 }
mtklein88a7ac02016-09-14 11:16:49 -0700183 if (is_official_build || is_android) {
184 # TODO(bsalomon): it'd be nice to make Android normal.
185 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
186 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400187 libs = []
188 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500189 if (skia_enable_gpu) {
190 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500191 if (is_skia_dev_build && skia_use_vulkan) {
Greg Daniel54200e42018-12-11 17:03:39 -0500192 include_dirs += [ "include/third_party/vulkan" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500193 include_dirs += [ "tools/gpu/vk" ]
194 }
Brian Salomon03e05842017-02-23 12:23:47 -0500195 }
Brian Osman34755e22016-12-05 09:46:02 -0500196 if (skia_use_angle) {
197 defines += [ "SK_ANGLE" ]
198 }
Brian Osman3f375d02016-12-28 11:19:22 -0500199 if (skia_enable_discrete_gpu) {
200 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
201 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400202 if (!is_official_build) {
203 defines += [ "GR_TEST_UTILS=1" ]
204 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400205 if (skia_llvm_path != "") {
206 defines += [ "SK_LLVM_AVAILABLE" ]
207 include_dirs += [ "$skia_llvm_path/include" ]
208 libs += [ skia_llvm_lib ]
209 lib_dirs += [ "$skia_llvm_path/lib/" ]
210 }
mtkleinc04ff472016-06-23 10:29:30 -0700211}
212
213# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
214config("skia_library") {
215 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700216 defines = [ "SKIA_IMPLEMENTATION=1" ]
217}
218
219skia_library_configs = [
220 ":skia_public",
221 ":skia_private",
222 ":skia_library",
223]
224
mtklein9b8583d2016-08-24 17:32:30 -0700225# Use for CPU-specific Skia code that needs particular compiler flags.
226template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500227 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700228 if (invoker.enabled) {
229 source_set(target_name) {
230 forward_variables_from(invoker, "*")
231 configs += skia_library_configs
232 }
233 } else {
234 # If not enabled, a phony empty target that swallows all otherwise unused variables.
235 source_set(target_name) {
236 forward_variables_from(invoker,
237 "*",
238 [
239 "sources",
240 "cflags",
241 ])
242 }
243 }
anmittala7eaf2e2016-08-17 13:57:26 -0700244}
245
mtklein422310d2016-08-16 18:28:43 -0700246is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700247
mtklein7d6fb2c2016-08-25 14:50:44 -0700248opts("none") {
249 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700251 cflags = []
252}
253
mtklein7d6fb2c2016-08-25 14:50:44 -0700254opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700255 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700257 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700258}
259
260opts("arm64") {
261 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700262 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700263 cflags = []
264}
265
266opts("crc32") {
267 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700268 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700269 cflags = [ "-march=armv8-a+crc" ]
270}
271
mtklein9b8583d2016-08-24 17:32:30 -0700272opts("sse2") {
273 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700274 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400275 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400276 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
277 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400278 cflags = [ "-msse2" ]
279 }
mtklein9b8583d2016-08-24 17:32:30 -0700280}
mtkleinc04ff472016-06-23 10:29:30 -0700281
mtklein9b8583d2016-08-24 17:32:30 -0700282opts("ssse3") {
283 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700284 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400285 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400286 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
287 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400288 cflags = [ "-mssse3" ]
289 }
mtklein9b8583d2016-08-24 17:32:30 -0700290}
mtkleinc04ff472016-06-23 10:29:30 -0700291
mtklein9b8583d2016-08-24 17:32:30 -0700292opts("sse41") {
293 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700294 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400295 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400296 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
297 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400298 cflags = [ "-msse4.1" ]
299 }
mtklein9b8583d2016-08-24 17:32:30 -0700300}
mtklein4e976072016-08-08 09:06:27 -0700301
mtklein9b8583d2016-08-24 17:32:30 -0700302opts("sse42") {
303 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700304 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400305 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400306 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
307 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400308 cflags = [ "-msse4.2" ]
309 }
mtklein9b8583d2016-08-24 17:32:30 -0700310}
311
312opts("avx") {
313 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700314 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400315 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000316 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400317 } else {
318 cflags = [ "-mavx" ]
319 }
mtkleinc04ff472016-06-23 10:29:30 -0700320}
321
Mike Klein1b9b7d52018-02-27 10:37:40 -0500322opts("hsw") {
323 enabled = is_x86
324 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400325 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500326 cflags = [ "/arch:AVX2" ]
327 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000328 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500329 }
330
331 # Oddly, clang-cl doesn't recognize this as a valid flag.
332 # If it ever does, it'd nice to move this up with -mavx2 and co.
333 if (is_clang && !is_win) {
334 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
335 # but nice to have, generating slightly better code for paths without explicit FMAs.
336 cflags += [ "-ffp-contract=fast" ]
337 }
338}
339
mtkleinc095df52016-08-24 12:23:52 -0700340# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700341template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500342 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700343 if (invoker.enabled) {
344 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700345 if (defined(invoker.public_defines)) {
346 defines = invoker.public_defines
347 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600348 if (defined(invoker.public_configs)) {
349 configs = invoker.public_configs
350 }
mtklein457b42a2016-08-23 13:56:37 -0700351 }
352 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700353 forward_variables_from(invoker,
354 "*",
355 [
356 "public_defines",
357 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700358 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700359 ])
mtklein457b42a2016-08-23 13:56:37 -0700360 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700361 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700362 if (defined(invoker.configs_to_remove)) {
363 configs -= invoker.configs_to_remove
364 }
mtklein457b42a2016-08-23 13:56:37 -0700365 }
366 } else {
mtklein457b42a2016-08-23 13:56:37 -0700367 source_set(target_name) {
368 forward_variables_from(invoker,
369 "*",
370 [
371 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400372 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700373 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700374 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700375 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700376 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700377 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700378 ])
mtkleincd01b032016-08-31 04:58:19 -0700379 if (defined(invoker.sources_when_disabled)) {
380 sources = invoker.sources_when_disabled
381 }
382 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700383 }
mtkleineb3c4252016-08-23 07:38:09 -0700384 }
mtklein457b42a2016-08-23 13:56:37 -0700385}
mtklein457b42a2016-08-23 13:56:37 -0700386
mtkleina45be612016-08-29 15:22:10 -0700387optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500388 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700389
390 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500391 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700392 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700393 ]
394 sources = [
395 "src/ports/SkFontMgr_android.cpp",
396 "src/ports/SkFontMgr_android_factory.cpp",
397 "src/ports/SkFontMgr_android_parser.cpp",
398 ]
399}
400
mtkleind2e39db2016-09-07 07:52:55 -0700401optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500402 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700403
404 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500405 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700406 ]
407 sources = [
408 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500409 "src/ports/SkFontMgr_custom.h",
410 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700411 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500412 "src/ports/SkFontMgr_custom_embedded.cpp",
413 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700414 ]
415}
416
Kevin Lubickddd0a332018-12-12 10:35:13 -0500417optional("fontmgr_wasm") {
418 enabled = target_cpu == "wasm"
419
420 deps = [
421 ":typeface_freetype",
422 ]
423 sources = [
424 "src/ports/SkFontMgr_custom.cpp",
425 "src/ports/SkFontMgr_custom.h",
426 "src/ports/SkFontMgr_custom_embedded.cpp",
427 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
428 ]
429}
430
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800431optional("fontmgr_fuchsia") {
432 enabled = skia_enable_fontmgr_fuchsia
433
434 deps = [
435 "//garnet/public/fidl/fuchsia.fonts",
436 ]
437 sources = [
438 "src/ports/SkFontMgr_fuchsia.cpp",
439 "src/ports/SkFontMgr_fuchsia.h",
440 ]
441}
442
Hal Canaryff2742e2018-01-30 11:35:47 -0500443optional("fontmgr_empty") {
444 enabled = skia_enable_fontmgr_empty
445 sources = [
446 "src/ports/SkFontMgr_empty_factory.cpp",
447 ]
448}
449
mtklein3cc22182016-08-29 13:26:14 -0700450optional("fontmgr_fontconfig") {
451 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700452
453 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500454 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700455 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700456 ]
457 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700458 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700459 "src/ports/SkFontConfigInterface_direct.cpp",
460 "src/ports/SkFontConfigInterface_direct_factory.cpp",
461 "src/ports/SkFontMgr_FontConfigInterface.cpp",
462 "src/ports/SkFontMgr_fontconfig.cpp",
463 "src/ports/SkFontMgr_fontconfig_factory.cpp",
464 ]
465}
466
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500467optional("fontmgr_custom_empty") {
468 enabled = skia_enable_fontmgr_custom_empty
mtkleincdedd0e2016-09-12 15:15:44 -0700469
470 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500471 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700472 ]
473 sources = [
474 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500475 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700476 "src/ports/SkFontMgr_custom_empty_factory.cpp",
477 ]
478}
479
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700480if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400481 executable("sksllex") {
482 sources = [
483 "src/sksl/lex/Main.cpp",
484 "src/sksl/lex/NFA.cpp",
485 "src/sksl/lex/RegexNode.cpp",
486 "src/sksl/lex/RegexParser.cpp",
487 ]
488 include_dirs = [ "src/sksl/lex" ]
489 }
490
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700491 action("run_sksllex") {
492 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400493 deps = [
494 ":sksllex(//gn/toolchain:$host_toolchain)",
495 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700496 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700497 "src/sksl/lex/sksl.lex",
498 ]
499
500 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
501 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
502 outputs = [
503 "$target_out_dir/" +
504 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
505 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
506 # confused due to the same file being named by two different paths
507 ]
508 sksllex_path = "$root_out_dir/"
509 sksllex_path += "sksllex"
510 if (host_os == "win") {
511 sksllex_path += ".exe"
512 }
513 args = [
514 rebase_path(sksllex_path),
515 rebase_path("bin/clang-format"),
516 rebase_path("src"),
517 ]
518 }
519} else {
520 group("run_sksllex") {
521 }
522}
523
524if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400525 executable("skslc") {
526 defines = [ "SKSL_STANDALONE" ]
527 sources = [
528 "src/sksl/SkSLMain.cpp",
529 ]
530 sources += skia_sksl_sources
531 include_dirs = [
532 "src/gpu",
533 "src/sksl",
534 ]
535 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500536 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400537 "//third_party/spirv-tools",
538 ]
539 }
540
541 skia_gpu_processor_outputs = []
542 foreach(src, skia_gpu_processor_sources) {
543 dir = get_path_info(src, "dir")
544 name = get_path_info(src, "name")
545
546 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
547 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
548 skia_gpu_processor_outputs += [
549 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
550 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
551 # confused due to the same file being named by two different paths
552 ]
553 }
554
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500555 action("create_sksl_enums") {
556 script = "gn/create_sksl_enums.py"
557 sources = [
558 "include/private/GrSharedEnums.h",
559 ]
560 outputs = [
561 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500562 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500563 ]
564 args = [
565 rebase_path(sources[0]),
566 rebase_path(outputs[0]),
567 ]
568 }
569
Ethan Nicholas762466e2017-06-29 10:03:38 -0400570 action("compile_processors") {
571 script = "gn/compile_processors.py"
572 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500573 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 ":skslc(//gn/toolchain:$host_toolchain)",
575 ]
576 sources = skia_gpu_processor_sources
577 outputs = skia_gpu_processor_outputs
578 skslc_path = "$root_out_dir/"
579 if (host_toolchain != default_toolchain_name) {
580 skslc_path += "$host_toolchain/"
581 }
582 skslc_path += "skslc"
583 if (host_os == "win") {
584 skslc_path += ".exe"
585 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400586 args = [
587 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400588 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400589 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400590 args += rebase_path(skia_gpu_processor_sources)
591 }
592} else {
593 skia_gpu_processor_outputs = []
594 group("compile_processors") {
595 }
596}
597
Mike Klein33ad63a2018-11-11 07:17:00 -0500598optional("gpu_for_real") {
mtklein06c35c02016-09-20 12:28:12 -0700599 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400600 deps = [
601 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700602 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400603 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700604 if (skia_generate_workarounds) {
605 deps += [ ":workaround_list" ]
606 }
mtkleine9fb3d52016-09-20 15:11:46 -0700607 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600608 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400609 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700610
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400612 if (!skia_enable_ccpr) {
613 sources -= skia_ccpr_sources
614 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
615 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400616 if (!skia_enable_nvpr) {
617 sources -= skia_nvpr_sources
618 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
619 }
mtklein06c35c02016-09-20 12:28:12 -0700620
621 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500622 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700623 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400624 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700625 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400626 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400627
628 # this lib is required to link against AHardwareBuffer
629 if (defined(ndk_api) && ndk_api >= 26) {
630 libs += [ "android" ]
631 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400632 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500633 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400634 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700635 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500636 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400637 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700638 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500639 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800640 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500641 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400642 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500643 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500644 if (target_cpu != "arm64") {
645 libs += [ "OpenGL32.lib" ]
646 }
mtklein06c35c02016-09-20 12:28:12 -0700647 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500648 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700649 }
mtkleine9fb3d52016-09-20 15:11:46 -0700650
651 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400652 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400653 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700654 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700655 if (skia_enable_vulkan_debug_layers) {
656 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
657 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800658 if (is_fuchsia) {
659 public_deps += [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
660 }
mtkleine9fb3d52016-09-20 15:11:46 -0700661 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400662
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400663 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400664 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400665 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
666 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400667
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400668 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400669 if (skia_use_metal) {
670 public_defines += [ "SK_METAL" ]
671 sources += skia_metal_sources
672 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400673 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400674 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400675 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500676
677 if (skia_enable_atlas_text) {
678 sources += skia_atlas_text_sources
679 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400680
681 if (is_debug) {
682 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
683 }
mtklein06c35c02016-09-20 12:28:12 -0700684}
685
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400686optional("heif") {
687 enabled = skia_use_libheif
688 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
689
690 deps = []
691
692 sources = [
693 "src/codec/SkHeifCodec.cpp",
694 ]
695}
696
mtklein63213812016-08-24 09:55:56 -0700697optional("jpeg") {
698 enabled = skia_use_libjpeg_turbo
699 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
700
mtklein63213812016-08-24 09:55:56 -0700701 deps = [
702 "//third_party/libjpeg-turbo:libjpeg",
703 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400704 public = [
705 "include/encode/SkJpegEncoder.h",
706 ]
mtklein63213812016-08-24 09:55:56 -0700707 sources = [
708 "src/codec/SkJpegCodec.cpp",
709 "src/codec/SkJpegDecoderMgr.cpp",
710 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700711 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400712 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700713 ]
714}
715
716optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500717 enabled = skia_use_zlib && skia_enable_pdf
718 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700719
mtklein63213812016-08-24 09:55:56 -0700720 deps = [
721 "//third_party/zlib",
722 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400723 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700724 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400725 }
brettwb9447282016-09-01 14:24:39 -0700726 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700727 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700728
729 if (skia_use_sfntly) {
730 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500731 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700732 }
733}
734
735optional("png") {
736 enabled = skia_use_libpng
737 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
738
mtklein63213812016-08-24 09:55:56 -0700739 deps = [
740 "//third_party/libpng",
741 ]
742 sources = [
743 "src/codec/SkIcoCodec.cpp",
744 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400745 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700746 ]
747}
748
scroggof84ad642016-10-31 09:02:57 -0700749optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400750 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700751 public_defines = [ "SK_CODEC_DECODES_RAW" ]
752
753 deps = [
754 "//third_party/dng_sdk",
755 "//third_party/libjpeg-turbo:libjpeg",
756 "//third_party/piex",
757 ]
758
759 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
760 # Skia.
761 configs_to_remove = [ "//gn:no_exceptions" ]
762
763 sources = [
scroggof84ad642016-10-31 09:02:57 -0700764 "src/codec/SkRawCodec.cpp",
765 ]
766}
767
Mike Klein852a8cb2018-05-15 10:46:58 -0400768import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400769source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400770 cflags = []
771 if (!is_win || is_clang) {
772 cflags += [
773 "-w",
774 "-std=c11",
775 ]
776 }
777
778 public = [
779 "third_party/skcms/skcms.h",
780 ]
781 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
782}
783
mtklein3cc22182016-08-29 13:26:14 -0700784optional("typeface_freetype") {
785 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700786
787 deps = [
788 "//third_party/freetype2",
789 ]
790 sources = [
791 "src/ports/SkFontHost_FreeType.cpp",
792 "src/ports/SkFontHost_FreeType_common.cpp",
793 ]
794}
795
mtklein457b42a2016-08-23 13:56:37 -0700796optional("webp") {
797 enabled = skia_use_libwebp
798 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
799
mtklein457b42a2016-08-23 13:56:37 -0700800 deps = [
801 "//third_party/libwebp",
802 ]
803 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700804 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400805 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700806 ]
mtkleineb3c4252016-08-23 07:38:09 -0700807}
808
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400809optional("wuffs") {
810 enabled = skia_use_wuffs
811 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
812
813 deps = [
814 "//third_party/wuffs",
815 ]
816 sources = [
817 "src/codec/SkWuffsCodec.cpp",
818 ]
819}
820
mtklein63213812016-08-24 09:55:56 -0700821optional("xml") {
822 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000823 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700824
mtklein63213812016-08-24 09:55:56 -0700825 deps = [
826 "//third_party/expat",
827 ]
828 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500829 "src/svg/SkSVGCanvas.cpp",
830 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700831 "src/xml/SkDOM.cpp",
832 "src/xml/SkXMLParser.cpp",
833 "src/xml/SkXMLWriter.cpp",
834 ]
835}
836
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700837if (skia_enable_gpu && skia_generate_workarounds) {
838 action("workaround_list") {
839 script = "tools/build_workaround_header.py"
840
841 inputs = [
842 "src/gpu/gpu_workaround_list.txt",
843 ]
844
845 # see comments in skia_compile_processors about out dir path shenanigans.
846 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700847 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700848
849 outputs = [
850 "$root_out_dir/$output_file",
851 ]
852 args = [
853 "--output-file",
854 "$output_file",
855 ]
856
857 foreach(file, inputs) {
858 args += [ rebase_path(file, root_build_dir) ]
859 }
860 }
861}
862
Mike Klein33ad63a2018-11-11 07:17:00 -0500863# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them.
864# TODO: rename :gpu_for_real back to :gpu when cleaning up.
865source_set("effects") {
866}
867source_set("gpu") {
868}
869
mtkleinc04ff472016-06-23 10:29:30 -0700870component("skia") {
871 public_configs = [ ":skia_public" ]
872 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700873
Mike Klein607b0a72018-11-07 16:17:34 -0500874 public_deps = [
Mike Klein33ad63a2018-11-11 07:17:00 -0500875 ":gpu_for_real",
Mike Klein607b0a72018-11-07 16:17:34 -0500876 ":pdf",
877 ":skcms",
878 ]
879
mtkleinc04ff472016-06-23 10:29:30 -0700880 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700881 ":arm64",
882 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700883 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000884 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700885 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700886 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700887 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500888 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500889 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700890 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800891 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500892 ":fontmgr_wasm",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400893 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500894 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700895 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700896 ":none",
mtklein63213812016-08-24 09:55:56 -0700897 ":png",
scroggof84ad642016-10-31 09:02:57 -0700898 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700899 ":sse2",
900 ":sse41",
901 ":sse42",
902 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700903 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400904 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700905 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700906 ]
907
Kevin Lubick134be1d2018-10-30 15:05:04 -0400908 if (skia_enable_nima) {
909 deps += [ "//third_party/Nima-Cpp" ]
910 }
911
Chinmay Garde43f115c2016-11-16 15:04:12 -0800912 # This file (and all GN files in Skia) are designed to work with an
913 # empty sources assignment filter; we handle all that explicitly.
914 # We clear the filter here for clients who may have set up a global filter.
915 set_sources_assignment_filter([])
916
mtkleinc04ff472016-06-23 10:29:30 -0700917 sources = []
brettwb9447282016-09-01 14:24:39 -0700918 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700919 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500920 sources += skia_xps_sources
Mike Klein54378232018-11-08 12:08:05 +0000921 sources += skia_effects_sources
922 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700923 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400924 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500925 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700926 "src/android/SkBitmapRegionCodec.cpp",
927 "src/android/SkBitmapRegionDecoder.cpp",
928 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100929 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400930 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700931 "src/codec/SkBmpCodec.cpp",
932 "src/codec/SkBmpMaskCodec.cpp",
933 "src/codec/SkBmpRLECodec.cpp",
934 "src/codec/SkBmpStandardCodec.cpp",
935 "src/codec/SkCodec.cpp",
936 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400937 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400938 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700939 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700940 "src/codec/SkMaskSwizzler.cpp",
941 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700942 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700943 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700944 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700945 "src/codec/SkSwizzler.cpp",
946 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700947 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700948 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000949 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700950 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700951 "src/ports/SkMemory_malloc.cpp",
952 "src/ports/SkOSFile_stdio.cpp",
953 "src/sfnt/SkOTTable_name.cpp",
954 "src/sfnt/SkOTUtils.cpp",
955 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700956 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700957 ]
brettwb9447282016-09-01 14:24:39 -0700958
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400959 defines = []
960 if (!skia_enable_skpicture) {
961 defines = [ "SK_DISABLE_SKPICTURE" ]
962 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000963 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400964 sources += [ "src/core/SkPicture_none.cpp" ]
965 }
966
mtklein7d6fb2c2016-08-25 14:50:44 -0700967 libs = []
968
mtkleinc04ff472016-06-23 10:29:30 -0700969 if (is_win) {
970 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400971 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700972 "src/ports/SkDebug_win.cpp",
973 "src/ports/SkFontHost_win.cpp",
974 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500975 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700976 "src/ports/SkImageEncoder_WIC.cpp",
977 "src/ports/SkImageGeneratorWIC.cpp",
978 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700979 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700980 "src/ports/SkScalerContext_win_dw.cpp",
981 "src/ports/SkTLS_win.cpp",
982 "src/ports/SkTypeface_win_dw.cpp",
983 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400984 libs += [
985 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500986 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400987 "Ole32.lib",
988 "OleAut32.lib",
989 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500990 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400991 ]
mtkleinc04ff472016-06-23 10:29:30 -0700992 } else {
993 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700994 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700995 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700996 "src/ports/SkTLS_pthread.cpp",
997 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400998 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700999 }
1000
mtklein7d6fb2c2016-08-25 14:50:44 -07001001 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001002 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001003 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001004 deps += [ "//third_party/cpu-features" ]
1005 }
mtklein06c35c02016-09-20 12:28:12 -07001006 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001007 libs += [
1008 "EGL",
1009 "GLESv2",
1010 "log",
1011 ]
1012 }
1013
Kevin Lubick217056c2018-09-20 17:39:31 -04001014 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001015 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001016 if (skia_use_egl) {
1017 libs += [ "GLESv2" ]
1018 }
mtkleinc04ff472016-06-23 10:29:30 -07001019 }
1020
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001021 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001022 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001023 }
1024
mtkleinc04ff472016-06-23 10:29:30 -07001025 if (is_mac) {
1026 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001027 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001028 "src/ports/SkImageEncoder_CG.cpp",
1029 "src/ports/SkImageGeneratorCG.cpp",
1030 ]
mtklein09e61f72016-08-23 13:35:28 -07001031 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001032 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1033 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001034 "ApplicationServices.framework",
1035 "OpenGL.framework",
1036 ]
mtkleinc04ff472016-06-23 10:29:30 -07001037 }
abarth6fc8ff02016-07-15 15:15:15 -07001038
Mike Klein7d302882016-11-03 14:06:31 -04001039 if (is_ios) {
1040 sources += [
1041 "src/ports/SkDebug_stdio.cpp",
1042 "src/ports/SkFontHost_mac.cpp",
1043 "src/ports/SkImageEncoder_CG.cpp",
1044 "src/ports/SkImageGeneratorCG.cpp",
1045 ]
1046 libs += [
1047 "CoreFoundation.framework",
1048 "CoreGraphics.framework",
1049 "CoreText.framework",
1050 "ImageIO.framework",
1051 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001052
1053 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1054 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001055 ]
1056 }
1057
abarth6fc8ff02016-07-15 15:15:15 -07001058 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001059 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001060 }
mtkleinc04ff472016-06-23 10:29:30 -07001061}
1062
Kevin Lubickcbcff382018-10-02 09:02:18 -04001063static_library("pathkit") {
1064 public_configs = [ ":skia_public" ]
1065 configs += skia_library_configs
1066
1067 deps = [
1068 ":arm64",
1069 ":armv7",
1070 ":avx",
1071 ":crc32",
1072 ":hsw",
1073 ":none",
1074 ":sse2",
1075 ":sse41",
1076 ":sse42",
1077 ":ssse3",
1078 ]
1079
1080 # This file (and all GN files in Skia) are designed to work with an
1081 # empty sources assignment filter; we handle all that explicitly.
1082 # We clear the filter here for clients who may have set up a global filter.
1083 set_sources_assignment_filter([])
1084
1085 sources = []
1086 sources += skia_pathops_sources
1087 sources += [
1088 "src/core/SkAnalyticEdge.cpp",
1089 "src/core/SkArenaAlloc.cpp",
1090 "src/core/SkCubicMap.cpp",
1091 "src/core/SkEdge.cpp",
1092 "src/core/SkEdgeBuilder.cpp",
1093 "src/core/SkEdgeClipper.cpp",
1094 "src/core/SkGeometry.cpp",
1095 "src/core/SkLineClipper.cpp",
1096 "src/core/SkMallocPixelRef.cpp",
1097 "src/core/SkMath.cpp",
1098 "src/core/SkMatrix.cpp",
1099 "src/core/SkOpts.cpp",
1100 "src/core/SkPaint.cpp",
1101 "src/core/SkPath.cpp",
1102 "src/core/SkPathEffect.cpp",
1103 "src/core/SkPathMeasure.cpp",
1104 "src/core/SkPathRef.cpp",
1105 "src/core/SkPoint.cpp",
1106 "src/core/SkRRect.cpp",
1107 "src/core/SkRect.cpp",
1108 "src/core/SkSemaphore.cpp",
1109 "src/core/SkStream.cpp",
1110 "src/core/SkString.cpp",
1111 "src/core/SkStringUtils.cpp",
1112 "src/core/SkStroke.cpp",
1113 "src/core/SkStrokeRec.cpp",
1114 "src/core/SkStrokerPriv.cpp",
1115 "src/core/SkThreadID.cpp",
1116 "src/core/SkUtils.cpp",
1117 "src/effects/SkDashPathEffect.cpp",
1118 "src/effects/SkTrimPathEffect.cpp",
1119 "src/ports/SkDebug_stdio.cpp",
1120 "src/ports/SkMemory_malloc.cpp",
1121 "src/utils/SkDashPath.cpp",
1122 "src/utils/SkParse.cpp",
1123 "src/utils/SkParsePath.cpp",
1124 "src/utils/SkUTF.cpp",
1125 ]
1126}
1127
mtkleinc095df52016-08-24 12:23:52 -07001128# Targets guarded by skia_enable_tools may use //third_party freely.
1129if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001130 # Used by gn_to_bp.py to list our public include dirs.
1131 source_set("public") {
1132 configs += [ ":skia_public" ]
1133 }
1134
Mike Kleinc36dedf2016-11-18 09:35:28 -05001135 config("skia.h_config") {
1136 include_dirs = [ "$target_gen_dir" ]
1137 }
1138 action("skia.h") {
1139 public_configs = [ ":skia.h_config" ]
1140 skia_h = "$target_gen_dir/skia.h"
1141 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001142
1143 # TODO: would be cool to not hard-code these here, but how?
1144 module_public_includes = [
1145 "modules/sksg/include",
1146 "modules/skottie/include",
1147 ]
1148 args =
1149 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1150 [ rebase_path(skia_h, root_build_dir) ] +
1151 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001152 depfile = "$skia_h.deps"
1153 outputs = [
1154 skia_h,
1155 ]
1156 }
1157
Brian Osmanc9a42472018-05-31 13:17:12 -04001158 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001159 executable("fiddle") {
1160 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001161 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001162 "tools/fiddle/draw.cpp",
1163 "tools/fiddle/fiddle_main.cpp",
1164 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001165
1166 if (skia_use_egl) {
1167 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001168 } else {
1169 sources += [ "tools/fiddle/null_context.cpp" ]
1170 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001171 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001172 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001173 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001174 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001175 ":skia",
1176 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001177 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001178 ]
1179 }
1180 }
1181
Brian Osmanc9a42472018-05-31 13:17:12 -04001182 source_set("public_headers_warnings_check") {
1183 sources = [
1184 "tools/public_headers_warnings_check.cpp",
1185 ]
1186 configs -= [ "//gn:warnings_except_public_headers" ]
1187 deps = [
1188 ":skia",
1189 ":skia.h",
1190 "modules/skottie",
1191 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001192
1193 # We add this directory to simulate the client already have
1194 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001195 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001196 }
1197
mtkleinc095df52016-08-24 12:23:52 -07001198 template("test_lib") {
1199 config(target_name + "_config") {
1200 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001201 if (defined(invoker.public_defines)) {
1202 defines = invoker.public_defines
1203 }
mtklein25c81d42016-07-27 13:55:26 -07001204 }
mtkleinc095df52016-08-24 12:23:52 -07001205 source_set(target_name) {
1206 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1207 public_configs = [
1208 ":" + target_name + "_config",
1209 ":skia_private",
1210 ]
1211
1212 if (!defined(deps)) {
1213 deps = []
1214 }
1215 deps += [ ":skia" ]
1216 testonly = true
1217 }
mtklein25c81d42016-07-27 13:55:26 -07001218 }
mtklein25c81d42016-07-27 13:55:26 -07001219
Mike Kleine6682eb2017-01-05 10:54:57 -05001220 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001221 if (is_ios) {
1222 app_name = target_name
1223 gen_path = target_gen_dir
1224
1225 action("${app_name}_generate_info_plist") {
1226 script = "//gn/gen_plist_ios.py"
1227 outputs = [
1228 "$gen_path/${app_name}_Info.plist",
1229 ]
1230 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1231 }
1232
1233 bundle_data("${app_name}_bundle_info_plist") {
1234 public_deps = [
1235 ":${app_name}_generate_info_plist",
1236 ]
1237 sources = [
1238 "$gen_path/${app_name}_Info.plist",
1239 ]
1240 outputs = [
1241 "{{bundle_root_dir}}/Info.plist",
1242 ]
1243 }
1244
Jim Van Verth329c5a62017-11-29 11:42:33 -05001245 bundle_ios_data =
1246 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1247
1248 if (bundle_ios_data) {
1249 has_skps =
1250 "True" == exec_script("//gn/checkdir.py",
1251 [ rebase_path("skps", root_build_dir) ],
1252 "trim string")
1253 bundle_data("${app_name}_bundle_resources") {
1254 sources = [
1255 "resources",
1256 ]
1257 outputs = [
1258 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1259 "{{bundle_resources_dir}}/data/resources",
1260 ]
1261 }
1262
1263 if (has_skps) {
1264 bundle_data("${app_name}_bundle_skps") {
1265 sources = [
1266 "skps",
1267 ]
1268 outputs = [
1269 # Store in same folder as resources
1270 "{{bundle_resources_dir}}/data/skps",
1271 ]
1272 }
1273 }
1274 }
1275
Jim Van Verth443a9132017-11-28 09:45:26 -05001276 executable("${app_name}_generate_executable") {
1277 forward_variables_from(invoker,
1278 "*",
1279 [
1280 "output_name",
1281 "visibility",
1282 "is_shared_library",
1283 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001284 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001285 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001286 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1287 }
1288
1289 bundle_data("${app_name}_bundle_executable") {
1290 public_deps = [
1291 ":${app_name}_generate_executable",
1292 ]
1293 sources = [
1294 "$gen_path/$app_name",
1295 ]
1296 outputs = [
1297 "{{bundle_executable_dir}}/$app_name",
1298 ]
1299 testonly = true
1300 }
1301
1302 create_bundle("$app_name") {
1303 product_type = "com.apple.product-type.application"
1304 testonly = true
1305
1306 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1307 bundle_resources_dir = bundle_root_dir
1308 bundle_executable_dir = bundle_root_dir
1309 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1310
1311 deps = [
1312 ":${app_name}_bundle_executable",
1313 ":${app_name}_bundle_info_plist",
1314 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001315 if (bundle_ios_data) {
1316 deps += [ ":${app_name}_bundle_resources" ]
1317 if (has_skps) {
1318 deps += [ ":${app_name}_bundle_skps" ]
1319 }
1320 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001321
1322 # should only code sign when running on a device, not the simulator
1323 if (target_cpu != "x64") {
1324 code_signing_script = "//gn/codesign_ios.py"
1325 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1326 code_signing_outputs = [
1327 "$bundle_root_dir/_CodeSignature/CodeResources",
1328 "$bundle_root_dir/embedded.mobileprovision",
1329 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001330 code_signing_args = [
1331 rebase_path("$bundle_root_dir", root_build_dir),
1332 skia_ios_identity,
1333 skia_ios_profile,
1334 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001335 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001336 }
1337 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001338 # !is_ios
1339
1340 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1341 shared_library("lib" + target_name) {
1342 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1343 configs += [ ":skia_private" ]
1344 testonly = true
1345 }
1346 } else {
1347 _executable = target_name
1348 executable(_executable) {
1349 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1350 configs += [ ":skia_private" ]
1351 testonly = true
1352 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001353 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001354 if (is_android && skia_android_serial != "" && defined(_executable)) {
1355 action("push_" + target_name) {
1356 script = "gn/push_to_android.py"
1357 deps = [
1358 ":" + _executable,
1359 ]
1360 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1361 outputs = [
1362 _stamp,
1363 ]
1364 args = [
1365 rebase_path("$root_build_dir/$_executable"),
1366 skia_android_serial,
1367 rebase_path(_stamp),
1368 ]
1369 testonly = true
1370 }
Mike Klein7d921032017-01-05 12:20:41 -05001371 }
1372 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001373 }
1374
Greg Danielda16cce2018-08-01 09:23:57 -04001375 config("moltenvk_config") {
1376 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1377 if (is_ios) {
1378 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1379 } else {
1380 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1381 }
1382 cflags = [ "-F$moltenvk_framework_path" ]
1383 ldflags = [ "-F$moltenvk_framework_path" ]
1384 libs = [
1385 "MoltenVK.framework",
1386 "Metal.framework",
1387 "IOSurface.framework",
1388 "QuartzCore.framework",
1389 "Foundation.framework",
1390 ]
1391 if (is_ios) {
1392 libs += [ "UIKit.framework" ]
1393 } else {
1394 libs += [ "IOKit.framework" ]
1395 }
1396 defines = [ "SK_MOLTENVK" ]
1397 }
1398 }
1399
1400 source_set("moltenvk") {
1401 public_configs = [ ":moltenvk_config" ]
1402 }
1403
mtkleinc095df52016-08-24 12:23:52 -07001404 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001405 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001406 public_defines = []
1407 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001408
Brian Osmanc9a42472018-05-31 13:17:12 -04001409 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001410 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001411 sources = [
1412 "tools/gpu/GrContextFactory.cpp",
1413 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001414 "tools/gpu/MemoryCache.cpp",
1415 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001416 "tools/gpu/ProxyUtils.cpp",
1417 "tools/gpu/TestContext.cpp",
1418 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1419 "tools/gpu/gl/GLTestContext.cpp",
1420 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001421 "tools/gpu/gl/null/NullGLTestContext.cpp",
1422 "tools/gpu/mock/MockTestContext.cpp",
1423 ]
1424 libs = []
1425
1426 if (is_android || skia_use_egl) {
1427 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1428 } else if (is_ios) {
1429 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1430 libs += [ "OpenGLES.framework" ]
1431 } else if (is_linux) {
1432 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001433 libs += [
1434 "GLU",
1435 "X11",
1436 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001437 } else if (is_mac) {
1438 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1439 } else if (is_win) {
1440 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001441 libs += [ "Gdi32.lib" ]
1442 if (target_cpu != "arm64") {
1443 libs += [ "OpenGL32.lib" ]
1444 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001445 }
mtklein25c81d42016-07-27 13:55:26 -07001446
Brian Osmanc9a42472018-05-31 13:17:12 -04001447 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001448
Brian Osmanc9a42472018-05-31 13:17:12 -04001449 if (skia_use_angle) {
1450 deps += [ "//third_party/angle2" ]
1451 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1452 }
Greg Daniel54200e42018-12-11 17:03:39 -05001453
Brian Osmanc9a42472018-05-31 13:17:12 -04001454 if (skia_use_vulkan) {
1455 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1456 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001457 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1458 public_deps += [ ":moltenvk" ]
1459 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001460 }
1461 if (skia_use_metal) {
1462 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001463 }
mtklein25c81d42016-07-27 13:55:26 -07001464 }
mtklein25c81d42016-07-27 13:55:26 -07001465
mtkleinc095df52016-08-24 12:23:52 -07001466 test_lib("flags") {
1467 public_include_dirs = [ "tools/flags" ]
1468 sources = [
1469 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001470 ]
1471 }
1472 test_lib("common_flags") {
1473 public_include_dirs = [ "tools/flags" ]
1474 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001475 "tools/flags/SkCommonFlags.cpp",
1476 "tools/flags/SkCommonFlagsConfig.cpp",
1477 ]
1478 deps = [
mtklein046cb562016-09-16 10:23:12 -07001479 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001480 ]
1481 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001482 ":gpu_tool_utils",
1483 ]
1484 }
mtklein25c81d42016-07-27 13:55:26 -07001485
mtkleinc095df52016-08-24 12:23:52 -07001486 test_lib("tool_utils") {
1487 public_include_dirs = [
1488 "tools",
1489 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001490 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001491 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001492 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001493 ]
1494 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001495 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001496 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001497 "tools/DDLPromiseImageHelper.cpp",
1498 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001499 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001500 "tools/ProcStats.cpp",
1501 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001502 "tools/UrlDataManager.cpp",
1503 "tools/debugger/SkDebugCanvas.cpp",
1504 "tools/debugger/SkDrawCommand.cpp",
1505 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001506 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001507 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001508 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001509 "tools/fonts/SkTestFontMgr.h",
1510 "tools/fonts/SkTestSVGTypeface.cpp",
1511 "tools/fonts/SkTestSVGTypeface.h",
1512 "tools/fonts/SkTestTypeface.cpp",
1513 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001514 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001515 "tools/random_parse_path.cpp",
1516 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001517 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001518 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001519 "tools/trace/SkChromeTracingTracer.cpp",
1520 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001521 "tools/trace/SkDebugfTracer.cpp",
1522 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001523 "tools/trace/SkEventTracingPriv.cpp",
1524 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001525 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001526 libs = []
1527 if (is_ios) {
1528 sources += [ "tools/ios_utils.m" ]
1529 libs += [ "Foundation.framework" ]
1530 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001531 defines = []
1532 if (skia_tools_require_resources) {
1533 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1534 }
mtkleinc095df52016-08-24 12:23:52 -07001535 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001536 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001537 ":flags",
1538 "//third_party/libpng",
1539 ]
1540 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001541 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001542 "//third_party/jsoncpp",
1543 ]
1544 }
mtklein25c81d42016-07-27 13:55:26 -07001545
Mike Klein6e744122016-10-27 12:21:40 -04001546 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001547 test_lib("gm") {
1548 public_include_dirs = [ "gm" ]
1549 sources = gm_sources
1550 deps = [
scroggo19b91532016-10-24 09:03:26 -07001551 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001552 ":skia",
1553 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001554 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001555 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001556 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001557 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001558 public_deps = [
1559 ":gpu_tool_utils",
1560 ]
mtkleinc095df52016-08-24 12:23:52 -07001561 }
mtklein25c81d42016-07-27 13:55:26 -07001562
Mike Klein6e744122016-10-27 12:21:40 -04001563 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001564 test_lib("tests") {
1565 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001566 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001567 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001568 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001569 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001570 if (!(skia_use_freetype && skia_use_fontconfig)) {
1571 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1572 }
mtkleinc095df52016-08-24 12:23:52 -07001573 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001574 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001575 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001576 ":skia",
1577 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001578 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001579 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001580 "//third_party/libpng",
1581 "//third_party/zlib",
1582 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001583 public_deps = [
1584 ":gpu_tool_utils", # Test.h #includes headers from this target.
1585 ]
mtkleinc095df52016-08-24 12:23:52 -07001586 }
mtklein2f3416d2016-08-02 16:02:05 -07001587
Mike Klein6e744122016-10-27 12:21:40 -04001588 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001589 test_lib("bench") {
1590 public_include_dirs = [ "bench" ]
1591 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001592 deps = [
1593 ":flags",
1594 ":gm",
1595 ":gpu_tool_utils",
1596 ":skia",
1597 ":tool_utils",
1598 ]
1599 }
mtklein2b6870c2016-07-28 14:17:33 -07001600
mtkleinc095df52016-08-24 12:23:52 -07001601 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001602 public_include_dirs = []
1603 if (skia_use_expat) {
1604 public_include_dirs += [ "experimental/svg/model" ]
1605 sources = [
1606 "experimental/svg/model/SkSVGAttribute.cpp",
1607 "experimental/svg/model/SkSVGAttributeParser.cpp",
1608 "experimental/svg/model/SkSVGCircle.cpp",
1609 "experimental/svg/model/SkSVGClipPath.cpp",
1610 "experimental/svg/model/SkSVGContainer.cpp",
1611 "experimental/svg/model/SkSVGDOM.cpp",
1612 "experimental/svg/model/SkSVGEllipse.cpp",
1613 "experimental/svg/model/SkSVGGradient.cpp",
1614 "experimental/svg/model/SkSVGLine.cpp",
1615 "experimental/svg/model/SkSVGLinearGradient.cpp",
1616 "experimental/svg/model/SkSVGNode.cpp",
1617 "experimental/svg/model/SkSVGPath.cpp",
1618 "experimental/svg/model/SkSVGPattern.cpp",
1619 "experimental/svg/model/SkSVGPoly.cpp",
1620 "experimental/svg/model/SkSVGRadialGradient.cpp",
1621 "experimental/svg/model/SkSVGRect.cpp",
1622 "experimental/svg/model/SkSVGRenderContext.cpp",
1623 "experimental/svg/model/SkSVGSVG.cpp",
1624 "experimental/svg/model/SkSVGShape.cpp",
1625 "experimental/svg/model/SkSVGStop.cpp",
1626 "experimental/svg/model/SkSVGTransformableNode.cpp",
1627 "experimental/svg/model/SkSVGUse.cpp",
1628 "experimental/svg/model/SkSVGValue.cpp",
1629 ]
1630 deps = [
1631 ":skia",
1632 ":xml",
1633 ]
1634 }
mtkleinc095df52016-08-24 12:23:52 -07001635 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001636
Mike Klein38af9432016-11-11 11:39:44 -05001637 if (skia_use_lua) {
1638 test_lib("lua") {
1639 public_include_dirs = []
1640 sources = [
1641 "src/utils/SkLua.cpp",
1642 "src/utils/SkLuaCanvas.cpp",
1643 ]
1644 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001645 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001646 "//third_party/lua",
1647 ]
1648 }
1649
Mike Kleine6682eb2017-01-05 10:54:57 -05001650 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001651 sources = [
1652 "tools/lua/lua_app.cpp",
1653 ]
1654 deps = [
1655 ":lua",
1656 ":skia",
1657 "//third_party/lua",
1658 ]
Mike Klein38af9432016-11-11 11:39:44 -05001659 }
1660
Mike Kleine6682eb2017-01-05 10:54:57 -05001661 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001662 sources = [
1663 "tools/lua/lua_pictures.cpp",
1664 ]
1665 deps = [
1666 ":flags",
1667 ":lua",
1668 ":skia",
1669 ":tool_utils",
1670 "//third_party/lua",
1671 ]
Mike Klein38af9432016-11-11 11:39:44 -05001672 }
1673 }
1674
Cary Clark8032b982017-07-28 11:04:54 -04001675 test_app("bookmaker") {
1676 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001677 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001678 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001679 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001680 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001681 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001682 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001683 "tools/bookmaker/includeParser.cpp",
1684 "tools/bookmaker/includeWriter.cpp",
1685 "tools/bookmaker/mdOut.cpp",
1686 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001687 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001688 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001689 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001690 ]
1691 deps = [
1692 ":flags",
1693 ":skia",
1694 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001695 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001696 ]
1697 }
1698
Florin Malitabfe876a2018-09-02 12:33:59 -04001699 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001700 test_app("skottie_tool") {
1701 deps = [
1702 "modules/skottie:tool",
1703 ]
1704 }
1705 }
1706
Kevin Lubickebf648e2017-09-21 13:45:16 -04001707 if (target_cpu != "wasm") {
1708 import("gn/samples.gni")
1709 test_lib("samples") {
1710 public_include_dirs = [ "samplecode" ]
1711 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001712 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001713 public_deps = [
1714 ":tool_utils",
1715 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001716 deps = [
1717 ":experimental_svg_model",
1718 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001719 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001720 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001721 ]
Mike Klein38af9432016-11-11 11:39:44 -05001722
Ruiqi Maof5101492018-06-29 14:32:21 -04001723 # NIMA does not build on Windows clang
1724 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001725 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001726 deps += [ "//third_party/Nima-Cpp" ]
1727 }
1728
Kevin Lubickebf648e2017-09-21 13:45:16 -04001729 if (skia_use_lua) {
1730 sources += [ "samplecode/SampleLua.cpp" ]
1731 deps += [
1732 ":lua",
1733 "//third_party/lua",
1734 ]
1735 }
1736 }
Mike Klein7af351a2018-07-27 09:54:43 -04001737 test_app("imgcvt") {
1738 sources = [
1739 "tools/imgcvt.cpp",
1740 ]
1741 deps = [
1742 ":skcms",
1743 ":skia",
1744 ]
1745 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001746 test_app("dm") {
1747 sources = [
1748 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001749 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001750 "dm/DMJsonWriter.cpp",
1751 "dm/DMSrcSink.cpp",
1752 ]
1753 include_dirs = [ "tests" ]
1754 deps = [
1755 ":common_flags",
1756 ":experimental_svg_model",
1757 ":flags",
1758 ":gm",
1759 ":gpu_tool_utils",
1760 ":skia",
1761 ":tests",
1762 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001763 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001764 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001765 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001766 "//third_party/jsoncpp",
1767 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001768 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001769
1770 # NIMA does not build on Windows clang
1771 if (!is_win || !is_clang) {
1772 deps += [ "//third_party/Nima-Cpp" ]
1773 }
Mike Klein38af9432016-11-11 11:39:44 -05001774 }
Brian Osman16adfa32016-10-18 14:42:44 -04001775 }
1776
Mike Kleina8a51ce2018-01-09 12:34:11 -05001777 if (!is_win) {
1778 test_app("remote_demo") {
1779 sources = [
1780 "tools/remote_demo.cpp",
1781 ]
1782 deps = [
1783 ":skia",
1784 ]
1785 }
1786 }
1787
Mike Kleine6682eb2017-01-05 10:54:57 -05001788 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001789 sources = [
1790 "bench/nanobench.cpp",
1791 ]
1792 deps = [
1793 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001794 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001795 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001796 ":flags",
1797 ":gm",
1798 ":gpu_tool_utils",
1799 ":skia",
1800 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001801 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001802 "//third_party/jsoncpp",
1803 ]
mtklein2b6870c2016-07-28 14:17:33 -07001804 }
halcanary19a97202016-08-03 15:08:04 -07001805
Ravi Mistry10d36c52017-01-31 09:49:18 -05001806 test_app("skpinfo") {
1807 sources = [
1808 "tools/skpinfo.cpp",
1809 ]
1810 deps = [
1811 ":flags",
1812 ":skia",
1813 ]
1814 }
1815
Brian Osmanc9a42472018-05-31 13:17:12 -04001816 test_app("skpbench") {
1817 sources = [
1818 "tools/skpbench/skpbench.cpp",
1819 ]
1820 deps = [
1821 ":flags",
1822 ":gpu_tool_utils",
1823 ":skia",
1824 ":tool_utils",
1825 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001826 }
1827
Mike Kleine6682eb2017-01-05 10:54:57 -05001828 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001829 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001830 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001831 ]
1832 deps = [
1833 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001834 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001835 ]
halcanary3eee9d92016-09-10 07:01:53 -07001836 }
mtklein046cb562016-09-16 10:23:12 -07001837
Ben Wagner219f3622017-07-17 15:32:25 -04001838 test_app("create_test_font") {
1839 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001840 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001841 ]
1842 deps = [
1843 ":skia",
1844 ]
1845 assert_no_deps = [
1846 # tool_utils requires the output of this app.
1847 ":tool_utils",
1848 ]
1849 }
1850
Florin Malita5d3ff432018-07-31 16:38:43 -04001851 if (skia_use_expat) {
1852 test_app("create_test_font_color") {
1853 sources = [
1854 "tools/fonts/create_test_font_color.cpp",
1855 ]
1856 deps = [
1857 ":flags",
1858 ":skia",
1859 ":tool_utils",
1860 ]
1861 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001862 }
1863
Mike Kleine6682eb2017-01-05 10:54:57 -05001864 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001865 sources = [
1866 "tools/get_images_from_skps.cpp",
1867 ]
1868 deps = [
1869 ":flags",
1870 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001871 ]
mtklein046cb562016-09-16 10:23:12 -07001872 }
mtkleinecbc5262016-09-22 11:51:24 -07001873
Brian Osman6788a542018-12-10 11:56:01 -05001874 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001875 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001876 sources = [
1877 "tools/skiaserve/Request.cpp",
1878 "tools/skiaserve/Response.cpp",
1879 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001880 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1881 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1882 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1883 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1884 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1885 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1886 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1887 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1888 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001889 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1890 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001891 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1892 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1893 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1894 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1895 ]
1896 deps = [
1897 ":flags",
1898 ":gpu_tool_utils",
1899 ":skia",
1900 ":tool_utils",
1901 "//third_party/jsoncpp",
1902 "//third_party/libmicrohttpd",
1903 "//third_party/libpng",
1904 ]
Mike Klein7d302882016-11-03 14:06:31 -04001905 }
mtkleinecbc5262016-09-22 11:51:24 -07001906 }
kjlubick14f984b2016-10-03 11:49:45 -07001907
Mike Kleine6682eb2017-01-05 10:54:57 -05001908 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001909 include_dirs = [
1910 "tools",
1911 "tools/debugger",
1912 ]
kjlubick14f984b2016-10-03 11:49:45 -07001913 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001914 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001915 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001916 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001917 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001918 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001919 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001920 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001921 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001922 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001923 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001924 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001925 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001926 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001927 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1928 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001929 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001930 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001931 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001932 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001933 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1934 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001935 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001936 "tools/UrlDataManager.cpp",
1937 "tools/debugger/SkDebugCanvas.cpp",
1938 "tools/debugger/SkDrawCommand.cpp",
1939 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001940 ]
1941 deps = [
1942 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001943 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001944 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001945 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001946 "//third_party/jsoncpp",
1947 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001948 ]
kjlubick14f984b2016-10-03 11:49:45 -07001949 }
Mike Klein38312422016-10-05 15:41:01 -04001950
Mike Kleine6682eb2017-01-05 10:54:57 -05001951 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001952 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001953 rebase_path("tests/skia_test.cpp"),
1954 rebase_path("tests/Test.cpp"),
1955 ]
caryclark9feb6322016-10-25 08:58:26 -07001956 deps = [
1957 ":flags",
1958 ":gpu_tool_utils",
1959 ":skia",
1960 ":tool_utils",
1961 ]
caryclark9feb6322016-10-25 08:58:26 -07001962 }
1963
Mike Kleine6682eb2017-01-05 10:54:57 -05001964 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001965 sources = [
1966 "tools/DumpRecord.cpp",
1967 "tools/dump_record.cpp",
1968 ]
1969 deps = [
1970 ":flags",
1971 ":skia",
1972 ]
Mike Klein38312422016-10-05 15:41:01 -04001973 }
bungemanfe917272016-10-13 17:36:40 -04001974
Mike Kleine6682eb2017-01-05 10:54:57 -05001975 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001976 sources = [
1977 "tools/skdiff/skdiff.cpp",
1978 "tools/skdiff/skdiff_html.cpp",
1979 "tools/skdiff/skdiff_main.cpp",
1980 "tools/skdiff/skdiff_utils.cpp",
1981 ]
1982 deps = [
1983 ":skia",
1984 ":tool_utils",
1985 ]
bungemanfe917272016-10-13 17:36:40 -04001986 }
halcanarya73d76a2016-10-17 13:19:02 -07001987
Mike Kleine6682eb2017-01-05 10:54:57 -05001988 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001989 sources = [
1990 "tools/skp_parser.cpp",
1991 ]
1992 deps = [
1993 ":skia",
1994 ":tool_utils",
1995 "//third_party/jsoncpp",
1996 ]
halcanarya73d76a2016-10-17 13:19:02 -07001997 }
Brian Osman16adfa32016-10-18 14:42:44 -04001998
Brian Osmanc9a42472018-05-31 13:17:12 -04001999 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002000 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05002001 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002002 defines =
2003 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002004 sources = [
2005 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002006 "tools/skqp/src/skqp.cpp",
2007 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002008 ]
2009 deps = [
2010 ":gm",
2011 ":gpu_tool_utils",
2012 ":skia",
2013 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002014 ":tool_utils",
2015 ]
2016 }
2017 test_app("skqp") {
2018 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002019 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002020 ]
2021 deps = [
2022 ":skia",
2023 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002024 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002025 ]
2026 }
2027 test_app("jitter_gms") {
2028 sources = [
2029 "tools/skqp/jitter_gms.cpp",
2030 ]
2031 deps = [
2032 ":gm",
2033 ":skia",
2034 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002035 ]
2036 }
2037 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002038 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002039 test_app("skqp_app") {
2040 is_shared_library = true
2041 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002042 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002043 ]
2044 deps = [
2045 ":skia",
2046 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002047 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002048 ]
2049 libs = [ "android" ]
2050 }
2051 }
Stan Iliev93151722018-08-02 11:10:52 -04002052 if (is_android && skia_enable_gpu) {
2053 test_app("skottie_android") {
2054 is_shared_library = true
2055
2056 sources = [
2057 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2058 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2059 ]
2060 libs = []
2061
2062 include_dirs = []
2063 deps = [
2064 ":skia",
2065 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002066 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002067 ]
2068 }
2069 }
Hal Canary75427132017-10-11 16:00:31 -04002070
Hal Canarya9de7602018-01-19 13:08:23 -05002071 test_app("list_gms") {
2072 sources = [
2073 "tools/list_gms.cpp",
2074 ]
2075 deps = [
2076 ":gm",
2077 ":skia",
2078 ]
2079 }
2080 test_app("list_gpu_unit_tests") {
2081 sources = [
2082 "dm/DMGpuTestProcs.cpp",
2083 "tools/list_gpu_unit_tests.cpp",
2084 ]
2085 deps = [
2086 ":skia",
2087 ":tests",
2088 ]
2089 }
2090
Brian Osmanc9a42472018-05-31 13:17:12 -04002091 test_lib("sk_app") {
2092 public_include_dirs = [ "tools/sk_app" ]
2093 sources = [
2094 "tools/sk_app/CommandSet.cpp",
2095 "tools/sk_app/GLWindowContext.cpp",
2096 "tools/sk_app/Window.cpp",
2097 ]
2098 libs = []
2099
2100 if (is_android) {
2101 sources += [
2102 "tools/sk_app/android/GLWindowContext_android.cpp",
2103 "tools/sk_app/android/RasterWindowContext_android.cpp",
2104 "tools/sk_app/android/Window_android.cpp",
2105 "tools/sk_app/android/main_android.cpp",
2106 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002107 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002108 libs += [ "android" ]
2109 } else if (is_linux) {
2110 sources += [
2111 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2112 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2113 "tools/sk_app/unix/Window_unix.cpp",
2114 "tools/sk_app/unix/keysym2ucs.c",
2115 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002116 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002117 libs += [
2118 "GL",
2119 "X11",
2120 ]
2121 } else if (is_win) {
2122 sources += [
2123 "tools/sk_app/win/GLWindowContext_win.cpp",
2124 "tools/sk_app/win/RasterWindowContext_win.cpp",
2125 "tools/sk_app/win/Window_win.cpp",
2126 "tools/sk_app/win/main_win.cpp",
2127 ]
Brian Salomon194db172017-08-17 14:37:06 -04002128 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002129 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002130 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002131 } else if (is_mac) {
2132 sources += [
2133 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2134 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2135 "tools/sk_app/mac/Window_mac.cpp",
2136 "tools/sk_app/mac/main_mac.cpp",
2137 ]
2138 libs += [
2139 "QuartzCore.framework",
2140 "Cocoa.framework",
2141 "Foundation.framework",
2142 ]
2143 } else if (is_ios) {
2144 sources += [
2145 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2146 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2147 "tools/sk_app/ios/Window_ios.cpp",
2148 "tools/sk_app/ios/main_ios.cpp",
2149 ]
2150 }
2151
2152 if (skia_use_vulkan) {
2153 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2154 if (is_android) {
2155 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2156 } else if (is_linux) {
2157 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2158 libs += [ "X11-xcb" ]
2159 } else if (is_win) {
2160 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2161 }
2162 }
2163
2164 deps = [
2165 ":gpu_tool_utils",
2166 ":skia",
2167 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002168 ]
2169 if (is_android) {
2170 deps += [ "//third_party/native_app_glue" ]
2171 } else if (is_mac || is_ios) {
2172 deps += [ "//third_party/libsdl" ]
2173 }
2174 if (skia_use_angle) {
2175 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002176 }
Brian Osman16adfa32016-10-18 14:42:44 -04002177 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002178
Brian Osmanc9a42472018-05-31 13:17:12 -04002179 test_app("viewer") {
2180 is_shared_library = is_android
2181 if (is_ios) {
2182 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002183 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002184 sources = [
2185 "tools/viewer/BisectSlide.cpp",
2186 "tools/viewer/GMSlide.cpp",
2187 "tools/viewer/ImGuiLayer.cpp",
2188 "tools/viewer/ImageSlide.cpp",
2189 "tools/viewer/SKPSlide.cpp",
2190 "tools/viewer/SampleSlide.cpp",
2191 "tools/viewer/SkottieSlide.cpp",
2192 "tools/viewer/SlideDir.cpp",
2193 "tools/viewer/StatsLayer.cpp",
2194 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002195 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002196 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002197 "tools/viewer/Viewer.cpp",
2198 ]
2199 libs = []
2200
Kevin Lubickd9699322018-10-30 15:08:53 -04002201 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002202 deps = [
2203 ":experimental_svg_model",
2204 ":flags",
2205 ":gm",
2206 ":gpu_tool_utils",
2207 ":samples",
2208 ":sk_app",
2209 ":skia",
2210 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002211 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002212 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002213 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002214 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002215 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002216 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002217
2218 # NIMA does not build on Windows clang
2219 if (!is_win || !is_clang) {
2220 sources += [ "tools/viewer/NIMASlide.cpp" ]
2221 deps += [ "//third_party/Nima-Cpp" ]
2222 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002223 }
2224
ziadbbceddbc2018-06-19 13:57:15 -04002225 if (is_android) {
2226 test_app("arcore") {
2227 is_shared_library = true
2228 configs = [
2229 ":skia_public",
2230 "gn:default",
2231 ]
2232
2233 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2234 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2235 sources = []
2236 sources += skia_core_sources
2237 sources += skia_utils_sources
2238 sources += skia_xps_sources
2239 sources += [
2240 "src/android/SkAndroidFrameworkUtils.cpp",
2241 "src/android/SkAnimatedImage.cpp",
2242 "src/android/SkBitmapRegionCodec.cpp",
2243 "src/android/SkBitmapRegionDecoder.cpp",
2244 "src/codec/SkAndroidCodec.cpp",
2245 "src/codec/SkBmpBaseCodec.cpp",
2246 "src/codec/SkBmpCodec.cpp",
2247 "src/codec/SkBmpMaskCodec.cpp",
2248 "src/codec/SkBmpRLECodec.cpp",
2249 "src/codec/SkBmpStandardCodec.cpp",
2250 "src/codec/SkCodec.cpp",
2251 "src/codec/SkCodecImageGenerator.cpp",
2252 "src/codec/SkColorTable.cpp",
2253 "src/codec/SkGifCodec.cpp",
2254 "src/codec/SkMaskSwizzler.cpp",
2255 "src/codec/SkMasks.cpp",
2256 "src/codec/SkSampledCodec.cpp",
2257 "src/codec/SkSampler.cpp",
2258 "src/codec/SkStreamBuffer.cpp",
2259 "src/codec/SkSwizzler.cpp",
2260 "src/codec/SkWbmpCodec.cpp",
2261 "src/images/SkImageEncoder.cpp",
2262 "src/ports/SkDiscardableMemory_none.cpp",
2263 "src/ports/SkImageGenerator_skia.cpp",
2264 "src/ports/SkMemory_malloc.cpp",
2265 "src/ports/SkOSFile_stdio.cpp",
2266 "src/sfnt/SkOTTable_name.cpp",
2267 "src/sfnt/SkOTUtils.cpp",
2268 "src/utils/mac/SkStream_mac.cpp",
2269 "third_party/gif/SkGifImageReader.cpp",
2270 ]
2271 deps = [
2272 ":tool_utils",
2273 "modules/skottie",
2274 "modules/skshaper",
2275 ]
2276 }
2277 }
2278
Brian Osmanc9a42472018-05-31 13:17:12 -04002279 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002280 test_app("HelloWorld") {
2281 sources = [
2282 "example/HelloWorld.cpp",
2283 ]
2284 libs = []
2285
2286 include_dirs = []
2287 deps = [
2288 ":flags",
2289 ":gpu_tool_utils",
2290 ":sk_app",
2291 ":skia",
2292 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002293 ]
2294 }
2295 }
2296
Brian Osmanc9a42472018-05-31 13:17:12 -04002297 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002298 test_app("SkiaSDLExample") {
2299 sources = [
2300 "example/SkiaSDLExample.cpp",
2301 ]
2302 libs = []
2303 include_dirs = []
2304 deps = [
2305 ":gpu_tool_utils",
2306 ":skia",
2307 "//third_party/libsdl",
2308 ]
2309 }
2310 }
2311
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002312 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2313 action_foreach("generate_mocs") {
2314 script = "gn/call.py"
2315 sources = [
2316 "tools/mdbviz/MainWindow.h",
2317 ]
2318 outputs = [
2319 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2320 ]
2321 args = [
2322 "$skia_qt_path" + "/bin/moc",
2323 "{{source}}",
2324 "-o",
2325 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2326 ]
2327 }
2328 action_foreach("generate_resources") {
2329 script = "gn/call.py"
2330 sources = [
2331 "tools/mdbviz/resources.qrc",
2332 ]
2333 outputs = [
2334 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2335 ]
2336 args = [
2337 "$skia_qt_path" + "/bin/rcc",
2338 "{{source}}",
2339 "-o",
2340 "gen/mdbviz/{{source_name_part}}_res.cpp",
2341 ]
2342 }
2343 test_app("mdbviz") {
2344 if (is_win) {
2345 # on Windows we need to disable some exception handling warnings due to the Qt headers
2346 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2347 }
2348 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002349 "tools/UrlDataManager.cpp",
2350 "tools/debugger/SkDebugCanvas.cpp",
2351 "tools/debugger/SkDrawCommand.cpp",
2352 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002353 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002354 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002355 "tools/mdbviz/main.cpp",
2356
2357 # generated files
2358 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2359 "$target_gen_dir/mdbviz/resources_res.cpp",
2360 ]
2361 lib_dirs = [ "$skia_qt_path/lib" ]
2362 libs = [
2363 "Qt5Core.lib",
2364 "Qt5Gui.lib",
2365 "Qt5Widgets.lib",
2366 ]
2367 include_dirs = [
2368 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002369 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002370 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002371 "tools",
2372 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002373 ]
2374 deps = [
2375 ":generate_mocs",
2376 ":generate_resources",
2377 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002378 "//third_party/jsoncpp",
2379 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002380 ]
2381 }
2382 }
2383
Mike Kleine459afd2017-03-03 09:21:30 -05002384 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002385 copy("gdbserver") {
2386 sources = [
2387 "$ndk/$ndk_gdbserver",
2388 ]
2389 outputs = [
2390 "$root_out_dir/gdbserver",
2391 ]
2392 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002393 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002394
2395 if (skia_use_opencl) {
2396 test_app("hello-opencl") {
2397 sources = [
2398 "src/compute/common/cl/assert_cl.c",
2399 "src/compute/common/cl/find_cl.c",
2400 "tools/hello-opencl.cpp",
2401 ]
2402 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002403 if (is_linux) {
2404 libs = [ "OpenCL" ]
2405 } else if (is_win) {
2406 libs = [ "OpenCL.lib" ]
2407 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002408 }
2409 }
mtklein25c81d42016-07-27 13:55:26 -07002410}