blob: 5df2b4ab96a48f07de61decd61a117531d514e63 [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
Mike Klein3669a822017-03-03 10:55:02 -05009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12is_skia_dev_build = is_skia_standalone && !is_official_build
13
mtkleinc04ff472016-06-23 10:29:30 -070014declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000015 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070016 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070017 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070018 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040019 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040020 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070021 skia_use_libjpeg_turbo = true
22 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070023 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050024 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070025 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040026 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070027 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070028
Mike Klein7d921032017-01-05 12:20:41 -050029 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070030 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050031 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050032 skia_enable_effects = true
Mike Klein2fcd1702017-03-08 18:54:25 +000033 skia_enable_jumper = is_skia_dev_build
mtklein06c35c02016-09-20 12:28:12 -070034 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050035 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040036 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050037 skia_enable_tools = is_skia_dev_build
38 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040039 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070040}
Brian Salomon23d73ea2016-10-27 13:31:37 -040041declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080042 skia_use_dng_sdk =
43 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040044 skia_use_sfntly = skia_use_icu
45
Mike Klein4d598a32016-10-31 13:44:49 -040046 if (is_android) {
47 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
48 } else {
49 skia_use_vulkan = skia_vulkan_sdk != ""
50 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040051}
Brian Salomon789e25e2016-09-30 13:41:03 -040052
mtklein38925aa2016-09-21 10:11:25 -070053# Our tools require static linking (they use non-exported symbols).
54skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070055
mtkleina45be612016-08-29 15:22:10 -070056fontmgr_android_enabled = skia_use_expat && skia_use_freetype
57
mtklein1211e0c2016-07-26 13:55:45 -070058skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070059 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070060 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070061 "include/codec",
62 "include/config",
63 "include/core",
64 "include/effects",
65 "include/gpu",
66 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070067 "include/pathops",
68 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070069 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070070 "include/utils",
71 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070072]
73
mtkleinc04ff472016-06-23 10:29:30 -070074# Skia public API, generally provided by :skia.
75config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070076 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040077 defines = []
78 if (is_component_build) {
79 defines += [ "SKIA_DLL" ]
80 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040081 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070082 defines += [ "SK_SAMPLES_FOR_X" ]
83 }
mtkleincae1be52016-09-20 08:24:34 -070084 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040085 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070086 }
mtklein06c35c02016-09-20 12:28:12 -070087 if (!skia_enable_gpu) {
88 defines += [ "SK_SUPPORT_GPU=0" ]
89 }
mtkleinc04ff472016-06-23 10:29:30 -070090}
91
92# Skia internal APIs, used by Skia itself and a few test tools.
93config("skia_private") {
94 visibility = [ ":*" ]
95
96 include_dirs = [
97 "include/private",
98 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070099 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700100 "src/core",
101 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700102 "src/effects/gradients",
103 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700104 "src/image",
105 "src/images",
106 "src/lazy",
107 "src/opts",
108 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700109 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "src/ports",
111 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700112 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700113 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700114 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500115 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700116 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700117 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700118 ]
mtklein150d1132016-08-01 06:56:40 -0700119
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400120 defines = [
121 "SK_GAMMA_APPLY_TO_A8",
122 "SK_INTERNAL",
123 ]
mtkleinb37c0342016-09-09 11:07:45 -0700124 if (is_android) {
125 defines += [
126 "SK_GAMMA_EXPONENT=1.4",
127 "SK_GAMMA_CONTRAST=0.0",
128 ]
129 }
mtklein88a7ac02016-09-14 11:16:49 -0700130 if (is_official_build || is_android) {
131 # TODO(bsalomon): it'd be nice to make Android normal.
132 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
133 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400134 libs = []
135 lib_dirs = []
136 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400137 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400138 if (is_win) {
139 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
Brian Salomon3b5bf352017-03-20 15:54:41 -0400140 lib_dirs += [
141 "$skia_vulkan_sdk/Bin",
142 "$skia_vulkan_sdk/Lib",
143 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400144 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400145 include_dirs += [ "$skia_vulkan_sdk/include/" ]
146 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400147 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400148 }
Mike Klein487bfc22016-10-14 14:04:56 -0400149 if (is_win) {
150 libs += [ "vulkan-1.lib" ]
151 } else {
152 libs += [ "vulkan" ]
153 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400154 }
Brian Salomon03e05842017-02-23 12:23:47 -0500155 if (skia_enable_gpu) {
156 include_dirs += [ "src/gpu" ]
157 }
Brian Osman34755e22016-12-05 09:46:02 -0500158 if (skia_use_angle) {
159 defines += [ "SK_ANGLE" ]
160 }
Brian Osman3f375d02016-12-28 11:19:22 -0500161 if (skia_enable_discrete_gpu) {
162 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
163 }
mtkleinc04ff472016-06-23 10:29:30 -0700164}
165
166# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
167config("skia_library") {
168 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700169 defines = [ "SKIA_IMPLEMENTATION=1" ]
170}
171
172skia_library_configs = [
173 ":skia_public",
174 ":skia_private",
175 ":skia_library",
176]
177
mtklein9b8583d2016-08-24 17:32:30 -0700178# Use for CPU-specific Skia code that needs particular compiler flags.
179template("opts") {
180 if (invoker.enabled) {
181 source_set(target_name) {
182 forward_variables_from(invoker, "*")
183 configs += skia_library_configs
184 }
185 } else {
186 # If not enabled, a phony empty target that swallows all otherwise unused variables.
187 source_set(target_name) {
188 forward_variables_from(invoker,
189 "*",
190 [
191 "sources",
192 "cflags",
193 ])
194 }
195 }
anmittala7eaf2e2016-08-17 13:57:26 -0700196}
197
mtklein422310d2016-08-16 18:28:43 -0700198is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700199
mtklein7d6fb2c2016-08-25 14:50:44 -0700200opts("none") {
201 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700202 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700203 cflags = []
204}
205
mtklein7d6fb2c2016-08-25 14:50:44 -0700206opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700207 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700208 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700209 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700210}
211
212opts("arm64") {
213 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700215 cflags = []
216}
217
218opts("crc32") {
219 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700221 cflags = [ "-march=armv8-a+crc" ]
222}
223
mtklein9b8583d2016-08-24 17:32:30 -0700224opts("sse2") {
225 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700226 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400227 if (is_win) {
228 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
229 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400230 cflags = [ "-msse2" ]
231 }
mtklein9b8583d2016-08-24 17:32:30 -0700232}
mtkleinc04ff472016-06-23 10:29:30 -0700233
mtklein9b8583d2016-08-24 17:32:30 -0700234opts("ssse3") {
235 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700236 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400237 if (is_win) {
238 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
239 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400240 cflags = [ "-mssse3" ]
241 }
mtklein9b8583d2016-08-24 17:32:30 -0700242}
mtkleinc04ff472016-06-23 10:29:30 -0700243
mtklein9b8583d2016-08-24 17:32:30 -0700244opts("sse41") {
245 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400247 if (is_win) {
248 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
249 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400250 cflags = [ "-msse4.1" ]
251 }
mtklein9b8583d2016-08-24 17:32:30 -0700252}
mtklein4e976072016-08-08 09:06:27 -0700253
mtklein9b8583d2016-08-24 17:32:30 -0700254opts("sse42") {
255 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400257 if (is_win) {
258 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
259 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400260 cflags = [ "-msse4.2" ]
261 }
mtklein9b8583d2016-08-24 17:32:30 -0700262}
263
264opts("avx") {
265 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400267 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000268 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400269 } else {
270 cflags = [ "-mavx" ]
271 }
mtkleinc04ff472016-06-23 10:29:30 -0700272}
273
Mike Klein78d5a3b2016-09-30 10:48:01 -0400274opts("hsw") {
275 enabled = is_x86
276 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400277 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000278 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400279 } else {
280 cflags = [
281 "-mavx2",
282 "-mbmi",
283 "-mbmi2",
284 "-mf16c",
285 "-mfma",
286 ]
287 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400288}
289
mtkleinc095df52016-08-24 12:23:52 -0700290# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700291template("optional") {
292 if (invoker.enabled) {
293 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700294 if (defined(invoker.public_defines)) {
295 defines = invoker.public_defines
296 }
mtklein457b42a2016-08-23 13:56:37 -0700297 }
298 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700299 forward_variables_from(invoker,
300 "*",
301 [
302 "public_defines",
303 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700304 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700305 ])
mtklein457b42a2016-08-23 13:56:37 -0700306 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700307 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700308 if (defined(invoker.configs_to_remove)) {
309 configs -= invoker.configs_to_remove
310 }
mtklein457b42a2016-08-23 13:56:37 -0700311 }
312 } else {
mtklein457b42a2016-08-23 13:56:37 -0700313 source_set(target_name) {
314 forward_variables_from(invoker,
315 "*",
316 [
317 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700318 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700319 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700320 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700321 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700322 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700323 ])
mtkleincd01b032016-08-31 04:58:19 -0700324 if (defined(invoker.sources_when_disabled)) {
325 sources = invoker.sources_when_disabled
326 }
327 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700328 }
mtkleineb3c4252016-08-23 07:38:09 -0700329 }
mtklein457b42a2016-08-23 13:56:37 -0700330}
mtklein457b42a2016-08-23 13:56:37 -0700331
Mike Kleina04bb452017-02-09 12:24:07 -0500332optional("effects") {
333 enabled = skia_enable_effects
334 sources =
335 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
336 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
337}
338
mtkleina45be612016-08-29 15:22:10 -0700339optional("fontmgr_android") {
340 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700341
342 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500343 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700344 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700345 ]
346 sources = [
347 "src/ports/SkFontMgr_android.cpp",
348 "src/ports/SkFontMgr_android_factory.cpp",
349 "src/ports/SkFontMgr_android_parser.cpp",
350 ]
351}
352
mtkleind2e39db2016-09-07 07:52:55 -0700353optional("fontmgr_custom") {
354 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
355
356 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500357 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700358 ]
359 sources = [
360 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500361 "src/ports/SkFontMgr_custom.h",
362 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700363 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500364 "src/ports/SkFontMgr_custom_embedded.cpp",
365 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700366 ]
367}
368
mtklein3cc22182016-08-29 13:26:14 -0700369optional("fontmgr_fontconfig") {
370 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700371
372 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500373 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700374 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700375 ]
376 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700377 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700378 "src/ports/SkFontConfigInterface_direct.cpp",
379 "src/ports/SkFontConfigInterface_direct_factory.cpp",
380 "src/ports/SkFontMgr_FontConfigInterface.cpp",
381 "src/ports/SkFontMgr_fontconfig.cpp",
382 "src/ports/SkFontMgr_fontconfig_factory.cpp",
383 ]
384}
385
mtkleincdedd0e2016-09-12 15:15:44 -0700386optional("fontmgr_fuchsia") {
387 enabled = is_fuchsia && skia_use_freetype
388
389 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500390 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700391 ]
392 sources = [
393 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500394 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700395 "src/ports/SkFontMgr_custom_empty_factory.cpp",
396 ]
397}
398
mtklein06c35c02016-09-20 12:28:12 -0700399optional("gpu") {
400 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700401 public_defines = []
402
Mike Klein29b3e582017-02-09 11:57:32 -0500403 sources = skia_gpu_sources + skia_sksl_sources +
404 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700405
406 # These paths need to be absolute to match the ones produced by shared_sources.gni.
407 sources -= get_path_info([
408 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
409 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
410 ],
411 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400412 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700413 if (is_android) {
414 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
415 } else if (is_linux) {
416 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500417 libs += [
418 "GL",
419 "GLU",
420 ]
mtklein06c35c02016-09-20 12:28:12 -0700421 } else if (is_mac) {
422 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800423 } else if (is_ios) {
424 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400425 } else if (is_win) {
426 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
427 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700428 } else {
429 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
430 }
mtkleine9fb3d52016-09-20 15:11:46 -0700431
432 if (skia_use_vulkan) {
433 public_defines += [ "SK_VULKAN" ]
434 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700435 if (skia_enable_vulkan_debug_layers) {
436 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
437 }
mtkleine9fb3d52016-09-20 15:11:46 -0700438 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400439 if (skia_enable_spirv_validation) {
440 deps = [
441 "//third_party/spirv-tools",
442 ]
443 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
444 }
mtklein06c35c02016-09-20 12:28:12 -0700445}
446
mtklein63213812016-08-24 09:55:56 -0700447optional("jpeg") {
448 enabled = skia_use_libjpeg_turbo
449 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
450
mtklein63213812016-08-24 09:55:56 -0700451 deps = [
452 "//third_party/libjpeg-turbo:libjpeg",
453 ]
454 sources = [
455 "src/codec/SkJpegCodec.cpp",
456 "src/codec/SkJpegDecoderMgr.cpp",
457 "src/codec/SkJpegUtility.cpp",
458 "src/images/SkJPEGImageEncoder.cpp",
459 "src/images/SkJPEGWriteUtility.cpp",
460 ]
461}
462
463optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500464 enabled = skia_use_zlib && skia_enable_pdf
465 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700466
mtklein63213812016-08-24 09:55:56 -0700467 deps = [
468 "//third_party/zlib",
469 ]
brettwb9447282016-09-01 14:24:39 -0700470 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700471 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700472
473 if (skia_use_sfntly) {
474 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500475 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700476 }
477}
478
479optional("png") {
480 enabled = skia_use_libpng
481 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
482
mtklein63213812016-08-24 09:55:56 -0700483 deps = [
484 "//third_party/libpng",
485 ]
486 sources = [
487 "src/codec/SkIcoCodec.cpp",
488 "src/codec/SkPngCodec.cpp",
489 "src/images/SkPNGImageEncoder.cpp",
490 ]
491}
492
scroggof84ad642016-10-31 09:02:57 -0700493optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400494 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700495 public_defines = [ "SK_CODEC_DECODES_RAW" ]
496
497 deps = [
498 "//third_party/dng_sdk",
499 "//third_party/libjpeg-turbo:libjpeg",
500 "//third_party/piex",
501 ]
502
503 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
504 # Skia.
505 configs_to_remove = [ "//gn:no_exceptions" ]
506
507 sources = [
508 "src/codec/SkRawAdapterCodec.cpp",
509 "src/codec/SkRawCodec.cpp",
510 ]
511}
512
Mike Klein2fcd1702017-03-08 18:54:25 +0000513optional("jumper") {
514 enabled = skia_enable_jumper
515 public_defines = [ "SK_JUMPER" ]
516 sources = [
517 "src/jumper/SkJumper.cpp",
518 "src/jumper/SkJumper_generated.cpp",
519 "src/jumper/SkJumper_stages.cpp",
520 ]
521}
522
mtklein3cc22182016-08-29 13:26:14 -0700523optional("typeface_freetype") {
524 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700525
526 deps = [
527 "//third_party/freetype2",
528 ]
529 sources = [
530 "src/ports/SkFontHost_FreeType.cpp",
531 "src/ports/SkFontHost_FreeType_common.cpp",
532 ]
533}
534
mtklein457b42a2016-08-23 13:56:37 -0700535optional("webp") {
536 enabled = skia_use_libwebp
537 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
538
mtklein457b42a2016-08-23 13:56:37 -0700539 deps = [
540 "//third_party/libwebp",
541 ]
542 sources = [
543 "src/codec/SkWebpAdapterCodec.cpp",
544 "src/codec/SkWebpCodec.cpp",
545 "src/images/SkWEBPImageEncoder.cpp",
546 ]
mtkleineb3c4252016-08-23 07:38:09 -0700547}
548
mtklein63213812016-08-24 09:55:56 -0700549optional("xml") {
550 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000551 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700552
mtklein63213812016-08-24 09:55:56 -0700553 deps = [
554 "//third_party/expat",
555 ]
556 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500557 "src/svg/SkSVGCanvas.cpp",
558 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700559 "src/xml/SkDOM.cpp",
560 "src/xml/SkXMLParser.cpp",
561 "src/xml/SkXMLWriter.cpp",
562 ]
563}
564
mtkleinc04ff472016-06-23 10:29:30 -0700565component("skia") {
566 public_configs = [ ":skia_public" ]
567 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700568
569 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700570 ":arm64",
571 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700572 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700573 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500574 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700575 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700576 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700577 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700578 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700579 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400580 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700581 ":jpeg",
Mike Klein2fcd1702017-03-08 18:54:25 +0000582 ":jumper",
mtklein9b8583d2016-08-24 17:32:30 -0700583 ":none",
mtklein63213812016-08-24 09:55:56 -0700584 ":pdf",
585 ":png",
scroggof84ad642016-10-31 09:02:57 -0700586 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700587 ":sse2",
588 ":sse41",
589 ":sse42",
590 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700591 ":webp",
mtklein63213812016-08-24 09:55:56 -0700592 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700593 ]
594
Chinmay Garde43f115c2016-11-16 15:04:12 -0800595 # This file (and all GN files in Skia) are designed to work with an
596 # empty sources assignment filter; we handle all that explicitly.
597 # We clear the filter here for clients who may have set up a global filter.
598 set_sources_assignment_filter([])
599
mtkleinc04ff472016-06-23 10:29:30 -0700600 sources = []
brettwb9447282016-09-01 14:24:39 -0700601 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700602 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500603 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700604 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700605 "src/android/SkBitmapRegionCodec.cpp",
606 "src/android/SkBitmapRegionDecoder.cpp",
607 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700608 "src/codec/SkBmpCodec.cpp",
609 "src/codec/SkBmpMaskCodec.cpp",
610 "src/codec/SkBmpRLECodec.cpp",
611 "src/codec/SkBmpStandardCodec.cpp",
612 "src/codec/SkCodec.cpp",
613 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700614 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700615 "src/codec/SkMaskSwizzler.cpp",
616 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700617 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700618 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700619 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700620 "src/codec/SkSwizzler.cpp",
621 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700622 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700623 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700624 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700625 "src/ports/SkMemory_malloc.cpp",
626 "src/ports/SkOSFile_stdio.cpp",
627 "src/sfnt/SkOTTable_name.cpp",
628 "src/sfnt/SkOTUtils.cpp",
629 "src/utils/mac/SkStream_mac.cpp",
630 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700631 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700632 ]
brettwb9447282016-09-01 14:24:39 -0700633
mtklein7d6fb2c2016-08-25 14:50:44 -0700634 libs = []
635
mtkleinc04ff472016-06-23 10:29:30 -0700636 if (is_win) {
637 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400638 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700639 "src/ports/SkDebug_win.cpp",
640 "src/ports/SkFontHost_win.cpp",
641 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700642 "src/ports/SkImageEncoder_WIC.cpp",
643 "src/ports/SkImageGeneratorWIC.cpp",
644 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700645 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700646 "src/ports/SkScalerContext_win_dw.cpp",
647 "src/ports/SkTLS_win.cpp",
648 "src/ports/SkTypeface_win_dw.cpp",
649 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400650 if (skia_use_gdi) {
651 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
652 libs += [
653 "Gdi32.lib",
654 "Usp10.lib",
655 ]
656 } else {
657 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
658 }
mtkleinb9be9792016-09-16 14:44:18 -0700659 sources -=
660 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400661 libs += [
662 "FontSub.lib",
663 "Ole32.lib",
664 "OleAut32.lib",
665 "User32.lib",
666 ]
mtkleinc04ff472016-06-23 10:29:30 -0700667 } else {
668 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700669 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700670 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700671 "src/ports/SkTLS_pthread.cpp",
672 ]
673 }
674
mtklein7d6fb2c2016-08-25 14:50:44 -0700675 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500676 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500677 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500678 deps += [ "//third_party/cpu-features" ]
679 }
mtklein06c35c02016-09-20 12:28:12 -0700680 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700681 libs += [
682 "EGL",
683 "GLESv2",
684 "log",
685 ]
686 }
687
mtkleinc04ff472016-06-23 10:29:30 -0700688 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700689 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700690 }
691
692 if (is_mac) {
693 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700694 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700695 "src/ports/SkFontHost_mac.cpp",
696 "src/ports/SkImageEncoder_CG.cpp",
697 "src/ports/SkImageGeneratorCG.cpp",
698 ]
mtklein09e61f72016-08-23 13:35:28 -0700699 libs += [
700 "ApplicationServices.framework",
701 "OpenGL.framework",
702 ]
mtkleinc04ff472016-06-23 10:29:30 -0700703 }
abarth6fc8ff02016-07-15 15:15:15 -0700704
Mike Klein7d302882016-11-03 14:06:31 -0400705 if (is_ios) {
706 sources += [
707 "src/ports/SkDebug_stdio.cpp",
708 "src/ports/SkFontHost_mac.cpp",
709 "src/ports/SkImageEncoder_CG.cpp",
710 "src/ports/SkImageGeneratorCG.cpp",
711 ]
712 libs += [
713 "CoreFoundation.framework",
714 "CoreGraphics.framework",
715 "CoreText.framework",
716 "ImageIO.framework",
717 "MobileCoreServices.framework",
718 ]
719 }
720
abarth6fc8ff02016-07-15 15:15:15 -0700721 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700722 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700723 }
mtkleinc04ff472016-06-23 10:29:30 -0700724}
725
mtkleinc095df52016-08-24 12:23:52 -0700726# Targets guarded by skia_enable_tools may use //third_party freely.
727if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500728 # Used by gn_to_bp.py to list our public include dirs.
729 source_set("public") {
730 configs += [ ":skia_public" ]
731 }
732
Mike Kleinc36dedf2016-11-18 09:35:28 -0500733 config("skia.h_config") {
734 include_dirs = [ "$target_gen_dir" ]
735 }
736 action("skia.h") {
737 public_configs = [ ":skia.h_config" ]
738 skia_h = "$target_gen_dir/skia.h"
739 script = "gn/find_headers.py"
740 args = [ rebase_path(skia_h, root_build_dir) ] +
741 rebase_path(skia_public_includes)
742 depfile = "$skia_h.deps"
743 outputs = [
744 skia_h,
745 ]
746 }
747
748 if (skia_enable_gpu && target_cpu == "x64") {
749 # Our bots only have 64-bit libOSMesa installed.
750 # TODO: worth fixing?
751 executable("fiddle") {
752 libs = []
753 if (is_linux) {
754 libs += [ "OSMesa" ]
755 }
756
757 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500758 "tools/fiddle/draw.cpp",
759 "tools/fiddle/fiddle_main.cpp",
760 ]
761 deps = [
762 ":skia",
763 ":skia.h",
764 ]
765 }
766 }
767
768 if (skia_enable_gpu) {
769 source_set("public_headers_warnings_check") {
770 sources = [
771 "tools/public_headers_warnings_check.cpp",
772 ]
773 configs -= [ "//gn:warnings_except_public_headers" ]
774 deps = [
775 ":skia",
776 ":skia.h",
777 ]
778 }
779 }
780
mtkleinc095df52016-08-24 12:23:52 -0700781 template("test_lib") {
782 config(target_name + "_config") {
783 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700784 if (defined(invoker.public_defines)) {
785 defines = invoker.public_defines
786 }
mtklein25c81d42016-07-27 13:55:26 -0700787 }
mtkleinc095df52016-08-24 12:23:52 -0700788 source_set(target_name) {
789 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
790 public_configs = [
791 ":" + target_name + "_config",
792 ":skia_private",
793 ]
794
795 if (!defined(deps)) {
796 deps = []
797 }
798 deps += [ ":skia" ]
799 testonly = true
800 }
mtklein25c81d42016-07-27 13:55:26 -0700801 }
mtklein25c81d42016-07-27 13:55:26 -0700802
Mike Kleine6682eb2017-01-05 10:54:57 -0500803 template("test_app") {
804 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
805 shared_library("lib" + target_name) {
806 forward_variables_from(invoker, "*", [ "is_shared_library" ])
807 testonly = true
808 }
809 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500810 _executable = target_name
811 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500812 forward_variables_from(invoker, "*", [ "is_shared_library" ])
813 testonly = true
814 }
815 }
Mike Klein7d921032017-01-05 12:20:41 -0500816 if (is_android && skia_android_serial != "" && defined(_executable)) {
817 action("push_" + target_name) {
818 script = "gn/push_to_android.py"
819 deps = [
820 ":" + _executable,
821 ]
822 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
823 outputs = [
824 _stamp,
825 ]
826 args = [
827 rebase_path("$root_build_dir/$_executable"),
828 skia_android_serial,
829 rebase_path(_stamp),
830 ]
831 testonly = true
832 }
833 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500834 }
835
mtkleinc095df52016-08-24 12:23:52 -0700836 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700837 public_include_dirs = []
838 if (skia_enable_gpu) {
839 public_defines = []
840 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700841
842 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700843 sources = [
844 "tools/gpu/GrContextFactory.cpp",
845 "tools/gpu/GrTest.cpp",
846 "tools/gpu/TestContext.cpp",
847 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700848 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700849 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
850 "tools/gpu/gl/debug/GrBufferObj.cpp",
851 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
852 "tools/gpu/gl/debug/GrProgramObj.cpp",
853 "tools/gpu/gl/debug/GrShaderObj.cpp",
854 "tools/gpu/gl/debug/GrTextureObj.cpp",
855 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
856 "tools/gpu/gl/null/NullGLTestContext.cpp",
857 ]
858 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700859
mtklein38925aa2016-09-21 10:11:25 -0700860 if (is_android) {
861 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400862 } else if (is_ios) {
863 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
864 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700865 } else if (is_linux) {
866 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500867 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700868 } else if (is_mac) {
869 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400870 } else if (is_win) {
871 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
872 libs += [
873 "Gdi32.lib",
874 "OpenGL32.lib",
875 ]
mtklein38925aa2016-09-21 10:11:25 -0700876 }
mtklein6ef69992016-09-14 06:12:09 -0700877
Mike Kleinc168a3a2016-11-14 14:53:13 +0000878 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000879 deps += [ "//third_party/angle2" ]
880 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
881 }
mtklein38925aa2016-09-21 10:11:25 -0700882 if (skia_use_mesa) {
883 public_defines += [ "SK_MESA" ]
884 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
885 libs += [ "OSMesa" ]
886 }
mtkleind68f9b02016-09-23 13:18:41 -0700887 if (skia_use_vulkan) {
888 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
889 }
mtkleina627b5c2016-09-20 13:36:47 -0700890 }
mtklein25c81d42016-07-27 13:55:26 -0700891 }
mtklein25c81d42016-07-27 13:55:26 -0700892
mtkleinc095df52016-08-24 12:23:52 -0700893 test_lib("flags") {
894 public_include_dirs = [ "tools/flags" ]
895 sources = [
896 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700897 ]
898 }
899 test_lib("common_flags") {
900 public_include_dirs = [ "tools/flags" ]
901 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700902 "tools/flags/SkCommonFlags.cpp",
903 "tools/flags/SkCommonFlagsConfig.cpp",
904 ]
905 deps = [
mtklein046cb562016-09-16 10:23:12 -0700906 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700907 ":gpu_tool_utils",
908 ]
909 }
mtklein25c81d42016-07-27 13:55:26 -0700910
mtkleinc095df52016-08-24 12:23:52 -0700911 test_lib("tool_utils") {
912 public_include_dirs = [
913 "tools",
914 "tools/debugger",
915 "tools/timer",
916 ]
917 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700918 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700919 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700920 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700921 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700922 "tools/ProcStats.cpp",
923 "tools/Resources.cpp",
924 "tools/ThermalManager.cpp",
925 "tools/UrlDataManager.cpp",
926 "tools/debugger/SkDebugCanvas.cpp",
927 "tools/debugger/SkDrawCommand.cpp",
928 "tools/debugger/SkJsonWriteBuffer.cpp",
929 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700930 "tools/picture_utils.cpp",
931 "tools/random_parse_path.cpp",
932 "tools/sk_tool_utils.cpp",
933 "tools/sk_tool_utils_font.cpp",
934 "tools/timer/Timer.cpp",
935 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500936 libs = []
937 if (is_ios) {
938 sources += [ "tools/ios_utils.m" ]
939 libs += [ "Foundation.framework" ]
940 }
mtkleinc095df52016-08-24 12:23:52 -0700941 deps = [
mtklein046cb562016-09-16 10:23:12 -0700942 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700943 ":flags",
944 "//third_party/libpng",
945 ]
946 public_deps = [
947 "//third_party/jsoncpp",
948 ]
949 }
mtklein25c81d42016-07-27 13:55:26 -0700950
Mike Klein6e744122016-10-27 12:21:40 -0400951 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700952 test_lib("gm") {
953 public_include_dirs = [ "gm" ]
954 sources = gm_sources
955 deps = [
scroggo19b91532016-10-24 09:03:26 -0700956 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700957 ":gpu_tool_utils",
958 ":skia",
959 ":tool_utils",
960 ]
961 }
mtklein25c81d42016-07-27 13:55:26 -0700962
Mike Klein6e744122016-10-27 12:21:40 -0400963 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700964 test_lib("tests") {
965 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400966 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700967 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400968 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700969 }
mtkleinc095df52016-08-24 12:23:52 -0700970 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700971 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700972 ":flags",
973 ":gpu_tool_utils",
974 ":skia",
975 ":tool_utils",
976 "//third_party/libpng",
977 "//third_party/zlib",
978 ]
979 }
mtklein2f3416d2016-08-02 16:02:05 -0700980
Mike Klein6e744122016-10-27 12:21:40 -0400981 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700982 test_lib("bench") {
983 public_include_dirs = [ "bench" ]
984 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700985 deps = [
986 ":flags",
987 ":gm",
988 ":gpu_tool_utils",
989 ":skia",
990 ":tool_utils",
991 ]
992 }
mtklein2b6870c2016-07-28 14:17:33 -0700993
mtkleinc095df52016-08-24 12:23:52 -0700994 test_lib("experimental_svg_model") {
995 public_include_dirs = [ "experimental/svg/model" ]
996 sources = [
997 "experimental/svg/model/SkSVGAttribute.cpp",
998 "experimental/svg/model/SkSVGAttributeParser.cpp",
999 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001000 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001001 "experimental/svg/model/SkSVGContainer.cpp",
1002 "experimental/svg/model/SkSVGDOM.cpp",
1003 "experimental/svg/model/SkSVGEllipse.cpp",
1004 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001005 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001006 "experimental/svg/model/SkSVGNode.cpp",
1007 "experimental/svg/model/SkSVGPath.cpp",
1008 "experimental/svg/model/SkSVGPoly.cpp",
1009 "experimental/svg/model/SkSVGRect.cpp",
1010 "experimental/svg/model/SkSVGRenderContext.cpp",
1011 "experimental/svg/model/SkSVGSVG.cpp",
1012 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001013 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001014 "experimental/svg/model/SkSVGTransformableNode.cpp",
1015 "experimental/svg/model/SkSVGValue.cpp",
1016 ]
1017 deps = [
1018 ":skia",
1019 ]
1020 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001021
Brian Osman16adfa32016-10-18 14:42:44 -04001022 test_lib("views") {
1023 public_include_dirs = [ "include/views" ]
1024 sources = [
1025 "src/views/SkEvent.cpp",
1026 "src/views/SkEventSink.cpp",
1027 "src/views/SkOSMenu.cpp",
1028 "src/views/SkTagList.cpp",
1029 "src/views/SkTouchGesture.cpp",
1030 "src/views/SkView.cpp",
1031 "src/views/SkViewPriv.cpp",
1032 ]
1033 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001034 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001035 if (!is_android) {
1036 sources += [ "src/views/SkWindow.cpp" ]
1037 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001038 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001039 public_include_dirs += [ "src/views/unix" ]
1040 sources += [
1041 "src/views/unix/SkOSWindow_Unix.cpp",
1042 "src/views/unix/keysym2ucs.c",
1043 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001044 libs += [
1045 "GL",
1046 "X11",
1047 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001048 } else if (is_mac) {
1049 sources += [
1050 "src/views/mac/SkEventNotifier.mm",
1051 "src/views/mac/SkNSView.mm",
1052 "src/views/mac/SkOSWindow_Mac.mm",
1053 "src/views/mac/SkTextFieldCell.m",
1054 ]
1055 libs += [
1056 "QuartzCore.framework",
1057 "Cocoa.framework",
1058 "Foundation.framework",
1059 ]
1060 } else if (is_win) {
1061 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1062 }
Brian Osman34755e22016-12-05 09:46:02 -05001063 if (skia_use_angle) {
1064 deps += [ "//third_party/angle2" ]
1065 }
Brian Osman16adfa32016-10-18 14:42:44 -04001066 }
1067
Mike Klein38af9432016-11-11 11:39:44 -05001068 if (skia_use_lua) {
1069 test_lib("lua") {
1070 public_include_dirs = []
1071 sources = [
1072 "src/utils/SkLua.cpp",
1073 "src/utils/SkLuaCanvas.cpp",
1074 ]
1075 deps = [
1076 "//third_party/lua",
1077 ]
1078 }
1079
Mike Kleine6682eb2017-01-05 10:54:57 -05001080 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001081 sources = [
1082 "tools/lua/lua_app.cpp",
1083 ]
1084 deps = [
1085 ":lua",
1086 ":skia",
1087 "//third_party/lua",
1088 ]
Mike Klein38af9432016-11-11 11:39:44 -05001089 }
1090
Mike Kleine6682eb2017-01-05 10:54:57 -05001091 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001092 sources = [
1093 "tools/lua/lua_pictures.cpp",
1094 ]
1095 deps = [
1096 ":flags",
1097 ":lua",
1098 ":skia",
1099 ":tool_utils",
1100 "//third_party/lua",
1101 ]
Mike Klein38af9432016-11-11 11:39:44 -05001102 }
1103 }
1104
Mike Klein6e744122016-10-27 12:21:40 -04001105 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001106 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001107 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001108 include_dirs = [ "experimental" ]
1109 sources = samples_sources + [
1110 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1111 "experimental/SkSetPoly3To3.cpp",
1112 "experimental/SkSetPoly3To3_A.cpp",
1113 "experimental/SkSetPoly3To3_D.cpp",
1114 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001115 deps = [
1116 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001117 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001118 ":tool_utils",
1119 ":views",
1120 ":xml",
1121 ]
Mike Klein38af9432016-11-11 11:39:44 -05001122
1123 if (skia_use_lua) {
1124 sources += [ "samplecode/SampleLua.cpp" ]
1125 deps += [
1126 ":lua",
1127 "//third_party/lua",
1128 ]
1129 }
Brian Osman16adfa32016-10-18 14:42:44 -04001130 }
1131
Mike Kleine6682eb2017-01-05 10:54:57 -05001132 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001133 sources = [
1134 "dm/DM.cpp",
1135 "dm/DMJsonWriter.cpp",
1136 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001137 ]
1138 include_dirs = [ "tests" ]
1139 deps = [
mtklein046cb562016-09-16 10:23:12 -07001140 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001141 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001142 ":flags",
1143 ":gm",
1144 ":gpu_tool_utils",
1145 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001146 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001147 ":tool_utils",
1148 "//third_party/jsoncpp",
1149 "//third_party/libpng",
1150 ]
mtklein2b6870c2016-07-28 14:17:33 -07001151 }
1152
Mike Kleina3430172016-09-27 16:46:29 -04001153 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001154 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001155 sources = [
1156 "tools/monobench.cpp",
1157 ]
1158 deps = [
1159 ":bench",
1160 ":skia",
1161 ]
Mike Kleina3430172016-09-27 16:46:29 -04001162 }
mtklein2b6870c2016-07-28 14:17:33 -07001163 }
1164
Mike Kleine6682eb2017-01-05 10:54:57 -05001165 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001166 sources = [
1167 "bench/nanobench.cpp",
1168 ]
1169 deps = [
1170 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001171 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001172 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001173 ":flags",
1174 ":gm",
1175 ":gpu_tool_utils",
1176 ":skia",
1177 ":tool_utils",
1178 "//third_party/jsoncpp",
1179 ]
mtklein2b6870c2016-07-28 14:17:33 -07001180 }
halcanary19a97202016-08-03 15:08:04 -07001181
Ravi Mistry10d36c52017-01-31 09:49:18 -05001182 test_app("skpinfo") {
1183 sources = [
1184 "tools/skpinfo.cpp",
1185 ]
1186 deps = [
1187 ":flags",
1188 ":skia",
1189 ]
1190 }
1191
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001192 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001193 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001194 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001195 "samplecode/SampleApp.cpp",
1196 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001197 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001198 if (is_mac) {
1199 sources += [ "src/views/mac/skia_mac.mm" ]
1200 } else if (is_win) {
1201 sources += [ "src/views/win/skia_win.cpp" ]
1202 } else if (is_linux) {
1203 sources += [ "src/views/unix/skia_unix.cpp" ]
1204 }
mtklein38925aa2016-09-21 10:11:25 -07001205 deps = [
1206 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001207 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001208 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001209 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001210 ":skia",
1211 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001212 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001213 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001214 if (skia_use_angle) {
1215 deps += [ "//third_party/angle2" ]
1216 }
mtklein38925aa2016-09-21 10:11:25 -07001217 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001218 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001219
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001220 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001221 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001222 sources = [
1223 "tools/skpbench/skpbench.cpp",
1224 ]
1225 deps = [
1226 ":flags",
1227 ":gpu_tool_utils",
1228 ":skia",
1229 ":tool_utils",
1230 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001231 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001232 }
1233
Mike Klein7d302882016-11-03 14:06:31 -04001234 # We can't yet build ICU on iOS or Windows.
1235 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001236 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001237 sources = [
1238 "tools/SkShaper_harfbuzz.cpp",
1239 "tools/using_skia_and_harfbuzz.cpp",
1240 ]
1241 deps = [
1242 ":skia",
1243 "//third_party/harfbuzz",
1244 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001245 }
halcanary19a97202016-08-03 15:08:04 -07001246 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001247 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001248 sources = [
1249 "tools/SkShaper_primitive.cpp",
1250 "tools/using_skia_and_harfbuzz.cpp",
1251 ]
1252 deps = [
1253 ":skia",
1254 ]
halcanary3eee9d92016-09-10 07:01:53 -07001255 }
mtklein046cb562016-09-16 10:23:12 -07001256
Mike Kleine6682eb2017-01-05 10:54:57 -05001257 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001258 sources = [
1259 "tools/get_images_from_skps.cpp",
1260 ]
1261 deps = [
1262 ":flags",
1263 ":skia",
1264 "//third_party/jsoncpp",
1265 ]
mtklein046cb562016-09-16 10:23:12 -07001266 }
mtkleinecbc5262016-09-22 11:51:24 -07001267
Mike Kleine6682eb2017-01-05 10:54:57 -05001268 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001269 sources = [
1270 "tools/colorspaceinfo.cpp",
1271 ]
1272 deps = [
1273 ":flags",
1274 ":skia",
1275 ":tool_utils",
1276 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001277 }
1278
Mike Klein7d302882016-11-03 14:06:31 -04001279 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001280 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001281 sources = [
1282 "tools/skiaserve/Request.cpp",
1283 "tools/skiaserve/Response.cpp",
1284 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001285 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1286 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1287 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1288 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1289 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1290 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1291 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1292 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1293 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001294 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1295 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001296 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1297 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1298 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1299 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1300 ]
1301 deps = [
1302 ":flags",
1303 ":gpu_tool_utils",
1304 ":skia",
1305 ":tool_utils",
1306 "//third_party/jsoncpp",
1307 "//third_party/libmicrohttpd",
1308 "//third_party/libpng",
1309 ]
Mike Klein7d302882016-11-03 14:06:31 -04001310 }
mtkleinecbc5262016-09-22 11:51:24 -07001311 }
kjlubick14f984b2016-10-03 11:49:45 -07001312
Mike Kleine6682eb2017-01-05 10:54:57 -05001313 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001314 sources = [
1315 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001316 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001317 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001318 "fuzz/FuzzGradients.cpp",
1319 "fuzz/FuzzParsePath.cpp",
1320 "fuzz/FuzzPathop.cpp",
1321 "fuzz/FuzzScaleToSides.cpp",
1322 "fuzz/fuzz.cpp",
1323 ]
1324 deps = [
1325 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001326 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001327 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001328 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001329 ]
kjlubick14f984b2016-10-03 11:49:45 -07001330 }
Mike Klein38312422016-10-05 15:41:01 -04001331
Mike Kleine6682eb2017-01-05 10:54:57 -05001332 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001333 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001334 rebase_path("tests/skia_test.cpp"),
1335 rebase_path("tests/Test.cpp"),
1336 ]
caryclark9feb6322016-10-25 08:58:26 -07001337 deps = [
1338 ":flags",
1339 ":gpu_tool_utils",
1340 ":skia",
1341 ":tool_utils",
1342 ]
caryclark9feb6322016-10-25 08:58:26 -07001343 }
1344
Mike Kleine6682eb2017-01-05 10:54:57 -05001345 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001346 sources = [
1347 "tools/DumpRecord.cpp",
1348 "tools/dump_record.cpp",
1349 ]
1350 deps = [
1351 ":flags",
1352 ":skia",
1353 ]
Mike Klein38312422016-10-05 15:41:01 -04001354 }
bungemanfe917272016-10-13 17:36:40 -04001355
Mike Kleine6682eb2017-01-05 10:54:57 -05001356 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001357 sources = [
1358 "tools/skdiff/skdiff.cpp",
1359 "tools/skdiff/skdiff_html.cpp",
1360 "tools/skdiff/skdiff_main.cpp",
1361 "tools/skdiff/skdiff_utils.cpp",
1362 ]
1363 deps = [
1364 ":skia",
1365 ":tool_utils",
1366 ]
bungemanfe917272016-10-13 17:36:40 -04001367 }
halcanarya73d76a2016-10-17 13:19:02 -07001368
Mike Kleine6682eb2017-01-05 10:54:57 -05001369 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001370 sources = [
1371 "tools/skp_parser.cpp",
1372 ]
1373 deps = [
1374 ":skia",
1375 ":tool_utils",
1376 "//third_party/jsoncpp",
1377 ]
halcanarya73d76a2016-10-17 13:19:02 -07001378 }
Brian Osman16adfa32016-10-18 14:42:44 -04001379
Mike Kleina92c3832016-12-08 09:49:39 -05001380 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001381 test_app("viewer") {
1382 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001383 sources = [
1384 "tools/viewer/GMSlide.cpp",
1385 "tools/viewer/ImageSlide.cpp",
1386 "tools/viewer/SKPSlide.cpp",
1387 "tools/viewer/SampleSlide.cpp",
1388 "tools/viewer/Viewer.cpp",
1389 "tools/viewer/sk_app/CommandSet.cpp",
1390 "tools/viewer/sk_app/GLWindowContext.cpp",
1391 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001392 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001393 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001394
Jim Van Verth4e56a912016-10-21 10:58:52 -04001395 if (is_android) {
1396 sources += [
1397 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1398 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1399 "tools/viewer/sk_app/android/Window_android.cpp",
1400 "tools/viewer/sk_app/android/main_android.cpp",
1401 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1402 ]
Brian Osman462334e2017-02-09 11:22:57 -05001403 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001404 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001405 sources += [
1406 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1407 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1408 "tools/viewer/sk_app/unix/Window_unix.cpp",
1409 "tools/viewer/sk_app/unix/main_unix.cpp",
1410 ]
1411 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001412 sources += [
1413 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1414 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1415 "tools/viewer/sk_app/win/Window_win.cpp",
1416 "tools/viewer/sk_app/win/main_win.cpp",
1417 ]
Mike Klein43c25262016-10-20 10:17:47 -04001418 } else if (is_mac) {
1419 sources += [
1420 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1421 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1422 "tools/viewer/sk_app/mac/Window_mac.cpp",
1423 "tools/viewer/sk_app/mac/main_mac.cpp",
1424 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001425 }
1426
1427 if (skia_use_vulkan) {
1428 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001429 if (is_android) {
1430 sources +=
1431 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001432 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001433 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1434 libs += [ "X11-xcb" ]
1435 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001436 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1437 }
1438 }
1439
1440 include_dirs = []
1441 deps = [
1442 ":flags",
1443 ":gm",
1444 ":gpu_tool_utils",
1445 ":samples",
1446 ":skia",
1447 ":tool_utils",
1448 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001449 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001450 "//third_party/jsoncpp",
1451 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001452 if (is_android) {
1453 deps += [ "//third_party/native_app_glue" ]
1454 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001455 deps += [ "//third_party/libsdl" ]
1456 }
Mike Kleina92c3832016-12-08 09:49:39 -05001457 }
Brian Osman16adfa32016-10-18 14:42:44 -04001458 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001459
Mike Kleine459afd2017-03-03 09:21:30 -05001460 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001461 copy("gdbserver") {
1462 sources = [
1463 "$ndk/$ndk_gdbserver",
1464 ]
1465 outputs = [
1466 "$root_out_dir/gdbserver",
1467 ]
1468 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001469 }
1470
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001471 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001472 test_app("skslc") {
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001473 sources = [
1474 "src/sksl/SkSLMain.cpp",
1475 ]
1476 deps = [
1477 ":flags",
1478 ":skia",
1479 ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001480 }
1481 }
mtklein25c81d42016-07-27 13:55:26 -07001482}