blob: 3bbc95eb2fe77e51dd77e5d9304aa3c2db0fc3e1 [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 Kleina04bb452017-02-09 12:24:07 -050045 skia_enable_effects = true
Mike Reed0917fad2018-06-19 10:17:30 -040046 skia_enable_effects_imagefilters = true
Mike Klein42bb3602018-10-19 18:14:07 +000047 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
Kevin Lubickf4def342018-10-04 12:52:50 -0400133
134 # Flutter always wants this https://github.com/flutter/flutter/issues/11402
135 defines += [ "SK_ENABLE_DUMP_GPU" ]
Brian Osmanf2c90142017-07-13 15:50:03 -0400136 }
mtklein06c35c02016-09-20 12:28:12 -0700137 if (!skia_enable_gpu) {
138 defines += [ "SK_SUPPORT_GPU=0" ]
139 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500140 if (skia_enable_atlas_text) {
141 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
142 }
mtkleinc04ff472016-06-23 10:29:30 -0700143}
144
145# Skia internal APIs, used by Skia itself and a few test tools.
146config("skia_private") {
147 visibility = [ ":*" ]
148
149 include_dirs = [
150 "include/private",
151 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700152 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700153 "src/core",
154 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700155 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/image",
157 "src/images",
158 "src/lazy",
159 "src/opts",
160 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700161 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700162 "src/ports",
163 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400164 "src/shaders",
165 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700166 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700167 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700168 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500169 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700170 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700171 ]
mtklein150d1132016-08-01 06:56:40 -0700172
Mike Reeda9e241d2017-05-03 10:52:00 -0400173 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700174 if (is_android) {
175 defines += [
176 "SK_GAMMA_EXPONENT=1.4",
177 "SK_GAMMA_CONTRAST=0.0",
178 ]
179 }
mtklein88a7ac02016-09-14 11:16:49 -0700180 if (is_official_build || is_android) {
181 # TODO(bsalomon): it'd be nice to make Android normal.
182 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
183 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400184 libs = []
185 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500186 if (skia_enable_gpu) {
187 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500188 if (is_skia_dev_build && skia_use_vulkan) {
189 include_dirs += [ "tools/gpu/vk" ]
190 }
Brian Salomon03e05842017-02-23 12:23:47 -0500191 }
Brian Osman34755e22016-12-05 09:46:02 -0500192 if (skia_use_angle) {
193 defines += [ "SK_ANGLE" ]
194 }
Brian Osman3f375d02016-12-28 11:19:22 -0500195 if (skia_enable_discrete_gpu) {
196 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
197 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400198 if (!is_official_build) {
199 defines += [ "GR_TEST_UTILS=1" ]
200 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400201 if (skia_llvm_path != "") {
202 defines += [ "SK_LLVM_AVAILABLE" ]
203 include_dirs += [ "$skia_llvm_path/include" ]
204 libs += [ skia_llvm_lib ]
205 lib_dirs += [ "$skia_llvm_path/lib/" ]
206 }
mtkleinc04ff472016-06-23 10:29:30 -0700207}
208
209# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
210config("skia_library") {
211 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700212 defines = [ "SKIA_IMPLEMENTATION=1" ]
213}
214
215skia_library_configs = [
216 ":skia_public",
217 ":skia_private",
218 ":skia_library",
219]
220
mtklein9b8583d2016-08-24 17:32:30 -0700221# Use for CPU-specific Skia code that needs particular compiler flags.
222template("opts") {
223 if (invoker.enabled) {
224 source_set(target_name) {
225 forward_variables_from(invoker, "*")
226 configs += skia_library_configs
227 }
228 } else {
229 # If not enabled, a phony empty target that swallows all otherwise unused variables.
230 source_set(target_name) {
231 forward_variables_from(invoker,
232 "*",
233 [
234 "sources",
235 "cflags",
236 ])
237 }
238 }
anmittala7eaf2e2016-08-17 13:57:26 -0700239}
240
mtklein422310d2016-08-16 18:28:43 -0700241is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700242
mtklein7d6fb2c2016-08-25 14:50:44 -0700243opts("none") {
244 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700245 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700246 cflags = []
247}
248
mtklein7d6fb2c2016-08-25 14:50:44 -0700249opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700250 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700252 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700253}
254
255opts("arm64") {
256 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700258 cflags = []
259}
260
261opts("crc32") {
262 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700264 cflags = [ "-march=armv8-a+crc" ]
265}
266
mtklein9b8583d2016-08-24 17:32:30 -0700267opts("sse2") {
268 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400270 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400271 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
272 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400273 cflags = [ "-msse2" ]
274 }
mtklein9b8583d2016-08-24 17:32:30 -0700275}
mtkleinc04ff472016-06-23 10:29:30 -0700276
mtklein9b8583d2016-08-24 17:32:30 -0700277opts("ssse3") {
278 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700279 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400280 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400281 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
282 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400283 cflags = [ "-mssse3" ]
284 }
mtklein9b8583d2016-08-24 17:32:30 -0700285}
mtkleinc04ff472016-06-23 10:29:30 -0700286
mtklein9b8583d2016-08-24 17:32:30 -0700287opts("sse41") {
288 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700289 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400290 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400291 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
292 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400293 cflags = [ "-msse4.1" ]
294 }
mtklein9b8583d2016-08-24 17:32:30 -0700295}
mtklein4e976072016-08-08 09:06:27 -0700296
mtklein9b8583d2016-08-24 17:32:30 -0700297opts("sse42") {
298 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700299 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400300 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400301 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
302 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400303 cflags = [ "-msse4.2" ]
304 }
mtklein9b8583d2016-08-24 17:32:30 -0700305}
306
307opts("avx") {
308 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700309 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400310 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000311 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400312 } else {
313 cflags = [ "-mavx" ]
314 }
mtkleinc04ff472016-06-23 10:29:30 -0700315}
316
Mike Klein1b9b7d52018-02-27 10:37:40 -0500317opts("hsw") {
318 enabled = is_x86
319 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400320 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500321 cflags = [ "/arch:AVX2" ]
322 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000323 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500324 }
325
326 # Oddly, clang-cl doesn't recognize this as a valid flag.
327 # If it ever does, it'd nice to move this up with -mavx2 and co.
328 if (is_clang && !is_win) {
329 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
330 # but nice to have, generating slightly better code for paths without explicit FMAs.
331 cflags += [ "-ffp-contract=fast" ]
332 }
333}
334
mtkleinc095df52016-08-24 12:23:52 -0700335# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700336template("optional") {
337 if (invoker.enabled) {
338 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700339 if (defined(invoker.public_defines)) {
340 defines = invoker.public_defines
341 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600342 if (defined(invoker.public_configs)) {
343 configs = invoker.public_configs
344 }
mtklein457b42a2016-08-23 13:56:37 -0700345 }
346 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700347 forward_variables_from(invoker,
348 "*",
349 [
350 "public_defines",
351 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700352 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700353 ])
mtklein457b42a2016-08-23 13:56:37 -0700354 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700355 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700356 if (defined(invoker.configs_to_remove)) {
357 configs -= invoker.configs_to_remove
358 }
mtklein457b42a2016-08-23 13:56:37 -0700359 }
360 } else {
mtklein457b42a2016-08-23 13:56:37 -0700361 source_set(target_name) {
362 forward_variables_from(invoker,
363 "*",
364 [
365 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400366 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700367 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700368 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700369 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700370 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700371 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700372 ])
mtkleincd01b032016-08-31 04:58:19 -0700373 if (defined(invoker.sources_when_disabled)) {
374 sources = invoker.sources_when_disabled
375 }
376 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700377 }
mtkleineb3c4252016-08-23 07:38:09 -0700378 }
mtklein457b42a2016-08-23 13:56:37 -0700379}
mtklein457b42a2016-08-23 13:56:37 -0700380
Mike Kleina04bb452017-02-09 12:24:07 -0500381optional("effects") {
382 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400383 deps = [
384 ":compile_processors",
385 ]
Mike Klein2ba04792018-10-18 11:32:41 -0400386 sources = skia_effects_sources
Mike Reed0917fad2018-06-19 10:17:30 -0400387 if (skia_enable_effects_imagefilters) {
Mike Klein2ba04792018-10-18 11:32:41 -0400388 sources += skia_effects_imagefilter_sources_no_global_initialization
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400389 if (!skia_enable_skpicture) {
390 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
391 }
Mike Klein2ba04792018-10-18 11:32:41 -0400392 }
393}
394
395optional("effect_deserialization") {
396 enabled = skia_enable_effects && skia_enable_effect_deserialization
397
398 sources = [
399 "src/ports/SkGlobalInitialization_default.cpp",
400 ]
401 if (skia_enable_effects_imagefilters) {
402 sources += [ "src/ports/SkGlobalInitialization_default_imagefilters.cpp" ]
Mike Reed0917fad2018-06-19 10:17:30 -0400403 } else {
404 sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
405 }
Mike Klein2ba04792018-10-18 11:32:41 -0400406
Mike Reed0917fad2018-06-19 10:17:30 -0400407 sources_when_disabled = [
408 "src/ports/SkGlobalInitialization_none.cpp",
409 "src/ports/SkGlobalInitialization_none_imagefilters.cpp",
410 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500411}
412
mtkleina45be612016-08-29 15:22:10 -0700413optional("fontmgr_android") {
414 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700415
416 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500417 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700418 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700419 ]
420 sources = [
421 "src/ports/SkFontMgr_android.cpp",
422 "src/ports/SkFontMgr_android_factory.cpp",
423 "src/ports/SkFontMgr_android_parser.cpp",
424 ]
425}
426
mtkleind2e39db2016-09-07 07:52:55 -0700427optional("fontmgr_custom") {
Kevin Lubick217056c2018-09-20 17:39:31 -0400428 enabled = (is_linux || target_cpu == "wasm") && skia_use_freetype &&
429 !skia_use_fontconfig
mtkleind2e39db2016-09-07 07:52:55 -0700430
431 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500432 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700433 ]
434 sources = [
435 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500436 "src/ports/SkFontMgr_custom.h",
437 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700438 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500439 "src/ports/SkFontMgr_custom_embedded.cpp",
440 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700441 ]
442}
443
Hal Canaryff2742e2018-01-30 11:35:47 -0500444optional("fontmgr_empty") {
445 enabled = skia_enable_fontmgr_empty
446 sources = [
447 "src/ports/SkFontMgr_empty_factory.cpp",
448 ]
449}
450
mtklein3cc22182016-08-29 13:26:14 -0700451optional("fontmgr_fontconfig") {
452 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700453
454 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500455 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700456 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700457 ]
458 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700459 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700460 "src/ports/SkFontConfigInterface_direct.cpp",
461 "src/ports/SkFontConfigInterface_direct_factory.cpp",
462 "src/ports/SkFontMgr_FontConfigInterface.cpp",
463 "src/ports/SkFontMgr_fontconfig.cpp",
464 "src/ports/SkFontMgr_fontconfig_factory.cpp",
465 ]
466}
467
mtkleincdedd0e2016-09-12 15:15:44 -0700468optional("fontmgr_fuchsia") {
469 enabled = is_fuchsia && skia_use_freetype
470
471 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500472 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700473 ]
474 sources = [
475 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500476 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700477 "src/ports/SkFontMgr_custom_empty_factory.cpp",
478 ]
479}
480
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700481if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400482 executable("sksllex") {
483 sources = [
484 "src/sksl/lex/Main.cpp",
485 "src/sksl/lex/NFA.cpp",
486 "src/sksl/lex/RegexNode.cpp",
487 "src/sksl/lex/RegexParser.cpp",
488 ]
489 include_dirs = [ "src/sksl/lex" ]
490 }
491
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700492 action("run_sksllex") {
493 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400494 deps = [
495 ":sksllex(//gn/toolchain:$host_toolchain)",
496 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700497 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700498 "src/sksl/lex/sksl.lex",
499 ]
500
501 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
502 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
503 outputs = [
504 "$target_out_dir/" +
505 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
506 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
507 # confused due to the same file being named by two different paths
508 ]
509 sksllex_path = "$root_out_dir/"
510 sksllex_path += "sksllex"
511 if (host_os == "win") {
512 sksllex_path += ".exe"
513 }
514 args = [
515 rebase_path(sksllex_path),
516 rebase_path("bin/clang-format"),
517 rebase_path("src"),
518 ]
519 }
520} else {
521 group("run_sksllex") {
522 }
523}
524
525if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400526 executable("skslc") {
527 defines = [ "SKSL_STANDALONE" ]
528 sources = [
529 "src/sksl/SkSLMain.cpp",
530 ]
531 sources += skia_sksl_sources
532 include_dirs = [
533 "src/gpu",
534 "src/sksl",
535 ]
536 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500537 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400538 "//third_party/spirv-tools",
539 ]
540 }
541
542 skia_gpu_processor_outputs = []
543 foreach(src, skia_gpu_processor_sources) {
544 dir = get_path_info(src, "dir")
545 name = get_path_info(src, "name")
546
547 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
548 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
549 skia_gpu_processor_outputs += [
550 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
551 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
552 # confused due to the same file being named by two different paths
553 ]
554 }
555
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500556 action("create_sksl_enums") {
557 script = "gn/create_sksl_enums.py"
558 sources = [
559 "include/private/GrSharedEnums.h",
560 ]
561 outputs = [
562 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500563 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500564 ]
565 args = [
566 rebase_path(sources[0]),
567 rebase_path(outputs[0]),
568 ]
569 }
570
Ethan Nicholas762466e2017-06-29 10:03:38 -0400571 action("compile_processors") {
572 script = "gn/compile_processors.py"
573 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500574 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 ":skslc(//gn/toolchain:$host_toolchain)",
576 ]
577 sources = skia_gpu_processor_sources
578 outputs = skia_gpu_processor_outputs
579 skslc_path = "$root_out_dir/"
580 if (host_toolchain != default_toolchain_name) {
581 skslc_path += "$host_toolchain/"
582 }
583 skslc_path += "skslc"
584 if (host_os == "win") {
585 skslc_path += ".exe"
586 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400587 args = [
588 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400589 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400590 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400591 args += rebase_path(skia_gpu_processor_sources)
592 }
593} else {
594 skia_gpu_processor_outputs = []
595 group("compile_processors") {
596 }
597}
598
mtklein06c35c02016-09-20 12:28:12 -0700599optional("gpu") {
600 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400601 deps = [
602 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700603 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400604 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700605 if (skia_generate_workarounds) {
606 deps += [ ":workaround_list" ]
607 }
mtkleine9fb3d52016-09-20 15:11:46 -0700608 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600609 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400610 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700611
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400613 if (!skia_enable_ccpr) {
614 sources -= skia_ccpr_sources
615 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
616 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400617 if (!skia_enable_nvpr) {
618 sources -= skia_nvpr_sources
619 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
620 }
mtklein06c35c02016-09-20 12:28:12 -0700621
622 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500623 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700624 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400625 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700626 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400627 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400628
629 # this lib is required to link against AHardwareBuffer
630 if (defined(ndk_api) && ndk_api >= 26) {
631 libs += [ "android" ]
632 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400633 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500634 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400635 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700636 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500637 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400638 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700639 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500640 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800641 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500642 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400643 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500644 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400645 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700646 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500647 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700648 }
mtkleine9fb3d52016-09-20 15:11:46 -0700649
650 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400651 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400652 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700653 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700654 if (skia_enable_vulkan_debug_layers) {
655 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
656 }
mtkleine9fb3d52016-09-20 15:11:46 -0700657 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400658
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400659 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400660 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400661 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
662 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400663
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400664 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400665 if (skia_use_metal) {
666 public_defines += [ "SK_METAL" ]
667 sources += skia_metal_sources
668 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400669 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400670 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400671 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500672
673 if (skia_enable_atlas_text) {
674 sources += skia_atlas_text_sources
675 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400676
677 if (is_debug) {
678 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
679 }
mtklein06c35c02016-09-20 12:28:12 -0700680}
681
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400682optional("heif") {
683 enabled = skia_use_libheif
684 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
685
686 deps = []
687
688 sources = [
689 "src/codec/SkHeifCodec.cpp",
690 ]
691}
692
mtklein63213812016-08-24 09:55:56 -0700693optional("jpeg") {
694 enabled = skia_use_libjpeg_turbo
695 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
696
mtklein63213812016-08-24 09:55:56 -0700697 deps = [
698 "//third_party/libjpeg-turbo:libjpeg",
699 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400700 public = [
701 "include/encode/SkJpegEncoder.h",
702 ]
mtklein63213812016-08-24 09:55:56 -0700703 sources = [
704 "src/codec/SkJpegCodec.cpp",
705 "src/codec/SkJpegDecoderMgr.cpp",
706 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700707 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400708 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700709 ]
710}
711
712optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500713 enabled = skia_use_zlib && skia_enable_pdf
714 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700715
mtklein63213812016-08-24 09:55:56 -0700716 deps = [
717 "//third_party/zlib",
718 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400719 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700720 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400721 }
brettwb9447282016-09-01 14:24:39 -0700722 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700723 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700724
725 if (skia_use_sfntly) {
726 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500727 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700728 }
729}
730
731optional("png") {
732 enabled = skia_use_libpng
733 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
734
mtklein63213812016-08-24 09:55:56 -0700735 deps = [
736 "//third_party/libpng",
737 ]
738 sources = [
739 "src/codec/SkIcoCodec.cpp",
740 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400741 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700742 ]
743}
744
scroggof84ad642016-10-31 09:02:57 -0700745optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400746 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700747 public_defines = [ "SK_CODEC_DECODES_RAW" ]
748
749 deps = [
750 "//third_party/dng_sdk",
751 "//third_party/libjpeg-turbo:libjpeg",
752 "//third_party/piex",
753 ]
754
755 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
756 # Skia.
757 configs_to_remove = [ "//gn:no_exceptions" ]
758
759 sources = [
760 "src/codec/SkRawAdapterCodec.cpp",
761 "src/codec/SkRawCodec.cpp",
762 ]
763}
764
Mike Klein852a8cb2018-05-15 10:46:58 -0400765import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400766source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400767 cflags = []
768 if (!is_win || is_clang) {
769 cflags += [
770 "-w",
771 "-std=c11",
772 ]
773 }
774
775 public = [
776 "third_party/skcms/skcms.h",
777 ]
778 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
779}
780
mtklein3cc22182016-08-29 13:26:14 -0700781optional("typeface_freetype") {
782 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700783
784 deps = [
785 "//third_party/freetype2",
786 ]
787 sources = [
788 "src/ports/SkFontHost_FreeType.cpp",
789 "src/ports/SkFontHost_FreeType_common.cpp",
790 ]
791}
792
mtklein457b42a2016-08-23 13:56:37 -0700793optional("webp") {
794 enabled = skia_use_libwebp
795 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
796
mtklein457b42a2016-08-23 13:56:37 -0700797 deps = [
798 "//third_party/libwebp",
799 ]
800 sources = [
801 "src/codec/SkWebpAdapterCodec.cpp",
802 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400803 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700804 ]
mtkleineb3c4252016-08-23 07:38:09 -0700805}
806
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400807optional("wuffs") {
808 enabled = skia_use_wuffs
809 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
810
811 deps = [
812 "//third_party/wuffs",
813 ]
814 sources = [
815 "src/codec/SkWuffsCodec.cpp",
816 ]
817}
818
mtklein63213812016-08-24 09:55:56 -0700819optional("xml") {
820 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000821 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700822
mtklein63213812016-08-24 09:55:56 -0700823 deps = [
824 "//third_party/expat",
825 ]
826 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500827 "src/svg/SkSVGCanvas.cpp",
828 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700829 "src/xml/SkDOM.cpp",
830 "src/xml/SkXMLParser.cpp",
831 "src/xml/SkXMLWriter.cpp",
832 ]
833}
834
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700835if (skia_enable_gpu && skia_generate_workarounds) {
836 action("workaround_list") {
837 script = "tools/build_workaround_header.py"
838
839 inputs = [
840 "src/gpu/gpu_workaround_list.txt",
841 ]
842
843 # see comments in skia_compile_processors about out dir path shenanigans.
844 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700845 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700846
847 outputs = [
848 "$root_out_dir/$output_file",
849 ]
850 args = [
851 "--output-file",
852 "$output_file",
853 ]
854
855 foreach(file, inputs) {
856 args += [ rebase_path(file, root_build_dir) ]
857 }
858 }
859}
860
mtkleinc04ff472016-06-23 10:29:30 -0700861component("skia") {
862 public_configs = [ ":skia_public" ]
863 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700864
865 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700866 ":arm64",
867 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700868 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700869 ":crc32",
Mike Klein2ba04792018-10-18 11:32:41 -0400870 ":effect_deserialization",
Mike Kleina04bb452017-02-09 12:24:07 -0500871 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700872 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700873 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500874 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700875 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700876 ":fontmgr_fuchsia",
Greg Danielda16cce2018-08-01 09:23:57 -0400877 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400878 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500879 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700880 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700881 ":none",
mtklein63213812016-08-24 09:55:56 -0700882 ":pdf",
883 ":png",
scroggof84ad642016-10-31 09:02:57 -0700884 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500885 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700886 ":sse2",
887 ":sse41",
888 ":sse42",
889 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700890 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400891 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700892 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700893 ]
894
Kevin Lubick134be1d2018-10-30 15:05:04 -0400895 if (skia_enable_nima) {
896 deps += [ "//third_party/Nima-Cpp" ]
897 }
898
Chinmay Garde43f115c2016-11-16 15:04:12 -0800899 # This file (and all GN files in Skia) are designed to work with an
900 # empty sources assignment filter; we handle all that explicitly.
901 # We clear the filter here for clients who may have set up a global filter.
902 set_sources_assignment_filter([])
903
mtkleinc04ff472016-06-23 10:29:30 -0700904 sources = []
brettwb9447282016-09-01 14:24:39 -0700905 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700906 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500907 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700908 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400909 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500910 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700911 "src/android/SkBitmapRegionCodec.cpp",
912 "src/android/SkBitmapRegionDecoder.cpp",
913 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400914 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700915 "src/codec/SkBmpCodec.cpp",
916 "src/codec/SkBmpMaskCodec.cpp",
917 "src/codec/SkBmpRLECodec.cpp",
918 "src/codec/SkBmpStandardCodec.cpp",
919 "src/codec/SkCodec.cpp",
920 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400921 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400922 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700923 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700924 "src/codec/SkMaskSwizzler.cpp",
925 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700926 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700927 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700928 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700929 "src/codec/SkSwizzler.cpp",
930 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700931 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700932 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700933 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700934 "src/ports/SkMemory_malloc.cpp",
935 "src/ports/SkOSFile_stdio.cpp",
936 "src/sfnt/SkOTTable_name.cpp",
937 "src/sfnt/SkOTUtils.cpp",
938 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700939 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700940 ]
brettwb9447282016-09-01 14:24:39 -0700941
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400942 defines = []
943 if (!skia_enable_skpicture) {
944 defines = [ "SK_DISABLE_SKPICTURE" ]
945 sources -= skia_skpicture_sources
946 sources += [ "src/core/SkPicture_none.cpp" ]
947 }
948
mtklein7d6fb2c2016-08-25 14:50:44 -0700949 libs = []
950
mtkleinc04ff472016-06-23 10:29:30 -0700951 if (is_win) {
952 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400953 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700954 "src/ports/SkDebug_win.cpp",
955 "src/ports/SkFontHost_win.cpp",
956 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500957 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700958 "src/ports/SkImageEncoder_WIC.cpp",
959 "src/ports/SkImageGeneratorWIC.cpp",
960 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700961 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700962 "src/ports/SkScalerContext_win_dw.cpp",
963 "src/ports/SkTLS_win.cpp",
964 "src/ports/SkTypeface_win_dw.cpp",
965 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400966 libs += [
967 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500968 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400969 "Ole32.lib",
970 "OleAut32.lib",
971 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500972 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400973 ]
mtkleinc04ff472016-06-23 10:29:30 -0700974 } else {
975 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700976 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700977 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700978 "src/ports/SkTLS_pthread.cpp",
979 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400980 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700981 }
982
mtklein7d6fb2c2016-08-25 14:50:44 -0700983 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500984 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500985 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500986 deps += [ "//third_party/cpu-features" ]
987 }
mtklein06c35c02016-09-20 12:28:12 -0700988 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700989 libs += [
990 "EGL",
991 "GLESv2",
992 "log",
993 ]
994 }
995
Kevin Lubick217056c2018-09-20 17:39:31 -0400996 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700997 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400998 if (skia_use_egl) {
999 libs += [ "GLESv2" ]
1000 }
mtkleinc04ff472016-06-23 10:29:30 -07001001 }
1002
1003 if (is_mac) {
1004 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001005 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001006 "src/ports/SkFontHost_mac.cpp",
1007 "src/ports/SkImageEncoder_CG.cpp",
1008 "src/ports/SkImageGeneratorCG.cpp",
1009 ]
mtklein09e61f72016-08-23 13:35:28 -07001010 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001011 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1012 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001013 "ApplicationServices.framework",
1014 "OpenGL.framework",
1015 ]
mtkleinc04ff472016-06-23 10:29:30 -07001016 }
abarth6fc8ff02016-07-15 15:15:15 -07001017
Mike Klein7d302882016-11-03 14:06:31 -04001018 if (is_ios) {
1019 sources += [
1020 "src/ports/SkDebug_stdio.cpp",
1021 "src/ports/SkFontHost_mac.cpp",
1022 "src/ports/SkImageEncoder_CG.cpp",
1023 "src/ports/SkImageGeneratorCG.cpp",
1024 ]
1025 libs += [
1026 "CoreFoundation.framework",
1027 "CoreGraphics.framework",
1028 "CoreText.framework",
1029 "ImageIO.framework",
1030 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001031
1032 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1033 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001034 ]
1035 }
1036
abarth6fc8ff02016-07-15 15:15:15 -07001037 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001038 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001039 }
mtkleinc04ff472016-06-23 10:29:30 -07001040}
1041
Kevin Lubickcbcff382018-10-02 09:02:18 -04001042static_library("pathkit") {
1043 public_configs = [ ":skia_public" ]
1044 configs += skia_library_configs
1045
1046 deps = [
1047 ":arm64",
1048 ":armv7",
1049 ":avx",
1050 ":crc32",
1051 ":hsw",
1052 ":none",
1053 ":sse2",
1054 ":sse41",
1055 ":sse42",
1056 ":ssse3",
1057 ]
1058
1059 # This file (and all GN files in Skia) are designed to work with an
1060 # empty sources assignment filter; we handle all that explicitly.
1061 # We clear the filter here for clients who may have set up a global filter.
1062 set_sources_assignment_filter([])
1063
1064 sources = []
1065 sources += skia_pathops_sources
1066 sources += [
1067 "src/core/SkAnalyticEdge.cpp",
1068 "src/core/SkArenaAlloc.cpp",
1069 "src/core/SkCubicMap.cpp",
1070 "src/core/SkEdge.cpp",
1071 "src/core/SkEdgeBuilder.cpp",
1072 "src/core/SkEdgeClipper.cpp",
1073 "src/core/SkGeometry.cpp",
1074 "src/core/SkLineClipper.cpp",
1075 "src/core/SkMallocPixelRef.cpp",
1076 "src/core/SkMath.cpp",
1077 "src/core/SkMatrix.cpp",
1078 "src/core/SkOpts.cpp",
1079 "src/core/SkPaint.cpp",
1080 "src/core/SkPath.cpp",
1081 "src/core/SkPathEffect.cpp",
1082 "src/core/SkPathMeasure.cpp",
1083 "src/core/SkPathRef.cpp",
1084 "src/core/SkPoint.cpp",
1085 "src/core/SkRRect.cpp",
1086 "src/core/SkRect.cpp",
1087 "src/core/SkSemaphore.cpp",
1088 "src/core/SkStream.cpp",
1089 "src/core/SkString.cpp",
1090 "src/core/SkStringUtils.cpp",
1091 "src/core/SkStroke.cpp",
1092 "src/core/SkStrokeRec.cpp",
1093 "src/core/SkStrokerPriv.cpp",
1094 "src/core/SkThreadID.cpp",
1095 "src/core/SkUtils.cpp",
1096 "src/effects/SkDashPathEffect.cpp",
1097 "src/effects/SkTrimPathEffect.cpp",
1098 "src/ports/SkDebug_stdio.cpp",
1099 "src/ports/SkMemory_malloc.cpp",
1100 "src/utils/SkDashPath.cpp",
1101 "src/utils/SkParse.cpp",
1102 "src/utils/SkParsePath.cpp",
1103 "src/utils/SkUTF.cpp",
1104 ]
1105}
1106
mtkleinc095df52016-08-24 12:23:52 -07001107# Targets guarded by skia_enable_tools may use //third_party freely.
1108if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001109 # Used by gn_to_bp.py to list our public include dirs.
1110 source_set("public") {
1111 configs += [ ":skia_public" ]
1112 }
1113
Mike Kleinc36dedf2016-11-18 09:35:28 -05001114 config("skia.h_config") {
1115 include_dirs = [ "$target_gen_dir" ]
1116 }
1117 action("skia.h") {
1118 public_configs = [ ":skia.h_config" ]
1119 skia_h = "$target_gen_dir/skia.h"
1120 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001121
1122 # TODO: would be cool to not hard-code these here, but how?
1123 module_public_includes = [
1124 "modules/sksg/include",
1125 "modules/skottie/include",
1126 ]
1127 args =
1128 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1129 [ rebase_path(skia_h, root_build_dir) ] +
1130 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001131 depfile = "$skia_h.deps"
1132 outputs = [
1133 skia_h,
1134 ]
1135 }
1136
Brian Osmanc9a42472018-05-31 13:17:12 -04001137 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001138 executable("fiddle") {
1139 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001140 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001141 "tools/fiddle/draw.cpp",
1142 "tools/fiddle/fiddle_main.cpp",
1143 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001144
1145 if (skia_use_egl) {
1146 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001147 } else {
1148 sources += [ "tools/fiddle/null_context.cpp" ]
1149 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001150 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001151 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001152 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001153 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001154 ":skia",
1155 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001156 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001157 ]
1158 }
1159 }
1160
Brian Osmanc9a42472018-05-31 13:17:12 -04001161 source_set("public_headers_warnings_check") {
1162 sources = [
1163 "tools/public_headers_warnings_check.cpp",
1164 ]
1165 configs -= [ "//gn:warnings_except_public_headers" ]
1166 deps = [
1167 ":skia",
1168 ":skia.h",
1169 "modules/skottie",
1170 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001171 }
1172
mtkleinc095df52016-08-24 12:23:52 -07001173 template("test_lib") {
1174 config(target_name + "_config") {
1175 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001176 if (defined(invoker.public_defines)) {
1177 defines = invoker.public_defines
1178 }
mtklein25c81d42016-07-27 13:55:26 -07001179 }
mtkleinc095df52016-08-24 12:23:52 -07001180 source_set(target_name) {
1181 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1182 public_configs = [
1183 ":" + target_name + "_config",
1184 ":skia_private",
1185 ]
1186
1187 if (!defined(deps)) {
1188 deps = []
1189 }
1190 deps += [ ":skia" ]
1191 testonly = true
1192 }
mtklein25c81d42016-07-27 13:55:26 -07001193 }
mtklein25c81d42016-07-27 13:55:26 -07001194
Mike Kleine6682eb2017-01-05 10:54:57 -05001195 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001196 if (is_ios) {
1197 app_name = target_name
1198 gen_path = target_gen_dir
1199
1200 action("${app_name}_generate_info_plist") {
1201 script = "//gn/gen_plist_ios.py"
1202 outputs = [
1203 "$gen_path/${app_name}_Info.plist",
1204 ]
1205 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1206 }
1207
1208 bundle_data("${app_name}_bundle_info_plist") {
1209 public_deps = [
1210 ":${app_name}_generate_info_plist",
1211 ]
1212 sources = [
1213 "$gen_path/${app_name}_Info.plist",
1214 ]
1215 outputs = [
1216 "{{bundle_root_dir}}/Info.plist",
1217 ]
1218 }
1219
Jim Van Verth329c5a62017-11-29 11:42:33 -05001220 bundle_ios_data =
1221 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1222
1223 if (bundle_ios_data) {
1224 has_skps =
1225 "True" == exec_script("//gn/checkdir.py",
1226 [ rebase_path("skps", root_build_dir) ],
1227 "trim string")
1228 bundle_data("${app_name}_bundle_resources") {
1229 sources = [
1230 "resources",
1231 ]
1232 outputs = [
1233 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1234 "{{bundle_resources_dir}}/data/resources",
1235 ]
1236 }
1237
1238 if (has_skps) {
1239 bundle_data("${app_name}_bundle_skps") {
1240 sources = [
1241 "skps",
1242 ]
1243 outputs = [
1244 # Store in same folder as resources
1245 "{{bundle_resources_dir}}/data/skps",
1246 ]
1247 }
1248 }
1249 }
1250
Jim Van Verth443a9132017-11-28 09:45:26 -05001251 executable("${app_name}_generate_executable") {
1252 forward_variables_from(invoker,
1253 "*",
1254 [
1255 "output_name",
1256 "visibility",
1257 "is_shared_library",
1258 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001259 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001260 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001261 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1262 }
1263
1264 bundle_data("${app_name}_bundle_executable") {
1265 public_deps = [
1266 ":${app_name}_generate_executable",
1267 ]
1268 sources = [
1269 "$gen_path/$app_name",
1270 ]
1271 outputs = [
1272 "{{bundle_executable_dir}}/$app_name",
1273 ]
1274 testonly = true
1275 }
1276
1277 create_bundle("$app_name") {
1278 product_type = "com.apple.product-type.application"
1279 testonly = true
1280
1281 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1282 bundle_resources_dir = bundle_root_dir
1283 bundle_executable_dir = bundle_root_dir
1284 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1285
1286 deps = [
1287 ":${app_name}_bundle_executable",
1288 ":${app_name}_bundle_info_plist",
1289 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001290 if (bundle_ios_data) {
1291 deps += [ ":${app_name}_bundle_resources" ]
1292 if (has_skps) {
1293 deps += [ ":${app_name}_bundle_skps" ]
1294 }
1295 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001296
1297 # should only code sign when running on a device, not the simulator
1298 if (target_cpu != "x64") {
1299 code_signing_script = "//gn/codesign_ios.py"
1300 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1301 code_signing_outputs = [
1302 "$bundle_root_dir/_CodeSignature/CodeResources",
1303 "$bundle_root_dir/embedded.mobileprovision",
1304 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001305 code_signing_args = [
1306 rebase_path("$bundle_root_dir", root_build_dir),
1307 skia_ios_identity,
1308 skia_ios_profile,
1309 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001310 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001311 }
1312 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001313 # !is_ios
1314
1315 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1316 shared_library("lib" + target_name) {
1317 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1318 configs += [ ":skia_private" ]
1319 testonly = true
1320 }
1321 } else {
1322 _executable = target_name
1323 executable(_executable) {
1324 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1325 configs += [ ":skia_private" ]
1326 testonly = true
1327 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001328 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001329 if (is_android && skia_android_serial != "" && defined(_executable)) {
1330 action("push_" + target_name) {
1331 script = "gn/push_to_android.py"
1332 deps = [
1333 ":" + _executable,
1334 ]
1335 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1336 outputs = [
1337 _stamp,
1338 ]
1339 args = [
1340 rebase_path("$root_build_dir/$_executable"),
1341 skia_android_serial,
1342 rebase_path(_stamp),
1343 ]
1344 testonly = true
1345 }
Mike Klein7d921032017-01-05 12:20:41 -05001346 }
1347 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001348 }
1349
Greg Danielda16cce2018-08-01 09:23:57 -04001350 config("moltenvk_config") {
1351 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1352 if (is_ios) {
1353 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1354 } else {
1355 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1356 }
1357 cflags = [ "-F$moltenvk_framework_path" ]
1358 ldflags = [ "-F$moltenvk_framework_path" ]
1359 libs = [
1360 "MoltenVK.framework",
1361 "Metal.framework",
1362 "IOSurface.framework",
1363 "QuartzCore.framework",
1364 "Foundation.framework",
1365 ]
1366 if (is_ios) {
1367 libs += [ "UIKit.framework" ]
1368 } else {
1369 libs += [ "IOKit.framework" ]
1370 }
1371 defines = [ "SK_MOLTENVK" ]
1372 }
1373 }
1374
1375 source_set("moltenvk") {
1376 public_configs = [ ":moltenvk_config" ]
1377 }
1378
mtkleinc095df52016-08-24 12:23:52 -07001379 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001380 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001381 public_defines = []
1382 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001383
Brian Osmanc9a42472018-05-31 13:17:12 -04001384 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001385 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001386 sources = [
1387 "tools/gpu/GrContextFactory.cpp",
1388 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001389 "tools/gpu/MemoryCache.cpp",
1390 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001391 "tools/gpu/ProxyUtils.cpp",
1392 "tools/gpu/TestContext.cpp",
1393 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1394 "tools/gpu/gl/GLTestContext.cpp",
1395 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001396 "tools/gpu/gl/null/NullGLTestContext.cpp",
1397 "tools/gpu/mock/MockTestContext.cpp",
1398 ]
1399 libs = []
1400
1401 if (is_android || skia_use_egl) {
1402 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1403 } else if (is_ios) {
1404 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1405 libs += [ "OpenGLES.framework" ]
1406 } else if (is_linux) {
1407 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001408 libs += [
1409 "GLU",
1410 "X11",
1411 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001412 } else if (is_mac) {
1413 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1414 } else if (is_win) {
1415 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1416 libs += [
1417 "Gdi32.lib",
1418 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001419 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001420 }
mtklein25c81d42016-07-27 13:55:26 -07001421
Brian Osmanc9a42472018-05-31 13:17:12 -04001422 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001423
Brian Osmanc9a42472018-05-31 13:17:12 -04001424 if (skia_use_angle) {
1425 deps += [ "//third_party/angle2" ]
1426 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1427 }
Greg Danielb4d89562018-10-03 18:44:49 +00001428 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001429 if (skia_use_vulkan) {
1430 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1431 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001432 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1433 public_deps += [ ":moltenvk" ]
1434 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001435 }
1436 if (skia_use_metal) {
1437 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001438 }
mtklein25c81d42016-07-27 13:55:26 -07001439 }
mtklein25c81d42016-07-27 13:55:26 -07001440
mtkleinc095df52016-08-24 12:23:52 -07001441 test_lib("flags") {
1442 public_include_dirs = [ "tools/flags" ]
1443 sources = [
1444 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001445 ]
1446 }
1447 test_lib("common_flags") {
1448 public_include_dirs = [ "tools/flags" ]
1449 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001450 "tools/flags/SkCommonFlags.cpp",
1451 "tools/flags/SkCommonFlagsConfig.cpp",
1452 ]
1453 deps = [
mtklein046cb562016-09-16 10:23:12 -07001454 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001455 ]
1456 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001457 ":gpu_tool_utils",
1458 ]
1459 }
mtklein25c81d42016-07-27 13:55:26 -07001460
mtkleinc095df52016-08-24 12:23:52 -07001461 test_lib("tool_utils") {
1462 public_include_dirs = [
1463 "tools",
1464 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001465 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001466 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001467 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001468 ]
1469 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001470 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001471 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001472 "tools/DDLPromiseImageHelper.cpp",
1473 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001474 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001475 "tools/ProcStats.cpp",
1476 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001477 "tools/UrlDataManager.cpp",
1478 "tools/debugger/SkDebugCanvas.cpp",
1479 "tools/debugger/SkDrawCommand.cpp",
1480 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001481 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001482 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001483 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001484 "tools/fonts/SkTestFontMgr.h",
1485 "tools/fonts/SkTestSVGTypeface.cpp",
1486 "tools/fonts/SkTestSVGTypeface.h",
1487 "tools/fonts/SkTestTypeface.cpp",
1488 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001489 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001490 "tools/random_parse_path.cpp",
1491 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001492 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001493 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001494 "tools/trace/SkChromeTracingTracer.cpp",
1495 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001496 "tools/trace/SkDebugfTracer.cpp",
1497 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001498 "tools/trace/SkEventTracingPriv.cpp",
1499 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001500 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001501 libs = []
1502 if (is_ios) {
1503 sources += [ "tools/ios_utils.m" ]
1504 libs += [ "Foundation.framework" ]
1505 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001506 defines = []
1507 if (skia_tools_require_resources) {
1508 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1509 }
mtkleinc095df52016-08-24 12:23:52 -07001510 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001511 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001512 ":flags",
1513 "//third_party/libpng",
1514 ]
1515 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001516 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001517 "//third_party/jsoncpp",
1518 ]
1519 }
mtklein25c81d42016-07-27 13:55:26 -07001520
Mike Klein6e744122016-10-27 12:21:40 -04001521 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001522 test_lib("gm") {
1523 public_include_dirs = [ "gm" ]
1524 sources = gm_sources
1525 deps = [
scroggo19b91532016-10-24 09:03:26 -07001526 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001527 ":skia",
1528 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001529 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001530 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001531 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001532 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001533 public_deps = [
1534 ":gpu_tool_utils",
1535 ]
mtkleinc095df52016-08-24 12:23:52 -07001536 }
mtklein25c81d42016-07-27 13:55:26 -07001537
Mike Klein6e744122016-10-27 12:21:40 -04001538 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001539 test_lib("tests") {
1540 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001541 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001542 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001543 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001544 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001545 if (!(skia_use_freetype && skia_use_fontconfig)) {
1546 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1547 }
mtkleinc095df52016-08-24 12:23:52 -07001548 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001549 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001550 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001551 ":skia",
1552 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001553 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001554 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001555 "//third_party/libpng",
1556 "//third_party/zlib",
1557 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001558 public_deps = [
1559 ":gpu_tool_utils", # Test.h #includes headers from this target.
1560 ]
mtkleinc095df52016-08-24 12:23:52 -07001561 }
mtklein2f3416d2016-08-02 16:02:05 -07001562
Mike Klein6e744122016-10-27 12:21:40 -04001563 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001564 test_lib("bench") {
1565 public_include_dirs = [ "bench" ]
1566 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001567 deps = [
1568 ":flags",
1569 ":gm",
1570 ":gpu_tool_utils",
1571 ":skia",
1572 ":tool_utils",
1573 ]
1574 }
mtklein2b6870c2016-07-28 14:17:33 -07001575
mtkleinc095df52016-08-24 12:23:52 -07001576 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001577 public_include_dirs = []
1578 if (skia_use_expat) {
1579 public_include_dirs += [ "experimental/svg/model" ]
1580 sources = [
1581 "experimental/svg/model/SkSVGAttribute.cpp",
1582 "experimental/svg/model/SkSVGAttributeParser.cpp",
1583 "experimental/svg/model/SkSVGCircle.cpp",
1584 "experimental/svg/model/SkSVGClipPath.cpp",
1585 "experimental/svg/model/SkSVGContainer.cpp",
1586 "experimental/svg/model/SkSVGDOM.cpp",
1587 "experimental/svg/model/SkSVGEllipse.cpp",
1588 "experimental/svg/model/SkSVGGradient.cpp",
1589 "experimental/svg/model/SkSVGLine.cpp",
1590 "experimental/svg/model/SkSVGLinearGradient.cpp",
1591 "experimental/svg/model/SkSVGNode.cpp",
1592 "experimental/svg/model/SkSVGPath.cpp",
1593 "experimental/svg/model/SkSVGPattern.cpp",
1594 "experimental/svg/model/SkSVGPoly.cpp",
1595 "experimental/svg/model/SkSVGRadialGradient.cpp",
1596 "experimental/svg/model/SkSVGRect.cpp",
1597 "experimental/svg/model/SkSVGRenderContext.cpp",
1598 "experimental/svg/model/SkSVGSVG.cpp",
1599 "experimental/svg/model/SkSVGShape.cpp",
1600 "experimental/svg/model/SkSVGStop.cpp",
1601 "experimental/svg/model/SkSVGTransformableNode.cpp",
1602 "experimental/svg/model/SkSVGUse.cpp",
1603 "experimental/svg/model/SkSVGValue.cpp",
1604 ]
1605 deps = [
1606 ":skia",
1607 ":xml",
1608 ]
1609 }
mtkleinc095df52016-08-24 12:23:52 -07001610 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001611
Mike Klein38af9432016-11-11 11:39:44 -05001612 if (skia_use_lua) {
1613 test_lib("lua") {
1614 public_include_dirs = []
1615 sources = [
1616 "src/utils/SkLua.cpp",
1617 "src/utils/SkLuaCanvas.cpp",
1618 ]
1619 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001620 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001621 "//third_party/lua",
1622 ]
1623 }
1624
Mike Kleine6682eb2017-01-05 10:54:57 -05001625 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001626 sources = [
1627 "tools/lua/lua_app.cpp",
1628 ]
1629 deps = [
1630 ":lua",
1631 ":skia",
1632 "//third_party/lua",
1633 ]
Mike Klein38af9432016-11-11 11:39:44 -05001634 }
1635
Mike Kleine6682eb2017-01-05 10:54:57 -05001636 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001637 sources = [
1638 "tools/lua/lua_pictures.cpp",
1639 ]
1640 deps = [
1641 ":flags",
1642 ":lua",
1643 ":skia",
1644 ":tool_utils",
1645 "//third_party/lua",
1646 ]
Mike Klein38af9432016-11-11 11:39:44 -05001647 }
1648 }
1649
Cary Clark8032b982017-07-28 11:04:54 -04001650 test_app("bookmaker") {
1651 sources = [
1652 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001653 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001654 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001655 "tools/bookmaker/fiddleParser.cpp",
1656 "tools/bookmaker/includeParser.cpp",
1657 "tools/bookmaker/includeWriter.cpp",
1658 "tools/bookmaker/mdOut.cpp",
1659 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001660 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001661 "tools/bookmaker/spellCheck.cpp",
1662 ]
1663 deps = [
1664 ":flags",
1665 ":skia",
1666 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001667 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001668 ]
1669 }
1670
Florin Malitabfe876a2018-09-02 12:33:59 -04001671 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001672 test_app("skottie_tool") {
1673 deps = [
1674 "modules/skottie:tool",
1675 ]
1676 }
1677 }
1678
Kevin Lubickebf648e2017-09-21 13:45:16 -04001679 if (target_cpu != "wasm") {
1680 import("gn/samples.gni")
1681 test_lib("samples") {
1682 public_include_dirs = [ "samplecode" ]
1683 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001684 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001685 public_deps = [
1686 ":tool_utils",
1687 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001688 deps = [
1689 ":experimental_svg_model",
1690 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001691 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001692 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001693 ]
Mike Klein38af9432016-11-11 11:39:44 -05001694
Ruiqi Maof5101492018-06-29 14:32:21 -04001695 # NIMA does not build on Windows clang
1696 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001697 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001698 deps += [ "//third_party/Nima-Cpp" ]
1699 }
1700
Kevin Lubickebf648e2017-09-21 13:45:16 -04001701 if (skia_use_lua) {
1702 sources += [ "samplecode/SampleLua.cpp" ]
1703 deps += [
1704 ":lua",
1705 "//third_party/lua",
1706 ]
1707 }
1708 }
Mike Klein7af351a2018-07-27 09:54:43 -04001709 test_app("imgcvt") {
1710 sources = [
1711 "tools/imgcvt.cpp",
1712 ]
1713 deps = [
1714 ":skcms",
1715 ":skia",
1716 ]
1717 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001718 test_app("dm") {
1719 sources = [
1720 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001721 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001722 "dm/DMJsonWriter.cpp",
1723 "dm/DMSrcSink.cpp",
1724 ]
1725 include_dirs = [ "tests" ]
1726 deps = [
1727 ":common_flags",
1728 ":experimental_svg_model",
1729 ":flags",
1730 ":gm",
1731 ":gpu_tool_utils",
1732 ":skia",
1733 ":tests",
1734 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001735 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001736 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001737 "//third_party/jsoncpp",
1738 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001739 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001740
1741 # NIMA does not build on Windows clang
1742 if (!is_win || !is_clang) {
1743 deps += [ "//third_party/Nima-Cpp" ]
1744 }
Mike Klein38af9432016-11-11 11:39:44 -05001745 }
Brian Osman16adfa32016-10-18 14:42:44 -04001746 }
1747
Mike Kleina8a51ce2018-01-09 12:34:11 -05001748 if (!is_win) {
1749 test_app("remote_demo") {
1750 sources = [
1751 "tools/remote_demo.cpp",
1752 ]
1753 deps = [
1754 ":skia",
1755 ]
1756 }
1757 }
1758
Mike Kleine6682eb2017-01-05 10:54:57 -05001759 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001760 sources = [
1761 "bench/nanobench.cpp",
1762 ]
1763 deps = [
1764 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001765 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001766 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001767 ":flags",
1768 ":gm",
1769 ":gpu_tool_utils",
1770 ":skia",
1771 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001772 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001773 "//third_party/jsoncpp",
1774 ]
mtklein2b6870c2016-07-28 14:17:33 -07001775 }
halcanary19a97202016-08-03 15:08:04 -07001776
Ravi Mistry10d36c52017-01-31 09:49:18 -05001777 test_app("skpinfo") {
1778 sources = [
1779 "tools/skpinfo.cpp",
1780 ]
1781 deps = [
1782 ":flags",
1783 ":skia",
1784 ]
1785 }
1786
Brian Osmanc9a42472018-05-31 13:17:12 -04001787 test_app("skpbench") {
1788 sources = [
1789 "tools/skpbench/skpbench.cpp",
1790 ]
1791 deps = [
1792 ":flags",
1793 ":gpu_tool_utils",
1794 ":skia",
1795 ":tool_utils",
1796 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001797 }
1798
Mike Kleine6682eb2017-01-05 10:54:57 -05001799 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001800 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001801 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001802 ]
1803 deps = [
1804 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001805 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001806 ]
halcanary3eee9d92016-09-10 07:01:53 -07001807 }
mtklein046cb562016-09-16 10:23:12 -07001808
Ben Wagner219f3622017-07-17 15:32:25 -04001809 test_app("create_test_font") {
1810 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001811 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001812 ]
1813 deps = [
1814 ":skia",
1815 ]
1816 assert_no_deps = [
1817 # tool_utils requires the output of this app.
1818 ":tool_utils",
1819 ]
1820 }
1821
Florin Malita5d3ff432018-07-31 16:38:43 -04001822 if (skia_use_expat) {
1823 test_app("create_test_font_color") {
1824 sources = [
1825 "tools/fonts/create_test_font_color.cpp",
1826 ]
1827 deps = [
1828 ":flags",
1829 ":skia",
1830 ":tool_utils",
1831 ]
1832 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001833 }
1834
Mike Kleine6682eb2017-01-05 10:54:57 -05001835 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001836 sources = [
1837 "tools/get_images_from_skps.cpp",
1838 ]
1839 deps = [
1840 ":flags",
1841 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001842 ]
mtklein046cb562016-09-16 10:23:12 -07001843 }
mtkleinecbc5262016-09-22 11:51:24 -07001844
Kevin Lubickebf648e2017-09-21 13:45:16 -04001845 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001846 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001847 sources = [
1848 "tools/skiaserve/Request.cpp",
1849 "tools/skiaserve/Response.cpp",
1850 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001851 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1852 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1853 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1854 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1855 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1856 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1857 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1858 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1859 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001860 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1861 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001862 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1863 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1864 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1865 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1866 ]
1867 deps = [
1868 ":flags",
1869 ":gpu_tool_utils",
1870 ":skia",
1871 ":tool_utils",
1872 "//third_party/jsoncpp",
1873 "//third_party/libmicrohttpd",
1874 "//third_party/libpng",
1875 ]
Mike Klein7d302882016-11-03 14:06:31 -04001876 }
mtkleinecbc5262016-09-22 11:51:24 -07001877 }
kjlubick14f984b2016-10-03 11:49:45 -07001878
Mike Kleine6682eb2017-01-05 10:54:57 -05001879 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001880 include_dirs = [
1881 "tools",
1882 "tools/debugger",
1883 ]
kjlubick14f984b2016-10-03 11:49:45 -07001884 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001885 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001886 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001887 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001888 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001889 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001890 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001891 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001892 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001893 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001894 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001895 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001896 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001897 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001898 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1899 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001900 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001901 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001902 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001903 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001904 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1905 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001906 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001907 "tools/UrlDataManager.cpp",
1908 "tools/debugger/SkDebugCanvas.cpp",
1909 "tools/debugger/SkDrawCommand.cpp",
1910 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001911 ]
1912 deps = [
1913 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001914 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001915 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001916 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001917 "//third_party/jsoncpp",
1918 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001919 ]
kjlubick14f984b2016-10-03 11:49:45 -07001920 }
Mike Klein38312422016-10-05 15:41:01 -04001921
Mike Kleine6682eb2017-01-05 10:54:57 -05001922 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001923 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001924 rebase_path("tests/skia_test.cpp"),
1925 rebase_path("tests/Test.cpp"),
1926 ]
caryclark9feb6322016-10-25 08:58:26 -07001927 deps = [
1928 ":flags",
1929 ":gpu_tool_utils",
1930 ":skia",
1931 ":tool_utils",
1932 ]
caryclark9feb6322016-10-25 08:58:26 -07001933 }
1934
Mike Kleine6682eb2017-01-05 10:54:57 -05001935 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001936 sources = [
1937 "tools/DumpRecord.cpp",
1938 "tools/dump_record.cpp",
1939 ]
1940 deps = [
1941 ":flags",
1942 ":skia",
1943 ]
Mike Klein38312422016-10-05 15:41:01 -04001944 }
bungemanfe917272016-10-13 17:36:40 -04001945
Mike Kleine6682eb2017-01-05 10:54:57 -05001946 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001947 sources = [
1948 "tools/skdiff/skdiff.cpp",
1949 "tools/skdiff/skdiff_html.cpp",
1950 "tools/skdiff/skdiff_main.cpp",
1951 "tools/skdiff/skdiff_utils.cpp",
1952 ]
1953 deps = [
1954 ":skia",
1955 ":tool_utils",
1956 ]
bungemanfe917272016-10-13 17:36:40 -04001957 }
halcanarya73d76a2016-10-17 13:19:02 -07001958
Mike Kleine6682eb2017-01-05 10:54:57 -05001959 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001960 sources = [
1961 "tools/skp_parser.cpp",
1962 ]
1963 deps = [
1964 ":skia",
1965 ":tool_utils",
1966 "//third_party/jsoncpp",
1967 ]
halcanarya73d76a2016-10-17 13:19:02 -07001968 }
Brian Osman16adfa32016-10-18 14:42:44 -04001969
Brian Osmanc9a42472018-05-31 13:17:12 -04001970 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001971 test_lib("skqp_lib") {
1972 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001973 defines =
1974 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001975 if (skia_skqp_enable_driver_correctness_workarounds) {
1976 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1977 }
Hal Canary75427132017-10-11 16:00:31 -04001978 sources = [
1979 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001980 "tools/skqp/gm_knowledge.cpp",
1981 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001982 ]
1983 deps = [
1984 ":gm",
1985 ":gpu_tool_utils",
1986 ":skia",
1987 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001988 ":tool_utils",
1989 ]
1990 }
1991 test_app("skqp") {
1992 sources = [
1993 "tools/skqp/skqp.cpp",
1994 ]
1995 deps = [
1996 ":skia",
1997 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001998 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001999 "//third_party/googletest",
2000 ]
2001 }
2002 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002003 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002004 test_app("skqp_app") {
2005 is_shared_library = true
2006 sources = [
2007 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
2008 ]
2009 deps = [
2010 ":skia",
2011 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002012 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002013 ]
2014 libs = [ "android" ]
2015 }
2016 }
Stan Iliev93151722018-08-02 11:10:52 -04002017 if (is_android && skia_enable_gpu) {
2018 test_app("skottie_android") {
2019 is_shared_library = true
2020
2021 sources = [
2022 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2023 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2024 ]
2025 libs = []
2026
2027 include_dirs = []
2028 deps = [
2029 ":skia",
2030 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002031 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002032 ]
2033 }
2034 }
Hal Canary75427132017-10-11 16:00:31 -04002035
Hal Canarya9de7602018-01-19 13:08:23 -05002036 test_app("list_gms") {
2037 sources = [
2038 "tools/list_gms.cpp",
2039 ]
2040 deps = [
2041 ":gm",
2042 ":skia",
2043 ]
2044 }
2045 test_app("list_gpu_unit_tests") {
2046 sources = [
2047 "dm/DMGpuTestProcs.cpp",
2048 "tools/list_gpu_unit_tests.cpp",
2049 ]
2050 deps = [
2051 ":skia",
2052 ":tests",
2053 ]
2054 }
2055
Brian Osmanc9a42472018-05-31 13:17:12 -04002056 test_lib("sk_app") {
2057 public_include_dirs = [ "tools/sk_app" ]
2058 sources = [
2059 "tools/sk_app/CommandSet.cpp",
2060 "tools/sk_app/GLWindowContext.cpp",
2061 "tools/sk_app/Window.cpp",
2062 ]
2063 libs = []
2064
2065 if (is_android) {
2066 sources += [
2067 "tools/sk_app/android/GLWindowContext_android.cpp",
2068 "tools/sk_app/android/RasterWindowContext_android.cpp",
2069 "tools/sk_app/android/Window_android.cpp",
2070 "tools/sk_app/android/main_android.cpp",
2071 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002072 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002073 libs += [ "android" ]
2074 } else if (is_linux) {
2075 sources += [
2076 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2077 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2078 "tools/sk_app/unix/Window_unix.cpp",
2079 "tools/sk_app/unix/keysym2ucs.c",
2080 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002081 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002082 libs += [
2083 "GL",
2084 "X11",
2085 ]
2086 } else if (is_win) {
2087 sources += [
2088 "tools/sk_app/win/GLWindowContext_win.cpp",
2089 "tools/sk_app/win/RasterWindowContext_win.cpp",
2090 "tools/sk_app/win/Window_win.cpp",
2091 "tools/sk_app/win/main_win.cpp",
2092 ]
Brian Salomon194db172017-08-17 14:37:06 -04002093 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002094 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002095 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002096 } else if (is_mac) {
2097 sources += [
2098 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2099 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2100 "tools/sk_app/mac/Window_mac.cpp",
2101 "tools/sk_app/mac/main_mac.cpp",
2102 ]
2103 libs += [
2104 "QuartzCore.framework",
2105 "Cocoa.framework",
2106 "Foundation.framework",
2107 ]
2108 } else if (is_ios) {
2109 sources += [
2110 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2111 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2112 "tools/sk_app/ios/Window_ios.cpp",
2113 "tools/sk_app/ios/main_ios.cpp",
2114 ]
2115 }
2116
2117 if (skia_use_vulkan) {
2118 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2119 if (is_android) {
2120 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2121 } else if (is_linux) {
2122 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2123 libs += [ "X11-xcb" ]
2124 } else if (is_win) {
2125 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
2126 }
2127 }
2128
2129 deps = [
2130 ":gpu_tool_utils",
2131 ":skia",
2132 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002133 ]
2134 if (is_android) {
2135 deps += [ "//third_party/native_app_glue" ]
2136 } else if (is_mac || is_ios) {
2137 deps += [ "//third_party/libsdl" ]
2138 }
2139 if (skia_use_angle) {
2140 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002141 }
Brian Osman16adfa32016-10-18 14:42:44 -04002142 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002143
Brian Osmanc9a42472018-05-31 13:17:12 -04002144 test_app("viewer") {
2145 is_shared_library = is_android
2146 if (is_ios) {
2147 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002148 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002149 sources = [
2150 "tools/viewer/BisectSlide.cpp",
2151 "tools/viewer/GMSlide.cpp",
2152 "tools/viewer/ImGuiLayer.cpp",
2153 "tools/viewer/ImageSlide.cpp",
2154 "tools/viewer/SKPSlide.cpp",
2155 "tools/viewer/SampleSlide.cpp",
2156 "tools/viewer/SkottieSlide.cpp",
2157 "tools/viewer/SlideDir.cpp",
2158 "tools/viewer/StatsLayer.cpp",
2159 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002160 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002161 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002162 "tools/viewer/Viewer.cpp",
2163 ]
2164 libs = []
2165
Kevin Lubickd9699322018-10-30 15:08:53 -04002166 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002167 deps = [
2168 ":experimental_svg_model",
2169 ":flags",
2170 ":gm",
2171 ":gpu_tool_utils",
2172 ":samples",
2173 ":sk_app",
2174 ":skia",
2175 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002176 "modules/skottie",
2177 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002178 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002179 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002180 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002181
2182 # NIMA does not build on Windows clang
2183 if (!is_win || !is_clang) {
2184 sources += [ "tools/viewer/NIMASlide.cpp" ]
2185 deps += [ "//third_party/Nima-Cpp" ]
2186 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002187 }
2188
ziadbbceddbc2018-06-19 13:57:15 -04002189 if (is_android) {
2190 test_app("arcore") {
2191 is_shared_library = true
2192 configs = [
2193 ":skia_public",
2194 "gn:default",
2195 ]
2196
2197 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2198 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2199 sources = []
2200 sources += skia_core_sources
2201 sources += skia_utils_sources
2202 sources += skia_xps_sources
2203 sources += [
2204 "src/android/SkAndroidFrameworkUtils.cpp",
2205 "src/android/SkAnimatedImage.cpp",
2206 "src/android/SkBitmapRegionCodec.cpp",
2207 "src/android/SkBitmapRegionDecoder.cpp",
2208 "src/codec/SkAndroidCodec.cpp",
2209 "src/codec/SkBmpBaseCodec.cpp",
2210 "src/codec/SkBmpCodec.cpp",
2211 "src/codec/SkBmpMaskCodec.cpp",
2212 "src/codec/SkBmpRLECodec.cpp",
2213 "src/codec/SkBmpStandardCodec.cpp",
2214 "src/codec/SkCodec.cpp",
2215 "src/codec/SkCodecImageGenerator.cpp",
2216 "src/codec/SkColorTable.cpp",
2217 "src/codec/SkGifCodec.cpp",
2218 "src/codec/SkMaskSwizzler.cpp",
2219 "src/codec/SkMasks.cpp",
2220 "src/codec/SkSampledCodec.cpp",
2221 "src/codec/SkSampler.cpp",
2222 "src/codec/SkStreamBuffer.cpp",
2223 "src/codec/SkSwizzler.cpp",
2224 "src/codec/SkWbmpCodec.cpp",
2225 "src/images/SkImageEncoder.cpp",
2226 "src/ports/SkDiscardableMemory_none.cpp",
2227 "src/ports/SkImageGenerator_skia.cpp",
2228 "src/ports/SkMemory_malloc.cpp",
2229 "src/ports/SkOSFile_stdio.cpp",
2230 "src/sfnt/SkOTTable_name.cpp",
2231 "src/sfnt/SkOTUtils.cpp",
2232 "src/utils/mac/SkStream_mac.cpp",
2233 "third_party/gif/SkGifImageReader.cpp",
2234 ]
2235 deps = [
2236 ":tool_utils",
2237 "modules/skottie",
2238 "modules/skshaper",
2239 ]
2240 }
2241 }
2242
Brian Osmanc9a42472018-05-31 13:17:12 -04002243 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002244 test_app("HelloWorld") {
2245 sources = [
2246 "example/HelloWorld.cpp",
2247 ]
2248 libs = []
2249
2250 include_dirs = []
2251 deps = [
2252 ":flags",
2253 ":gpu_tool_utils",
2254 ":sk_app",
2255 ":skia",
2256 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002257 ]
2258 }
2259 }
2260
Brian Osmanc9a42472018-05-31 13:17:12 -04002261 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002262 test_app("SkiaSDLExample") {
2263 sources = [
2264 "example/SkiaSDLExample.cpp",
2265 ]
2266 libs = []
2267 include_dirs = []
2268 deps = [
2269 ":gpu_tool_utils",
2270 ":skia",
2271 "//third_party/libsdl",
2272 ]
2273 }
2274 }
2275
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002276 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2277 action_foreach("generate_mocs") {
2278 script = "gn/call.py"
2279 sources = [
2280 "tools/mdbviz/MainWindow.h",
2281 ]
2282 outputs = [
2283 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2284 ]
2285 args = [
2286 "$skia_qt_path" + "/bin/moc",
2287 "{{source}}",
2288 "-o",
2289 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2290 ]
2291 }
2292 action_foreach("generate_resources") {
2293 script = "gn/call.py"
2294 sources = [
2295 "tools/mdbviz/resources.qrc",
2296 ]
2297 outputs = [
2298 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2299 ]
2300 args = [
2301 "$skia_qt_path" + "/bin/rcc",
2302 "{{source}}",
2303 "-o",
2304 "gen/mdbviz/{{source_name_part}}_res.cpp",
2305 ]
2306 }
2307 test_app("mdbviz") {
2308 if (is_win) {
2309 # on Windows we need to disable some exception handling warnings due to the Qt headers
2310 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2311 }
2312 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002313 "tools/UrlDataManager.cpp",
2314 "tools/debugger/SkDebugCanvas.cpp",
2315 "tools/debugger/SkDrawCommand.cpp",
2316 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002317 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002318 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002319 "tools/mdbviz/main.cpp",
2320
2321 # generated files
2322 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2323 "$target_gen_dir/mdbviz/resources_res.cpp",
2324 ]
2325 lib_dirs = [ "$skia_qt_path/lib" ]
2326 libs = [
2327 "Qt5Core.lib",
2328 "Qt5Gui.lib",
2329 "Qt5Widgets.lib",
2330 ]
2331 include_dirs = [
2332 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002333 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002334 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002335 "tools",
2336 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002337 ]
2338 deps = [
2339 ":generate_mocs",
2340 ":generate_resources",
2341 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002342 "//third_party/jsoncpp",
2343 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002344 ]
2345 }
2346 }
2347
Mike Kleine459afd2017-03-03 09:21:30 -05002348 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002349 copy("gdbserver") {
2350 sources = [
2351 "$ndk/$ndk_gdbserver",
2352 ]
2353 outputs = [
2354 "$root_out_dir/gdbserver",
2355 ]
2356 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002357 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002358
2359 if (skia_use_opencl) {
2360 test_app("hello-opencl") {
2361 sources = [
2362 "src/compute/common/cl/assert_cl.c",
2363 "src/compute/common/cl/find_cl.c",
2364 "tools/hello-opencl.cpp",
2365 ]
2366 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002367 if (is_linux) {
2368 libs = [ "OpenCL" ]
2369 } else if (is_win) {
2370 libs = [ "OpenCL.lib" ]
2371 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002372 }
2373 }
mtklein25c81d42016-07-27 13:55:26 -07002374}