blob: d6bac295626000d3620d2638d885e8743ae74e76 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
12 import("//build/vulkan/config.gni")
13}
14
mtkleinc04ff472016-06-23 10:29:30 -070015declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040016 skia_enable_flutter_defines = false
17}
18
19declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000020 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040021 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070022 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070023 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050024 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070025 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050026 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070027 skia_use_libjpeg_turbo = true
28 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070029 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050030 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040031 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040032 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040033 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070034 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040035 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040036 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070037 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050038 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070039
Mike Klein7d921032017-01-05 12:20:41 -050040 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040041 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000042 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050043 skia_enable_discrete_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040044 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050045 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040046 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040047 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050048 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040049 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040050 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070051 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070052 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040053
Hal Canary2331c822018-02-01 14:06:13 -050054 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040055
56 skia_llvm_path = ""
57 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040058
59 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070060}
Brian Salomon23d73ea2016-10-27 13:31:37 -040061declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040062 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040063 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050064 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050065 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050066 skia_enable_fontmgr_custom =
67 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050068 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
69 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080070 skia_enable_fontmgr_fuchsia = is_fuchsia
Mike Klein10d665d2016-11-01 11:46:10 -040071
Mike Klein4d598a32016-10-31 13:44:49 -040072 if (is_android) {
73 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070074 } else if (is_fuchsia) {
75 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040076 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050077 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040078 }
Jim Van Verth4e502972017-12-07 15:16:10 -050079
80 if (is_ios) {
81 skia_ios_identity = ".*Google.*"
82 skia_ios_profile = "Google Development"
83 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040084}
Brian Salomon789e25e2016-09-30 13:41:03 -040085
Adam Barth54ef74a2017-10-13 10:59:38 -070086if (defined(skia_settings)) {
87 import(skia_settings)
88}
89
mtklein1211e0c2016-07-26 13:55:45 -070090skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070091 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070092 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070093 "include/codec",
94 "include/config",
95 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -040096 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -070097 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040098 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500100 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/pathops",
102 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700103 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700104 "include/utils",
105 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700106]
107
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500108if (skia_enable_atlas_text) {
109 skia_public_includes += [ "include/atlastext" ]
110}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000111
mtkleinc04ff472016-06-23 10:29:30 -0700112# Skia public API, generally provided by :skia.
113config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700114 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400115 defines = []
116 if (is_component_build) {
117 defines += [ "SKIA_DLL" ]
118 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400119 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700120 defines += [ "SK_SAMPLES_FOR_X" ]
121 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400122 if (skia_enable_flutter_defines) {
123 defines += flutter_defines
124 }
mtklein06c35c02016-09-20 12:28:12 -0700125 if (!skia_enable_gpu) {
126 defines += [ "SK_SUPPORT_GPU=0" ]
127 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500128 if (skia_enable_atlas_text) {
129 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
130 }
Mike Reed025f7832018-11-12 09:27:05 -0500131 if (is_fuchsia) {
132 defines += fuchsia_defines
133 }
mtkleinc04ff472016-06-23 10:29:30 -0700134}
135
136# Skia internal APIs, used by Skia itself and a few test tools.
137config("skia_private") {
138 visibility = [ ":*" ]
139
140 include_dirs = [
141 "include/private",
142 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700143 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700144 "src/core",
145 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700146 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700147 "src/image",
148 "src/images",
149 "src/lazy",
150 "src/opts",
151 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700152 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700153 "src/ports",
154 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400155 "src/shaders",
156 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700157 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700158 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700159 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500160 "src/xml",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500161 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700162 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700163 ]
mtklein150d1132016-08-01 06:56:40 -0700164
Mike Reeda9e241d2017-05-03 10:52:00 -0400165 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500166 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700167 defines += [
168 "SK_GAMMA_EXPONENT=1.4",
169 "SK_GAMMA_CONTRAST=0.0",
170 ]
171 }
mtklein88a7ac02016-09-14 11:16:49 -0700172 if (is_official_build || is_android) {
173 # TODO(bsalomon): it'd be nice to make Android normal.
174 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
175 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400176 libs = []
177 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500178 if (skia_enable_gpu) {
179 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500180 if (is_skia_dev_build && skia_use_vulkan) {
181 include_dirs += [ "tools/gpu/vk" ]
182 }
Brian Salomon03e05842017-02-23 12:23:47 -0500183 }
Brian Osman34755e22016-12-05 09:46:02 -0500184 if (skia_use_angle) {
185 defines += [ "SK_ANGLE" ]
186 }
Brian Osman3f375d02016-12-28 11:19:22 -0500187 if (skia_enable_discrete_gpu) {
188 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
189 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400190 if (!is_official_build) {
191 defines += [ "GR_TEST_UTILS=1" ]
192 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400193 if (skia_llvm_path != "") {
194 defines += [ "SK_LLVM_AVAILABLE" ]
195 include_dirs += [ "$skia_llvm_path/include" ]
196 libs += [ skia_llvm_lib ]
197 lib_dirs += [ "$skia_llvm_path/lib/" ]
198 }
mtkleinc04ff472016-06-23 10:29:30 -0700199}
200
201# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
202config("skia_library") {
203 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700204 defines = [ "SKIA_IMPLEMENTATION=1" ]
205}
206
207skia_library_configs = [
208 ":skia_public",
209 ":skia_private",
210 ":skia_library",
211]
212
mtklein9b8583d2016-08-24 17:32:30 -0700213# Use for CPU-specific Skia code that needs particular compiler flags.
214template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500215 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700216 if (invoker.enabled) {
217 source_set(target_name) {
218 forward_variables_from(invoker, "*")
219 configs += skia_library_configs
220 }
221 } else {
222 # If not enabled, a phony empty target that swallows all otherwise unused variables.
223 source_set(target_name) {
224 forward_variables_from(invoker,
225 "*",
226 [
227 "sources",
228 "cflags",
229 ])
230 }
231 }
anmittala7eaf2e2016-08-17 13:57:26 -0700232}
233
mtklein422310d2016-08-16 18:28:43 -0700234is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700235
mtklein7d6fb2c2016-08-25 14:50:44 -0700236opts("none") {
237 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700239 cflags = []
240}
241
mtklein7d6fb2c2016-08-25 14:50:44 -0700242opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700243 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700245 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700246}
247
248opts("arm64") {
249 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700251 cflags = []
252}
253
254opts("crc32") {
255 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700257 cflags = [ "-march=armv8-a+crc" ]
258}
259
mtklein9b8583d2016-08-24 17:32:30 -0700260opts("sse2") {
261 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700262 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400263 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400264 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
265 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400266 cflags = [ "-msse2" ]
267 }
mtklein9b8583d2016-08-24 17:32:30 -0700268}
mtkleinc04ff472016-06-23 10:29:30 -0700269
mtklein9b8583d2016-08-24 17:32:30 -0700270opts("ssse3") {
271 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700272 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400273 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400274 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
275 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400276 cflags = [ "-mssse3" ]
277 }
mtklein9b8583d2016-08-24 17:32:30 -0700278}
mtkleinc04ff472016-06-23 10:29:30 -0700279
mtklein9b8583d2016-08-24 17:32:30 -0700280opts("sse41") {
281 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700282 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400283 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400284 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
285 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400286 cflags = [ "-msse4.1" ]
287 }
mtklein9b8583d2016-08-24 17:32:30 -0700288}
mtklein4e976072016-08-08 09:06:27 -0700289
mtklein9b8583d2016-08-24 17:32:30 -0700290opts("sse42") {
291 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700292 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400293 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400294 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
295 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400296 cflags = [ "-msse4.2" ]
297 }
mtklein9b8583d2016-08-24 17:32:30 -0700298}
299
300opts("avx") {
301 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700302 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400303 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000304 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400305 } else {
306 cflags = [ "-mavx" ]
307 }
mtkleinc04ff472016-06-23 10:29:30 -0700308}
309
Mike Klein1b9b7d52018-02-27 10:37:40 -0500310opts("hsw") {
311 enabled = is_x86
312 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400313 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500314 cflags = [ "/arch:AVX2" ]
315 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000316 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500317 }
318
319 # Oddly, clang-cl doesn't recognize this as a valid flag.
320 # If it ever does, it'd nice to move this up with -mavx2 and co.
321 if (is_clang && !is_win) {
322 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
323 # but nice to have, generating slightly better code for paths without explicit FMAs.
324 cflags += [ "-ffp-contract=fast" ]
325 }
326}
327
mtkleinc095df52016-08-24 12:23:52 -0700328# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700329template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500330 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700331 if (invoker.enabled) {
332 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700333 if (defined(invoker.public_defines)) {
334 defines = invoker.public_defines
335 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600336 if (defined(invoker.public_configs)) {
337 configs = invoker.public_configs
338 }
mtklein457b42a2016-08-23 13:56:37 -0700339 }
340 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700341 forward_variables_from(invoker,
342 "*",
343 [
344 "public_defines",
345 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700346 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700347 ])
mtklein457b42a2016-08-23 13:56:37 -0700348 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700349 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700350 if (defined(invoker.configs_to_remove)) {
351 configs -= invoker.configs_to_remove
352 }
mtklein457b42a2016-08-23 13:56:37 -0700353 }
354 } else {
mtklein457b42a2016-08-23 13:56:37 -0700355 source_set(target_name) {
356 forward_variables_from(invoker,
357 "*",
358 [
359 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400360 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700361 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700362 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700363 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700364 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700365 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700366 ])
mtkleincd01b032016-08-31 04:58:19 -0700367 if (defined(invoker.sources_when_disabled)) {
368 sources = invoker.sources_when_disabled
369 }
370 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700371 }
mtkleineb3c4252016-08-23 07:38:09 -0700372 }
mtklein457b42a2016-08-23 13:56:37 -0700373}
mtklein457b42a2016-08-23 13:56:37 -0700374
mtkleina45be612016-08-29 15:22:10 -0700375optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500376 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700377
378 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500379 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700380 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700381 ]
382 sources = [
383 "src/ports/SkFontMgr_android.cpp",
384 "src/ports/SkFontMgr_android_factory.cpp",
385 "src/ports/SkFontMgr_android_parser.cpp",
386 ]
387}
388
mtkleind2e39db2016-09-07 07:52:55 -0700389optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500390 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700391
392 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500393 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700394 ]
395 sources = [
396 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500397 "src/ports/SkFontMgr_custom.h",
398 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700399 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500400 "src/ports/SkFontMgr_custom_embedded.cpp",
401 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700402 ]
403}
404
Kevin Lubickddd0a332018-12-12 10:35:13 -0500405optional("fontmgr_wasm") {
406 enabled = target_cpu == "wasm"
407
408 deps = [
409 ":typeface_freetype",
410 ]
411 sources = [
412 "src/ports/SkFontMgr_custom.cpp",
413 "src/ports/SkFontMgr_custom.h",
414 "src/ports/SkFontMgr_custom_embedded.cpp",
415 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
416 ]
417}
418
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800419optional("fontmgr_fuchsia") {
420 enabled = skia_enable_fontmgr_fuchsia
421
422 deps = [
Adam Barthf4766752019-02-07 09:08:54 -0800423 "//sdk/fidl/fuchsia.fonts",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800424 ]
425 sources = [
426 "src/ports/SkFontMgr_fuchsia.cpp",
427 "src/ports/SkFontMgr_fuchsia.h",
428 ]
429}
430
Hal Canaryff2742e2018-01-30 11:35:47 -0500431optional("fontmgr_empty") {
432 enabled = skia_enable_fontmgr_empty
433 sources = [
434 "src/ports/SkFontMgr_empty_factory.cpp",
435 ]
436}
437
mtklein3cc22182016-08-29 13:26:14 -0700438optional("fontmgr_fontconfig") {
439 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700440
441 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500442 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700443 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700444 ]
445 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700446 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700447 "src/ports/SkFontConfigInterface_direct.cpp",
448 "src/ports/SkFontConfigInterface_direct_factory.cpp",
449 "src/ports/SkFontMgr_FontConfigInterface.cpp",
450 "src/ports/SkFontMgr_fontconfig.cpp",
451 "src/ports/SkFontMgr_fontconfig_factory.cpp",
452 ]
453}
454
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500455optional("fontmgr_custom_empty") {
456 enabled = skia_enable_fontmgr_custom_empty
mtkleincdedd0e2016-09-12 15:15:44 -0700457
458 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500459 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700460 ]
461 sources = [
462 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500463 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700464 "src/ports/SkFontMgr_custom_empty_factory.cpp",
465 ]
466}
467
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700468if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400469 executable("sksllex") {
470 sources = [
471 "src/sksl/lex/Main.cpp",
472 "src/sksl/lex/NFA.cpp",
473 "src/sksl/lex/RegexNode.cpp",
474 "src/sksl/lex/RegexParser.cpp",
475 ]
476 include_dirs = [ "src/sksl/lex" ]
477 }
478
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700479 action("run_sksllex") {
480 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400481 deps = [
482 ":sksllex(//gn/toolchain:$host_toolchain)",
483 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700484 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700485 "src/sksl/lex/sksl.lex",
486 ]
487
488 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
489 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
490 outputs = [
491 "$target_out_dir/" +
492 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
493 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
494 # confused due to the same file being named by two different paths
495 ]
496 sksllex_path = "$root_out_dir/"
497 sksllex_path += "sksllex"
498 if (host_os == "win") {
499 sksllex_path += ".exe"
500 }
501 args = [
502 rebase_path(sksllex_path),
503 rebase_path("bin/clang-format"),
504 rebase_path("src"),
505 ]
506 }
507} else {
508 group("run_sksllex") {
509 }
510}
511
512if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400513 executable("skslc") {
514 defines = [ "SKSL_STANDALONE" ]
515 sources = [
516 "src/sksl/SkSLMain.cpp",
517 ]
518 sources += skia_sksl_sources
519 include_dirs = [
520 "src/gpu",
521 "src/sksl",
522 ]
523 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500524 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400525 "//third_party/spirv-tools",
526 ]
527 }
528
529 skia_gpu_processor_outputs = []
530 foreach(src, skia_gpu_processor_sources) {
531 dir = get_path_info(src, "dir")
532 name = get_path_info(src, "name")
533
534 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
535 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
536 skia_gpu_processor_outputs += [
537 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
538 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
539 # confused due to the same file being named by two different paths
540 ]
541 }
542
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500543 action("create_sksl_enums") {
544 script = "gn/create_sksl_enums.py"
545 sources = [
546 "include/private/GrSharedEnums.h",
547 ]
548 outputs = [
549 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500550 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500551 ]
552 args = [
553 rebase_path(sources[0]),
554 rebase_path(outputs[0]),
555 ]
556 }
557
Ethan Nicholas762466e2017-06-29 10:03:38 -0400558 action("compile_processors") {
559 script = "gn/compile_processors.py"
560 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500561 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400562 ":skslc(//gn/toolchain:$host_toolchain)",
563 ]
564 sources = skia_gpu_processor_sources
565 outputs = skia_gpu_processor_outputs
566 skslc_path = "$root_out_dir/"
567 if (host_toolchain != default_toolchain_name) {
568 skslc_path += "$host_toolchain/"
569 }
570 skslc_path += "skslc"
571 if (host_os == "win") {
572 skslc_path += ".exe"
573 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400574 args = [
575 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400576 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400577 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400578 args += rebase_path(skia_gpu_processor_sources)
579 }
580} else {
581 skia_gpu_processor_outputs = []
582 group("compile_processors") {
583 }
584}
585
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500586optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700587 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400588 deps = [
589 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700590 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400591 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700592 if (skia_generate_workarounds) {
593 deps += [ ":workaround_list" ]
594 }
mtkleine9fb3d52016-09-20 15:11:46 -0700595 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600596 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400597 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700598
Brian Salomon3d6801e2017-12-11 10:06:31 -0500599 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400600 if (!skia_enable_ccpr) {
601 sources -= skia_ccpr_sources
602 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
603 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400604 if (!skia_enable_nvpr) {
605 sources -= skia_nvpr_sources
606 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
607 }
mtklein06c35c02016-09-20 12:28:12 -0700608
609 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700611 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400612 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700613 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400614 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400615
616 # this lib is required to link against AHardwareBuffer
617 if (defined(ndk_api) && ndk_api >= 26) {
618 libs += [ "android" ]
619 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400620 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500621 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400622 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700623 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500624 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400625 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700626 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500627 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800628 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500629 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400630 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500631 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500632 if (target_cpu != "arm64") {
633 libs += [ "OpenGL32.lib" ]
634 }
mtklein06c35c02016-09-20 12:28:12 -0700635 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500636 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700637 }
mtkleine9fb3d52016-09-20 15:11:46 -0700638
639 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400640 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400641 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700642 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700643 if (skia_enable_vulkan_debug_layers) {
644 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
645 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800646 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500647 public_deps +=
648 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800649 }
mtkleine9fb3d52016-09-20 15:11:46 -0700650 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400651
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400652 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400653 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400654 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
655 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400656
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400657 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400658 if (skia_use_metal) {
659 public_defines += [ "SK_METAL" ]
660 sources += skia_metal_sources
661 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400662 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400663 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400664 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500665
666 if (skia_enable_atlas_text) {
667 sources += skia_atlas_text_sources
668 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400669
670 if (is_debug) {
671 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
672 }
mtklein06c35c02016-09-20 12:28:12 -0700673}
674
Leon Scroggins III41169202019-01-29 09:29:57 -0500675optional("gif") {
676 enabled = !skia_use_wuffs
677 sources = [
678 "src/codec/SkGifCodec.cpp",
679 "third_party/gif/SkGifImageReader.cpp",
680 ]
681}
682
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400683optional("heif") {
684 enabled = skia_use_libheif
685 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
686
687 deps = []
688
689 sources = [
690 "src/codec/SkHeifCodec.cpp",
691 ]
692}
693
mtklein63213812016-08-24 09:55:56 -0700694optional("jpeg") {
695 enabled = skia_use_libjpeg_turbo
696 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
697
mtklein63213812016-08-24 09:55:56 -0700698 deps = [
699 "//third_party/libjpeg-turbo:libjpeg",
700 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400701 public = [
702 "include/encode/SkJpegEncoder.h",
703 ]
mtklein63213812016-08-24 09:55:56 -0700704 sources = [
705 "src/codec/SkJpegCodec.cpp",
706 "src/codec/SkJpegDecoderMgr.cpp",
707 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700708 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400709 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700710 ]
711}
712
713optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500714 enabled = skia_use_zlib && skia_enable_pdf
715 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700716
mtklein63213812016-08-24 09:55:56 -0700717 deps = [
718 "//third_party/zlib",
719 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400720 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700721 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400722 }
brettwb9447282016-09-01 14:24:39 -0700723 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700724 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700725
726 if (skia_use_sfntly) {
727 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500728 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700729 }
730}
731
732optional("png") {
733 enabled = skia_use_libpng
734 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
735
mtklein63213812016-08-24 09:55:56 -0700736 deps = [
737 "//third_party/libpng",
738 ]
739 sources = [
740 "src/codec/SkIcoCodec.cpp",
741 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400742 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700743 ]
744}
745
scroggof84ad642016-10-31 09:02:57 -0700746optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400747 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700748 public_defines = [ "SK_CODEC_DECODES_RAW" ]
749
750 deps = [
751 "//third_party/dng_sdk",
752 "//third_party/libjpeg-turbo:libjpeg",
753 "//third_party/piex",
754 ]
755
756 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
757 # Skia.
758 configs_to_remove = [ "//gn:no_exceptions" ]
759
760 sources = [
scroggof84ad642016-10-31 09:02:57 -0700761 "src/codec/SkRawCodec.cpp",
762 ]
763}
764
Mike Klein852a8cb2018-05-15 10:46:58 -0400765import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400766source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400767 cflags = []
768 if (!is_win || is_clang) {
769 cflags += [
770 "-w",
771 "-std=c11",
772 ]
773 }
774
775 public = [
776 "third_party/skcms/skcms.h",
777 ]
778 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
779}
780
mtklein3cc22182016-08-29 13:26:14 -0700781optional("typeface_freetype") {
782 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700783
784 deps = [
785 "//third_party/freetype2",
786 ]
787 sources = [
788 "src/ports/SkFontHost_FreeType.cpp",
789 "src/ports/SkFontHost_FreeType_common.cpp",
790 ]
791}
792
mtklein457b42a2016-08-23 13:56:37 -0700793optional("webp") {
794 enabled = skia_use_libwebp
795 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
796
mtklein457b42a2016-08-23 13:56:37 -0700797 deps = [
798 "//third_party/libwebp",
799 ]
800 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700801 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400802 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700803 ]
mtkleineb3c4252016-08-23 07:38:09 -0700804}
805
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400806optional("wuffs") {
807 enabled = skia_use_wuffs
808 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
809
810 deps = [
811 "//third_party/wuffs",
812 ]
813 sources = [
814 "src/codec/SkWuffsCodec.cpp",
815 ]
816}
817
mtklein63213812016-08-24 09:55:56 -0700818optional("xml") {
819 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000820 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700821
mtklein63213812016-08-24 09:55:56 -0700822 deps = [
823 "//third_party/expat",
824 ]
825 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500826 "src/svg/SkSVGCanvas.cpp",
827 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700828 "src/xml/SkDOM.cpp",
829 "src/xml/SkXMLParser.cpp",
830 "src/xml/SkXMLWriter.cpp",
831 ]
832}
833
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700834if (skia_enable_gpu && skia_generate_workarounds) {
835 action("workaround_list") {
836 script = "tools/build_workaround_header.py"
837
838 inputs = [
839 "src/gpu/gpu_workaround_list.txt",
840 ]
841
842 # see comments in skia_compile_processors about out dir path shenanigans.
843 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700844 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700845
846 outputs = [
847 "$root_out_dir/$output_file",
848 ]
849 args = [
850 "--output-file",
851 "$output_file",
852 ]
853
854 foreach(file, inputs) {
855 args += [ rebase_path(file, root_build_dir) ]
856 }
857 }
858}
859
mtkleinc04ff472016-06-23 10:29:30 -0700860component("skia") {
861 public_configs = [ ":skia_public" ]
862 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700863
Mike Klein607b0a72018-11-07 16:17:34 -0500864 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500865 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500866 ":pdf",
867 ":skcms",
868 ]
869
mtkleinc04ff472016-06-23 10:29:30 -0700870 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700871 ":arm64",
872 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700873 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000874 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700875 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700876 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700877 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500878 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500879 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700880 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800881 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500882 ":fontmgr_wasm",
Leon Scroggins III41169202019-01-29 09:29:57 -0500883 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400884 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500885 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700886 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700887 ":none",
mtklein63213812016-08-24 09:55:56 -0700888 ":png",
scroggof84ad642016-10-31 09:02:57 -0700889 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700890 ":sse2",
891 ":sse41",
892 ":sse42",
893 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700894 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400895 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700896 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700897 ]
898
Kevin Lubick134be1d2018-10-30 15:05:04 -0400899 if (skia_enable_nima) {
900 deps += [ "//third_party/Nima-Cpp" ]
901 }
902
Chinmay Garde43f115c2016-11-16 15:04:12 -0800903 # This file (and all GN files in Skia) are designed to work with an
904 # empty sources assignment filter; we handle all that explicitly.
905 # We clear the filter here for clients who may have set up a global filter.
906 set_sources_assignment_filter([])
907
mtkleinc04ff472016-06-23 10:29:30 -0700908 sources = []
brettwb9447282016-09-01 14:24:39 -0700909 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700910 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500911 if (skia_use_xps) {
912 sources += skia_xps_sources
913 }
Mike Klein54378232018-11-08 12:08:05 +0000914 sources += skia_effects_sources
915 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700916 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400917 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500918 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700919 "src/android/SkBitmapRegionCodec.cpp",
920 "src/android/SkBitmapRegionDecoder.cpp",
921 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100922 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400923 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700924 "src/codec/SkBmpCodec.cpp",
925 "src/codec/SkBmpMaskCodec.cpp",
926 "src/codec/SkBmpRLECodec.cpp",
927 "src/codec/SkBmpStandardCodec.cpp",
928 "src/codec/SkCodec.cpp",
929 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400930 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400931 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700932 "src/codec/SkMaskSwizzler.cpp",
933 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700934 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700935 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700936 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700937 "src/codec/SkSwizzler.cpp",
938 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700939 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700940 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000941 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700942 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700943 "src/ports/SkMemory_malloc.cpp",
944 "src/ports/SkOSFile_stdio.cpp",
945 "src/sfnt/SkOTTable_name.cpp",
946 "src/sfnt/SkOTUtils.cpp",
947 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500948 "third_party/etc1/etc1.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700949 ]
brettwb9447282016-09-01 14:24:39 -0700950
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400951 defines = []
952 if (!skia_enable_skpicture) {
953 defines = [ "SK_DISABLE_SKPICTURE" ]
954 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000955 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400956 sources += [ "src/core/SkPicture_none.cpp" ]
957 }
958
mtklein7d6fb2c2016-08-25 14:50:44 -0700959 libs = []
960
mtkleinc04ff472016-06-23 10:29:30 -0700961 if (is_win) {
962 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400963 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700964 "src/ports/SkDebug_win.cpp",
965 "src/ports/SkFontHost_win.cpp",
966 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500967 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700968 "src/ports/SkImageEncoder_WIC.cpp",
969 "src/ports/SkImageGeneratorWIC.cpp",
970 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700971 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700972 "src/ports/SkScalerContext_win_dw.cpp",
973 "src/ports/SkTLS_win.cpp",
974 "src/ports/SkTypeface_win_dw.cpp",
975 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400976 libs += [
977 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500978 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400979 "Ole32.lib",
980 "OleAut32.lib",
981 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500982 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400983 ]
mtkleinc04ff472016-06-23 10:29:30 -0700984 } else {
985 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700986 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700987 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700988 "src/ports/SkTLS_pthread.cpp",
989 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400990 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700991 }
992
mtklein7d6fb2c2016-08-25 14:50:44 -0700993 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500994 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500995 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500996 deps += [ "//third_party/cpu-features" ]
997 }
mtklein06c35c02016-09-20 12:28:12 -0700998 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700999 libs += [
1000 "EGL",
1001 "GLESv2",
1002 "log",
1003 ]
1004 }
1005
Kevin Lubick217056c2018-09-20 17:39:31 -04001006 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001007 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001008 if (skia_use_egl) {
1009 libs += [ "GLESv2" ]
1010 }
mtkleinc04ff472016-06-23 10:29:30 -07001011 }
1012
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001013 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001014 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001015 }
1016
mtkleinc04ff472016-06-23 10:29:30 -07001017 if (is_mac) {
1018 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001019 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001020 "src/ports/SkImageEncoder_CG.cpp",
1021 "src/ports/SkImageGeneratorCG.cpp",
1022 ]
mtklein09e61f72016-08-23 13:35:28 -07001023 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001024 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1025 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001026 "ApplicationServices.framework",
1027 "OpenGL.framework",
1028 ]
mtkleinc04ff472016-06-23 10:29:30 -07001029 }
abarth6fc8ff02016-07-15 15:15:15 -07001030
Mike Klein7d302882016-11-03 14:06:31 -04001031 if (is_ios) {
1032 sources += [
1033 "src/ports/SkDebug_stdio.cpp",
1034 "src/ports/SkFontHost_mac.cpp",
1035 "src/ports/SkImageEncoder_CG.cpp",
1036 "src/ports/SkImageGeneratorCG.cpp",
1037 ]
1038 libs += [
1039 "CoreFoundation.framework",
1040 "CoreGraphics.framework",
1041 "CoreText.framework",
1042 "ImageIO.framework",
1043 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001044
1045 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1046 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001047 ]
1048 }
1049
abarth6fc8ff02016-07-15 15:15:15 -07001050 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001051 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001052 }
mtkleinc04ff472016-06-23 10:29:30 -07001053}
1054
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001055# DebugCanvas used in experimental/wasm-skp-debugger
1056if (target_cpu == "wasm") {
1057 static_library("debugcanvas") {
1058 public_configs = [ ":skia_public" ]
1059
1060 include_dirs = [
1061 "include/gpu",
1062 "include/private",
1063 "src/gpu",
1064 "src/core",
1065 "src/shaders",
1066 "src/utils",
1067 "tools",
1068 "tools/debugger",
1069 ]
1070
1071 sources = [
1072 "tools/UrlDataManager.cpp",
1073 "tools/debugger/SkDebugCanvas.cpp",
1074 "tools/debugger/SkDrawCommand.cpp",
1075 "tools/debugger/SkJsonWriteBuffer.cpp",
1076 ]
1077
1078 deps = [
1079 ":fontmgr_wasm",
1080 ]
1081 }
1082}
1083
Kevin Lubickcbcff382018-10-02 09:02:18 -04001084static_library("pathkit") {
1085 public_configs = [ ":skia_public" ]
1086 configs += skia_library_configs
1087
1088 deps = [
1089 ":arm64",
1090 ":armv7",
1091 ":avx",
1092 ":crc32",
1093 ":hsw",
1094 ":none",
1095 ":sse2",
1096 ":sse41",
1097 ":sse42",
1098 ":ssse3",
1099 ]
1100
1101 # This file (and all GN files in Skia) are designed to work with an
1102 # empty sources assignment filter; we handle all that explicitly.
1103 # We clear the filter here for clients who may have set up a global filter.
1104 set_sources_assignment_filter([])
1105
1106 sources = []
1107 sources += skia_pathops_sources
1108 sources += [
1109 "src/core/SkAnalyticEdge.cpp",
1110 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001111 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001112 "src/core/SkCubicMap.cpp",
1113 "src/core/SkEdge.cpp",
1114 "src/core/SkEdgeBuilder.cpp",
1115 "src/core/SkEdgeClipper.cpp",
1116 "src/core/SkGeometry.cpp",
1117 "src/core/SkLineClipper.cpp",
1118 "src/core/SkMallocPixelRef.cpp",
1119 "src/core/SkMath.cpp",
1120 "src/core/SkMatrix.cpp",
1121 "src/core/SkOpts.cpp",
1122 "src/core/SkPaint.cpp",
1123 "src/core/SkPath.cpp",
1124 "src/core/SkPathEffect.cpp",
1125 "src/core/SkPathMeasure.cpp",
1126 "src/core/SkPathRef.cpp",
1127 "src/core/SkPoint.cpp",
1128 "src/core/SkRRect.cpp",
1129 "src/core/SkRect.cpp",
1130 "src/core/SkSemaphore.cpp",
1131 "src/core/SkStream.cpp",
1132 "src/core/SkString.cpp",
1133 "src/core/SkStringUtils.cpp",
1134 "src/core/SkStroke.cpp",
1135 "src/core/SkStrokeRec.cpp",
1136 "src/core/SkStrokerPriv.cpp",
1137 "src/core/SkThreadID.cpp",
1138 "src/core/SkUtils.cpp",
1139 "src/effects/SkDashPathEffect.cpp",
1140 "src/effects/SkTrimPathEffect.cpp",
1141 "src/ports/SkDebug_stdio.cpp",
1142 "src/ports/SkMemory_malloc.cpp",
1143 "src/utils/SkDashPath.cpp",
1144 "src/utils/SkParse.cpp",
1145 "src/utils/SkParsePath.cpp",
1146 "src/utils/SkUTF.cpp",
1147 ]
1148}
1149
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001150group("modules") {
1151 deps = [
1152 "modules/skottie",
1153 "modules/skshaper",
1154 ]
1155}
1156
mtkleinc095df52016-08-24 12:23:52 -07001157# Targets guarded by skia_enable_tools may use //third_party freely.
1158if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001159 # Used by gn_to_bp.py to list our public include dirs.
1160 source_set("public") {
1161 configs += [ ":skia_public" ]
1162 }
1163
Mike Kleinc36dedf2016-11-18 09:35:28 -05001164 config("skia.h_config") {
1165 include_dirs = [ "$target_gen_dir" ]
1166 }
1167 action("skia.h") {
1168 public_configs = [ ":skia.h_config" ]
1169 skia_h = "$target_gen_dir/skia.h"
1170 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001171
1172 # TODO: would be cool to not hard-code these here, but how?
1173 module_public_includes = [
1174 "modules/sksg/include",
1175 "modules/skottie/include",
1176 ]
1177 args =
1178 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1179 [ rebase_path(skia_h, root_build_dir) ] +
1180 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001181 depfile = "$skia_h.deps"
1182 outputs = [
1183 skia_h,
1184 ]
1185 }
1186
Brian Osmanc9a42472018-05-31 13:17:12 -04001187 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001188 executable("fiddle") {
1189 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001190 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001191 "tools/fiddle/draw.cpp",
1192 "tools/fiddle/fiddle_main.cpp",
1193 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001194
1195 if (skia_use_egl) {
1196 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001197 } else {
1198 sources += [ "tools/fiddle/null_context.cpp" ]
1199 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001200 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001201 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001202 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001203 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001204 ":skia",
1205 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001206 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001207 ]
1208 }
1209 }
1210
Brian Osmanc9a42472018-05-31 13:17:12 -04001211 source_set("public_headers_warnings_check") {
1212 sources = [
1213 "tools/public_headers_warnings_check.cpp",
1214 ]
1215 configs -= [ "//gn:warnings_except_public_headers" ]
1216 deps = [
1217 ":skia",
1218 ":skia.h",
1219 "modules/skottie",
1220 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001221
1222 # We add this directory to simulate the client already have
1223 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001224 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001225 }
1226
mtkleinc095df52016-08-24 12:23:52 -07001227 template("test_lib") {
1228 config(target_name + "_config") {
1229 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001230 if (defined(invoker.public_defines)) {
1231 defines = invoker.public_defines
1232 }
mtklein25c81d42016-07-27 13:55:26 -07001233 }
mtkleinc095df52016-08-24 12:23:52 -07001234 source_set(target_name) {
1235 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1236 public_configs = [
1237 ":" + target_name + "_config",
1238 ":skia_private",
1239 ]
1240
1241 if (!defined(deps)) {
1242 deps = []
1243 }
1244 deps += [ ":skia" ]
1245 testonly = true
1246 }
mtklein25c81d42016-07-27 13:55:26 -07001247 }
mtklein25c81d42016-07-27 13:55:26 -07001248
Mike Kleine6682eb2017-01-05 10:54:57 -05001249 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001250 if (is_ios) {
1251 app_name = target_name
1252 gen_path = target_gen_dir
1253
1254 action("${app_name}_generate_info_plist") {
1255 script = "//gn/gen_plist_ios.py"
1256 outputs = [
1257 "$gen_path/${app_name}_Info.plist",
1258 ]
1259 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1260 }
1261
1262 bundle_data("${app_name}_bundle_info_plist") {
1263 public_deps = [
1264 ":${app_name}_generate_info_plist",
1265 ]
1266 sources = [
1267 "$gen_path/${app_name}_Info.plist",
1268 ]
1269 outputs = [
1270 "{{bundle_root_dir}}/Info.plist",
1271 ]
1272 }
1273
Jim Van Verth329c5a62017-11-29 11:42:33 -05001274 bundle_ios_data =
1275 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1276
1277 if (bundle_ios_data) {
1278 has_skps =
1279 "True" == exec_script("//gn/checkdir.py",
1280 [ rebase_path("skps", root_build_dir) ],
1281 "trim string")
1282 bundle_data("${app_name}_bundle_resources") {
1283 sources = [
1284 "resources",
1285 ]
1286 outputs = [
1287 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1288 "{{bundle_resources_dir}}/data/resources",
1289 ]
1290 }
1291
1292 if (has_skps) {
1293 bundle_data("${app_name}_bundle_skps") {
1294 sources = [
1295 "skps",
1296 ]
1297 outputs = [
1298 # Store in same folder as resources
1299 "{{bundle_resources_dir}}/data/skps",
1300 ]
1301 }
1302 }
1303 }
1304
Jim Van Verth443a9132017-11-28 09:45:26 -05001305 executable("${app_name}_generate_executable") {
1306 forward_variables_from(invoker,
1307 "*",
1308 [
1309 "output_name",
1310 "visibility",
1311 "is_shared_library",
1312 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001313 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001314 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001315 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1316 }
1317
1318 bundle_data("${app_name}_bundle_executable") {
1319 public_deps = [
1320 ":${app_name}_generate_executable",
1321 ]
1322 sources = [
1323 "$gen_path/$app_name",
1324 ]
1325 outputs = [
1326 "{{bundle_executable_dir}}/$app_name",
1327 ]
1328 testonly = true
1329 }
1330
1331 create_bundle("$app_name") {
1332 product_type = "com.apple.product-type.application"
1333 testonly = true
1334
1335 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1336 bundle_resources_dir = bundle_root_dir
1337 bundle_executable_dir = bundle_root_dir
1338 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1339
1340 deps = [
1341 ":${app_name}_bundle_executable",
1342 ":${app_name}_bundle_info_plist",
1343 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001344 if (bundle_ios_data) {
1345 deps += [ ":${app_name}_bundle_resources" ]
1346 if (has_skps) {
1347 deps += [ ":${app_name}_bundle_skps" ]
1348 }
1349 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001350
1351 # should only code sign when running on a device, not the simulator
1352 if (target_cpu != "x64") {
1353 code_signing_script = "//gn/codesign_ios.py"
1354 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1355 code_signing_outputs = [
1356 "$bundle_root_dir/_CodeSignature/CodeResources",
1357 "$bundle_root_dir/embedded.mobileprovision",
1358 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001359 code_signing_args = [
1360 rebase_path("$bundle_root_dir", root_build_dir),
1361 skia_ios_identity,
1362 skia_ios_profile,
1363 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001364 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001365 }
1366 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001367 # !is_ios
1368
1369 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1370 shared_library("lib" + target_name) {
1371 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1372 configs += [ ":skia_private" ]
1373 testonly = true
1374 }
1375 } else {
1376 _executable = target_name
1377 executable(_executable) {
1378 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1379 configs += [ ":skia_private" ]
1380 testonly = true
1381 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001382 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001383 if (is_android && skia_android_serial != "" && defined(_executable)) {
1384 action("push_" + target_name) {
1385 script = "gn/push_to_android.py"
1386 deps = [
1387 ":" + _executable,
1388 ]
1389 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1390 outputs = [
1391 _stamp,
1392 ]
1393 args = [
1394 rebase_path("$root_build_dir/$_executable"),
1395 skia_android_serial,
1396 rebase_path(_stamp),
1397 ]
1398 testonly = true
1399 }
Mike Klein7d921032017-01-05 12:20:41 -05001400 }
1401 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001402 }
1403
Greg Danielda16cce2018-08-01 09:23:57 -04001404 config("moltenvk_config") {
1405 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1406 if (is_ios) {
1407 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1408 } else {
1409 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1410 }
1411 cflags = [ "-F$moltenvk_framework_path" ]
1412 ldflags = [ "-F$moltenvk_framework_path" ]
1413 libs = [
1414 "MoltenVK.framework",
1415 "Metal.framework",
1416 "IOSurface.framework",
1417 "QuartzCore.framework",
1418 "Foundation.framework",
1419 ]
1420 if (is_ios) {
1421 libs += [ "UIKit.framework" ]
1422 } else {
1423 libs += [ "IOKit.framework" ]
1424 }
1425 defines = [ "SK_MOLTENVK" ]
1426 }
1427 }
1428
1429 source_set("moltenvk") {
1430 public_configs = [ ":moltenvk_config" ]
1431 }
1432
mtkleinc095df52016-08-24 12:23:52 -07001433 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001434 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001435 public_defines = []
1436 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001437
Brian Osmanc9a42472018-05-31 13:17:12 -04001438 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001439 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001440 sources = [
1441 "tools/gpu/GrContextFactory.cpp",
1442 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001443 "tools/gpu/MemoryCache.cpp",
1444 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001445 "tools/gpu/ProxyUtils.cpp",
1446 "tools/gpu/TestContext.cpp",
1447 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1448 "tools/gpu/gl/GLTestContext.cpp",
1449 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001450 "tools/gpu/gl/null/NullGLTestContext.cpp",
1451 "tools/gpu/mock/MockTestContext.cpp",
1452 ]
1453 libs = []
1454
1455 if (is_android || skia_use_egl) {
1456 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1457 } else if (is_ios) {
1458 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1459 libs += [ "OpenGLES.framework" ]
1460 } else if (is_linux) {
1461 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001462 libs += [
1463 "GLU",
1464 "X11",
1465 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001466 } else if (is_mac) {
1467 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1468 } else if (is_win) {
1469 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001470 libs += [ "Gdi32.lib" ]
1471 if (target_cpu != "arm64") {
1472 libs += [ "OpenGL32.lib" ]
1473 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001474 }
mtklein25c81d42016-07-27 13:55:26 -07001475
Brian Osmanc9a42472018-05-31 13:17:12 -04001476 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001477
Brian Osmanc9a42472018-05-31 13:17:12 -04001478 if (skia_use_angle) {
1479 deps += [ "//third_party/angle2" ]
1480 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1481 }
Greg Daniel54200e42018-12-11 17:03:39 -05001482
Greg Daniel487132b2018-12-20 14:09:36 -05001483 public_include_dirs += [ "include/third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001484 if (skia_use_vulkan) {
1485 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1486 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001487 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1488 public_deps += [ ":moltenvk" ]
1489 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001490 }
1491 if (skia_use_metal) {
1492 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001493 }
mtklein25c81d42016-07-27 13:55:26 -07001494 }
mtklein25c81d42016-07-27 13:55:26 -07001495
mtkleinc095df52016-08-24 12:23:52 -07001496 test_lib("flags") {
1497 public_include_dirs = [ "tools/flags" ]
1498 sources = [
1499 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001500 ]
1501 }
1502 test_lib("common_flags") {
1503 public_include_dirs = [ "tools/flags" ]
1504 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001505 "tools/flags/SkCommonFlags.cpp",
1506 "tools/flags/SkCommonFlagsConfig.cpp",
1507 ]
1508 deps = [
mtklein046cb562016-09-16 10:23:12 -07001509 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001510 ]
1511 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001512 ":gpu_tool_utils",
1513 ]
1514 }
mtklein25c81d42016-07-27 13:55:26 -07001515
mtkleinc095df52016-08-24 12:23:52 -07001516 test_lib("tool_utils") {
1517 public_include_dirs = [
1518 "tools",
1519 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001520 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001521 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001522 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001523 ]
1524 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001525 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001526 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001527 "tools/DDLPromiseImageHelper.cpp",
1528 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001529 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001530 "tools/ProcStats.cpp",
1531 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001532 "tools/UrlDataManager.cpp",
1533 "tools/debugger/SkDebugCanvas.cpp",
1534 "tools/debugger/SkDrawCommand.cpp",
1535 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001536 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001537 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001538 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001539 "tools/fonts/SkTestFontMgr.h",
1540 "tools/fonts/SkTestSVGTypeface.cpp",
1541 "tools/fonts/SkTestSVGTypeface.h",
1542 "tools/fonts/SkTestTypeface.cpp",
1543 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001544 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001545 "tools/random_parse_path.cpp",
1546 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001547 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001548 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001549 "tools/trace/SkChromeTracingTracer.cpp",
1550 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001551 "tools/trace/SkDebugfTracer.cpp",
1552 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001553 "tools/trace/SkEventTracingPriv.cpp",
1554 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001555 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001556 libs = []
1557 if (is_ios) {
1558 sources += [ "tools/ios_utils.m" ]
1559 libs += [ "Foundation.framework" ]
1560 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001561 defines = []
1562 if (skia_tools_require_resources) {
1563 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1564 }
mtkleinc095df52016-08-24 12:23:52 -07001565 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001566 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001567 ":flags",
1568 "//third_party/libpng",
1569 ]
1570 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001571 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001572 ]
1573 }
mtklein25c81d42016-07-27 13:55:26 -07001574
Mike Klein6e744122016-10-27 12:21:40 -04001575 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001576 test_lib("gm") {
1577 public_include_dirs = [ "gm" ]
1578 sources = gm_sources
1579 deps = [
scroggo19b91532016-10-24 09:03:26 -07001580 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001581 ":skia",
1582 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001583 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001584 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001585 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001586 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001587 public_deps = [
1588 ":gpu_tool_utils",
1589 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001590 if (skia_enable_skshaper) {
1591 deps += [ "modules/skshaper" ]
1592 defines = [ "SK_USING_SKSHAPER" ]
1593 }
mtkleinc095df52016-08-24 12:23:52 -07001594 }
mtklein25c81d42016-07-27 13:55:26 -07001595
Mike Klein6e744122016-10-27 12:21:40 -04001596 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001597 test_lib("tests") {
1598 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001599 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001600 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001601 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001602 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001603 if (!(skia_use_freetype && skia_use_fontconfig)) {
1604 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1605 }
mtkleinc095df52016-08-24 12:23:52 -07001606 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001607 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001608 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001609 ":skia",
1610 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001611 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001612 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001613 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001614 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001615 "//third_party/zlib",
1616 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001617 public_deps = [
1618 ":gpu_tool_utils", # Test.h #includes headers from this target.
1619 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001620 if (skia_enable_skshaper) {
1621 deps += [ "modules/skshaper" ]
1622 defines = [ "SK_USING_SKSHAPER" ]
1623 }
mtkleinc095df52016-08-24 12:23:52 -07001624 }
mtklein2f3416d2016-08-02 16:02:05 -07001625
Mike Klein6e744122016-10-27 12:21:40 -04001626 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001627 test_lib("bench") {
1628 public_include_dirs = [ "bench" ]
1629 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001630 deps = [
1631 ":flags",
1632 ":gm",
1633 ":gpu_tool_utils",
1634 ":skia",
1635 ":tool_utils",
1636 ]
1637 }
mtklein2b6870c2016-07-28 14:17:33 -07001638
mtkleinc095df52016-08-24 12:23:52 -07001639 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001640 public_include_dirs = []
1641 if (skia_use_expat) {
1642 public_include_dirs += [ "experimental/svg/model" ]
1643 sources = [
1644 "experimental/svg/model/SkSVGAttribute.cpp",
1645 "experimental/svg/model/SkSVGAttributeParser.cpp",
1646 "experimental/svg/model/SkSVGCircle.cpp",
1647 "experimental/svg/model/SkSVGClipPath.cpp",
1648 "experimental/svg/model/SkSVGContainer.cpp",
1649 "experimental/svg/model/SkSVGDOM.cpp",
1650 "experimental/svg/model/SkSVGEllipse.cpp",
1651 "experimental/svg/model/SkSVGGradient.cpp",
1652 "experimental/svg/model/SkSVGLine.cpp",
1653 "experimental/svg/model/SkSVGLinearGradient.cpp",
1654 "experimental/svg/model/SkSVGNode.cpp",
1655 "experimental/svg/model/SkSVGPath.cpp",
1656 "experimental/svg/model/SkSVGPattern.cpp",
1657 "experimental/svg/model/SkSVGPoly.cpp",
1658 "experimental/svg/model/SkSVGRadialGradient.cpp",
1659 "experimental/svg/model/SkSVGRect.cpp",
1660 "experimental/svg/model/SkSVGRenderContext.cpp",
1661 "experimental/svg/model/SkSVGSVG.cpp",
1662 "experimental/svg/model/SkSVGShape.cpp",
1663 "experimental/svg/model/SkSVGStop.cpp",
1664 "experimental/svg/model/SkSVGTransformableNode.cpp",
1665 "experimental/svg/model/SkSVGUse.cpp",
1666 "experimental/svg/model/SkSVGValue.cpp",
1667 ]
1668 deps = [
1669 ":skia",
1670 ":xml",
1671 ]
1672 }
mtkleinc095df52016-08-24 12:23:52 -07001673 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001674
Mike Klein38af9432016-11-11 11:39:44 -05001675 if (skia_use_lua) {
1676 test_lib("lua") {
1677 public_include_dirs = []
1678 sources = [
1679 "src/utils/SkLua.cpp",
1680 "src/utils/SkLuaCanvas.cpp",
1681 ]
1682 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001683 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001684 "//third_party/lua",
1685 ]
1686 }
1687
Mike Kleine6682eb2017-01-05 10:54:57 -05001688 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001689 sources = [
1690 "tools/lua/lua_app.cpp",
1691 ]
1692 deps = [
1693 ":lua",
1694 ":skia",
1695 "//third_party/lua",
1696 ]
Mike Klein38af9432016-11-11 11:39:44 -05001697 }
1698
Mike Kleine6682eb2017-01-05 10:54:57 -05001699 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001700 sources = [
1701 "tools/lua/lua_pictures.cpp",
1702 ]
1703 deps = [
1704 ":flags",
1705 ":lua",
1706 ":skia",
1707 ":tool_utils",
1708 "//third_party/lua",
1709 ]
Mike Klein38af9432016-11-11 11:39:44 -05001710 }
1711 }
1712
Cary Clark8032b982017-07-28 11:04:54 -04001713 test_app("bookmaker") {
1714 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001715 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001716 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001717 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001718 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001719 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001720 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001721 "tools/bookmaker/includeParser.cpp",
1722 "tools/bookmaker/includeWriter.cpp",
1723 "tools/bookmaker/mdOut.cpp",
1724 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001725 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001726 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001727 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001728 ]
1729 deps = [
1730 ":flags",
1731 ":skia",
1732 ":tool_utils",
1733 ]
1734 }
1735
Florin Malitabfe876a2018-09-02 12:33:59 -04001736 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001737 test_app("skottie_tool") {
1738 deps = [
1739 "modules/skottie:tool",
1740 ]
1741 }
1742 }
1743
Kevin Lubickebf648e2017-09-21 13:45:16 -04001744 if (target_cpu != "wasm") {
1745 import("gn/samples.gni")
1746 test_lib("samples") {
1747 public_include_dirs = [ "samplecode" ]
1748 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001749 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001750 public_deps = [
1751 ":tool_utils",
1752 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001753 deps = [
1754 ":experimental_svg_model",
1755 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001756 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001757 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001758 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001759 ]
Mike Klein38af9432016-11-11 11:39:44 -05001760
Ruiqi Maof5101492018-06-29 14:32:21 -04001761 # NIMA does not build on Windows clang
1762 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001763 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001764 deps += [ "//third_party/Nima-Cpp" ]
1765 }
1766
Kevin Lubickebf648e2017-09-21 13:45:16 -04001767 if (skia_use_lua) {
1768 sources += [ "samplecode/SampleLua.cpp" ]
1769 deps += [
1770 ":lua",
1771 "//third_party/lua",
1772 ]
1773 }
1774 }
Mike Klein7af351a2018-07-27 09:54:43 -04001775 test_app("imgcvt") {
1776 sources = [
1777 "tools/imgcvt.cpp",
1778 ]
1779 deps = [
1780 ":skcms",
1781 ":skia",
1782 ]
1783 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001784 test_app("dm") {
1785 sources = [
1786 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001787 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001788 "dm/DMJsonWriter.cpp",
1789 "dm/DMSrcSink.cpp",
1790 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001791 deps = [
1792 ":common_flags",
1793 ":experimental_svg_model",
1794 ":flags",
1795 ":gm",
1796 ":gpu_tool_utils",
1797 ":skia",
1798 ":tests",
1799 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001800 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001801 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001802 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001803 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001804 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001805
1806 # NIMA does not build on Windows clang
1807 if (!is_win || !is_clang) {
1808 deps += [ "//third_party/Nima-Cpp" ]
1809 }
Mike Klein38af9432016-11-11 11:39:44 -05001810 }
Brian Osman16adfa32016-10-18 14:42:44 -04001811 }
1812
Mike Kleina8a51ce2018-01-09 12:34:11 -05001813 if (!is_win) {
1814 test_app("remote_demo") {
1815 sources = [
1816 "tools/remote_demo.cpp",
1817 ]
1818 deps = [
1819 ":skia",
1820 ]
1821 }
1822 }
1823
Mike Kleine6682eb2017-01-05 10:54:57 -05001824 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001825 sources = [
1826 "bench/nanobench.cpp",
1827 ]
1828 deps = [
1829 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001830 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001831 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001832 ":flags",
1833 ":gm",
1834 ":gpu_tool_utils",
1835 ":skia",
1836 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001837 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001838 ]
mtklein2b6870c2016-07-28 14:17:33 -07001839 }
halcanary19a97202016-08-03 15:08:04 -07001840
Ravi Mistry10d36c52017-01-31 09:49:18 -05001841 test_app("skpinfo") {
1842 sources = [
1843 "tools/skpinfo.cpp",
1844 ]
1845 deps = [
1846 ":flags",
1847 ":skia",
1848 ]
1849 }
1850
Brian Osmanc9a42472018-05-31 13:17:12 -04001851 test_app("skpbench") {
1852 sources = [
1853 "tools/skpbench/skpbench.cpp",
1854 ]
1855 deps = [
1856 ":flags",
1857 ":gpu_tool_utils",
1858 ":skia",
1859 ":tool_utils",
1860 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001861 }
1862
Mike Kleine6682eb2017-01-05 10:54:57 -05001863 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001864 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001865 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001866 ]
1867 deps = [
1868 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001869 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001870 ]
halcanary3eee9d92016-09-10 07:01:53 -07001871 }
mtklein046cb562016-09-16 10:23:12 -07001872
Ben Wagner219f3622017-07-17 15:32:25 -04001873 test_app("create_test_font") {
1874 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001875 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001876 ]
1877 deps = [
1878 ":skia",
1879 ]
1880 assert_no_deps = [
1881 # tool_utils requires the output of this app.
1882 ":tool_utils",
1883 ]
1884 }
1885
Florin Malita5d3ff432018-07-31 16:38:43 -04001886 if (skia_use_expat) {
1887 test_app("create_test_font_color") {
1888 sources = [
1889 "tools/fonts/create_test_font_color.cpp",
1890 ]
1891 deps = [
1892 ":flags",
1893 ":skia",
1894 ":tool_utils",
1895 ]
1896 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001897 }
1898
Mike Kleine6682eb2017-01-05 10:54:57 -05001899 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001900 sources = [
1901 "tools/get_images_from_skps.cpp",
1902 ]
1903 deps = [
1904 ":flags",
1905 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001906 ]
mtklein046cb562016-09-16 10:23:12 -07001907 }
mtkleinecbc5262016-09-22 11:51:24 -07001908
Brian Osman6788a542018-12-10 11:56:01 -05001909 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001910 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001911 sources = [
1912 "tools/skiaserve/Request.cpp",
1913 "tools/skiaserve/Response.cpp",
1914 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001915 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1916 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1917 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1918 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1919 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1920 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1921 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1922 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1923 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001924 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1925 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001926 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1927 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1928 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1929 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1930 ]
1931 deps = [
1932 ":flags",
1933 ":gpu_tool_utils",
1934 ":skia",
1935 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001936 "//third_party/libmicrohttpd",
1937 "//third_party/libpng",
1938 ]
Mike Klein7d302882016-11-03 14:06:31 -04001939 }
mtkleinecbc5262016-09-22 11:51:24 -07001940 }
kjlubick14f984b2016-10-03 11:49:45 -07001941
Mike Kleine6682eb2017-01-05 10:54:57 -05001942 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001943 include_dirs = [
1944 "tools",
1945 "tools/debugger",
Kevin Lubickec1c6202018-12-14 11:42:53 -05001946 "tools/fonts",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001947 ]
kjlubick14f984b2016-10-03 11:49:45 -07001948 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001949 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001950 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001951 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001952 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001953 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001954 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001955 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001956 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001957 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001958 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001959 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001960 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001961 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001962 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1963 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001964 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001965 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001966 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001967 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001968 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1969 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001970 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001971 "tools/UrlDataManager.cpp",
1972 "tools/debugger/SkDebugCanvas.cpp",
1973 "tools/debugger/SkDrawCommand.cpp",
1974 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001975 ]
1976 deps = [
1977 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001978 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001979 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001980 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001981 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001982 ]
kjlubick14f984b2016-10-03 11:49:45 -07001983 }
Mike Klein38312422016-10-05 15:41:01 -04001984
Mike Kleine6682eb2017-01-05 10:54:57 -05001985 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001986 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001987 rebase_path("tests/skia_test.cpp"),
1988 rebase_path("tests/Test.cpp"),
1989 ]
caryclark9feb6322016-10-25 08:58:26 -07001990 deps = [
1991 ":flags",
1992 ":gpu_tool_utils",
1993 ":skia",
1994 ":tool_utils",
1995 ]
caryclark9feb6322016-10-25 08:58:26 -07001996 }
1997
Mike Kleine6682eb2017-01-05 10:54:57 -05001998 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001999 sources = [
2000 "tools/DumpRecord.cpp",
2001 "tools/dump_record.cpp",
2002 ]
2003 deps = [
2004 ":flags",
2005 ":skia",
2006 ]
Mike Klein38312422016-10-05 15:41:01 -04002007 }
bungemanfe917272016-10-13 17:36:40 -04002008
Mike Kleine6682eb2017-01-05 10:54:57 -05002009 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002010 sources = [
2011 "tools/skdiff/skdiff.cpp",
2012 "tools/skdiff/skdiff_html.cpp",
2013 "tools/skdiff/skdiff_main.cpp",
2014 "tools/skdiff/skdiff_utils.cpp",
2015 ]
2016 deps = [
2017 ":skia",
2018 ":tool_utils",
2019 ]
bungemanfe917272016-10-13 17:36:40 -04002020 }
halcanarya73d76a2016-10-17 13:19:02 -07002021
Mike Kleine6682eb2017-01-05 10:54:57 -05002022 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002023 sources = [
2024 "tools/skp_parser.cpp",
2025 ]
2026 deps = [
2027 ":skia",
2028 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002029 ]
halcanarya73d76a2016-10-17 13:19:02 -07002030 }
Brian Osman16adfa32016-10-18 14:42:44 -04002031
Brian Osmanc9a42472018-05-31 13:17:12 -04002032 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002033 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05002034 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002035 defines =
2036 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002037 sources = [
2038 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002039 "tools/skqp/src/skqp.cpp",
2040 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002041 ]
2042 deps = [
2043 ":gm",
2044 ":gpu_tool_utils",
2045 ":skia",
2046 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002047 ":tool_utils",
2048 ]
2049 }
2050 test_app("skqp") {
2051 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002052 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002053 ]
2054 deps = [
2055 ":skia",
2056 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002057 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002058 ]
2059 }
2060 test_app("jitter_gms") {
2061 sources = [
2062 "tools/skqp/jitter_gms.cpp",
2063 ]
2064 deps = [
2065 ":gm",
2066 ":skia",
2067 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002068 ]
2069 }
2070 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002071 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002072 test_app("skqp_app") {
2073 is_shared_library = true
2074 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002075 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002076 ]
2077 deps = [
2078 ":skia",
2079 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002080 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002081 ]
2082 libs = [ "android" ]
2083 }
2084 }
Stan Iliev93151722018-08-02 11:10:52 -04002085 if (is_android && skia_enable_gpu) {
2086 test_app("skottie_android") {
2087 is_shared_library = true
2088
2089 sources = [
2090 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2091 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2092 ]
2093 libs = []
2094
2095 include_dirs = []
2096 deps = [
2097 ":skia",
2098 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002099 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002100 ]
2101 }
2102 }
Hal Canary75427132017-10-11 16:00:31 -04002103
Hal Canarya9de7602018-01-19 13:08:23 -05002104 test_app("list_gms") {
2105 sources = [
2106 "tools/list_gms.cpp",
2107 ]
2108 deps = [
2109 ":gm",
2110 ":skia",
2111 ]
2112 }
2113 test_app("list_gpu_unit_tests") {
2114 sources = [
2115 "dm/DMGpuTestProcs.cpp",
2116 "tools/list_gpu_unit_tests.cpp",
2117 ]
2118 deps = [
2119 ":skia",
2120 ":tests",
2121 ]
2122 }
2123
Brian Osmanc9a42472018-05-31 13:17:12 -04002124 test_lib("sk_app") {
2125 public_include_dirs = [ "tools/sk_app" ]
2126 sources = [
2127 "tools/sk_app/CommandSet.cpp",
2128 "tools/sk_app/GLWindowContext.cpp",
2129 "tools/sk_app/Window.cpp",
2130 ]
2131 libs = []
2132
2133 if (is_android) {
2134 sources += [
2135 "tools/sk_app/android/GLWindowContext_android.cpp",
2136 "tools/sk_app/android/RasterWindowContext_android.cpp",
2137 "tools/sk_app/android/Window_android.cpp",
2138 "tools/sk_app/android/main_android.cpp",
2139 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002140 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002141 libs += [ "android" ]
2142 } else if (is_linux) {
2143 sources += [
2144 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2145 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2146 "tools/sk_app/unix/Window_unix.cpp",
2147 "tools/sk_app/unix/keysym2ucs.c",
2148 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002149 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002150 libs += [
2151 "GL",
2152 "X11",
2153 ]
2154 } else if (is_win) {
2155 sources += [
2156 "tools/sk_app/win/GLWindowContext_win.cpp",
2157 "tools/sk_app/win/RasterWindowContext_win.cpp",
2158 "tools/sk_app/win/Window_win.cpp",
2159 "tools/sk_app/win/main_win.cpp",
2160 ]
Brian Salomon194db172017-08-17 14:37:06 -04002161 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002162 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002163 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002164 } else if (is_mac) {
2165 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002166 "tools/sk_app/mac/GLWindowContext_mac.mm",
2167 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2168 "tools/sk_app/mac/Window_mac.mm",
2169 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002170 ]
2171 libs += [
2172 "QuartzCore.framework",
2173 "Cocoa.framework",
2174 "Foundation.framework",
2175 ]
2176 } else if (is_ios) {
2177 sources += [
2178 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2179 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2180 "tools/sk_app/ios/Window_ios.cpp",
2181 "tools/sk_app/ios/main_ios.cpp",
2182 ]
2183 }
2184
2185 if (skia_use_vulkan) {
2186 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2187 if (is_android) {
2188 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2189 } else if (is_linux) {
2190 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2191 libs += [ "X11-xcb" ]
2192 } else if (is_win) {
2193 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002194 } else if (is_mac) {
2195 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2196 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002197 }
2198 }
2199
Jim Van Verthbe39f712019-02-08 15:36:14 -05002200 if (skia_use_metal) {
2201 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2202 if (is_mac) {
2203 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2204 }
2205 libs += [ "MetalKit.framework" ]
2206 }
2207
Brian Osmanc9a42472018-05-31 13:17:12 -04002208 deps = [
2209 ":gpu_tool_utils",
2210 ":skia",
2211 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002212 ]
2213 if (is_android) {
2214 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002215 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002216 deps += [ "//third_party/libsdl" ]
2217 }
2218 if (skia_use_angle) {
2219 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002220 }
Brian Osman16adfa32016-10-18 14:42:44 -04002221 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002222
Brian Osmanc9a42472018-05-31 13:17:12 -04002223 test_app("viewer") {
2224 is_shared_library = is_android
2225 if (is_ios) {
2226 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002227 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002228 sources = [
2229 "tools/viewer/BisectSlide.cpp",
2230 "tools/viewer/GMSlide.cpp",
2231 "tools/viewer/ImGuiLayer.cpp",
2232 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002233 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002234 "tools/viewer/SKPSlide.cpp",
2235 "tools/viewer/SampleSlide.cpp",
2236 "tools/viewer/SkottieSlide.cpp",
2237 "tools/viewer/SlideDir.cpp",
2238 "tools/viewer/StatsLayer.cpp",
2239 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002240 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002241 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002242 "tools/viewer/Viewer.cpp",
2243 ]
2244 libs = []
2245
Kevin Lubickd9699322018-10-30 15:08:53 -04002246 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002247 deps = [
2248 ":experimental_svg_model",
2249 ":flags",
2250 ":gm",
2251 ":gpu_tool_utils",
2252 ":samples",
2253 ":sk_app",
2254 ":skia",
2255 ":tool_utils",
Brian Osman7c979f52019-02-12 13:27:51 -05002256 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002257 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002258 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002259 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002260 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002261 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002262 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002263
2264 # NIMA does not build on Windows clang
2265 if (!is_win || !is_clang) {
2266 sources += [ "tools/viewer/NIMASlide.cpp" ]
2267 deps += [ "//third_party/Nima-Cpp" ]
2268 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002269 }
2270
ziadbbceddbc2018-06-19 13:57:15 -04002271 if (is_android) {
2272 test_app("arcore") {
2273 is_shared_library = true
2274 configs = [
2275 ":skia_public",
2276 "gn:default",
2277 ]
2278
2279 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2280 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2281 sources = []
2282 sources += skia_core_sources
2283 sources += skia_utils_sources
2284 sources += skia_xps_sources
2285 sources += [
2286 "src/android/SkAndroidFrameworkUtils.cpp",
2287 "src/android/SkAnimatedImage.cpp",
2288 "src/android/SkBitmapRegionCodec.cpp",
2289 "src/android/SkBitmapRegionDecoder.cpp",
2290 "src/codec/SkAndroidCodec.cpp",
2291 "src/codec/SkBmpBaseCodec.cpp",
2292 "src/codec/SkBmpCodec.cpp",
2293 "src/codec/SkBmpMaskCodec.cpp",
2294 "src/codec/SkBmpRLECodec.cpp",
2295 "src/codec/SkBmpStandardCodec.cpp",
2296 "src/codec/SkCodec.cpp",
2297 "src/codec/SkCodecImageGenerator.cpp",
2298 "src/codec/SkColorTable.cpp",
2299 "src/codec/SkGifCodec.cpp",
2300 "src/codec/SkMaskSwizzler.cpp",
2301 "src/codec/SkMasks.cpp",
2302 "src/codec/SkSampledCodec.cpp",
2303 "src/codec/SkSampler.cpp",
2304 "src/codec/SkStreamBuffer.cpp",
2305 "src/codec/SkSwizzler.cpp",
2306 "src/codec/SkWbmpCodec.cpp",
2307 "src/images/SkImageEncoder.cpp",
2308 "src/ports/SkDiscardableMemory_none.cpp",
2309 "src/ports/SkImageGenerator_skia.cpp",
2310 "src/ports/SkMemory_malloc.cpp",
2311 "src/ports/SkOSFile_stdio.cpp",
2312 "src/sfnt/SkOTTable_name.cpp",
2313 "src/sfnt/SkOTUtils.cpp",
2314 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -05002315 "third_party/etc1/etc1.cpp",
ziadbbceddbc2018-06-19 13:57:15 -04002316 "third_party/gif/SkGifImageReader.cpp",
2317 ]
2318 deps = [
2319 ":tool_utils",
2320 "modules/skottie",
2321 "modules/skshaper",
2322 ]
2323 }
2324 }
2325
Brian Osmanc9a42472018-05-31 13:17:12 -04002326 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002327 test_app("HelloWorld") {
2328 sources = [
2329 "example/HelloWorld.cpp",
2330 ]
2331 libs = []
2332
2333 include_dirs = []
2334 deps = [
2335 ":flags",
2336 ":gpu_tool_utils",
2337 ":sk_app",
2338 ":skia",
2339 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002340 ]
2341 }
2342 }
2343
Brian Osmanc9a42472018-05-31 13:17:12 -04002344 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002345 test_app("SkiaSDLExample") {
2346 sources = [
2347 "example/SkiaSDLExample.cpp",
2348 ]
2349 libs = []
2350 include_dirs = []
2351 deps = [
2352 ":gpu_tool_utils",
2353 ":skia",
2354 "//third_party/libsdl",
2355 ]
2356 }
2357 }
2358
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002359 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2360 action_foreach("generate_mocs") {
2361 script = "gn/call.py"
2362 sources = [
2363 "tools/mdbviz/MainWindow.h",
2364 ]
2365 outputs = [
2366 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2367 ]
2368 args = [
2369 "$skia_qt_path" + "/bin/moc",
2370 "{{source}}",
2371 "-o",
2372 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2373 ]
2374 }
2375 action_foreach("generate_resources") {
2376 script = "gn/call.py"
2377 sources = [
2378 "tools/mdbviz/resources.qrc",
2379 ]
2380 outputs = [
2381 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2382 ]
2383 args = [
2384 "$skia_qt_path" + "/bin/rcc",
2385 "{{source}}",
2386 "-o",
2387 "gen/mdbviz/{{source_name_part}}_res.cpp",
2388 ]
2389 }
2390 test_app("mdbviz") {
2391 if (is_win) {
2392 # on Windows we need to disable some exception handling warnings due to the Qt headers
2393 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2394 }
2395 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002396 "tools/UrlDataManager.cpp",
2397 "tools/debugger/SkDebugCanvas.cpp",
2398 "tools/debugger/SkDrawCommand.cpp",
2399 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002400 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002401 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002402 "tools/mdbviz/main.cpp",
2403
2404 # generated files
2405 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2406 "$target_gen_dir/mdbviz/resources_res.cpp",
2407 ]
2408 lib_dirs = [ "$skia_qt_path/lib" ]
2409 libs = [
2410 "Qt5Core.lib",
2411 "Qt5Gui.lib",
2412 "Qt5Widgets.lib",
2413 ]
2414 include_dirs = [
2415 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002416 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002417 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002418 "tools",
2419 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002420 ]
2421 deps = [
2422 ":generate_mocs",
2423 ":generate_resources",
2424 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002425 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002426 ]
2427 }
2428 }
2429
Mike Kleine459afd2017-03-03 09:21:30 -05002430 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002431 copy("gdbserver") {
2432 sources = [
2433 "$ndk/$ndk_gdbserver",
2434 ]
2435 outputs = [
2436 "$root_out_dir/gdbserver",
2437 ]
2438 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002439 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002440
2441 if (skia_use_opencl) {
2442 test_app("hello-opencl") {
2443 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002444 "tools/hello-opencl.cpp",
2445 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002446 deps = [
2447 "//third_party/opencl",
2448 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002449 }
2450 }
mtklein25c81d42016-07-27 13:55:26 -07002451}