blob: d0f415d056936cfa6d195b432f13e346bc0911a9 [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
mtklein06c35c02016-09-20 12:28:12 -070031 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050032 skia_enable_pdf = true
Mike Klein4ef8cb32017-01-12 11:36:46 -050033 skia_enable_splicer = is_skia_standalone && sanitize != "MSAN" && !is_ios
mtklein3e8012e2016-09-21 09:14:19 -070034 skia_enable_tools = is_skia_standalone
35 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040036 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070037}
Brian Salomon23d73ea2016-10-27 13:31:37 -040038declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080039 skia_use_dng_sdk =
40 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040041 skia_use_sfntly = skia_use_icu
42
Mike Klein4d598a32016-10-31 13:44:49 -040043 if (is_android) {
44 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
45 } else {
46 skia_use_vulkan = skia_vulkan_sdk != ""
47 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040048}
Brian Salomon789e25e2016-09-30 13:41:03 -040049
mtklein38925aa2016-09-21 10:11:25 -070050# Our tools require static linking (they use non-exported symbols).
51skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070052
mtkleina45be612016-08-29 15:22:10 -070053fontmgr_android_enabled = skia_use_expat && skia_use_freetype
54
mtklein1211e0c2016-07-26 13:55:45 -070055skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070056 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070057 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070058 "include/codec",
59 "include/config",
60 "include/core",
61 "include/effects",
62 "include/gpu",
63 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070064 "include/pathops",
65 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070066 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070067 "include/utils",
68 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070069 "include/xml",
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",
mtkleinc04ff472016-06-23 10:29:30 -0700114 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700115 "third_party/gif",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000116 "third_party/ktx",
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
mtkleina45be612016-08-29 15:22:10 -0700325optional("fontmgr_android") {
326 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700327
328 deps = [
329 "//third_party/expat",
330 "//third_party/freetype2",
331 ]
332 sources = [
333 "src/ports/SkFontMgr_android.cpp",
334 "src/ports/SkFontMgr_android_factory.cpp",
335 "src/ports/SkFontMgr_android_parser.cpp",
336 ]
337}
338
mtkleind2e39db2016-09-07 07:52:55 -0700339optional("fontmgr_custom") {
340 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
341
342 deps = [
343 "//third_party/freetype2",
344 ]
345 sources = [
346 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500347 "src/ports/SkFontMgr_custom.h",
348 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700349 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500350 "src/ports/SkFontMgr_custom_embedded.cpp",
351 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700352 ]
353}
354
mtklein3cc22182016-08-29 13:26:14 -0700355optional("fontmgr_fontconfig") {
356 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700357
358 deps = [
359 "//third_party:fontconfig",
360 "//third_party/freetype2",
361 ]
362 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700363 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700364 "src/ports/SkFontConfigInterface_direct.cpp",
365 "src/ports/SkFontConfigInterface_direct_factory.cpp",
366 "src/ports/SkFontMgr_FontConfigInterface.cpp",
367 "src/ports/SkFontMgr_fontconfig.cpp",
368 "src/ports/SkFontMgr_fontconfig_factory.cpp",
369 ]
370}
371
mtkleincdedd0e2016-09-12 15:15:44 -0700372optional("fontmgr_fuchsia") {
373 enabled = is_fuchsia && skia_use_freetype
374
375 deps = [
376 "//third_party/freetype2",
377 ]
378 sources = [
379 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500380 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700381 "src/ports/SkFontMgr_custom_empty_factory.cpp",
382 ]
383}
384
mtklein06c35c02016-09-20 12:28:12 -0700385optional("gpu") {
386 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700387 public_defines = []
388
mtklein06c35c02016-09-20 12:28:12 -0700389 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
390
391 # These paths need to be absolute to match the ones produced by shared_sources.gni.
392 sources -= get_path_info([
393 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
394 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
395 ],
396 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400397 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700398 if (is_android) {
399 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
400 } else if (is_linux) {
401 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
402 } else if (is_mac) {
403 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800404 } else if (is_ios) {
405 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400406 } else if (is_win) {
407 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
408 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700409 } else {
410 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
411 }
mtkleine9fb3d52016-09-20 15:11:46 -0700412
413 if (skia_use_vulkan) {
414 public_defines += [ "SK_VULKAN" ]
415 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700416 if (skia_enable_vulkan_debug_layers) {
417 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
418 }
mtkleine9fb3d52016-09-20 15:11:46 -0700419 }
mtklein06c35c02016-09-20 12:28:12 -0700420}
421
mtklein63213812016-08-24 09:55:56 -0700422optional("jpeg") {
423 enabled = skia_use_libjpeg_turbo
424 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
425
mtklein63213812016-08-24 09:55:56 -0700426 deps = [
427 "//third_party/libjpeg-turbo:libjpeg",
428 ]
429 sources = [
430 "src/codec/SkJpegCodec.cpp",
431 "src/codec/SkJpegDecoderMgr.cpp",
432 "src/codec/SkJpegUtility.cpp",
433 "src/images/SkJPEGImageEncoder.cpp",
434 "src/images/SkJPEGWriteUtility.cpp",
435 ]
436}
437
438optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500439 enabled = skia_use_zlib && skia_enable_pdf
440 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700441
mtklein63213812016-08-24 09:55:56 -0700442 deps = [
443 "//third_party/zlib",
444 ]
brettwb9447282016-09-01 14:24:39 -0700445 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700446 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700447
448 if (skia_use_sfntly) {
449 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500450 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700451 }
452}
453
454optional("png") {
455 enabled = skia_use_libpng
456 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
457
mtklein63213812016-08-24 09:55:56 -0700458 deps = [
459 "//third_party/libpng",
460 ]
461 sources = [
462 "src/codec/SkIcoCodec.cpp",
463 "src/codec/SkPngCodec.cpp",
464 "src/images/SkPNGImageEncoder.cpp",
465 ]
466}
467
scroggof84ad642016-10-31 09:02:57 -0700468optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400469 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700470 public_defines = [ "SK_CODEC_DECODES_RAW" ]
471
472 deps = [
473 "//third_party/dng_sdk",
474 "//third_party/libjpeg-turbo:libjpeg",
475 "//third_party/piex",
476 ]
477
478 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
479 # Skia.
480 configs_to_remove = [ "//gn:no_exceptions" ]
481
482 sources = [
483 "src/codec/SkRawAdapterCodec.cpp",
484 "src/codec/SkRawCodec.cpp",
485 ]
486}
487
Mike Kleina7080262017-01-09 10:20:13 -0500488optional("splicer") {
489 enabled = skia_enable_splicer
490 public_defines = [ "SK_RASTER_PIPELINE_HAS_JIT" ]
491
492 sources = [
493 "src/splicer/SkSplicer.cpp",
494 ]
495}
496
mtklein3cc22182016-08-29 13:26:14 -0700497optional("typeface_freetype") {
498 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700499
500 deps = [
501 "//third_party/freetype2",
502 ]
503 sources = [
504 "src/ports/SkFontHost_FreeType.cpp",
505 "src/ports/SkFontHost_FreeType_common.cpp",
506 ]
507}
508
mtklein457b42a2016-08-23 13:56:37 -0700509optional("webp") {
510 enabled = skia_use_libwebp
511 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
512
mtklein457b42a2016-08-23 13:56:37 -0700513 deps = [
514 "//third_party/libwebp",
515 ]
516 sources = [
517 "src/codec/SkWebpAdapterCodec.cpp",
518 "src/codec/SkWebpCodec.cpp",
519 "src/images/SkWEBPImageEncoder.cpp",
520 ]
mtkleineb3c4252016-08-23 07:38:09 -0700521}
522
mtklein63213812016-08-24 09:55:56 -0700523optional("xml") {
524 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000525 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700526
mtklein63213812016-08-24 09:55:56 -0700527 deps = [
528 "//third_party/expat",
529 ]
530 sources = [
531 "src/xml/SkDOM.cpp",
532 "src/xml/SkXMLParser.cpp",
533 "src/xml/SkXMLWriter.cpp",
534 ]
535}
536
mtkleinc04ff472016-06-23 10:29:30 -0700537component("skia") {
538 public_configs = [ ":skia_public" ]
539 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700540
541 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700542 ":arm64",
543 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700544 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700545 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700546 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700547 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700548 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700549 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700550 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400551 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700552 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700553 ":none",
mtklein63213812016-08-24 09:55:56 -0700554 ":pdf",
555 ":png",
scroggof84ad642016-10-31 09:02:57 -0700556 ":raw",
Mike Kleina7080262017-01-09 10:20:13 -0500557 ":splicer",
mtklein9b8583d2016-08-24 17:32:30 -0700558 ":sse2",
559 ":sse41",
560 ":sse42",
561 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700562 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700563 ":webp",
mtklein63213812016-08-24 09:55:56 -0700564 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700565 ]
566
Chinmay Garde43f115c2016-11-16 15:04:12 -0800567 # This file (and all GN files in Skia) are designed to work with an
568 # empty sources assignment filter; we handle all that explicitly.
569 # We clear the filter here for clients who may have set up a global filter.
570 set_sources_assignment_filter([])
571
mtkleinc04ff472016-06-23 10:29:30 -0700572 sources = []
brettwb9447282016-09-01 14:24:39 -0700573 sources += skia_core_sources
574 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700575 sources += skia_sksl_sources
576 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500577 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700578 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700579 "src/android/SkBitmapRegionCodec.cpp",
580 "src/android/SkBitmapRegionDecoder.cpp",
581 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700582 "src/codec/SkBmpCodec.cpp",
583 "src/codec/SkBmpMaskCodec.cpp",
584 "src/codec/SkBmpRLECodec.cpp",
585 "src/codec/SkBmpStandardCodec.cpp",
586 "src/codec/SkCodec.cpp",
587 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700588 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700589 "src/codec/SkMaskSwizzler.cpp",
590 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700591 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700592 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700593 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700594 "src/codec/SkSwizzler.cpp",
595 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700596 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700597 "src/ports/SkDiscardableMemory_none.cpp",
598 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700599 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700600 "src/ports/SkMemory_malloc.cpp",
601 "src/ports/SkOSFile_stdio.cpp",
602 "src/sfnt/SkOTTable_name.cpp",
603 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700604 "src/svg/SkSVGCanvas.cpp",
605 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700606 "src/utils/mac/SkStream_mac.cpp",
607 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700608 "third_party/gif/SkGifImageReader.cpp",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000609 "third_party/ktx/ktx.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700610 ]
brettwb9447282016-09-01 14:24:39 -0700611
mtklein7d6fb2c2016-08-25 14:50:44 -0700612 libs = []
613
mtkleinc04ff472016-06-23 10:29:30 -0700614 if (is_win) {
615 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400616 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700617 "src/ports/SkDebug_win.cpp",
618 "src/ports/SkFontHost_win.cpp",
619 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700620 "src/ports/SkImageEncoder_WIC.cpp",
621 "src/ports/SkImageGeneratorWIC.cpp",
622 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700623 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700624 "src/ports/SkScalerContext_win_dw.cpp",
625 "src/ports/SkTLS_win.cpp",
626 "src/ports/SkTypeface_win_dw.cpp",
627 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400628 if (skia_use_gdi) {
629 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
630 libs += [
631 "Gdi32.lib",
632 "Usp10.lib",
633 ]
634 } else {
635 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
636 }
mtkleinb9be9792016-09-16 14:44:18 -0700637 sources -=
638 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400639 libs += [
640 "FontSub.lib",
641 "Ole32.lib",
642 "OleAut32.lib",
643 "User32.lib",
644 ]
mtkleinc04ff472016-06-23 10:29:30 -0700645 } else {
646 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700647 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700648 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700649 "src/ports/SkTLS_pthread.cpp",
650 ]
651 }
652
mtklein7d6fb2c2016-08-25 14:50:44 -0700653 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500654 deps += [ "//third_party/expat" ]
655 if (is_skia_standalone && ndk != "") {
656 deps += [ "//third_party/cpu-features" ]
657 }
mtklein06c35c02016-09-20 12:28:12 -0700658 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700659 libs += [
660 "EGL",
661 "GLESv2",
662 "log",
663 ]
664 }
665
mtkleinc04ff472016-06-23 10:29:30 -0700666 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700667 libs += [
668 "GL",
669 "GLU",
670 "X11",
671 ]
mtklein06c35c02016-09-20 12:28:12 -0700672 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700673 }
674
675 if (is_mac) {
676 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700677 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700678 "src/ports/SkFontHost_mac.cpp",
679 "src/ports/SkImageEncoder_CG.cpp",
680 "src/ports/SkImageGeneratorCG.cpp",
681 ]
mtklein09e61f72016-08-23 13:35:28 -0700682 libs += [
683 "ApplicationServices.framework",
684 "OpenGL.framework",
685 ]
mtkleinc04ff472016-06-23 10:29:30 -0700686 }
abarth6fc8ff02016-07-15 15:15:15 -0700687
Mike Klein7d302882016-11-03 14:06:31 -0400688 if (is_ios) {
689 sources += [
690 "src/ports/SkDebug_stdio.cpp",
691 "src/ports/SkFontHost_mac.cpp",
692 "src/ports/SkImageEncoder_CG.cpp",
693 "src/ports/SkImageGeneratorCG.cpp",
694 ]
695 libs += [
696 "CoreFoundation.framework",
697 "CoreGraphics.framework",
698 "CoreText.framework",
699 "ImageIO.framework",
700 "MobileCoreServices.framework",
701 ]
702 }
703
abarth6fc8ff02016-07-15 15:15:15 -0700704 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700705 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700706 }
mtkleinc04ff472016-06-23 10:29:30 -0700707}
708
mtkleinc095df52016-08-24 12:23:52 -0700709# Targets guarded by skia_enable_tools may use //third_party freely.
710if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500711 # Used by gn_to_bp.py to list our public include dirs.
712 source_set("public") {
713 configs += [ ":skia_public" ]
714 }
715
Mike Kleinc36dedf2016-11-18 09:35:28 -0500716 config("skia.h_config") {
717 include_dirs = [ "$target_gen_dir" ]
718 }
719 action("skia.h") {
720 public_configs = [ ":skia.h_config" ]
721 skia_h = "$target_gen_dir/skia.h"
722 script = "gn/find_headers.py"
723 args = [ rebase_path(skia_h, root_build_dir) ] +
724 rebase_path(skia_public_includes)
725 depfile = "$skia_h.deps"
726 outputs = [
727 skia_h,
728 ]
729 }
730
731 if (skia_enable_gpu && target_cpu == "x64") {
732 # Our bots only have 64-bit libOSMesa installed.
733 # TODO: worth fixing?
734 executable("fiddle") {
735 libs = []
736 if (is_linux) {
737 libs += [ "OSMesa" ]
738 }
739
740 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500741 "tools/fiddle/draw.cpp",
742 "tools/fiddle/fiddle_main.cpp",
743 ]
744 deps = [
745 ":skia",
746 ":skia.h",
747 ]
748 }
749 }
750
751 if (skia_enable_gpu) {
752 source_set("public_headers_warnings_check") {
753 sources = [
754 "tools/public_headers_warnings_check.cpp",
755 ]
756 configs -= [ "//gn:warnings_except_public_headers" ]
757 deps = [
758 ":skia",
759 ":skia.h",
760 ]
761 }
762 }
763
mtkleinc095df52016-08-24 12:23:52 -0700764 template("test_lib") {
765 config(target_name + "_config") {
766 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700767 if (defined(invoker.public_defines)) {
768 defines = invoker.public_defines
769 }
mtklein25c81d42016-07-27 13:55:26 -0700770 }
mtkleinc095df52016-08-24 12:23:52 -0700771 source_set(target_name) {
772 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
773 public_configs = [
774 ":" + target_name + "_config",
775 ":skia_private",
776 ]
777
778 if (!defined(deps)) {
779 deps = []
780 }
781 deps += [ ":skia" ]
782 testonly = true
783 }
mtklein25c81d42016-07-27 13:55:26 -0700784 }
mtklein25c81d42016-07-27 13:55:26 -0700785
Mike Kleine6682eb2017-01-05 10:54:57 -0500786 template("test_app") {
787 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
788 shared_library("lib" + target_name) {
789 forward_variables_from(invoker, "*", [ "is_shared_library" ])
790 testonly = true
791 }
792 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500793 _executable = target_name
794 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500795 forward_variables_from(invoker, "*", [ "is_shared_library" ])
796 testonly = true
797 }
798 }
Mike Klein7d921032017-01-05 12:20:41 -0500799 if (is_android && skia_android_serial != "" && defined(_executable)) {
800 action("push_" + target_name) {
801 script = "gn/push_to_android.py"
802 deps = [
803 ":" + _executable,
804 ]
805 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
806 outputs = [
807 _stamp,
808 ]
809 args = [
810 rebase_path("$root_build_dir/$_executable"),
811 skia_android_serial,
812 rebase_path(_stamp),
813 ]
814 testonly = true
815 }
816 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500817 }
818
mtkleinc095df52016-08-24 12:23:52 -0700819 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700820 public_include_dirs = []
821 if (skia_enable_gpu) {
822 public_defines = []
823 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700824
825 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700826 sources = [
827 "tools/gpu/GrContextFactory.cpp",
828 "tools/gpu/GrTest.cpp",
829 "tools/gpu/TestContext.cpp",
830 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700831 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700832 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
833 "tools/gpu/gl/debug/GrBufferObj.cpp",
834 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
835 "tools/gpu/gl/debug/GrProgramObj.cpp",
836 "tools/gpu/gl/debug/GrShaderObj.cpp",
837 "tools/gpu/gl/debug/GrTextureObj.cpp",
838 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
839 "tools/gpu/gl/null/NullGLTestContext.cpp",
840 ]
841 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700842
mtklein38925aa2016-09-21 10:11:25 -0700843 if (is_android) {
844 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400845 } else if (is_ios) {
846 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
847 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700848 } else if (is_linux) {
849 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
850 } else if (is_mac) {
851 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400852 } else if (is_win) {
853 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
854 libs += [
855 "Gdi32.lib",
856 "OpenGL32.lib",
857 ]
mtklein38925aa2016-09-21 10:11:25 -0700858 }
mtklein6ef69992016-09-14 06:12:09 -0700859
Mike Kleinc168a3a2016-11-14 14:53:13 +0000860 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000861 deps += [ "//third_party/angle2" ]
862 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
863 }
mtklein38925aa2016-09-21 10:11:25 -0700864 if (skia_use_mesa) {
865 public_defines += [ "SK_MESA" ]
866 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
867 libs += [ "OSMesa" ]
868 }
mtkleind68f9b02016-09-23 13:18:41 -0700869 if (skia_use_vulkan) {
870 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
871 }
mtkleina627b5c2016-09-20 13:36:47 -0700872 }
mtklein25c81d42016-07-27 13:55:26 -0700873 }
mtklein25c81d42016-07-27 13:55:26 -0700874
mtkleinc095df52016-08-24 12:23:52 -0700875 test_lib("flags") {
876 public_include_dirs = [ "tools/flags" ]
877 sources = [
878 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700879 ]
880 }
881 test_lib("common_flags") {
882 public_include_dirs = [ "tools/flags" ]
883 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700884 "tools/flags/SkCommonFlags.cpp",
885 "tools/flags/SkCommonFlagsConfig.cpp",
886 ]
887 deps = [
mtklein046cb562016-09-16 10:23:12 -0700888 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700889 ":gpu_tool_utils",
890 ]
891 }
mtklein25c81d42016-07-27 13:55:26 -0700892
mtkleinc095df52016-08-24 12:23:52 -0700893 test_lib("tool_utils") {
894 public_include_dirs = [
895 "tools",
896 "tools/debugger",
897 "tools/timer",
898 ]
899 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700900 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700901 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700902 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700903 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700904 "tools/ProcStats.cpp",
905 "tools/Resources.cpp",
906 "tools/ThermalManager.cpp",
907 "tools/UrlDataManager.cpp",
908 "tools/debugger/SkDebugCanvas.cpp",
909 "tools/debugger/SkDrawCommand.cpp",
910 "tools/debugger/SkJsonWriteBuffer.cpp",
911 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700912 "tools/picture_utils.cpp",
913 "tools/random_parse_path.cpp",
914 "tools/sk_tool_utils.cpp",
915 "tools/sk_tool_utils_font.cpp",
916 "tools/timer/Timer.cpp",
917 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500918 libs = []
919 if (is_ios) {
920 sources += [ "tools/ios_utils.m" ]
921 libs += [ "Foundation.framework" ]
922 }
mtkleinc095df52016-08-24 12:23:52 -0700923 deps = [
mtklein046cb562016-09-16 10:23:12 -0700924 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700925 ":flags",
926 "//third_party/libpng",
927 ]
928 public_deps = [
929 "//third_party/jsoncpp",
930 ]
931 }
mtklein25c81d42016-07-27 13:55:26 -0700932
Mike Klein6e744122016-10-27 12:21:40 -0400933 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700934 test_lib("gm") {
935 public_include_dirs = [ "gm" ]
936 sources = gm_sources
937 deps = [
scroggo19b91532016-10-24 09:03:26 -0700938 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700939 ":gpu_tool_utils",
940 ":skia",
941 ":tool_utils",
942 ]
943 }
mtklein25c81d42016-07-27 13:55:26 -0700944
Mike Klein6e744122016-10-27 12:21:40 -0400945 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700946 test_lib("tests") {
947 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400948 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700949 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400950 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700951 }
mtkleinc095df52016-08-24 12:23:52 -0700952 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700953 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700954 ":flags",
955 ":gpu_tool_utils",
956 ":skia",
957 ":tool_utils",
958 "//third_party/libpng",
959 "//third_party/zlib",
960 ]
961 }
mtklein2f3416d2016-08-02 16:02:05 -0700962
Mike Klein6e744122016-10-27 12:21:40 -0400963 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700964 test_lib("bench") {
965 public_include_dirs = [ "bench" ]
966 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700967 deps = [
968 ":flags",
969 ":gm",
970 ":gpu_tool_utils",
971 ":skia",
972 ":tool_utils",
973 ]
974 }
mtklein2b6870c2016-07-28 14:17:33 -0700975
mtkleinc095df52016-08-24 12:23:52 -0700976 test_lib("experimental_svg_model") {
977 public_include_dirs = [ "experimental/svg/model" ]
978 sources = [
979 "experimental/svg/model/SkSVGAttribute.cpp",
980 "experimental/svg/model/SkSVGAttributeParser.cpp",
981 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -0500982 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700983 "experimental/svg/model/SkSVGContainer.cpp",
984 "experimental/svg/model/SkSVGDOM.cpp",
985 "experimental/svg/model/SkSVGEllipse.cpp",
986 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700987 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700988 "experimental/svg/model/SkSVGNode.cpp",
989 "experimental/svg/model/SkSVGPath.cpp",
990 "experimental/svg/model/SkSVGPoly.cpp",
991 "experimental/svg/model/SkSVGRect.cpp",
992 "experimental/svg/model/SkSVGRenderContext.cpp",
993 "experimental/svg/model/SkSVGSVG.cpp",
994 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700995 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700996 "experimental/svg/model/SkSVGTransformableNode.cpp",
997 "experimental/svg/model/SkSVGValue.cpp",
998 ]
999 deps = [
1000 ":skia",
1001 ]
1002 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001003
Brian Osman16adfa32016-10-18 14:42:44 -04001004 test_lib("views") {
1005 public_include_dirs = [ "include/views" ]
1006 sources = [
1007 "src/views/SkEvent.cpp",
1008 "src/views/SkEventSink.cpp",
1009 "src/views/SkOSMenu.cpp",
1010 "src/views/SkTagList.cpp",
1011 "src/views/SkTouchGesture.cpp",
1012 "src/views/SkView.cpp",
1013 "src/views/SkViewPriv.cpp",
1014 ]
1015 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001016 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001017 if (!is_android) {
1018 sources += [ "src/views/SkWindow.cpp" ]
1019 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001020 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001021 public_include_dirs += [ "src/views/unix" ]
1022 sources += [
1023 "src/views/unix/SkOSWindow_Unix.cpp",
1024 "src/views/unix/keysym2ucs.c",
1025 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001026 } else if (is_mac) {
1027 sources += [
1028 "src/views/mac/SkEventNotifier.mm",
1029 "src/views/mac/SkNSView.mm",
1030 "src/views/mac/SkOSWindow_Mac.mm",
1031 "src/views/mac/SkTextFieldCell.m",
1032 ]
1033 libs += [
1034 "QuartzCore.framework",
1035 "Cocoa.framework",
1036 "Foundation.framework",
1037 ]
1038 } else if (is_win) {
1039 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1040 }
Brian Osman34755e22016-12-05 09:46:02 -05001041 if (skia_use_angle) {
1042 deps += [ "//third_party/angle2" ]
1043 }
Brian Osman16adfa32016-10-18 14:42:44 -04001044 }
1045
Mike Klein38af9432016-11-11 11:39:44 -05001046 if (skia_use_lua) {
1047 test_lib("lua") {
1048 public_include_dirs = []
1049 sources = [
1050 "src/utils/SkLua.cpp",
1051 "src/utils/SkLuaCanvas.cpp",
1052 ]
1053 deps = [
1054 "//third_party/lua",
1055 ]
1056 }
1057
Mike Kleine6682eb2017-01-05 10:54:57 -05001058 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001059 sources = [
1060 "tools/lua/lua_app.cpp",
1061 ]
1062 deps = [
1063 ":lua",
1064 ":skia",
1065 "//third_party/lua",
1066 ]
Mike Klein38af9432016-11-11 11:39:44 -05001067 }
1068
Mike Kleine6682eb2017-01-05 10:54:57 -05001069 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001070 sources = [
1071 "tools/lua/lua_pictures.cpp",
1072 ]
1073 deps = [
1074 ":flags",
1075 ":lua",
1076 ":skia",
1077 ":tool_utils",
1078 "//third_party/lua",
1079 ]
Mike Klein38af9432016-11-11 11:39:44 -05001080 }
1081 }
1082
Mike Klein6e744122016-10-27 12:21:40 -04001083 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001084 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001085 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001086 include_dirs = [ "experimental" ]
1087 sources = samples_sources + [
1088 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1089 "experimental/SkSetPoly3To3.cpp",
1090 "experimental/SkSetPoly3To3_A.cpp",
1091 "experimental/SkSetPoly3To3_D.cpp",
1092 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001093 deps = [
1094 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001095 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001096 ":tool_utils",
1097 ":views",
1098 ":xml",
1099 ]
Mike Klein38af9432016-11-11 11:39:44 -05001100
1101 if (skia_use_lua) {
1102 sources += [ "samplecode/SampleLua.cpp" ]
1103 deps += [
1104 ":lua",
1105 "//third_party/lua",
1106 ]
1107 }
Brian Osman16adfa32016-10-18 14:42:44 -04001108 }
1109
Mike Kleine6682eb2017-01-05 10:54:57 -05001110 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001111 sources = [
1112 "dm/DM.cpp",
1113 "dm/DMJsonWriter.cpp",
1114 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001115 ]
1116 include_dirs = [ "tests" ]
1117 deps = [
mtklein046cb562016-09-16 10:23:12 -07001118 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001119 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001120 ":flags",
1121 ":gm",
1122 ":gpu_tool_utils",
1123 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001124 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001125 ":tool_utils",
1126 "//third_party/jsoncpp",
1127 "//third_party/libpng",
1128 ]
mtklein2b6870c2016-07-28 14:17:33 -07001129 }
1130
Mike Kleina3430172016-09-27 16:46:29 -04001131 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001132 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001133 sources = [
1134 "tools/monobench.cpp",
1135 ]
1136 deps = [
1137 ":bench",
1138 ":skia",
1139 ]
Mike Kleina3430172016-09-27 16:46:29 -04001140 }
mtklein2b6870c2016-07-28 14:17:33 -07001141 }
1142
Mike Kleine6682eb2017-01-05 10:54:57 -05001143 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001144 sources = [
1145 "bench/nanobench.cpp",
1146 ]
1147 deps = [
1148 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001149 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001150 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001151 ":flags",
1152 ":gm",
1153 ":gpu_tool_utils",
1154 ":skia",
1155 ":tool_utils",
1156 "//third_party/jsoncpp",
1157 ]
mtklein2b6870c2016-07-28 14:17:33 -07001158 }
halcanary19a97202016-08-03 15:08:04 -07001159
Ravi Mistry10d36c52017-01-31 09:49:18 -05001160 test_app("skpinfo") {
1161 sources = [
1162 "tools/skpinfo.cpp",
1163 ]
1164 deps = [
1165 ":flags",
1166 ":skia",
1167 ]
1168 }
1169
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001170 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001171 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001172 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001173 "samplecode/SampleApp.cpp",
1174 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001175 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001176 if (is_mac) {
1177 sources += [ "src/views/mac/skia_mac.mm" ]
1178 } else if (is_win) {
1179 sources += [ "src/views/win/skia_win.cpp" ]
1180 } else if (is_linux) {
1181 sources += [ "src/views/unix/skia_unix.cpp" ]
1182 }
mtklein38925aa2016-09-21 10:11:25 -07001183 deps = [
1184 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001185 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001186 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001187 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001188 ":skia",
1189 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001190 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001191 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001192 if (skia_use_angle) {
1193 deps += [ "//third_party/angle2" ]
1194 }
mtklein38925aa2016-09-21 10:11:25 -07001195 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001196 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001197
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001198 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001199 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001200 sources = [
1201 "tools/skpbench/skpbench.cpp",
1202 ]
1203 deps = [
1204 ":flags",
1205 ":gpu_tool_utils",
1206 ":skia",
1207 ":tool_utils",
1208 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001209 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001210 }
1211
Mike Klein7d302882016-11-03 14:06:31 -04001212 # We can't yet build ICU on iOS or Windows.
1213 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001214 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001215 sources = [
1216 "tools/SkShaper_harfbuzz.cpp",
1217 "tools/using_skia_and_harfbuzz.cpp",
1218 ]
1219 deps = [
1220 ":skia",
1221 "//third_party/harfbuzz",
1222 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001223 }
halcanary19a97202016-08-03 15:08:04 -07001224 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001225 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001226 sources = [
1227 "tools/SkShaper_primitive.cpp",
1228 "tools/using_skia_and_harfbuzz.cpp",
1229 ]
1230 deps = [
1231 ":skia",
1232 ]
halcanary3eee9d92016-09-10 07:01:53 -07001233 }
mtklein046cb562016-09-16 10:23:12 -07001234
Mike Kleine6682eb2017-01-05 10:54:57 -05001235 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001236 sources = [
1237 "tools/get_images_from_skps.cpp",
1238 ]
1239 deps = [
1240 ":flags",
1241 ":skia",
1242 "//third_party/jsoncpp",
1243 ]
mtklein046cb562016-09-16 10:23:12 -07001244 }
mtkleinecbc5262016-09-22 11:51:24 -07001245
Mike Kleine6682eb2017-01-05 10:54:57 -05001246 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001247 sources = [
1248 "tools/colorspaceinfo.cpp",
1249 ]
1250 deps = [
1251 ":flags",
1252 ":skia",
1253 ":tool_utils",
1254 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001255 }
1256
Mike Klein7d302882016-11-03 14:06:31 -04001257 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001258 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001259 sources = [
1260 "tools/skiaserve/Request.cpp",
1261 "tools/skiaserve/Response.cpp",
1262 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001263 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1264 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1265 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1266 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1267 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1268 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1269 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1270 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1271 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001272 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1273 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001274 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1275 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1276 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1277 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1278 ]
1279 deps = [
1280 ":flags",
1281 ":gpu_tool_utils",
1282 ":skia",
1283 ":tool_utils",
1284 "//third_party/jsoncpp",
1285 "//third_party/libmicrohttpd",
1286 "//third_party/libpng",
1287 ]
Mike Klein7d302882016-11-03 14:06:31 -04001288 }
mtkleinecbc5262016-09-22 11:51:24 -07001289 }
kjlubick14f984b2016-10-03 11:49:45 -07001290
Mike Kleine6682eb2017-01-05 10:54:57 -05001291 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001292 sources = [
1293 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001294 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001295 "fuzz/FuzzGradients.cpp",
1296 "fuzz/FuzzParsePath.cpp",
1297 "fuzz/FuzzPathop.cpp",
1298 "fuzz/FuzzScaleToSides.cpp",
1299 "fuzz/fuzz.cpp",
1300 ]
1301 deps = [
1302 ":flags",
1303 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001304 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001305 ]
kjlubick14f984b2016-10-03 11:49:45 -07001306 }
Mike Klein38312422016-10-05 15:41:01 -04001307
Mike Kleine6682eb2017-01-05 10:54:57 -05001308 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001309 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001310 rebase_path("tests/skia_test.cpp"),
1311 rebase_path("tests/Test.cpp"),
1312 ]
caryclark9feb6322016-10-25 08:58:26 -07001313 deps = [
1314 ":flags",
1315 ":gpu_tool_utils",
1316 ":skia",
1317 ":tool_utils",
1318 ]
caryclark9feb6322016-10-25 08:58:26 -07001319 }
1320
Mike Kleine6682eb2017-01-05 10:54:57 -05001321 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001322 sources = [
1323 "tools/DumpRecord.cpp",
1324 "tools/dump_record.cpp",
1325 ]
1326 deps = [
1327 ":flags",
1328 ":skia",
1329 ]
Mike Klein38312422016-10-05 15:41:01 -04001330 }
bungemanfe917272016-10-13 17:36:40 -04001331
Mike Kleine6682eb2017-01-05 10:54:57 -05001332 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001333 sources = [
1334 "tools/skdiff/skdiff.cpp",
1335 "tools/skdiff/skdiff_html.cpp",
1336 "tools/skdiff/skdiff_main.cpp",
1337 "tools/skdiff/skdiff_utils.cpp",
1338 ]
1339 deps = [
1340 ":skia",
1341 ":tool_utils",
1342 ]
bungemanfe917272016-10-13 17:36:40 -04001343 }
halcanarya73d76a2016-10-17 13:19:02 -07001344
Mike Kleine6682eb2017-01-05 10:54:57 -05001345 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001346 sources = [
1347 "tools/skp_parser.cpp",
1348 ]
1349 deps = [
1350 ":skia",
1351 ":tool_utils",
1352 "//third_party/jsoncpp",
1353 ]
halcanarya73d76a2016-10-17 13:19:02 -07001354 }
Brian Osman16adfa32016-10-18 14:42:44 -04001355
Mike Kleina92c3832016-12-08 09:49:39 -05001356 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001357 test_app("viewer") {
1358 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001359 sources = [
1360 "tools/viewer/GMSlide.cpp",
1361 "tools/viewer/ImageSlide.cpp",
1362 "tools/viewer/SKPSlide.cpp",
1363 "tools/viewer/SampleSlide.cpp",
1364 "tools/viewer/Viewer.cpp",
1365 "tools/viewer/sk_app/CommandSet.cpp",
1366 "tools/viewer/sk_app/GLWindowContext.cpp",
1367 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001368 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001369 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001370
Jim Van Verth4e56a912016-10-21 10:58:52 -04001371 if (is_android) {
1372 sources += [
1373 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1374 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1375 "tools/viewer/sk_app/android/Window_android.cpp",
1376 "tools/viewer/sk_app/android/main_android.cpp",
1377 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1378 ]
1379 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001380 sources += [
1381 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1382 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1383 "tools/viewer/sk_app/unix/Window_unix.cpp",
1384 "tools/viewer/sk_app/unix/main_unix.cpp",
1385 ]
1386 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001387 sources += [
1388 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1389 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1390 "tools/viewer/sk_app/win/Window_win.cpp",
1391 "tools/viewer/sk_app/win/main_win.cpp",
1392 ]
Mike Klein43c25262016-10-20 10:17:47 -04001393 } else if (is_mac) {
1394 sources += [
1395 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1396 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1397 "tools/viewer/sk_app/mac/Window_mac.cpp",
1398 "tools/viewer/sk_app/mac/main_mac.cpp",
1399 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001400 }
1401
1402 if (skia_use_vulkan) {
1403 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001404 if (is_android) {
1405 sources +=
1406 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1407 libs += [ "android" ]
1408 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001409 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1410 libs += [ "X11-xcb" ]
1411 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001412 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1413 }
1414 }
1415
1416 include_dirs = []
1417 deps = [
1418 ":flags",
1419 ":gm",
1420 ":gpu_tool_utils",
1421 ":samples",
1422 ":skia",
1423 ":tool_utils",
1424 ":views",
1425 "//third_party/jsoncpp",
1426 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001427 if (is_android) {
1428 deps += [ "//third_party/native_app_glue" ]
1429 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001430 deps += [ "//third_party/libsdl" ]
1431 }
Mike Kleina92c3832016-12-08 09:49:39 -05001432 }
Brian Osman16adfa32016-10-18 14:42:44 -04001433 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001434
Mike Klein621ea112017-01-12 08:07:23 -05001435 if (is_android && is_skia_standalone && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001436 copy("gdbserver") {
1437 sources = [
1438 "$ndk/$ndk_gdbserver",
1439 ]
1440 outputs = [
1441 "$root_out_dir/gdbserver",
1442 ]
1443 }
1444 if (ndk_simpleperf != "") {
1445 copy("simpleperf") {
1446 sources = [
1447 "$ndk/$ndk_simpleperf",
1448 "$ndk/simpleperf/simpleperf_report.py",
1449 ]
1450 outputs = [
1451 "$root_out_dir/{{source_file_part}}",
1452 ]
1453 }
1454 }
1455 }
1456
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001457 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001458 test_app("skslc") {
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001459 sources = [
1460 "src/sksl/SkSLMain.cpp",
1461 ]
1462 deps = [
1463 ":flags",
1464 ":skia",
1465 ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001466 }
1467 }
mtklein25c81d42016-07-27 13:55:26 -07001468}