blob: d5dd3ee7387286a381465af42a52a2c6c734b3bc [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")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040019 skia_enable_flutter_defines = false
20}
21
22declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000023 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040024 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070025 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070026 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070027 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040028 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070029 skia_use_libjpeg_turbo = true
30 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070031 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050032 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040033 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040034 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040035 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070036 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040037 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040038 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070039 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070040
Mike Klein7d921032017-01-05 12:20:41 -050041 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040042 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000043 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050044 skia_enable_discrete_gpu = true
Mike Klein34d7a162018-11-07 18:52:14 +000045 skia_enable_effects = true
46 skia_enable_effects_imagefilters = true
47 skia_enable_effect_deserialization = !skia_enable_flutter_defines
Hal Canaryff2742e2018-01-30 11:35:47 -050048 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000049 skia_enable_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040050 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050051 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040052 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040053 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050054 skia_enable_tools = is_skia_dev_build
55 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielda16cce2018-08-01 09:23:57 -040056 skia_vulkan_header = "" # temporary as we remove the use from clients
Robert Phillipsa6d2d702017-09-01 12:17:03 -040057 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040058 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070059 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070060 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040061
Hal Canary4689b542018-01-31 11:54:14 -050062 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050063 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040064
65 skia_llvm_path = ""
66 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040067
68 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070069}
Brian Salomon23d73ea2016-10-27 13:31:37 -040070declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040071 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040072 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050073 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040074
Mike Klein4d598a32016-10-31 13:44:49 -040075 if (is_android) {
76 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070077 } else if (is_fuchsia) {
78 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040079 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040080 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
81 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040082 }
Jim Van Verth4e502972017-12-07 15:16:10 -050083
84 if (is_ios) {
85 skia_ios_identity = ".*Google.*"
86 skia_ios_profile = "Google Development"
87 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040088}
Brian Salomon789e25e2016-09-30 13:41:03 -040089
Adam Barth54ef74a2017-10-13 10:59:38 -070090if (defined(skia_settings)) {
91 import(skia_settings)
92}
93
Brian Osmanc9a42472018-05-31 13:17:12 -040094# Our tools require static linking (they use non-exported symbols), and the GPU backend.
95skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070096
mtkleina45be612016-08-29 15:22:10 -070097fontmgr_android_enabled = skia_use_expat && skia_use_freetype
98
mtklein1211e0c2016-07-26 13:55:45 -070099skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -0700100 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700101 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700102 "include/codec",
103 "include/config",
104 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -0400105 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400107 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700108 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500109 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700110 "include/pathops",
111 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700112 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700113 "include/utils",
114 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700115]
116
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500117if (skia_enable_atlas_text) {
118 skia_public_includes += [ "include/atlastext" ]
119}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000120
mtkleinc04ff472016-06-23 10:29:30 -0700121# Skia public API, generally provided by :skia.
122config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700123 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400124 defines = []
125 if (is_component_build) {
126 defines += [ "SKIA_DLL" ]
127 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400128 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700129 defines += [ "SK_SAMPLES_FOR_X" ]
130 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400131 if (skia_enable_flutter_defines) {
132 defines += flutter_defines
133 }
mtklein06c35c02016-09-20 12:28:12 -0700134 if (!skia_enable_gpu) {
135 defines += [ "SK_SUPPORT_GPU=0" ]
136 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500137 if (skia_enable_atlas_text) {
138 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
139 }
mtkleinc04ff472016-06-23 10:29:30 -0700140}
141
142# Skia internal APIs, used by Skia itself and a few test tools.
143config("skia_private") {
144 visibility = [ ":*" ]
145
146 include_dirs = [
147 "include/private",
148 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700149 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700150 "src/core",
151 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700152 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700153 "src/image",
154 "src/images",
155 "src/lazy",
156 "src/opts",
157 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700158 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700159 "src/ports",
160 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400161 "src/shaders",
162 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700163 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700164 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700165 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500166 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700167 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700168 ]
mtklein150d1132016-08-01 06:56:40 -0700169
Mike Reeda9e241d2017-05-03 10:52:00 -0400170 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700171 if (is_android) {
172 defines += [
173 "SK_GAMMA_EXPONENT=1.4",
174 "SK_GAMMA_CONTRAST=0.0",
175 ]
176 }
mtklein88a7ac02016-09-14 11:16:49 -0700177 if (is_official_build || is_android) {
178 # TODO(bsalomon): it'd be nice to make Android normal.
179 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
180 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400181 libs = []
182 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500183 if (skia_enable_gpu) {
184 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500185 if (is_skia_dev_build && skia_use_vulkan) {
186 include_dirs += [ "tools/gpu/vk" ]
187 }
Brian Salomon03e05842017-02-23 12:23:47 -0500188 }
Brian Osman34755e22016-12-05 09:46:02 -0500189 if (skia_use_angle) {
190 defines += [ "SK_ANGLE" ]
191 }
Brian Osman3f375d02016-12-28 11:19:22 -0500192 if (skia_enable_discrete_gpu) {
193 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
194 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400195 if (!is_official_build) {
196 defines += [ "GR_TEST_UTILS=1" ]
197 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400198 if (skia_llvm_path != "") {
199 defines += [ "SK_LLVM_AVAILABLE" ]
200 include_dirs += [ "$skia_llvm_path/include" ]
201 libs += [ skia_llvm_lib ]
202 lib_dirs += [ "$skia_llvm_path/lib/" ]
203 }
mtkleinc04ff472016-06-23 10:29:30 -0700204}
205
206# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
207config("skia_library") {
208 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700209 defines = [ "SKIA_IMPLEMENTATION=1" ]
210}
211
212skia_library_configs = [
213 ":skia_public",
214 ":skia_private",
215 ":skia_library",
216]
217
mtklein9b8583d2016-08-24 17:32:30 -0700218# Use for CPU-specific Skia code that needs particular compiler flags.
219template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500220 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700221 if (invoker.enabled) {
222 source_set(target_name) {
223 forward_variables_from(invoker, "*")
224 configs += skia_library_configs
225 }
226 } else {
227 # If not enabled, a phony empty target that swallows all otherwise unused variables.
228 source_set(target_name) {
229 forward_variables_from(invoker,
230 "*",
231 [
232 "sources",
233 "cflags",
234 ])
235 }
236 }
anmittala7eaf2e2016-08-17 13:57:26 -0700237}
238
mtklein422310d2016-08-16 18:28:43 -0700239is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700240
mtklein7d6fb2c2016-08-25 14:50:44 -0700241opts("none") {
242 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700244 cflags = []
245}
246
mtklein7d6fb2c2016-08-25 14:50:44 -0700247opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700248 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700250 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700251}
252
253opts("arm64") {
254 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700255 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700256 cflags = []
257}
258
259opts("crc32") {
260 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700261 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700262 cflags = [ "-march=armv8-a+crc" ]
263}
264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("sse2") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-msse2" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtkleinc04ff472016-06-23 10:29:30 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("ssse3") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-mssse3" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtkleinc04ff472016-06-23 10:29:30 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("sse41") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400289 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-msse4.1" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
mtklein4e976072016-08-08 09:06:27 -0700294
mtklein9b8583d2016-08-24 17:32:30 -0700295opts("sse42") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400298 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400299 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
300 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400301 cflags = [ "-msse4.2" ]
302 }
mtklein9b8583d2016-08-24 17:32:30 -0700303}
304
305opts("avx") {
306 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700307 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400308 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000309 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400310 } else {
311 cflags = [ "-mavx" ]
312 }
mtkleinc04ff472016-06-23 10:29:30 -0700313}
314
Mike Klein1b9b7d52018-02-27 10:37:40 -0500315opts("hsw") {
316 enabled = is_x86
317 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400318 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500319 cflags = [ "/arch:AVX2" ]
320 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000321 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500322 }
323
324 # Oddly, clang-cl doesn't recognize this as a valid flag.
325 # If it ever does, it'd nice to move this up with -mavx2 and co.
326 if (is_clang && !is_win) {
327 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
328 # but nice to have, generating slightly better code for paths without explicit FMAs.
329 cflags += [ "-ffp-contract=fast" ]
330 }
331}
332
mtkleinc095df52016-08-24 12:23:52 -0700333# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700334template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500335 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700336 if (invoker.enabled) {
337 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700338 if (defined(invoker.public_defines)) {
339 defines = invoker.public_defines
340 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600341 if (defined(invoker.public_configs)) {
342 configs = invoker.public_configs
343 }
mtklein457b42a2016-08-23 13:56:37 -0700344 }
345 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700346 forward_variables_from(invoker,
347 "*",
348 [
349 "public_defines",
350 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700351 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700352 ])
mtklein457b42a2016-08-23 13:56:37 -0700353 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700354 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700355 if (defined(invoker.configs_to_remove)) {
356 configs -= invoker.configs_to_remove
357 }
mtklein457b42a2016-08-23 13:56:37 -0700358 }
359 } else {
mtklein457b42a2016-08-23 13:56:37 -0700360 source_set(target_name) {
361 forward_variables_from(invoker,
362 "*",
363 [
364 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400365 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700366 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700367 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700368 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700369 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700370 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700371 ])
mtkleincd01b032016-08-31 04:58:19 -0700372 if (defined(invoker.sources_when_disabled)) {
373 sources = invoker.sources_when_disabled
374 }
375 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700376 }
mtkleineb3c4252016-08-23 07:38:09 -0700377 }
mtklein457b42a2016-08-23 13:56:37 -0700378}
mtklein457b42a2016-08-23 13:56:37 -0700379
Mike Klein34d7a162018-11-07 18:52:14 +0000380optional("effects") {
381 enabled = skia_enable_effects
382 deps = [
383 ":compile_processors",
384 ]
385 sources = skia_effects_sources
386 if (skia_enable_effects_imagefilters) {
387 sources += skia_effects_imagefilter_sources_no_global_initialization
388 if (!skia_enable_skpicture) {
389 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
390 }
391 }
392}
393
394optional("effect_deserialization") {
395 enabled = skia_enable_effects && skia_enable_effect_deserialization
396
397 sources = [
398 "src/ports/SkGlobalInitialization_default.cpp",
399 ]
400 if (skia_enable_effects_imagefilters) {
401 sources += [ "src/ports/SkGlobalInitialization_default_imagefilters.cpp" ]
402 } else {
403 sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
404 }
405
406 sources_when_disabled = [
407 "src/ports/SkGlobalInitialization_none.cpp",
408 "src/ports/SkGlobalInitialization_none_imagefilters.cpp",
409 ]
410}
411
mtkleina45be612016-08-29 15:22:10 -0700412optional("fontmgr_android") {
413 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700414
415 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500416 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700417 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700418 ]
419 sources = [
420 "src/ports/SkFontMgr_android.cpp",
421 "src/ports/SkFontMgr_android_factory.cpp",
422 "src/ports/SkFontMgr_android_parser.cpp",
423 ]
424}
425
mtkleind2e39db2016-09-07 07:52:55 -0700426optional("fontmgr_custom") {
Kevin Lubick217056c2018-09-20 17:39:31 -0400427 enabled = (is_linux || target_cpu == "wasm") && skia_use_freetype &&
428 !skia_use_fontconfig
mtkleind2e39db2016-09-07 07:52:55 -0700429
430 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500431 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700432 ]
433 sources = [
434 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500435 "src/ports/SkFontMgr_custom.h",
436 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700437 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500438 "src/ports/SkFontMgr_custom_embedded.cpp",
439 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700440 ]
441}
442
Hal Canaryff2742e2018-01-30 11:35:47 -0500443optional("fontmgr_empty") {
444 enabled = skia_enable_fontmgr_empty
445 sources = [
446 "src/ports/SkFontMgr_empty_factory.cpp",
447 ]
448}
449
mtklein3cc22182016-08-29 13:26:14 -0700450optional("fontmgr_fontconfig") {
451 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700452
453 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500454 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700455 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700456 ]
457 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700458 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700459 "src/ports/SkFontConfigInterface_direct.cpp",
460 "src/ports/SkFontConfigInterface_direct_factory.cpp",
461 "src/ports/SkFontMgr_FontConfigInterface.cpp",
462 "src/ports/SkFontMgr_fontconfig.cpp",
463 "src/ports/SkFontMgr_fontconfig_factory.cpp",
464 ]
465}
466
mtkleincdedd0e2016-09-12 15:15:44 -0700467optional("fontmgr_fuchsia") {
468 enabled = is_fuchsia && skia_use_freetype
469
470 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500471 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700472 ]
473 sources = [
474 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500475 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700476 "src/ports/SkFontMgr_custom_empty_factory.cpp",
477 ]
478}
479
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700480if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400481 executable("sksllex") {
482 sources = [
483 "src/sksl/lex/Main.cpp",
484 "src/sksl/lex/NFA.cpp",
485 "src/sksl/lex/RegexNode.cpp",
486 "src/sksl/lex/RegexParser.cpp",
487 ]
488 include_dirs = [ "src/sksl/lex" ]
489 }
490
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700491 action("run_sksllex") {
492 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400493 deps = [
494 ":sksllex(//gn/toolchain:$host_toolchain)",
495 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700496 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700497 "src/sksl/lex/sksl.lex",
498 ]
499
500 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
501 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
502 outputs = [
503 "$target_out_dir/" +
504 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
505 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
506 # confused due to the same file being named by two different paths
507 ]
508 sksllex_path = "$root_out_dir/"
509 sksllex_path += "sksllex"
510 if (host_os == "win") {
511 sksllex_path += ".exe"
512 }
513 args = [
514 rebase_path(sksllex_path),
515 rebase_path("bin/clang-format"),
516 rebase_path("src"),
517 ]
518 }
519} else {
520 group("run_sksllex") {
521 }
522}
523
524if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400525 executable("skslc") {
526 defines = [ "SKSL_STANDALONE" ]
527 sources = [
528 "src/sksl/SkSLMain.cpp",
529 ]
530 sources += skia_sksl_sources
531 include_dirs = [
532 "src/gpu",
533 "src/sksl",
534 ]
535 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500536 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400537 "//third_party/spirv-tools",
538 ]
539 }
540
541 skia_gpu_processor_outputs = []
542 foreach(src, skia_gpu_processor_sources) {
543 dir = get_path_info(src, "dir")
544 name = get_path_info(src, "name")
545
546 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
547 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
548 skia_gpu_processor_outputs += [
549 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
550 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
551 # confused due to the same file being named by two different paths
552 ]
553 }
554
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500555 action("create_sksl_enums") {
556 script = "gn/create_sksl_enums.py"
557 sources = [
558 "include/private/GrSharedEnums.h",
559 ]
560 outputs = [
561 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500562 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500563 ]
564 args = [
565 rebase_path(sources[0]),
566 rebase_path(outputs[0]),
567 ]
568 }
569
Ethan Nicholas762466e2017-06-29 10:03:38 -0400570 action("compile_processors") {
571 script = "gn/compile_processors.py"
572 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500573 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 ":skslc(//gn/toolchain:$host_toolchain)",
575 ]
576 sources = skia_gpu_processor_sources
577 outputs = skia_gpu_processor_outputs
578 skslc_path = "$root_out_dir/"
579 if (host_toolchain != default_toolchain_name) {
580 skslc_path += "$host_toolchain/"
581 }
582 skslc_path += "skslc"
583 if (host_os == "win") {
584 skslc_path += ".exe"
585 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400586 args = [
587 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400588 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400589 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400590 args += rebase_path(skia_gpu_processor_sources)
591 }
592} else {
593 skia_gpu_processor_outputs = []
594 group("compile_processors") {
595 }
596}
597
mtklein06c35c02016-09-20 12:28:12 -0700598optional("gpu") {
599 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400600 deps = [
601 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700602 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400603 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700604 if (skia_generate_workarounds) {
605 deps += [ ":workaround_list" ]
606 }
mtkleine9fb3d52016-09-20 15:11:46 -0700607 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600608 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400609 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700610
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400612 if (!skia_enable_ccpr) {
613 sources -= skia_ccpr_sources
614 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
615 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400616 if (!skia_enable_nvpr) {
617 sources -= skia_nvpr_sources
618 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
619 }
mtklein06c35c02016-09-20 12:28:12 -0700620
621 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500622 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700623 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400624 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700625 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400626 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400627
628 # this lib is required to link against AHardwareBuffer
629 if (defined(ndk_api) && ndk_api >= 26) {
630 libs += [ "android" ]
631 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400632 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500633 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400634 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700635 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500636 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400637 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700638 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500639 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800640 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500641 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400642 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500643 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400644 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700645 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500646 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700647 }
mtkleine9fb3d52016-09-20 15:11:46 -0700648
649 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400650 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400651 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700652 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700653 if (skia_enable_vulkan_debug_layers) {
654 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
655 }
mtkleine9fb3d52016-09-20 15:11:46 -0700656 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400657
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400658 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400659 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400660 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
661 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400662
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400663 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400664 if (skia_use_metal) {
665 public_defines += [ "SK_METAL" ]
666 sources += skia_metal_sources
667 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400668 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400669 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400670 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500671
672 if (skia_enable_atlas_text) {
673 sources += skia_atlas_text_sources
674 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400675
676 if (is_debug) {
677 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
678 }
mtklein06c35c02016-09-20 12:28:12 -0700679}
680
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400681optional("heif") {
682 enabled = skia_use_libheif
683 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
684
685 deps = []
686
687 sources = [
688 "src/codec/SkHeifCodec.cpp",
689 ]
690}
691
mtklein63213812016-08-24 09:55:56 -0700692optional("jpeg") {
693 enabled = skia_use_libjpeg_turbo
694 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
695
mtklein63213812016-08-24 09:55:56 -0700696 deps = [
697 "//third_party/libjpeg-turbo:libjpeg",
698 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400699 public = [
700 "include/encode/SkJpegEncoder.h",
701 ]
mtklein63213812016-08-24 09:55:56 -0700702 sources = [
703 "src/codec/SkJpegCodec.cpp",
704 "src/codec/SkJpegDecoderMgr.cpp",
705 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700706 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400707 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700708 ]
709}
710
711optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500712 enabled = skia_use_zlib && skia_enable_pdf
713 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700714
mtklein63213812016-08-24 09:55:56 -0700715 deps = [
716 "//third_party/zlib",
717 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400718 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700719 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400720 }
brettwb9447282016-09-01 14:24:39 -0700721 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700722 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700723
724 if (skia_use_sfntly) {
725 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500726 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700727 }
728}
729
730optional("png") {
731 enabled = skia_use_libpng
732 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
733
mtklein63213812016-08-24 09:55:56 -0700734 deps = [
735 "//third_party/libpng",
736 ]
737 sources = [
738 "src/codec/SkIcoCodec.cpp",
739 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400740 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700741 ]
742}
743
scroggof84ad642016-10-31 09:02:57 -0700744optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400745 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700746 public_defines = [ "SK_CODEC_DECODES_RAW" ]
747
748 deps = [
749 "//third_party/dng_sdk",
750 "//third_party/libjpeg-turbo:libjpeg",
751 "//third_party/piex",
752 ]
753
754 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
755 # Skia.
756 configs_to_remove = [ "//gn:no_exceptions" ]
757
758 sources = [
759 "src/codec/SkRawAdapterCodec.cpp",
760 "src/codec/SkRawCodec.cpp",
761 ]
762}
763
Mike Klein852a8cb2018-05-15 10:46:58 -0400764import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400765source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400766 cflags = []
767 if (!is_win || is_clang) {
768 cflags += [
769 "-w",
770 "-std=c11",
771 ]
772 }
773
774 public = [
775 "third_party/skcms/skcms.h",
776 ]
777 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
778}
779
mtklein3cc22182016-08-29 13:26:14 -0700780optional("typeface_freetype") {
781 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700782
783 deps = [
784 "//third_party/freetype2",
785 ]
786 sources = [
787 "src/ports/SkFontHost_FreeType.cpp",
788 "src/ports/SkFontHost_FreeType_common.cpp",
789 ]
790}
791
mtklein457b42a2016-08-23 13:56:37 -0700792optional("webp") {
793 enabled = skia_use_libwebp
794 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
795
mtklein457b42a2016-08-23 13:56:37 -0700796 deps = [
797 "//third_party/libwebp",
798 ]
799 sources = [
800 "src/codec/SkWebpAdapterCodec.cpp",
801 "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 = [
865 ":effects",
866 ":gpu",
867 ":pdf",
868 ":skcms",
869 ]
870
mtkleinc04ff472016-06-23 10:29:30 -0700871 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700872 ":arm64",
873 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700874 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700875 ":crc32",
Mike Klein34d7a162018-11-07 18:52:14 +0000876 ":effect_deserialization",
mtkleina45be612016-08-29 15:22:10 -0700877 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700878 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500879 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700880 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700881 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400882 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500883 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700884 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700885 ":none",
mtklein63213812016-08-24 09:55:56 -0700886 ":png",
scroggof84ad642016-10-31 09:02:57 -0700887 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700888 ":sse2",
889 ":sse41",
890 ":sse42",
891 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700892 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400893 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700894 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700895 ]
896
Kevin Lubick134be1d2018-10-30 15:05:04 -0400897 if (skia_enable_nima) {
898 deps += [ "//third_party/Nima-Cpp" ]
899 }
900
Chinmay Garde43f115c2016-11-16 15:04:12 -0800901 # This file (and all GN files in Skia) are designed to work with an
902 # empty sources assignment filter; we handle all that explicitly.
903 # We clear the filter here for clients who may have set up a global filter.
904 set_sources_assignment_filter([])
905
mtkleinc04ff472016-06-23 10:29:30 -0700906 sources = []
brettwb9447282016-09-01 14:24:39 -0700907 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700908 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500909 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700910 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400911 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500912 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700913 "src/android/SkBitmapRegionCodec.cpp",
914 "src/android/SkBitmapRegionDecoder.cpp",
915 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400916 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700917 "src/codec/SkBmpCodec.cpp",
918 "src/codec/SkBmpMaskCodec.cpp",
919 "src/codec/SkBmpRLECodec.cpp",
920 "src/codec/SkBmpStandardCodec.cpp",
921 "src/codec/SkCodec.cpp",
922 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400923 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400924 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700925 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700926 "src/codec/SkMaskSwizzler.cpp",
927 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700928 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700929 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700930 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700931 "src/codec/SkSwizzler.cpp",
932 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700933 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700934 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700935 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700936 "src/ports/SkMemory_malloc.cpp",
937 "src/ports/SkOSFile_stdio.cpp",
938 "src/sfnt/SkOTTable_name.cpp",
939 "src/sfnt/SkOTUtils.cpp",
940 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700941 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700942 ]
brettwb9447282016-09-01 14:24:39 -0700943
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400944 defines = []
945 if (!skia_enable_skpicture) {
946 defines = [ "SK_DISABLE_SKPICTURE" ]
947 sources -= skia_skpicture_sources
948 sources += [ "src/core/SkPicture_none.cpp" ]
949 }
950
mtklein7d6fb2c2016-08-25 14:50:44 -0700951 libs = []
952
mtkleinc04ff472016-06-23 10:29:30 -0700953 if (is_win) {
954 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400955 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700956 "src/ports/SkDebug_win.cpp",
957 "src/ports/SkFontHost_win.cpp",
958 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500959 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700960 "src/ports/SkImageEncoder_WIC.cpp",
961 "src/ports/SkImageGeneratorWIC.cpp",
962 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700963 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700964 "src/ports/SkScalerContext_win_dw.cpp",
965 "src/ports/SkTLS_win.cpp",
966 "src/ports/SkTypeface_win_dw.cpp",
967 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400968 libs += [
969 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500970 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400971 "Ole32.lib",
972 "OleAut32.lib",
973 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500974 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400975 ]
mtkleinc04ff472016-06-23 10:29:30 -0700976 } else {
977 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700978 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700979 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700980 "src/ports/SkTLS_pthread.cpp",
981 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400982 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700983 }
984
mtklein7d6fb2c2016-08-25 14:50:44 -0700985 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500986 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500987 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500988 deps += [ "//third_party/cpu-features" ]
989 }
mtklein06c35c02016-09-20 12:28:12 -0700990 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700991 libs += [
992 "EGL",
993 "GLESv2",
994 "log",
995 ]
996 }
997
Kevin Lubick217056c2018-09-20 17:39:31 -0400998 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700999 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001000 if (skia_use_egl) {
1001 libs += [ "GLESv2" ]
1002 }
mtkleinc04ff472016-06-23 10:29:30 -07001003 }
1004
1005 if (is_mac) {
1006 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001007 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001008 "src/ports/SkFontHost_mac.cpp",
1009 "src/ports/SkImageEncoder_CG.cpp",
1010 "src/ports/SkImageGeneratorCG.cpp",
1011 ]
mtklein09e61f72016-08-23 13:35:28 -07001012 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001013 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1014 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001015 "ApplicationServices.framework",
1016 "OpenGL.framework",
1017 ]
mtkleinc04ff472016-06-23 10:29:30 -07001018 }
abarth6fc8ff02016-07-15 15:15:15 -07001019
Mike Klein7d302882016-11-03 14:06:31 -04001020 if (is_ios) {
1021 sources += [
1022 "src/ports/SkDebug_stdio.cpp",
1023 "src/ports/SkFontHost_mac.cpp",
1024 "src/ports/SkImageEncoder_CG.cpp",
1025 "src/ports/SkImageGeneratorCG.cpp",
1026 ]
1027 libs += [
1028 "CoreFoundation.framework",
1029 "CoreGraphics.framework",
1030 "CoreText.framework",
1031 "ImageIO.framework",
1032 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001033
1034 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1035 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001036 ]
1037 }
1038
abarth6fc8ff02016-07-15 15:15:15 -07001039 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001040 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001041 }
mtkleinc04ff472016-06-23 10:29:30 -07001042}
1043
Kevin Lubickcbcff382018-10-02 09:02:18 -04001044static_library("pathkit") {
1045 public_configs = [ ":skia_public" ]
1046 configs += skia_library_configs
1047
1048 deps = [
1049 ":arm64",
1050 ":armv7",
1051 ":avx",
1052 ":crc32",
1053 ":hsw",
1054 ":none",
1055 ":sse2",
1056 ":sse41",
1057 ":sse42",
1058 ":ssse3",
1059 ]
1060
1061 # This file (and all GN files in Skia) are designed to work with an
1062 # empty sources assignment filter; we handle all that explicitly.
1063 # We clear the filter here for clients who may have set up a global filter.
1064 set_sources_assignment_filter([])
1065
1066 sources = []
1067 sources += skia_pathops_sources
1068 sources += [
1069 "src/core/SkAnalyticEdge.cpp",
1070 "src/core/SkArenaAlloc.cpp",
1071 "src/core/SkCubicMap.cpp",
1072 "src/core/SkEdge.cpp",
1073 "src/core/SkEdgeBuilder.cpp",
1074 "src/core/SkEdgeClipper.cpp",
1075 "src/core/SkGeometry.cpp",
1076 "src/core/SkLineClipper.cpp",
1077 "src/core/SkMallocPixelRef.cpp",
1078 "src/core/SkMath.cpp",
1079 "src/core/SkMatrix.cpp",
1080 "src/core/SkOpts.cpp",
1081 "src/core/SkPaint.cpp",
1082 "src/core/SkPath.cpp",
1083 "src/core/SkPathEffect.cpp",
1084 "src/core/SkPathMeasure.cpp",
1085 "src/core/SkPathRef.cpp",
1086 "src/core/SkPoint.cpp",
1087 "src/core/SkRRect.cpp",
1088 "src/core/SkRect.cpp",
1089 "src/core/SkSemaphore.cpp",
1090 "src/core/SkStream.cpp",
1091 "src/core/SkString.cpp",
1092 "src/core/SkStringUtils.cpp",
1093 "src/core/SkStroke.cpp",
1094 "src/core/SkStrokeRec.cpp",
1095 "src/core/SkStrokerPriv.cpp",
1096 "src/core/SkThreadID.cpp",
1097 "src/core/SkUtils.cpp",
1098 "src/effects/SkDashPathEffect.cpp",
1099 "src/effects/SkTrimPathEffect.cpp",
1100 "src/ports/SkDebug_stdio.cpp",
1101 "src/ports/SkMemory_malloc.cpp",
1102 "src/utils/SkDashPath.cpp",
1103 "src/utils/SkParse.cpp",
1104 "src/utils/SkParsePath.cpp",
1105 "src/utils/SkUTF.cpp",
1106 ]
1107}
1108
mtkleinc095df52016-08-24 12:23:52 -07001109# Targets guarded by skia_enable_tools may use //third_party freely.
1110if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001111 # Used by gn_to_bp.py to list our public include dirs.
1112 source_set("public") {
1113 configs += [ ":skia_public" ]
1114 }
1115
Mike Kleinc36dedf2016-11-18 09:35:28 -05001116 config("skia.h_config") {
1117 include_dirs = [ "$target_gen_dir" ]
1118 }
1119 action("skia.h") {
1120 public_configs = [ ":skia.h_config" ]
1121 skia_h = "$target_gen_dir/skia.h"
1122 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001123
1124 # TODO: would be cool to not hard-code these here, but how?
1125 module_public_includes = [
1126 "modules/sksg/include",
1127 "modules/skottie/include",
1128 ]
1129 args =
1130 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1131 [ rebase_path(skia_h, root_build_dir) ] +
1132 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001133 depfile = "$skia_h.deps"
1134 outputs = [
1135 skia_h,
1136 ]
1137 }
1138
Brian Osmanc9a42472018-05-31 13:17:12 -04001139 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001140 executable("fiddle") {
1141 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001142 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001143 "tools/fiddle/draw.cpp",
1144 "tools/fiddle/fiddle_main.cpp",
1145 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001146
1147 if (skia_use_egl) {
1148 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001149 } else {
1150 sources += [ "tools/fiddle/null_context.cpp" ]
1151 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001152 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001153 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001154 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001155 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001156 ":skia",
1157 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001158 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001159 ]
1160 }
1161 }
1162
Brian Osmanc9a42472018-05-31 13:17:12 -04001163 source_set("public_headers_warnings_check") {
1164 sources = [
1165 "tools/public_headers_warnings_check.cpp",
1166 ]
1167 configs -= [ "//gn:warnings_except_public_headers" ]
1168 deps = [
1169 ":skia",
1170 ":skia.h",
1171 "modules/skottie",
1172 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001173 }
1174
mtkleinc095df52016-08-24 12:23:52 -07001175 template("test_lib") {
1176 config(target_name + "_config") {
1177 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001178 if (defined(invoker.public_defines)) {
1179 defines = invoker.public_defines
1180 }
mtklein25c81d42016-07-27 13:55:26 -07001181 }
mtkleinc095df52016-08-24 12:23:52 -07001182 source_set(target_name) {
1183 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1184 public_configs = [
1185 ":" + target_name + "_config",
1186 ":skia_private",
1187 ]
1188
1189 if (!defined(deps)) {
1190 deps = []
1191 }
1192 deps += [ ":skia" ]
1193 testonly = true
1194 }
mtklein25c81d42016-07-27 13:55:26 -07001195 }
mtklein25c81d42016-07-27 13:55:26 -07001196
Mike Kleine6682eb2017-01-05 10:54:57 -05001197 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001198 if (is_ios) {
1199 app_name = target_name
1200 gen_path = target_gen_dir
1201
1202 action("${app_name}_generate_info_plist") {
1203 script = "//gn/gen_plist_ios.py"
1204 outputs = [
1205 "$gen_path/${app_name}_Info.plist",
1206 ]
1207 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1208 }
1209
1210 bundle_data("${app_name}_bundle_info_plist") {
1211 public_deps = [
1212 ":${app_name}_generate_info_plist",
1213 ]
1214 sources = [
1215 "$gen_path/${app_name}_Info.plist",
1216 ]
1217 outputs = [
1218 "{{bundle_root_dir}}/Info.plist",
1219 ]
1220 }
1221
Jim Van Verth329c5a62017-11-29 11:42:33 -05001222 bundle_ios_data =
1223 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1224
1225 if (bundle_ios_data) {
1226 has_skps =
1227 "True" == exec_script("//gn/checkdir.py",
1228 [ rebase_path("skps", root_build_dir) ],
1229 "trim string")
1230 bundle_data("${app_name}_bundle_resources") {
1231 sources = [
1232 "resources",
1233 ]
1234 outputs = [
1235 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1236 "{{bundle_resources_dir}}/data/resources",
1237 ]
1238 }
1239
1240 if (has_skps) {
1241 bundle_data("${app_name}_bundle_skps") {
1242 sources = [
1243 "skps",
1244 ]
1245 outputs = [
1246 # Store in same folder as resources
1247 "{{bundle_resources_dir}}/data/skps",
1248 ]
1249 }
1250 }
1251 }
1252
Jim Van Verth443a9132017-11-28 09:45:26 -05001253 executable("${app_name}_generate_executable") {
1254 forward_variables_from(invoker,
1255 "*",
1256 [
1257 "output_name",
1258 "visibility",
1259 "is_shared_library",
1260 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001261 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001262 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001263 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1264 }
1265
1266 bundle_data("${app_name}_bundle_executable") {
1267 public_deps = [
1268 ":${app_name}_generate_executable",
1269 ]
1270 sources = [
1271 "$gen_path/$app_name",
1272 ]
1273 outputs = [
1274 "{{bundle_executable_dir}}/$app_name",
1275 ]
1276 testonly = true
1277 }
1278
1279 create_bundle("$app_name") {
1280 product_type = "com.apple.product-type.application"
1281 testonly = true
1282
1283 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1284 bundle_resources_dir = bundle_root_dir
1285 bundle_executable_dir = bundle_root_dir
1286 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1287
1288 deps = [
1289 ":${app_name}_bundle_executable",
1290 ":${app_name}_bundle_info_plist",
1291 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001292 if (bundle_ios_data) {
1293 deps += [ ":${app_name}_bundle_resources" ]
1294 if (has_skps) {
1295 deps += [ ":${app_name}_bundle_skps" ]
1296 }
1297 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001298
1299 # should only code sign when running on a device, not the simulator
1300 if (target_cpu != "x64") {
1301 code_signing_script = "//gn/codesign_ios.py"
1302 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1303 code_signing_outputs = [
1304 "$bundle_root_dir/_CodeSignature/CodeResources",
1305 "$bundle_root_dir/embedded.mobileprovision",
1306 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001307 code_signing_args = [
1308 rebase_path("$bundle_root_dir", root_build_dir),
1309 skia_ios_identity,
1310 skia_ios_profile,
1311 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001312 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001313 }
1314 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001315 # !is_ios
1316
1317 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1318 shared_library("lib" + target_name) {
1319 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1320 configs += [ ":skia_private" ]
1321 testonly = true
1322 }
1323 } else {
1324 _executable = target_name
1325 executable(_executable) {
1326 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1327 configs += [ ":skia_private" ]
1328 testonly = true
1329 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001330 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001331 if (is_android && skia_android_serial != "" && defined(_executable)) {
1332 action("push_" + target_name) {
1333 script = "gn/push_to_android.py"
1334 deps = [
1335 ":" + _executable,
1336 ]
1337 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1338 outputs = [
1339 _stamp,
1340 ]
1341 args = [
1342 rebase_path("$root_build_dir/$_executable"),
1343 skia_android_serial,
1344 rebase_path(_stamp),
1345 ]
1346 testonly = true
1347 }
Mike Klein7d921032017-01-05 12:20:41 -05001348 }
1349 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001350 }
1351
Greg Danielda16cce2018-08-01 09:23:57 -04001352 config("moltenvk_config") {
1353 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1354 if (is_ios) {
1355 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1356 } else {
1357 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1358 }
1359 cflags = [ "-F$moltenvk_framework_path" ]
1360 ldflags = [ "-F$moltenvk_framework_path" ]
1361 libs = [
1362 "MoltenVK.framework",
1363 "Metal.framework",
1364 "IOSurface.framework",
1365 "QuartzCore.framework",
1366 "Foundation.framework",
1367 ]
1368 if (is_ios) {
1369 libs += [ "UIKit.framework" ]
1370 } else {
1371 libs += [ "IOKit.framework" ]
1372 }
1373 defines = [ "SK_MOLTENVK" ]
1374 }
1375 }
1376
1377 source_set("moltenvk") {
1378 public_configs = [ ":moltenvk_config" ]
1379 }
1380
mtkleinc095df52016-08-24 12:23:52 -07001381 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001382 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001383 public_defines = []
1384 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001385
Brian Osmanc9a42472018-05-31 13:17:12 -04001386 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001387 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001388 sources = [
1389 "tools/gpu/GrContextFactory.cpp",
1390 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001391 "tools/gpu/MemoryCache.cpp",
1392 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001393 "tools/gpu/ProxyUtils.cpp",
1394 "tools/gpu/TestContext.cpp",
1395 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1396 "tools/gpu/gl/GLTestContext.cpp",
1397 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001398 "tools/gpu/gl/null/NullGLTestContext.cpp",
1399 "tools/gpu/mock/MockTestContext.cpp",
1400 ]
1401 libs = []
1402
1403 if (is_android || skia_use_egl) {
1404 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1405 } else if (is_ios) {
1406 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1407 libs += [ "OpenGLES.framework" ]
1408 } else if (is_linux) {
1409 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001410 libs += [
1411 "GLU",
1412 "X11",
1413 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001414 } else if (is_mac) {
1415 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1416 } else if (is_win) {
1417 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1418 libs += [
1419 "Gdi32.lib",
1420 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001421 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001422 }
mtklein25c81d42016-07-27 13:55:26 -07001423
Brian Osmanc9a42472018-05-31 13:17:12 -04001424 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001425
Brian Osmanc9a42472018-05-31 13:17:12 -04001426 if (skia_use_angle) {
1427 deps += [ "//third_party/angle2" ]
1428 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1429 }
Greg Danielb4d89562018-10-03 18:44:49 +00001430 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001431 if (skia_use_vulkan) {
1432 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1433 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001434 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1435 public_deps += [ ":moltenvk" ]
1436 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001437 }
1438 if (skia_use_metal) {
1439 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001440 }
mtklein25c81d42016-07-27 13:55:26 -07001441 }
mtklein25c81d42016-07-27 13:55:26 -07001442
mtkleinc095df52016-08-24 12:23:52 -07001443 test_lib("flags") {
1444 public_include_dirs = [ "tools/flags" ]
1445 sources = [
1446 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001447 ]
1448 }
1449 test_lib("common_flags") {
1450 public_include_dirs = [ "tools/flags" ]
1451 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001452 "tools/flags/SkCommonFlags.cpp",
1453 "tools/flags/SkCommonFlagsConfig.cpp",
1454 ]
1455 deps = [
mtklein046cb562016-09-16 10:23:12 -07001456 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001457 ]
1458 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001459 ":gpu_tool_utils",
1460 ]
1461 }
mtklein25c81d42016-07-27 13:55:26 -07001462
mtkleinc095df52016-08-24 12:23:52 -07001463 test_lib("tool_utils") {
1464 public_include_dirs = [
1465 "tools",
1466 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001467 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001468 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001469 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001470 ]
1471 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001472 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001473 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001474 "tools/DDLPromiseImageHelper.cpp",
1475 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001476 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001477 "tools/ProcStats.cpp",
1478 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001479 "tools/UrlDataManager.cpp",
1480 "tools/debugger/SkDebugCanvas.cpp",
1481 "tools/debugger/SkDrawCommand.cpp",
1482 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001483 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001484 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001485 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001486 "tools/fonts/SkTestFontMgr.h",
1487 "tools/fonts/SkTestSVGTypeface.cpp",
1488 "tools/fonts/SkTestSVGTypeface.h",
1489 "tools/fonts/SkTestTypeface.cpp",
1490 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001491 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001492 "tools/random_parse_path.cpp",
1493 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001494 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001495 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001496 "tools/trace/SkChromeTracingTracer.cpp",
1497 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001498 "tools/trace/SkDebugfTracer.cpp",
1499 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001500 "tools/trace/SkEventTracingPriv.cpp",
1501 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001502 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001503 libs = []
1504 if (is_ios) {
1505 sources += [ "tools/ios_utils.m" ]
1506 libs += [ "Foundation.framework" ]
1507 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001508 defines = []
1509 if (skia_tools_require_resources) {
1510 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1511 }
mtkleinc095df52016-08-24 12:23:52 -07001512 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001513 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001514 ":flags",
1515 "//third_party/libpng",
1516 ]
1517 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001518 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001519 "//third_party/jsoncpp",
1520 ]
1521 }
mtklein25c81d42016-07-27 13:55:26 -07001522
Mike Klein6e744122016-10-27 12:21:40 -04001523 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001524 test_lib("gm") {
1525 public_include_dirs = [ "gm" ]
1526 sources = gm_sources
1527 deps = [
scroggo19b91532016-10-24 09:03:26 -07001528 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001529 ":skia",
1530 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001531 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001532 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001533 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001534 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001535 public_deps = [
1536 ":gpu_tool_utils",
1537 ]
mtkleinc095df52016-08-24 12:23:52 -07001538 }
mtklein25c81d42016-07-27 13:55:26 -07001539
Mike Klein6e744122016-10-27 12:21:40 -04001540 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001541 test_lib("tests") {
1542 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001543 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001544 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001545 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001546 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001547 if (!(skia_use_freetype && skia_use_fontconfig)) {
1548 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1549 }
mtkleinc095df52016-08-24 12:23:52 -07001550 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001551 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001552 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001553 ":skia",
1554 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001555 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001556 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001557 "//third_party/libpng",
1558 "//third_party/zlib",
1559 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001560 public_deps = [
1561 ":gpu_tool_utils", # Test.h #includes headers from this target.
1562 ]
mtkleinc095df52016-08-24 12:23:52 -07001563 }
mtklein2f3416d2016-08-02 16:02:05 -07001564
Mike Klein6e744122016-10-27 12:21:40 -04001565 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001566 test_lib("bench") {
1567 public_include_dirs = [ "bench" ]
1568 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001569 deps = [
1570 ":flags",
1571 ":gm",
1572 ":gpu_tool_utils",
1573 ":skia",
1574 ":tool_utils",
1575 ]
1576 }
mtklein2b6870c2016-07-28 14:17:33 -07001577
mtkleinc095df52016-08-24 12:23:52 -07001578 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001579 public_include_dirs = []
1580 if (skia_use_expat) {
1581 public_include_dirs += [ "experimental/svg/model" ]
1582 sources = [
1583 "experimental/svg/model/SkSVGAttribute.cpp",
1584 "experimental/svg/model/SkSVGAttributeParser.cpp",
1585 "experimental/svg/model/SkSVGCircle.cpp",
1586 "experimental/svg/model/SkSVGClipPath.cpp",
1587 "experimental/svg/model/SkSVGContainer.cpp",
1588 "experimental/svg/model/SkSVGDOM.cpp",
1589 "experimental/svg/model/SkSVGEllipse.cpp",
1590 "experimental/svg/model/SkSVGGradient.cpp",
1591 "experimental/svg/model/SkSVGLine.cpp",
1592 "experimental/svg/model/SkSVGLinearGradient.cpp",
1593 "experimental/svg/model/SkSVGNode.cpp",
1594 "experimental/svg/model/SkSVGPath.cpp",
1595 "experimental/svg/model/SkSVGPattern.cpp",
1596 "experimental/svg/model/SkSVGPoly.cpp",
1597 "experimental/svg/model/SkSVGRadialGradient.cpp",
1598 "experimental/svg/model/SkSVGRect.cpp",
1599 "experimental/svg/model/SkSVGRenderContext.cpp",
1600 "experimental/svg/model/SkSVGSVG.cpp",
1601 "experimental/svg/model/SkSVGShape.cpp",
1602 "experimental/svg/model/SkSVGStop.cpp",
1603 "experimental/svg/model/SkSVGTransformableNode.cpp",
1604 "experimental/svg/model/SkSVGUse.cpp",
1605 "experimental/svg/model/SkSVGValue.cpp",
1606 ]
1607 deps = [
1608 ":skia",
1609 ":xml",
1610 ]
1611 }
mtkleinc095df52016-08-24 12:23:52 -07001612 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001613
Mike Klein38af9432016-11-11 11:39:44 -05001614 if (skia_use_lua) {
1615 test_lib("lua") {
1616 public_include_dirs = []
1617 sources = [
1618 "src/utils/SkLua.cpp",
1619 "src/utils/SkLuaCanvas.cpp",
1620 ]
1621 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001622 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001623 "//third_party/lua",
1624 ]
1625 }
1626
Mike Kleine6682eb2017-01-05 10:54:57 -05001627 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001628 sources = [
1629 "tools/lua/lua_app.cpp",
1630 ]
1631 deps = [
1632 ":lua",
1633 ":skia",
1634 "//third_party/lua",
1635 ]
Mike Klein38af9432016-11-11 11:39:44 -05001636 }
1637
Mike Kleine6682eb2017-01-05 10:54:57 -05001638 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001639 sources = [
1640 "tools/lua/lua_pictures.cpp",
1641 ]
1642 deps = [
1643 ":flags",
1644 ":lua",
1645 ":skia",
1646 ":tool_utils",
1647 "//third_party/lua",
1648 ]
Mike Klein38af9432016-11-11 11:39:44 -05001649 }
1650 }
1651
Cary Clark8032b982017-07-28 11:04:54 -04001652 test_app("bookmaker") {
1653 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001654 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001655 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001656 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001657 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001658 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001659 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001660 "tools/bookmaker/includeParser.cpp",
1661 "tools/bookmaker/includeWriter.cpp",
1662 "tools/bookmaker/mdOut.cpp",
1663 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001664 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001665 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001666 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001667 ]
1668 deps = [
1669 ":flags",
1670 ":skia",
1671 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001672 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001673 ]
1674 }
1675
Florin Malitabfe876a2018-09-02 12:33:59 -04001676 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001677 test_app("skottie_tool") {
1678 deps = [
1679 "modules/skottie:tool",
1680 ]
1681 }
1682 }
1683
Kevin Lubickebf648e2017-09-21 13:45:16 -04001684 if (target_cpu != "wasm") {
1685 import("gn/samples.gni")
1686 test_lib("samples") {
1687 public_include_dirs = [ "samplecode" ]
1688 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001689 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001690 public_deps = [
1691 ":tool_utils",
1692 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001693 deps = [
1694 ":experimental_svg_model",
1695 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001696 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001697 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001698 ]
Mike Klein38af9432016-11-11 11:39:44 -05001699
Ruiqi Maof5101492018-06-29 14:32:21 -04001700 # NIMA does not build on Windows clang
1701 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001702 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001703 deps += [ "//third_party/Nima-Cpp" ]
1704 }
1705
Kevin Lubickebf648e2017-09-21 13:45:16 -04001706 if (skia_use_lua) {
1707 sources += [ "samplecode/SampleLua.cpp" ]
1708 deps += [
1709 ":lua",
1710 "//third_party/lua",
1711 ]
1712 }
1713 }
Mike Klein7af351a2018-07-27 09:54:43 -04001714 test_app("imgcvt") {
1715 sources = [
1716 "tools/imgcvt.cpp",
1717 ]
1718 deps = [
1719 ":skcms",
1720 ":skia",
1721 ]
1722 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001723 test_app("dm") {
1724 sources = [
1725 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001726 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001727 "dm/DMJsonWriter.cpp",
1728 "dm/DMSrcSink.cpp",
1729 ]
1730 include_dirs = [ "tests" ]
1731 deps = [
1732 ":common_flags",
1733 ":experimental_svg_model",
1734 ":flags",
1735 ":gm",
1736 ":gpu_tool_utils",
1737 ":skia",
1738 ":tests",
1739 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001740 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001741 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001742 "//third_party/jsoncpp",
1743 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001744 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001745
1746 # NIMA does not build on Windows clang
1747 if (!is_win || !is_clang) {
1748 deps += [ "//third_party/Nima-Cpp" ]
1749 }
Mike Klein38af9432016-11-11 11:39:44 -05001750 }
Brian Osman16adfa32016-10-18 14:42:44 -04001751 }
1752
Mike Kleina8a51ce2018-01-09 12:34:11 -05001753 if (!is_win) {
1754 test_app("remote_demo") {
1755 sources = [
1756 "tools/remote_demo.cpp",
1757 ]
1758 deps = [
1759 ":skia",
1760 ]
1761 }
1762 }
1763
Mike Kleine6682eb2017-01-05 10:54:57 -05001764 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001765 sources = [
1766 "bench/nanobench.cpp",
1767 ]
1768 deps = [
1769 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001770 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001771 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001772 ":flags",
1773 ":gm",
1774 ":gpu_tool_utils",
1775 ":skia",
1776 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001777 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001778 "//third_party/jsoncpp",
1779 ]
mtklein2b6870c2016-07-28 14:17:33 -07001780 }
halcanary19a97202016-08-03 15:08:04 -07001781
Ravi Mistry10d36c52017-01-31 09:49:18 -05001782 test_app("skpinfo") {
1783 sources = [
1784 "tools/skpinfo.cpp",
1785 ]
1786 deps = [
1787 ":flags",
1788 ":skia",
1789 ]
1790 }
1791
Brian Osmanc9a42472018-05-31 13:17:12 -04001792 test_app("skpbench") {
1793 sources = [
1794 "tools/skpbench/skpbench.cpp",
1795 ]
1796 deps = [
1797 ":flags",
1798 ":gpu_tool_utils",
1799 ":skia",
1800 ":tool_utils",
1801 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001802 }
1803
Mike Kleine6682eb2017-01-05 10:54:57 -05001804 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001805 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001806 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001807 ]
1808 deps = [
1809 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001810 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001811 ]
halcanary3eee9d92016-09-10 07:01:53 -07001812 }
mtklein046cb562016-09-16 10:23:12 -07001813
Ben Wagner219f3622017-07-17 15:32:25 -04001814 test_app("create_test_font") {
1815 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001816 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001817 ]
1818 deps = [
1819 ":skia",
1820 ]
1821 assert_no_deps = [
1822 # tool_utils requires the output of this app.
1823 ":tool_utils",
1824 ]
1825 }
1826
Florin Malita5d3ff432018-07-31 16:38:43 -04001827 if (skia_use_expat) {
1828 test_app("create_test_font_color") {
1829 sources = [
1830 "tools/fonts/create_test_font_color.cpp",
1831 ]
1832 deps = [
1833 ":flags",
1834 ":skia",
1835 ":tool_utils",
1836 ]
1837 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001838 }
1839
Mike Kleine6682eb2017-01-05 10:54:57 -05001840 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001841 sources = [
1842 "tools/get_images_from_skps.cpp",
1843 ]
1844 deps = [
1845 ":flags",
1846 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001847 ]
mtklein046cb562016-09-16 10:23:12 -07001848 }
mtkleinecbc5262016-09-22 11:51:24 -07001849
Kevin Lubickebf648e2017-09-21 13:45:16 -04001850 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001851 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001852 sources = [
1853 "tools/skiaserve/Request.cpp",
1854 "tools/skiaserve/Response.cpp",
1855 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001856 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1857 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1858 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1859 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1860 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1861 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1862 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1863 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1864 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001865 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1866 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001867 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1868 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1869 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1870 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1871 ]
1872 deps = [
1873 ":flags",
1874 ":gpu_tool_utils",
1875 ":skia",
1876 ":tool_utils",
1877 "//third_party/jsoncpp",
1878 "//third_party/libmicrohttpd",
1879 "//third_party/libpng",
1880 ]
Mike Klein7d302882016-11-03 14:06:31 -04001881 }
mtkleinecbc5262016-09-22 11:51:24 -07001882 }
kjlubick14f984b2016-10-03 11:49:45 -07001883
Mike Kleine6682eb2017-01-05 10:54:57 -05001884 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001885 include_dirs = [
1886 "tools",
1887 "tools/debugger",
1888 ]
kjlubick14f984b2016-10-03 11:49:45 -07001889 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001890 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001891 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001892 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001893 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001894 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001895 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001896 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001897 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001898 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001899 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001900 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001901 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001902 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001903 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1904 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001905 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001906 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001907 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001908 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001909 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1910 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001911 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001912 "tools/UrlDataManager.cpp",
1913 "tools/debugger/SkDebugCanvas.cpp",
1914 "tools/debugger/SkDrawCommand.cpp",
1915 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001916 ]
1917 deps = [
1918 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001919 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001920 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001921 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001922 "//third_party/jsoncpp",
1923 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001924 ]
kjlubick14f984b2016-10-03 11:49:45 -07001925 }
Mike Klein38312422016-10-05 15:41:01 -04001926
Mike Kleine6682eb2017-01-05 10:54:57 -05001927 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001928 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001929 rebase_path("tests/skia_test.cpp"),
1930 rebase_path("tests/Test.cpp"),
1931 ]
caryclark9feb6322016-10-25 08:58:26 -07001932 deps = [
1933 ":flags",
1934 ":gpu_tool_utils",
1935 ":skia",
1936 ":tool_utils",
1937 ]
caryclark9feb6322016-10-25 08:58:26 -07001938 }
1939
Mike Kleine6682eb2017-01-05 10:54:57 -05001940 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001941 sources = [
1942 "tools/DumpRecord.cpp",
1943 "tools/dump_record.cpp",
1944 ]
1945 deps = [
1946 ":flags",
1947 ":skia",
1948 ]
Mike Klein38312422016-10-05 15:41:01 -04001949 }
bungemanfe917272016-10-13 17:36:40 -04001950
Mike Kleine6682eb2017-01-05 10:54:57 -05001951 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001952 sources = [
1953 "tools/skdiff/skdiff.cpp",
1954 "tools/skdiff/skdiff_html.cpp",
1955 "tools/skdiff/skdiff_main.cpp",
1956 "tools/skdiff/skdiff_utils.cpp",
1957 ]
1958 deps = [
1959 ":skia",
1960 ":tool_utils",
1961 ]
bungemanfe917272016-10-13 17:36:40 -04001962 }
halcanarya73d76a2016-10-17 13:19:02 -07001963
Mike Kleine6682eb2017-01-05 10:54:57 -05001964 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001965 sources = [
1966 "tools/skp_parser.cpp",
1967 ]
1968 deps = [
1969 ":skia",
1970 ":tool_utils",
1971 "//third_party/jsoncpp",
1972 ]
halcanarya73d76a2016-10-17 13:19:02 -07001973 }
Brian Osman16adfa32016-10-18 14:42:44 -04001974
Brian Osmanc9a42472018-05-31 13:17:12 -04001975 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001976 test_lib("skqp_lib") {
1977 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001978 defines =
1979 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001980 if (skia_skqp_enable_driver_correctness_workarounds) {
1981 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1982 }
Hal Canary75427132017-10-11 16:00:31 -04001983 sources = [
1984 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001985 "tools/skqp/gm_knowledge.cpp",
1986 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001987 ]
1988 deps = [
1989 ":gm",
1990 ":gpu_tool_utils",
1991 ":skia",
1992 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001993 ":tool_utils",
1994 ]
1995 }
1996 test_app("skqp") {
1997 sources = [
1998 "tools/skqp/skqp.cpp",
1999 ]
2000 deps = [
2001 ":skia",
2002 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002003 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04002004 "//third_party/googletest",
2005 ]
2006 }
2007 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002008 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002009 test_app("skqp_app") {
2010 is_shared_library = true
2011 sources = [
2012 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
2013 ]
2014 deps = [
2015 ":skia",
2016 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002017 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002018 ]
2019 libs = [ "android" ]
2020 }
2021 }
Stan Iliev93151722018-08-02 11:10:52 -04002022 if (is_android && skia_enable_gpu) {
2023 test_app("skottie_android") {
2024 is_shared_library = true
2025
2026 sources = [
2027 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2028 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2029 ]
2030 libs = []
2031
2032 include_dirs = []
2033 deps = [
2034 ":skia",
2035 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002036 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002037 ]
2038 }
2039 }
Hal Canary75427132017-10-11 16:00:31 -04002040
Hal Canarya9de7602018-01-19 13:08:23 -05002041 test_app("list_gms") {
2042 sources = [
2043 "tools/list_gms.cpp",
2044 ]
2045 deps = [
2046 ":gm",
2047 ":skia",
2048 ]
2049 }
2050 test_app("list_gpu_unit_tests") {
2051 sources = [
2052 "dm/DMGpuTestProcs.cpp",
2053 "tools/list_gpu_unit_tests.cpp",
2054 ]
2055 deps = [
2056 ":skia",
2057 ":tests",
2058 ]
2059 }
2060
Brian Osmanc9a42472018-05-31 13:17:12 -04002061 test_lib("sk_app") {
2062 public_include_dirs = [ "tools/sk_app" ]
2063 sources = [
2064 "tools/sk_app/CommandSet.cpp",
2065 "tools/sk_app/GLWindowContext.cpp",
2066 "tools/sk_app/Window.cpp",
2067 ]
2068 libs = []
2069
2070 if (is_android) {
2071 sources += [
2072 "tools/sk_app/android/GLWindowContext_android.cpp",
2073 "tools/sk_app/android/RasterWindowContext_android.cpp",
2074 "tools/sk_app/android/Window_android.cpp",
2075 "tools/sk_app/android/main_android.cpp",
2076 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002077 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002078 libs += [ "android" ]
2079 } else if (is_linux) {
2080 sources += [
2081 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2082 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2083 "tools/sk_app/unix/Window_unix.cpp",
2084 "tools/sk_app/unix/keysym2ucs.c",
2085 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002086 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002087 libs += [
2088 "GL",
2089 "X11",
2090 ]
2091 } else if (is_win) {
2092 sources += [
2093 "tools/sk_app/win/GLWindowContext_win.cpp",
2094 "tools/sk_app/win/RasterWindowContext_win.cpp",
2095 "tools/sk_app/win/Window_win.cpp",
2096 "tools/sk_app/win/main_win.cpp",
2097 ]
Brian Salomon194db172017-08-17 14:37:06 -04002098 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002099 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002100 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002101 } else if (is_mac) {
2102 sources += [
2103 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2104 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2105 "tools/sk_app/mac/Window_mac.cpp",
2106 "tools/sk_app/mac/main_mac.cpp",
2107 ]
2108 libs += [
2109 "QuartzCore.framework",
2110 "Cocoa.framework",
2111 "Foundation.framework",
2112 ]
2113 } else if (is_ios) {
2114 sources += [
2115 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2116 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2117 "tools/sk_app/ios/Window_ios.cpp",
2118 "tools/sk_app/ios/main_ios.cpp",
2119 ]
2120 }
2121
2122 if (skia_use_vulkan) {
2123 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2124 if (is_android) {
2125 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2126 } else if (is_linux) {
2127 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2128 libs += [ "X11-xcb" ]
2129 } else if (is_win) {
2130 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2131 }
2132 }
2133
2134 deps = [
2135 ":gpu_tool_utils",
2136 ":skia",
2137 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002138 ]
2139 if (is_android) {
2140 deps += [ "//third_party/native_app_glue" ]
2141 } else if (is_mac || is_ios) {
2142 deps += [ "//third_party/libsdl" ]
2143 }
2144 if (skia_use_angle) {
2145 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002146 }
Brian Osman16adfa32016-10-18 14:42:44 -04002147 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002148
Brian Osmanc9a42472018-05-31 13:17:12 -04002149 test_app("viewer") {
2150 is_shared_library = is_android
2151 if (is_ios) {
2152 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002153 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002154 sources = [
2155 "tools/viewer/BisectSlide.cpp",
2156 "tools/viewer/GMSlide.cpp",
2157 "tools/viewer/ImGuiLayer.cpp",
2158 "tools/viewer/ImageSlide.cpp",
2159 "tools/viewer/SKPSlide.cpp",
2160 "tools/viewer/SampleSlide.cpp",
2161 "tools/viewer/SkottieSlide.cpp",
2162 "tools/viewer/SlideDir.cpp",
2163 "tools/viewer/StatsLayer.cpp",
2164 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002165 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002166 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002167 "tools/viewer/Viewer.cpp",
2168 ]
2169 libs = []
2170
Kevin Lubickd9699322018-10-30 15:08:53 -04002171 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002172 deps = [
2173 ":experimental_svg_model",
2174 ":flags",
2175 ":gm",
2176 ":gpu_tool_utils",
2177 ":samples",
2178 ":sk_app",
2179 ":skia",
2180 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002181 "modules/skottie",
2182 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002183 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002184 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002185 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002186
2187 # NIMA does not build on Windows clang
2188 if (!is_win || !is_clang) {
2189 sources += [ "tools/viewer/NIMASlide.cpp" ]
2190 deps += [ "//third_party/Nima-Cpp" ]
2191 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002192 }
2193
ziadbbceddbc2018-06-19 13:57:15 -04002194 if (is_android) {
2195 test_app("arcore") {
2196 is_shared_library = true
2197 configs = [
2198 ":skia_public",
2199 "gn:default",
2200 ]
2201
2202 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2203 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2204 sources = []
2205 sources += skia_core_sources
2206 sources += skia_utils_sources
2207 sources += skia_xps_sources
2208 sources += [
2209 "src/android/SkAndroidFrameworkUtils.cpp",
2210 "src/android/SkAnimatedImage.cpp",
2211 "src/android/SkBitmapRegionCodec.cpp",
2212 "src/android/SkBitmapRegionDecoder.cpp",
2213 "src/codec/SkAndroidCodec.cpp",
2214 "src/codec/SkBmpBaseCodec.cpp",
2215 "src/codec/SkBmpCodec.cpp",
2216 "src/codec/SkBmpMaskCodec.cpp",
2217 "src/codec/SkBmpRLECodec.cpp",
2218 "src/codec/SkBmpStandardCodec.cpp",
2219 "src/codec/SkCodec.cpp",
2220 "src/codec/SkCodecImageGenerator.cpp",
2221 "src/codec/SkColorTable.cpp",
2222 "src/codec/SkGifCodec.cpp",
2223 "src/codec/SkMaskSwizzler.cpp",
2224 "src/codec/SkMasks.cpp",
2225 "src/codec/SkSampledCodec.cpp",
2226 "src/codec/SkSampler.cpp",
2227 "src/codec/SkStreamBuffer.cpp",
2228 "src/codec/SkSwizzler.cpp",
2229 "src/codec/SkWbmpCodec.cpp",
2230 "src/images/SkImageEncoder.cpp",
2231 "src/ports/SkDiscardableMemory_none.cpp",
2232 "src/ports/SkImageGenerator_skia.cpp",
2233 "src/ports/SkMemory_malloc.cpp",
2234 "src/ports/SkOSFile_stdio.cpp",
2235 "src/sfnt/SkOTTable_name.cpp",
2236 "src/sfnt/SkOTUtils.cpp",
2237 "src/utils/mac/SkStream_mac.cpp",
2238 "third_party/gif/SkGifImageReader.cpp",
2239 ]
2240 deps = [
2241 ":tool_utils",
2242 "modules/skottie",
2243 "modules/skshaper",
2244 ]
2245 }
2246 }
2247
Brian Osmanc9a42472018-05-31 13:17:12 -04002248 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002249 test_app("HelloWorld") {
2250 sources = [
2251 "example/HelloWorld.cpp",
2252 ]
2253 libs = []
2254
2255 include_dirs = []
2256 deps = [
2257 ":flags",
2258 ":gpu_tool_utils",
2259 ":sk_app",
2260 ":skia",
2261 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002262 ]
2263 }
2264 }
2265
Brian Osmanc9a42472018-05-31 13:17:12 -04002266 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002267 test_app("SkiaSDLExample") {
2268 sources = [
2269 "example/SkiaSDLExample.cpp",
2270 ]
2271 libs = []
2272 include_dirs = []
2273 deps = [
2274 ":gpu_tool_utils",
2275 ":skia",
2276 "//third_party/libsdl",
2277 ]
2278 }
2279 }
2280
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002281 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2282 action_foreach("generate_mocs") {
2283 script = "gn/call.py"
2284 sources = [
2285 "tools/mdbviz/MainWindow.h",
2286 ]
2287 outputs = [
2288 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2289 ]
2290 args = [
2291 "$skia_qt_path" + "/bin/moc",
2292 "{{source}}",
2293 "-o",
2294 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2295 ]
2296 }
2297 action_foreach("generate_resources") {
2298 script = "gn/call.py"
2299 sources = [
2300 "tools/mdbviz/resources.qrc",
2301 ]
2302 outputs = [
2303 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2304 ]
2305 args = [
2306 "$skia_qt_path" + "/bin/rcc",
2307 "{{source}}",
2308 "-o",
2309 "gen/mdbviz/{{source_name_part}}_res.cpp",
2310 ]
2311 }
2312 test_app("mdbviz") {
2313 if (is_win) {
2314 # on Windows we need to disable some exception handling warnings due to the Qt headers
2315 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2316 }
2317 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002318 "tools/UrlDataManager.cpp",
2319 "tools/debugger/SkDebugCanvas.cpp",
2320 "tools/debugger/SkDrawCommand.cpp",
2321 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002322 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002323 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002324 "tools/mdbviz/main.cpp",
2325
2326 # generated files
2327 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2328 "$target_gen_dir/mdbviz/resources_res.cpp",
2329 ]
2330 lib_dirs = [ "$skia_qt_path/lib" ]
2331 libs = [
2332 "Qt5Core.lib",
2333 "Qt5Gui.lib",
2334 "Qt5Widgets.lib",
2335 ]
2336 include_dirs = [
2337 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002338 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002339 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002340 "tools",
2341 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002342 ]
2343 deps = [
2344 ":generate_mocs",
2345 ":generate_resources",
2346 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002347 "//third_party/jsoncpp",
2348 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002349 ]
2350 }
2351 }
2352
Mike Kleine459afd2017-03-03 09:21:30 -05002353 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002354 copy("gdbserver") {
2355 sources = [
2356 "$ndk/$ndk_gdbserver",
2357 ]
2358 outputs = [
2359 "$root_out_dir/gdbserver",
2360 ]
2361 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002362 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002363
2364 if (skia_use_opencl) {
2365 test_app("hello-opencl") {
2366 sources = [
2367 "src/compute/common/cl/assert_cl.c",
2368 "src/compute/common/cl/find_cl.c",
2369 "tools/hello-opencl.cpp",
2370 ]
2371 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002372 if (is_linux) {
2373 libs = [ "OpenCL" ]
2374 } else if (is_win) {
2375 libs = [ "OpenCL.lib" ]
2376 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002377 }
2378 }
mtklein25c81d42016-07-27 13:55:26 -07002379}