blob: 11b1943a47466e914f16a37bb3212128bccae623 [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 Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040029 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040030 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070031 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040032 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040033 skia_use_libheif = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Mike Reed0917fad2018-06-19 10:17:30 -040038 skia_enable_effects_imagefilters = true
Brian Osmanf2c90142017-07-13 15:50:03 -040039 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050040 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000041 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050042 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040043 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050044 skia_enable_tools = is_skia_dev_build
45 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040046 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040047 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070048 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
Hal Canary4689b542018-01-31 11:54:14 -050051 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050052 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040053
54 skia_llvm_path = ""
55 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040056
57 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070058}
Brian Salomon23d73ea2016-10-27 13:31:37 -040059declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040060 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040061 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050062 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040063
Mike Klein4d598a32016-10-31 13:44:49 -040064 if (is_android) {
65 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070066 } else if (is_fuchsia) {
67 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040068 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040069 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
70 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040071 }
Jim Van Verth4e502972017-12-07 15:16:10 -050072
73 if (is_ios) {
74 skia_ios_identity = ".*Google.*"
75 skia_ios_profile = "Google Development"
76 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040077}
Brian Salomon789e25e2016-09-30 13:41:03 -040078
Adam Barth54ef74a2017-10-13 10:59:38 -070079if (defined(skia_settings)) {
80 import(skia_settings)
81}
82
Brian Osmanc9a42472018-05-31 13:17:12 -040083# Our tools require static linking (they use non-exported symbols), and the GPU backend.
84skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070085
mtkleina45be612016-08-29 15:22:10 -070086fontmgr_android_enabled = skia_use_expat && skia_use_freetype
87
mtklein1211e0c2016-07-26 13:55:45 -070088skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070089 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070090 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070091 "include/codec",
92 "include/config",
93 "include/core",
94 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040095 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070096 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050097 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -070098 "include/pathops",
99 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700100 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/utils",
102 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700103]
104
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500105if (skia_enable_atlas_text) {
106 skia_public_includes += [ "include/atlastext" ]
107}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000108
mtkleinc04ff472016-06-23 10:29:30 -0700109# Skia public API, generally provided by :skia.
110config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700111 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400112 defines = []
113 if (is_component_build) {
114 defines += [ "SKIA_DLL" ]
115 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400116 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700117 defines += [ "SK_SAMPLES_FOR_X" ]
118 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400119 if (skia_enable_flutter_defines) {
120 defines += flutter_defines
121 }
mtklein06c35c02016-09-20 12:28:12 -0700122 if (!skia_enable_gpu) {
123 defines += [ "SK_SUPPORT_GPU=0" ]
124 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500125 if (skia_enable_atlas_text) {
126 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
127 }
mtkleinc04ff472016-06-23 10:29:30 -0700128}
129
130# Skia internal APIs, used by Skia itself and a few test tools.
131config("skia_private") {
132 visibility = [ ":*" ]
133
134 include_dirs = [
135 "include/private",
136 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700137 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700138 "src/core",
139 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700140 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700141 "src/image",
142 "src/images",
143 "src/lazy",
144 "src/opts",
145 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700146 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700147 "src/ports",
148 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400149 "src/shaders",
150 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700151 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700152 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700153 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500154 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700155 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700156 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400157 if (skia_llvm_path != "") {
158 include_dirs += [ "$skia_llvm_path/include" ]
159 }
mtklein150d1132016-08-01 06:56:40 -0700160
Mike Reeda9e241d2017-05-03 10:52:00 -0400161 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700162 if (is_android) {
163 defines += [
164 "SK_GAMMA_EXPONENT=1.4",
165 "SK_GAMMA_CONTRAST=0.0",
166 ]
167 }
mtklein88a7ac02016-09-14 11:16:49 -0700168 if (is_official_build || is_android) {
169 # TODO(bsalomon): it'd be nice to make Android normal.
170 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
171 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400172 libs = []
173 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500174 if (skia_enable_gpu) {
175 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500176 if (is_skia_dev_build && skia_use_vulkan) {
177 include_dirs += [ "tools/gpu/vk" ]
178 }
Brian Salomon03e05842017-02-23 12:23:47 -0500179 }
Brian Osman34755e22016-12-05 09:46:02 -0500180 if (skia_use_angle) {
181 defines += [ "SK_ANGLE" ]
182 }
Brian Osman3f375d02016-12-28 11:19:22 -0500183 if (skia_enable_discrete_gpu) {
184 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
185 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400186 if (!is_official_build) {
187 defines += [ "GR_TEST_UTILS=1" ]
188 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400189 if (skia_llvm_path != "") {
190 defines += [ "SK_LLVM_AVAILABLE" ]
191 include_dirs += [ "$skia_llvm_path/include" ]
192 libs += [ skia_llvm_lib ]
193 lib_dirs += [ "$skia_llvm_path/lib/" ]
194 }
mtkleinc04ff472016-06-23 10:29:30 -0700195}
196
197# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
198config("skia_library") {
199 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700200 defines = [ "SKIA_IMPLEMENTATION=1" ]
201}
202
203skia_library_configs = [
204 ":skia_public",
205 ":skia_private",
206 ":skia_library",
207]
208
mtklein9b8583d2016-08-24 17:32:30 -0700209# Use for CPU-specific Skia code that needs particular compiler flags.
210template("opts") {
211 if (invoker.enabled) {
212 source_set(target_name) {
213 forward_variables_from(invoker, "*")
214 configs += skia_library_configs
215 }
216 } else {
217 # If not enabled, a phony empty target that swallows all otherwise unused variables.
218 source_set(target_name) {
219 forward_variables_from(invoker,
220 "*",
221 [
222 "sources",
223 "cflags",
224 ])
225 }
226 }
anmittala7eaf2e2016-08-17 13:57:26 -0700227}
228
mtklein422310d2016-08-16 18:28:43 -0700229is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700230
mtklein7d6fb2c2016-08-25 14:50:44 -0700231opts("none") {
232 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700233 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700234 cflags = []
235}
236
mtklein7d6fb2c2016-08-25 14:50:44 -0700237opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700238 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700240 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700241}
242
243opts("arm64") {
244 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700245 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700246 cflags = []
247}
248
249opts("crc32") {
250 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700252 cflags = [ "-march=armv8-a+crc" ]
253}
254
mtklein9b8583d2016-08-24 17:32:30 -0700255opts("sse2") {
256 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400258 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400259 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
260 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400261 cflags = [ "-msse2" ]
262 }
mtklein9b8583d2016-08-24 17:32:30 -0700263}
mtkleinc04ff472016-06-23 10:29:30 -0700264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("ssse3") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-mssse3" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtkleinc04ff472016-06-23 10:29:30 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("sse41") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-msse4.1" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtklein4e976072016-08-08 09:06:27 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("sse42") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400289 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-msse4.2" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
294
295opts("avx") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400298 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000299 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400300 } else {
301 cflags = [ "-mavx" ]
302 }
mtkleinc04ff472016-06-23 10:29:30 -0700303}
304
Mike Klein1b9b7d52018-02-27 10:37:40 -0500305opts("hsw") {
306 enabled = is_x86
307 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400308 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500309 cflags = [ "/arch:AVX2" ]
310 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000311 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500312 }
313
314 # Oddly, clang-cl doesn't recognize this as a valid flag.
315 # If it ever does, it'd nice to move this up with -mavx2 and co.
316 if (is_clang && !is_win) {
317 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
318 # but nice to have, generating slightly better code for paths without explicit FMAs.
319 cflags += [ "-ffp-contract=fast" ]
320 }
321}
322
mtkleinc095df52016-08-24 12:23:52 -0700323# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700324template("optional") {
325 if (invoker.enabled) {
326 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700327 if (defined(invoker.public_defines)) {
328 defines = invoker.public_defines
329 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600330 if (defined(invoker.public_configs)) {
331 configs = invoker.public_configs
332 }
mtklein457b42a2016-08-23 13:56:37 -0700333 }
334 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700335 forward_variables_from(invoker,
336 "*",
337 [
338 "public_defines",
339 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700340 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700341 ])
mtklein457b42a2016-08-23 13:56:37 -0700342 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700343 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700344 if (defined(invoker.configs_to_remove)) {
345 configs -= invoker.configs_to_remove
346 }
mtklein457b42a2016-08-23 13:56:37 -0700347 }
348 } else {
mtklein457b42a2016-08-23 13:56:37 -0700349 source_set(target_name) {
350 forward_variables_from(invoker,
351 "*",
352 [
353 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400354 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700355 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700356 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700357 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700358 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700359 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700360 ])
mtkleincd01b032016-08-31 04:58:19 -0700361 if (defined(invoker.sources_when_disabled)) {
362 sources = invoker.sources_when_disabled
363 }
364 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700365 }
mtkleineb3c4252016-08-23 07:38:09 -0700366 }
mtklein457b42a2016-08-23 13:56:37 -0700367}
mtklein457b42a2016-08-23 13:56:37 -0700368
Mike Kleina04bb452017-02-09 12:24:07 -0500369optional("effects") {
370 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400371 deps = [
372 ":compile_processors",
373 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500374 sources =
375 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
Mike Reed0917fad2018-06-19 10:17:30 -0400376 if (skia_enable_effects_imagefilters) {
377 sources += skia_effects_imagefilter_sources
378 } else {
379 sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
380 }
381 sources_when_disabled = [
382 "src/ports/SkGlobalInitialization_none.cpp",
383 "src/ports/SkGlobalInitialization_none_imagefilters.cpp",
384 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500385}
386
mtkleina45be612016-08-29 15:22:10 -0700387optional("fontmgr_android") {
388 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700389
390 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500391 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700392 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700393 ]
394 sources = [
395 "src/ports/SkFontMgr_android.cpp",
396 "src/ports/SkFontMgr_android_factory.cpp",
397 "src/ports/SkFontMgr_android_parser.cpp",
398 ]
399}
400
mtkleind2e39db2016-09-07 07:52:55 -0700401optional("fontmgr_custom") {
402 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
403
404 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500405 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700406 ]
407 sources = [
408 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500409 "src/ports/SkFontMgr_custom.h",
410 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700411 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500412 "src/ports/SkFontMgr_custom_embedded.cpp",
413 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700414 ]
415}
416
Hal Canaryff2742e2018-01-30 11:35:47 -0500417optional("fontmgr_empty") {
418 enabled = skia_enable_fontmgr_empty
419 sources = [
420 "src/ports/SkFontMgr_empty_factory.cpp",
421 ]
422}
423
mtklein3cc22182016-08-29 13:26:14 -0700424optional("fontmgr_fontconfig") {
425 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700426
427 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500428 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700429 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700430 ]
431 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700432 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700433 "src/ports/SkFontConfigInterface_direct.cpp",
434 "src/ports/SkFontConfigInterface_direct_factory.cpp",
435 "src/ports/SkFontMgr_FontConfigInterface.cpp",
436 "src/ports/SkFontMgr_fontconfig.cpp",
437 "src/ports/SkFontMgr_fontconfig_factory.cpp",
438 ]
439}
440
mtkleincdedd0e2016-09-12 15:15:44 -0700441optional("fontmgr_fuchsia") {
442 enabled = is_fuchsia && skia_use_freetype
443
444 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500445 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700446 ]
447 sources = [
448 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500449 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700450 "src/ports/SkFontMgr_custom_empty_factory.cpp",
451 ]
452}
453
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700454if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400455 executable("sksllex") {
456 sources = [
457 "src/sksl/lex/Main.cpp",
458 "src/sksl/lex/NFA.cpp",
459 "src/sksl/lex/RegexNode.cpp",
460 "src/sksl/lex/RegexParser.cpp",
461 ]
462 include_dirs = [ "src/sksl/lex" ]
463 }
464
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700465 action("run_sksllex") {
466 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400467 deps = [
468 ":sksllex(//gn/toolchain:$host_toolchain)",
469 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700470 sources = [
471 "src/sksl/lex/layout.lex",
472 "src/sksl/lex/sksl.lex",
473 ]
474
475 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
476 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
477 outputs = [
478 "$target_out_dir/" +
479 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
480 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
481 # confused due to the same file being named by two different paths
482 ]
483 sksllex_path = "$root_out_dir/"
484 sksllex_path += "sksllex"
485 if (host_os == "win") {
486 sksllex_path += ".exe"
487 }
488 args = [
489 rebase_path(sksllex_path),
490 rebase_path("bin/clang-format"),
491 rebase_path("src"),
492 ]
493 }
494} else {
495 group("run_sksllex") {
496 }
497}
498
499if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400500 executable("skslc") {
501 defines = [ "SKSL_STANDALONE" ]
502 sources = [
503 "src/sksl/SkSLMain.cpp",
504 ]
505 sources += skia_sksl_sources
506 include_dirs = [
507 "src/gpu",
508 "src/sksl",
509 ]
510 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500511 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400512 "//third_party/spirv-tools",
513 ]
514 }
515
516 skia_gpu_processor_outputs = []
517 foreach(src, skia_gpu_processor_sources) {
518 dir = get_path_info(src, "dir")
519 name = get_path_info(src, "name")
520
521 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
522 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
523 skia_gpu_processor_outputs += [
524 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
525 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
526 # confused due to the same file being named by two different paths
527 ]
528 }
529
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500530 action("create_sksl_enums") {
531 script = "gn/create_sksl_enums.py"
532 sources = [
533 "include/private/GrSharedEnums.h",
534 ]
535 outputs = [
536 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500537 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500538 ]
539 args = [
540 rebase_path(sources[0]),
541 rebase_path(outputs[0]),
542 ]
543 }
544
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 action("compile_processors") {
546 script = "gn/compile_processors.py"
547 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500548 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400549 ":skslc(//gn/toolchain:$host_toolchain)",
550 ]
551 sources = skia_gpu_processor_sources
552 outputs = skia_gpu_processor_outputs
553 skslc_path = "$root_out_dir/"
554 if (host_toolchain != default_toolchain_name) {
555 skslc_path += "$host_toolchain/"
556 }
557 skslc_path += "skslc"
558 if (host_os == "win") {
559 skslc_path += ".exe"
560 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400561 args = [
562 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400563 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400564 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400565 args += rebase_path(skia_gpu_processor_sources)
566 }
567} else {
568 skia_gpu_processor_outputs = []
569 group("compile_processors") {
570 }
571}
572
mtklein06c35c02016-09-20 12:28:12 -0700573optional("gpu") {
574 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 deps = [
576 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700577 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400578 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700579 if (skia_generate_workarounds) {
580 deps += [ ":workaround_list" ]
581 }
mtkleine9fb3d52016-09-20 15:11:46 -0700582 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600583 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400584 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700585
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700587
588 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500589 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700590 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400591 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700592 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400593 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400594
595 # this lib is required to link against AHardwareBuffer
596 if (defined(ndk_api) && ndk_api >= 26) {
597 libs += [ "android" ]
598 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400599 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500600 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400601 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700602 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500603 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400604 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700605 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800607 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400609 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400611 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700612 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500613 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700614 }
mtkleine9fb3d52016-09-20 15:11:46 -0700615
616 if (skia_use_vulkan) {
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400617 # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
618 # //third_party/vulkan directory in their trees so they can set up the vulkan library however
619 # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
620 # vulkan files.
621 public_deps += [ "third_party/vulkan" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400622 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700623 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700624 if (skia_enable_vulkan_debug_layers) {
625 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
626 }
mtkleine9fb3d52016-09-20 15:11:46 -0700627 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400628
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400629 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400630 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400631 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
632 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400633
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400634 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400635 if (skia_use_metal) {
636 public_defines += [ "SK_METAL" ]
637 sources += skia_metal_sources
638 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400639 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400640 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500641
642 if (skia_enable_atlas_text) {
643 sources += skia_atlas_text_sources
644 }
mtklein06c35c02016-09-20 12:28:12 -0700645}
646
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400647optional("heif") {
648 enabled = skia_use_libheif
649 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
650
651 deps = []
652
653 sources = [
654 "src/codec/SkHeifCodec.cpp",
655 ]
656}
657
mtklein63213812016-08-24 09:55:56 -0700658optional("jpeg") {
659 enabled = skia_use_libjpeg_turbo
660 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
661
mtklein63213812016-08-24 09:55:56 -0700662 deps = [
663 "//third_party/libjpeg-turbo:libjpeg",
664 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400665 public = [
666 "include/encode/SkJpegEncoder.h",
667 ]
mtklein63213812016-08-24 09:55:56 -0700668 sources = [
669 "src/codec/SkJpegCodec.cpp",
670 "src/codec/SkJpegDecoderMgr.cpp",
671 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700672 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400673 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700674 ]
675}
676
677optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500678 enabled = skia_use_zlib && skia_enable_pdf
679 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700680
mtklein63213812016-08-24 09:55:56 -0700681 deps = [
682 "//third_party/zlib",
683 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400684 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700685 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400686 }
brettwb9447282016-09-01 14:24:39 -0700687 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700688 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700689
690 if (skia_use_sfntly) {
691 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500692 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700693 }
694}
695
696optional("png") {
697 enabled = skia_use_libpng
698 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
699
mtklein63213812016-08-24 09:55:56 -0700700 deps = [
701 "//third_party/libpng",
702 ]
703 sources = [
704 "src/codec/SkIcoCodec.cpp",
705 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400706 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700707 ]
708}
709
scroggof84ad642016-10-31 09:02:57 -0700710optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400711 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700712 public_defines = [ "SK_CODEC_DECODES_RAW" ]
713
714 deps = [
715 "//third_party/dng_sdk",
716 "//third_party/libjpeg-turbo:libjpeg",
717 "//third_party/piex",
718 ]
719
720 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
721 # Skia.
722 configs_to_remove = [ "//gn:no_exceptions" ]
723
724 sources = [
725 "src/codec/SkRawAdapterCodec.cpp",
726 "src/codec/SkRawCodec.cpp",
727 ]
728}
729
Mike Klein852a8cb2018-05-15 10:46:58 -0400730import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400731source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400732 cflags = []
733 if (!is_win || is_clang) {
734 cflags += [
735 "-w",
736 "-std=c11",
737 ]
738 }
739
740 public = [
741 "third_party/skcms/skcms.h",
742 ]
743 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
744}
745
mtklein3cc22182016-08-29 13:26:14 -0700746optional("typeface_freetype") {
747 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700748
749 deps = [
750 "//third_party/freetype2",
751 ]
752 sources = [
753 "src/ports/SkFontHost_FreeType.cpp",
754 "src/ports/SkFontHost_FreeType_common.cpp",
755 ]
756}
757
mtklein457b42a2016-08-23 13:56:37 -0700758optional("webp") {
759 enabled = skia_use_libwebp
760 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
761
mtklein457b42a2016-08-23 13:56:37 -0700762 deps = [
763 "//third_party/libwebp",
764 ]
765 sources = [
766 "src/codec/SkWebpAdapterCodec.cpp",
767 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400768 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700769 ]
mtkleineb3c4252016-08-23 07:38:09 -0700770}
771
mtklein63213812016-08-24 09:55:56 -0700772optional("xml") {
773 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000774 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700775
mtklein63213812016-08-24 09:55:56 -0700776 deps = [
777 "//third_party/expat",
778 ]
779 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500780 "src/svg/SkSVGCanvas.cpp",
781 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700782 "src/xml/SkDOM.cpp",
783 "src/xml/SkXMLParser.cpp",
784 "src/xml/SkXMLWriter.cpp",
785 ]
786}
787
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700788if (skia_enable_gpu && skia_generate_workarounds) {
789 action("workaround_list") {
790 script = "tools/build_workaround_header.py"
791
792 inputs = [
793 "src/gpu/gpu_workaround_list.txt",
794 ]
795
796 # see comments in skia_compile_processors about out dir path shenanigans.
797 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700798 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700799
800 outputs = [
801 "$root_out_dir/$output_file",
802 ]
803 args = [
804 "--output-file",
805 "$output_file",
806 ]
807
808 foreach(file, inputs) {
809 args += [ rebase_path(file, root_build_dir) ]
810 }
811 }
812}
813
mtkleinc04ff472016-06-23 10:29:30 -0700814component("skia") {
815 public_configs = [ ":skia_public" ]
816 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700817
818 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700819 ":arm64",
820 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700821 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700822 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500823 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700824 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700825 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500826 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700827 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700828 ":fontmgr_fuchsia",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400829 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500830 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700831 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700832 ":none",
mtklein63213812016-08-24 09:55:56 -0700833 ":pdf",
834 ":png",
scroggof84ad642016-10-31 09:02:57 -0700835 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500836 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700837 ":sse2",
838 ":sse41",
839 ":sse42",
840 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700841 ":webp",
mtklein63213812016-08-24 09:55:56 -0700842 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700843 ]
844
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400845 # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
846 # need to get propagated up to the tools that depend on :skia and thus :gpu.
847 public_deps = [
848 ":gpu",
849 ]
850
Chinmay Garde43f115c2016-11-16 15:04:12 -0800851 # This file (and all GN files in Skia) are designed to work with an
852 # empty sources assignment filter; we handle all that explicitly.
853 # We clear the filter here for clients who may have set up a global filter.
854 set_sources_assignment_filter([])
855
mtkleinc04ff472016-06-23 10:29:30 -0700856 sources = []
brettwb9447282016-09-01 14:24:39 -0700857 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700858 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500859 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700860 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400861 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500862 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700863 "src/android/SkBitmapRegionCodec.cpp",
864 "src/android/SkBitmapRegionDecoder.cpp",
865 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400866 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700867 "src/codec/SkBmpCodec.cpp",
868 "src/codec/SkBmpMaskCodec.cpp",
869 "src/codec/SkBmpRLECodec.cpp",
870 "src/codec/SkBmpStandardCodec.cpp",
871 "src/codec/SkCodec.cpp",
872 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400873 "src/codec/SkColorTable.cpp",
scroggo19b91532016-10-24 09:03:26 -0700874 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700875 "src/codec/SkMaskSwizzler.cpp",
876 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700877 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700878 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700879 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700880 "src/codec/SkSwizzler.cpp",
881 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700882 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700883 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700884 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700885 "src/ports/SkMemory_malloc.cpp",
886 "src/ports/SkOSFile_stdio.cpp",
887 "src/sfnt/SkOTTable_name.cpp",
888 "src/sfnt/SkOTUtils.cpp",
889 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700890 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700891 ]
brettwb9447282016-09-01 14:24:39 -0700892
mtklein7d6fb2c2016-08-25 14:50:44 -0700893 libs = []
894
mtkleinc04ff472016-06-23 10:29:30 -0700895 if (is_win) {
896 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400897 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700898 "src/ports/SkDebug_win.cpp",
899 "src/ports/SkFontHost_win.cpp",
900 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500901 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700902 "src/ports/SkImageEncoder_WIC.cpp",
903 "src/ports/SkImageGeneratorWIC.cpp",
904 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700905 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700906 "src/ports/SkScalerContext_win_dw.cpp",
907 "src/ports/SkTLS_win.cpp",
908 "src/ports/SkTypeface_win_dw.cpp",
909 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400910 libs += [
911 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500912 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400913 "Ole32.lib",
914 "OleAut32.lib",
915 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500916 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400917 ]
mtkleinc04ff472016-06-23 10:29:30 -0700918 } else {
919 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700920 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700921 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700922 "src/ports/SkTLS_pthread.cpp",
923 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400924 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700925 }
926
mtklein7d6fb2c2016-08-25 14:50:44 -0700927 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500928 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500929 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500930 deps += [ "//third_party/cpu-features" ]
931 }
mtklein06c35c02016-09-20 12:28:12 -0700932 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700933 libs += [
934 "EGL",
935 "GLESv2",
936 "log",
937 ]
938 }
939
mtkleinc04ff472016-06-23 10:29:30 -0700940 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700941 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400942 if (skia_use_egl) {
943 libs += [ "GLESv2" ]
944 }
mtkleinc04ff472016-06-23 10:29:30 -0700945 }
946
947 if (is_mac) {
948 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700949 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700950 "src/ports/SkFontHost_mac.cpp",
951 "src/ports/SkImageEncoder_CG.cpp",
952 "src/ports/SkImageGeneratorCG.cpp",
953 ]
mtklein09e61f72016-08-23 13:35:28 -0700954 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400955 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
956 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700957 "ApplicationServices.framework",
958 "OpenGL.framework",
959 ]
mtkleinc04ff472016-06-23 10:29:30 -0700960 }
abarth6fc8ff02016-07-15 15:15:15 -0700961
Mike Klein7d302882016-11-03 14:06:31 -0400962 if (is_ios) {
963 sources += [
964 "src/ports/SkDebug_stdio.cpp",
965 "src/ports/SkFontHost_mac.cpp",
966 "src/ports/SkImageEncoder_CG.cpp",
967 "src/ports/SkImageGeneratorCG.cpp",
968 ]
969 libs += [
970 "CoreFoundation.framework",
971 "CoreGraphics.framework",
972 "CoreText.framework",
973 "ImageIO.framework",
974 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400975
976 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
977 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400978 ]
979 }
980
abarth6fc8ff02016-07-15 15:15:15 -0700981 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700982 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700983 }
mtkleinc04ff472016-06-23 10:29:30 -0700984}
985
mtkleinc095df52016-08-24 12:23:52 -0700986# Targets guarded by skia_enable_tools may use //third_party freely.
987if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500988 # Used by gn_to_bp.py to list our public include dirs.
989 source_set("public") {
990 configs += [ ":skia_public" ]
991 }
992
Mike Kleinc36dedf2016-11-18 09:35:28 -0500993 config("skia.h_config") {
994 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500995 if (skia_use_vulkan) {
996 # So we can get the header which includes vulkan
997 include_dirs += [ "tools/gpu/vk" ]
998 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500999 }
1000 action("skia.h") {
1001 public_configs = [ ":skia.h_config" ]
1002 skia_h = "$target_gen_dir/skia.h"
1003 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001004
1005 # TODO: would be cool to not hard-code these here, but how?
1006 module_public_includes = [
1007 "modules/sksg/include",
1008 "modules/skottie/include",
1009 ]
1010 args =
1011 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1012 [ rebase_path(skia_h, root_build_dir) ] +
1013 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001014 depfile = "$skia_h.deps"
1015 outputs = [
1016 skia_h,
1017 ]
1018 }
1019
Brian Osmanc9a42472018-05-31 13:17:12 -04001020 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001021 executable("fiddle") {
1022 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001023 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001024 "tools/fiddle/draw.cpp",
1025 "tools/fiddle/fiddle_main.cpp",
1026 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001027
1028 if (skia_use_egl) {
1029 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001030 } else {
1031 sources += [ "tools/fiddle/null_context.cpp" ]
1032 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001033 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001034 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001035 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001036 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001037 ":skia",
1038 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001039 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001040 ]
1041 }
1042 }
1043
Brian Osmanc9a42472018-05-31 13:17:12 -04001044 source_set("public_headers_warnings_check") {
1045 sources = [
1046 "tools/public_headers_warnings_check.cpp",
1047 ]
1048 configs -= [ "//gn:warnings_except_public_headers" ]
1049 deps = [
1050 ":skia",
1051 ":skia.h",
1052 "modules/skottie",
1053 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001054 }
1055
mtkleinc095df52016-08-24 12:23:52 -07001056 template("test_lib") {
1057 config(target_name + "_config") {
1058 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001059 if (defined(invoker.public_defines)) {
1060 defines = invoker.public_defines
1061 }
mtklein25c81d42016-07-27 13:55:26 -07001062 }
mtkleinc095df52016-08-24 12:23:52 -07001063 source_set(target_name) {
1064 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1065 public_configs = [
1066 ":" + target_name + "_config",
1067 ":skia_private",
1068 ]
1069
1070 if (!defined(deps)) {
1071 deps = []
1072 }
1073 deps += [ ":skia" ]
1074 testonly = true
1075 }
mtklein25c81d42016-07-27 13:55:26 -07001076 }
mtklein25c81d42016-07-27 13:55:26 -07001077
Mike Kleine6682eb2017-01-05 10:54:57 -05001078 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001079 if (is_ios) {
1080 app_name = target_name
1081 gen_path = target_gen_dir
1082
1083 action("${app_name}_generate_info_plist") {
1084 script = "//gn/gen_plist_ios.py"
1085 outputs = [
1086 "$gen_path/${app_name}_Info.plist",
1087 ]
1088 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1089 }
1090
1091 bundle_data("${app_name}_bundle_info_plist") {
1092 public_deps = [
1093 ":${app_name}_generate_info_plist",
1094 ]
1095 sources = [
1096 "$gen_path/${app_name}_Info.plist",
1097 ]
1098 outputs = [
1099 "{{bundle_root_dir}}/Info.plist",
1100 ]
1101 }
1102
Jim Van Verth329c5a62017-11-29 11:42:33 -05001103 bundle_ios_data =
1104 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1105
1106 if (bundle_ios_data) {
1107 has_skps =
1108 "True" == exec_script("//gn/checkdir.py",
1109 [ rebase_path("skps", root_build_dir) ],
1110 "trim string")
1111 bundle_data("${app_name}_bundle_resources") {
1112 sources = [
1113 "resources",
1114 ]
1115 outputs = [
1116 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1117 "{{bundle_resources_dir}}/data/resources",
1118 ]
1119 }
1120
1121 if (has_skps) {
1122 bundle_data("${app_name}_bundle_skps") {
1123 sources = [
1124 "skps",
1125 ]
1126 outputs = [
1127 # Store in same folder as resources
1128 "{{bundle_resources_dir}}/data/skps",
1129 ]
1130 }
1131 }
1132 }
1133
Jim Van Verth443a9132017-11-28 09:45:26 -05001134 executable("${app_name}_generate_executable") {
1135 forward_variables_from(invoker,
1136 "*",
1137 [
1138 "output_name",
1139 "visibility",
1140 "is_shared_library",
1141 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001142 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001143 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001144 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1145 }
1146
1147 bundle_data("${app_name}_bundle_executable") {
1148 public_deps = [
1149 ":${app_name}_generate_executable",
1150 ]
1151 sources = [
1152 "$gen_path/$app_name",
1153 ]
1154 outputs = [
1155 "{{bundle_executable_dir}}/$app_name",
1156 ]
1157 testonly = true
1158 }
1159
1160 create_bundle("$app_name") {
1161 product_type = "com.apple.product-type.application"
1162 testonly = true
1163
1164 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1165 bundle_resources_dir = bundle_root_dir
1166 bundle_executable_dir = bundle_root_dir
1167 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1168
1169 deps = [
1170 ":${app_name}_bundle_executable",
1171 ":${app_name}_bundle_info_plist",
1172 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001173 if (bundle_ios_data) {
1174 deps += [ ":${app_name}_bundle_resources" ]
1175 if (has_skps) {
1176 deps += [ ":${app_name}_bundle_skps" ]
1177 }
1178 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001179
1180 # should only code sign when running on a device, not the simulator
1181 if (target_cpu != "x64") {
1182 code_signing_script = "//gn/codesign_ios.py"
1183 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1184 code_signing_outputs = [
1185 "$bundle_root_dir/_CodeSignature/CodeResources",
1186 "$bundle_root_dir/embedded.mobileprovision",
1187 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001188 code_signing_args = [
1189 rebase_path("$bundle_root_dir", root_build_dir),
1190 skia_ios_identity,
1191 skia_ios_profile,
1192 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001193 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001194 }
1195 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001196 # !is_ios
1197
1198 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1199 shared_library("lib" + target_name) {
1200 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1201 configs += [ ":skia_private" ]
1202 testonly = true
1203 }
1204 } else {
1205 _executable = target_name
1206 executable(_executable) {
1207 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1208 configs += [ ":skia_private" ]
1209 testonly = true
1210 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001211 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001212 if (is_android && skia_android_serial != "" && defined(_executable)) {
1213 action("push_" + target_name) {
1214 script = "gn/push_to_android.py"
1215 deps = [
1216 ":" + _executable,
1217 ]
1218 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1219 outputs = [
1220 _stamp,
1221 ]
1222 args = [
1223 rebase_path("$root_build_dir/$_executable"),
1224 skia_android_serial,
1225 rebase_path(_stamp),
1226 ]
1227 testonly = true
1228 }
Mike Klein7d921032017-01-05 12:20:41 -05001229 }
1230 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001231 }
1232
mtkleinc095df52016-08-24 12:23:52 -07001233 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001234 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001235 public_defines = []
1236 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001237
Brian Osmanc9a42472018-05-31 13:17:12 -04001238 deps = []
1239 sources = [
1240 "tools/gpu/GrContextFactory.cpp",
1241 "tools/gpu/GrTest.cpp",
1242 "tools/gpu/ProxyUtils.cpp",
1243 "tools/gpu/TestContext.cpp",
1244 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1245 "tools/gpu/gl/GLTestContext.cpp",
1246 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
1247 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1248 "tools/gpu/gl/debug/GrBufferObj.cpp",
1249 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1250 "tools/gpu/gl/debug/GrProgramObj.cpp",
1251 "tools/gpu/gl/debug/GrShaderObj.cpp",
1252 "tools/gpu/gl/debug/GrTextureObj.cpp",
1253 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1254 "tools/gpu/gl/null/NullGLTestContext.cpp",
1255 "tools/gpu/mock/MockTestContext.cpp",
1256 ]
1257 libs = []
1258
1259 if (is_android || skia_use_egl) {
1260 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1261 } else if (is_ios) {
1262 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1263 libs += [ "OpenGLES.framework" ]
1264 } else if (is_linux) {
1265 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001266 libs += [
1267 "GLU",
1268 "X11",
1269 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001270 } else if (is_mac) {
1271 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1272 } else if (is_win) {
1273 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1274 libs += [
1275 "Gdi32.lib",
1276 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001277 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001278 }
mtklein25c81d42016-07-27 13:55:26 -07001279
Brian Osmanc9a42472018-05-31 13:17:12 -04001280 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001281
Brian Osmanc9a42472018-05-31 13:17:12 -04001282 if (skia_use_angle) {
1283 deps += [ "//third_party/angle2" ]
1284 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1285 }
1286 if (skia_use_vulkan) {
1287 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1288 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
1289 }
1290 if (skia_use_metal) {
1291 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001292 }
mtklein25c81d42016-07-27 13:55:26 -07001293 }
mtklein25c81d42016-07-27 13:55:26 -07001294
mtkleinc095df52016-08-24 12:23:52 -07001295 test_lib("flags") {
1296 public_include_dirs = [ "tools/flags" ]
1297 sources = [
1298 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001299 ]
1300 }
1301 test_lib("common_flags") {
1302 public_include_dirs = [ "tools/flags" ]
1303 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001304 "tools/flags/SkCommonFlags.cpp",
1305 "tools/flags/SkCommonFlagsConfig.cpp",
1306 ]
1307 deps = [
mtklein046cb562016-09-16 10:23:12 -07001308 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001309 ":gpu_tool_utils",
1310 ]
1311 }
mtklein25c81d42016-07-27 13:55:26 -07001312
mtkleinc095df52016-08-24 12:23:52 -07001313 test_lib("tool_utils") {
1314 public_include_dirs = [
1315 "tools",
1316 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001317 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001318 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001319 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001320 ]
1321 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001322 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001323 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001324 "tools/DDLPromiseImageHelper.cpp",
1325 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001326 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001327 "tools/ProcStats.cpp",
1328 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001329 "tools/UrlDataManager.cpp",
1330 "tools/debugger/SkDebugCanvas.cpp",
1331 "tools/debugger/SkDrawCommand.cpp",
1332 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001333 "tools/fonts/SkRandomScalerContext.cpp",
1334 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001335 "tools/fonts/SkTestFontMgr.h",
1336 "tools/fonts/SkTestSVGTypeface.cpp",
1337 "tools/fonts/SkTestSVGTypeface.h",
1338 "tools/fonts/SkTestTypeface.cpp",
1339 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001340 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001341 "tools/picture_utils.cpp",
1342 "tools/random_parse_path.cpp",
1343 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001344 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001345 "tools/trace/SkChromeTracingTracer.cpp",
1346 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001347 "tools/trace/SkDebugfTracer.cpp",
1348 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001349 "tools/trace/SkEventTracingPriv.cpp",
1350 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001351 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001352 libs = []
1353 if (is_ios) {
1354 sources += [ "tools/ios_utils.m" ]
1355 libs += [ "Foundation.framework" ]
1356 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001357 defines = []
1358 if (skia_tools_require_resources) {
1359 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1360 }
mtkleinc095df52016-08-24 12:23:52 -07001361 deps = [
mtklein046cb562016-09-16 10:23:12 -07001362 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001363 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001364 ":flags",
1365 "//third_party/libpng",
1366 ]
1367 public_deps = [
1368 "//third_party/jsoncpp",
1369 ]
1370 }
mtklein25c81d42016-07-27 13:55:26 -07001371
Mike Klein6e744122016-10-27 12:21:40 -04001372 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001373 test_lib("gm") {
1374 public_include_dirs = [ "gm" ]
1375 sources = gm_sources
1376 deps = [
scroggo19b91532016-10-24 09:03:26 -07001377 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001378 ":gpu_tool_utils",
1379 ":skia",
1380 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001381 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001382 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001383 ]
1384 }
mtklein25c81d42016-07-27 13:55:26 -07001385
Mike Klein6e744122016-10-27 12:21:40 -04001386 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001387 test_lib("tests") {
1388 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001389 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001390 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001391 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001392 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001393 if (!(skia_use_freetype && skia_use_fontconfig)) {
1394 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1395 }
mtkleinc095df52016-08-24 12:23:52 -07001396 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001397 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001398 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001399 ":skia",
1400 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001401 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001402 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001403 "//third_party/libpng",
1404 "//third_party/zlib",
1405 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001406 public_deps = [
1407 ":gpu_tool_utils", # Test.h #includes headers from this target.
1408 ]
mtkleinc095df52016-08-24 12:23:52 -07001409 }
mtklein2f3416d2016-08-02 16:02:05 -07001410
Mike Klein6e744122016-10-27 12:21:40 -04001411 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001412 test_lib("bench") {
1413 public_include_dirs = [ "bench" ]
1414 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001415 deps = [
1416 ":flags",
1417 ":gm",
1418 ":gpu_tool_utils",
1419 ":skia",
1420 ":tool_utils",
1421 ]
1422 }
mtklein2b6870c2016-07-28 14:17:33 -07001423
mtkleinc095df52016-08-24 12:23:52 -07001424 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001425 public_include_dirs = []
1426 if (skia_use_expat) {
1427 public_include_dirs += [ "experimental/svg/model" ]
1428 sources = [
1429 "experimental/svg/model/SkSVGAttribute.cpp",
1430 "experimental/svg/model/SkSVGAttributeParser.cpp",
1431 "experimental/svg/model/SkSVGCircle.cpp",
1432 "experimental/svg/model/SkSVGClipPath.cpp",
1433 "experimental/svg/model/SkSVGContainer.cpp",
1434 "experimental/svg/model/SkSVGDOM.cpp",
1435 "experimental/svg/model/SkSVGEllipse.cpp",
1436 "experimental/svg/model/SkSVGGradient.cpp",
1437 "experimental/svg/model/SkSVGLine.cpp",
1438 "experimental/svg/model/SkSVGLinearGradient.cpp",
1439 "experimental/svg/model/SkSVGNode.cpp",
1440 "experimental/svg/model/SkSVGPath.cpp",
1441 "experimental/svg/model/SkSVGPattern.cpp",
1442 "experimental/svg/model/SkSVGPoly.cpp",
1443 "experimental/svg/model/SkSVGRadialGradient.cpp",
1444 "experimental/svg/model/SkSVGRect.cpp",
1445 "experimental/svg/model/SkSVGRenderContext.cpp",
1446 "experimental/svg/model/SkSVGSVG.cpp",
1447 "experimental/svg/model/SkSVGShape.cpp",
1448 "experimental/svg/model/SkSVGStop.cpp",
1449 "experimental/svg/model/SkSVGTransformableNode.cpp",
1450 "experimental/svg/model/SkSVGUse.cpp",
1451 "experimental/svg/model/SkSVGValue.cpp",
1452 ]
1453 deps = [
1454 ":skia",
1455 ":xml",
1456 ]
1457 }
mtkleinc095df52016-08-24 12:23:52 -07001458 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001459
Kevin Lubickebf648e2017-09-21 13:45:16 -04001460 if (target_cpu != "wasm") {
1461 test_lib("views") {
1462 public_include_dirs = [ "include/views" ]
1463 sources = [
1464 "src/views/SkEvent.cpp",
1465 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001466 "src/views/SkTouchGesture.cpp",
1467 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001468 ]
Brian Osman34755e22016-12-05 09:46:02 -05001469 }
Brian Osman16adfa32016-10-18 14:42:44 -04001470 }
1471
Mike Klein38af9432016-11-11 11:39:44 -05001472 if (skia_use_lua) {
1473 test_lib("lua") {
1474 public_include_dirs = []
1475 sources = [
1476 "src/utils/SkLua.cpp",
1477 "src/utils/SkLuaCanvas.cpp",
1478 ]
1479 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001480 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001481 "//third_party/lua",
1482 ]
1483 }
1484
Mike Kleine6682eb2017-01-05 10:54:57 -05001485 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001486 sources = [
1487 "tools/lua/lua_app.cpp",
1488 ]
1489 deps = [
1490 ":lua",
1491 ":skia",
1492 "//third_party/lua",
1493 ]
Mike Klein38af9432016-11-11 11:39:44 -05001494 }
1495
Mike Kleine6682eb2017-01-05 10:54:57 -05001496 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001497 sources = [
1498 "tools/lua/lua_pictures.cpp",
1499 ]
1500 deps = [
1501 ":flags",
1502 ":lua",
1503 ":skia",
1504 ":tool_utils",
1505 "//third_party/lua",
1506 ]
Mike Klein38af9432016-11-11 11:39:44 -05001507 }
1508 }
1509
Cary Clark8032b982017-07-28 11:04:54 -04001510 test_app("bookmaker") {
1511 sources = [
1512 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001513 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001514 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001515 "tools/bookmaker/fiddleParser.cpp",
1516 "tools/bookmaker/includeParser.cpp",
1517 "tools/bookmaker/includeWriter.cpp",
1518 "tools/bookmaker/mdOut.cpp",
1519 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001520 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001521 "tools/bookmaker/spellCheck.cpp",
1522 ]
1523 deps = [
1524 ":flags",
1525 ":skia",
1526 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001527 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001528 ]
1529 }
1530
Florin Malitae2aa7b62018-06-06 09:37:26 -04001531 if (is_linux) {
Florin Malita79725d32018-06-05 16:16:57 -04001532 test_app("skottie_tool") {
1533 deps = [
1534 "modules/skottie:tool",
1535 ]
1536 }
1537 }
1538
Kevin Lubickebf648e2017-09-21 13:45:16 -04001539 if (target_cpu != "wasm") {
1540 import("gn/samples.gni")
1541 test_lib("samples") {
1542 public_include_dirs = [ "samplecode" ]
1543 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001544 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001545 deps = [
1546 ":experimental_svg_model",
1547 ":flags",
1548 ":gm",
1549 ":tool_utils",
1550 ":views",
1551 ":xml",
Brian Osmanccb87522018-06-01 19:20:00 +00001552 "modules/sksg:samples",
Herb Derby264182c2018-05-29 15:53:40 -04001553 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001554 ]
Mike Klein38af9432016-11-11 11:39:44 -05001555
Ruiqi Maof5101492018-06-29 14:32:21 -04001556 # NIMA does not build on Windows clang
1557 if (!is_win || !is_clang) {
1558 deps += [ "//third_party/Nima-Cpp" ]
1559 }
1560
Kevin Lubickebf648e2017-09-21 13:45:16 -04001561 if (skia_use_lua) {
1562 sources += [ "samplecode/SampleLua.cpp" ]
1563 deps += [
1564 ":lua",
1565 "//third_party/lua",
1566 ]
1567 }
1568 }
1569 test_app("dm") {
1570 sources = [
1571 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001572 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001573 "dm/DMJsonWriter.cpp",
1574 "dm/DMSrcSink.cpp",
1575 ]
1576 include_dirs = [ "tests" ]
1577 deps = [
1578 ":common_flags",
1579 ":experimental_svg_model",
1580 ":flags",
1581 ":gm",
1582 ":gpu_tool_utils",
1583 ":skia",
1584 ":tests",
1585 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001586 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001587 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001588 "//third_party/jsoncpp",
1589 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001590 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001591
1592 # NIMA does not build on Windows clang
1593 if (!is_win || !is_clang) {
1594 deps += [ "//third_party/Nima-Cpp" ]
1595 }
Mike Klein38af9432016-11-11 11:39:44 -05001596 }
Brian Osman16adfa32016-10-18 14:42:44 -04001597 }
1598
Mike Kleina8a51ce2018-01-09 12:34:11 -05001599 if (!is_win) {
1600 test_app("remote_demo") {
1601 sources = [
1602 "tools/remote_demo.cpp",
1603 ]
1604 deps = [
1605 ":skia",
1606 ]
1607 }
1608 }
1609
Mike Kleine6682eb2017-01-05 10:54:57 -05001610 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001611 sources = [
1612 "bench/nanobench.cpp",
1613 ]
1614 deps = [
1615 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001616 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001617 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001618 ":flags",
1619 ":gm",
1620 ":gpu_tool_utils",
1621 ":skia",
1622 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001623 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001624 "//third_party/jsoncpp",
1625 ]
mtklein2b6870c2016-07-28 14:17:33 -07001626 }
halcanary19a97202016-08-03 15:08:04 -07001627
Ravi Mistry10d36c52017-01-31 09:49:18 -05001628 test_app("skpinfo") {
1629 sources = [
1630 "tools/skpinfo.cpp",
1631 ]
1632 deps = [
1633 ":flags",
1634 ":skia",
1635 ]
1636 }
1637
Brian Osmanc9a42472018-05-31 13:17:12 -04001638 test_app("skpbench") {
1639 sources = [
1640 "tools/skpbench/skpbench.cpp",
1641 ]
1642 deps = [
1643 ":flags",
1644 ":gpu_tool_utils",
1645 ":skia",
1646 ":tool_utils",
1647 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001648 }
1649
Mike Kleine6682eb2017-01-05 10:54:57 -05001650 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001651 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001652 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001653 ]
1654 deps = [
1655 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001656 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001657 ]
halcanary3eee9d92016-09-10 07:01:53 -07001658 }
mtklein046cb562016-09-16 10:23:12 -07001659
Matt Sarett9f1c4032017-05-17 10:06:32 -04001660 test_app("create_flutter_test_images") {
1661 sources = [
1662 "tools/create_flutter_test_images.cpp",
1663 ]
1664 deps = [
1665 ":skia",
1666 ":tool_utils",
1667 ]
1668 }
1669
Ben Wagner219f3622017-07-17 15:32:25 -04001670 test_app("create_test_font") {
1671 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001672 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001673 ]
1674 deps = [
1675 ":skia",
1676 ]
1677 assert_no_deps = [
1678 # tool_utils requires the output of this app.
1679 ":tool_utils",
1680 ]
1681 }
1682
Ben Wagner97182cc2018-02-15 10:20:04 -05001683 test_app("create_test_font_color") {
1684 sources = [
1685 "tools/fonts/create_test_font_color.cpp",
1686 ]
1687 deps = [
1688 ":flags",
1689 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001690 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001691 ]
1692 }
1693
Mike Kleine6682eb2017-01-05 10:54:57 -05001694 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001695 sources = [
1696 "tools/get_images_from_skps.cpp",
1697 ]
1698 deps = [
1699 ":flags",
1700 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001701 ]
mtklein046cb562016-09-16 10:23:12 -07001702 }
mtkleinecbc5262016-09-22 11:51:24 -07001703
Kevin Lubickebf648e2017-09-21 13:45:16 -04001704 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001705 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001706 sources = [
1707 "tools/skiaserve/Request.cpp",
1708 "tools/skiaserve/Response.cpp",
1709 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001710 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1711 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1712 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1713 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1714 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1715 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1716 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1717 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1718 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001719 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1720 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001721 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1722 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1723 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1724 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1725 ]
1726 deps = [
1727 ":flags",
1728 ":gpu_tool_utils",
1729 ":skia",
1730 ":tool_utils",
1731 "//third_party/jsoncpp",
1732 "//third_party/libmicrohttpd",
1733 "//third_party/libpng",
1734 ]
Mike Klein7d302882016-11-03 14:06:31 -04001735 }
mtkleinecbc5262016-09-22 11:51:24 -07001736 }
kjlubick14f984b2016-10-03 11:49:45 -07001737
Mike Kleine6682eb2017-01-05 10:54:57 -05001738 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001739 include_dirs = [
1740 "tools",
1741 "tools/debugger",
1742 ]
kjlubick14f984b2016-10-03 11:49:45 -07001743 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001744 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001745 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001746 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001747 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001748 "fuzz/FuzzGradients.cpp",
1749 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001750 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001751 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001752 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001753 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001754 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001755 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1756 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001757 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001758 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001759 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001760 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1761 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001762 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001763 "tools/UrlDataManager.cpp",
1764 "tools/debugger/SkDebugCanvas.cpp",
1765 "tools/debugger/SkDrawCommand.cpp",
1766 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001767 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001768 ]
1769 deps = [
1770 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001771 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001772 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001773 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001774 "//third_party/jsoncpp",
1775 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001776 ]
kjlubick14f984b2016-10-03 11:49:45 -07001777 }
Mike Klein38312422016-10-05 15:41:01 -04001778
Mike Kleine6682eb2017-01-05 10:54:57 -05001779 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001780 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001781 rebase_path("tests/skia_test.cpp"),
1782 rebase_path("tests/Test.cpp"),
1783 ]
caryclark9feb6322016-10-25 08:58:26 -07001784 deps = [
1785 ":flags",
1786 ":gpu_tool_utils",
1787 ":skia",
1788 ":tool_utils",
1789 ]
caryclark9feb6322016-10-25 08:58:26 -07001790 }
1791
Mike Kleine6682eb2017-01-05 10:54:57 -05001792 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001793 sources = [
1794 "tools/DumpRecord.cpp",
1795 "tools/dump_record.cpp",
1796 ]
1797 deps = [
1798 ":flags",
1799 ":skia",
1800 ]
Mike Klein38312422016-10-05 15:41:01 -04001801 }
bungemanfe917272016-10-13 17:36:40 -04001802
Mike Kleine6682eb2017-01-05 10:54:57 -05001803 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001804 sources = [
1805 "tools/skdiff/skdiff.cpp",
1806 "tools/skdiff/skdiff_html.cpp",
1807 "tools/skdiff/skdiff_main.cpp",
1808 "tools/skdiff/skdiff_utils.cpp",
1809 ]
1810 deps = [
1811 ":skia",
1812 ":tool_utils",
1813 ]
bungemanfe917272016-10-13 17:36:40 -04001814 }
halcanarya73d76a2016-10-17 13:19:02 -07001815
Mike Kleine6682eb2017-01-05 10:54:57 -05001816 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001817 sources = [
1818 "tools/skp_parser.cpp",
1819 ]
1820 deps = [
1821 ":skia",
1822 ":tool_utils",
1823 "//third_party/jsoncpp",
1824 ]
halcanarya73d76a2016-10-17 13:19:02 -07001825 }
Brian Osman16adfa32016-10-18 14:42:44 -04001826
Brian Osmanc9a42472018-05-31 13:17:12 -04001827 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001828 test_lib("skqp_lib") {
1829 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001830 defines =
1831 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001832 if (skia_skqp_enable_driver_correctness_workarounds) {
1833 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1834 }
Hal Canary75427132017-10-11 16:00:31 -04001835 sources = [
1836 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001837 "tools/skqp/gm_knowledge.cpp",
1838 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001839 ]
1840 deps = [
1841 ":gm",
1842 ":gpu_tool_utils",
1843 ":skia",
1844 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001845 ":tool_utils",
1846 ]
1847 }
1848 test_app("skqp") {
1849 sources = [
1850 "tools/skqp/skqp.cpp",
1851 ]
1852 deps = [
1853 ":skia",
1854 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001855 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001856 "//third_party/googletest",
1857 ]
1858 }
1859 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001860 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001861 test_app("skqp_app") {
1862 is_shared_library = true
1863 sources = [
1864 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1865 ]
1866 deps = [
1867 ":skia",
1868 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001869 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001870 ]
1871 libs = [ "android" ]
1872 }
1873 }
Hal Canary75427132017-10-11 16:00:31 -04001874
Hal Canarya9de7602018-01-19 13:08:23 -05001875 test_app("list_gms") {
1876 sources = [
1877 "tools/list_gms.cpp",
1878 ]
1879 deps = [
1880 ":gm",
1881 ":skia",
1882 ]
1883 }
1884 test_app("list_gpu_unit_tests") {
1885 sources = [
1886 "dm/DMGpuTestProcs.cpp",
1887 "tools/list_gpu_unit_tests.cpp",
1888 ]
1889 deps = [
1890 ":skia",
1891 ":tests",
1892 ]
1893 }
1894
Brian Osmanc9a42472018-05-31 13:17:12 -04001895 test_lib("sk_app") {
1896 public_include_dirs = [ "tools/sk_app" ]
1897 sources = [
1898 "tools/sk_app/CommandSet.cpp",
1899 "tools/sk_app/GLWindowContext.cpp",
1900 "tools/sk_app/Window.cpp",
1901 ]
1902 libs = []
1903
1904 if (is_android) {
1905 sources += [
1906 "tools/sk_app/android/GLWindowContext_android.cpp",
1907 "tools/sk_app/android/RasterWindowContext_android.cpp",
1908 "tools/sk_app/android/Window_android.cpp",
1909 "tools/sk_app/android/main_android.cpp",
1910 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001911 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001912 libs += [ "android" ]
1913 } else if (is_linux) {
1914 sources += [
1915 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1916 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1917 "tools/sk_app/unix/Window_unix.cpp",
1918 "tools/sk_app/unix/keysym2ucs.c",
1919 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001920 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001921 libs += [
1922 "GL",
1923 "X11",
1924 ]
1925 } else if (is_win) {
1926 sources += [
1927 "tools/sk_app/win/GLWindowContext_win.cpp",
1928 "tools/sk_app/win/RasterWindowContext_win.cpp",
1929 "tools/sk_app/win/Window_win.cpp",
1930 "tools/sk_app/win/main_win.cpp",
1931 ]
Brian Salomon194db172017-08-17 14:37:06 -04001932 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001933 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001934 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001935 } else if (is_mac) {
1936 sources += [
1937 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1938 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1939 "tools/sk_app/mac/Window_mac.cpp",
1940 "tools/sk_app/mac/main_mac.cpp",
1941 ]
1942 libs += [
1943 "QuartzCore.framework",
1944 "Cocoa.framework",
1945 "Foundation.framework",
1946 ]
1947 } else if (is_ios) {
1948 sources += [
1949 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1950 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1951 "tools/sk_app/ios/Window_ios.cpp",
1952 "tools/sk_app/ios/main_ios.cpp",
1953 ]
1954 }
1955
1956 if (skia_use_vulkan) {
1957 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1958 if (is_android) {
1959 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1960 } else if (is_linux) {
1961 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1962 libs += [ "X11-xcb" ]
1963 } else if (is_win) {
1964 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
1965 }
1966 }
1967
1968 deps = [
1969 ":gpu_tool_utils",
1970 ":skia",
1971 ":tool_utils",
1972 ":views",
1973 ]
1974 if (is_android) {
1975 deps += [ "//third_party/native_app_glue" ]
1976 } else if (is_mac || is_ios) {
1977 deps += [ "//third_party/libsdl" ]
1978 }
1979 if (skia_use_angle) {
1980 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05001981 }
Brian Osman16adfa32016-10-18 14:42:44 -04001982 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001983
Brian Osmanc9a42472018-05-31 13:17:12 -04001984 test_app("viewer") {
1985 is_shared_library = is_android
1986 if (is_ios) {
1987 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05001988 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001989 sources = [
1990 "tools/viewer/BisectSlide.cpp",
1991 "tools/viewer/GMSlide.cpp",
1992 "tools/viewer/ImGuiLayer.cpp",
1993 "tools/viewer/ImageSlide.cpp",
1994 "tools/viewer/SKPSlide.cpp",
1995 "tools/viewer/SampleSlide.cpp",
1996 "tools/viewer/SkottieSlide.cpp",
1997 "tools/viewer/SlideDir.cpp",
1998 "tools/viewer/StatsLayer.cpp",
1999 "tools/viewer/SvgSlide.cpp",
2000 "tools/viewer/Viewer.cpp",
2001 ]
2002 libs = []
2003
2004 include_dirs = []
2005 deps = [
2006 ":experimental_svg_model",
2007 ":flags",
2008 ":gm",
2009 ":gpu_tool_utils",
2010 ":samples",
2011 ":sk_app",
2012 ":skia",
2013 ":tool_utils",
2014 ":views",
2015 "modules/skottie",
2016 "modules/sksg",
2017 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002018 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002019
2020 # NIMA does not build on Windows clang
2021 if (!is_win || !is_clang) {
2022 sources += [ "tools/viewer/NIMASlide.cpp" ]
2023 deps += [ "//third_party/Nima-Cpp" ]
2024 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002025 }
2026
ziadbbceddbc2018-06-19 13:57:15 -04002027 if (is_android) {
2028 test_app("arcore") {
2029 is_shared_library = true
2030 configs = [
2031 ":skia_public",
2032 "gn:default",
2033 ]
2034
2035 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2036 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2037 sources = []
2038 sources += skia_core_sources
2039 sources += skia_utils_sources
2040 sources += skia_xps_sources
2041 sources += [
2042 "src/android/SkAndroidFrameworkUtils.cpp",
2043 "src/android/SkAnimatedImage.cpp",
2044 "src/android/SkBitmapRegionCodec.cpp",
2045 "src/android/SkBitmapRegionDecoder.cpp",
2046 "src/codec/SkAndroidCodec.cpp",
2047 "src/codec/SkBmpBaseCodec.cpp",
2048 "src/codec/SkBmpCodec.cpp",
2049 "src/codec/SkBmpMaskCodec.cpp",
2050 "src/codec/SkBmpRLECodec.cpp",
2051 "src/codec/SkBmpStandardCodec.cpp",
2052 "src/codec/SkCodec.cpp",
2053 "src/codec/SkCodecImageGenerator.cpp",
2054 "src/codec/SkColorTable.cpp",
2055 "src/codec/SkGifCodec.cpp",
2056 "src/codec/SkMaskSwizzler.cpp",
2057 "src/codec/SkMasks.cpp",
2058 "src/codec/SkSampledCodec.cpp",
2059 "src/codec/SkSampler.cpp",
2060 "src/codec/SkStreamBuffer.cpp",
2061 "src/codec/SkSwizzler.cpp",
2062 "src/codec/SkWbmpCodec.cpp",
2063 "src/images/SkImageEncoder.cpp",
2064 "src/ports/SkDiscardableMemory_none.cpp",
2065 "src/ports/SkImageGenerator_skia.cpp",
2066 "src/ports/SkMemory_malloc.cpp",
2067 "src/ports/SkOSFile_stdio.cpp",
2068 "src/sfnt/SkOTTable_name.cpp",
2069 "src/sfnt/SkOTUtils.cpp",
2070 "src/utils/mac/SkStream_mac.cpp",
2071 "third_party/gif/SkGifImageReader.cpp",
2072 ]
2073 deps = [
2074 ":tool_utils",
2075 "modules/skottie",
2076 "modules/skshaper",
2077 ]
2078 }
2079 }
2080
Brian Osmanc9a42472018-05-31 13:17:12 -04002081 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002082 test_app("HelloWorld") {
2083 sources = [
2084 "example/HelloWorld.cpp",
2085 ]
2086 libs = []
2087
2088 include_dirs = []
2089 deps = [
2090 ":flags",
2091 ":gpu_tool_utils",
2092 ":sk_app",
2093 ":skia",
2094 ":tool_utils",
2095 ":views",
2096 ]
2097 }
2098 }
2099
Brian Osmanc9a42472018-05-31 13:17:12 -04002100 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002101 test_app("SkiaSDLExample") {
2102 sources = [
2103 "example/SkiaSDLExample.cpp",
2104 ]
2105 libs = []
2106 include_dirs = []
2107 deps = [
2108 ":gpu_tool_utils",
2109 ":skia",
2110 "//third_party/libsdl",
2111 ]
2112 }
2113 }
2114
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002115 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2116 action_foreach("generate_mocs") {
2117 script = "gn/call.py"
2118 sources = [
2119 "tools/mdbviz/MainWindow.h",
2120 ]
2121 outputs = [
2122 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2123 ]
2124 args = [
2125 "$skia_qt_path" + "/bin/moc",
2126 "{{source}}",
2127 "-o",
2128 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2129 ]
2130 }
2131 action_foreach("generate_resources") {
2132 script = "gn/call.py"
2133 sources = [
2134 "tools/mdbviz/resources.qrc",
2135 ]
2136 outputs = [
2137 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2138 ]
2139 args = [
2140 "$skia_qt_path" + "/bin/rcc",
2141 "{{source}}",
2142 "-o",
2143 "gen/mdbviz/{{source_name_part}}_res.cpp",
2144 ]
2145 }
2146 test_app("mdbviz") {
2147 if (is_win) {
2148 # on Windows we need to disable some exception handling warnings due to the Qt headers
2149 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2150 }
2151 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002152 "tools/UrlDataManager.cpp",
2153 "tools/debugger/SkDebugCanvas.cpp",
2154 "tools/debugger/SkDrawCommand.cpp",
2155 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002156 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002157 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002158 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002159 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002160
2161 # generated files
2162 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2163 "$target_gen_dir/mdbviz/resources_res.cpp",
2164 ]
2165 lib_dirs = [ "$skia_qt_path/lib" ]
2166 libs = [
2167 "Qt5Core.lib",
2168 "Qt5Gui.lib",
2169 "Qt5Widgets.lib",
2170 ]
2171 include_dirs = [
2172 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002173 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002174 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002175 "tools",
2176 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002177 ]
2178 deps = [
2179 ":generate_mocs",
2180 ":generate_resources",
2181 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002182 "//third_party/jsoncpp",
2183 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002184 ]
2185 }
2186 }
2187
Mike Kleine459afd2017-03-03 09:21:30 -05002188 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002189 copy("gdbserver") {
2190 sources = [
2191 "$ndk/$ndk_gdbserver",
2192 ]
2193 outputs = [
2194 "$root_out_dir/gdbserver",
2195 ]
2196 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002197 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002198
2199 if (skia_use_opencl) {
2200 test_app("hello-opencl") {
2201 sources = [
2202 "src/compute/common/cl/assert_cl.c",
2203 "src/compute/common/cl/find_cl.c",
2204 "tools/hello-opencl.cpp",
2205 ]
2206 include_dirs = [ "src/compute/common" ]
2207 libs = [ "OpenCL" ]
2208 }
2209 }
mtklein25c81d42016-07-27 13:55:26 -07002210}