blob: d3019248bb2d75b76d7b2cab0652ac5dedc531eb [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
Mike Kleincfc4f442016-10-26 17:19:03 -04006import("gn/android_framework_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 Klein69f6ed42016-10-13 15:45:07 -040024 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040025 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070026 skia_use_libjpeg_turbo = true
27 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070028 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050029 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070030 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040031 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070032 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070035 skia_enable_android_framework_defines = false
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
mtklein06c35c02016-09-20 12:28:12 -070038 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050039 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050041 skia_enable_tools = is_skia_dev_build
42 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040043 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070044}
Brian Salomon23d73ea2016-10-27 13:31:37 -040045declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040046 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040047 skia_use_sfntly = skia_use_icu
48
Mike Klein4d598a32016-10-31 13:44:49 -040049 if (is_android) {
50 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070051 } else if (is_fuchsia) {
52 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040053 } else {
54 skia_use_vulkan = skia_vulkan_sdk != ""
55 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040056}
Greg Danielec6ae522017-04-25 13:38:26 -040057declare_args() {
58 if (skia_use_vulkan) {
59 if (is_fuchsia) {
60 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
61 } else if (is_linux || is_win) {
62 skia_vulkan_headers = "$skia_vulkan_sdk/include"
63 } else {
64 # When buliding on Android we get the header via the NDK
65 skia_vulkan_headers = ""
66 }
67 } else {
68 skia_vulkan_headers = "third_party/vulkan"
69 }
70}
Brian Salomon789e25e2016-09-30 13:41:03 -040071
mtklein38925aa2016-09-21 10:11:25 -070072# Our tools require static linking (they use non-exported symbols).
73skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070074
mtkleina45be612016-08-29 15:22:10 -070075fontmgr_android_enabled = skia_use_expat && skia_use_freetype
76
mtklein1211e0c2016-07-26 13:55:45 -070077skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070078 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070079 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070080 "include/codec",
81 "include/config",
82 "include/core",
83 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040084 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070085 "include/gpu",
86 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070087 "include/pathops",
88 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070089 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070090 "include/utils",
91 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070092]
93
mtkleinc04ff472016-06-23 10:29:30 -070094# Skia public API, generally provided by :skia.
95config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070096 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -040097 if (skia_vulkan_headers != "") {
98 include_dirs += [ skia_vulkan_headers ]
99 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400100 defines = []
101 if (is_component_build) {
102 defines += [ "SKIA_DLL" ]
103 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400104 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700105 defines += [ "SK_SAMPLES_FOR_X" ]
106 }
mtkleincae1be52016-09-20 08:24:34 -0700107 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -0400108 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -0700109 }
mtklein06c35c02016-09-20 12:28:12 -0700110 if (!skia_enable_gpu) {
111 defines += [ "SK_SUPPORT_GPU=0" ]
112 }
mtkleinc04ff472016-06-23 10:29:30 -0700113}
114
115# Skia internal APIs, used by Skia itself and a few test tools.
116config("skia_private") {
117 visibility = [ ":*" ]
118
119 include_dirs = [
120 "include/private",
121 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700122 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700123 "src/core",
124 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700125 "src/effects/gradients",
126 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700127 "src/image",
128 "src/images",
129 "src/lazy",
130 "src/opts",
131 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700132 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700133 "src/ports",
134 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700135 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700136 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700137 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500138 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700139 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700140 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700141 ]
mtklein150d1132016-08-01 06:56:40 -0700142
Mike Reeda9e241d2017-05-03 10:52:00 -0400143 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700144 if (is_android) {
145 defines += [
146 "SK_GAMMA_EXPONENT=1.4",
147 "SK_GAMMA_CONTRAST=0.0",
148 ]
149 }
mtklein88a7ac02016-09-14 11:16:49 -0700150 if (is_official_build || is_android) {
151 # TODO(bsalomon): it'd be nice to make Android normal.
152 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
153 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400154 libs = []
155 lib_dirs = []
156 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700157 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400158 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400159 lib_dirs += [
160 "$skia_vulkan_sdk/Bin",
161 "$skia_vulkan_sdk/Lib",
162 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400163 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400164 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400165 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400166 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400167 }
Brian Salomon03e05842017-02-23 12:23:47 -0500168 if (skia_enable_gpu) {
169 include_dirs += [ "src/gpu" ]
170 }
Brian Osman34755e22016-12-05 09:46:02 -0500171 if (skia_use_angle) {
172 defines += [ "SK_ANGLE" ]
173 }
Brian Osman3f375d02016-12-28 11:19:22 -0500174 if (skia_enable_discrete_gpu) {
175 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
176 }
mtkleinc04ff472016-06-23 10:29:30 -0700177}
178
179# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
180config("skia_library") {
181 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700182 defines = [ "SKIA_IMPLEMENTATION=1" ]
183}
184
185skia_library_configs = [
186 ":skia_public",
187 ":skia_private",
188 ":skia_library",
189]
190
mtklein9b8583d2016-08-24 17:32:30 -0700191# Use for CPU-specific Skia code that needs particular compiler flags.
192template("opts") {
193 if (invoker.enabled) {
194 source_set(target_name) {
195 forward_variables_from(invoker, "*")
196 configs += skia_library_configs
197 }
198 } else {
199 # If not enabled, a phony empty target that swallows all otherwise unused variables.
200 source_set(target_name) {
201 forward_variables_from(invoker,
202 "*",
203 [
204 "sources",
205 "cflags",
206 ])
207 }
208 }
anmittala7eaf2e2016-08-17 13:57:26 -0700209}
210
mtklein422310d2016-08-16 18:28:43 -0700211is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700212
mtklein7d6fb2c2016-08-25 14:50:44 -0700213opts("none") {
214 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700215 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700216 cflags = []
217}
218
mtklein7d6fb2c2016-08-25 14:50:44 -0700219opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700220 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700221 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700222 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700223}
224
225opts("arm64") {
226 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700227 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700228 cflags = []
229}
230
231opts("crc32") {
232 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700233 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700234 cflags = [ "-march=armv8-a+crc" ]
235}
236
mtklein9b8583d2016-08-24 17:32:30 -0700237opts("sse2") {
238 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400240 if (is_win) {
241 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
242 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400243 cflags = [ "-msse2" ]
244 }
mtklein9b8583d2016-08-24 17:32:30 -0700245}
mtkleinc04ff472016-06-23 10:29:30 -0700246
mtklein9b8583d2016-08-24 17:32:30 -0700247opts("ssse3") {
248 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400250 if (is_win) {
251 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
252 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400253 cflags = [ "-mssse3" ]
254 }
mtklein9b8583d2016-08-24 17:32:30 -0700255}
mtkleinc04ff472016-06-23 10:29:30 -0700256
mtklein9b8583d2016-08-24 17:32:30 -0700257opts("sse41") {
258 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400260 if (is_win) {
261 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
262 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400263 cflags = [ "-msse4.1" ]
264 }
mtklein9b8583d2016-08-24 17:32:30 -0700265}
mtklein4e976072016-08-08 09:06:27 -0700266
mtklein9b8583d2016-08-24 17:32:30 -0700267opts("sse42") {
268 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400270 if (is_win) {
271 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
272 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400273 cflags = [ "-msse4.2" ]
274 }
mtklein9b8583d2016-08-24 17:32:30 -0700275}
276
277opts("avx") {
278 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700279 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400280 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000281 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400282 } else {
283 cflags = [ "-mavx" ]
284 }
mtkleinc04ff472016-06-23 10:29:30 -0700285}
286
Mike Klein78d5a3b2016-09-30 10:48:01 -0400287opts("hsw") {
288 enabled = is_x86
289 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400290 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000291 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400292 } else {
293 cflags = [
294 "-mavx2",
295 "-mbmi",
296 "-mbmi2",
297 "-mf16c",
298 "-mfma",
299 ]
300 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400301}
302
mtkleinc095df52016-08-24 12:23:52 -0700303# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700304template("optional") {
305 if (invoker.enabled) {
306 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700307 if (defined(invoker.public_defines)) {
308 defines = invoker.public_defines
309 }
mtklein457b42a2016-08-23 13:56:37 -0700310 }
311 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700312 forward_variables_from(invoker,
313 "*",
314 [
315 "public_defines",
316 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700317 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700318 ])
mtklein457b42a2016-08-23 13:56:37 -0700319 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700320 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700321 if (defined(invoker.configs_to_remove)) {
322 configs -= invoker.configs_to_remove
323 }
mtklein457b42a2016-08-23 13:56:37 -0700324 }
325 } else {
mtklein457b42a2016-08-23 13:56:37 -0700326 source_set(target_name) {
327 forward_variables_from(invoker,
328 "*",
329 [
330 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700331 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700332 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700333 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700334 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700335 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700336 ])
mtkleincd01b032016-08-31 04:58:19 -0700337 if (defined(invoker.sources_when_disabled)) {
338 sources = invoker.sources_when_disabled
339 }
340 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700341 }
mtkleineb3c4252016-08-23 07:38:09 -0700342 }
mtklein457b42a2016-08-23 13:56:37 -0700343}
mtklein457b42a2016-08-23 13:56:37 -0700344
Mike Kleina04bb452017-02-09 12:24:07 -0500345optional("effects") {
346 enabled = skia_enable_effects
347 sources =
348 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
349 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
350}
351
mtkleina45be612016-08-29 15:22:10 -0700352optional("fontmgr_android") {
353 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700354
355 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500356 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700357 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700358 ]
359 sources = [
360 "src/ports/SkFontMgr_android.cpp",
361 "src/ports/SkFontMgr_android_factory.cpp",
362 "src/ports/SkFontMgr_android_parser.cpp",
363 ]
364}
365
mtkleind2e39db2016-09-07 07:52:55 -0700366optional("fontmgr_custom") {
367 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
368
369 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500370 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700371 ]
372 sources = [
373 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500374 "src/ports/SkFontMgr_custom.h",
375 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700376 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500377 "src/ports/SkFontMgr_custom_embedded.cpp",
378 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700379 ]
380}
381
mtklein3cc22182016-08-29 13:26:14 -0700382optional("fontmgr_fontconfig") {
383 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700384
385 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500386 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700387 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700388 ]
389 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700390 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700391 "src/ports/SkFontConfigInterface_direct.cpp",
392 "src/ports/SkFontConfigInterface_direct_factory.cpp",
393 "src/ports/SkFontMgr_FontConfigInterface.cpp",
394 "src/ports/SkFontMgr_fontconfig.cpp",
395 "src/ports/SkFontMgr_fontconfig_factory.cpp",
396 ]
397}
398
mtkleincdedd0e2016-09-12 15:15:44 -0700399optional("fontmgr_fuchsia") {
400 enabled = is_fuchsia && skia_use_freetype
401
402 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500403 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700404 ]
405 sources = [
406 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500407 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700408 "src/ports/SkFontMgr_custom_empty_factory.cpp",
409 ]
410}
411
mtklein06c35c02016-09-20 12:28:12 -0700412optional("gpu") {
413 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700414 public_defines = []
415
Mike Klein29b3e582017-02-09 11:57:32 -0500416 sources = skia_gpu_sources + skia_sksl_sources +
417 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700418
419 # These paths need to be absolute to match the ones produced by shared_sources.gni.
420 sources -= get_path_info([
421 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
422 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
423 ],
424 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400425 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700426 if (is_android) {
427 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400428 } else if (skia_use_egl) {
429 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
430 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700431 } else if (is_linux) {
432 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500433 libs += [
434 "GL",
435 "GLU",
436 ]
mtklein06c35c02016-09-20 12:28:12 -0700437 } else if (is_mac) {
438 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800439 } else if (is_ios) {
440 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400441 } else if (is_win) {
442 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
443 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700444 } else {
445 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
446 }
mtkleine9fb3d52016-09-20 15:11:46 -0700447
448 if (skia_use_vulkan) {
449 public_defines += [ "SK_VULKAN" ]
450 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700451 if (skia_enable_vulkan_debug_layers) {
452 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
453 }
mtkleine9fb3d52016-09-20 15:11:46 -0700454 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400455 if (skia_enable_spirv_validation) {
456 deps = [
457 "//third_party/spirv-tools",
458 ]
459 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
460 }
mtklein06c35c02016-09-20 12:28:12 -0700461}
462
mtklein63213812016-08-24 09:55:56 -0700463optional("jpeg") {
464 enabled = skia_use_libjpeg_turbo
465 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
466
mtklein63213812016-08-24 09:55:56 -0700467 deps = [
468 "//third_party/libjpeg-turbo:libjpeg",
469 ]
470 sources = [
471 "src/codec/SkJpegCodec.cpp",
472 "src/codec/SkJpegDecoderMgr.cpp",
473 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700474 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400475 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700476 ]
477}
478
479optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500480 enabled = skia_use_zlib && skia_enable_pdf
481 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700482
mtklein63213812016-08-24 09:55:56 -0700483 deps = [
484 "//third_party/zlib",
485 ]
brettwb9447282016-09-01 14:24:39 -0700486 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700487 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700488
489 if (skia_use_sfntly) {
490 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500491 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700492 }
493}
494
495optional("png") {
496 enabled = skia_use_libpng
497 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
498
mtklein63213812016-08-24 09:55:56 -0700499 deps = [
500 "//third_party/libpng",
501 ]
502 sources = [
503 "src/codec/SkIcoCodec.cpp",
504 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400505 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700506 ]
507}
508
scroggof84ad642016-10-31 09:02:57 -0700509optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400510 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700511 public_defines = [ "SK_CODEC_DECODES_RAW" ]
512
513 deps = [
514 "//third_party/dng_sdk",
515 "//third_party/libjpeg-turbo:libjpeg",
516 "//third_party/piex",
517 ]
518
519 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
520 # Skia.
521 configs_to_remove = [ "//gn:no_exceptions" ]
522
523 sources = [
524 "src/codec/SkRawAdapterCodec.cpp",
525 "src/codec/SkRawCodec.cpp",
526 ]
527}
528
mtklein3cc22182016-08-29 13:26:14 -0700529optional("typeface_freetype") {
530 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700531
532 deps = [
533 "//third_party/freetype2",
534 ]
535 sources = [
536 "src/ports/SkFontHost_FreeType.cpp",
537 "src/ports/SkFontHost_FreeType_common.cpp",
538 ]
539}
540
mtklein457b42a2016-08-23 13:56:37 -0700541optional("webp") {
542 enabled = skia_use_libwebp
543 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
544
mtklein457b42a2016-08-23 13:56:37 -0700545 deps = [
546 "//third_party/libwebp",
547 ]
548 sources = [
549 "src/codec/SkWebpAdapterCodec.cpp",
550 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400551 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700552 ]
mtkleineb3c4252016-08-23 07:38:09 -0700553}
554
mtklein63213812016-08-24 09:55:56 -0700555optional("xml") {
556 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000557 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700558
mtklein63213812016-08-24 09:55:56 -0700559 deps = [
560 "//third_party/expat",
561 ]
562 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500563 "src/svg/SkSVGCanvas.cpp",
564 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700565 "src/xml/SkDOM.cpp",
566 "src/xml/SkXMLParser.cpp",
567 "src/xml/SkXMLWriter.cpp",
568 ]
569}
570
mtkleinc04ff472016-06-23 10:29:30 -0700571component("skia") {
572 public_configs = [ ":skia_public" ]
573 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700574
575 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700576 ":arm64",
577 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700578 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700579 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500580 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700581 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700582 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700583 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700584 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700585 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400586 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700587 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700588 ":none",
mtklein63213812016-08-24 09:55:56 -0700589 ":pdf",
590 ":png",
scroggof84ad642016-10-31 09:02:57 -0700591 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700592 ":sse2",
593 ":sse41",
594 ":sse42",
595 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700596 ":webp",
mtklein63213812016-08-24 09:55:56 -0700597 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700598 ]
599
Chinmay Garde43f115c2016-11-16 15:04:12 -0800600 # This file (and all GN files in Skia) are designed to work with an
601 # empty sources assignment filter; we handle all that explicitly.
602 # We clear the filter here for clients who may have set up a global filter.
603 set_sources_assignment_filter([])
604
mtkleinc04ff472016-06-23 10:29:30 -0700605 sources = []
brettwb9447282016-09-01 14:24:39 -0700606 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700607 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500608 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700609 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700610 "src/android/SkBitmapRegionCodec.cpp",
611 "src/android/SkBitmapRegionDecoder.cpp",
612 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700613 "src/codec/SkBmpCodec.cpp",
614 "src/codec/SkBmpMaskCodec.cpp",
615 "src/codec/SkBmpRLECodec.cpp",
616 "src/codec/SkBmpStandardCodec.cpp",
617 "src/codec/SkCodec.cpp",
618 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700619 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700620 "src/codec/SkMaskSwizzler.cpp",
621 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700622 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700623 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700624 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700625 "src/codec/SkSwizzler.cpp",
626 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700627 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700628 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700629 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700630 "src/ports/SkMemory_malloc.cpp",
631 "src/ports/SkOSFile_stdio.cpp",
632 "src/sfnt/SkOTTable_name.cpp",
633 "src/sfnt/SkOTUtils.cpp",
634 "src/utils/mac/SkStream_mac.cpp",
635 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700636 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700637 ]
brettwb9447282016-09-01 14:24:39 -0700638
mtklein7d6fb2c2016-08-25 14:50:44 -0700639 libs = []
640
mtkleinc04ff472016-06-23 10:29:30 -0700641 if (is_win) {
642 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400643 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700644 "src/ports/SkDebug_win.cpp",
645 "src/ports/SkFontHost_win.cpp",
646 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700647 "src/ports/SkImageEncoder_WIC.cpp",
648 "src/ports/SkImageGeneratorWIC.cpp",
649 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700650 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700651 "src/ports/SkScalerContext_win_dw.cpp",
652 "src/ports/SkTLS_win.cpp",
653 "src/ports/SkTypeface_win_dw.cpp",
654 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400655 if (skia_use_gdi) {
656 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
657 libs += [
658 "Gdi32.lib",
659 "Usp10.lib",
660 ]
661 } else {
662 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
663 }
mtkleinb9be9792016-09-16 14:44:18 -0700664 sources -=
665 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400666 libs += [
667 "FontSub.lib",
668 "Ole32.lib",
669 "OleAut32.lib",
670 "User32.lib",
671 ]
mtkleinc04ff472016-06-23 10:29:30 -0700672 } else {
673 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700674 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700675 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700676 "src/ports/SkTLS_pthread.cpp",
677 ]
678 }
679
mtklein7d6fb2c2016-08-25 14:50:44 -0700680 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500681 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500682 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500683 deps += [ "//third_party/cpu-features" ]
684 }
mtklein06c35c02016-09-20 12:28:12 -0700685 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700686 libs += [
687 "EGL",
688 "GLESv2",
689 "log",
690 ]
691 }
692
mtkleinc04ff472016-06-23 10:29:30 -0700693 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700694 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700695 }
696
697 if (is_mac) {
698 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700699 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700700 "src/ports/SkFontHost_mac.cpp",
701 "src/ports/SkImageEncoder_CG.cpp",
702 "src/ports/SkImageGeneratorCG.cpp",
703 ]
mtklein09e61f72016-08-23 13:35:28 -0700704 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400705 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
706 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700707 "ApplicationServices.framework",
708 "OpenGL.framework",
709 ]
mtkleinc04ff472016-06-23 10:29:30 -0700710 }
abarth6fc8ff02016-07-15 15:15:15 -0700711
Mike Klein7d302882016-11-03 14:06:31 -0400712 if (is_ios) {
713 sources += [
714 "src/ports/SkDebug_stdio.cpp",
715 "src/ports/SkFontHost_mac.cpp",
716 "src/ports/SkImageEncoder_CG.cpp",
717 "src/ports/SkImageGeneratorCG.cpp",
718 ]
719 libs += [
720 "CoreFoundation.framework",
721 "CoreGraphics.framework",
722 "CoreText.framework",
723 "ImageIO.framework",
724 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400725
726 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
727 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400728 ]
729 }
730
abarth6fc8ff02016-07-15 15:15:15 -0700731 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700732 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700733 }
mtkleinc04ff472016-06-23 10:29:30 -0700734}
735
mtkleinc095df52016-08-24 12:23:52 -0700736# Targets guarded by skia_enable_tools may use //third_party freely.
737if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500738 # Used by gn_to_bp.py to list our public include dirs.
739 source_set("public") {
740 configs += [ ":skia_public" ]
741 }
742
Mike Kleinc36dedf2016-11-18 09:35:28 -0500743 config("skia.h_config") {
744 include_dirs = [ "$target_gen_dir" ]
745 }
746 action("skia.h") {
747 public_configs = [ ":skia.h_config" ]
748 skia_h = "$target_gen_dir/skia.h"
749 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400750 args = [ rebase_path(skia_h, root_build_dir) ] +
Greg Danielec6ae522017-04-25 13:38:26 -0400751 rebase_path(skia_public_includes) +
752 [ rebase_path("third_party/vulkan") ]
Mike Kleinc36dedf2016-11-18 09:35:28 -0500753 depfile = "$skia_h.deps"
754 outputs = [
755 skia_h,
756 ]
757 }
758
759 if (skia_enable_gpu && target_cpu == "x64") {
760 # Our bots only have 64-bit libOSMesa installed.
761 # TODO: worth fixing?
762 executable("fiddle") {
763 libs = []
764 if (is_linux) {
765 libs += [ "OSMesa" ]
766 }
767
768 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500769 "tools/fiddle/draw.cpp",
770 "tools/fiddle/fiddle_main.cpp",
771 ]
Joe Gregorio1e735c02017-04-19 14:05:14 -0400772 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500773 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400774 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500775 ":skia",
776 ":skia.h",
777 ]
778 }
779 }
780
781 if (skia_enable_gpu) {
782 source_set("public_headers_warnings_check") {
783 sources = [
784 "tools/public_headers_warnings_check.cpp",
785 ]
786 configs -= [ "//gn:warnings_except_public_headers" ]
787 deps = [
788 ":skia",
789 ":skia.h",
790 ]
791 }
792 }
793
mtkleinc095df52016-08-24 12:23:52 -0700794 template("test_lib") {
795 config(target_name + "_config") {
796 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700797 if (defined(invoker.public_defines)) {
798 defines = invoker.public_defines
799 }
mtklein25c81d42016-07-27 13:55:26 -0700800 }
mtkleinc095df52016-08-24 12:23:52 -0700801 source_set(target_name) {
802 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
803 public_configs = [
804 ":" + target_name + "_config",
805 ":skia_private",
806 ]
807
808 if (!defined(deps)) {
809 deps = []
810 }
811 deps += [ ":skia" ]
812 testonly = true
813 }
mtklein25c81d42016-07-27 13:55:26 -0700814 }
mtklein25c81d42016-07-27 13:55:26 -0700815
Mike Kleine6682eb2017-01-05 10:54:57 -0500816 template("test_app") {
817 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
818 shared_library("lib" + target_name) {
819 forward_variables_from(invoker, "*", [ "is_shared_library" ])
820 testonly = true
821 }
822 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500823 _executable = target_name
824 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500825 forward_variables_from(invoker, "*", [ "is_shared_library" ])
826 testonly = true
827 }
828 }
Mike Klein7d921032017-01-05 12:20:41 -0500829 if (is_android && skia_android_serial != "" && defined(_executable)) {
830 action("push_" + target_name) {
831 script = "gn/push_to_android.py"
832 deps = [
833 ":" + _executable,
834 ]
835 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
836 outputs = [
837 _stamp,
838 ]
839 args = [
840 rebase_path("$root_build_dir/$_executable"),
841 skia_android_serial,
842 rebase_path(_stamp),
843 ]
844 testonly = true
845 }
846 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500847 }
848
mtkleinc095df52016-08-24 12:23:52 -0700849 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700850 public_include_dirs = []
851 if (skia_enable_gpu) {
852 public_defines = []
853 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700854
855 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700856 sources = [
857 "tools/gpu/GrContextFactory.cpp",
858 "tools/gpu/GrTest.cpp",
859 "tools/gpu/TestContext.cpp",
860 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700861 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700862 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
863 "tools/gpu/gl/debug/GrBufferObj.cpp",
864 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
865 "tools/gpu/gl/debug/GrProgramObj.cpp",
866 "tools/gpu/gl/debug/GrShaderObj.cpp",
867 "tools/gpu/gl/debug/GrTextureObj.cpp",
868 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
869 "tools/gpu/gl/null/NullGLTestContext.cpp",
870 ]
871 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700872
Kevin Lubick4a24e102017-03-29 11:19:01 -0400873 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700874 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400875 } else if (is_ios) {
876 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
877 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700878 } else if (is_linux) {
879 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500880 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700881 } else if (is_mac) {
882 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400883 } else if (is_win) {
884 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
885 libs += [
886 "Gdi32.lib",
887 "OpenGL32.lib",
888 ]
mtklein38925aa2016-09-21 10:11:25 -0700889 }
mtklein6ef69992016-09-14 06:12:09 -0700890
Mike Kleinc168a3a2016-11-14 14:53:13 +0000891 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000892 deps += [ "//third_party/angle2" ]
893 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
894 }
mtklein38925aa2016-09-21 10:11:25 -0700895 if (skia_use_mesa) {
896 public_defines += [ "SK_MESA" ]
897 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
898 libs += [ "OSMesa" ]
899 }
mtkleind68f9b02016-09-23 13:18:41 -0700900 if (skia_use_vulkan) {
901 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400902 if (is_win) {
903 libs += [ "vulkan-1.lib" ]
904 } else {
905 libs += [ "vulkan" ]
906 }
mtkleind68f9b02016-09-23 13:18:41 -0700907 }
mtkleina627b5c2016-09-20 13:36:47 -0700908 }
mtklein25c81d42016-07-27 13:55:26 -0700909 }
mtklein25c81d42016-07-27 13:55:26 -0700910
mtkleinc095df52016-08-24 12:23:52 -0700911 test_lib("flags") {
912 public_include_dirs = [ "tools/flags" ]
913 sources = [
914 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700915 ]
916 }
917 test_lib("common_flags") {
918 public_include_dirs = [ "tools/flags" ]
919 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700920 "tools/flags/SkCommonFlags.cpp",
921 "tools/flags/SkCommonFlagsConfig.cpp",
922 ]
923 deps = [
mtklein046cb562016-09-16 10:23:12 -0700924 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700925 ":gpu_tool_utils",
926 ]
927 }
mtklein25c81d42016-07-27 13:55:26 -0700928
mtkleinc095df52016-08-24 12:23:52 -0700929 test_lib("tool_utils") {
930 public_include_dirs = [
931 "tools",
932 "tools/debugger",
933 "tools/timer",
934 ]
935 sources = [
mtkleinb37c0342016-09-09 11:07:45 -0700936 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700937 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700938 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700939 "tools/ProcStats.cpp",
940 "tools/Resources.cpp",
941 "tools/ThermalManager.cpp",
942 "tools/UrlDataManager.cpp",
943 "tools/debugger/SkDebugCanvas.cpp",
944 "tools/debugger/SkDrawCommand.cpp",
945 "tools/debugger/SkJsonWriteBuffer.cpp",
946 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700947 "tools/picture_utils.cpp",
948 "tools/random_parse_path.cpp",
949 "tools/sk_tool_utils.cpp",
950 "tools/sk_tool_utils_font.cpp",
951 "tools/timer/Timer.cpp",
952 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500953 libs = []
954 if (is_ios) {
955 sources += [ "tools/ios_utils.m" ]
956 libs += [ "Foundation.framework" ]
957 }
mtkleinc095df52016-08-24 12:23:52 -0700958 deps = [
mtklein046cb562016-09-16 10:23:12 -0700959 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700960 ":flags",
961 "//third_party/libpng",
962 ]
963 public_deps = [
964 "//third_party/jsoncpp",
965 ]
966 }
mtklein25c81d42016-07-27 13:55:26 -0700967
Mike Klein6e744122016-10-27 12:21:40 -0400968 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700969 test_lib("gm") {
970 public_include_dirs = [ "gm" ]
971 sources = gm_sources
972 deps = [
scroggo19b91532016-10-24 09:03:26 -0700973 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700974 ":gpu_tool_utils",
975 ":skia",
976 ":tool_utils",
977 ]
978 }
mtklein25c81d42016-07-27 13:55:26 -0700979
Mike Klein6e744122016-10-27 12:21:40 -0400980 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700981 test_lib("tests") {
982 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400983 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700984 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400985 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700986 }
mtkleinc095df52016-08-24 12:23:52 -0700987 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700988 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700989 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700990 ":skia",
991 ":tool_utils",
992 "//third_party/libpng",
993 "//third_party/zlib",
994 ]
Mike Kleind63442d2017-03-27 14:16:04 -0400995 public_deps = [
996 ":gpu_tool_utils", # Test.h #includes headers from this target.
997 ]
mtkleinc095df52016-08-24 12:23:52 -0700998 }
mtklein2f3416d2016-08-02 16:02:05 -0700999
Mike Klein6e744122016-10-27 12:21:40 -04001000 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001001 test_lib("bench") {
1002 public_include_dirs = [ "bench" ]
1003 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001004 deps = [
1005 ":flags",
1006 ":gm",
1007 ":gpu_tool_utils",
1008 ":skia",
1009 ":tool_utils",
1010 ]
1011 }
mtklein2b6870c2016-07-28 14:17:33 -07001012
mtkleinc095df52016-08-24 12:23:52 -07001013 test_lib("experimental_svg_model") {
1014 public_include_dirs = [ "experimental/svg/model" ]
1015 sources = [
1016 "experimental/svg/model/SkSVGAttribute.cpp",
1017 "experimental/svg/model/SkSVGAttributeParser.cpp",
1018 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001019 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001020 "experimental/svg/model/SkSVGContainer.cpp",
1021 "experimental/svg/model/SkSVGDOM.cpp",
1022 "experimental/svg/model/SkSVGEllipse.cpp",
1023 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001024 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001025 "experimental/svg/model/SkSVGNode.cpp",
1026 "experimental/svg/model/SkSVGPath.cpp",
1027 "experimental/svg/model/SkSVGPoly.cpp",
1028 "experimental/svg/model/SkSVGRect.cpp",
1029 "experimental/svg/model/SkSVGRenderContext.cpp",
1030 "experimental/svg/model/SkSVGSVG.cpp",
1031 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001032 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001033 "experimental/svg/model/SkSVGTransformableNode.cpp",
1034 "experimental/svg/model/SkSVGValue.cpp",
1035 ]
1036 deps = [
1037 ":skia",
1038 ]
1039 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001040
Brian Osman16adfa32016-10-18 14:42:44 -04001041 test_lib("views") {
1042 public_include_dirs = [ "include/views" ]
1043 sources = [
1044 "src/views/SkEvent.cpp",
1045 "src/views/SkEventSink.cpp",
1046 "src/views/SkOSMenu.cpp",
1047 "src/views/SkTagList.cpp",
1048 "src/views/SkTouchGesture.cpp",
1049 "src/views/SkView.cpp",
1050 "src/views/SkViewPriv.cpp",
1051 ]
1052 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001053 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001054 if (!is_android) {
1055 sources += [ "src/views/SkWindow.cpp" ]
1056 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001057 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001058 public_include_dirs += [ "src/views/unix" ]
1059 sources += [
1060 "src/views/unix/SkOSWindow_Unix.cpp",
1061 "src/views/unix/keysym2ucs.c",
1062 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001063 libs += [
1064 "GL",
1065 "X11",
1066 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001067 } else if (is_mac) {
1068 sources += [
1069 "src/views/mac/SkEventNotifier.mm",
1070 "src/views/mac/SkNSView.mm",
1071 "src/views/mac/SkOSWindow_Mac.mm",
1072 "src/views/mac/SkTextFieldCell.m",
1073 ]
1074 libs += [
1075 "QuartzCore.framework",
1076 "Cocoa.framework",
1077 "Foundation.framework",
1078 ]
1079 } else if (is_win) {
1080 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1081 }
Brian Osman34755e22016-12-05 09:46:02 -05001082 if (skia_use_angle) {
1083 deps += [ "//third_party/angle2" ]
1084 }
Brian Osman16adfa32016-10-18 14:42:44 -04001085 }
1086
Mike Klein38af9432016-11-11 11:39:44 -05001087 if (skia_use_lua) {
1088 test_lib("lua") {
1089 public_include_dirs = []
1090 sources = [
1091 "src/utils/SkLua.cpp",
1092 "src/utils/SkLuaCanvas.cpp",
1093 ]
1094 deps = [
1095 "//third_party/lua",
1096 ]
1097 }
1098
Mike Kleine6682eb2017-01-05 10:54:57 -05001099 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001100 sources = [
1101 "tools/lua/lua_app.cpp",
1102 ]
1103 deps = [
1104 ":lua",
1105 ":skia",
1106 "//third_party/lua",
1107 ]
Mike Klein38af9432016-11-11 11:39:44 -05001108 }
1109
Mike Kleine6682eb2017-01-05 10:54:57 -05001110 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001111 sources = [
1112 "tools/lua/lua_pictures.cpp",
1113 ]
1114 deps = [
1115 ":flags",
1116 ":lua",
1117 ":skia",
1118 ":tool_utils",
1119 "//third_party/lua",
1120 ]
Mike Klein38af9432016-11-11 11:39:44 -05001121 }
1122 }
1123
Mike Klein6e744122016-10-27 12:21:40 -04001124 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001125 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001126 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001127 include_dirs = [ "experimental" ]
1128 sources = samples_sources + [
1129 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1130 "experimental/SkSetPoly3To3.cpp",
1131 "experimental/SkSetPoly3To3_A.cpp",
1132 "experimental/SkSetPoly3To3_D.cpp",
1133 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001134 deps = [
1135 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001136 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001137 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001138 ":tool_utils",
1139 ":views",
1140 ":xml",
1141 ]
Mike Klein38af9432016-11-11 11:39:44 -05001142
1143 if (skia_use_lua) {
1144 sources += [ "samplecode/SampleLua.cpp" ]
1145 deps += [
1146 ":lua",
1147 "//third_party/lua",
1148 ]
1149 }
Brian Osman16adfa32016-10-18 14:42:44 -04001150 }
1151
Mike Kleine6682eb2017-01-05 10:54:57 -05001152 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001153 sources = [
1154 "dm/DM.cpp",
1155 "dm/DMJsonWriter.cpp",
1156 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001157 ]
1158 include_dirs = [ "tests" ]
1159 deps = [
mtklein046cb562016-09-16 10:23:12 -07001160 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001161 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001162 ":flags",
1163 ":gm",
1164 ":gpu_tool_utils",
1165 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001166 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001167 ":tool_utils",
1168 "//third_party/jsoncpp",
1169 "//third_party/libpng",
1170 ]
mtklein2b6870c2016-07-28 14:17:33 -07001171 }
1172
Mike Klein06432b22017-03-21 13:14:33 -04001173 test_app("ok") {
1174 sources = [
1175 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001176 "tools/ok_dsts.cpp",
1177 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001178 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001179 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001180 ]
1181 deps = [
1182 ":gm",
1183 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001184 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001185 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001186 ]
1187 }
1188
Mike Kleina3430172016-09-27 16:46:29 -04001189 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001190 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001191 sources = [
1192 "tools/monobench.cpp",
1193 ]
1194 deps = [
1195 ":bench",
1196 ":skia",
1197 ]
Mike Kleina3430172016-09-27 16:46:29 -04001198 }
mtklein2b6870c2016-07-28 14:17:33 -07001199 }
1200
Mike Kleine6682eb2017-01-05 10:54:57 -05001201 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001202 sources = [
1203 "bench/nanobench.cpp",
1204 ]
1205 deps = [
1206 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001207 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001208 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001209 ":flags",
1210 ":gm",
1211 ":gpu_tool_utils",
1212 ":skia",
1213 ":tool_utils",
1214 "//third_party/jsoncpp",
1215 ]
mtklein2b6870c2016-07-28 14:17:33 -07001216 }
halcanary19a97202016-08-03 15:08:04 -07001217
Ravi Mistry10d36c52017-01-31 09:49:18 -05001218 test_app("skpinfo") {
1219 sources = [
1220 "tools/skpinfo.cpp",
1221 ]
1222 deps = [
1223 ":flags",
1224 ":skia",
1225 ]
1226 }
1227
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001228 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001229 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001230 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001231 "samplecode/SampleApp.cpp",
1232 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001233 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001234 if (is_mac) {
1235 sources += [ "src/views/mac/skia_mac.mm" ]
1236 } else if (is_win) {
1237 sources += [ "src/views/win/skia_win.cpp" ]
1238 } else if (is_linux) {
1239 sources += [ "src/views/unix/skia_unix.cpp" ]
1240 }
mtklein38925aa2016-09-21 10:11:25 -07001241 deps = [
1242 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001243 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001244 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001245 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001246 ":skia",
1247 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001248 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001249 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001250 if (skia_use_angle) {
1251 deps += [ "//third_party/angle2" ]
1252 }
mtklein38925aa2016-09-21 10:11:25 -07001253 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001254 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001255
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001256 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001257 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001258 sources = [
1259 "tools/skpbench/skpbench.cpp",
1260 ]
1261 deps = [
1262 ":flags",
1263 ":gpu_tool_utils",
1264 ":skia",
1265 ":tool_utils",
1266 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001267 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001268 }
1269
Mike Klein7d302882016-11-03 14:06:31 -04001270 # We can't yet build ICU on iOS or Windows.
1271 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001272 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001273 sources = [
1274 "tools/SkShaper_harfbuzz.cpp",
1275 "tools/using_skia_and_harfbuzz.cpp",
1276 ]
1277 deps = [
1278 ":skia",
1279 "//third_party/harfbuzz",
1280 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001281 }
halcanary19a97202016-08-03 15:08:04 -07001282 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001283 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001284 sources = [
1285 "tools/SkShaper_primitive.cpp",
1286 "tools/using_skia_and_harfbuzz.cpp",
1287 ]
1288 deps = [
1289 ":skia",
1290 ]
halcanary3eee9d92016-09-10 07:01:53 -07001291 }
mtklein046cb562016-09-16 10:23:12 -07001292
Mike Kleine6682eb2017-01-05 10:54:57 -05001293 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001294 sources = [
1295 "tools/get_images_from_skps.cpp",
1296 ]
1297 deps = [
1298 ":flags",
1299 ":skia",
1300 "//third_party/jsoncpp",
1301 ]
mtklein046cb562016-09-16 10:23:12 -07001302 }
mtkleinecbc5262016-09-22 11:51:24 -07001303
Mike Kleine6682eb2017-01-05 10:54:57 -05001304 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001305 sources = [
1306 "tools/colorspaceinfo.cpp",
1307 ]
1308 deps = [
1309 ":flags",
1310 ":skia",
1311 ":tool_utils",
1312 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001313 }
1314
Mike Klein7d302882016-11-03 14:06:31 -04001315 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001316 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001317 sources = [
1318 "tools/skiaserve/Request.cpp",
1319 "tools/skiaserve/Response.cpp",
1320 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001321 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1322 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1323 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1324 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1325 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1326 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1327 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1328 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1329 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001330 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1331 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001332 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1333 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1334 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1335 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1336 ]
1337 deps = [
1338 ":flags",
1339 ":gpu_tool_utils",
1340 ":skia",
1341 ":tool_utils",
1342 "//third_party/jsoncpp",
1343 "//third_party/libmicrohttpd",
1344 "//third_party/libpng",
1345 ]
Mike Klein7d302882016-11-03 14:06:31 -04001346 }
mtkleinecbc5262016-09-22 11:51:24 -07001347 }
kjlubick14f984b2016-10-03 11:49:45 -07001348
Mike Kleine6682eb2017-01-05 10:54:57 -05001349 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001350 sources = [
1351 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001352 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001353 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001354 "fuzz/FuzzGradients.cpp",
1355 "fuzz/FuzzParsePath.cpp",
1356 "fuzz/FuzzPathop.cpp",
1357 "fuzz/FuzzScaleToSides.cpp",
1358 "fuzz/fuzz.cpp",
1359 ]
1360 deps = [
1361 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001362 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001363 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001364 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001365 ]
kjlubick14f984b2016-10-03 11:49:45 -07001366 }
Mike Klein38312422016-10-05 15:41:01 -04001367
Mike Kleine6682eb2017-01-05 10:54:57 -05001368 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001369 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001370 rebase_path("tests/skia_test.cpp"),
1371 rebase_path("tests/Test.cpp"),
1372 ]
caryclark9feb6322016-10-25 08:58:26 -07001373 deps = [
1374 ":flags",
1375 ":gpu_tool_utils",
1376 ":skia",
1377 ":tool_utils",
1378 ]
caryclark9feb6322016-10-25 08:58:26 -07001379 }
1380
Mike Kleine6682eb2017-01-05 10:54:57 -05001381 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001382 sources = [
1383 "tools/DumpRecord.cpp",
1384 "tools/dump_record.cpp",
1385 ]
1386 deps = [
1387 ":flags",
1388 ":skia",
1389 ]
Mike Klein38312422016-10-05 15:41:01 -04001390 }
bungemanfe917272016-10-13 17:36:40 -04001391
Mike Kleine6682eb2017-01-05 10:54:57 -05001392 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001393 sources = [
1394 "tools/skdiff/skdiff.cpp",
1395 "tools/skdiff/skdiff_html.cpp",
1396 "tools/skdiff/skdiff_main.cpp",
1397 "tools/skdiff/skdiff_utils.cpp",
1398 ]
1399 deps = [
1400 ":skia",
1401 ":tool_utils",
1402 ]
bungemanfe917272016-10-13 17:36:40 -04001403 }
halcanarya73d76a2016-10-17 13:19:02 -07001404
Mike Kleine6682eb2017-01-05 10:54:57 -05001405 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001406 sources = [
1407 "tools/skp_parser.cpp",
1408 ]
1409 deps = [
1410 ":skia",
1411 ":tool_utils",
1412 "//third_party/jsoncpp",
1413 ]
halcanarya73d76a2016-10-17 13:19:02 -07001414 }
Brian Osman16adfa32016-10-18 14:42:44 -04001415
Mike Kleina92c3832016-12-08 09:49:39 -05001416 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001417 test_app("viewer") {
1418 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001419 sources = [
1420 "tools/viewer/GMSlide.cpp",
1421 "tools/viewer/ImageSlide.cpp",
1422 "tools/viewer/SKPSlide.cpp",
1423 "tools/viewer/SampleSlide.cpp",
1424 "tools/viewer/Viewer.cpp",
1425 "tools/viewer/sk_app/CommandSet.cpp",
1426 "tools/viewer/sk_app/GLWindowContext.cpp",
1427 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001428 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001429 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001430
Jim Van Verth4e56a912016-10-21 10:58:52 -04001431 if (is_android) {
1432 sources += [
1433 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1434 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1435 "tools/viewer/sk_app/android/Window_android.cpp",
1436 "tools/viewer/sk_app/android/main_android.cpp",
1437 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1438 ]
Brian Osman462334e2017-02-09 11:22:57 -05001439 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001440 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001441 sources += [
1442 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1443 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1444 "tools/viewer/sk_app/unix/Window_unix.cpp",
1445 "tools/viewer/sk_app/unix/main_unix.cpp",
1446 ]
1447 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001448 sources += [
1449 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1450 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1451 "tools/viewer/sk_app/win/Window_win.cpp",
1452 "tools/viewer/sk_app/win/main_win.cpp",
1453 ]
Mike Klein43c25262016-10-20 10:17:47 -04001454 } else if (is_mac) {
1455 sources += [
1456 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1457 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1458 "tools/viewer/sk_app/mac/Window_mac.cpp",
1459 "tools/viewer/sk_app/mac/main_mac.cpp",
1460 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001461 }
1462
1463 if (skia_use_vulkan) {
1464 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001465 if (is_android) {
1466 sources +=
1467 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001468 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001469 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1470 libs += [ "X11-xcb" ]
1471 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001472 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1473 }
1474 }
1475
1476 include_dirs = []
1477 deps = [
1478 ":flags",
1479 ":gm",
1480 ":gpu_tool_utils",
1481 ":samples",
1482 ":skia",
1483 ":tool_utils",
1484 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001485 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001486 "//third_party/jsoncpp",
1487 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001488 if (is_android) {
1489 deps += [ "//third_party/native_app_glue" ]
1490 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001491 deps += [ "//third_party/libsdl" ]
1492 }
Mike Kleina92c3832016-12-08 09:49:39 -05001493 }
Brian Osman16adfa32016-10-18 14:42:44 -04001494 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001495
Mike Kleine459afd2017-03-03 09:21:30 -05001496 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001497 copy("gdbserver") {
1498 sources = [
1499 "$ndk/$ndk_gdbserver",
1500 ]
1501 outputs = [
1502 "$root_out_dir/gdbserver",
1503 ]
1504 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001505 }
1506
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001507 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001508 test_app("skslc") {
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001509 defines = [ "SKSL_STANDALONE" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001510 sources = [
1511 "src/sksl/SkSLMain.cpp",
1512 ]
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001513 sources += skia_sksl_sources
1514 include_dirs = [ "src/sksl" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001515 }
1516 }
mtklein25c81d42016-07-27 13:55:26 -07001517}