blob: 024ee73ccd3d3a7b2030e518f1c5d4391077ec8b [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Mike Kleincfc4f442016-10-26 17:19:03 -04006import("gn/android_framework_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
mtklein3e8012e2016-09-21 09:14:19 -07009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12
mtkleinc04ff472016-06-23 10:29:30 -070013declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000014 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070015 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070016 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070017 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040018 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040019 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070020 skia_use_libjpeg_turbo = true
21 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070022 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050023 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070024 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040025 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070026 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070027
Mike Klein7d921032017-01-05 12:20:41 -050028 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070029 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050030 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050031 skia_enable_effects = true
Mike Klein0c8f7a32017-02-16 14:02:50 +000032 skia_enable_jumper = false
mtklein06c35c02016-09-20 12:28:12 -070033 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050034 skia_enable_pdf = true
mtklein3e8012e2016-09-21 09:14:19 -070035 skia_enable_tools = is_skia_standalone
36 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040037 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070038}
Brian Salomon23d73ea2016-10-27 13:31:37 -040039declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080040 skia_use_dng_sdk =
41 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040042 skia_use_sfntly = skia_use_icu
43
Mike Klein4d598a32016-10-31 13:44:49 -040044 if (is_android) {
45 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
46 } else {
47 skia_use_vulkan = skia_vulkan_sdk != ""
48 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040049}
Brian Salomon789e25e2016-09-30 13:41:03 -040050
mtklein38925aa2016-09-21 10:11:25 -070051# Our tools require static linking (they use non-exported symbols).
52skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070053
mtkleina45be612016-08-29 15:22:10 -070054fontmgr_android_enabled = skia_use_expat && skia_use_freetype
55
mtklein1211e0c2016-07-26 13:55:45 -070056skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070057 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070058 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070059 "include/codec",
60 "include/config",
61 "include/core",
62 "include/effects",
63 "include/gpu",
64 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070065 "include/pathops",
66 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070067 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070068 "include/utils",
69 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070070]
71
mtkleinc04ff472016-06-23 10:29:30 -070072# Skia public API, generally provided by :skia.
73config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070074 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040075 defines = []
76 if (is_component_build) {
77 defines += [ "SKIA_DLL" ]
78 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040079 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070080 defines += [ "SK_SAMPLES_FOR_X" ]
81 }
mtkleincae1be52016-09-20 08:24:34 -070082 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040083 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070084 }
mtklein06c35c02016-09-20 12:28:12 -070085 if (!skia_enable_gpu) {
86 defines += [ "SK_SUPPORT_GPU=0" ]
87 }
mtkleinc04ff472016-06-23 10:29:30 -070088}
89
90# Skia internal APIs, used by Skia itself and a few test tools.
91config("skia_private") {
92 visibility = [ ":*" ]
93
94 include_dirs = [
95 "include/private",
96 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070097 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070098 "src/core",
99 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700100 "src/effects/gradients",
101 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700102 "src/gpu",
103 "src/image",
104 "src/images",
105 "src/lazy",
106 "src/opts",
107 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700108 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700109 "src/ports",
110 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700111 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700112 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700113 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500114 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700115 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700116 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700117 ]
mtklein150d1132016-08-01 06:56:40 -0700118
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400119 defines = [
120 "SK_GAMMA_APPLY_TO_A8",
121 "SK_INTERNAL",
122 ]
mtkleinb37c0342016-09-09 11:07:45 -0700123 if (is_android) {
124 defines += [
125 "SK_GAMMA_EXPONENT=1.4",
126 "SK_GAMMA_CONTRAST=0.0",
127 ]
128 }
mtklein88a7ac02016-09-14 11:16:49 -0700129 if (is_official_build || is_android) {
130 # TODO(bsalomon): it'd be nice to make Android normal.
131 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
132 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400133 libs = []
134 lib_dirs = []
135 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400136 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400137 if (is_win) {
138 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
139 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
140 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400141 include_dirs += [ "$skia_vulkan_sdk/include/" ]
142 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400143 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400144 }
Mike Klein487bfc22016-10-14 14:04:56 -0400145 if (is_win) {
146 libs += [ "vulkan-1.lib" ]
147 } else {
148 libs += [ "vulkan" ]
149 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400150 }
Brian Osman34755e22016-12-05 09:46:02 -0500151 if (skia_use_angle) {
152 defines += [ "SK_ANGLE" ]
153 }
Brian Osman3f375d02016-12-28 11:19:22 -0500154 if (skia_enable_discrete_gpu) {
155 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
156 }
mtkleinc04ff472016-06-23 10:29:30 -0700157}
158
159# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
160config("skia_library") {
161 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700162 defines = [ "SKIA_IMPLEMENTATION=1" ]
163}
164
165skia_library_configs = [
166 ":skia_public",
167 ":skia_private",
168 ":skia_library",
169]
170
mtklein9b8583d2016-08-24 17:32:30 -0700171# Use for CPU-specific Skia code that needs particular compiler flags.
172template("opts") {
173 if (invoker.enabled) {
174 source_set(target_name) {
175 forward_variables_from(invoker, "*")
176 configs += skia_library_configs
177 }
178 } else {
179 # If not enabled, a phony empty target that swallows all otherwise unused variables.
180 source_set(target_name) {
181 forward_variables_from(invoker,
182 "*",
183 [
184 "sources",
185 "cflags",
186 ])
187 }
188 }
anmittala7eaf2e2016-08-17 13:57:26 -0700189}
190
mtklein422310d2016-08-16 18:28:43 -0700191is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700192
mtklein7d6fb2c2016-08-25 14:50:44 -0700193opts("none") {
194 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700195 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700196 cflags = []
197}
198
mtklein7d6fb2c2016-08-25 14:50:44 -0700199opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700200 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700201 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700202 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700203}
204
205opts("arm64") {
206 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700208 cflags = []
209}
210
211opts("crc32") {
212 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700213 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700214 cflags = [ "-march=armv8-a+crc" ]
215}
216
mtklein9b8583d2016-08-24 17:32:30 -0700217opts("sse2") {
218 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700219 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400220 if (is_win) {
221 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
222 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400223 cflags = [ "-msse2" ]
224 }
mtklein9b8583d2016-08-24 17:32:30 -0700225}
mtkleinc04ff472016-06-23 10:29:30 -0700226
mtklein9b8583d2016-08-24 17:32:30 -0700227opts("ssse3") {
228 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400230 if (is_win) {
231 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
232 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400233 cflags = [ "-mssse3" ]
234 }
mtklein9b8583d2016-08-24 17:32:30 -0700235}
mtkleinc04ff472016-06-23 10:29:30 -0700236
mtklein9b8583d2016-08-24 17:32:30 -0700237opts("sse41") {
238 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400240 if (is_win) {
241 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
242 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400243 cflags = [ "-msse4.1" ]
244 }
mtklein9b8583d2016-08-24 17:32:30 -0700245}
mtklein4e976072016-08-08 09:06:27 -0700246
mtklein9b8583d2016-08-24 17:32:30 -0700247opts("sse42") {
248 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400250 if (is_win) {
251 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
252 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400253 cflags = [ "-msse4.2" ]
254 }
mtklein9b8583d2016-08-24 17:32:30 -0700255}
256
257opts("avx") {
258 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400260 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000261 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400262 } else {
263 cflags = [ "-mavx" ]
264 }
mtkleinc04ff472016-06-23 10:29:30 -0700265}
266
Mike Klein78d5a3b2016-09-30 10:48:01 -0400267opts("hsw") {
268 enabled = is_x86
269 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400270 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000271 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400272 } else {
273 cflags = [
274 "-mavx2",
275 "-mbmi",
276 "-mbmi2",
277 "-mf16c",
278 "-mfma",
279 ]
280 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400281}
282
mtkleinc095df52016-08-24 12:23:52 -0700283# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700284template("optional") {
285 if (invoker.enabled) {
286 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700287 if (defined(invoker.public_defines)) {
288 defines = invoker.public_defines
289 }
mtklein457b42a2016-08-23 13:56:37 -0700290 }
291 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700292 forward_variables_from(invoker,
293 "*",
294 [
295 "public_defines",
296 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700297 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700298 ])
mtklein457b42a2016-08-23 13:56:37 -0700299 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700300 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700301 if (defined(invoker.configs_to_remove)) {
302 configs -= invoker.configs_to_remove
303 }
mtklein457b42a2016-08-23 13:56:37 -0700304 }
305 } else {
mtklein457b42a2016-08-23 13:56:37 -0700306 source_set(target_name) {
307 forward_variables_from(invoker,
308 "*",
309 [
310 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700311 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700312 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700313 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700314 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700315 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700316 ])
mtkleincd01b032016-08-31 04:58:19 -0700317 if (defined(invoker.sources_when_disabled)) {
318 sources = invoker.sources_when_disabled
319 }
320 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700321 }
mtkleineb3c4252016-08-23 07:38:09 -0700322 }
mtklein457b42a2016-08-23 13:56:37 -0700323}
mtklein457b42a2016-08-23 13:56:37 -0700324
Mike Kleina04bb452017-02-09 12:24:07 -0500325optional("effects") {
326 enabled = skia_enable_effects
327 sources =
328 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
329 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
330}
331
mtkleina45be612016-08-29 15:22:10 -0700332optional("fontmgr_android") {
333 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700334
335 deps = [
336 "//third_party/expat",
337 "//third_party/freetype2",
338 ]
339 sources = [
340 "src/ports/SkFontMgr_android.cpp",
341 "src/ports/SkFontMgr_android_factory.cpp",
342 "src/ports/SkFontMgr_android_parser.cpp",
343 ]
344}
345
mtkleind2e39db2016-09-07 07:52:55 -0700346optional("fontmgr_custom") {
347 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
348
349 deps = [
350 "//third_party/freetype2",
351 ]
352 sources = [
353 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500354 "src/ports/SkFontMgr_custom.h",
355 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700356 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500357 "src/ports/SkFontMgr_custom_embedded.cpp",
358 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700359 ]
360}
361
mtklein3cc22182016-08-29 13:26:14 -0700362optional("fontmgr_fontconfig") {
363 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700364
365 deps = [
366 "//third_party:fontconfig",
367 "//third_party/freetype2",
368 ]
369 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700370 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700371 "src/ports/SkFontConfigInterface_direct.cpp",
372 "src/ports/SkFontConfigInterface_direct_factory.cpp",
373 "src/ports/SkFontMgr_FontConfigInterface.cpp",
374 "src/ports/SkFontMgr_fontconfig.cpp",
375 "src/ports/SkFontMgr_fontconfig_factory.cpp",
376 ]
377}
378
mtkleincdedd0e2016-09-12 15:15:44 -0700379optional("fontmgr_fuchsia") {
380 enabled = is_fuchsia && skia_use_freetype
381
382 deps = [
383 "//third_party/freetype2",
384 ]
385 sources = [
386 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500387 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700388 "src/ports/SkFontMgr_custom_empty_factory.cpp",
389 ]
390}
391
mtklein06c35c02016-09-20 12:28:12 -0700392optional("gpu") {
393 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700394 public_defines = []
395
Mike Klein29b3e582017-02-09 11:57:32 -0500396 sources = skia_gpu_sources + skia_sksl_sources +
397 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700398
399 # These paths need to be absolute to match the ones produced by shared_sources.gni.
400 sources -= get_path_info([
401 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
402 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
403 ],
404 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400405 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700406 if (is_android) {
407 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
408 } else if (is_linux) {
409 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
410 } else if (is_mac) {
411 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800412 } else if (is_ios) {
413 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400414 } else if (is_win) {
415 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
416 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700417 } else {
418 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
419 }
mtkleine9fb3d52016-09-20 15:11:46 -0700420
421 if (skia_use_vulkan) {
422 public_defines += [ "SK_VULKAN" ]
423 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700424 if (skia_enable_vulkan_debug_layers) {
425 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
426 }
mtkleine9fb3d52016-09-20 15:11:46 -0700427 }
mtklein06c35c02016-09-20 12:28:12 -0700428}
429
mtklein63213812016-08-24 09:55:56 -0700430optional("jpeg") {
431 enabled = skia_use_libjpeg_turbo
432 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
433
mtklein63213812016-08-24 09:55:56 -0700434 deps = [
435 "//third_party/libjpeg-turbo:libjpeg",
436 ]
437 sources = [
438 "src/codec/SkJpegCodec.cpp",
439 "src/codec/SkJpegDecoderMgr.cpp",
440 "src/codec/SkJpegUtility.cpp",
441 "src/images/SkJPEGImageEncoder.cpp",
442 "src/images/SkJPEGWriteUtility.cpp",
443 ]
444}
445
446optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500447 enabled = skia_use_zlib && skia_enable_pdf
448 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700449
mtklein63213812016-08-24 09:55:56 -0700450 deps = [
451 "//third_party/zlib",
452 ]
brettwb9447282016-09-01 14:24:39 -0700453 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700454 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700455
456 if (skia_use_sfntly) {
457 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500458 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700459 }
460}
461
462optional("png") {
463 enabled = skia_use_libpng
464 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
465
mtklein63213812016-08-24 09:55:56 -0700466 deps = [
467 "//third_party/libpng",
468 ]
469 sources = [
470 "src/codec/SkIcoCodec.cpp",
471 "src/codec/SkPngCodec.cpp",
472 "src/images/SkPNGImageEncoder.cpp",
473 ]
474}
475
scroggof84ad642016-10-31 09:02:57 -0700476optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400477 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700478 public_defines = [ "SK_CODEC_DECODES_RAW" ]
479
480 deps = [
481 "//third_party/dng_sdk",
482 "//third_party/libjpeg-turbo:libjpeg",
483 "//third_party/piex",
484 ]
485
486 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
487 # Skia.
488 configs_to_remove = [ "//gn:no_exceptions" ]
489
490 sources = [
491 "src/codec/SkRawAdapterCodec.cpp",
492 "src/codec/SkRawCodec.cpp",
493 ]
494}
495
Mike Kleine1caee12017-02-15 13:31:12 -0500496optional("jumper") {
497 enabled = skia_enable_jumper
498 public_defines = [ "SK_JUMPER" ]
499 sources = [
500 "src/jumper/SkJumper.cpp",
501 "src/jumper/SkJumper_stages.cpp",
502 ]
503}
504
mtklein3cc22182016-08-29 13:26:14 -0700505optional("typeface_freetype") {
506 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700507
508 deps = [
509 "//third_party/freetype2",
510 ]
511 sources = [
512 "src/ports/SkFontHost_FreeType.cpp",
513 "src/ports/SkFontHost_FreeType_common.cpp",
514 ]
515}
516
mtklein457b42a2016-08-23 13:56:37 -0700517optional("webp") {
518 enabled = skia_use_libwebp
519 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
520
mtklein457b42a2016-08-23 13:56:37 -0700521 deps = [
522 "//third_party/libwebp",
523 ]
524 sources = [
525 "src/codec/SkWebpAdapterCodec.cpp",
526 "src/codec/SkWebpCodec.cpp",
527 "src/images/SkWEBPImageEncoder.cpp",
528 ]
mtkleineb3c4252016-08-23 07:38:09 -0700529}
530
mtklein63213812016-08-24 09:55:56 -0700531optional("xml") {
532 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000533 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700534
mtklein63213812016-08-24 09:55:56 -0700535 deps = [
536 "//third_party/expat",
537 ]
538 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500539 "src/svg/SkSVGCanvas.cpp",
540 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700541 "src/xml/SkDOM.cpp",
542 "src/xml/SkXMLParser.cpp",
543 "src/xml/SkXMLWriter.cpp",
544 ]
545}
546
mtkleinc04ff472016-06-23 10:29:30 -0700547component("skia") {
548 public_configs = [ ":skia_public" ]
549 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700550
551 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700552 ":arm64",
553 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700554 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700555 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500556 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700557 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700558 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700559 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700560 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700561 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400562 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700563 ":jpeg",
Mike Kleine1caee12017-02-15 13:31:12 -0500564 ":jumper",
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",
mtklein9b8583d2016-08-24 17:32:30 -0700569 ":sse2",
570 ":sse41",
571 ":sse42",
572 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700573 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700574 ":webp",
mtklein63213812016-08-24 09:55:56 -0700575 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700576 ]
577
Chinmay Garde43f115c2016-11-16 15:04:12 -0800578 # This file (and all GN files in Skia) are designed to work with an
579 # empty sources assignment filter; we handle all that explicitly.
580 # We clear the filter here for clients who may have set up a global filter.
581 set_sources_assignment_filter([])
582
mtkleinc04ff472016-06-23 10:29:30 -0700583 sources = []
brettwb9447282016-09-01 14:24:39 -0700584 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700585 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500586 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700587 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700588 "src/android/SkBitmapRegionCodec.cpp",
589 "src/android/SkBitmapRegionDecoder.cpp",
590 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700591 "src/codec/SkBmpCodec.cpp",
592 "src/codec/SkBmpMaskCodec.cpp",
593 "src/codec/SkBmpRLECodec.cpp",
594 "src/codec/SkBmpStandardCodec.cpp",
595 "src/codec/SkCodec.cpp",
596 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700597 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700598 "src/codec/SkMaskSwizzler.cpp",
599 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700600 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700601 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700602 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700603 "src/codec/SkSwizzler.cpp",
604 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700605 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700606 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700607 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700608 "src/ports/SkMemory_malloc.cpp",
609 "src/ports/SkOSFile_stdio.cpp",
610 "src/sfnt/SkOTTable_name.cpp",
611 "src/sfnt/SkOTUtils.cpp",
612 "src/utils/mac/SkStream_mac.cpp",
613 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700614 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700615 ]
brettwb9447282016-09-01 14:24:39 -0700616
mtklein7d6fb2c2016-08-25 14:50:44 -0700617 libs = []
618
mtkleinc04ff472016-06-23 10:29:30 -0700619 if (is_win) {
620 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400621 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700622 "src/ports/SkDebug_win.cpp",
623 "src/ports/SkFontHost_win.cpp",
624 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700625 "src/ports/SkImageEncoder_WIC.cpp",
626 "src/ports/SkImageGeneratorWIC.cpp",
627 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700628 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700629 "src/ports/SkScalerContext_win_dw.cpp",
630 "src/ports/SkTLS_win.cpp",
631 "src/ports/SkTypeface_win_dw.cpp",
632 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400633 if (skia_use_gdi) {
634 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
635 libs += [
636 "Gdi32.lib",
637 "Usp10.lib",
638 ]
639 } else {
640 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
641 }
mtkleinb9be9792016-09-16 14:44:18 -0700642 sources -=
643 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400644 libs += [
645 "FontSub.lib",
646 "Ole32.lib",
647 "OleAut32.lib",
648 "User32.lib",
649 ]
mtkleinc04ff472016-06-23 10:29:30 -0700650 } else {
651 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700652 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700653 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700654 "src/ports/SkTLS_pthread.cpp",
655 ]
656 }
657
mtklein7d6fb2c2016-08-25 14:50:44 -0700658 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500659 deps += [ "//third_party/expat" ]
660 if (is_skia_standalone && ndk != "") {
661 deps += [ "//third_party/cpu-features" ]
662 }
mtklein06c35c02016-09-20 12:28:12 -0700663 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700664 libs += [
665 "EGL",
666 "GLESv2",
667 "log",
668 ]
669 }
670
mtkleinc04ff472016-06-23 10:29:30 -0700671 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700672 libs += [
673 "GL",
674 "GLU",
675 "X11",
676 ]
mtklein06c35c02016-09-20 12:28:12 -0700677 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700678 }
679
680 if (is_mac) {
681 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700682 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700683 "src/ports/SkFontHost_mac.cpp",
684 "src/ports/SkImageEncoder_CG.cpp",
685 "src/ports/SkImageGeneratorCG.cpp",
686 ]
mtklein09e61f72016-08-23 13:35:28 -0700687 libs += [
688 "ApplicationServices.framework",
689 "OpenGL.framework",
690 ]
mtkleinc04ff472016-06-23 10:29:30 -0700691 }
abarth6fc8ff02016-07-15 15:15:15 -0700692
Mike Klein7d302882016-11-03 14:06:31 -0400693 if (is_ios) {
694 sources += [
695 "src/ports/SkDebug_stdio.cpp",
696 "src/ports/SkFontHost_mac.cpp",
697 "src/ports/SkImageEncoder_CG.cpp",
698 "src/ports/SkImageGeneratorCG.cpp",
699 ]
700 libs += [
701 "CoreFoundation.framework",
702 "CoreGraphics.framework",
703 "CoreText.framework",
704 "ImageIO.framework",
705 "MobileCoreServices.framework",
706 ]
707 }
708
abarth6fc8ff02016-07-15 15:15:15 -0700709 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700710 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700711 }
mtkleinc04ff472016-06-23 10:29:30 -0700712}
713
mtkleinc095df52016-08-24 12:23:52 -0700714# Targets guarded by skia_enable_tools may use //third_party freely.
715if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500716 # Used by gn_to_bp.py to list our public include dirs.
717 source_set("public") {
718 configs += [ ":skia_public" ]
719 }
720
Mike Kleinc36dedf2016-11-18 09:35:28 -0500721 config("skia.h_config") {
722 include_dirs = [ "$target_gen_dir" ]
723 }
724 action("skia.h") {
725 public_configs = [ ":skia.h_config" ]
726 skia_h = "$target_gen_dir/skia.h"
727 script = "gn/find_headers.py"
728 args = [ rebase_path(skia_h, root_build_dir) ] +
729 rebase_path(skia_public_includes)
730 depfile = "$skia_h.deps"
731 outputs = [
732 skia_h,
733 ]
734 }
735
736 if (skia_enable_gpu && target_cpu == "x64") {
737 # Our bots only have 64-bit libOSMesa installed.
738 # TODO: worth fixing?
739 executable("fiddle") {
740 libs = []
741 if (is_linux) {
742 libs += [ "OSMesa" ]
743 }
744
745 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500746 "tools/fiddle/draw.cpp",
747 "tools/fiddle/fiddle_main.cpp",
748 ]
749 deps = [
750 ":skia",
751 ":skia.h",
752 ]
753 }
754 }
755
756 if (skia_enable_gpu) {
757 source_set("public_headers_warnings_check") {
758 sources = [
759 "tools/public_headers_warnings_check.cpp",
760 ]
761 configs -= [ "//gn:warnings_except_public_headers" ]
762 deps = [
763 ":skia",
764 ":skia.h",
765 ]
766 }
767 }
768
mtkleinc095df52016-08-24 12:23:52 -0700769 template("test_lib") {
770 config(target_name + "_config") {
771 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700772 if (defined(invoker.public_defines)) {
773 defines = invoker.public_defines
774 }
mtklein25c81d42016-07-27 13:55:26 -0700775 }
mtkleinc095df52016-08-24 12:23:52 -0700776 source_set(target_name) {
777 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
778 public_configs = [
779 ":" + target_name + "_config",
780 ":skia_private",
781 ]
782
783 if (!defined(deps)) {
784 deps = []
785 }
786 deps += [ ":skia" ]
787 testonly = true
788 }
mtklein25c81d42016-07-27 13:55:26 -0700789 }
mtklein25c81d42016-07-27 13:55:26 -0700790
Mike Kleine6682eb2017-01-05 10:54:57 -0500791 template("test_app") {
792 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
793 shared_library("lib" + target_name) {
794 forward_variables_from(invoker, "*", [ "is_shared_library" ])
795 testonly = true
796 }
797 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500798 _executable = target_name
799 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500800 forward_variables_from(invoker, "*", [ "is_shared_library" ])
801 testonly = true
802 }
803 }
Mike Klein7d921032017-01-05 12:20:41 -0500804 if (is_android && skia_android_serial != "" && defined(_executable)) {
805 action("push_" + target_name) {
806 script = "gn/push_to_android.py"
807 deps = [
808 ":" + _executable,
809 ]
810 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
811 outputs = [
812 _stamp,
813 ]
814 args = [
815 rebase_path("$root_build_dir/$_executable"),
816 skia_android_serial,
817 rebase_path(_stamp),
818 ]
819 testonly = true
820 }
821 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500822 }
823
mtkleinc095df52016-08-24 12:23:52 -0700824 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700825 public_include_dirs = []
826 if (skia_enable_gpu) {
827 public_defines = []
828 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700829
830 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700831 sources = [
832 "tools/gpu/GrContextFactory.cpp",
833 "tools/gpu/GrTest.cpp",
834 "tools/gpu/TestContext.cpp",
835 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700836 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700837 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
838 "tools/gpu/gl/debug/GrBufferObj.cpp",
839 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
840 "tools/gpu/gl/debug/GrProgramObj.cpp",
841 "tools/gpu/gl/debug/GrShaderObj.cpp",
842 "tools/gpu/gl/debug/GrTextureObj.cpp",
843 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
844 "tools/gpu/gl/null/NullGLTestContext.cpp",
845 ]
846 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700847
mtklein38925aa2016-09-21 10:11:25 -0700848 if (is_android) {
849 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400850 } else if (is_ios) {
851 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
852 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700853 } else if (is_linux) {
854 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
855 } else if (is_mac) {
856 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400857 } else if (is_win) {
858 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
859 libs += [
860 "Gdi32.lib",
861 "OpenGL32.lib",
862 ]
mtklein38925aa2016-09-21 10:11:25 -0700863 }
mtklein6ef69992016-09-14 06:12:09 -0700864
Mike Kleinc168a3a2016-11-14 14:53:13 +0000865 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000866 deps += [ "//third_party/angle2" ]
867 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
868 }
mtklein38925aa2016-09-21 10:11:25 -0700869 if (skia_use_mesa) {
870 public_defines += [ "SK_MESA" ]
871 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
872 libs += [ "OSMesa" ]
873 }
mtkleind68f9b02016-09-23 13:18:41 -0700874 if (skia_use_vulkan) {
875 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
876 }
mtkleina627b5c2016-09-20 13:36:47 -0700877 }
mtklein25c81d42016-07-27 13:55:26 -0700878 }
mtklein25c81d42016-07-27 13:55:26 -0700879
mtkleinc095df52016-08-24 12:23:52 -0700880 test_lib("flags") {
881 public_include_dirs = [ "tools/flags" ]
882 sources = [
883 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700884 ]
885 }
886 test_lib("common_flags") {
887 public_include_dirs = [ "tools/flags" ]
888 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700889 "tools/flags/SkCommonFlags.cpp",
890 "tools/flags/SkCommonFlagsConfig.cpp",
891 ]
892 deps = [
mtklein046cb562016-09-16 10:23:12 -0700893 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700894 ":gpu_tool_utils",
895 ]
896 }
mtklein25c81d42016-07-27 13:55:26 -0700897
mtkleinc095df52016-08-24 12:23:52 -0700898 test_lib("tool_utils") {
899 public_include_dirs = [
900 "tools",
901 "tools/debugger",
902 "tools/timer",
903 ]
904 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700905 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700906 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700907 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700908 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700909 "tools/ProcStats.cpp",
910 "tools/Resources.cpp",
911 "tools/ThermalManager.cpp",
912 "tools/UrlDataManager.cpp",
913 "tools/debugger/SkDebugCanvas.cpp",
914 "tools/debugger/SkDrawCommand.cpp",
915 "tools/debugger/SkJsonWriteBuffer.cpp",
916 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700917 "tools/picture_utils.cpp",
918 "tools/random_parse_path.cpp",
919 "tools/sk_tool_utils.cpp",
920 "tools/sk_tool_utils_font.cpp",
921 "tools/timer/Timer.cpp",
922 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500923 libs = []
924 if (is_ios) {
925 sources += [ "tools/ios_utils.m" ]
926 libs += [ "Foundation.framework" ]
927 }
mtkleinc095df52016-08-24 12:23:52 -0700928 deps = [
mtklein046cb562016-09-16 10:23:12 -0700929 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700930 ":flags",
931 "//third_party/libpng",
932 ]
933 public_deps = [
934 "//third_party/jsoncpp",
935 ]
936 }
mtklein25c81d42016-07-27 13:55:26 -0700937
Mike Klein6e744122016-10-27 12:21:40 -0400938 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700939 test_lib("gm") {
940 public_include_dirs = [ "gm" ]
941 sources = gm_sources
942 deps = [
scroggo19b91532016-10-24 09:03:26 -0700943 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700944 ":gpu_tool_utils",
945 ":skia",
946 ":tool_utils",
947 ]
948 }
mtklein25c81d42016-07-27 13:55:26 -0700949
Mike Klein6e744122016-10-27 12:21:40 -0400950 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700951 test_lib("tests") {
952 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400953 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700954 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400955 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700956 }
mtkleinc095df52016-08-24 12:23:52 -0700957 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700958 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700959 ":flags",
960 ":gpu_tool_utils",
961 ":skia",
962 ":tool_utils",
963 "//third_party/libpng",
964 "//third_party/zlib",
965 ]
966 }
mtklein2f3416d2016-08-02 16:02:05 -0700967
Mike Klein6e744122016-10-27 12:21:40 -0400968 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700969 test_lib("bench") {
970 public_include_dirs = [ "bench" ]
971 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700972 deps = [
973 ":flags",
974 ":gm",
975 ":gpu_tool_utils",
976 ":skia",
977 ":tool_utils",
978 ]
979 }
mtklein2b6870c2016-07-28 14:17:33 -0700980
mtkleinc095df52016-08-24 12:23:52 -0700981 test_lib("experimental_svg_model") {
982 public_include_dirs = [ "experimental/svg/model" ]
983 sources = [
984 "experimental/svg/model/SkSVGAttribute.cpp",
985 "experimental/svg/model/SkSVGAttributeParser.cpp",
986 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -0500987 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700988 "experimental/svg/model/SkSVGContainer.cpp",
989 "experimental/svg/model/SkSVGDOM.cpp",
990 "experimental/svg/model/SkSVGEllipse.cpp",
991 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700992 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700993 "experimental/svg/model/SkSVGNode.cpp",
994 "experimental/svg/model/SkSVGPath.cpp",
995 "experimental/svg/model/SkSVGPoly.cpp",
996 "experimental/svg/model/SkSVGRect.cpp",
997 "experimental/svg/model/SkSVGRenderContext.cpp",
998 "experimental/svg/model/SkSVGSVG.cpp",
999 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001000 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001001 "experimental/svg/model/SkSVGTransformableNode.cpp",
1002 "experimental/svg/model/SkSVGValue.cpp",
1003 ]
1004 deps = [
1005 ":skia",
1006 ]
1007 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001008
Brian Osman16adfa32016-10-18 14:42:44 -04001009 test_lib("views") {
1010 public_include_dirs = [ "include/views" ]
1011 sources = [
1012 "src/views/SkEvent.cpp",
1013 "src/views/SkEventSink.cpp",
1014 "src/views/SkOSMenu.cpp",
1015 "src/views/SkTagList.cpp",
1016 "src/views/SkTouchGesture.cpp",
1017 "src/views/SkView.cpp",
1018 "src/views/SkViewPriv.cpp",
1019 ]
1020 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001021 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001022 if (!is_android) {
1023 sources += [ "src/views/SkWindow.cpp" ]
1024 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001025 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001026 public_include_dirs += [ "src/views/unix" ]
1027 sources += [
1028 "src/views/unix/SkOSWindow_Unix.cpp",
1029 "src/views/unix/keysym2ucs.c",
1030 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001031 } else if (is_mac) {
1032 sources += [
1033 "src/views/mac/SkEventNotifier.mm",
1034 "src/views/mac/SkNSView.mm",
1035 "src/views/mac/SkOSWindow_Mac.mm",
1036 "src/views/mac/SkTextFieldCell.m",
1037 ]
1038 libs += [
1039 "QuartzCore.framework",
1040 "Cocoa.framework",
1041 "Foundation.framework",
1042 ]
1043 } else if (is_win) {
1044 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1045 }
Brian Osman34755e22016-12-05 09:46:02 -05001046 if (skia_use_angle) {
1047 deps += [ "//third_party/angle2" ]
1048 }
Brian Osman16adfa32016-10-18 14:42:44 -04001049 }
1050
Mike Klein38af9432016-11-11 11:39:44 -05001051 if (skia_use_lua) {
1052 test_lib("lua") {
1053 public_include_dirs = []
1054 sources = [
1055 "src/utils/SkLua.cpp",
1056 "src/utils/SkLuaCanvas.cpp",
1057 ]
1058 deps = [
1059 "//third_party/lua",
1060 ]
1061 }
1062
Mike Kleine6682eb2017-01-05 10:54:57 -05001063 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001064 sources = [
1065 "tools/lua/lua_app.cpp",
1066 ]
1067 deps = [
1068 ":lua",
1069 ":skia",
1070 "//third_party/lua",
1071 ]
Mike Klein38af9432016-11-11 11:39:44 -05001072 }
1073
Mike Kleine6682eb2017-01-05 10:54:57 -05001074 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001075 sources = [
1076 "tools/lua/lua_pictures.cpp",
1077 ]
1078 deps = [
1079 ":flags",
1080 ":lua",
1081 ":skia",
1082 ":tool_utils",
1083 "//third_party/lua",
1084 ]
Mike Klein38af9432016-11-11 11:39:44 -05001085 }
1086 }
1087
Mike Klein6e744122016-10-27 12:21:40 -04001088 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001089 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001090 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001091 include_dirs = [ "experimental" ]
1092 sources = samples_sources + [
1093 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1094 "experimental/SkSetPoly3To3.cpp",
1095 "experimental/SkSetPoly3To3_A.cpp",
1096 "experimental/SkSetPoly3To3_D.cpp",
1097 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001098 deps = [
1099 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001100 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001101 ":tool_utils",
1102 ":views",
1103 ":xml",
1104 ]
Mike Klein38af9432016-11-11 11:39:44 -05001105
1106 if (skia_use_lua) {
1107 sources += [ "samplecode/SampleLua.cpp" ]
1108 deps += [
1109 ":lua",
1110 "//third_party/lua",
1111 ]
1112 }
Brian Osman16adfa32016-10-18 14:42:44 -04001113 }
1114
Mike Kleine6682eb2017-01-05 10:54:57 -05001115 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001116 sources = [
1117 "dm/DM.cpp",
1118 "dm/DMJsonWriter.cpp",
1119 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001120 ]
1121 include_dirs = [ "tests" ]
1122 deps = [
mtklein046cb562016-09-16 10:23:12 -07001123 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001124 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001125 ":flags",
1126 ":gm",
1127 ":gpu_tool_utils",
1128 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001129 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001130 ":tool_utils",
1131 "//third_party/jsoncpp",
1132 "//third_party/libpng",
1133 ]
mtklein2b6870c2016-07-28 14:17:33 -07001134 }
1135
Mike Kleina3430172016-09-27 16:46:29 -04001136 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001137 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001138 sources = [
1139 "tools/monobench.cpp",
1140 ]
1141 deps = [
1142 ":bench",
1143 ":skia",
1144 ]
Mike Kleina3430172016-09-27 16:46:29 -04001145 }
mtklein2b6870c2016-07-28 14:17:33 -07001146 }
1147
Mike Kleine6682eb2017-01-05 10:54:57 -05001148 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001149 sources = [
1150 "bench/nanobench.cpp",
1151 ]
1152 deps = [
1153 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001154 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001155 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001156 ":flags",
1157 ":gm",
1158 ":gpu_tool_utils",
1159 ":skia",
1160 ":tool_utils",
1161 "//third_party/jsoncpp",
1162 ]
mtklein2b6870c2016-07-28 14:17:33 -07001163 }
halcanary19a97202016-08-03 15:08:04 -07001164
Ravi Mistry10d36c52017-01-31 09:49:18 -05001165 test_app("skpinfo") {
1166 sources = [
1167 "tools/skpinfo.cpp",
1168 ]
1169 deps = [
1170 ":flags",
1171 ":skia",
1172 ]
1173 }
1174
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001175 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001176 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001177 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001178 "samplecode/SampleApp.cpp",
1179 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001180 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001181 if (is_mac) {
1182 sources += [ "src/views/mac/skia_mac.mm" ]
1183 } else if (is_win) {
1184 sources += [ "src/views/win/skia_win.cpp" ]
1185 } else if (is_linux) {
1186 sources += [ "src/views/unix/skia_unix.cpp" ]
1187 }
mtklein38925aa2016-09-21 10:11:25 -07001188 deps = [
1189 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001190 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001191 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001192 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001193 ":skia",
1194 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001195 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001196 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001197 if (skia_use_angle) {
1198 deps += [ "//third_party/angle2" ]
1199 }
mtklein38925aa2016-09-21 10:11:25 -07001200 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001201 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001202
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001203 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001204 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001205 sources = [
1206 "tools/skpbench/skpbench.cpp",
1207 ]
1208 deps = [
1209 ":flags",
1210 ":gpu_tool_utils",
1211 ":skia",
1212 ":tool_utils",
1213 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001214 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001215 }
1216
Mike Klein7d302882016-11-03 14:06:31 -04001217 # We can't yet build ICU on iOS or Windows.
1218 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001219 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001220 sources = [
1221 "tools/SkShaper_harfbuzz.cpp",
1222 "tools/using_skia_and_harfbuzz.cpp",
1223 ]
1224 deps = [
1225 ":skia",
1226 "//third_party/harfbuzz",
1227 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001228 }
halcanary19a97202016-08-03 15:08:04 -07001229 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001230 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001231 sources = [
1232 "tools/SkShaper_primitive.cpp",
1233 "tools/using_skia_and_harfbuzz.cpp",
1234 ]
1235 deps = [
1236 ":skia",
1237 ]
halcanary3eee9d92016-09-10 07:01:53 -07001238 }
mtklein046cb562016-09-16 10:23:12 -07001239
Mike Kleine6682eb2017-01-05 10:54:57 -05001240 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001241 sources = [
1242 "tools/get_images_from_skps.cpp",
1243 ]
1244 deps = [
1245 ":flags",
1246 ":skia",
1247 "//third_party/jsoncpp",
1248 ]
mtklein046cb562016-09-16 10:23:12 -07001249 }
mtkleinecbc5262016-09-22 11:51:24 -07001250
Mike Kleine6682eb2017-01-05 10:54:57 -05001251 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001252 sources = [
1253 "tools/colorspaceinfo.cpp",
1254 ]
1255 deps = [
1256 ":flags",
1257 ":skia",
1258 ":tool_utils",
1259 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001260 }
1261
Mike Klein7d302882016-11-03 14:06:31 -04001262 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001263 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001264 sources = [
1265 "tools/skiaserve/Request.cpp",
1266 "tools/skiaserve/Response.cpp",
1267 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001268 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1269 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1270 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1271 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1272 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1273 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1274 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1275 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1276 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001277 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1278 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001279 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1280 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1281 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1282 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1283 ]
1284 deps = [
1285 ":flags",
1286 ":gpu_tool_utils",
1287 ":skia",
1288 ":tool_utils",
1289 "//third_party/jsoncpp",
1290 "//third_party/libmicrohttpd",
1291 "//third_party/libpng",
1292 ]
Mike Klein7d302882016-11-03 14:06:31 -04001293 }
mtkleinecbc5262016-09-22 11:51:24 -07001294 }
kjlubick14f984b2016-10-03 11:49:45 -07001295
Mike Kleine6682eb2017-01-05 10:54:57 -05001296 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001297 sources = [
1298 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001299 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001300 "fuzz/FuzzGradients.cpp",
1301 "fuzz/FuzzParsePath.cpp",
1302 "fuzz/FuzzPathop.cpp",
1303 "fuzz/FuzzScaleToSides.cpp",
1304 "fuzz/fuzz.cpp",
1305 ]
1306 deps = [
1307 ":flags",
1308 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001309 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001310 ]
kjlubick14f984b2016-10-03 11:49:45 -07001311 }
Mike Klein38312422016-10-05 15:41:01 -04001312
Mike Kleine6682eb2017-01-05 10:54:57 -05001313 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001314 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001315 rebase_path("tests/skia_test.cpp"),
1316 rebase_path("tests/Test.cpp"),
1317 ]
caryclark9feb6322016-10-25 08:58:26 -07001318 deps = [
1319 ":flags",
1320 ":gpu_tool_utils",
1321 ":skia",
1322 ":tool_utils",
1323 ]
caryclark9feb6322016-10-25 08:58:26 -07001324 }
1325
Mike Kleine6682eb2017-01-05 10:54:57 -05001326 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001327 sources = [
1328 "tools/DumpRecord.cpp",
1329 "tools/dump_record.cpp",
1330 ]
1331 deps = [
1332 ":flags",
1333 ":skia",
1334 ]
Mike Klein38312422016-10-05 15:41:01 -04001335 }
bungemanfe917272016-10-13 17:36:40 -04001336
Mike Kleine6682eb2017-01-05 10:54:57 -05001337 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001338 sources = [
1339 "tools/skdiff/skdiff.cpp",
1340 "tools/skdiff/skdiff_html.cpp",
1341 "tools/skdiff/skdiff_main.cpp",
1342 "tools/skdiff/skdiff_utils.cpp",
1343 ]
1344 deps = [
1345 ":skia",
1346 ":tool_utils",
1347 ]
bungemanfe917272016-10-13 17:36:40 -04001348 }
halcanarya73d76a2016-10-17 13:19:02 -07001349
Mike Kleine6682eb2017-01-05 10:54:57 -05001350 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001351 sources = [
1352 "tools/skp_parser.cpp",
1353 ]
1354 deps = [
1355 ":skia",
1356 ":tool_utils",
1357 "//third_party/jsoncpp",
1358 ]
halcanarya73d76a2016-10-17 13:19:02 -07001359 }
Brian Osman16adfa32016-10-18 14:42:44 -04001360
Mike Kleina92c3832016-12-08 09:49:39 -05001361 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001362 test_app("viewer") {
1363 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001364 sources = [
1365 "tools/viewer/GMSlide.cpp",
1366 "tools/viewer/ImageSlide.cpp",
1367 "tools/viewer/SKPSlide.cpp",
1368 "tools/viewer/SampleSlide.cpp",
1369 "tools/viewer/Viewer.cpp",
1370 "tools/viewer/sk_app/CommandSet.cpp",
1371 "tools/viewer/sk_app/GLWindowContext.cpp",
1372 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001373 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001374 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001375
Jim Van Verth4e56a912016-10-21 10:58:52 -04001376 if (is_android) {
1377 sources += [
1378 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1379 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1380 "tools/viewer/sk_app/android/Window_android.cpp",
1381 "tools/viewer/sk_app/android/main_android.cpp",
1382 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1383 ]
Brian Osman462334e2017-02-09 11:22:57 -05001384 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001385 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001386 sources += [
1387 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1388 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1389 "tools/viewer/sk_app/unix/Window_unix.cpp",
1390 "tools/viewer/sk_app/unix/main_unix.cpp",
1391 ]
1392 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001393 sources += [
1394 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1395 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1396 "tools/viewer/sk_app/win/Window_win.cpp",
1397 "tools/viewer/sk_app/win/main_win.cpp",
1398 ]
Mike Klein43c25262016-10-20 10:17:47 -04001399 } else if (is_mac) {
1400 sources += [
1401 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1402 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1403 "tools/viewer/sk_app/mac/Window_mac.cpp",
1404 "tools/viewer/sk_app/mac/main_mac.cpp",
1405 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001406 }
1407
1408 if (skia_use_vulkan) {
1409 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001410 if (is_android) {
1411 sources +=
1412 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001413 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001414 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1415 libs += [ "X11-xcb" ]
1416 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001417 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1418 }
1419 }
1420
1421 include_dirs = []
1422 deps = [
1423 ":flags",
1424 ":gm",
1425 ":gpu_tool_utils",
1426 ":samples",
1427 ":skia",
1428 ":tool_utils",
1429 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001430 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001431 "//third_party/jsoncpp",
1432 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001433 if (is_android) {
1434 deps += [ "//third_party/native_app_glue" ]
1435 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001436 deps += [ "//third_party/libsdl" ]
1437 }
Mike Kleina92c3832016-12-08 09:49:39 -05001438 }
Brian Osman16adfa32016-10-18 14:42:44 -04001439 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001440
Mike Klein621ea112017-01-12 08:07:23 -05001441 if (is_android && is_skia_standalone && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001442 copy("gdbserver") {
1443 sources = [
1444 "$ndk/$ndk_gdbserver",
1445 ]
1446 outputs = [
1447 "$root_out_dir/gdbserver",
1448 ]
1449 }
1450 if (ndk_simpleperf != "") {
1451 copy("simpleperf") {
1452 sources = [
1453 "$ndk/$ndk_simpleperf",
1454 "$ndk/simpleperf/simpleperf_report.py",
1455 ]
1456 outputs = [
1457 "$root_out_dir/{{source_file_part}}",
1458 ]
1459 }
1460 }
1461 }
1462
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001463 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001464 test_app("skslc") {
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001465 sources = [
1466 "src/sksl/SkSLMain.cpp",
1467 ]
1468 deps = [
1469 ":flags",
1470 ":skia",
1471 ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001472 }
1473 }
mtklein25c81d42016-07-27 13:55:26 -07001474}