blob: 1f95d601824c03f672ecfaebbf25a0c2a811c315 [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
mtklein06c35c02016-09-20 12:28:12 -070032 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050033 skia_enable_pdf = true
Mike Klein4ef8cb32017-01-12 11:36:46 -050034 skia_enable_splicer = is_skia_standalone && sanitize != "MSAN" && !is_ios
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",
mtklein25c81d42016-07-27 13:55:26 -070070 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070071]
72
mtkleinc04ff472016-06-23 10:29:30 -070073# Skia public API, generally provided by :skia.
74config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070075 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040076 defines = []
77 if (is_component_build) {
78 defines += [ "SKIA_DLL" ]
79 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040080 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070081 defines += [ "SK_SAMPLES_FOR_X" ]
82 }
mtkleincae1be52016-09-20 08:24:34 -070083 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040084 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070085 }
mtklein06c35c02016-09-20 12:28:12 -070086 if (!skia_enable_gpu) {
87 defines += [ "SK_SUPPORT_GPU=0" ]
88 }
mtkleinc04ff472016-06-23 10:29:30 -070089}
90
91# Skia internal APIs, used by Skia itself and a few test tools.
92config("skia_private") {
93 visibility = [ ":*" ]
94
95 include_dirs = [
96 "include/private",
97 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070098 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070099 "src/core",
100 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700101 "src/effects/gradients",
102 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700103 "src/gpu",
104 "src/image",
105 "src/images",
106 "src/lazy",
107 "src/opts",
108 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700109 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "src/ports",
111 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700112 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700113 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700114 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700115 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700116 "third_party/gif",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000117 "third_party/ktx",
mtkleinc04ff472016-06-23 10:29:30 -0700118 ]
mtklein150d1132016-08-01 06:56:40 -0700119
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400120 defines = [
121 "SK_GAMMA_APPLY_TO_A8",
122 "SK_INTERNAL",
123 ]
mtkleinb37c0342016-09-09 11:07:45 -0700124 if (is_android) {
125 defines += [
126 "SK_GAMMA_EXPONENT=1.4",
127 "SK_GAMMA_CONTRAST=0.0",
128 ]
129 }
mtklein88a7ac02016-09-14 11:16:49 -0700130 if (is_official_build || is_android) {
131 # TODO(bsalomon): it'd be nice to make Android normal.
132 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
133 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400134 libs = []
135 lib_dirs = []
136 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400137 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400138 if (is_win) {
139 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
140 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
141 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400142 include_dirs += [ "$skia_vulkan_sdk/include/" ]
143 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400144 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400145 }
Mike Klein487bfc22016-10-14 14:04:56 -0400146 if (is_win) {
147 libs += [ "vulkan-1.lib" ]
148 } else {
149 libs += [ "vulkan" ]
150 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400151 }
Brian Osman34755e22016-12-05 09:46:02 -0500152 if (skia_use_angle) {
153 defines += [ "SK_ANGLE" ]
154 }
Brian Osman3f375d02016-12-28 11:19:22 -0500155 if (skia_enable_discrete_gpu) {
156 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
157 }
mtkleinc04ff472016-06-23 10:29:30 -0700158}
159
160# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
161config("skia_library") {
162 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700163 defines = [ "SKIA_IMPLEMENTATION=1" ]
164}
165
166skia_library_configs = [
167 ":skia_public",
168 ":skia_private",
169 ":skia_library",
170]
171
mtklein9b8583d2016-08-24 17:32:30 -0700172# Use for CPU-specific Skia code that needs particular compiler flags.
173template("opts") {
174 if (invoker.enabled) {
175 source_set(target_name) {
176 forward_variables_from(invoker, "*")
177 configs += skia_library_configs
178 }
179 } else {
180 # If not enabled, a phony empty target that swallows all otherwise unused variables.
181 source_set(target_name) {
182 forward_variables_from(invoker,
183 "*",
184 [
185 "sources",
186 "cflags",
187 ])
188 }
189 }
anmittala7eaf2e2016-08-17 13:57:26 -0700190}
191
mtklein422310d2016-08-16 18:28:43 -0700192is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700193
mtklein7d6fb2c2016-08-25 14:50:44 -0700194opts("none") {
195 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700196 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700197 cflags = []
198}
199
mtklein7d6fb2c2016-08-25 14:50:44 -0700200opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700201 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700202 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700203 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700204}
205
206opts("arm64") {
207 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700208 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700209 cflags = []
210}
211
212opts("crc32") {
213 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700215 cflags = [ "-march=armv8-a+crc" ]
216}
217
mtklein9b8583d2016-08-24 17:32:30 -0700218opts("sse2") {
219 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400221 if (is_win) {
222 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
223 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400224 cflags = [ "-msse2" ]
225 }
mtklein9b8583d2016-08-24 17:32:30 -0700226}
mtkleinc04ff472016-06-23 10:29:30 -0700227
mtklein9b8583d2016-08-24 17:32:30 -0700228opts("ssse3") {
229 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700230 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400231 if (is_win) {
232 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
233 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400234 cflags = [ "-mssse3" ]
235 }
mtklein9b8583d2016-08-24 17:32:30 -0700236}
mtkleinc04ff472016-06-23 10:29:30 -0700237
mtklein9b8583d2016-08-24 17:32:30 -0700238opts("sse41") {
239 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400241 if (is_win) {
242 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
243 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400244 cflags = [ "-msse4.1" ]
245 }
mtklein9b8583d2016-08-24 17:32:30 -0700246}
mtklein4e976072016-08-08 09:06:27 -0700247
mtklein9b8583d2016-08-24 17:32:30 -0700248opts("sse42") {
249 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400251 if (is_win) {
252 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
253 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400254 cflags = [ "-msse4.2" ]
255 }
mtklein9b8583d2016-08-24 17:32:30 -0700256}
257
258opts("avx") {
259 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700260 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400261 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000262 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400263 } else {
264 cflags = [ "-mavx" ]
265 }
mtkleinc04ff472016-06-23 10:29:30 -0700266}
267
Mike Klein78d5a3b2016-09-30 10:48:01 -0400268opts("hsw") {
269 enabled = is_x86
270 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400271 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000272 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400273 } else {
274 cflags = [
275 "-mavx2",
276 "-mbmi",
277 "-mbmi2",
278 "-mf16c",
279 "-mfma",
280 ]
281 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400282}
283
mtkleinc095df52016-08-24 12:23:52 -0700284# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700285template("optional") {
286 if (invoker.enabled) {
287 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700288 if (defined(invoker.public_defines)) {
289 defines = invoker.public_defines
290 }
mtklein457b42a2016-08-23 13:56:37 -0700291 }
292 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700293 forward_variables_from(invoker,
294 "*",
295 [
296 "public_defines",
297 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700298 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700299 ])
mtklein457b42a2016-08-23 13:56:37 -0700300 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700301 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700302 if (defined(invoker.configs_to_remove)) {
303 configs -= invoker.configs_to_remove
304 }
mtklein457b42a2016-08-23 13:56:37 -0700305 }
306 } else {
mtklein457b42a2016-08-23 13:56:37 -0700307 source_set(target_name) {
308 forward_variables_from(invoker,
309 "*",
310 [
311 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700312 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700313 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700314 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700315 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700316 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700317 ])
mtkleincd01b032016-08-31 04:58:19 -0700318 if (defined(invoker.sources_when_disabled)) {
319 sources = invoker.sources_when_disabled
320 }
321 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700322 }
mtkleineb3c4252016-08-23 07:38:09 -0700323 }
mtklein457b42a2016-08-23 13:56:37 -0700324}
mtklein457b42a2016-08-23 13:56:37 -0700325
Mike Kleina04bb452017-02-09 12:24:07 -0500326optional("effects") {
327 enabled = skia_enable_effects
328 sources =
329 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
330 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
331}
332
mtkleina45be612016-08-29 15:22:10 -0700333optional("fontmgr_android") {
334 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700335
336 deps = [
337 "//third_party/expat",
338 "//third_party/freetype2",
339 ]
340 sources = [
341 "src/ports/SkFontMgr_android.cpp",
342 "src/ports/SkFontMgr_android_factory.cpp",
343 "src/ports/SkFontMgr_android_parser.cpp",
344 ]
345}
346
mtkleind2e39db2016-09-07 07:52:55 -0700347optional("fontmgr_custom") {
348 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
349
350 deps = [
351 "//third_party/freetype2",
352 ]
353 sources = [
354 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500355 "src/ports/SkFontMgr_custom.h",
356 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700357 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500358 "src/ports/SkFontMgr_custom_embedded.cpp",
359 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700360 ]
361}
362
mtklein3cc22182016-08-29 13:26:14 -0700363optional("fontmgr_fontconfig") {
364 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700365
366 deps = [
367 "//third_party:fontconfig",
368 "//third_party/freetype2",
369 ]
370 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700371 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700372 "src/ports/SkFontConfigInterface_direct.cpp",
373 "src/ports/SkFontConfigInterface_direct_factory.cpp",
374 "src/ports/SkFontMgr_FontConfigInterface.cpp",
375 "src/ports/SkFontMgr_fontconfig.cpp",
376 "src/ports/SkFontMgr_fontconfig_factory.cpp",
377 ]
378}
379
mtkleincdedd0e2016-09-12 15:15:44 -0700380optional("fontmgr_fuchsia") {
381 enabled = is_fuchsia && skia_use_freetype
382
383 deps = [
384 "//third_party/freetype2",
385 ]
386 sources = [
387 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500388 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700389 "src/ports/SkFontMgr_custom_empty_factory.cpp",
390 ]
391}
392
mtklein06c35c02016-09-20 12:28:12 -0700393optional("gpu") {
394 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700395 public_defines = []
396
Mike Klein29b3e582017-02-09 11:57:32 -0500397 sources = skia_gpu_sources + skia_sksl_sources +
398 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700399
400 # These paths need to be absolute to match the ones produced by shared_sources.gni.
401 sources -= get_path_info([
402 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
403 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
404 ],
405 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400406 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700407 if (is_android) {
408 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
409 } else if (is_linux) {
410 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
411 } else if (is_mac) {
412 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800413 } else if (is_ios) {
414 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400415 } else if (is_win) {
416 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
417 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700418 } else {
419 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
420 }
mtkleine9fb3d52016-09-20 15:11:46 -0700421
422 if (skia_use_vulkan) {
423 public_defines += [ "SK_VULKAN" ]
424 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700425 if (skia_enable_vulkan_debug_layers) {
426 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
427 }
mtkleine9fb3d52016-09-20 15:11:46 -0700428 }
mtklein06c35c02016-09-20 12:28:12 -0700429}
430
mtklein63213812016-08-24 09:55:56 -0700431optional("jpeg") {
432 enabled = skia_use_libjpeg_turbo
433 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
434
mtklein63213812016-08-24 09:55:56 -0700435 deps = [
436 "//third_party/libjpeg-turbo:libjpeg",
437 ]
438 sources = [
439 "src/codec/SkJpegCodec.cpp",
440 "src/codec/SkJpegDecoderMgr.cpp",
441 "src/codec/SkJpegUtility.cpp",
442 "src/images/SkJPEGImageEncoder.cpp",
443 "src/images/SkJPEGWriteUtility.cpp",
444 ]
445}
446
447optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500448 enabled = skia_use_zlib && skia_enable_pdf
449 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700450
mtklein63213812016-08-24 09:55:56 -0700451 deps = [
452 "//third_party/zlib",
453 ]
brettwb9447282016-09-01 14:24:39 -0700454 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700455 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700456
457 if (skia_use_sfntly) {
458 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500459 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700460 }
461}
462
463optional("png") {
464 enabled = skia_use_libpng
465 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
466
mtklein63213812016-08-24 09:55:56 -0700467 deps = [
468 "//third_party/libpng",
469 ]
470 sources = [
471 "src/codec/SkIcoCodec.cpp",
472 "src/codec/SkPngCodec.cpp",
473 "src/images/SkPNGImageEncoder.cpp",
474 ]
475}
476
scroggof84ad642016-10-31 09:02:57 -0700477optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400478 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700479 public_defines = [ "SK_CODEC_DECODES_RAW" ]
480
481 deps = [
482 "//third_party/dng_sdk",
483 "//third_party/libjpeg-turbo:libjpeg",
484 "//third_party/piex",
485 ]
486
487 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
488 # Skia.
489 configs_to_remove = [ "//gn:no_exceptions" ]
490
491 sources = [
492 "src/codec/SkRawAdapterCodec.cpp",
493 "src/codec/SkRawCodec.cpp",
494 ]
495}
496
Mike Kleina7080262017-01-09 10:20:13 -0500497optional("splicer") {
498 enabled = skia_enable_splicer
499 public_defines = [ "SK_RASTER_PIPELINE_HAS_JIT" ]
500
501 sources = [
502 "src/splicer/SkSplicer.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",
mtklein9b8583d2016-08-24 17:32:30 -0700565 ":none",
mtklein63213812016-08-24 09:55:56 -0700566 ":pdf",
567 ":png",
scroggof84ad642016-10-31 09:02:57 -0700568 ":raw",
Mike Kleina7080262017-01-09 10:20:13 -0500569 ":splicer",
mtklein9b8583d2016-08-24 17:32:30 -0700570 ":sse2",
571 ":sse41",
572 ":sse42",
573 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700574 ":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",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000616 "third_party/ktx/ktx.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700617 ]
brettwb9447282016-09-01 14:24:39 -0700618
mtklein7d6fb2c2016-08-25 14:50:44 -0700619 libs = []
620
mtkleinc04ff472016-06-23 10:29:30 -0700621 if (is_win) {
622 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400623 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700624 "src/ports/SkDebug_win.cpp",
625 "src/ports/SkFontHost_win.cpp",
626 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700627 "src/ports/SkImageEncoder_WIC.cpp",
628 "src/ports/SkImageGeneratorWIC.cpp",
629 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700630 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700631 "src/ports/SkScalerContext_win_dw.cpp",
632 "src/ports/SkTLS_win.cpp",
633 "src/ports/SkTypeface_win_dw.cpp",
634 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400635 if (skia_use_gdi) {
636 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
637 libs += [
638 "Gdi32.lib",
639 "Usp10.lib",
640 ]
641 } else {
642 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
643 }
mtkleinb9be9792016-09-16 14:44:18 -0700644 sources -=
645 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400646 libs += [
647 "FontSub.lib",
648 "Ole32.lib",
649 "OleAut32.lib",
650 "User32.lib",
651 ]
mtkleinc04ff472016-06-23 10:29:30 -0700652 } else {
653 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700654 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700655 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700656 "src/ports/SkTLS_pthread.cpp",
657 ]
658 }
659
mtklein7d6fb2c2016-08-25 14:50:44 -0700660 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500661 deps += [ "//third_party/expat" ]
662 if (is_skia_standalone && ndk != "") {
663 deps += [ "//third_party/cpu-features" ]
664 }
mtklein06c35c02016-09-20 12:28:12 -0700665 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700666 libs += [
667 "EGL",
668 "GLESv2",
669 "log",
670 ]
671 }
672
mtkleinc04ff472016-06-23 10:29:30 -0700673 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700674 libs += [
675 "GL",
676 "GLU",
677 "X11",
678 ]
mtklein06c35c02016-09-20 12:28:12 -0700679 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700680 }
681
682 if (is_mac) {
683 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700684 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700685 "src/ports/SkFontHost_mac.cpp",
686 "src/ports/SkImageEncoder_CG.cpp",
687 "src/ports/SkImageGeneratorCG.cpp",
688 ]
mtklein09e61f72016-08-23 13:35:28 -0700689 libs += [
690 "ApplicationServices.framework",
691 "OpenGL.framework",
692 ]
mtkleinc04ff472016-06-23 10:29:30 -0700693 }
abarth6fc8ff02016-07-15 15:15:15 -0700694
Mike Klein7d302882016-11-03 14:06:31 -0400695 if (is_ios) {
696 sources += [
697 "src/ports/SkDebug_stdio.cpp",
698 "src/ports/SkFontHost_mac.cpp",
699 "src/ports/SkImageEncoder_CG.cpp",
700 "src/ports/SkImageGeneratorCG.cpp",
701 ]
702 libs += [
703 "CoreFoundation.framework",
704 "CoreGraphics.framework",
705 "CoreText.framework",
706 "ImageIO.framework",
707 "MobileCoreServices.framework",
708 ]
709 }
710
abarth6fc8ff02016-07-15 15:15:15 -0700711 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700712 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700713 }
mtkleinc04ff472016-06-23 10:29:30 -0700714}
715
mtkleinc095df52016-08-24 12:23:52 -0700716# Targets guarded by skia_enable_tools may use //third_party freely.
717if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500718 # Used by gn_to_bp.py to list our public include dirs.
719 source_set("public") {
720 configs += [ ":skia_public" ]
721 }
722
Mike Kleinc36dedf2016-11-18 09:35:28 -0500723 config("skia.h_config") {
724 include_dirs = [ "$target_gen_dir" ]
725 }
726 action("skia.h") {
727 public_configs = [ ":skia.h_config" ]
728 skia_h = "$target_gen_dir/skia.h"
729 script = "gn/find_headers.py"
730 args = [ rebase_path(skia_h, root_build_dir) ] +
731 rebase_path(skia_public_includes)
732 depfile = "$skia_h.deps"
733 outputs = [
734 skia_h,
735 ]
736 }
737
738 if (skia_enable_gpu && target_cpu == "x64") {
739 # Our bots only have 64-bit libOSMesa installed.
740 # TODO: worth fixing?
741 executable("fiddle") {
742 libs = []
743 if (is_linux) {
744 libs += [ "OSMesa" ]
745 }
746
747 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500748 "tools/fiddle/draw.cpp",
749 "tools/fiddle/fiddle_main.cpp",
750 ]
751 deps = [
752 ":skia",
753 ":skia.h",
754 ]
755 }
756 }
757
758 if (skia_enable_gpu) {
759 source_set("public_headers_warnings_check") {
760 sources = [
761 "tools/public_headers_warnings_check.cpp",
762 ]
763 configs -= [ "//gn:warnings_except_public_headers" ]
764 deps = [
765 ":skia",
766 ":skia.h",
767 ]
768 }
769 }
770
mtkleinc095df52016-08-24 12:23:52 -0700771 template("test_lib") {
772 config(target_name + "_config") {
773 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700774 if (defined(invoker.public_defines)) {
775 defines = invoker.public_defines
776 }
mtklein25c81d42016-07-27 13:55:26 -0700777 }
mtkleinc095df52016-08-24 12:23:52 -0700778 source_set(target_name) {
779 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
780 public_configs = [
781 ":" + target_name + "_config",
782 ":skia_private",
783 ]
784
785 if (!defined(deps)) {
786 deps = []
787 }
788 deps += [ ":skia" ]
789 testonly = true
790 }
mtklein25c81d42016-07-27 13:55:26 -0700791 }
mtklein25c81d42016-07-27 13:55:26 -0700792
Mike Kleine6682eb2017-01-05 10:54:57 -0500793 template("test_app") {
794 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
795 shared_library("lib" + target_name) {
796 forward_variables_from(invoker, "*", [ "is_shared_library" ])
797 testonly = true
798 }
799 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500800 _executable = target_name
801 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500802 forward_variables_from(invoker, "*", [ "is_shared_library" ])
803 testonly = true
804 }
805 }
Mike Klein7d921032017-01-05 12:20:41 -0500806 if (is_android && skia_android_serial != "" && defined(_executable)) {
807 action("push_" + target_name) {
808 script = "gn/push_to_android.py"
809 deps = [
810 ":" + _executable,
811 ]
812 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
813 outputs = [
814 _stamp,
815 ]
816 args = [
817 rebase_path("$root_build_dir/$_executable"),
818 skia_android_serial,
819 rebase_path(_stamp),
820 ]
821 testonly = true
822 }
823 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500824 }
825
mtkleinc095df52016-08-24 12:23:52 -0700826 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700827 public_include_dirs = []
828 if (skia_enable_gpu) {
829 public_defines = []
830 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700831
832 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700833 sources = [
834 "tools/gpu/GrContextFactory.cpp",
835 "tools/gpu/GrTest.cpp",
836 "tools/gpu/TestContext.cpp",
837 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700838 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700839 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
840 "tools/gpu/gl/debug/GrBufferObj.cpp",
841 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
842 "tools/gpu/gl/debug/GrProgramObj.cpp",
843 "tools/gpu/gl/debug/GrShaderObj.cpp",
844 "tools/gpu/gl/debug/GrTextureObj.cpp",
845 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
846 "tools/gpu/gl/null/NullGLTestContext.cpp",
847 ]
848 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700849
mtklein38925aa2016-09-21 10:11:25 -0700850 if (is_android) {
851 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400852 } else if (is_ios) {
853 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
854 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700855 } else if (is_linux) {
856 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
857 } else if (is_mac) {
858 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400859 } else if (is_win) {
860 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
861 libs += [
862 "Gdi32.lib",
863 "OpenGL32.lib",
864 ]
mtklein38925aa2016-09-21 10:11:25 -0700865 }
mtklein6ef69992016-09-14 06:12:09 -0700866
Mike Kleinc168a3a2016-11-14 14:53:13 +0000867 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000868 deps += [ "//third_party/angle2" ]
869 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
870 }
mtklein38925aa2016-09-21 10:11:25 -0700871 if (skia_use_mesa) {
872 public_defines += [ "SK_MESA" ]
873 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
874 libs += [ "OSMesa" ]
875 }
mtkleind68f9b02016-09-23 13:18:41 -0700876 if (skia_use_vulkan) {
877 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
878 }
mtkleina627b5c2016-09-20 13:36:47 -0700879 }
mtklein25c81d42016-07-27 13:55:26 -0700880 }
mtklein25c81d42016-07-27 13:55:26 -0700881
mtkleinc095df52016-08-24 12:23:52 -0700882 test_lib("flags") {
883 public_include_dirs = [ "tools/flags" ]
884 sources = [
885 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700886 ]
887 }
888 test_lib("common_flags") {
889 public_include_dirs = [ "tools/flags" ]
890 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700891 "tools/flags/SkCommonFlags.cpp",
892 "tools/flags/SkCommonFlagsConfig.cpp",
893 ]
894 deps = [
mtklein046cb562016-09-16 10:23:12 -0700895 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700896 ":gpu_tool_utils",
897 ]
898 }
mtklein25c81d42016-07-27 13:55:26 -0700899
mtkleinc095df52016-08-24 12:23:52 -0700900 test_lib("tool_utils") {
901 public_include_dirs = [
902 "tools",
903 "tools/debugger",
904 "tools/timer",
905 ]
906 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700907 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700908 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700909 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700910 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700911 "tools/ProcStats.cpp",
912 "tools/Resources.cpp",
913 "tools/ThermalManager.cpp",
914 "tools/UrlDataManager.cpp",
915 "tools/debugger/SkDebugCanvas.cpp",
916 "tools/debugger/SkDrawCommand.cpp",
917 "tools/debugger/SkJsonWriteBuffer.cpp",
918 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700919 "tools/picture_utils.cpp",
920 "tools/random_parse_path.cpp",
921 "tools/sk_tool_utils.cpp",
922 "tools/sk_tool_utils_font.cpp",
923 "tools/timer/Timer.cpp",
924 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500925 libs = []
926 if (is_ios) {
927 sources += [ "tools/ios_utils.m" ]
928 libs += [ "Foundation.framework" ]
929 }
mtkleinc095df52016-08-24 12:23:52 -0700930 deps = [
mtklein046cb562016-09-16 10:23:12 -0700931 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700932 ":flags",
933 "//third_party/libpng",
934 ]
935 public_deps = [
936 "//third_party/jsoncpp",
937 ]
938 }
mtklein25c81d42016-07-27 13:55:26 -0700939
Mike Klein6e744122016-10-27 12:21:40 -0400940 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700941 test_lib("gm") {
942 public_include_dirs = [ "gm" ]
943 sources = gm_sources
944 deps = [
scroggo19b91532016-10-24 09:03:26 -0700945 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700946 ":gpu_tool_utils",
947 ":skia",
948 ":tool_utils",
949 ]
950 }
mtklein25c81d42016-07-27 13:55:26 -0700951
Mike Klein6e744122016-10-27 12:21:40 -0400952 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700953 test_lib("tests") {
954 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400955 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700956 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400957 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700958 }
mtkleinc095df52016-08-24 12:23:52 -0700959 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700960 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700961 ":flags",
962 ":gpu_tool_utils",
963 ":skia",
964 ":tool_utils",
965 "//third_party/libpng",
966 "//third_party/zlib",
967 ]
968 }
mtklein2f3416d2016-08-02 16:02:05 -0700969
Mike Klein6e744122016-10-27 12:21:40 -0400970 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700971 test_lib("bench") {
972 public_include_dirs = [ "bench" ]
973 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700974 deps = [
975 ":flags",
976 ":gm",
977 ":gpu_tool_utils",
978 ":skia",
979 ":tool_utils",
980 ]
981 }
mtklein2b6870c2016-07-28 14:17:33 -0700982
mtkleinc095df52016-08-24 12:23:52 -0700983 test_lib("experimental_svg_model") {
984 public_include_dirs = [ "experimental/svg/model" ]
985 sources = [
986 "experimental/svg/model/SkSVGAttribute.cpp",
987 "experimental/svg/model/SkSVGAttributeParser.cpp",
988 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -0500989 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700990 "experimental/svg/model/SkSVGContainer.cpp",
991 "experimental/svg/model/SkSVGDOM.cpp",
992 "experimental/svg/model/SkSVGEllipse.cpp",
993 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700994 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700995 "experimental/svg/model/SkSVGNode.cpp",
996 "experimental/svg/model/SkSVGPath.cpp",
997 "experimental/svg/model/SkSVGPoly.cpp",
998 "experimental/svg/model/SkSVGRect.cpp",
999 "experimental/svg/model/SkSVGRenderContext.cpp",
1000 "experimental/svg/model/SkSVGSVG.cpp",
1001 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001002 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001003 "experimental/svg/model/SkSVGTransformableNode.cpp",
1004 "experimental/svg/model/SkSVGValue.cpp",
1005 ]
1006 deps = [
1007 ":skia",
1008 ]
1009 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001010
Brian Osman16adfa32016-10-18 14:42:44 -04001011 test_lib("views") {
1012 public_include_dirs = [ "include/views" ]
1013 sources = [
1014 "src/views/SkEvent.cpp",
1015 "src/views/SkEventSink.cpp",
1016 "src/views/SkOSMenu.cpp",
1017 "src/views/SkTagList.cpp",
1018 "src/views/SkTouchGesture.cpp",
1019 "src/views/SkView.cpp",
1020 "src/views/SkViewPriv.cpp",
1021 ]
1022 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001023 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001024 if (!is_android) {
1025 sources += [ "src/views/SkWindow.cpp" ]
1026 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001027 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001028 public_include_dirs += [ "src/views/unix" ]
1029 sources += [
1030 "src/views/unix/SkOSWindow_Unix.cpp",
1031 "src/views/unix/keysym2ucs.c",
1032 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001033 } else if (is_mac) {
1034 sources += [
1035 "src/views/mac/SkEventNotifier.mm",
1036 "src/views/mac/SkNSView.mm",
1037 "src/views/mac/SkOSWindow_Mac.mm",
1038 "src/views/mac/SkTextFieldCell.m",
1039 ]
1040 libs += [
1041 "QuartzCore.framework",
1042 "Cocoa.framework",
1043 "Foundation.framework",
1044 ]
1045 } else if (is_win) {
1046 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1047 }
Brian Osman34755e22016-12-05 09:46:02 -05001048 if (skia_use_angle) {
1049 deps += [ "//third_party/angle2" ]
1050 }
Brian Osman16adfa32016-10-18 14:42:44 -04001051 }
1052
Mike Klein38af9432016-11-11 11:39:44 -05001053 if (skia_use_lua) {
1054 test_lib("lua") {
1055 public_include_dirs = []
1056 sources = [
1057 "src/utils/SkLua.cpp",
1058 "src/utils/SkLuaCanvas.cpp",
1059 ]
1060 deps = [
1061 "//third_party/lua",
1062 ]
1063 }
1064
Mike Kleine6682eb2017-01-05 10:54:57 -05001065 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001066 sources = [
1067 "tools/lua/lua_app.cpp",
1068 ]
1069 deps = [
1070 ":lua",
1071 ":skia",
1072 "//third_party/lua",
1073 ]
Mike Klein38af9432016-11-11 11:39:44 -05001074 }
1075
Mike Kleine6682eb2017-01-05 10:54:57 -05001076 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001077 sources = [
1078 "tools/lua/lua_pictures.cpp",
1079 ]
1080 deps = [
1081 ":flags",
1082 ":lua",
1083 ":skia",
1084 ":tool_utils",
1085 "//third_party/lua",
1086 ]
Mike Klein38af9432016-11-11 11:39:44 -05001087 }
1088 }
1089
Mike Klein6e744122016-10-27 12:21:40 -04001090 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001091 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001092 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001093 include_dirs = [ "experimental" ]
1094 sources = samples_sources + [
1095 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1096 "experimental/SkSetPoly3To3.cpp",
1097 "experimental/SkSetPoly3To3_A.cpp",
1098 "experimental/SkSetPoly3To3_D.cpp",
1099 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001100 deps = [
1101 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001102 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001103 ":tool_utils",
1104 ":views",
1105 ":xml",
1106 ]
Mike Klein38af9432016-11-11 11:39:44 -05001107
1108 if (skia_use_lua) {
1109 sources += [ "samplecode/SampleLua.cpp" ]
1110 deps += [
1111 ":lua",
1112 "//third_party/lua",
1113 ]
1114 }
Brian Osman16adfa32016-10-18 14:42:44 -04001115 }
1116
Mike Kleine6682eb2017-01-05 10:54:57 -05001117 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001118 sources = [
1119 "dm/DM.cpp",
1120 "dm/DMJsonWriter.cpp",
1121 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001122 ]
1123 include_dirs = [ "tests" ]
1124 deps = [
mtklein046cb562016-09-16 10:23:12 -07001125 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001126 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001127 ":flags",
1128 ":gm",
1129 ":gpu_tool_utils",
1130 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001131 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001132 ":tool_utils",
1133 "//third_party/jsoncpp",
1134 "//third_party/libpng",
1135 ]
mtklein2b6870c2016-07-28 14:17:33 -07001136 }
1137
Mike Kleina3430172016-09-27 16:46:29 -04001138 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001139 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001140 sources = [
1141 "tools/monobench.cpp",
1142 ]
1143 deps = [
1144 ":bench",
1145 ":skia",
1146 ]
Mike Kleina3430172016-09-27 16:46:29 -04001147 }
mtklein2b6870c2016-07-28 14:17:33 -07001148 }
1149
Mike Kleine6682eb2017-01-05 10:54:57 -05001150 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001151 sources = [
1152 "bench/nanobench.cpp",
1153 ]
1154 deps = [
1155 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001156 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001157 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001158 ":flags",
1159 ":gm",
1160 ":gpu_tool_utils",
1161 ":skia",
1162 ":tool_utils",
1163 "//third_party/jsoncpp",
1164 ]
mtklein2b6870c2016-07-28 14:17:33 -07001165 }
halcanary19a97202016-08-03 15:08:04 -07001166
Ravi Mistry10d36c52017-01-31 09:49:18 -05001167 test_app("skpinfo") {
1168 sources = [
1169 "tools/skpinfo.cpp",
1170 ]
1171 deps = [
1172 ":flags",
1173 ":skia",
1174 ]
1175 }
1176
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001177 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001178 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001179 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001180 "samplecode/SampleApp.cpp",
1181 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001182 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001183 if (is_mac) {
1184 sources += [ "src/views/mac/skia_mac.mm" ]
1185 } else if (is_win) {
1186 sources += [ "src/views/win/skia_win.cpp" ]
1187 } else if (is_linux) {
1188 sources += [ "src/views/unix/skia_unix.cpp" ]
1189 }
mtklein38925aa2016-09-21 10:11:25 -07001190 deps = [
1191 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001192 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001193 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001194 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001195 ":skia",
1196 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001197 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001198 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001199 if (skia_use_angle) {
1200 deps += [ "//third_party/angle2" ]
1201 }
mtklein38925aa2016-09-21 10:11:25 -07001202 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001203 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001204
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001205 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001206 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001207 sources = [
1208 "tools/skpbench/skpbench.cpp",
1209 ]
1210 deps = [
1211 ":flags",
1212 ":gpu_tool_utils",
1213 ":skia",
1214 ":tool_utils",
1215 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001216 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001217 }
1218
Mike Klein7d302882016-11-03 14:06:31 -04001219 # We can't yet build ICU on iOS or Windows.
1220 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001221 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001222 sources = [
1223 "tools/SkShaper_harfbuzz.cpp",
1224 "tools/using_skia_and_harfbuzz.cpp",
1225 ]
1226 deps = [
1227 ":skia",
1228 "//third_party/harfbuzz",
1229 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001230 }
halcanary19a97202016-08-03 15:08:04 -07001231 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001232 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001233 sources = [
1234 "tools/SkShaper_primitive.cpp",
1235 "tools/using_skia_and_harfbuzz.cpp",
1236 ]
1237 deps = [
1238 ":skia",
1239 ]
halcanary3eee9d92016-09-10 07:01:53 -07001240 }
mtklein046cb562016-09-16 10:23:12 -07001241
Mike Kleine6682eb2017-01-05 10:54:57 -05001242 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001243 sources = [
1244 "tools/get_images_from_skps.cpp",
1245 ]
1246 deps = [
1247 ":flags",
1248 ":skia",
1249 "//third_party/jsoncpp",
1250 ]
mtklein046cb562016-09-16 10:23:12 -07001251 }
mtkleinecbc5262016-09-22 11:51:24 -07001252
Mike Kleine6682eb2017-01-05 10:54:57 -05001253 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001254 sources = [
1255 "tools/colorspaceinfo.cpp",
1256 ]
1257 deps = [
1258 ":flags",
1259 ":skia",
1260 ":tool_utils",
1261 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001262 }
1263
Mike Klein7d302882016-11-03 14:06:31 -04001264 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001265 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001266 sources = [
1267 "tools/skiaserve/Request.cpp",
1268 "tools/skiaserve/Response.cpp",
1269 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001270 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1271 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1272 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1273 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1274 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1275 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1276 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1277 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1278 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001279 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1280 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001281 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1282 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1283 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1284 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1285 ]
1286 deps = [
1287 ":flags",
1288 ":gpu_tool_utils",
1289 ":skia",
1290 ":tool_utils",
1291 "//third_party/jsoncpp",
1292 "//third_party/libmicrohttpd",
1293 "//third_party/libpng",
1294 ]
Mike Klein7d302882016-11-03 14:06:31 -04001295 }
mtkleinecbc5262016-09-22 11:51:24 -07001296 }
kjlubick14f984b2016-10-03 11:49:45 -07001297
Mike Kleine6682eb2017-01-05 10:54:57 -05001298 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001299 sources = [
1300 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001301 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001302 "fuzz/FuzzGradients.cpp",
1303 "fuzz/FuzzParsePath.cpp",
1304 "fuzz/FuzzPathop.cpp",
1305 "fuzz/FuzzScaleToSides.cpp",
1306 "fuzz/fuzz.cpp",
1307 ]
1308 deps = [
1309 ":flags",
1310 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001311 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001312 ]
kjlubick14f984b2016-10-03 11:49:45 -07001313 }
Mike Klein38312422016-10-05 15:41:01 -04001314
Mike Kleine6682eb2017-01-05 10:54:57 -05001315 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001316 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001317 rebase_path("tests/skia_test.cpp"),
1318 rebase_path("tests/Test.cpp"),
1319 ]
caryclark9feb6322016-10-25 08:58:26 -07001320 deps = [
1321 ":flags",
1322 ":gpu_tool_utils",
1323 ":skia",
1324 ":tool_utils",
1325 ]
caryclark9feb6322016-10-25 08:58:26 -07001326 }
1327
Mike Kleine6682eb2017-01-05 10:54:57 -05001328 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001329 sources = [
1330 "tools/DumpRecord.cpp",
1331 "tools/dump_record.cpp",
1332 ]
1333 deps = [
1334 ":flags",
1335 ":skia",
1336 ]
Mike Klein38312422016-10-05 15:41:01 -04001337 }
bungemanfe917272016-10-13 17:36:40 -04001338
Mike Kleine6682eb2017-01-05 10:54:57 -05001339 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001340 sources = [
1341 "tools/skdiff/skdiff.cpp",
1342 "tools/skdiff/skdiff_html.cpp",
1343 "tools/skdiff/skdiff_main.cpp",
1344 "tools/skdiff/skdiff_utils.cpp",
1345 ]
1346 deps = [
1347 ":skia",
1348 ":tool_utils",
1349 ]
bungemanfe917272016-10-13 17:36:40 -04001350 }
halcanarya73d76a2016-10-17 13:19:02 -07001351
Mike Kleine6682eb2017-01-05 10:54:57 -05001352 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001353 sources = [
1354 "tools/skp_parser.cpp",
1355 ]
1356 deps = [
1357 ":skia",
1358 ":tool_utils",
1359 "//third_party/jsoncpp",
1360 ]
halcanarya73d76a2016-10-17 13:19:02 -07001361 }
Brian Osman16adfa32016-10-18 14:42:44 -04001362
Mike Kleina92c3832016-12-08 09:49:39 -05001363 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001364 test_app("viewer") {
1365 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001366 sources = [
1367 "tools/viewer/GMSlide.cpp",
1368 "tools/viewer/ImageSlide.cpp",
1369 "tools/viewer/SKPSlide.cpp",
1370 "tools/viewer/SampleSlide.cpp",
1371 "tools/viewer/Viewer.cpp",
1372 "tools/viewer/sk_app/CommandSet.cpp",
1373 "tools/viewer/sk_app/GLWindowContext.cpp",
1374 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001375 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001376 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001377
Jim Van Verth4e56a912016-10-21 10:58:52 -04001378 if (is_android) {
1379 sources += [
1380 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1381 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1382 "tools/viewer/sk_app/android/Window_android.cpp",
1383 "tools/viewer/sk_app/android/main_android.cpp",
1384 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1385 ]
Brian Osman462334e2017-02-09 11:22:57 -05001386 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001387 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001388 sources += [
1389 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1390 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1391 "tools/viewer/sk_app/unix/Window_unix.cpp",
1392 "tools/viewer/sk_app/unix/main_unix.cpp",
1393 ]
1394 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001395 sources += [
1396 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1397 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1398 "tools/viewer/sk_app/win/Window_win.cpp",
1399 "tools/viewer/sk_app/win/main_win.cpp",
1400 ]
Mike Klein43c25262016-10-20 10:17:47 -04001401 } else if (is_mac) {
1402 sources += [
1403 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1404 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1405 "tools/viewer/sk_app/mac/Window_mac.cpp",
1406 "tools/viewer/sk_app/mac/main_mac.cpp",
1407 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001408 }
1409
1410 if (skia_use_vulkan) {
1411 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001412 if (is_android) {
1413 sources +=
1414 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001415 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001416 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1417 libs += [ "X11-xcb" ]
1418 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001419 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1420 }
1421 }
1422
1423 include_dirs = []
1424 deps = [
1425 ":flags",
1426 ":gm",
1427 ":gpu_tool_utils",
1428 ":samples",
1429 ":skia",
1430 ":tool_utils",
1431 ":views",
1432 "//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}