blob: c162842b36e9a42cd0ee7d9c2ada0972d8940c6e [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 Kleind44dd4c2017-02-21 18:50:51 -050032 skia_enable_jumper = is_skia_standalone
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" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500410 libs += [
411 "GL",
412 "GLU",
413 ]
mtklein06c35c02016-09-20 12:28:12 -0700414 } else if (is_mac) {
415 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800416 } else if (is_ios) {
417 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400418 } else if (is_win) {
419 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
420 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700421 } else {
422 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
423 }
mtkleine9fb3d52016-09-20 15:11:46 -0700424
425 if (skia_use_vulkan) {
426 public_defines += [ "SK_VULKAN" ]
427 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700428 if (skia_enable_vulkan_debug_layers) {
429 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
430 }
mtkleine9fb3d52016-09-20 15:11:46 -0700431 }
mtklein06c35c02016-09-20 12:28:12 -0700432}
433
mtklein63213812016-08-24 09:55:56 -0700434optional("jpeg") {
435 enabled = skia_use_libjpeg_turbo
436 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
437
mtklein63213812016-08-24 09:55:56 -0700438 deps = [
439 "//third_party/libjpeg-turbo:libjpeg",
440 ]
441 sources = [
442 "src/codec/SkJpegCodec.cpp",
443 "src/codec/SkJpegDecoderMgr.cpp",
444 "src/codec/SkJpegUtility.cpp",
445 "src/images/SkJPEGImageEncoder.cpp",
446 "src/images/SkJPEGWriteUtility.cpp",
447 ]
448}
449
450optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500451 enabled = skia_use_zlib && skia_enable_pdf
452 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700453
mtklein63213812016-08-24 09:55:56 -0700454 deps = [
455 "//third_party/zlib",
456 ]
brettwb9447282016-09-01 14:24:39 -0700457 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700458 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700459
460 if (skia_use_sfntly) {
461 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500462 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700463 }
464}
465
466optional("png") {
467 enabled = skia_use_libpng
468 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
469
mtklein63213812016-08-24 09:55:56 -0700470 deps = [
471 "//third_party/libpng",
472 ]
473 sources = [
474 "src/codec/SkIcoCodec.cpp",
475 "src/codec/SkPngCodec.cpp",
476 "src/images/SkPNGImageEncoder.cpp",
477 ]
478}
479
scroggof84ad642016-10-31 09:02:57 -0700480optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400481 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700482 public_defines = [ "SK_CODEC_DECODES_RAW" ]
483
484 deps = [
485 "//third_party/dng_sdk",
486 "//third_party/libjpeg-turbo:libjpeg",
487 "//third_party/piex",
488 ]
489
490 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
491 # Skia.
492 configs_to_remove = [ "//gn:no_exceptions" ]
493
494 sources = [
495 "src/codec/SkRawAdapterCodec.cpp",
496 "src/codec/SkRawCodec.cpp",
497 ]
498}
499
Mike Kleine1caee12017-02-15 13:31:12 -0500500optional("jumper") {
501 enabled = skia_enable_jumper
502 public_defines = [ "SK_JUMPER" ]
503 sources = [
504 "src/jumper/SkJumper.cpp",
505 "src/jumper/SkJumper_stages.cpp",
506 ]
Mike Kleined1b9022017-02-21 12:13:44 -0500507 if (is_win && target_cpu == "x64") {
508 sources += [ "src/jumper/SkJumper_generated_win.S" ]
509 } else if (!is_win) {
510 sources += [ "src/jumper/SkJumper_generated.S" ]
511 }
Mike Kleine1caee12017-02-15 13:31:12 -0500512}
513
mtklein3cc22182016-08-29 13:26:14 -0700514optional("typeface_freetype") {
515 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700516
517 deps = [
518 "//third_party/freetype2",
519 ]
520 sources = [
521 "src/ports/SkFontHost_FreeType.cpp",
522 "src/ports/SkFontHost_FreeType_common.cpp",
523 ]
524}
525
mtklein457b42a2016-08-23 13:56:37 -0700526optional("webp") {
527 enabled = skia_use_libwebp
528 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
529
mtklein457b42a2016-08-23 13:56:37 -0700530 deps = [
531 "//third_party/libwebp",
532 ]
533 sources = [
534 "src/codec/SkWebpAdapterCodec.cpp",
535 "src/codec/SkWebpCodec.cpp",
536 "src/images/SkWEBPImageEncoder.cpp",
537 ]
mtkleineb3c4252016-08-23 07:38:09 -0700538}
539
mtklein63213812016-08-24 09:55:56 -0700540optional("xml") {
541 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000542 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700543
mtklein63213812016-08-24 09:55:56 -0700544 deps = [
545 "//third_party/expat",
546 ]
547 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500548 "src/svg/SkSVGCanvas.cpp",
549 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700550 "src/xml/SkDOM.cpp",
551 "src/xml/SkXMLParser.cpp",
552 "src/xml/SkXMLWriter.cpp",
553 ]
554}
555
mtkleinc04ff472016-06-23 10:29:30 -0700556component("skia") {
557 public_configs = [ ":skia_public" ]
558 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700559
560 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700561 ":arm64",
562 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700563 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700564 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500565 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700566 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700567 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700568 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700569 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700570 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400571 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700572 ":jpeg",
Mike Kleine1caee12017-02-15 13:31:12 -0500573 ":jumper",
mtklein9b8583d2016-08-24 17:32:30 -0700574 ":none",
mtklein63213812016-08-24 09:55:56 -0700575 ":pdf",
576 ":png",
scroggof84ad642016-10-31 09:02:57 -0700577 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700578 ":sse2",
579 ":sse41",
580 ":sse42",
581 ":ssse3",
Ben Wagner7d07d462017-02-17 18:38:52 +0000582 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700583 ":webp",
mtklein63213812016-08-24 09:55:56 -0700584 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700585 ]
586
Chinmay Garde43f115c2016-11-16 15:04:12 -0800587 # This file (and all GN files in Skia) are designed to work with an
588 # empty sources assignment filter; we handle all that explicitly.
589 # We clear the filter here for clients who may have set up a global filter.
590 set_sources_assignment_filter([])
591
mtkleinc04ff472016-06-23 10:29:30 -0700592 sources = []
brettwb9447282016-09-01 14:24:39 -0700593 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700594 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500595 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700596 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700597 "src/android/SkBitmapRegionCodec.cpp",
598 "src/android/SkBitmapRegionDecoder.cpp",
599 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700600 "src/codec/SkBmpCodec.cpp",
601 "src/codec/SkBmpMaskCodec.cpp",
602 "src/codec/SkBmpRLECodec.cpp",
603 "src/codec/SkBmpStandardCodec.cpp",
604 "src/codec/SkCodec.cpp",
605 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700606 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700607 "src/codec/SkMaskSwizzler.cpp",
608 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700609 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700610 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700611 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700612 "src/codec/SkSwizzler.cpp",
613 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700614 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700615 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700616 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700617 "src/ports/SkMemory_malloc.cpp",
618 "src/ports/SkOSFile_stdio.cpp",
619 "src/sfnt/SkOTTable_name.cpp",
620 "src/sfnt/SkOTUtils.cpp",
621 "src/utils/mac/SkStream_mac.cpp",
622 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700623 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700624 ]
brettwb9447282016-09-01 14:24:39 -0700625
mtklein7d6fb2c2016-08-25 14:50:44 -0700626 libs = []
627
mtkleinc04ff472016-06-23 10:29:30 -0700628 if (is_win) {
629 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400630 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700631 "src/ports/SkDebug_win.cpp",
632 "src/ports/SkFontHost_win.cpp",
633 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700634 "src/ports/SkImageEncoder_WIC.cpp",
635 "src/ports/SkImageGeneratorWIC.cpp",
636 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700637 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700638 "src/ports/SkScalerContext_win_dw.cpp",
639 "src/ports/SkTLS_win.cpp",
640 "src/ports/SkTypeface_win_dw.cpp",
641 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400642 if (skia_use_gdi) {
643 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
644 libs += [
645 "Gdi32.lib",
646 "Usp10.lib",
647 ]
648 } else {
649 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
650 }
mtkleinb9be9792016-09-16 14:44:18 -0700651 sources -=
652 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400653 libs += [
654 "FontSub.lib",
655 "Ole32.lib",
656 "OleAut32.lib",
657 "User32.lib",
658 ]
mtkleinc04ff472016-06-23 10:29:30 -0700659 } else {
660 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700661 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700662 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700663 "src/ports/SkTLS_pthread.cpp",
664 ]
665 }
666
mtklein7d6fb2c2016-08-25 14:50:44 -0700667 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500668 deps += [ "//third_party/expat" ]
669 if (is_skia_standalone && ndk != "") {
670 deps += [ "//third_party/cpu-features" ]
671 }
mtklein06c35c02016-09-20 12:28:12 -0700672 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700673 libs += [
674 "EGL",
675 "GLESv2",
676 "log",
677 ]
678 }
679
mtkleinc04ff472016-06-23 10:29:30 -0700680 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700681 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700682 }
683
684 if (is_mac) {
685 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700686 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700687 "src/ports/SkFontHost_mac.cpp",
688 "src/ports/SkImageEncoder_CG.cpp",
689 "src/ports/SkImageGeneratorCG.cpp",
690 ]
mtklein09e61f72016-08-23 13:35:28 -0700691 libs += [
692 "ApplicationServices.framework",
693 "OpenGL.framework",
694 ]
mtkleinc04ff472016-06-23 10:29:30 -0700695 }
abarth6fc8ff02016-07-15 15:15:15 -0700696
Mike Klein7d302882016-11-03 14:06:31 -0400697 if (is_ios) {
698 sources += [
699 "src/ports/SkDebug_stdio.cpp",
700 "src/ports/SkFontHost_mac.cpp",
701 "src/ports/SkImageEncoder_CG.cpp",
702 "src/ports/SkImageGeneratorCG.cpp",
703 ]
704 libs += [
705 "CoreFoundation.framework",
706 "CoreGraphics.framework",
707 "CoreText.framework",
708 "ImageIO.framework",
709 "MobileCoreServices.framework",
710 ]
711 }
712
abarth6fc8ff02016-07-15 15:15:15 -0700713 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700714 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700715 }
mtkleinc04ff472016-06-23 10:29:30 -0700716}
717
mtkleinc095df52016-08-24 12:23:52 -0700718# Targets guarded by skia_enable_tools may use //third_party freely.
719if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500720 # Used by gn_to_bp.py to list our public include dirs.
721 source_set("public") {
722 configs += [ ":skia_public" ]
723 }
724
Mike Kleinc36dedf2016-11-18 09:35:28 -0500725 config("skia.h_config") {
726 include_dirs = [ "$target_gen_dir" ]
727 }
728 action("skia.h") {
729 public_configs = [ ":skia.h_config" ]
730 skia_h = "$target_gen_dir/skia.h"
731 script = "gn/find_headers.py"
732 args = [ rebase_path(skia_h, root_build_dir) ] +
733 rebase_path(skia_public_includes)
734 depfile = "$skia_h.deps"
735 outputs = [
736 skia_h,
737 ]
738 }
739
740 if (skia_enable_gpu && target_cpu == "x64") {
741 # Our bots only have 64-bit libOSMesa installed.
742 # TODO: worth fixing?
743 executable("fiddle") {
744 libs = []
745 if (is_linux) {
746 libs += [ "OSMesa" ]
747 }
748
749 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500750 "tools/fiddle/draw.cpp",
751 "tools/fiddle/fiddle_main.cpp",
752 ]
753 deps = [
754 ":skia",
755 ":skia.h",
756 ]
757 }
758 }
759
760 if (skia_enable_gpu) {
761 source_set("public_headers_warnings_check") {
762 sources = [
763 "tools/public_headers_warnings_check.cpp",
764 ]
765 configs -= [ "//gn:warnings_except_public_headers" ]
766 deps = [
767 ":skia",
768 ":skia.h",
769 ]
770 }
771 }
772
mtkleinc095df52016-08-24 12:23:52 -0700773 template("test_lib") {
774 config(target_name + "_config") {
775 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700776 if (defined(invoker.public_defines)) {
777 defines = invoker.public_defines
778 }
mtklein25c81d42016-07-27 13:55:26 -0700779 }
mtkleinc095df52016-08-24 12:23:52 -0700780 source_set(target_name) {
781 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
782 public_configs = [
783 ":" + target_name + "_config",
784 ":skia_private",
785 ]
786
787 if (!defined(deps)) {
788 deps = []
789 }
790 deps += [ ":skia" ]
791 testonly = true
792 }
mtklein25c81d42016-07-27 13:55:26 -0700793 }
mtklein25c81d42016-07-27 13:55:26 -0700794
Mike Kleine6682eb2017-01-05 10:54:57 -0500795 template("test_app") {
796 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
797 shared_library("lib" + target_name) {
798 forward_variables_from(invoker, "*", [ "is_shared_library" ])
799 testonly = true
800 }
801 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500802 _executable = target_name
803 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500804 forward_variables_from(invoker, "*", [ "is_shared_library" ])
805 testonly = true
806 }
807 }
Mike Klein7d921032017-01-05 12:20:41 -0500808 if (is_android && skia_android_serial != "" && defined(_executable)) {
809 action("push_" + target_name) {
810 script = "gn/push_to_android.py"
811 deps = [
812 ":" + _executable,
813 ]
814 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
815 outputs = [
816 _stamp,
817 ]
818 args = [
819 rebase_path("$root_build_dir/$_executable"),
820 skia_android_serial,
821 rebase_path(_stamp),
822 ]
823 testonly = true
824 }
825 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500826 }
827
mtkleinc095df52016-08-24 12:23:52 -0700828 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700829 public_include_dirs = []
830 if (skia_enable_gpu) {
831 public_defines = []
832 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700833
834 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700835 sources = [
836 "tools/gpu/GrContextFactory.cpp",
837 "tools/gpu/GrTest.cpp",
838 "tools/gpu/TestContext.cpp",
839 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700840 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700841 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
842 "tools/gpu/gl/debug/GrBufferObj.cpp",
843 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
844 "tools/gpu/gl/debug/GrProgramObj.cpp",
845 "tools/gpu/gl/debug/GrShaderObj.cpp",
846 "tools/gpu/gl/debug/GrTextureObj.cpp",
847 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
848 "tools/gpu/gl/null/NullGLTestContext.cpp",
849 ]
850 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700851
mtklein38925aa2016-09-21 10:11:25 -0700852 if (is_android) {
853 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400854 } else if (is_ios) {
855 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
856 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700857 } else if (is_linux) {
858 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500859 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700860 } else if (is_mac) {
861 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400862 } else if (is_win) {
863 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
864 libs += [
865 "Gdi32.lib",
866 "OpenGL32.lib",
867 ]
mtklein38925aa2016-09-21 10:11:25 -0700868 }
mtklein6ef69992016-09-14 06:12:09 -0700869
Mike Kleinc168a3a2016-11-14 14:53:13 +0000870 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000871 deps += [ "//third_party/angle2" ]
872 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
873 }
mtklein38925aa2016-09-21 10:11:25 -0700874 if (skia_use_mesa) {
875 public_defines += [ "SK_MESA" ]
876 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
877 libs += [ "OSMesa" ]
878 }
mtkleind68f9b02016-09-23 13:18:41 -0700879 if (skia_use_vulkan) {
880 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
881 }
mtkleina627b5c2016-09-20 13:36:47 -0700882 }
mtklein25c81d42016-07-27 13:55:26 -0700883 }
mtklein25c81d42016-07-27 13:55:26 -0700884
mtkleinc095df52016-08-24 12:23:52 -0700885 test_lib("flags") {
886 public_include_dirs = [ "tools/flags" ]
887 sources = [
888 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700889 ]
890 }
891 test_lib("common_flags") {
892 public_include_dirs = [ "tools/flags" ]
893 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700894 "tools/flags/SkCommonFlags.cpp",
895 "tools/flags/SkCommonFlagsConfig.cpp",
896 ]
897 deps = [
mtklein046cb562016-09-16 10:23:12 -0700898 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700899 ":gpu_tool_utils",
900 ]
901 }
mtklein25c81d42016-07-27 13:55:26 -0700902
mtkleinc095df52016-08-24 12:23:52 -0700903 test_lib("tool_utils") {
904 public_include_dirs = [
905 "tools",
906 "tools/debugger",
907 "tools/timer",
908 ]
909 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700910 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700911 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700912 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700913 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700914 "tools/ProcStats.cpp",
915 "tools/Resources.cpp",
916 "tools/ThermalManager.cpp",
917 "tools/UrlDataManager.cpp",
918 "tools/debugger/SkDebugCanvas.cpp",
919 "tools/debugger/SkDrawCommand.cpp",
920 "tools/debugger/SkJsonWriteBuffer.cpp",
921 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700922 "tools/picture_utils.cpp",
923 "tools/random_parse_path.cpp",
924 "tools/sk_tool_utils.cpp",
925 "tools/sk_tool_utils_font.cpp",
926 "tools/timer/Timer.cpp",
927 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500928 libs = []
929 if (is_ios) {
930 sources += [ "tools/ios_utils.m" ]
931 libs += [ "Foundation.framework" ]
932 }
mtkleinc095df52016-08-24 12:23:52 -0700933 deps = [
mtklein046cb562016-09-16 10:23:12 -0700934 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700935 ":flags",
936 "//third_party/libpng",
937 ]
938 public_deps = [
939 "//third_party/jsoncpp",
940 ]
941 }
mtklein25c81d42016-07-27 13:55:26 -0700942
Mike Klein6e744122016-10-27 12:21:40 -0400943 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700944 test_lib("gm") {
945 public_include_dirs = [ "gm" ]
946 sources = gm_sources
947 deps = [
scroggo19b91532016-10-24 09:03:26 -0700948 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700949 ":gpu_tool_utils",
950 ":skia",
951 ":tool_utils",
952 ]
953 }
mtklein25c81d42016-07-27 13:55:26 -0700954
Mike Klein6e744122016-10-27 12:21:40 -0400955 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700956 test_lib("tests") {
957 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400958 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700959 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400960 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700961 }
mtkleinc095df52016-08-24 12:23:52 -0700962 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700963 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700964 ":flags",
965 ":gpu_tool_utils",
966 ":skia",
967 ":tool_utils",
968 "//third_party/libpng",
969 "//third_party/zlib",
970 ]
971 }
mtklein2f3416d2016-08-02 16:02:05 -0700972
Mike Klein6e744122016-10-27 12:21:40 -0400973 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700974 test_lib("bench") {
975 public_include_dirs = [ "bench" ]
976 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700977 deps = [
978 ":flags",
979 ":gm",
980 ":gpu_tool_utils",
981 ":skia",
982 ":tool_utils",
983 ]
984 }
mtklein2b6870c2016-07-28 14:17:33 -0700985
mtkleinc095df52016-08-24 12:23:52 -0700986 test_lib("experimental_svg_model") {
987 public_include_dirs = [ "experimental/svg/model" ]
988 sources = [
989 "experimental/svg/model/SkSVGAttribute.cpp",
990 "experimental/svg/model/SkSVGAttributeParser.cpp",
991 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -0500992 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700993 "experimental/svg/model/SkSVGContainer.cpp",
994 "experimental/svg/model/SkSVGDOM.cpp",
995 "experimental/svg/model/SkSVGEllipse.cpp",
996 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700997 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700998 "experimental/svg/model/SkSVGNode.cpp",
999 "experimental/svg/model/SkSVGPath.cpp",
1000 "experimental/svg/model/SkSVGPoly.cpp",
1001 "experimental/svg/model/SkSVGRect.cpp",
1002 "experimental/svg/model/SkSVGRenderContext.cpp",
1003 "experimental/svg/model/SkSVGSVG.cpp",
1004 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001005 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001006 "experimental/svg/model/SkSVGTransformableNode.cpp",
1007 "experimental/svg/model/SkSVGValue.cpp",
1008 ]
1009 deps = [
1010 ":skia",
1011 ]
1012 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001013
Brian Osman16adfa32016-10-18 14:42:44 -04001014 test_lib("views") {
1015 public_include_dirs = [ "include/views" ]
1016 sources = [
1017 "src/views/SkEvent.cpp",
1018 "src/views/SkEventSink.cpp",
1019 "src/views/SkOSMenu.cpp",
1020 "src/views/SkTagList.cpp",
1021 "src/views/SkTouchGesture.cpp",
1022 "src/views/SkView.cpp",
1023 "src/views/SkViewPriv.cpp",
1024 ]
1025 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001026 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001027 if (!is_android) {
1028 sources += [ "src/views/SkWindow.cpp" ]
1029 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001030 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001031 public_include_dirs += [ "src/views/unix" ]
1032 sources += [
1033 "src/views/unix/SkOSWindow_Unix.cpp",
1034 "src/views/unix/keysym2ucs.c",
1035 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001036 libs += [
1037 "GL",
1038 "X11",
1039 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001040 } else if (is_mac) {
1041 sources += [
1042 "src/views/mac/SkEventNotifier.mm",
1043 "src/views/mac/SkNSView.mm",
1044 "src/views/mac/SkOSWindow_Mac.mm",
1045 "src/views/mac/SkTextFieldCell.m",
1046 ]
1047 libs += [
1048 "QuartzCore.framework",
1049 "Cocoa.framework",
1050 "Foundation.framework",
1051 ]
1052 } else if (is_win) {
1053 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1054 }
Brian Osman34755e22016-12-05 09:46:02 -05001055 if (skia_use_angle) {
1056 deps += [ "//third_party/angle2" ]
1057 }
Brian Osman16adfa32016-10-18 14:42:44 -04001058 }
1059
Mike Klein38af9432016-11-11 11:39:44 -05001060 if (skia_use_lua) {
1061 test_lib("lua") {
1062 public_include_dirs = []
1063 sources = [
1064 "src/utils/SkLua.cpp",
1065 "src/utils/SkLuaCanvas.cpp",
1066 ]
1067 deps = [
1068 "//third_party/lua",
1069 ]
1070 }
1071
Mike Kleine6682eb2017-01-05 10:54:57 -05001072 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001073 sources = [
1074 "tools/lua/lua_app.cpp",
1075 ]
1076 deps = [
1077 ":lua",
1078 ":skia",
1079 "//third_party/lua",
1080 ]
Mike Klein38af9432016-11-11 11:39:44 -05001081 }
1082
Mike Kleine6682eb2017-01-05 10:54:57 -05001083 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001084 sources = [
1085 "tools/lua/lua_pictures.cpp",
1086 ]
1087 deps = [
1088 ":flags",
1089 ":lua",
1090 ":skia",
1091 ":tool_utils",
1092 "//third_party/lua",
1093 ]
Mike Klein38af9432016-11-11 11:39:44 -05001094 }
1095 }
1096
Mike Klein6e744122016-10-27 12:21:40 -04001097 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001098 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001099 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001100 include_dirs = [ "experimental" ]
1101 sources = samples_sources + [
1102 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1103 "experimental/SkSetPoly3To3.cpp",
1104 "experimental/SkSetPoly3To3_A.cpp",
1105 "experimental/SkSetPoly3To3_D.cpp",
1106 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001107 deps = [
1108 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001109 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001110 ":tool_utils",
1111 ":views",
1112 ":xml",
1113 ]
Mike Klein38af9432016-11-11 11:39:44 -05001114
1115 if (skia_use_lua) {
1116 sources += [ "samplecode/SampleLua.cpp" ]
1117 deps += [
1118 ":lua",
1119 "//third_party/lua",
1120 ]
1121 }
Brian Osman16adfa32016-10-18 14:42:44 -04001122 }
1123
Mike Kleine6682eb2017-01-05 10:54:57 -05001124 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001125 sources = [
1126 "dm/DM.cpp",
1127 "dm/DMJsonWriter.cpp",
1128 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001129 ]
1130 include_dirs = [ "tests" ]
1131 deps = [
mtklein046cb562016-09-16 10:23:12 -07001132 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001133 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001134 ":flags",
1135 ":gm",
1136 ":gpu_tool_utils",
1137 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001138 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001139 ":tool_utils",
1140 "//third_party/jsoncpp",
1141 "//third_party/libpng",
1142 ]
mtklein2b6870c2016-07-28 14:17:33 -07001143 }
1144
Mike Kleina3430172016-09-27 16:46:29 -04001145 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001146 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001147 sources = [
1148 "tools/monobench.cpp",
1149 ]
1150 deps = [
1151 ":bench",
1152 ":skia",
1153 ]
Mike Kleina3430172016-09-27 16:46:29 -04001154 }
mtklein2b6870c2016-07-28 14:17:33 -07001155 }
1156
Mike Kleine6682eb2017-01-05 10:54:57 -05001157 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001158 sources = [
1159 "bench/nanobench.cpp",
1160 ]
1161 deps = [
1162 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001163 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001164 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001165 ":flags",
1166 ":gm",
1167 ":gpu_tool_utils",
1168 ":skia",
1169 ":tool_utils",
1170 "//third_party/jsoncpp",
1171 ]
mtklein2b6870c2016-07-28 14:17:33 -07001172 }
halcanary19a97202016-08-03 15:08:04 -07001173
Ravi Mistry10d36c52017-01-31 09:49:18 -05001174 test_app("skpinfo") {
1175 sources = [
1176 "tools/skpinfo.cpp",
1177 ]
1178 deps = [
1179 ":flags",
1180 ":skia",
1181 ]
1182 }
1183
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001184 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001185 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001186 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001187 "samplecode/SampleApp.cpp",
1188 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001189 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001190 if (is_mac) {
1191 sources += [ "src/views/mac/skia_mac.mm" ]
1192 } else if (is_win) {
1193 sources += [ "src/views/win/skia_win.cpp" ]
1194 } else if (is_linux) {
1195 sources += [ "src/views/unix/skia_unix.cpp" ]
1196 }
mtklein38925aa2016-09-21 10:11:25 -07001197 deps = [
1198 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001199 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001200 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001201 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001202 ":skia",
1203 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001204 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001205 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001206 if (skia_use_angle) {
1207 deps += [ "//third_party/angle2" ]
1208 }
mtklein38925aa2016-09-21 10:11:25 -07001209 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001210 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001211
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001212 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001213 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001214 sources = [
1215 "tools/skpbench/skpbench.cpp",
1216 ]
1217 deps = [
1218 ":flags",
1219 ":gpu_tool_utils",
1220 ":skia",
1221 ":tool_utils",
1222 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001223 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001224 }
1225
Mike Klein7d302882016-11-03 14:06:31 -04001226 # We can't yet build ICU on iOS or Windows.
1227 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001228 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001229 sources = [
1230 "tools/SkShaper_harfbuzz.cpp",
1231 "tools/using_skia_and_harfbuzz.cpp",
1232 ]
1233 deps = [
1234 ":skia",
1235 "//third_party/harfbuzz",
1236 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001237 }
halcanary19a97202016-08-03 15:08:04 -07001238 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001239 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001240 sources = [
1241 "tools/SkShaper_primitive.cpp",
1242 "tools/using_skia_and_harfbuzz.cpp",
1243 ]
1244 deps = [
1245 ":skia",
1246 ]
halcanary3eee9d92016-09-10 07:01:53 -07001247 }
mtklein046cb562016-09-16 10:23:12 -07001248
Mike Kleine6682eb2017-01-05 10:54:57 -05001249 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001250 sources = [
1251 "tools/get_images_from_skps.cpp",
1252 ]
1253 deps = [
1254 ":flags",
1255 ":skia",
1256 "//third_party/jsoncpp",
1257 ]
mtklein046cb562016-09-16 10:23:12 -07001258 }
mtkleinecbc5262016-09-22 11:51:24 -07001259
Mike Kleine6682eb2017-01-05 10:54:57 -05001260 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001261 sources = [
1262 "tools/colorspaceinfo.cpp",
1263 ]
1264 deps = [
1265 ":flags",
1266 ":skia",
1267 ":tool_utils",
1268 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001269 }
1270
Mike Klein7d302882016-11-03 14:06:31 -04001271 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001272 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001273 sources = [
1274 "tools/skiaserve/Request.cpp",
1275 "tools/skiaserve/Response.cpp",
1276 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001277 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1278 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1279 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1280 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1281 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1282 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1283 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1284 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1285 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001286 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1287 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001288 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1289 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1290 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1291 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1292 ]
1293 deps = [
1294 ":flags",
1295 ":gpu_tool_utils",
1296 ":skia",
1297 ":tool_utils",
1298 "//third_party/jsoncpp",
1299 "//third_party/libmicrohttpd",
1300 "//third_party/libpng",
1301 ]
Mike Klein7d302882016-11-03 14:06:31 -04001302 }
mtkleinecbc5262016-09-22 11:51:24 -07001303 }
kjlubick14f984b2016-10-03 11:49:45 -07001304
Mike Kleine6682eb2017-01-05 10:54:57 -05001305 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001306 sources = [
1307 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001308 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001309 "fuzz/FuzzGradients.cpp",
1310 "fuzz/FuzzParsePath.cpp",
1311 "fuzz/FuzzPathop.cpp",
1312 "fuzz/FuzzScaleToSides.cpp",
1313 "fuzz/fuzz.cpp",
1314 ]
1315 deps = [
1316 ":flags",
1317 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001318 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001319 ]
kjlubick14f984b2016-10-03 11:49:45 -07001320 }
Mike Klein38312422016-10-05 15:41:01 -04001321
Mike Kleine6682eb2017-01-05 10:54:57 -05001322 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001323 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001324 rebase_path("tests/skia_test.cpp"),
1325 rebase_path("tests/Test.cpp"),
1326 ]
caryclark9feb6322016-10-25 08:58:26 -07001327 deps = [
1328 ":flags",
1329 ":gpu_tool_utils",
1330 ":skia",
1331 ":tool_utils",
1332 ]
caryclark9feb6322016-10-25 08:58:26 -07001333 }
1334
Mike Kleine6682eb2017-01-05 10:54:57 -05001335 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001336 sources = [
1337 "tools/DumpRecord.cpp",
1338 "tools/dump_record.cpp",
1339 ]
1340 deps = [
1341 ":flags",
1342 ":skia",
1343 ]
Mike Klein38312422016-10-05 15:41:01 -04001344 }
bungemanfe917272016-10-13 17:36:40 -04001345
Mike Kleine6682eb2017-01-05 10:54:57 -05001346 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001347 sources = [
1348 "tools/skdiff/skdiff.cpp",
1349 "tools/skdiff/skdiff_html.cpp",
1350 "tools/skdiff/skdiff_main.cpp",
1351 "tools/skdiff/skdiff_utils.cpp",
1352 ]
1353 deps = [
1354 ":skia",
1355 ":tool_utils",
1356 ]
bungemanfe917272016-10-13 17:36:40 -04001357 }
halcanarya73d76a2016-10-17 13:19:02 -07001358
Mike Kleine6682eb2017-01-05 10:54:57 -05001359 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001360 sources = [
1361 "tools/skp_parser.cpp",
1362 ]
1363 deps = [
1364 ":skia",
1365 ":tool_utils",
1366 "//third_party/jsoncpp",
1367 ]
halcanarya73d76a2016-10-17 13:19:02 -07001368 }
Brian Osman16adfa32016-10-18 14:42:44 -04001369
Mike Kleina92c3832016-12-08 09:49:39 -05001370 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001371 test_app("viewer") {
1372 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001373 sources = [
1374 "tools/viewer/GMSlide.cpp",
1375 "tools/viewer/ImageSlide.cpp",
1376 "tools/viewer/SKPSlide.cpp",
1377 "tools/viewer/SampleSlide.cpp",
1378 "tools/viewer/Viewer.cpp",
1379 "tools/viewer/sk_app/CommandSet.cpp",
1380 "tools/viewer/sk_app/GLWindowContext.cpp",
1381 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001382 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001383 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001384
Jim Van Verth4e56a912016-10-21 10:58:52 -04001385 if (is_android) {
1386 sources += [
1387 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1388 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1389 "tools/viewer/sk_app/android/Window_android.cpp",
1390 "tools/viewer/sk_app/android/main_android.cpp",
1391 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1392 ]
Brian Osman462334e2017-02-09 11:22:57 -05001393 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001394 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001395 sources += [
1396 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1397 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1398 "tools/viewer/sk_app/unix/Window_unix.cpp",
1399 "tools/viewer/sk_app/unix/main_unix.cpp",
1400 ]
1401 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001402 sources += [
1403 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1404 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1405 "tools/viewer/sk_app/win/Window_win.cpp",
1406 "tools/viewer/sk_app/win/main_win.cpp",
1407 ]
Mike Klein43c25262016-10-20 10:17:47 -04001408 } else if (is_mac) {
1409 sources += [
1410 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1411 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1412 "tools/viewer/sk_app/mac/Window_mac.cpp",
1413 "tools/viewer/sk_app/mac/main_mac.cpp",
1414 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001415 }
1416
1417 if (skia_use_vulkan) {
1418 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001419 if (is_android) {
1420 sources +=
1421 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001422 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001423 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1424 libs += [ "X11-xcb" ]
1425 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001426 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1427 }
1428 }
1429
1430 include_dirs = []
1431 deps = [
1432 ":flags",
1433 ":gm",
1434 ":gpu_tool_utils",
1435 ":samples",
1436 ":skia",
1437 ":tool_utils",
1438 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001439 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001440 "//third_party/jsoncpp",
1441 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001442 if (is_android) {
1443 deps += [ "//third_party/native_app_glue" ]
1444 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001445 deps += [ "//third_party/libsdl" ]
1446 }
Mike Kleina92c3832016-12-08 09:49:39 -05001447 }
Brian Osman16adfa32016-10-18 14:42:44 -04001448 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001449
Mike Klein621ea112017-01-12 08:07:23 -05001450 if (is_android && is_skia_standalone && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001451 copy("gdbserver") {
1452 sources = [
1453 "$ndk/$ndk_gdbserver",
1454 ]
1455 outputs = [
1456 "$root_out_dir/gdbserver",
1457 ]
1458 }
1459 if (ndk_simpleperf != "") {
1460 copy("simpleperf") {
1461 sources = [
1462 "$ndk/$ndk_simpleperf",
1463 "$ndk/simpleperf/simpleperf_report.py",
1464 ]
1465 outputs = [
1466 "$root_out_dir/{{source_file_part}}",
1467 ]
1468 }
1469 }
1470 }
1471
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001472 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001473 test_app("skslc") {
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001474 sources = [
1475 "src/sksl/SkSLMain.cpp",
1476 ]
1477 deps = [
1478 ":flags",
1479 ":skia",
1480 ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001481 }
1482 }
mtklein25c81d42016-07-27 13:55:26 -07001483}