blob: 93addb8d62188181fbf256df08823a8ee84c8dfe [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
Chinmay Garded92d0352018-09-17 10:23:28 -070034 skia_use_x11 = is_linux
mtklein1bd72ba2016-09-16 07:45:52 -070035
Mike Klein7d921032017-01-05 12:20:41 -050036 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050037 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050038 skia_enable_effects = true
Mike Reed0917fad2018-06-19 10:17:30 -040039 skia_enable_effects_imagefilters = true
Brian Osmanf2c90142017-07-13 15:50:03 -040040 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050041 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000042 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050043 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040044 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050045 skia_enable_tools = is_skia_dev_build
46 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielda16cce2018-08-01 09:23:57 -040047 skia_vulkan_header = "" # temporary as we remove the use from clients
Robert Phillipsa6d2d702017-09-01 12:17:03 -040048 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040049 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070050 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070051 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040052
Hal Canary4689b542018-01-31 11:54:14 -050053 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050054 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040055
56 skia_llvm_path = ""
57 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040058
59 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070060}
Brian Salomon23d73ea2016-10-27 13:31:37 -040061declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040062 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040063 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050064 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040065
Mike Klein4d598a32016-10-31 13:44:49 -040066 if (is_android) {
67 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070068 } else if (is_fuchsia) {
69 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040070 } else {
Greg Daniel91dfa3b2018-05-22 13:25:15 -040071 skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
72 (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
Mike Klein4d598a32016-10-31 13:44:49 -040073 }
Jim Van Verth4e502972017-12-07 15:16:10 -050074
75 if (is_ios) {
76 skia_ios_identity = ".*Google.*"
77 skia_ios_profile = "Google Development"
78 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040079}
Brian Salomon789e25e2016-09-30 13:41:03 -040080
Adam Barth54ef74a2017-10-13 10:59:38 -070081if (defined(skia_settings)) {
82 import(skia_settings)
83}
84
Brian Osmanc9a42472018-05-31 13:17:12 -040085# Our tools require static linking (they use non-exported symbols), and the GPU backend.
86skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
mtklein06c35c02016-09-20 12:28:12 -070087
mtkleina45be612016-08-29 15:22:10 -070088fontmgr_android_enabled = skia_use_expat && skia_use_freetype
89
mtklein1211e0c2016-07-26 13:55:45 -070090skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070091 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070092 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070093 "include/codec",
94 "include/config",
95 "include/core",
96 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040097 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070098 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050099 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/pathops",
101 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700102 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/utils",
104 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700105]
106
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500107if (skia_enable_atlas_text) {
108 skia_public_includes += [ "include/atlastext" ]
109}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000110
mtkleinc04ff472016-06-23 10:29:30 -0700111# Skia public API, generally provided by :skia.
112config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700113 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400114 defines = []
115 if (is_component_build) {
116 defines += [ "SKIA_DLL" ]
117 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400118 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700119 defines += [ "SK_SAMPLES_FOR_X" ]
120 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400121 if (skia_enable_flutter_defines) {
122 defines += flutter_defines
123 }
mtklein06c35c02016-09-20 12:28:12 -0700124 if (!skia_enable_gpu) {
125 defines += [ "SK_SUPPORT_GPU=0" ]
126 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500127 if (skia_enable_atlas_text) {
128 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
129 }
mtkleinc04ff472016-06-23 10:29:30 -0700130}
131
132# Skia internal APIs, used by Skia itself and a few test tools.
133config("skia_private") {
134 visibility = [ ":*" ]
135
136 include_dirs = [
137 "include/private",
138 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700139 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700140 "src/core",
141 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700142 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700143 "src/image",
144 "src/images",
145 "src/lazy",
146 "src/opts",
147 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700148 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700149 "src/ports",
150 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400151 "src/shaders",
152 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700153 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700154 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700155 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500156 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700157 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700158 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400159 if (skia_llvm_path != "") {
160 include_dirs += [ "$skia_llvm_path/include" ]
161 }
mtklein150d1132016-08-01 06:56:40 -0700162
Mike Reeda9e241d2017-05-03 10:52:00 -0400163 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700164 if (is_android) {
165 defines += [
166 "SK_GAMMA_EXPONENT=1.4",
167 "SK_GAMMA_CONTRAST=0.0",
168 ]
169 }
mtklein88a7ac02016-09-14 11:16:49 -0700170 if (is_official_build || is_android) {
171 # TODO(bsalomon): it'd be nice to make Android normal.
172 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
173 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400174 libs = []
175 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500176 if (skia_enable_gpu) {
177 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500178 if (is_skia_dev_build && skia_use_vulkan) {
179 include_dirs += [ "tools/gpu/vk" ]
180 }
Brian Salomon03e05842017-02-23 12:23:47 -0500181 }
Brian Osman34755e22016-12-05 09:46:02 -0500182 if (skia_use_angle) {
183 defines += [ "SK_ANGLE" ]
184 }
Brian Osman3f375d02016-12-28 11:19:22 -0500185 if (skia_enable_discrete_gpu) {
186 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
187 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400188 if (!is_official_build) {
189 defines += [ "GR_TEST_UTILS=1" ]
190 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400191 if (skia_llvm_path != "") {
192 defines += [ "SK_LLVM_AVAILABLE" ]
193 include_dirs += [ "$skia_llvm_path/include" ]
194 libs += [ skia_llvm_lib ]
195 lib_dirs += [ "$skia_llvm_path/lib/" ]
196 }
mtkleinc04ff472016-06-23 10:29:30 -0700197}
198
199# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
200config("skia_library") {
201 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700202 defines = [ "SKIA_IMPLEMENTATION=1" ]
203}
204
205skia_library_configs = [
206 ":skia_public",
207 ":skia_private",
208 ":skia_library",
209]
210
mtklein9b8583d2016-08-24 17:32:30 -0700211# Use for CPU-specific Skia code that needs particular compiler flags.
212template("opts") {
213 if (invoker.enabled) {
214 source_set(target_name) {
215 forward_variables_from(invoker, "*")
216 configs += skia_library_configs
217 }
218 } else {
219 # If not enabled, a phony empty target that swallows all otherwise unused variables.
220 source_set(target_name) {
221 forward_variables_from(invoker,
222 "*",
223 [
224 "sources",
225 "cflags",
226 ])
227 }
228 }
anmittala7eaf2e2016-08-17 13:57:26 -0700229}
230
mtklein422310d2016-08-16 18:28:43 -0700231is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700232
mtklein7d6fb2c2016-08-25 14:50:44 -0700233opts("none") {
234 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700235 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700236 cflags = []
237}
238
mtklein7d6fb2c2016-08-25 14:50:44 -0700239opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700240 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700242 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700243}
244
245opts("arm64") {
246 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700248 cflags = []
249}
250
251opts("crc32") {
252 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700254 cflags = [ "-march=armv8-a+crc" ]
255}
256
mtklein9b8583d2016-08-24 17:32:30 -0700257opts("sse2") {
258 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400260 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400261 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
262 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400263 cflags = [ "-msse2" ]
264 }
mtklein9b8583d2016-08-24 17:32:30 -0700265}
mtkleinc04ff472016-06-23 10:29:30 -0700266
mtklein9b8583d2016-08-24 17:32:30 -0700267opts("ssse3") {
268 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.ssse3_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_SSSE3" ]
272 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400273 cflags = [ "-mssse3" ]
274 }
mtklein9b8583d2016-08-24 17:32:30 -0700275}
mtkleinc04ff472016-06-23 10:29:30 -0700276
mtklein9b8583d2016-08-24 17:32:30 -0700277opts("sse41") {
278 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700279 sources = skia_opts.sse41_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_SSE41" ]
282 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400283 cflags = [ "-msse4.1" ]
284 }
mtklein9b8583d2016-08-24 17:32:30 -0700285}
mtklein4e976072016-08-08 09:06:27 -0700286
mtklein9b8583d2016-08-24 17:32:30 -0700287opts("sse42") {
288 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700289 sources = skia_opts.sse42_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_SSE42" ]
292 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400293 cflags = [ "-msse4.2" ]
294 }
mtklein9b8583d2016-08-24 17:32:30 -0700295}
296
297opts("avx") {
298 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700299 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400300 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000301 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400302 } else {
303 cflags = [ "-mavx" ]
304 }
mtkleinc04ff472016-06-23 10:29:30 -0700305}
306
Mike Klein1b9b7d52018-02-27 10:37:40 -0500307opts("hsw") {
308 enabled = is_x86
309 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400310 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500311 cflags = [ "/arch:AVX2" ]
312 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000313 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500314 }
315
316 # Oddly, clang-cl doesn't recognize this as a valid flag.
317 # If it ever does, it'd nice to move this up with -mavx2 and co.
318 if (is_clang && !is_win) {
319 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
320 # but nice to have, generating slightly better code for paths without explicit FMAs.
321 cflags += [ "-ffp-contract=fast" ]
322 }
323}
324
mtkleinc095df52016-08-24 12:23:52 -0700325# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700326template("optional") {
327 if (invoker.enabled) {
328 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700329 if (defined(invoker.public_defines)) {
330 defines = invoker.public_defines
331 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600332 if (defined(invoker.public_configs)) {
333 configs = invoker.public_configs
334 }
mtklein457b42a2016-08-23 13:56:37 -0700335 }
336 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700337 forward_variables_from(invoker,
338 "*",
339 [
340 "public_defines",
341 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700342 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700343 ])
mtklein457b42a2016-08-23 13:56:37 -0700344 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700345 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700346 if (defined(invoker.configs_to_remove)) {
347 configs -= invoker.configs_to_remove
348 }
mtklein457b42a2016-08-23 13:56:37 -0700349 }
350 } else {
mtklein457b42a2016-08-23 13:56:37 -0700351 source_set(target_name) {
352 forward_variables_from(invoker,
353 "*",
354 [
355 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400356 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700357 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700358 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700359 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700360 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700361 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700362 ])
mtkleincd01b032016-08-31 04:58:19 -0700363 if (defined(invoker.sources_when_disabled)) {
364 sources = invoker.sources_when_disabled
365 }
366 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700367 }
mtkleineb3c4252016-08-23 07:38:09 -0700368 }
mtklein457b42a2016-08-23 13:56:37 -0700369}
mtklein457b42a2016-08-23 13:56:37 -0700370
Mike Kleina04bb452017-02-09 12:24:07 -0500371optional("effects") {
372 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400373 deps = [
374 ":compile_processors",
375 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500376 sources =
377 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
Mike Reed0917fad2018-06-19 10:17:30 -0400378 if (skia_enable_effects_imagefilters) {
379 sources += skia_effects_imagefilter_sources
380 } else {
381 sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
382 }
383 sources_when_disabled = [
384 "src/ports/SkGlobalInitialization_none.cpp",
385 "src/ports/SkGlobalInitialization_none_imagefilters.cpp",
386 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500387}
388
mtkleina45be612016-08-29 15:22:10 -0700389optional("fontmgr_android") {
390 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700391
392 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500393 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700394 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700395 ]
396 sources = [
397 "src/ports/SkFontMgr_android.cpp",
398 "src/ports/SkFontMgr_android_factory.cpp",
399 "src/ports/SkFontMgr_android_parser.cpp",
400 ]
401}
402
mtkleind2e39db2016-09-07 07:52:55 -0700403optional("fontmgr_custom") {
404 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
405
406 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500407 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700408 ]
409 sources = [
410 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500411 "src/ports/SkFontMgr_custom.h",
412 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700413 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500414 "src/ports/SkFontMgr_custom_embedded.cpp",
415 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700416 ]
417}
418
Hal Canaryff2742e2018-01-30 11:35:47 -0500419optional("fontmgr_empty") {
420 enabled = skia_enable_fontmgr_empty
421 sources = [
422 "src/ports/SkFontMgr_empty_factory.cpp",
423 ]
424}
425
mtklein3cc22182016-08-29 13:26:14 -0700426optional("fontmgr_fontconfig") {
427 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700428
429 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500430 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700431 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700432 ]
433 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700434 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700435 "src/ports/SkFontConfigInterface_direct.cpp",
436 "src/ports/SkFontConfigInterface_direct_factory.cpp",
437 "src/ports/SkFontMgr_FontConfigInterface.cpp",
438 "src/ports/SkFontMgr_fontconfig.cpp",
439 "src/ports/SkFontMgr_fontconfig_factory.cpp",
440 ]
441}
442
mtkleincdedd0e2016-09-12 15:15:44 -0700443optional("fontmgr_fuchsia") {
444 enabled = is_fuchsia && skia_use_freetype
445
446 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500447 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700448 ]
449 sources = [
450 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500451 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700452 "src/ports/SkFontMgr_custom_empty_factory.cpp",
453 ]
454}
455
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700456if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400457 executable("sksllex") {
458 sources = [
459 "src/sksl/lex/Main.cpp",
460 "src/sksl/lex/NFA.cpp",
461 "src/sksl/lex/RegexNode.cpp",
462 "src/sksl/lex/RegexParser.cpp",
463 ]
464 include_dirs = [ "src/sksl/lex" ]
465 }
466
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700467 action("run_sksllex") {
468 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400469 deps = [
470 ":sksllex(//gn/toolchain:$host_toolchain)",
471 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700472 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700473 "src/sksl/lex/sksl.lex",
474 ]
475
476 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
477 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
478 outputs = [
479 "$target_out_dir/" +
480 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
481 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
482 # confused due to the same file being named by two different paths
483 ]
484 sksllex_path = "$root_out_dir/"
485 sksllex_path += "sksllex"
486 if (host_os == "win") {
487 sksllex_path += ".exe"
488 }
489 args = [
490 rebase_path(sksllex_path),
491 rebase_path("bin/clang-format"),
492 rebase_path("src"),
493 ]
494 }
495} else {
496 group("run_sksllex") {
497 }
498}
499
500if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400501 executable("skslc") {
502 defines = [ "SKSL_STANDALONE" ]
503 sources = [
504 "src/sksl/SkSLMain.cpp",
505 ]
506 sources += skia_sksl_sources
507 include_dirs = [
508 "src/gpu",
509 "src/sksl",
510 ]
511 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500512 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400513 "//third_party/spirv-tools",
514 ]
515 }
516
517 skia_gpu_processor_outputs = []
518 foreach(src, skia_gpu_processor_sources) {
519 dir = get_path_info(src, "dir")
520 name = get_path_info(src, "name")
521
522 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
523 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
524 skia_gpu_processor_outputs += [
525 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
526 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
527 # confused due to the same file being named by two different paths
528 ]
529 }
530
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500531 action("create_sksl_enums") {
532 script = "gn/create_sksl_enums.py"
533 sources = [
534 "include/private/GrSharedEnums.h",
535 ]
536 outputs = [
537 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500538 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500539 ]
540 args = [
541 rebase_path(sources[0]),
542 rebase_path(outputs[0]),
543 ]
544 }
545
Ethan Nicholas762466e2017-06-29 10:03:38 -0400546 action("compile_processors") {
547 script = "gn/compile_processors.py"
548 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500549 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400550 ":skslc(//gn/toolchain:$host_toolchain)",
551 ]
552 sources = skia_gpu_processor_sources
553 outputs = skia_gpu_processor_outputs
554 skslc_path = "$root_out_dir/"
555 if (host_toolchain != default_toolchain_name) {
556 skslc_path += "$host_toolchain/"
557 }
558 skslc_path += "skslc"
559 if (host_os == "win") {
560 skslc_path += ".exe"
561 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400562 args = [
563 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400564 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400565 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400566 args += rebase_path(skia_gpu_processor_sources)
567 }
568} else {
569 skia_gpu_processor_outputs = []
570 group("compile_processors") {
571 }
572}
573
mtklein06c35c02016-09-20 12:28:12 -0700574optional("gpu") {
575 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400576 deps = [
577 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700578 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400579 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700580 if (skia_generate_workarounds) {
581 deps += [ ":workaround_list" ]
582 }
mtkleine9fb3d52016-09-20 15:11:46 -0700583 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600584 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400585 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700586
Brian Salomon3d6801e2017-12-11 10:06:31 -0500587 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700588
589 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500590 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700591 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400592 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700593 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400594 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400595
596 # this lib is required to link against AHardwareBuffer
597 if (defined(ndk_api) && ndk_api >= 26) {
598 libs += [ "android" ]
599 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400600 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500601 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400602 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700603 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500604 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400605 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700606 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500607 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800608 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500609 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400610 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400612 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700613 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500614 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700615 }
mtkleine9fb3d52016-09-20 15:11:46 -0700616
617 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400618 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400619 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700620 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700621 if (skia_enable_vulkan_debug_layers) {
622 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
623 }
mtkleine9fb3d52016-09-20 15:11:46 -0700624 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400625
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400626 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400627 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400628 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
629 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400630
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400631 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400632 if (skia_use_metal) {
633 public_defines += [ "SK_METAL" ]
634 sources += skia_metal_sources
635 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400636 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400637 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400638 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500639
640 if (skia_enable_atlas_text) {
641 sources += skia_atlas_text_sources
642 }
mtklein06c35c02016-09-20 12:28:12 -0700643}
644
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400645optional("heif") {
646 enabled = skia_use_libheif
647 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
648
649 deps = []
650
651 sources = [
652 "src/codec/SkHeifCodec.cpp",
653 ]
654}
655
mtklein63213812016-08-24 09:55:56 -0700656optional("jpeg") {
657 enabled = skia_use_libjpeg_turbo
658 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
659
mtklein63213812016-08-24 09:55:56 -0700660 deps = [
661 "//third_party/libjpeg-turbo:libjpeg",
662 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400663 public = [
664 "include/encode/SkJpegEncoder.h",
665 ]
mtklein63213812016-08-24 09:55:56 -0700666 sources = [
667 "src/codec/SkJpegCodec.cpp",
668 "src/codec/SkJpegDecoderMgr.cpp",
669 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700670 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400671 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700672 ]
673}
674
675optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500676 enabled = skia_use_zlib && skia_enable_pdf
677 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700678
mtklein63213812016-08-24 09:55:56 -0700679 deps = [
680 "//third_party/zlib",
681 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400682 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700683 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400684 }
brettwb9447282016-09-01 14:24:39 -0700685 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700686 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700687
688 if (skia_use_sfntly) {
689 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500690 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700691 }
692}
693
694optional("png") {
695 enabled = skia_use_libpng
696 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
697
mtklein63213812016-08-24 09:55:56 -0700698 deps = [
699 "//third_party/libpng",
700 ]
701 sources = [
702 "src/codec/SkIcoCodec.cpp",
703 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400704 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700705 ]
706}
707
scroggof84ad642016-10-31 09:02:57 -0700708optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400709 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700710 public_defines = [ "SK_CODEC_DECODES_RAW" ]
711
712 deps = [
713 "//third_party/dng_sdk",
714 "//third_party/libjpeg-turbo:libjpeg",
715 "//third_party/piex",
716 ]
717
718 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
719 # Skia.
720 configs_to_remove = [ "//gn:no_exceptions" ]
721
722 sources = [
723 "src/codec/SkRawAdapterCodec.cpp",
724 "src/codec/SkRawCodec.cpp",
725 ]
726}
727
Mike Klein852a8cb2018-05-15 10:46:58 -0400728import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400729source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400730 cflags = []
731 if (!is_win || is_clang) {
732 cflags += [
733 "-w",
734 "-std=c11",
735 ]
736 }
737
738 public = [
739 "third_party/skcms/skcms.h",
740 ]
741 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
742}
743
mtklein3cc22182016-08-29 13:26:14 -0700744optional("typeface_freetype") {
745 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700746
747 deps = [
748 "//third_party/freetype2",
749 ]
750 sources = [
751 "src/ports/SkFontHost_FreeType.cpp",
752 "src/ports/SkFontHost_FreeType_common.cpp",
753 ]
754}
755
mtklein457b42a2016-08-23 13:56:37 -0700756optional("webp") {
757 enabled = skia_use_libwebp
758 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
759
mtklein457b42a2016-08-23 13:56:37 -0700760 deps = [
761 "//third_party/libwebp",
762 ]
763 sources = [
764 "src/codec/SkWebpAdapterCodec.cpp",
765 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400766 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700767 ]
mtkleineb3c4252016-08-23 07:38:09 -0700768}
769
mtklein63213812016-08-24 09:55:56 -0700770optional("xml") {
771 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000772 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700773
mtklein63213812016-08-24 09:55:56 -0700774 deps = [
775 "//third_party/expat",
776 ]
777 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500778 "src/svg/SkSVGCanvas.cpp",
779 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700780 "src/xml/SkDOM.cpp",
781 "src/xml/SkXMLParser.cpp",
782 "src/xml/SkXMLWriter.cpp",
783 ]
784}
785
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700786if (skia_enable_gpu && skia_generate_workarounds) {
787 action("workaround_list") {
788 script = "tools/build_workaround_header.py"
789
790 inputs = [
791 "src/gpu/gpu_workaround_list.txt",
792 ]
793
794 # see comments in skia_compile_processors about out dir path shenanigans.
795 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700796 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700797
798 outputs = [
799 "$root_out_dir/$output_file",
800 ]
801 args = [
802 "--output-file",
803 "$output_file",
804 ]
805
806 foreach(file, inputs) {
807 args += [ rebase_path(file, root_build_dir) ]
808 }
809 }
810}
811
mtkleinc04ff472016-06-23 10:29:30 -0700812component("skia") {
813 public_configs = [ ":skia_public" ]
814 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700815
816 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700817 ":arm64",
818 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700819 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700820 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500821 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700822 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700823 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500824 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700825 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700826 ":fontmgr_fuchsia",
Greg Danielda16cce2018-08-01 09:23:57 -0400827 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400828 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500829 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700830 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700831 ":none",
mtklein63213812016-08-24 09:55:56 -0700832 ":pdf",
833 ":png",
scroggof84ad642016-10-31 09:02:57 -0700834 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500835 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700836 ":sse2",
837 ":sse41",
838 ":sse42",
839 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700840 ":webp",
mtklein63213812016-08-24 09:55:56 -0700841 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700842 ]
843
Chinmay Garde43f115c2016-11-16 15:04:12 -0800844 # This file (and all GN files in Skia) are designed to work with an
845 # empty sources assignment filter; we handle all that explicitly.
846 # We clear the filter here for clients who may have set up a global filter.
847 set_sources_assignment_filter([])
848
mtkleinc04ff472016-06-23 10:29:30 -0700849 sources = []
brettwb9447282016-09-01 14:24:39 -0700850 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700851 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500852 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700853 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400854 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500855 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700856 "src/android/SkBitmapRegionCodec.cpp",
857 "src/android/SkBitmapRegionDecoder.cpp",
858 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400859 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700860 "src/codec/SkBmpCodec.cpp",
861 "src/codec/SkBmpMaskCodec.cpp",
862 "src/codec/SkBmpRLECodec.cpp",
863 "src/codec/SkBmpStandardCodec.cpp",
864 "src/codec/SkCodec.cpp",
865 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400866 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400867 "src/codec/SkEncodedInfo.cpp",
scroggo19b91532016-10-24 09:03:26 -0700868 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700869 "src/codec/SkMaskSwizzler.cpp",
870 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700871 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700872 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700873 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700874 "src/codec/SkSwizzler.cpp",
875 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700876 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700877 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700878 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700879 "src/ports/SkMemory_malloc.cpp",
880 "src/ports/SkOSFile_stdio.cpp",
881 "src/sfnt/SkOTTable_name.cpp",
882 "src/sfnt/SkOTUtils.cpp",
883 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700884 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700885 ]
brettwb9447282016-09-01 14:24:39 -0700886
mtklein7d6fb2c2016-08-25 14:50:44 -0700887 libs = []
888
mtkleinc04ff472016-06-23 10:29:30 -0700889 if (is_win) {
890 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400891 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700892 "src/ports/SkDebug_win.cpp",
893 "src/ports/SkFontHost_win.cpp",
894 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500895 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700896 "src/ports/SkImageEncoder_WIC.cpp",
897 "src/ports/SkImageGeneratorWIC.cpp",
898 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700899 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700900 "src/ports/SkScalerContext_win_dw.cpp",
901 "src/ports/SkTLS_win.cpp",
902 "src/ports/SkTypeface_win_dw.cpp",
903 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400904 libs += [
905 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500906 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400907 "Ole32.lib",
908 "OleAut32.lib",
909 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500910 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400911 ]
mtkleinc04ff472016-06-23 10:29:30 -0700912 } else {
913 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700914 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700915 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700916 "src/ports/SkTLS_pthread.cpp",
917 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400918 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700919 }
920
mtklein7d6fb2c2016-08-25 14:50:44 -0700921 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500922 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500923 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500924 deps += [ "//third_party/cpu-features" ]
925 }
mtklein06c35c02016-09-20 12:28:12 -0700926 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700927 libs += [
928 "EGL",
929 "GLESv2",
930 "log",
931 ]
932 }
933
mtkleinc04ff472016-06-23 10:29:30 -0700934 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700935 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400936 if (skia_use_egl) {
937 libs += [ "GLESv2" ]
938 }
mtkleinc04ff472016-06-23 10:29:30 -0700939 }
940
941 if (is_mac) {
942 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700943 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 "src/ports/SkFontHost_mac.cpp",
945 "src/ports/SkImageEncoder_CG.cpp",
946 "src/ports/SkImageGeneratorCG.cpp",
947 ]
mtklein09e61f72016-08-23 13:35:28 -0700948 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400949 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
950 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700951 "ApplicationServices.framework",
952 "OpenGL.framework",
953 ]
mtkleinc04ff472016-06-23 10:29:30 -0700954 }
abarth6fc8ff02016-07-15 15:15:15 -0700955
Mike Klein7d302882016-11-03 14:06:31 -0400956 if (is_ios) {
957 sources += [
958 "src/ports/SkDebug_stdio.cpp",
959 "src/ports/SkFontHost_mac.cpp",
960 "src/ports/SkImageEncoder_CG.cpp",
961 "src/ports/SkImageGeneratorCG.cpp",
962 ]
963 libs += [
964 "CoreFoundation.framework",
965 "CoreGraphics.framework",
966 "CoreText.framework",
967 "ImageIO.framework",
968 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400969
970 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
971 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400972 ]
973 }
974
abarth6fc8ff02016-07-15 15:15:15 -0700975 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700976 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700977 }
mtkleinc04ff472016-06-23 10:29:30 -0700978}
979
mtkleinc095df52016-08-24 12:23:52 -0700980# Targets guarded by skia_enable_tools may use //third_party freely.
981if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500982 # Used by gn_to_bp.py to list our public include dirs.
983 source_set("public") {
984 configs += [ ":skia_public" ]
985 }
986
Mike Kleinc36dedf2016-11-18 09:35:28 -0500987 config("skia.h_config") {
988 include_dirs = [ "$target_gen_dir" ]
989 }
990 action("skia.h") {
991 public_configs = [ ":skia.h_config" ]
992 skia_h = "$target_gen_dir/skia.h"
993 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -0400994
995 # TODO: would be cool to not hard-code these here, but how?
996 module_public_includes = [
997 "modules/sksg/include",
998 "modules/skottie/include",
999 ]
1000 args =
1001 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1002 [ rebase_path(skia_h, root_build_dir) ] +
1003 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001004 depfile = "$skia_h.deps"
1005 outputs = [
1006 skia_h,
1007 ]
1008 }
1009
Brian Osmanc9a42472018-05-31 13:17:12 -04001010 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001011 executable("fiddle") {
1012 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001013 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001014 "tools/fiddle/draw.cpp",
1015 "tools/fiddle/fiddle_main.cpp",
1016 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001017
1018 if (skia_use_egl) {
1019 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001020 } else {
1021 sources += [ "tools/fiddle/null_context.cpp" ]
1022 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001023 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001024 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001025 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001026 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001027 ":skia",
1028 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001029 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001030 ]
1031 }
1032 }
1033
Brian Osmanc9a42472018-05-31 13:17:12 -04001034 source_set("public_headers_warnings_check") {
1035 sources = [
1036 "tools/public_headers_warnings_check.cpp",
1037 ]
1038 configs -= [ "//gn:warnings_except_public_headers" ]
1039 deps = [
1040 ":skia",
1041 ":skia.h",
1042 "modules/skottie",
1043 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001044 }
1045
mtkleinc095df52016-08-24 12:23:52 -07001046 template("test_lib") {
1047 config(target_name + "_config") {
1048 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001049 if (defined(invoker.public_defines)) {
1050 defines = invoker.public_defines
1051 }
mtklein25c81d42016-07-27 13:55:26 -07001052 }
mtkleinc095df52016-08-24 12:23:52 -07001053 source_set(target_name) {
1054 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1055 public_configs = [
1056 ":" + target_name + "_config",
1057 ":skia_private",
1058 ]
1059
1060 if (!defined(deps)) {
1061 deps = []
1062 }
1063 deps += [ ":skia" ]
1064 testonly = true
1065 }
mtklein25c81d42016-07-27 13:55:26 -07001066 }
mtklein25c81d42016-07-27 13:55:26 -07001067
Mike Kleine6682eb2017-01-05 10:54:57 -05001068 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001069 if (is_ios) {
1070 app_name = target_name
1071 gen_path = target_gen_dir
1072
1073 action("${app_name}_generate_info_plist") {
1074 script = "//gn/gen_plist_ios.py"
1075 outputs = [
1076 "$gen_path/${app_name}_Info.plist",
1077 ]
1078 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1079 }
1080
1081 bundle_data("${app_name}_bundle_info_plist") {
1082 public_deps = [
1083 ":${app_name}_generate_info_plist",
1084 ]
1085 sources = [
1086 "$gen_path/${app_name}_Info.plist",
1087 ]
1088 outputs = [
1089 "{{bundle_root_dir}}/Info.plist",
1090 ]
1091 }
1092
Jim Van Verth329c5a62017-11-29 11:42:33 -05001093 bundle_ios_data =
1094 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1095
1096 if (bundle_ios_data) {
1097 has_skps =
1098 "True" == exec_script("//gn/checkdir.py",
1099 [ rebase_path("skps", root_build_dir) ],
1100 "trim string")
1101 bundle_data("${app_name}_bundle_resources") {
1102 sources = [
1103 "resources",
1104 ]
1105 outputs = [
1106 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1107 "{{bundle_resources_dir}}/data/resources",
1108 ]
1109 }
1110
1111 if (has_skps) {
1112 bundle_data("${app_name}_bundle_skps") {
1113 sources = [
1114 "skps",
1115 ]
1116 outputs = [
1117 # Store in same folder as resources
1118 "{{bundle_resources_dir}}/data/skps",
1119 ]
1120 }
1121 }
1122 }
1123
Jim Van Verth443a9132017-11-28 09:45:26 -05001124 executable("${app_name}_generate_executable") {
1125 forward_variables_from(invoker,
1126 "*",
1127 [
1128 "output_name",
1129 "visibility",
1130 "is_shared_library",
1131 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001132 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001133 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001134 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1135 }
1136
1137 bundle_data("${app_name}_bundle_executable") {
1138 public_deps = [
1139 ":${app_name}_generate_executable",
1140 ]
1141 sources = [
1142 "$gen_path/$app_name",
1143 ]
1144 outputs = [
1145 "{{bundle_executable_dir}}/$app_name",
1146 ]
1147 testonly = true
1148 }
1149
1150 create_bundle("$app_name") {
1151 product_type = "com.apple.product-type.application"
1152 testonly = true
1153
1154 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1155 bundle_resources_dir = bundle_root_dir
1156 bundle_executable_dir = bundle_root_dir
1157 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1158
1159 deps = [
1160 ":${app_name}_bundle_executable",
1161 ":${app_name}_bundle_info_plist",
1162 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001163 if (bundle_ios_data) {
1164 deps += [ ":${app_name}_bundle_resources" ]
1165 if (has_skps) {
1166 deps += [ ":${app_name}_bundle_skps" ]
1167 }
1168 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001169
1170 # should only code sign when running on a device, not the simulator
1171 if (target_cpu != "x64") {
1172 code_signing_script = "//gn/codesign_ios.py"
1173 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1174 code_signing_outputs = [
1175 "$bundle_root_dir/_CodeSignature/CodeResources",
1176 "$bundle_root_dir/embedded.mobileprovision",
1177 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001178 code_signing_args = [
1179 rebase_path("$bundle_root_dir", root_build_dir),
1180 skia_ios_identity,
1181 skia_ios_profile,
1182 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001183 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001184 }
1185 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001186 # !is_ios
1187
1188 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1189 shared_library("lib" + target_name) {
1190 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1191 configs += [ ":skia_private" ]
1192 testonly = true
1193 }
1194 } else {
1195 _executable = target_name
1196 executable(_executable) {
1197 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1198 configs += [ ":skia_private" ]
1199 testonly = true
1200 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001201 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001202 if (is_android && skia_android_serial != "" && defined(_executable)) {
1203 action("push_" + target_name) {
1204 script = "gn/push_to_android.py"
1205 deps = [
1206 ":" + _executable,
1207 ]
1208 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1209 outputs = [
1210 _stamp,
1211 ]
1212 args = [
1213 rebase_path("$root_build_dir/$_executable"),
1214 skia_android_serial,
1215 rebase_path(_stamp),
1216 ]
1217 testonly = true
1218 }
Mike Klein7d921032017-01-05 12:20:41 -05001219 }
1220 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001221 }
1222
Greg Danielda16cce2018-08-01 09:23:57 -04001223 config("moltenvk_config") {
1224 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1225 if (is_ios) {
1226 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1227 } else {
1228 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1229 }
1230 cflags = [ "-F$moltenvk_framework_path" ]
1231 ldflags = [ "-F$moltenvk_framework_path" ]
1232 libs = [
1233 "MoltenVK.framework",
1234 "Metal.framework",
1235 "IOSurface.framework",
1236 "QuartzCore.framework",
1237 "Foundation.framework",
1238 ]
1239 if (is_ios) {
1240 libs += [ "UIKit.framework" ]
1241 } else {
1242 libs += [ "IOKit.framework" ]
1243 }
1244 defines = [ "SK_MOLTENVK" ]
1245 }
1246 }
1247
1248 source_set("moltenvk") {
1249 public_configs = [ ":moltenvk_config" ]
1250 }
1251
mtkleinc095df52016-08-24 12:23:52 -07001252 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001253 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001254 public_defines = []
1255 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001256
Brian Osmanc9a42472018-05-31 13:17:12 -04001257 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001258 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001259 sources = [
1260 "tools/gpu/GrContextFactory.cpp",
1261 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001262 "tools/gpu/MemoryCache.cpp",
1263 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001264 "tools/gpu/ProxyUtils.cpp",
1265 "tools/gpu/TestContext.cpp",
1266 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1267 "tools/gpu/gl/GLTestContext.cpp",
1268 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001269 "tools/gpu/gl/null/NullGLTestContext.cpp",
1270 "tools/gpu/mock/MockTestContext.cpp",
1271 ]
1272 libs = []
1273
1274 if (is_android || skia_use_egl) {
1275 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1276 } else if (is_ios) {
1277 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1278 libs += [ "OpenGLES.framework" ]
1279 } else if (is_linux) {
1280 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001281 libs += [
1282 "GLU",
1283 "X11",
1284 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001285 } else if (is_mac) {
1286 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1287 } else if (is_win) {
1288 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1289 libs += [
1290 "Gdi32.lib",
1291 "OpenGL32.lib",
mtklein38925aa2016-09-21 10:11:25 -07001292 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001293 }
mtklein25c81d42016-07-27 13:55:26 -07001294
Brian Osmanc9a42472018-05-31 13:17:12 -04001295 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001296
Brian Osmanc9a42472018-05-31 13:17:12 -04001297 if (skia_use_angle) {
1298 deps += [ "//third_party/angle2" ]
1299 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1300 }
1301 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -04001302 public_include_dirs += [ "third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001303 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1304 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001305 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1306 public_deps += [ ":moltenvk" ]
1307 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001308 }
1309 if (skia_use_metal) {
1310 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001311 }
mtklein25c81d42016-07-27 13:55:26 -07001312 }
mtklein25c81d42016-07-27 13:55:26 -07001313
mtkleinc095df52016-08-24 12:23:52 -07001314 test_lib("flags") {
1315 public_include_dirs = [ "tools/flags" ]
1316 sources = [
1317 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001318 ]
1319 }
1320 test_lib("common_flags") {
1321 public_include_dirs = [ "tools/flags" ]
1322 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001323 "tools/flags/SkCommonFlags.cpp",
1324 "tools/flags/SkCommonFlagsConfig.cpp",
1325 ]
1326 deps = [
mtklein046cb562016-09-16 10:23:12 -07001327 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001328 ]
1329 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001330 ":gpu_tool_utils",
1331 ]
1332 }
mtklein25c81d42016-07-27 13:55:26 -07001333
mtkleinc095df52016-08-24 12:23:52 -07001334 test_lib("tool_utils") {
1335 public_include_dirs = [
1336 "tools",
1337 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001338 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001339 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001340 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001341 ]
1342 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001343 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001344 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001345 "tools/DDLPromiseImageHelper.cpp",
1346 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001347 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001348 "tools/ProcStats.cpp",
1349 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001350 "tools/UrlDataManager.cpp",
1351 "tools/debugger/SkDebugCanvas.cpp",
1352 "tools/debugger/SkDrawCommand.cpp",
1353 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001354 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001355 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001356 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001357 "tools/fonts/SkTestFontMgr.h",
1358 "tools/fonts/SkTestSVGTypeface.cpp",
1359 "tools/fonts/SkTestSVGTypeface.h",
1360 "tools/fonts/SkTestTypeface.cpp",
1361 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001362 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001363 "tools/random_parse_path.cpp",
1364 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001365 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001366 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001367 "tools/trace/SkChromeTracingTracer.cpp",
1368 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001369 "tools/trace/SkDebugfTracer.cpp",
1370 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001371 "tools/trace/SkEventTracingPriv.cpp",
1372 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001373 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001374 libs = []
1375 if (is_ios) {
1376 sources += [ "tools/ios_utils.m" ]
1377 libs += [ "Foundation.framework" ]
1378 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001379 defines = []
1380 if (skia_tools_require_resources) {
1381 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1382 }
mtkleinc095df52016-08-24 12:23:52 -07001383 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001384 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001385 ":flags",
1386 "//third_party/libpng",
1387 ]
1388 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001389 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001390 "//third_party/jsoncpp",
1391 ]
1392 }
mtklein25c81d42016-07-27 13:55:26 -07001393
Mike Klein6e744122016-10-27 12:21:40 -04001394 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001395 test_lib("gm") {
1396 public_include_dirs = [ "gm" ]
1397 sources = gm_sources
1398 deps = [
scroggo19b91532016-10-24 09:03:26 -07001399 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001400 ":skia",
1401 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001402 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001403 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001404 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001405 public_deps = [
1406 ":gpu_tool_utils",
1407 ]
mtkleinc095df52016-08-24 12:23:52 -07001408 }
mtklein25c81d42016-07-27 13:55:26 -07001409
Mike Klein6e744122016-10-27 12:21:40 -04001410 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001411 test_lib("tests") {
1412 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001413 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001414 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001415 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001416 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001417 if (!(skia_use_freetype && skia_use_fontconfig)) {
1418 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1419 }
mtkleinc095df52016-08-24 12:23:52 -07001420 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001421 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001422 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001423 ":skia",
1424 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001425 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001426 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001427 "//third_party/libpng",
1428 "//third_party/zlib",
1429 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001430 public_deps = [
1431 ":gpu_tool_utils", # Test.h #includes headers from this target.
1432 ]
mtkleinc095df52016-08-24 12:23:52 -07001433 }
mtklein2f3416d2016-08-02 16:02:05 -07001434
Mike Klein6e744122016-10-27 12:21:40 -04001435 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001436 test_lib("bench") {
1437 public_include_dirs = [ "bench" ]
1438 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001439 deps = [
1440 ":flags",
1441 ":gm",
1442 ":gpu_tool_utils",
1443 ":skia",
1444 ":tool_utils",
1445 ]
1446 }
mtklein2b6870c2016-07-28 14:17:33 -07001447
mtkleinc095df52016-08-24 12:23:52 -07001448 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001449 public_include_dirs = []
1450 if (skia_use_expat) {
1451 public_include_dirs += [ "experimental/svg/model" ]
1452 sources = [
1453 "experimental/svg/model/SkSVGAttribute.cpp",
1454 "experimental/svg/model/SkSVGAttributeParser.cpp",
1455 "experimental/svg/model/SkSVGCircle.cpp",
1456 "experimental/svg/model/SkSVGClipPath.cpp",
1457 "experimental/svg/model/SkSVGContainer.cpp",
1458 "experimental/svg/model/SkSVGDOM.cpp",
1459 "experimental/svg/model/SkSVGEllipse.cpp",
1460 "experimental/svg/model/SkSVGGradient.cpp",
1461 "experimental/svg/model/SkSVGLine.cpp",
1462 "experimental/svg/model/SkSVGLinearGradient.cpp",
1463 "experimental/svg/model/SkSVGNode.cpp",
1464 "experimental/svg/model/SkSVGPath.cpp",
1465 "experimental/svg/model/SkSVGPattern.cpp",
1466 "experimental/svg/model/SkSVGPoly.cpp",
1467 "experimental/svg/model/SkSVGRadialGradient.cpp",
1468 "experimental/svg/model/SkSVGRect.cpp",
1469 "experimental/svg/model/SkSVGRenderContext.cpp",
1470 "experimental/svg/model/SkSVGSVG.cpp",
1471 "experimental/svg/model/SkSVGShape.cpp",
1472 "experimental/svg/model/SkSVGStop.cpp",
1473 "experimental/svg/model/SkSVGTransformableNode.cpp",
1474 "experimental/svg/model/SkSVGUse.cpp",
1475 "experimental/svg/model/SkSVGValue.cpp",
1476 ]
1477 deps = [
1478 ":skia",
1479 ":xml",
1480 ]
1481 }
mtkleinc095df52016-08-24 12:23:52 -07001482 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001483
Mike Klein38af9432016-11-11 11:39:44 -05001484 if (skia_use_lua) {
1485 test_lib("lua") {
1486 public_include_dirs = []
1487 sources = [
1488 "src/utils/SkLua.cpp",
1489 "src/utils/SkLuaCanvas.cpp",
1490 ]
1491 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001492 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001493 "//third_party/lua",
1494 ]
1495 }
1496
Mike Kleine6682eb2017-01-05 10:54:57 -05001497 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001498 sources = [
1499 "tools/lua/lua_app.cpp",
1500 ]
1501 deps = [
1502 ":lua",
1503 ":skia",
1504 "//third_party/lua",
1505 ]
Mike Klein38af9432016-11-11 11:39:44 -05001506 }
1507
Mike Kleine6682eb2017-01-05 10:54:57 -05001508 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001509 sources = [
1510 "tools/lua/lua_pictures.cpp",
1511 ]
1512 deps = [
1513 ":flags",
1514 ":lua",
1515 ":skia",
1516 ":tool_utils",
1517 "//third_party/lua",
1518 ]
Mike Klein38af9432016-11-11 11:39:44 -05001519 }
1520 }
1521
Cary Clark8032b982017-07-28 11:04:54 -04001522 test_app("bookmaker") {
1523 sources = [
1524 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001525 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001526 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001527 "tools/bookmaker/fiddleParser.cpp",
1528 "tools/bookmaker/includeParser.cpp",
1529 "tools/bookmaker/includeWriter.cpp",
1530 "tools/bookmaker/mdOut.cpp",
1531 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001532 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001533 "tools/bookmaker/spellCheck.cpp",
1534 ]
1535 deps = [
1536 ":flags",
1537 ":skia",
1538 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001539 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001540 ]
1541 }
1542
Florin Malitabfe876a2018-09-02 12:33:59 -04001543 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001544 test_app("skottie_tool") {
1545 deps = [
1546 "modules/skottie:tool",
1547 ]
1548 }
1549 }
1550
Kevin Lubickebf648e2017-09-21 13:45:16 -04001551 if (target_cpu != "wasm") {
1552 import("gn/samples.gni")
1553 test_lib("samples") {
1554 public_include_dirs = [ "samplecode" ]
1555 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001556 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001557 public_deps = [
1558 ":tool_utils",
1559 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001560 deps = [
1561 ":experimental_svg_model",
1562 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001563 ":xml",
Herb Derby264182c2018-05-29 15:53:40 -04001564 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001565 ]
Mike Klein38af9432016-11-11 11:39:44 -05001566
Ruiqi Maof5101492018-06-29 14:32:21 -04001567 # NIMA does not build on Windows clang
1568 if (!is_win || !is_clang) {
1569 deps += [ "//third_party/Nima-Cpp" ]
1570 }
1571
Kevin Lubickebf648e2017-09-21 13:45:16 -04001572 if (skia_use_lua) {
1573 sources += [ "samplecode/SampleLua.cpp" ]
1574 deps += [
1575 ":lua",
1576 "//third_party/lua",
1577 ]
1578 }
1579 }
Mike Klein7af351a2018-07-27 09:54:43 -04001580 test_app("imgcvt") {
1581 sources = [
1582 "tools/imgcvt.cpp",
1583 ]
1584 deps = [
1585 ":skcms",
1586 ":skia",
1587 ]
1588 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001589 test_app("dm") {
1590 sources = [
1591 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001592 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001593 "dm/DMJsonWriter.cpp",
1594 "dm/DMSrcSink.cpp",
1595 ]
1596 include_dirs = [ "tests" ]
1597 deps = [
1598 ":common_flags",
1599 ":experimental_svg_model",
1600 ":flags",
1601 ":gm",
1602 ":gpu_tool_utils",
1603 ":skia",
1604 ":tests",
1605 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001606 "modules/skottie",
Florin Malita3b526b02018-05-25 12:43:51 -04001607 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001608 "//third_party/jsoncpp",
1609 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001610 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001611
1612 # NIMA does not build on Windows clang
1613 if (!is_win || !is_clang) {
1614 deps += [ "//third_party/Nima-Cpp" ]
1615 }
Mike Klein38af9432016-11-11 11:39:44 -05001616 }
Brian Osman16adfa32016-10-18 14:42:44 -04001617 }
1618
Mike Kleina8a51ce2018-01-09 12:34:11 -05001619 if (!is_win) {
1620 test_app("remote_demo") {
1621 sources = [
1622 "tools/remote_demo.cpp",
1623 ]
1624 deps = [
1625 ":skia",
1626 ]
1627 }
1628 }
1629
Mike Kleine6682eb2017-01-05 10:54:57 -05001630 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001631 sources = [
1632 "bench/nanobench.cpp",
1633 ]
1634 deps = [
1635 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001636 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001637 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001638 ":flags",
1639 ":gm",
1640 ":gpu_tool_utils",
1641 ":skia",
1642 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001643 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001644 "//third_party/jsoncpp",
1645 ]
mtklein2b6870c2016-07-28 14:17:33 -07001646 }
halcanary19a97202016-08-03 15:08:04 -07001647
Ravi Mistry10d36c52017-01-31 09:49:18 -05001648 test_app("skpinfo") {
1649 sources = [
1650 "tools/skpinfo.cpp",
1651 ]
1652 deps = [
1653 ":flags",
1654 ":skia",
1655 ]
1656 }
1657
Brian Osmanc9a42472018-05-31 13:17:12 -04001658 test_app("skpbench") {
1659 sources = [
1660 "tools/skpbench/skpbench.cpp",
1661 ]
1662 deps = [
1663 ":flags",
1664 ":gpu_tool_utils",
1665 ":skia",
1666 ":tool_utils",
1667 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001668 }
1669
Mike Kleine6682eb2017-01-05 10:54:57 -05001670 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001671 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001672 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001673 ]
1674 deps = [
1675 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001676 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001677 ]
halcanary3eee9d92016-09-10 07:01:53 -07001678 }
mtklein046cb562016-09-16 10:23:12 -07001679
Ben Wagner219f3622017-07-17 15:32:25 -04001680 test_app("create_test_font") {
1681 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001682 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001683 ]
1684 deps = [
1685 ":skia",
1686 ]
1687 assert_no_deps = [
1688 # tool_utils requires the output of this app.
1689 ":tool_utils",
1690 ]
1691 }
1692
Florin Malita5d3ff432018-07-31 16:38:43 -04001693 if (skia_use_expat) {
1694 test_app("create_test_font_color") {
1695 sources = [
1696 "tools/fonts/create_test_font_color.cpp",
1697 ]
1698 deps = [
1699 ":flags",
1700 ":skia",
1701 ":tool_utils",
1702 ]
1703 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001704 }
1705
Mike Kleine6682eb2017-01-05 10:54:57 -05001706 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001707 sources = [
1708 "tools/get_images_from_skps.cpp",
1709 ]
1710 deps = [
1711 ":flags",
1712 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001713 ]
mtklein046cb562016-09-16 10:23:12 -07001714 }
mtkleinecbc5262016-09-22 11:51:24 -07001715
Kevin Lubickebf648e2017-09-21 13:45:16 -04001716 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001717 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001718 sources = [
1719 "tools/skiaserve/Request.cpp",
1720 "tools/skiaserve/Response.cpp",
1721 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001722 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1723 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1724 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1725 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1726 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1727 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1728 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1729 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1730 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001731 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1732 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001733 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1734 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1735 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1736 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1737 ]
1738 deps = [
1739 ":flags",
1740 ":gpu_tool_utils",
1741 ":skia",
1742 ":tool_utils",
1743 "//third_party/jsoncpp",
1744 "//third_party/libmicrohttpd",
1745 "//third_party/libpng",
1746 ]
Mike Klein7d302882016-11-03 14:06:31 -04001747 }
mtkleinecbc5262016-09-22 11:51:24 -07001748 }
kjlubick14f984b2016-10-03 11:49:45 -07001749
Mike Kleine6682eb2017-01-05 10:54:57 -05001750 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001751 include_dirs = [
1752 "tools",
1753 "tools/debugger",
1754 ]
kjlubick14f984b2016-10-03 11:49:45 -07001755 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001756 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001757 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001758 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001759 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001760 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001761 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001762 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001763 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001764 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001765 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001766 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001767 "fuzz/FuzzRegionOp.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001768 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1769 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001770 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001771 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001772 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001773 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1774 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001775 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001776 "tools/UrlDataManager.cpp",
1777 "tools/debugger/SkDebugCanvas.cpp",
1778 "tools/debugger/SkDrawCommand.cpp",
1779 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001780 ]
1781 deps = [
1782 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001783 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001784 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001785 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001786 "//third_party/jsoncpp",
1787 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001788 ]
kjlubick14f984b2016-10-03 11:49:45 -07001789 }
Mike Klein38312422016-10-05 15:41:01 -04001790
Mike Kleine6682eb2017-01-05 10:54:57 -05001791 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001792 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001793 rebase_path("tests/skia_test.cpp"),
1794 rebase_path("tests/Test.cpp"),
1795 ]
caryclark9feb6322016-10-25 08:58:26 -07001796 deps = [
1797 ":flags",
1798 ":gpu_tool_utils",
1799 ":skia",
1800 ":tool_utils",
1801 ]
caryclark9feb6322016-10-25 08:58:26 -07001802 }
1803
Mike Kleine6682eb2017-01-05 10:54:57 -05001804 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001805 sources = [
1806 "tools/DumpRecord.cpp",
1807 "tools/dump_record.cpp",
1808 ]
1809 deps = [
1810 ":flags",
1811 ":skia",
1812 ]
Mike Klein38312422016-10-05 15:41:01 -04001813 }
bungemanfe917272016-10-13 17:36:40 -04001814
Mike Kleine6682eb2017-01-05 10:54:57 -05001815 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001816 sources = [
1817 "tools/skdiff/skdiff.cpp",
1818 "tools/skdiff/skdiff_html.cpp",
1819 "tools/skdiff/skdiff_main.cpp",
1820 "tools/skdiff/skdiff_utils.cpp",
1821 ]
1822 deps = [
1823 ":skia",
1824 ":tool_utils",
1825 ]
bungemanfe917272016-10-13 17:36:40 -04001826 }
halcanarya73d76a2016-10-17 13:19:02 -07001827
Mike Kleine6682eb2017-01-05 10:54:57 -05001828 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001829 sources = [
1830 "tools/skp_parser.cpp",
1831 ]
1832 deps = [
1833 ":skia",
1834 ":tool_utils",
1835 "//third_party/jsoncpp",
1836 ]
halcanarya73d76a2016-10-17 13:19:02 -07001837 }
Brian Osman16adfa32016-10-18 14:42:44 -04001838
Brian Osmanc9a42472018-05-31 13:17:12 -04001839 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05001840 test_lib("skqp_lib") {
1841 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001842 defines =
1843 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001844 if (skia_skqp_enable_driver_correctness_workarounds) {
1845 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1846 }
Hal Canary75427132017-10-11 16:00:31 -04001847 sources = [
1848 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001849 "tools/skqp/gm_knowledge.cpp",
1850 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001851 ]
1852 deps = [
1853 ":gm",
1854 ":gpu_tool_utils",
1855 ":skia",
1856 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001857 ":tool_utils",
1858 ]
1859 }
1860 test_app("skqp") {
1861 sources = [
1862 "tools/skqp/skqp.cpp",
1863 ]
1864 deps = [
1865 ":skia",
1866 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001867 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001868 "//third_party/googletest",
1869 ]
1870 }
1871 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001872 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05001873 test_app("skqp_app") {
1874 is_shared_library = true
1875 sources = [
1876 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1877 ]
1878 deps = [
1879 ":skia",
1880 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001881 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001882 ]
1883 libs = [ "android" ]
1884 }
1885 }
Stan Iliev93151722018-08-02 11:10:52 -04001886 if (is_android && skia_enable_gpu) {
1887 test_app("skottie_android") {
1888 is_shared_library = true
1889
1890 sources = [
1891 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
1892 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
1893 ]
1894 libs = []
1895
1896 include_dirs = []
1897 deps = [
1898 ":skia",
1899 "modules/skottie",
1900 ]
1901 }
1902 }
Hal Canary75427132017-10-11 16:00:31 -04001903
Hal Canarya9de7602018-01-19 13:08:23 -05001904 test_app("list_gms") {
1905 sources = [
1906 "tools/list_gms.cpp",
1907 ]
1908 deps = [
1909 ":gm",
1910 ":skia",
1911 ]
1912 }
1913 test_app("list_gpu_unit_tests") {
1914 sources = [
1915 "dm/DMGpuTestProcs.cpp",
1916 "tools/list_gpu_unit_tests.cpp",
1917 ]
1918 deps = [
1919 ":skia",
1920 ":tests",
1921 ]
1922 }
1923
Brian Osmanc9a42472018-05-31 13:17:12 -04001924 test_lib("sk_app") {
1925 public_include_dirs = [ "tools/sk_app" ]
1926 sources = [
1927 "tools/sk_app/CommandSet.cpp",
1928 "tools/sk_app/GLWindowContext.cpp",
1929 "tools/sk_app/Window.cpp",
1930 ]
1931 libs = []
1932
1933 if (is_android) {
1934 sources += [
1935 "tools/sk_app/android/GLWindowContext_android.cpp",
1936 "tools/sk_app/android/RasterWindowContext_android.cpp",
1937 "tools/sk_app/android/Window_android.cpp",
1938 "tools/sk_app/android/main_android.cpp",
1939 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001940 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001941 libs += [ "android" ]
1942 } else if (is_linux) {
1943 sources += [
1944 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1945 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1946 "tools/sk_app/unix/Window_unix.cpp",
1947 "tools/sk_app/unix/keysym2ucs.c",
1948 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001949 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001950 libs += [
1951 "GL",
1952 "X11",
1953 ]
1954 } else if (is_win) {
1955 sources += [
1956 "tools/sk_app/win/GLWindowContext_win.cpp",
1957 "tools/sk_app/win/RasterWindowContext_win.cpp",
1958 "tools/sk_app/win/Window_win.cpp",
1959 "tools/sk_app/win/main_win.cpp",
1960 ]
Brian Salomon194db172017-08-17 14:37:06 -04001961 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04001962 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001963 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001964 } else if (is_mac) {
1965 sources += [
1966 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1967 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1968 "tools/sk_app/mac/Window_mac.cpp",
1969 "tools/sk_app/mac/main_mac.cpp",
1970 ]
1971 libs += [
1972 "QuartzCore.framework",
1973 "Cocoa.framework",
1974 "Foundation.framework",
1975 ]
1976 } else if (is_ios) {
1977 sources += [
1978 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1979 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1980 "tools/sk_app/ios/Window_ios.cpp",
1981 "tools/sk_app/ios/main_ios.cpp",
1982 ]
1983 }
1984
1985 if (skia_use_vulkan) {
1986 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
1987 if (is_android) {
1988 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
1989 } else if (is_linux) {
1990 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1991 libs += [ "X11-xcb" ]
1992 } else if (is_win) {
1993 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
1994 }
1995 }
1996
1997 deps = [
1998 ":gpu_tool_utils",
1999 ":skia",
2000 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002001 ]
2002 if (is_android) {
2003 deps += [ "//third_party/native_app_glue" ]
2004 } else if (is_mac || is_ios) {
2005 deps += [ "//third_party/libsdl" ]
2006 }
2007 if (skia_use_angle) {
2008 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002009 }
Brian Osman16adfa32016-10-18 14:42:44 -04002010 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002011
Brian Osmanc9a42472018-05-31 13:17:12 -04002012 test_app("viewer") {
2013 is_shared_library = is_android
2014 if (is_ios) {
2015 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002016 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002017 sources = [
2018 "tools/viewer/BisectSlide.cpp",
2019 "tools/viewer/GMSlide.cpp",
2020 "tools/viewer/ImGuiLayer.cpp",
2021 "tools/viewer/ImageSlide.cpp",
2022 "tools/viewer/SKPSlide.cpp",
2023 "tools/viewer/SampleSlide.cpp",
2024 "tools/viewer/SkottieSlide.cpp",
2025 "tools/viewer/SlideDir.cpp",
2026 "tools/viewer/StatsLayer.cpp",
2027 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002028 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002029 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002030 "tools/viewer/Viewer.cpp",
2031 ]
2032 libs = []
2033
2034 include_dirs = []
2035 deps = [
2036 ":experimental_svg_model",
2037 ":flags",
2038 ":gm",
2039 ":gpu_tool_utils",
2040 ":samples",
2041 ":sk_app",
2042 ":skia",
2043 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002044 "modules/skottie",
2045 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002046 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002047 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002048 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002049
2050 # NIMA does not build on Windows clang
2051 if (!is_win || !is_clang) {
2052 sources += [ "tools/viewer/NIMASlide.cpp" ]
2053 deps += [ "//third_party/Nima-Cpp" ]
2054 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002055 }
2056
ziadbbceddbc2018-06-19 13:57:15 -04002057 if (is_android) {
2058 test_app("arcore") {
2059 is_shared_library = true
2060 configs = [
2061 ":skia_public",
2062 "gn:default",
2063 ]
2064
2065 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2066 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2067 sources = []
2068 sources += skia_core_sources
2069 sources += skia_utils_sources
2070 sources += skia_xps_sources
2071 sources += [
2072 "src/android/SkAndroidFrameworkUtils.cpp",
2073 "src/android/SkAnimatedImage.cpp",
2074 "src/android/SkBitmapRegionCodec.cpp",
2075 "src/android/SkBitmapRegionDecoder.cpp",
2076 "src/codec/SkAndroidCodec.cpp",
2077 "src/codec/SkBmpBaseCodec.cpp",
2078 "src/codec/SkBmpCodec.cpp",
2079 "src/codec/SkBmpMaskCodec.cpp",
2080 "src/codec/SkBmpRLECodec.cpp",
2081 "src/codec/SkBmpStandardCodec.cpp",
2082 "src/codec/SkCodec.cpp",
2083 "src/codec/SkCodecImageGenerator.cpp",
2084 "src/codec/SkColorTable.cpp",
2085 "src/codec/SkGifCodec.cpp",
2086 "src/codec/SkMaskSwizzler.cpp",
2087 "src/codec/SkMasks.cpp",
2088 "src/codec/SkSampledCodec.cpp",
2089 "src/codec/SkSampler.cpp",
2090 "src/codec/SkStreamBuffer.cpp",
2091 "src/codec/SkSwizzler.cpp",
2092 "src/codec/SkWbmpCodec.cpp",
2093 "src/images/SkImageEncoder.cpp",
2094 "src/ports/SkDiscardableMemory_none.cpp",
2095 "src/ports/SkImageGenerator_skia.cpp",
2096 "src/ports/SkMemory_malloc.cpp",
2097 "src/ports/SkOSFile_stdio.cpp",
2098 "src/sfnt/SkOTTable_name.cpp",
2099 "src/sfnt/SkOTUtils.cpp",
2100 "src/utils/mac/SkStream_mac.cpp",
2101 "third_party/gif/SkGifImageReader.cpp",
2102 ]
2103 deps = [
2104 ":tool_utils",
2105 "modules/skottie",
2106 "modules/skshaper",
2107 ]
2108 }
2109 }
2110
Brian Osmanc9a42472018-05-31 13:17:12 -04002111 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002112 test_app("HelloWorld") {
2113 sources = [
2114 "example/HelloWorld.cpp",
2115 ]
2116 libs = []
2117
2118 include_dirs = []
2119 deps = [
2120 ":flags",
2121 ":gpu_tool_utils",
2122 ":sk_app",
2123 ":skia",
2124 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002125 ]
2126 }
2127 }
2128
Brian Osmanc9a42472018-05-31 13:17:12 -04002129 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002130 test_app("SkiaSDLExample") {
2131 sources = [
2132 "example/SkiaSDLExample.cpp",
2133 ]
2134 libs = []
2135 include_dirs = []
2136 deps = [
2137 ":gpu_tool_utils",
2138 ":skia",
2139 "//third_party/libsdl",
2140 ]
2141 }
2142 }
2143
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002144 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2145 action_foreach("generate_mocs") {
2146 script = "gn/call.py"
2147 sources = [
2148 "tools/mdbviz/MainWindow.h",
2149 ]
2150 outputs = [
2151 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2152 ]
2153 args = [
2154 "$skia_qt_path" + "/bin/moc",
2155 "{{source}}",
2156 "-o",
2157 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2158 ]
2159 }
2160 action_foreach("generate_resources") {
2161 script = "gn/call.py"
2162 sources = [
2163 "tools/mdbviz/resources.qrc",
2164 ]
2165 outputs = [
2166 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2167 ]
2168 args = [
2169 "$skia_qt_path" + "/bin/rcc",
2170 "{{source}}",
2171 "-o",
2172 "gen/mdbviz/{{source_name_part}}_res.cpp",
2173 ]
2174 }
2175 test_app("mdbviz") {
2176 if (is_win) {
2177 # on Windows we need to disable some exception handling warnings due to the Qt headers
2178 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2179 }
2180 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002181 "tools/UrlDataManager.cpp",
2182 "tools/debugger/SkDebugCanvas.cpp",
2183 "tools/debugger/SkDrawCommand.cpp",
2184 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002185 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002186 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002187 "tools/mdbviz/main.cpp",
2188
2189 # generated files
2190 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2191 "$target_gen_dir/mdbviz/resources_res.cpp",
2192 ]
2193 lib_dirs = [ "$skia_qt_path/lib" ]
2194 libs = [
2195 "Qt5Core.lib",
2196 "Qt5Gui.lib",
2197 "Qt5Widgets.lib",
2198 ]
2199 include_dirs = [
2200 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002201 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002202 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002203 "tools",
2204 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002205 ]
2206 deps = [
2207 ":generate_mocs",
2208 ":generate_resources",
2209 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002210 "//third_party/jsoncpp",
2211 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002212 ]
2213 }
2214 }
2215
Mike Kleine459afd2017-03-03 09:21:30 -05002216 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002217 copy("gdbserver") {
2218 sources = [
2219 "$ndk/$ndk_gdbserver",
2220 ]
2221 outputs = [
2222 "$root_out_dir/gdbserver",
2223 ]
2224 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002225 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002226
2227 if (skia_use_opencl) {
2228 test_app("hello-opencl") {
2229 sources = [
2230 "src/compute/common/cl/assert_cl.c",
2231 "src/compute/common/cl/find_cl.c",
2232 "tools/hello-opencl.cpp",
2233 ]
2234 include_dirs = [ "src/compute/common" ]
Ben Wagner30a4e3d2018-08-07 16:58:15 -04002235 if (is_linux) {
2236 libs = [ "OpenCL" ]
2237 } else if (is_win) {
2238 libs = [ "OpenCL.lib" ]
2239 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002240 }
2241 }
mtklein25c81d42016-07-27 13:55:26 -07002242}