blob: a442ccef577ab2d07ffd72c483c7d2edcc8af615 [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
mtklein3e8012e2016-09-21 09:14:19 -07009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12
mtkleinc04ff472016-06-23 10:29:30 -070013declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000014 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070015 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070016 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070017 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040018 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040019 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070020 skia_use_libjpeg_turbo = true
21 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070022 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050023 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070024 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040025 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070026 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070027
Mike Klein7d921032017-01-05 12:20:41 -050028 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070029 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050030 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050031 skia_enable_effects = true
Mike Kleind1fe9522017-02-17 09:41:09 -050032 skia_enable_jumper = is_skia_standalone && is_mac
mtklein06c35c02016-09-20 12:28:12 -070033 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050034 skia_enable_pdf = true
mtklein3e8012e2016-09-21 09:14:19 -070035 skia_enable_tools = is_skia_standalone
36 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040037 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070038}
Brian Salomon23d73ea2016-10-27 13:31:37 -040039declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080040 skia_use_dng_sdk =
41 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040042 skia_use_sfntly = skia_use_icu
43
Mike Klein4d598a32016-10-31 13:44:49 -040044 if (is_android) {
45 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
46 } else {
47 skia_use_vulkan = skia_vulkan_sdk != ""
48 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040049}
Brian Salomon789e25e2016-09-30 13:41:03 -040050
mtklein38925aa2016-09-21 10:11:25 -070051# Our tools require static linking (they use non-exported symbols).
52skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070053
mtkleina45be612016-08-29 15:22:10 -070054fontmgr_android_enabled = skia_use_expat && skia_use_freetype
55
mtklein1211e0c2016-07-26 13:55:45 -070056skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070057 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070058 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070059 "include/codec",
60 "include/config",
61 "include/core",
62 "include/effects",
63 "include/gpu",
64 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070065 "include/pathops",
66 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070067 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070068 "include/utils",
69 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070070]
71
mtkleinc04ff472016-06-23 10:29:30 -070072# Skia public API, generally provided by :skia.
73config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070074 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040075 defines = []
76 if (is_component_build) {
77 defines += [ "SKIA_DLL" ]
78 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040079 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070080 defines += [ "SK_SAMPLES_FOR_X" ]
81 }
mtkleincae1be52016-09-20 08:24:34 -070082 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040083 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070084 }
mtklein06c35c02016-09-20 12:28:12 -070085 if (!skia_enable_gpu) {
86 defines += [ "SK_SUPPORT_GPU=0" ]
87 }
mtkleinc04ff472016-06-23 10:29:30 -070088}
89
90# Skia internal APIs, used by Skia itself and a few test tools.
91config("skia_private") {
92 visibility = [ ":*" ]
93
94 include_dirs = [
95 "include/private",
96 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070097 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070098 "src/core",
99 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700100 "src/effects/gradients",
101 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700102 "src/gpu",
103 "src/image",
104 "src/images",
105 "src/lazy",
106 "src/opts",
107 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700108 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700109 "src/ports",
110 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700111 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700112 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700113 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500114 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700115 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700116 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700117 ]
mtklein150d1132016-08-01 06:56:40 -0700118
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400119 defines = [
120 "SK_GAMMA_APPLY_TO_A8",
121 "SK_INTERNAL",
122 ]
mtkleinb37c0342016-09-09 11:07:45 -0700123 if (is_android) {
124 defines += [
125 "SK_GAMMA_EXPONENT=1.4",
126 "SK_GAMMA_CONTRAST=0.0",
127 ]
128 }
mtklein88a7ac02016-09-14 11:16:49 -0700129 if (is_official_build || is_android) {
130 # TODO(bsalomon): it'd be nice to make Android normal.
131 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
132 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400133 libs = []
134 lib_dirs = []
135 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400136 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400137 if (is_win) {
138 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
139 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
140 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400141 include_dirs += [ "$skia_vulkan_sdk/include/" ]
142 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400143 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400144 }
Mike Klein487bfc22016-10-14 14:04:56 -0400145 if (is_win) {
146 libs += [ "vulkan-1.lib" ]
147 } else {
148 libs += [ "vulkan" ]
149 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400150 }
Brian Osman34755e22016-12-05 09:46:02 -0500151 if (skia_use_angle) {
152 defines += [ "SK_ANGLE" ]
153 }
Brian Osman3f375d02016-12-28 11:19:22 -0500154 if (skia_enable_discrete_gpu) {
155 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
156 }
mtkleinc04ff472016-06-23 10:29:30 -0700157}
158
159# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
160config("skia_library") {
161 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700162 defines = [ "SKIA_IMPLEMENTATION=1" ]
163}
164
165skia_library_configs = [
166 ":skia_public",
167 ":skia_private",
168 ":skia_library",
169]
170
mtklein9b8583d2016-08-24 17:32:30 -0700171# Use for CPU-specific Skia code that needs particular compiler flags.
172template("opts") {
173 if (invoker.enabled) {
174 source_set(target_name) {
175 forward_variables_from(invoker, "*")
176 configs += skia_library_configs
177 }
178 } else {
179 # If not enabled, a phony empty target that swallows all otherwise unused variables.
180 source_set(target_name) {
181 forward_variables_from(invoker,
182 "*",
183 [
184 "sources",
185 "cflags",
186 ])
187 }
188 }
anmittala7eaf2e2016-08-17 13:57:26 -0700189}
190
mtklein422310d2016-08-16 18:28:43 -0700191is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700192
mtklein7d6fb2c2016-08-25 14:50:44 -0700193opts("none") {
194 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700195 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700196 cflags = []
197}
198
mtklein7d6fb2c2016-08-25 14:50:44 -0700199opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700200 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700201 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700202 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700203}
204
205opts("arm64") {
206 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700208 cflags = []
209}
210
211opts("crc32") {
212 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700213 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700214 cflags = [ "-march=armv8-a+crc" ]
215}
216
mtklein9b8583d2016-08-24 17:32:30 -0700217opts("sse2") {
218 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700219 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400220 if (is_win) {
221 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
222 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400223 cflags = [ "-msse2" ]
224 }
mtklein9b8583d2016-08-24 17:32:30 -0700225}
mtkleinc04ff472016-06-23 10:29:30 -0700226
mtklein9b8583d2016-08-24 17:32:30 -0700227opts("ssse3") {
228 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400230 if (is_win) {
231 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
232 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400233 cflags = [ "-mssse3" ]
234 }
mtklein9b8583d2016-08-24 17:32:30 -0700235}
mtkleinc04ff472016-06-23 10:29:30 -0700236
mtklein9b8583d2016-08-24 17:32:30 -0700237opts("sse41") {
238 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400240 if (is_win) {
241 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
242 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400243 cflags = [ "-msse4.1" ]
244 }
mtklein9b8583d2016-08-24 17:32:30 -0700245}
mtklein4e976072016-08-08 09:06:27 -0700246
mtklein9b8583d2016-08-24 17:32:30 -0700247opts("sse42") {
248 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400250 if (is_win) {
251 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
252 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400253 cflags = [ "-msse4.2" ]
254 }
mtklein9b8583d2016-08-24 17:32:30 -0700255}
256
257opts("avx") {
258 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400260 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000261 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400262 } else {
263 cflags = [ "-mavx" ]
264 }
mtkleinc04ff472016-06-23 10:29:30 -0700265}
266
Mike Klein78d5a3b2016-09-30 10:48:01 -0400267opts("hsw") {
268 enabled = is_x86
269 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400270 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000271 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400272 } else {
273 cflags = [
274 "-mavx2",
275 "-mbmi",
276 "-mbmi2",
277 "-mf16c",
278 "-mfma",
279 ]
280 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400281}
282
mtkleinc095df52016-08-24 12:23:52 -0700283# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700284template("optional") {
285 if (invoker.enabled) {
286 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700287 if (defined(invoker.public_defines)) {
288 defines = invoker.public_defines
289 }
mtklein457b42a2016-08-23 13:56:37 -0700290 }
291 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700292 forward_variables_from(invoker,
293 "*",
294 [
295 "public_defines",
296 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700297 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700298 ])
mtklein457b42a2016-08-23 13:56:37 -0700299 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700300 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700301 if (defined(invoker.configs_to_remove)) {
302 configs -= invoker.configs_to_remove
303 }
mtklein457b42a2016-08-23 13:56:37 -0700304 }
305 } else {
mtklein457b42a2016-08-23 13:56:37 -0700306 source_set(target_name) {
307 forward_variables_from(invoker,
308 "*",
309 [
310 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700311 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700312 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700313 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700314 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700315 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700316 ])
mtkleincd01b032016-08-31 04:58:19 -0700317 if (defined(invoker.sources_when_disabled)) {
318 sources = invoker.sources_when_disabled
319 }
320 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700321 }
mtkleineb3c4252016-08-23 07:38:09 -0700322 }
mtklein457b42a2016-08-23 13:56:37 -0700323}
mtklein457b42a2016-08-23 13:56:37 -0700324
Mike Kleina04bb452017-02-09 12:24:07 -0500325optional("effects") {
326 enabled = skia_enable_effects
327 sources =
328 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
329 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
330}
331
mtkleina45be612016-08-29 15:22:10 -0700332optional("fontmgr_android") {
333 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700334
335 deps = [
336 "//third_party/expat",
Ben Wagner7d07d462017-02-17 18:38:52 +0000337 "//third_party/freetype2",
mtkleina45be612016-08-29 15:22:10 -0700338 ]
339 sources = [
340 "src/ports/SkFontMgr_android.cpp",
341 "src/ports/SkFontMgr_android_factory.cpp",
342 "src/ports/SkFontMgr_android_parser.cpp",
343 ]
344}
345
mtkleind2e39db2016-09-07 07:52:55 -0700346optional("fontmgr_custom") {
347 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
348
349 deps = [
Ben Wagner7d07d462017-02-17 18:38:52 +0000350 "//third_party/freetype2",
mtkleind2e39db2016-09-07 07:52:55 -0700351 ]
352 sources = [
353 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500354 "src/ports/SkFontMgr_custom.h",
355 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700356 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500357 "src/ports/SkFontMgr_custom_embedded.cpp",
358 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700359 ]
360}
361
mtklein3cc22182016-08-29 13:26:14 -0700362optional("fontmgr_fontconfig") {
363 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700364
365 deps = [
366 "//third_party:fontconfig",
Ben Wagner7d07d462017-02-17 18:38:52 +0000367 "//third_party/freetype2",
mtklein3cc22182016-08-29 13:26:14 -0700368 ]
369 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700370 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700371 "src/ports/SkFontConfigInterface_direct.cpp",
372 "src/ports/SkFontConfigInterface_direct_factory.cpp",
373 "src/ports/SkFontMgr_FontConfigInterface.cpp",
374 "src/ports/SkFontMgr_fontconfig.cpp",
375 "src/ports/SkFontMgr_fontconfig_factory.cpp",
376 ]
377}
378
mtkleincdedd0e2016-09-12 15:15:44 -0700379optional("fontmgr_fuchsia") {
380 enabled = is_fuchsia && skia_use_freetype
381
382 deps = [
Ben Wagner7d07d462017-02-17 18:38:52 +0000383 "//third_party/freetype2",
mtkleincdedd0e2016-09-12 15:15:44 -0700384 ]
385 sources = [
386 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500387 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700388 "src/ports/SkFontMgr_custom_empty_factory.cpp",
389 ]
390}
391
mtklein06c35c02016-09-20 12:28:12 -0700392optional("gpu") {
393 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700394 public_defines = []
395
Mike Klein29b3e582017-02-09 11:57:32 -0500396 sources = skia_gpu_sources + skia_sksl_sources +
397 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700398
399 # These paths need to be absolute to match the ones produced by shared_sources.gni.
400 sources -= get_path_info([
401 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
402 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
403 ],
404 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400405 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700406 if (is_android) {
407 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
408 } else if (is_linux) {
409 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
410 } else if (is_mac) {
411 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800412 } else if (is_ios) {
413 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400414 } else if (is_win) {
415 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
416 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700417 } else {
418 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
419 }
mtkleine9fb3d52016-09-20 15:11:46 -0700420
421 if (skia_use_vulkan) {
422 public_defines += [ "SK_VULKAN" ]
423 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700424 if (skia_enable_vulkan_debug_layers) {
425 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
426 }
mtkleine9fb3d52016-09-20 15:11:46 -0700427 }
mtklein06c35c02016-09-20 12:28:12 -0700428}
429
mtklein63213812016-08-24 09:55:56 -0700430optional("jpeg") {
431 enabled = skia_use_libjpeg_turbo
432 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
433
mtklein63213812016-08-24 09:55:56 -0700434 deps = [
435 "//third_party/libjpeg-turbo:libjpeg",
436 ]
437 sources = [
438 "src/codec/SkJpegCodec.cpp",
439 "src/codec/SkJpegDecoderMgr.cpp",
440 "src/codec/SkJpegUtility.cpp",
441 "src/images/SkJPEGImageEncoder.cpp",
442 "src/images/SkJPEGWriteUtility.cpp",
443 ]
444}
445
446optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500447 enabled = skia_use_zlib && skia_enable_pdf
448 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700449
mtklein63213812016-08-24 09:55:56 -0700450 deps = [
451 "//third_party/zlib",
452 ]
brettwb9447282016-09-01 14:24:39 -0700453 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700454 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700455
456 if (skia_use_sfntly) {
457 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500458 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700459 }
460}
461
462optional("png") {
463 enabled = skia_use_libpng
464 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
465
mtklein63213812016-08-24 09:55:56 -0700466 deps = [
467 "//third_party/libpng",
468 ]
469 sources = [
470 "src/codec/SkIcoCodec.cpp",
471 "src/codec/SkPngCodec.cpp",
472 "src/images/SkPNGImageEncoder.cpp",
473 ]
474}
475
scroggof84ad642016-10-31 09:02:57 -0700476optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400477 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700478 public_defines = [ "SK_CODEC_DECODES_RAW" ]
479
480 deps = [
481 "//third_party/dng_sdk",
482 "//third_party/libjpeg-turbo:libjpeg",
483 "//third_party/piex",
484 ]
485
486 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
487 # Skia.
488 configs_to_remove = [ "//gn:no_exceptions" ]
489
490 sources = [
491 "src/codec/SkRawAdapterCodec.cpp",
492 "src/codec/SkRawCodec.cpp",
493 ]
494}
495
Mike Kleine1caee12017-02-15 13:31:12 -0500496optional("jumper") {
497 enabled = skia_enable_jumper
498 public_defines = [ "SK_JUMPER" ]
499 sources = [
500 "src/jumper/SkJumper.cpp",
Mike Kleind1fe9522017-02-17 09:41:09 -0500501 "src/jumper/SkJumper_generated_x86_64.s",
Mike Kleine1caee12017-02-15 13:31:12 -0500502 "src/jumper/SkJumper_stages.cpp",
503 ]
504}
505
mtklein3cc22182016-08-29 13:26:14 -0700506optional("typeface_freetype") {
507 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700508
509 deps = [
510 "//third_party/freetype2",
511 ]
512 sources = [
513 "src/ports/SkFontHost_FreeType.cpp",
514 "src/ports/SkFontHost_FreeType_common.cpp",
515 ]
516}
517
mtklein457b42a2016-08-23 13:56:37 -0700518optional("webp") {
519 enabled = skia_use_libwebp
520 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
521
mtklein457b42a2016-08-23 13:56:37 -0700522 deps = [
523 "//third_party/libwebp",
524 ]
525 sources = [
526 "src/codec/SkWebpAdapterCodec.cpp",
527 "src/codec/SkWebpCodec.cpp",
528 "src/images/SkWEBPImageEncoder.cpp",
529 ]
mtkleineb3c4252016-08-23 07:38:09 -0700530}
531
mtklein63213812016-08-24 09:55:56 -0700532optional("xml") {
533 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000534 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700535
mtklein63213812016-08-24 09:55:56 -0700536 deps = [
537 "//third_party/expat",
538 ]
539 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500540 "src/svg/SkSVGCanvas.cpp",
541 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700542 "src/xml/SkDOM.cpp",
543 "src/xml/SkXMLParser.cpp",
544 "src/xml/SkXMLWriter.cpp",
545 ]
546}
547
mtkleinc04ff472016-06-23 10:29:30 -0700548component("skia") {
549 public_configs = [ ":skia_public" ]
550 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700551
552 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700553 ":arm64",
554 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700555 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700556 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500557 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700558 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700559 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700560 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700561 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700562 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400563 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700564 ":jpeg",
Mike Kleine1caee12017-02-15 13:31:12 -0500565 ":jumper",
mtklein9b8583d2016-08-24 17:32:30 -0700566 ":none",
mtklein63213812016-08-24 09:55:56 -0700567 ":pdf",
568 ":png",
scroggof84ad642016-10-31 09:02:57 -0700569 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700570 ":sse2",
571 ":sse41",
572 ":sse42",
573 ":ssse3",
Ben Wagner7d07d462017-02-17 18:38:52 +0000574 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700575 ":webp",
mtklein63213812016-08-24 09:55:56 -0700576 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700577 ]
578
Chinmay Garde43f115c2016-11-16 15:04:12 -0800579 # This file (and all GN files in Skia) are designed to work with an
580 # empty sources assignment filter; we handle all that explicitly.
581 # We clear the filter here for clients who may have set up a global filter.
582 set_sources_assignment_filter([])
583
mtkleinc04ff472016-06-23 10:29:30 -0700584 sources = []
brettwb9447282016-09-01 14:24:39 -0700585 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700586 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500587 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700588 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700589 "src/android/SkBitmapRegionCodec.cpp",
590 "src/android/SkBitmapRegionDecoder.cpp",
591 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700592 "src/codec/SkBmpCodec.cpp",
593 "src/codec/SkBmpMaskCodec.cpp",
594 "src/codec/SkBmpRLECodec.cpp",
595 "src/codec/SkBmpStandardCodec.cpp",
596 "src/codec/SkCodec.cpp",
597 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700598 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700599 "src/codec/SkMaskSwizzler.cpp",
600 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700601 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700602 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700603 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700604 "src/codec/SkSwizzler.cpp",
605 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700606 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700607 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700608 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700609 "src/ports/SkMemory_malloc.cpp",
610 "src/ports/SkOSFile_stdio.cpp",
611 "src/sfnt/SkOTTable_name.cpp",
612 "src/sfnt/SkOTUtils.cpp",
613 "src/utils/mac/SkStream_mac.cpp",
614 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700615 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700616 ]
brettwb9447282016-09-01 14:24:39 -0700617
mtklein7d6fb2c2016-08-25 14:50:44 -0700618 libs = []
619
mtkleinc04ff472016-06-23 10:29:30 -0700620 if (is_win) {
621 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400622 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700623 "src/ports/SkDebug_win.cpp",
624 "src/ports/SkFontHost_win.cpp",
625 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700626 "src/ports/SkImageEncoder_WIC.cpp",
627 "src/ports/SkImageGeneratorWIC.cpp",
628 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700629 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700630 "src/ports/SkScalerContext_win_dw.cpp",
631 "src/ports/SkTLS_win.cpp",
632 "src/ports/SkTypeface_win_dw.cpp",
633 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400634 if (skia_use_gdi) {
635 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
636 libs += [
637 "Gdi32.lib",
638 "Usp10.lib",
639 ]
640 } else {
641 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
642 }
mtkleinb9be9792016-09-16 14:44:18 -0700643 sources -=
644 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400645 libs += [
646 "FontSub.lib",
647 "Ole32.lib",
648 "OleAut32.lib",
649 "User32.lib",
650 ]
mtkleinc04ff472016-06-23 10:29:30 -0700651 } else {
652 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700653 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700654 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700655 "src/ports/SkTLS_pthread.cpp",
656 ]
657 }
658
mtklein7d6fb2c2016-08-25 14:50:44 -0700659 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500660 deps += [ "//third_party/expat" ]
661 if (is_skia_standalone && ndk != "") {
662 deps += [ "//third_party/cpu-features" ]
663 }
mtklein06c35c02016-09-20 12:28:12 -0700664 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700665 libs += [
666 "EGL",
667 "GLESv2",
668 "log",
669 ]
670 }
671
mtkleinc04ff472016-06-23 10:29:30 -0700672 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700673 libs += [
674 "GL",
675 "GLU",
676 "X11",
677 ]
mtklein06c35c02016-09-20 12:28:12 -0700678 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700679 }
680
681 if (is_mac) {
682 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700683 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700684 "src/ports/SkFontHost_mac.cpp",
685 "src/ports/SkImageEncoder_CG.cpp",
686 "src/ports/SkImageGeneratorCG.cpp",
687 ]
mtklein09e61f72016-08-23 13:35:28 -0700688 libs += [
689 "ApplicationServices.framework",
690 "OpenGL.framework",
691 ]
mtkleinc04ff472016-06-23 10:29:30 -0700692 }
abarth6fc8ff02016-07-15 15:15:15 -0700693
Mike Klein7d302882016-11-03 14:06:31 -0400694 if (is_ios) {
695 sources += [
696 "src/ports/SkDebug_stdio.cpp",
697 "src/ports/SkFontHost_mac.cpp",
698 "src/ports/SkImageEncoder_CG.cpp",
699 "src/ports/SkImageGeneratorCG.cpp",
700 ]
701 libs += [
702 "CoreFoundation.framework",
703 "CoreGraphics.framework",
704 "CoreText.framework",
705 "ImageIO.framework",
706 "MobileCoreServices.framework",
707 ]
708 }
709
abarth6fc8ff02016-07-15 15:15:15 -0700710 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700711 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700712 }
mtkleinc04ff472016-06-23 10:29:30 -0700713}
714
mtkleinc095df52016-08-24 12:23:52 -0700715# Targets guarded by skia_enable_tools may use //third_party freely.
716if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500717 # Used by gn_to_bp.py to list our public include dirs.
718 source_set("public") {
719 configs += [ ":skia_public" ]
720 }
721
Mike Kleinc36dedf2016-11-18 09:35:28 -0500722 config("skia.h_config") {
723 include_dirs = [ "$target_gen_dir" ]
724 }
725 action("skia.h") {
726 public_configs = [ ":skia.h_config" ]
727 skia_h = "$target_gen_dir/skia.h"
728 script = "gn/find_headers.py"
729 args = [ rebase_path(skia_h, root_build_dir) ] +
730 rebase_path(skia_public_includes)
731 depfile = "$skia_h.deps"
732 outputs = [
733 skia_h,
734 ]
735 }
736
737 if (skia_enable_gpu && target_cpu == "x64") {
738 # Our bots only have 64-bit libOSMesa installed.
739 # TODO: worth fixing?
740 executable("fiddle") {
741 libs = []
742 if (is_linux) {
743 libs += [ "OSMesa" ]
744 }
745
746 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500747 "tools/fiddle/draw.cpp",
748 "tools/fiddle/fiddle_main.cpp",
749 ]
750 deps = [
751 ":skia",
752 ":skia.h",
753 ]
754 }
755 }
756
757 if (skia_enable_gpu) {
758 source_set("public_headers_warnings_check") {
759 sources = [
760 "tools/public_headers_warnings_check.cpp",
761 ]
762 configs -= [ "//gn:warnings_except_public_headers" ]
763 deps = [
764 ":skia",
765 ":skia.h",
766 ]
767 }
768 }
769
mtkleinc095df52016-08-24 12:23:52 -0700770 template("test_lib") {
771 config(target_name + "_config") {
772 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700773 if (defined(invoker.public_defines)) {
774 defines = invoker.public_defines
775 }
mtklein25c81d42016-07-27 13:55:26 -0700776 }
mtkleinc095df52016-08-24 12:23:52 -0700777 source_set(target_name) {
778 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
779 public_configs = [
780 ":" + target_name + "_config",
781 ":skia_private",
782 ]
783
784 if (!defined(deps)) {
785 deps = []
786 }
787 deps += [ ":skia" ]
788 testonly = true
789 }
mtklein25c81d42016-07-27 13:55:26 -0700790 }
mtklein25c81d42016-07-27 13:55:26 -0700791
Mike Kleine6682eb2017-01-05 10:54:57 -0500792 template("test_app") {
793 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
794 shared_library("lib" + target_name) {
795 forward_variables_from(invoker, "*", [ "is_shared_library" ])
796 testonly = true
797 }
798 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500799 _executable = target_name
800 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500801 forward_variables_from(invoker, "*", [ "is_shared_library" ])
802 testonly = true
803 }
804 }
Mike Klein7d921032017-01-05 12:20:41 -0500805 if (is_android && skia_android_serial != "" && defined(_executable)) {
806 action("push_" + target_name) {
807 script = "gn/push_to_android.py"
808 deps = [
809 ":" + _executable,
810 ]
811 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
812 outputs = [
813 _stamp,
814 ]
815 args = [
816 rebase_path("$root_build_dir/$_executable"),
817 skia_android_serial,
818 rebase_path(_stamp),
819 ]
820 testonly = true
821 }
822 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500823 }
824
mtkleinc095df52016-08-24 12:23:52 -0700825 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700826 public_include_dirs = []
827 if (skia_enable_gpu) {
828 public_defines = []
829 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700830
831 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700832 sources = [
833 "tools/gpu/GrContextFactory.cpp",
834 "tools/gpu/GrTest.cpp",
835 "tools/gpu/TestContext.cpp",
836 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700837 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700838 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
839 "tools/gpu/gl/debug/GrBufferObj.cpp",
840 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
841 "tools/gpu/gl/debug/GrProgramObj.cpp",
842 "tools/gpu/gl/debug/GrShaderObj.cpp",
843 "tools/gpu/gl/debug/GrTextureObj.cpp",
844 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
845 "tools/gpu/gl/null/NullGLTestContext.cpp",
846 ]
847 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700848
mtklein38925aa2016-09-21 10:11:25 -0700849 if (is_android) {
850 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400851 } else if (is_ios) {
852 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
853 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700854 } else if (is_linux) {
855 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
856 } else if (is_mac) {
857 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400858 } else if (is_win) {
859 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
860 libs += [
861 "Gdi32.lib",
862 "OpenGL32.lib",
863 ]
mtklein38925aa2016-09-21 10:11:25 -0700864 }
mtklein6ef69992016-09-14 06:12:09 -0700865
Mike Kleinc168a3a2016-11-14 14:53:13 +0000866 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000867 deps += [ "//third_party/angle2" ]
868 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
869 }
mtklein38925aa2016-09-21 10:11:25 -0700870 if (skia_use_mesa) {
871 public_defines += [ "SK_MESA" ]
872 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
873 libs += [ "OSMesa" ]
874 }
mtkleind68f9b02016-09-23 13:18:41 -0700875 if (skia_use_vulkan) {
876 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
877 }
mtkleina627b5c2016-09-20 13:36:47 -0700878 }
mtklein25c81d42016-07-27 13:55:26 -0700879 }
mtklein25c81d42016-07-27 13:55:26 -0700880
mtkleinc095df52016-08-24 12:23:52 -0700881 test_lib("flags") {
882 public_include_dirs = [ "tools/flags" ]
883 sources = [
884 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700885 ]
886 }
887 test_lib("common_flags") {
888 public_include_dirs = [ "tools/flags" ]
889 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700890 "tools/flags/SkCommonFlags.cpp",
891 "tools/flags/SkCommonFlagsConfig.cpp",
892 ]
893 deps = [
mtklein046cb562016-09-16 10:23:12 -0700894 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700895 ":gpu_tool_utils",
896 ]
897 }
mtklein25c81d42016-07-27 13:55:26 -0700898
mtkleinc095df52016-08-24 12:23:52 -0700899 test_lib("tool_utils") {
900 public_include_dirs = [
901 "tools",
902 "tools/debugger",
903 "tools/timer",
904 ]
905 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700906 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700907 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700908 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700909 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700910 "tools/ProcStats.cpp",
911 "tools/Resources.cpp",
912 "tools/ThermalManager.cpp",
913 "tools/UrlDataManager.cpp",
914 "tools/debugger/SkDebugCanvas.cpp",
915 "tools/debugger/SkDrawCommand.cpp",
916 "tools/debugger/SkJsonWriteBuffer.cpp",
917 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700918 "tools/picture_utils.cpp",
919 "tools/random_parse_path.cpp",
920 "tools/sk_tool_utils.cpp",
921 "tools/sk_tool_utils_font.cpp",
922 "tools/timer/Timer.cpp",
923 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500924 libs = []
925 if (is_ios) {
926 sources += [ "tools/ios_utils.m" ]
927 libs += [ "Foundation.framework" ]
928 }
mtkleinc095df52016-08-24 12:23:52 -0700929 deps = [
mtklein046cb562016-09-16 10:23:12 -0700930 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700931 ":flags",
932 "//third_party/libpng",
933 ]
934 public_deps = [
935 "//third_party/jsoncpp",
936 ]
937 }
mtklein25c81d42016-07-27 13:55:26 -0700938
Mike Klein6e744122016-10-27 12:21:40 -0400939 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700940 test_lib("gm") {
941 public_include_dirs = [ "gm" ]
942 sources = gm_sources
943 deps = [
scroggo19b91532016-10-24 09:03:26 -0700944 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700945 ":gpu_tool_utils",
946 ":skia",
947 ":tool_utils",
948 ]
949 }
mtklein25c81d42016-07-27 13:55:26 -0700950
Mike Klein6e744122016-10-27 12:21:40 -0400951 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700952 test_lib("tests") {
953 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400954 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700955 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400956 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700957 }
mtkleinc095df52016-08-24 12:23:52 -0700958 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700959 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700960 ":flags",
961 ":gpu_tool_utils",
962 ":skia",
963 ":tool_utils",
964 "//third_party/libpng",
965 "//third_party/zlib",
966 ]
967 }
mtklein2f3416d2016-08-02 16:02:05 -0700968
Mike Klein6e744122016-10-27 12:21:40 -0400969 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700970 test_lib("bench") {
971 public_include_dirs = [ "bench" ]
972 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700973 deps = [
974 ":flags",
975 ":gm",
976 ":gpu_tool_utils",
977 ":skia",
978 ":tool_utils",
979 ]
980 }
mtklein2b6870c2016-07-28 14:17:33 -0700981
mtkleinc095df52016-08-24 12:23:52 -0700982 test_lib("experimental_svg_model") {
983 public_include_dirs = [ "experimental/svg/model" ]
984 sources = [
985 "experimental/svg/model/SkSVGAttribute.cpp",
986 "experimental/svg/model/SkSVGAttributeParser.cpp",
987 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -0500988 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700989 "experimental/svg/model/SkSVGContainer.cpp",
990 "experimental/svg/model/SkSVGDOM.cpp",
991 "experimental/svg/model/SkSVGEllipse.cpp",
992 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700993 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700994 "experimental/svg/model/SkSVGNode.cpp",
995 "experimental/svg/model/SkSVGPath.cpp",
996 "experimental/svg/model/SkSVGPoly.cpp",
997 "experimental/svg/model/SkSVGRect.cpp",
998 "experimental/svg/model/SkSVGRenderContext.cpp",
999 "experimental/svg/model/SkSVGSVG.cpp",
1000 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001001 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001002 "experimental/svg/model/SkSVGTransformableNode.cpp",
1003 "experimental/svg/model/SkSVGValue.cpp",
1004 ]
1005 deps = [
1006 ":skia",
1007 ]
1008 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001009
Brian Osman16adfa32016-10-18 14:42:44 -04001010 test_lib("views") {
1011 public_include_dirs = [ "include/views" ]
1012 sources = [
1013 "src/views/SkEvent.cpp",
1014 "src/views/SkEventSink.cpp",
1015 "src/views/SkOSMenu.cpp",
1016 "src/views/SkTagList.cpp",
1017 "src/views/SkTouchGesture.cpp",
1018 "src/views/SkView.cpp",
1019 "src/views/SkViewPriv.cpp",
1020 ]
1021 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001022 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001023 if (!is_android) {
1024 sources += [ "src/views/SkWindow.cpp" ]
1025 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001026 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001027 public_include_dirs += [ "src/views/unix" ]
1028 sources += [
1029 "src/views/unix/SkOSWindow_Unix.cpp",
1030 "src/views/unix/keysym2ucs.c",
1031 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001032 } else if (is_mac) {
1033 sources += [
1034 "src/views/mac/SkEventNotifier.mm",
1035 "src/views/mac/SkNSView.mm",
1036 "src/views/mac/SkOSWindow_Mac.mm",
1037 "src/views/mac/SkTextFieldCell.m",
1038 ]
1039 libs += [
1040 "QuartzCore.framework",
1041 "Cocoa.framework",
1042 "Foundation.framework",
1043 ]
1044 } else if (is_win) {
1045 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1046 }
Brian Osman34755e22016-12-05 09:46:02 -05001047 if (skia_use_angle) {
1048 deps += [ "//third_party/angle2" ]
1049 }
Brian Osman16adfa32016-10-18 14:42:44 -04001050 }
1051
Mike Klein38af9432016-11-11 11:39:44 -05001052 if (skia_use_lua) {
1053 test_lib("lua") {
1054 public_include_dirs = []
1055 sources = [
1056 "src/utils/SkLua.cpp",
1057 "src/utils/SkLuaCanvas.cpp",
1058 ]
1059 deps = [
1060 "//third_party/lua",
1061 ]
1062 }
1063
Mike Kleine6682eb2017-01-05 10:54:57 -05001064 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001065 sources = [
1066 "tools/lua/lua_app.cpp",
1067 ]
1068 deps = [
1069 ":lua",
1070 ":skia",
1071 "//third_party/lua",
1072 ]
Mike Klein38af9432016-11-11 11:39:44 -05001073 }
1074
Mike Kleine6682eb2017-01-05 10:54:57 -05001075 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001076 sources = [
1077 "tools/lua/lua_pictures.cpp",
1078 ]
1079 deps = [
1080 ":flags",
1081 ":lua",
1082 ":skia",
1083 ":tool_utils",
1084 "//third_party/lua",
1085 ]
Mike Klein38af9432016-11-11 11:39:44 -05001086 }
1087 }
1088
Mike Klein6e744122016-10-27 12:21:40 -04001089 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001090 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001091 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001092 include_dirs = [ "experimental" ]
1093 sources = samples_sources + [
1094 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1095 "experimental/SkSetPoly3To3.cpp",
1096 "experimental/SkSetPoly3To3_A.cpp",
1097 "experimental/SkSetPoly3To3_D.cpp",
1098 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001099 deps = [
1100 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001101 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001102 ":tool_utils",
1103 ":views",
1104 ":xml",
1105 ]
Mike Klein38af9432016-11-11 11:39:44 -05001106
1107 if (skia_use_lua) {
1108 sources += [ "samplecode/SampleLua.cpp" ]
1109 deps += [
1110 ":lua",
1111 "//third_party/lua",
1112 ]
1113 }
Brian Osman16adfa32016-10-18 14:42:44 -04001114 }
1115
Mike Kleine6682eb2017-01-05 10:54:57 -05001116 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001117 sources = [
1118 "dm/DM.cpp",
1119 "dm/DMJsonWriter.cpp",
1120 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001121 ]
1122 include_dirs = [ "tests" ]
1123 deps = [
mtklein046cb562016-09-16 10:23:12 -07001124 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001125 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001126 ":flags",
1127 ":gm",
1128 ":gpu_tool_utils",
1129 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001130 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001131 ":tool_utils",
1132 "//third_party/jsoncpp",
1133 "//third_party/libpng",
1134 ]
mtklein2b6870c2016-07-28 14:17:33 -07001135 }
1136
Mike Kleina3430172016-09-27 16:46:29 -04001137 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001138 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001139 sources = [
1140 "tools/monobench.cpp",
1141 ]
1142 deps = [
1143 ":bench",
1144 ":skia",
1145 ]
Mike Kleina3430172016-09-27 16:46:29 -04001146 }
mtklein2b6870c2016-07-28 14:17:33 -07001147 }
1148
Mike Kleine6682eb2017-01-05 10:54:57 -05001149 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001150 sources = [
1151 "bench/nanobench.cpp",
1152 ]
1153 deps = [
1154 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001155 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001156 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001157 ":flags",
1158 ":gm",
1159 ":gpu_tool_utils",
1160 ":skia",
1161 ":tool_utils",
1162 "//third_party/jsoncpp",
1163 ]
mtklein2b6870c2016-07-28 14:17:33 -07001164 }
halcanary19a97202016-08-03 15:08:04 -07001165
Ravi Mistry10d36c52017-01-31 09:49:18 -05001166 test_app("skpinfo") {
1167 sources = [
1168 "tools/skpinfo.cpp",
1169 ]
1170 deps = [
1171 ":flags",
1172 ":skia",
1173 ]
1174 }
1175
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001176 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001177 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001178 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001179 "samplecode/SampleApp.cpp",
1180 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001181 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001182 if (is_mac) {
1183 sources += [ "src/views/mac/skia_mac.mm" ]
1184 } else if (is_win) {
1185 sources += [ "src/views/win/skia_win.cpp" ]
1186 } else if (is_linux) {
1187 sources += [ "src/views/unix/skia_unix.cpp" ]
1188 }
mtklein38925aa2016-09-21 10:11:25 -07001189 deps = [
1190 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001191 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001192 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001193 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001194 ":skia",
1195 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001196 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001197 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001198 if (skia_use_angle) {
1199 deps += [ "//third_party/angle2" ]
1200 }
mtklein38925aa2016-09-21 10:11:25 -07001201 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001202 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001203
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001204 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001205 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001206 sources = [
1207 "tools/skpbench/skpbench.cpp",
1208 ]
1209 deps = [
1210 ":flags",
1211 ":gpu_tool_utils",
1212 ":skia",
1213 ":tool_utils",
1214 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001215 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001216 }
1217
Mike Klein7d302882016-11-03 14:06:31 -04001218 # We can't yet build ICU on iOS or Windows.
1219 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001220 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001221 sources = [
1222 "tools/SkShaper_harfbuzz.cpp",
1223 "tools/using_skia_and_harfbuzz.cpp",
1224 ]
1225 deps = [
1226 ":skia",
1227 "//third_party/harfbuzz",
1228 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001229 }
halcanary19a97202016-08-03 15:08:04 -07001230 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001231 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001232 sources = [
1233 "tools/SkShaper_primitive.cpp",
1234 "tools/using_skia_and_harfbuzz.cpp",
1235 ]
1236 deps = [
1237 ":skia",
1238 ]
halcanary3eee9d92016-09-10 07:01:53 -07001239 }
mtklein046cb562016-09-16 10:23:12 -07001240
Mike Kleine6682eb2017-01-05 10:54:57 -05001241 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001242 sources = [
1243 "tools/get_images_from_skps.cpp",
1244 ]
1245 deps = [
1246 ":flags",
1247 ":skia",
1248 "//third_party/jsoncpp",
1249 ]
mtklein046cb562016-09-16 10:23:12 -07001250 }
mtkleinecbc5262016-09-22 11:51:24 -07001251
Mike Kleine6682eb2017-01-05 10:54:57 -05001252 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001253 sources = [
1254 "tools/colorspaceinfo.cpp",
1255 ]
1256 deps = [
1257 ":flags",
1258 ":skia",
1259 ":tool_utils",
1260 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001261 }
1262
Mike Klein7d302882016-11-03 14:06:31 -04001263 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001264 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001265 sources = [
1266 "tools/skiaserve/Request.cpp",
1267 "tools/skiaserve/Response.cpp",
1268 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001269 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1270 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1271 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1272 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1273 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1274 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1275 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1276 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1277 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001278 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1279 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001280 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1281 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1282 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1283 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1284 ]
1285 deps = [
1286 ":flags",
1287 ":gpu_tool_utils",
1288 ":skia",
1289 ":tool_utils",
1290 "//third_party/jsoncpp",
1291 "//third_party/libmicrohttpd",
1292 "//third_party/libpng",
1293 ]
Mike Klein7d302882016-11-03 14:06:31 -04001294 }
mtkleinecbc5262016-09-22 11:51:24 -07001295 }
kjlubick14f984b2016-10-03 11:49:45 -07001296
Mike Kleine6682eb2017-01-05 10:54:57 -05001297 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001298 sources = [
1299 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001300 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001301 "fuzz/FuzzGradients.cpp",
1302 "fuzz/FuzzParsePath.cpp",
1303 "fuzz/FuzzPathop.cpp",
1304 "fuzz/FuzzScaleToSides.cpp",
1305 "fuzz/fuzz.cpp",
1306 ]
1307 deps = [
1308 ":flags",
1309 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001310 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001311 ]
kjlubick14f984b2016-10-03 11:49:45 -07001312 }
Mike Klein38312422016-10-05 15:41:01 -04001313
Mike Kleine6682eb2017-01-05 10:54:57 -05001314 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001315 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001316 rebase_path("tests/skia_test.cpp"),
1317 rebase_path("tests/Test.cpp"),
1318 ]
caryclark9feb6322016-10-25 08:58:26 -07001319 deps = [
1320 ":flags",
1321 ":gpu_tool_utils",
1322 ":skia",
1323 ":tool_utils",
1324 ]
caryclark9feb6322016-10-25 08:58:26 -07001325 }
1326
Mike Kleine6682eb2017-01-05 10:54:57 -05001327 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001328 sources = [
1329 "tools/DumpRecord.cpp",
1330 "tools/dump_record.cpp",
1331 ]
1332 deps = [
1333 ":flags",
1334 ":skia",
1335 ]
Mike Klein38312422016-10-05 15:41:01 -04001336 }
bungemanfe917272016-10-13 17:36:40 -04001337
Mike Kleine6682eb2017-01-05 10:54:57 -05001338 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001339 sources = [
1340 "tools/skdiff/skdiff.cpp",
1341 "tools/skdiff/skdiff_html.cpp",
1342 "tools/skdiff/skdiff_main.cpp",
1343 "tools/skdiff/skdiff_utils.cpp",
1344 ]
1345 deps = [
1346 ":skia",
1347 ":tool_utils",
1348 ]
bungemanfe917272016-10-13 17:36:40 -04001349 }
halcanarya73d76a2016-10-17 13:19:02 -07001350
Mike Kleine6682eb2017-01-05 10:54:57 -05001351 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001352 sources = [
1353 "tools/skp_parser.cpp",
1354 ]
1355 deps = [
1356 ":skia",
1357 ":tool_utils",
1358 "//third_party/jsoncpp",
1359 ]
halcanarya73d76a2016-10-17 13:19:02 -07001360 }
Brian Osman16adfa32016-10-18 14:42:44 -04001361
Mike Kleina92c3832016-12-08 09:49:39 -05001362 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001363 test_app("viewer") {
1364 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001365 sources = [
1366 "tools/viewer/GMSlide.cpp",
1367 "tools/viewer/ImageSlide.cpp",
1368 "tools/viewer/SKPSlide.cpp",
1369 "tools/viewer/SampleSlide.cpp",
1370 "tools/viewer/Viewer.cpp",
1371 "tools/viewer/sk_app/CommandSet.cpp",
1372 "tools/viewer/sk_app/GLWindowContext.cpp",
1373 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001374 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001375 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001376
Jim Van Verth4e56a912016-10-21 10:58:52 -04001377 if (is_android) {
1378 sources += [
1379 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1380 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1381 "tools/viewer/sk_app/android/Window_android.cpp",
1382 "tools/viewer/sk_app/android/main_android.cpp",
1383 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1384 ]
Brian Osman462334e2017-02-09 11:22:57 -05001385 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001386 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001387 sources += [
1388 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1389 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1390 "tools/viewer/sk_app/unix/Window_unix.cpp",
1391 "tools/viewer/sk_app/unix/main_unix.cpp",
1392 ]
1393 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001394 sources += [
1395 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1396 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1397 "tools/viewer/sk_app/win/Window_win.cpp",
1398 "tools/viewer/sk_app/win/main_win.cpp",
1399 ]
Mike Klein43c25262016-10-20 10:17:47 -04001400 } else if (is_mac) {
1401 sources += [
1402 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1403 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1404 "tools/viewer/sk_app/mac/Window_mac.cpp",
1405 "tools/viewer/sk_app/mac/main_mac.cpp",
1406 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001407 }
1408
1409 if (skia_use_vulkan) {
1410 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001411 if (is_android) {
1412 sources +=
1413 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001414 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001415 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1416 libs += [ "X11-xcb" ]
1417 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001418 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1419 }
1420 }
1421
1422 include_dirs = []
1423 deps = [
1424 ":flags",
1425 ":gm",
1426 ":gpu_tool_utils",
1427 ":samples",
1428 ":skia",
1429 ":tool_utils",
1430 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001431 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001432 "//third_party/jsoncpp",
1433 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001434 if (is_android) {
1435 deps += [ "//third_party/native_app_glue" ]
1436 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001437 deps += [ "//third_party/libsdl" ]
1438 }
Mike Kleina92c3832016-12-08 09:49:39 -05001439 }
Brian Osman16adfa32016-10-18 14:42:44 -04001440 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001441
Mike Klein621ea112017-01-12 08:07:23 -05001442 if (is_android && is_skia_standalone && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001443 copy("gdbserver") {
1444 sources = [
1445 "$ndk/$ndk_gdbserver",
1446 ]
1447 outputs = [
1448 "$root_out_dir/gdbserver",
1449 ]
1450 }
1451 if (ndk_simpleperf != "") {
1452 copy("simpleperf") {
1453 sources = [
1454 "$ndk/$ndk_simpleperf",
1455 "$ndk/simpleperf/simpleperf_report.py",
1456 ]
1457 outputs = [
1458 "$root_out_dir/{{source_file_part}}",
1459 ]
1460 }
1461 }
1462 }
1463
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001464 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001465 test_app("skslc") {
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001466 sources = [
1467 "src/sksl/SkSLMain.cpp",
1468 ]
1469 deps = [
1470 ":flags",
1471 ":skia",
1472 ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001473 }
1474 }
mtklein25c81d42016-07-27 13:55:26 -07001475}