blob: f700ac6f7050c2ad7350a4b540fc31797bc08035 [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
Kevin Lubick4a24e102017-03-29 11:19:01 -040016 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070017 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070018 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070019 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040020 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040021 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070022 skia_use_libjpeg_turbo = true
23 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070024 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050025 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070026 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040027 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070028 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070029
Mike Klein7d921032017-01-05 12:20:41 -050030 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070031 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050032 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050033 skia_enable_effects = true
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")
Michael Jurkada3e5962017-04-14 17:44:09 -070040 skia_link_with_vulkan = !is_fuchsia
mtkleinc04ff472016-06-23 10:29:30 -070041}
Brian Salomon23d73ea2016-10-27 13:31:37 -040042declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040043 skia_use_dng_sdk = !is_fuchsia && 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 }
Michael Jurka3251ed82017-04-05 09:52:55 -070051 if (is_win) {
52 skia_vulkan_headers_path = "$skia_vulkan_sdk/Include"
53 } else {
54 skia_vulkan_headers_path = "$skia_vulkan_sdk/include"
55 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040056}
Brian Salomon789e25e2016-09-30 13:41:03 -040057
mtklein38925aa2016-09-21 10:11:25 -070058# Our tools require static linking (they use non-exported symbols).
59skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070060
mtkleina45be612016-08-29 15:22:10 -070061fontmgr_android_enabled = skia_use_expat && skia_use_freetype
62
mtklein1211e0c2016-07-26 13:55:45 -070063skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070064 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070065 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070066 "include/codec",
67 "include/config",
68 "include/core",
69 "include/effects",
70 "include/gpu",
71 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070072 "include/pathops",
73 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070074 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070075 "include/utils",
76 "include/utils/mac",
Greg Daniel50130e42017-04-12 13:29:50 -040077 skia_vulkan_headers_path,
mtklein1211e0c2016-07-26 13:55:45 -070078]
79
mtkleinc04ff472016-06-23 10:29:30 -070080# Skia public API, generally provided by :skia.
81config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070082 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040083 defines = []
84 if (is_component_build) {
85 defines += [ "SKIA_DLL" ]
86 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040087 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070088 defines += [ "SK_SAMPLES_FOR_X" ]
89 }
mtkleincae1be52016-09-20 08:24:34 -070090 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040091 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070092 }
mtklein06c35c02016-09-20 12:28:12 -070093 if (!skia_enable_gpu) {
94 defines += [ "SK_SUPPORT_GPU=0" ]
95 }
mtkleinc04ff472016-06-23 10:29:30 -070096}
97
98# Skia internal APIs, used by Skia itself and a few test tools.
99config("skia_private") {
100 visibility = [ ":*" ]
101
102 include_dirs = [
103 "include/private",
104 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700106 "src/core",
107 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700108 "src/effects/gradients",
109 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "src/image",
111 "src/images",
112 "src/lazy",
113 "src/opts",
114 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700115 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700116 "src/ports",
117 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700118 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700119 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700120 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500121 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700122 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700123 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700124 ]
mtklein150d1132016-08-01 06:56:40 -0700125
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400126 defines = [
127 "SK_GAMMA_APPLY_TO_A8",
128 "SK_INTERNAL",
129 ]
mtkleinb37c0342016-09-09 11:07:45 -0700130 if (is_android) {
131 defines += [
132 "SK_GAMMA_EXPONENT=1.4",
133 "SK_GAMMA_CONTRAST=0.0",
134 ]
135 }
mtklein88a7ac02016-09-14 11:16:49 -0700136 if (is_official_build || is_android) {
137 # TODO(bsalomon): it'd be nice to make Android normal.
138 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
139 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400140 libs = []
141 lib_dirs = []
142 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700143 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400144 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400145 lib_dirs += [
146 "$skia_vulkan_sdk/Bin",
147 "$skia_vulkan_sdk/Lib",
148 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400149 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400150 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400151 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400152 }
Michael Jurka3251ed82017-04-05 09:52:55 -0700153
154 if (skia_link_with_vulkan) {
155 defines += [ "SK_LINK_WITH_VULKAN" ]
156 if (is_win) {
157 libs += [ "vulkan-1.lib" ]
158 } else {
159 libs += [ "vulkan" ]
160 }
Mike Klein487bfc22016-10-14 14:04:56 -0400161 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400162 }
Brian Salomon03e05842017-02-23 12:23:47 -0500163 if (skia_enable_gpu) {
164 include_dirs += [ "src/gpu" ]
165 }
Brian Osman34755e22016-12-05 09:46:02 -0500166 if (skia_use_angle) {
167 defines += [ "SK_ANGLE" ]
168 }
Brian Osman3f375d02016-12-28 11:19:22 -0500169 if (skia_enable_discrete_gpu) {
170 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
171 }
mtkleinc04ff472016-06-23 10:29:30 -0700172}
173
174# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
175config("skia_library") {
176 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700177 defines = [ "SKIA_IMPLEMENTATION=1" ]
178}
179
180skia_library_configs = [
181 ":skia_public",
182 ":skia_private",
183 ":skia_library",
184]
185
mtklein9b8583d2016-08-24 17:32:30 -0700186# Use for CPU-specific Skia code that needs particular compiler flags.
187template("opts") {
188 if (invoker.enabled) {
189 source_set(target_name) {
190 forward_variables_from(invoker, "*")
191 configs += skia_library_configs
192 }
193 } else {
194 # If not enabled, a phony empty target that swallows all otherwise unused variables.
195 source_set(target_name) {
196 forward_variables_from(invoker,
197 "*",
198 [
199 "sources",
200 "cflags",
201 ])
202 }
203 }
anmittala7eaf2e2016-08-17 13:57:26 -0700204}
205
mtklein422310d2016-08-16 18:28:43 -0700206is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700207
mtklein7d6fb2c2016-08-25 14:50:44 -0700208opts("none") {
209 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700211 cflags = []
212}
213
mtklein7d6fb2c2016-08-25 14:50:44 -0700214opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700215 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700216 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700217 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700218}
219
220opts("arm64") {
221 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700222 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700223 cflags = []
224}
225
226opts("crc32") {
227 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700228 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700229 cflags = [ "-march=armv8-a+crc" ]
230}
231
mtklein9b8583d2016-08-24 17:32:30 -0700232opts("sse2") {
233 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700234 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400235 if (is_win) {
236 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
237 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400238 cflags = [ "-msse2" ]
239 }
mtklein9b8583d2016-08-24 17:32:30 -0700240}
mtkleinc04ff472016-06-23 10:29:30 -0700241
mtklein9b8583d2016-08-24 17:32:30 -0700242opts("ssse3") {
243 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400245 if (is_win) {
246 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
247 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400248 cflags = [ "-mssse3" ]
249 }
mtklein9b8583d2016-08-24 17:32:30 -0700250}
mtkleinc04ff472016-06-23 10:29:30 -0700251
mtklein9b8583d2016-08-24 17:32:30 -0700252opts("sse41") {
253 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700254 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400255 if (is_win) {
256 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
257 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400258 cflags = [ "-msse4.1" ]
259 }
mtklein9b8583d2016-08-24 17:32:30 -0700260}
mtklein4e976072016-08-08 09:06:27 -0700261
mtklein9b8583d2016-08-24 17:32:30 -0700262opts("sse42") {
263 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400265 if (is_win) {
266 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
267 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400268 cflags = [ "-msse4.2" ]
269 }
mtklein9b8583d2016-08-24 17:32:30 -0700270}
271
272opts("avx") {
273 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700274 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400275 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000276 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400277 } else {
278 cflags = [ "-mavx" ]
279 }
mtkleinc04ff472016-06-23 10:29:30 -0700280}
281
Mike Klein78d5a3b2016-09-30 10:48:01 -0400282opts("hsw") {
283 enabled = is_x86
284 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400285 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000286 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400287 } else {
288 cflags = [
289 "-mavx2",
290 "-mbmi",
291 "-mbmi2",
292 "-mf16c",
293 "-mfma",
294 ]
295 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400296}
297
mtkleinc095df52016-08-24 12:23:52 -0700298# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700299template("optional") {
300 if (invoker.enabled) {
301 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700302 if (defined(invoker.public_defines)) {
303 defines = invoker.public_defines
304 }
mtklein457b42a2016-08-23 13:56:37 -0700305 }
306 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700307 forward_variables_from(invoker,
308 "*",
309 [
310 "public_defines",
311 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700312 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700313 ])
mtklein457b42a2016-08-23 13:56:37 -0700314 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700315 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700316 if (defined(invoker.configs_to_remove)) {
317 configs -= invoker.configs_to_remove
318 }
mtklein457b42a2016-08-23 13:56:37 -0700319 }
320 } else {
mtklein457b42a2016-08-23 13:56:37 -0700321 source_set(target_name) {
322 forward_variables_from(invoker,
323 "*",
324 [
325 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700326 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700327 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700328 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700329 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700330 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700331 ])
mtkleincd01b032016-08-31 04:58:19 -0700332 if (defined(invoker.sources_when_disabled)) {
333 sources = invoker.sources_when_disabled
334 }
335 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700336 }
mtkleineb3c4252016-08-23 07:38:09 -0700337 }
mtklein457b42a2016-08-23 13:56:37 -0700338}
mtklein457b42a2016-08-23 13:56:37 -0700339
Mike Kleina04bb452017-02-09 12:24:07 -0500340optional("effects") {
341 enabled = skia_enable_effects
342 sources =
343 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
344 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
345}
346
mtkleina45be612016-08-29 15:22:10 -0700347optional("fontmgr_android") {
348 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700349
350 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500351 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700352 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700353 ]
354 sources = [
355 "src/ports/SkFontMgr_android.cpp",
356 "src/ports/SkFontMgr_android_factory.cpp",
357 "src/ports/SkFontMgr_android_parser.cpp",
358 ]
359}
360
mtkleind2e39db2016-09-07 07:52:55 -0700361optional("fontmgr_custom") {
362 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
363
364 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500365 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700366 ]
367 sources = [
368 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500369 "src/ports/SkFontMgr_custom.h",
370 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700371 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500372 "src/ports/SkFontMgr_custom_embedded.cpp",
373 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700374 ]
375}
376
mtklein3cc22182016-08-29 13:26:14 -0700377optional("fontmgr_fontconfig") {
378 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700382 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700383 ]
384 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700385 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700386 "src/ports/SkFontConfigInterface_direct.cpp",
387 "src/ports/SkFontConfigInterface_direct_factory.cpp",
388 "src/ports/SkFontMgr_FontConfigInterface.cpp",
389 "src/ports/SkFontMgr_fontconfig.cpp",
390 "src/ports/SkFontMgr_fontconfig_factory.cpp",
391 ]
392}
393
mtkleincdedd0e2016-09-12 15:15:44 -0700394optional("fontmgr_fuchsia") {
395 enabled = is_fuchsia && skia_use_freetype
396
397 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500398 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700399 ]
400 sources = [
401 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500402 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700403 "src/ports/SkFontMgr_custom_empty_factory.cpp",
404 ]
405}
406
mtklein06c35c02016-09-20 12:28:12 -0700407optional("gpu") {
408 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700409 public_defines = []
410
Mike Klein29b3e582017-02-09 11:57:32 -0500411 sources = skia_gpu_sources + skia_sksl_sources +
412 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700413
414 # These paths need to be absolute to match the ones produced by shared_sources.gni.
415 sources -= get_path_info([
416 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
417 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
418 ],
419 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400420 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700421 if (is_android) {
422 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400423 } else if (skia_use_egl) {
424 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
425 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700426 } else if (is_linux) {
427 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500428 libs += [
429 "GL",
430 "GLU",
431 ]
mtklein06c35c02016-09-20 12:28:12 -0700432 } else if (is_mac) {
433 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800434 } else if (is_ios) {
435 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400436 } else if (is_win) {
437 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
438 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700439 } else {
440 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
441 }
mtkleine9fb3d52016-09-20 15:11:46 -0700442
443 if (skia_use_vulkan) {
444 public_defines += [ "SK_VULKAN" ]
445 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700446 if (skia_enable_vulkan_debug_layers) {
447 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
448 }
mtkleine9fb3d52016-09-20 15:11:46 -0700449 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400450 if (skia_enable_spirv_validation) {
451 deps = [
452 "//third_party/spirv-tools",
453 ]
454 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
455 }
mtklein06c35c02016-09-20 12:28:12 -0700456}
457
mtklein63213812016-08-24 09:55:56 -0700458optional("jpeg") {
459 enabled = skia_use_libjpeg_turbo
460 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
461
mtklein63213812016-08-24 09:55:56 -0700462 deps = [
463 "//third_party/libjpeg-turbo:libjpeg",
464 ]
465 sources = [
466 "src/codec/SkJpegCodec.cpp",
467 "src/codec/SkJpegDecoderMgr.cpp",
468 "src/codec/SkJpegUtility.cpp",
469 "src/images/SkJPEGImageEncoder.cpp",
470 "src/images/SkJPEGWriteUtility.cpp",
471 ]
472}
473
474optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500475 enabled = skia_use_zlib && skia_enable_pdf
476 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700477
mtklein63213812016-08-24 09:55:56 -0700478 deps = [
479 "//third_party/zlib",
480 ]
brettwb9447282016-09-01 14:24:39 -0700481 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700482 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700483
484 if (skia_use_sfntly) {
485 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500486 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700487 }
488}
489
490optional("png") {
491 enabled = skia_use_libpng
492 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
493
mtklein63213812016-08-24 09:55:56 -0700494 deps = [
495 "//third_party/libpng",
496 ]
497 sources = [
498 "src/codec/SkIcoCodec.cpp",
499 "src/codec/SkPngCodec.cpp",
500 "src/images/SkPNGImageEncoder.cpp",
501 ]
502}
503
scroggof84ad642016-10-31 09:02:57 -0700504optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400505 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700506 public_defines = [ "SK_CODEC_DECODES_RAW" ]
507
508 deps = [
509 "//third_party/dng_sdk",
510 "//third_party/libjpeg-turbo:libjpeg",
511 "//third_party/piex",
512 ]
513
514 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
515 # Skia.
516 configs_to_remove = [ "//gn:no_exceptions" ]
517
518 sources = [
519 "src/codec/SkRawAdapterCodec.cpp",
520 "src/codec/SkRawCodec.cpp",
521 ]
522}
523
mtklein3cc22182016-08-29 13:26:14 -0700524optional("typeface_freetype") {
525 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700526
527 deps = [
528 "//third_party/freetype2",
529 ]
530 sources = [
531 "src/ports/SkFontHost_FreeType.cpp",
532 "src/ports/SkFontHost_FreeType_common.cpp",
533 ]
534}
535
mtklein457b42a2016-08-23 13:56:37 -0700536optional("webp") {
537 enabled = skia_use_libwebp
538 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
539
mtklein457b42a2016-08-23 13:56:37 -0700540 deps = [
541 "//third_party/libwebp",
542 ]
543 sources = [
544 "src/codec/SkWebpAdapterCodec.cpp",
545 "src/codec/SkWebpCodec.cpp",
546 "src/images/SkWEBPImageEncoder.cpp",
547 ]
mtkleineb3c4252016-08-23 07:38:09 -0700548}
549
mtklein63213812016-08-24 09:55:56 -0700550optional("xml") {
551 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000552 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700553
mtklein63213812016-08-24 09:55:56 -0700554 deps = [
555 "//third_party/expat",
556 ]
557 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500558 "src/svg/SkSVGCanvas.cpp",
559 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700560 "src/xml/SkDOM.cpp",
561 "src/xml/SkXMLParser.cpp",
562 "src/xml/SkXMLWriter.cpp",
563 ]
564}
565
mtkleinc04ff472016-06-23 10:29:30 -0700566component("skia") {
567 public_configs = [ ":skia_public" ]
568 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700569
570 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700571 ":arm64",
572 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700573 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700574 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500575 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700576 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700577 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700578 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700579 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700580 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400581 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700582 ":jpeg",
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 += [
bungeman3e306f62017-03-29 11:32:02 -0400700 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
701 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700702 "ApplicationServices.framework",
703 "OpenGL.framework",
704 ]
mtkleinc04ff472016-06-23 10:29:30 -0700705 }
abarth6fc8ff02016-07-15 15:15:15 -0700706
Mike Klein7d302882016-11-03 14:06:31 -0400707 if (is_ios) {
708 sources += [
709 "src/ports/SkDebug_stdio.cpp",
710 "src/ports/SkFontHost_mac.cpp",
711 "src/ports/SkImageEncoder_CG.cpp",
712 "src/ports/SkImageGeneratorCG.cpp",
713 ]
714 libs += [
715 "CoreFoundation.framework",
716 "CoreGraphics.framework",
717 "CoreText.framework",
718 "ImageIO.framework",
719 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400720
721 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
722 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400723 ]
724 }
725
abarth6fc8ff02016-07-15 15:15:15 -0700726 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700727 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700728 }
mtkleinc04ff472016-06-23 10:29:30 -0700729}
730
mtkleinc095df52016-08-24 12:23:52 -0700731# Targets guarded by skia_enable_tools may use //third_party freely.
732if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500733 # Used by gn_to_bp.py to list our public include dirs.
734 source_set("public") {
735 configs += [ ":skia_public" ]
736 }
737
Mike Kleinc36dedf2016-11-18 09:35:28 -0500738 config("skia.h_config") {
739 include_dirs = [ "$target_gen_dir" ]
740 }
741 action("skia.h") {
742 public_configs = [ ":skia.h_config" ]
743 skia_h = "$target_gen_dir/skia.h"
744 script = "gn/find_headers.py"
Greg Daniel50130e42017-04-12 13:29:50 -0400745 if (skia_use_vulkan) {
746 use_vulkan_string = "True"
747 } else {
748 use_vulkan_string = "False"
749 }
750 args = [
751 rebase_path(skia_h, root_build_dir),
752 use_vulkan_string,
753 ] + rebase_path(skia_public_includes - [ skia_vulkan_headers_path ])
Mike Kleinc36dedf2016-11-18 09:35:28 -0500754 depfile = "$skia_h.deps"
755 outputs = [
756 skia_h,
757 ]
758 }
759
760 if (skia_enable_gpu && target_cpu == "x64") {
761 # Our bots only have 64-bit libOSMesa installed.
762 # TODO: worth fixing?
763 executable("fiddle") {
764 libs = []
765 if (is_linux) {
766 libs += [ "OSMesa" ]
767 }
768
769 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500770 "tools/fiddle/draw.cpp",
771 "tools/fiddle/fiddle_main.cpp",
772 ]
773 deps = [
774 ":skia",
775 ":skia.h",
776 ]
777 }
778 }
779
780 if (skia_enable_gpu) {
781 source_set("public_headers_warnings_check") {
782 sources = [
783 "tools/public_headers_warnings_check.cpp",
784 ]
785 configs -= [ "//gn:warnings_except_public_headers" ]
786 deps = [
787 ":skia",
788 ":skia.h",
789 ]
790 }
791 }
792
mtkleinc095df52016-08-24 12:23:52 -0700793 template("test_lib") {
794 config(target_name + "_config") {
795 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700796 if (defined(invoker.public_defines)) {
797 defines = invoker.public_defines
798 }
mtklein25c81d42016-07-27 13:55:26 -0700799 }
mtkleinc095df52016-08-24 12:23:52 -0700800 source_set(target_name) {
801 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
802 public_configs = [
803 ":" + target_name + "_config",
804 ":skia_private",
805 ]
806
807 if (!defined(deps)) {
808 deps = []
809 }
810 deps += [ ":skia" ]
811 testonly = true
812 }
mtklein25c81d42016-07-27 13:55:26 -0700813 }
mtklein25c81d42016-07-27 13:55:26 -0700814
Mike Kleine6682eb2017-01-05 10:54:57 -0500815 template("test_app") {
816 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
817 shared_library("lib" + target_name) {
818 forward_variables_from(invoker, "*", [ "is_shared_library" ])
819 testonly = true
820 }
821 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500822 _executable = target_name
823 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500824 forward_variables_from(invoker, "*", [ "is_shared_library" ])
825 testonly = true
826 }
827 }
Mike Klein7d921032017-01-05 12:20:41 -0500828 if (is_android && skia_android_serial != "" && defined(_executable)) {
829 action("push_" + target_name) {
830 script = "gn/push_to_android.py"
831 deps = [
832 ":" + _executable,
833 ]
834 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
835 outputs = [
836 _stamp,
837 ]
838 args = [
839 rebase_path("$root_build_dir/$_executable"),
840 skia_android_serial,
841 rebase_path(_stamp),
842 ]
843 testonly = true
844 }
845 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500846 }
847
mtkleinc095df52016-08-24 12:23:52 -0700848 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700849 public_include_dirs = []
850 if (skia_enable_gpu) {
851 public_defines = []
852 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700853
854 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700855 sources = [
856 "tools/gpu/GrContextFactory.cpp",
857 "tools/gpu/GrTest.cpp",
858 "tools/gpu/TestContext.cpp",
859 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700860 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700861 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
862 "tools/gpu/gl/debug/GrBufferObj.cpp",
863 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
864 "tools/gpu/gl/debug/GrProgramObj.cpp",
865 "tools/gpu/gl/debug/GrShaderObj.cpp",
866 "tools/gpu/gl/debug/GrTextureObj.cpp",
867 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
868 "tools/gpu/gl/null/NullGLTestContext.cpp",
869 ]
870 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700871
Kevin Lubick4a24e102017-03-29 11:19:01 -0400872 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700873 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400874 } else if (is_ios) {
875 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
876 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700877 } else if (is_linux) {
878 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500879 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700880 } else if (is_mac) {
881 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400882 } else if (is_win) {
883 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
884 libs += [
885 "Gdi32.lib",
886 "OpenGL32.lib",
887 ]
mtklein38925aa2016-09-21 10:11:25 -0700888 }
mtklein6ef69992016-09-14 06:12:09 -0700889
Mike Kleinc168a3a2016-11-14 14:53:13 +0000890 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000891 deps += [ "//third_party/angle2" ]
892 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
893 }
mtklein38925aa2016-09-21 10:11:25 -0700894 if (skia_use_mesa) {
895 public_defines += [ "SK_MESA" ]
896 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
897 libs += [ "OSMesa" ]
898 }
mtkleind68f9b02016-09-23 13:18:41 -0700899 if (skia_use_vulkan) {
900 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
901 }
mtkleina627b5c2016-09-20 13:36:47 -0700902 }
mtklein25c81d42016-07-27 13:55:26 -0700903 }
mtklein25c81d42016-07-27 13:55:26 -0700904
mtkleinc095df52016-08-24 12:23:52 -0700905 test_lib("flags") {
906 public_include_dirs = [ "tools/flags" ]
907 sources = [
908 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700909 ]
910 }
911 test_lib("common_flags") {
912 public_include_dirs = [ "tools/flags" ]
913 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700914 "tools/flags/SkCommonFlags.cpp",
915 "tools/flags/SkCommonFlagsConfig.cpp",
916 ]
917 deps = [
mtklein046cb562016-09-16 10:23:12 -0700918 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700919 ":gpu_tool_utils",
920 ]
921 }
mtklein25c81d42016-07-27 13:55:26 -0700922
mtkleinc095df52016-08-24 12:23:52 -0700923 test_lib("tool_utils") {
924 public_include_dirs = [
925 "tools",
926 "tools/debugger",
927 "tools/timer",
928 ]
929 sources = [
mtkleinb37c0342016-09-09 11:07:45 -0700930 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700931 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700932 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700933 "tools/ProcStats.cpp",
934 "tools/Resources.cpp",
935 "tools/ThermalManager.cpp",
936 "tools/UrlDataManager.cpp",
937 "tools/debugger/SkDebugCanvas.cpp",
938 "tools/debugger/SkDrawCommand.cpp",
939 "tools/debugger/SkJsonWriteBuffer.cpp",
940 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700941 "tools/picture_utils.cpp",
942 "tools/random_parse_path.cpp",
943 "tools/sk_tool_utils.cpp",
944 "tools/sk_tool_utils_font.cpp",
945 "tools/timer/Timer.cpp",
946 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500947 libs = []
948 if (is_ios) {
949 sources += [ "tools/ios_utils.m" ]
950 libs += [ "Foundation.framework" ]
951 }
mtkleinc095df52016-08-24 12:23:52 -0700952 deps = [
mtklein046cb562016-09-16 10:23:12 -0700953 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700954 ":flags",
955 "//third_party/libpng",
956 ]
957 public_deps = [
958 "//third_party/jsoncpp",
959 ]
960 }
mtklein25c81d42016-07-27 13:55:26 -0700961
Mike Klein6e744122016-10-27 12:21:40 -0400962 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700963 test_lib("gm") {
964 public_include_dirs = [ "gm" ]
965 sources = gm_sources
966 deps = [
scroggo19b91532016-10-24 09:03:26 -0700967 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700968 ":gpu_tool_utils",
969 ":skia",
970 ":tool_utils",
971 ]
972 }
mtklein25c81d42016-07-27 13:55:26 -0700973
Mike Klein6e744122016-10-27 12:21:40 -0400974 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700975 test_lib("tests") {
976 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400977 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700978 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400979 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700980 }
mtkleinc095df52016-08-24 12:23:52 -0700981 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700982 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700983 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700984 ":skia",
985 ":tool_utils",
986 "//third_party/libpng",
987 "//third_party/zlib",
988 ]
Mike Kleind63442d2017-03-27 14:16:04 -0400989 public_deps = [
990 ":gpu_tool_utils", # Test.h #includes headers from this target.
991 ]
mtkleinc095df52016-08-24 12:23:52 -0700992 }
mtklein2f3416d2016-08-02 16:02:05 -0700993
Mike Klein6e744122016-10-27 12:21:40 -0400994 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700995 test_lib("bench") {
996 public_include_dirs = [ "bench" ]
997 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700998 deps = [
999 ":flags",
1000 ":gm",
1001 ":gpu_tool_utils",
1002 ":skia",
1003 ":tool_utils",
1004 ]
1005 }
mtklein2b6870c2016-07-28 14:17:33 -07001006
mtkleinc095df52016-08-24 12:23:52 -07001007 test_lib("experimental_svg_model") {
1008 public_include_dirs = [ "experimental/svg/model" ]
1009 sources = [
1010 "experimental/svg/model/SkSVGAttribute.cpp",
1011 "experimental/svg/model/SkSVGAttributeParser.cpp",
1012 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001013 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001014 "experimental/svg/model/SkSVGContainer.cpp",
1015 "experimental/svg/model/SkSVGDOM.cpp",
1016 "experimental/svg/model/SkSVGEllipse.cpp",
1017 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001018 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001019 "experimental/svg/model/SkSVGNode.cpp",
1020 "experimental/svg/model/SkSVGPath.cpp",
1021 "experimental/svg/model/SkSVGPoly.cpp",
1022 "experimental/svg/model/SkSVGRect.cpp",
1023 "experimental/svg/model/SkSVGRenderContext.cpp",
1024 "experimental/svg/model/SkSVGSVG.cpp",
1025 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001026 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001027 "experimental/svg/model/SkSVGTransformableNode.cpp",
1028 "experimental/svg/model/SkSVGValue.cpp",
1029 ]
1030 deps = [
1031 ":skia",
1032 ]
1033 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001034
Brian Osman16adfa32016-10-18 14:42:44 -04001035 test_lib("views") {
1036 public_include_dirs = [ "include/views" ]
1037 sources = [
1038 "src/views/SkEvent.cpp",
1039 "src/views/SkEventSink.cpp",
1040 "src/views/SkOSMenu.cpp",
1041 "src/views/SkTagList.cpp",
1042 "src/views/SkTouchGesture.cpp",
1043 "src/views/SkView.cpp",
1044 "src/views/SkViewPriv.cpp",
1045 ]
1046 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001047 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001048 if (!is_android) {
1049 sources += [ "src/views/SkWindow.cpp" ]
1050 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001051 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001052 public_include_dirs += [ "src/views/unix" ]
1053 sources += [
1054 "src/views/unix/SkOSWindow_Unix.cpp",
1055 "src/views/unix/keysym2ucs.c",
1056 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001057 libs += [
1058 "GL",
1059 "X11",
1060 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001061 } else if (is_mac) {
1062 sources += [
1063 "src/views/mac/SkEventNotifier.mm",
1064 "src/views/mac/SkNSView.mm",
1065 "src/views/mac/SkOSWindow_Mac.mm",
1066 "src/views/mac/SkTextFieldCell.m",
1067 ]
1068 libs += [
1069 "QuartzCore.framework",
1070 "Cocoa.framework",
1071 "Foundation.framework",
1072 ]
1073 } else if (is_win) {
1074 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1075 }
Brian Osman34755e22016-12-05 09:46:02 -05001076 if (skia_use_angle) {
1077 deps += [ "//third_party/angle2" ]
1078 }
Brian Osman16adfa32016-10-18 14:42:44 -04001079 }
1080
Mike Klein38af9432016-11-11 11:39:44 -05001081 if (skia_use_lua) {
1082 test_lib("lua") {
1083 public_include_dirs = []
1084 sources = [
1085 "src/utils/SkLua.cpp",
1086 "src/utils/SkLuaCanvas.cpp",
1087 ]
1088 deps = [
1089 "//third_party/lua",
1090 ]
1091 }
1092
Mike Kleine6682eb2017-01-05 10:54:57 -05001093 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001094 sources = [
1095 "tools/lua/lua_app.cpp",
1096 ]
1097 deps = [
1098 ":lua",
1099 ":skia",
1100 "//third_party/lua",
1101 ]
Mike Klein38af9432016-11-11 11:39:44 -05001102 }
1103
Mike Kleine6682eb2017-01-05 10:54:57 -05001104 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001105 sources = [
1106 "tools/lua/lua_pictures.cpp",
1107 ]
1108 deps = [
1109 ":flags",
1110 ":lua",
1111 ":skia",
1112 ":tool_utils",
1113 "//third_party/lua",
1114 ]
Mike Klein38af9432016-11-11 11:39:44 -05001115 }
1116 }
1117
Mike Klein6e744122016-10-27 12:21:40 -04001118 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001119 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001120 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001121 include_dirs = [ "experimental" ]
1122 sources = samples_sources + [
1123 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1124 "experimental/SkSetPoly3To3.cpp",
1125 "experimental/SkSetPoly3To3_A.cpp",
1126 "experimental/SkSetPoly3To3_D.cpp",
1127 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001128 deps = [
1129 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001130 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001131 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001132 ":tool_utils",
1133 ":views",
1134 ":xml",
1135 ]
Mike Klein38af9432016-11-11 11:39:44 -05001136
1137 if (skia_use_lua) {
1138 sources += [ "samplecode/SampleLua.cpp" ]
1139 deps += [
1140 ":lua",
1141 "//third_party/lua",
1142 ]
1143 }
Brian Osman16adfa32016-10-18 14:42:44 -04001144 }
1145
Mike Kleine6682eb2017-01-05 10:54:57 -05001146 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001147 sources = [
1148 "dm/DM.cpp",
1149 "dm/DMJsonWriter.cpp",
1150 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001151 ]
1152 include_dirs = [ "tests" ]
1153 deps = [
mtklein046cb562016-09-16 10:23:12 -07001154 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001155 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001156 ":flags",
1157 ":gm",
1158 ":gpu_tool_utils",
1159 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001160 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001161 ":tool_utils",
1162 "//third_party/jsoncpp",
1163 "//third_party/libpng",
1164 ]
mtklein2b6870c2016-07-28 14:17:33 -07001165 }
1166
Mike Klein06432b22017-03-21 13:14:33 -04001167 test_app("ok") {
1168 sources = [
1169 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001170 "tools/ok_dsts.cpp",
1171 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001172 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001173 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001174 ]
1175 deps = [
1176 ":gm",
1177 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001178 ":tests",
Mike Klein06432b22017-03-21 13:14:33 -04001179 ]
1180 }
1181
Mike Kleina3430172016-09-27 16:46:29 -04001182 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001183 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001184 sources = [
1185 "tools/monobench.cpp",
1186 ]
1187 deps = [
1188 ":bench",
1189 ":skia",
1190 ]
Mike Kleina3430172016-09-27 16:46:29 -04001191 }
mtklein2b6870c2016-07-28 14:17:33 -07001192 }
1193
Mike Kleine6682eb2017-01-05 10:54:57 -05001194 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001195 sources = [
1196 "bench/nanobench.cpp",
1197 ]
1198 deps = [
1199 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001200 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001201 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001202 ":flags",
1203 ":gm",
1204 ":gpu_tool_utils",
1205 ":skia",
1206 ":tool_utils",
1207 "//third_party/jsoncpp",
1208 ]
mtklein2b6870c2016-07-28 14:17:33 -07001209 }
halcanary19a97202016-08-03 15:08:04 -07001210
Ravi Mistry10d36c52017-01-31 09:49:18 -05001211 test_app("skpinfo") {
1212 sources = [
1213 "tools/skpinfo.cpp",
1214 ]
1215 deps = [
1216 ":flags",
1217 ":skia",
1218 ]
1219 }
1220
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001221 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001222 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001223 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001224 "samplecode/SampleApp.cpp",
1225 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001226 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001227 if (is_mac) {
1228 sources += [ "src/views/mac/skia_mac.mm" ]
1229 } else if (is_win) {
1230 sources += [ "src/views/win/skia_win.cpp" ]
1231 } else if (is_linux) {
1232 sources += [ "src/views/unix/skia_unix.cpp" ]
1233 }
mtklein38925aa2016-09-21 10:11:25 -07001234 deps = [
1235 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001236 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001237 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001238 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001239 ":skia",
1240 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001241 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001242 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001243 if (skia_use_angle) {
1244 deps += [ "//third_party/angle2" ]
1245 }
mtklein38925aa2016-09-21 10:11:25 -07001246 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001247 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001248
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001249 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001250 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001251 sources = [
1252 "tools/skpbench/skpbench.cpp",
1253 ]
1254 deps = [
1255 ":flags",
1256 ":gpu_tool_utils",
1257 ":skia",
1258 ":tool_utils",
1259 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001260 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001261 }
1262
Mike Klein7d302882016-11-03 14:06:31 -04001263 # We can't yet build ICU on iOS or Windows.
1264 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001265 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001266 sources = [
1267 "tools/SkShaper_harfbuzz.cpp",
1268 "tools/using_skia_and_harfbuzz.cpp",
1269 ]
1270 deps = [
1271 ":skia",
1272 "//third_party/harfbuzz",
1273 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001274 }
halcanary19a97202016-08-03 15:08:04 -07001275 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001276 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001277 sources = [
1278 "tools/SkShaper_primitive.cpp",
1279 "tools/using_skia_and_harfbuzz.cpp",
1280 ]
1281 deps = [
1282 ":skia",
1283 ]
halcanary3eee9d92016-09-10 07:01:53 -07001284 }
mtklein046cb562016-09-16 10:23:12 -07001285
Mike Kleine6682eb2017-01-05 10:54:57 -05001286 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001287 sources = [
1288 "tools/get_images_from_skps.cpp",
1289 ]
1290 deps = [
1291 ":flags",
1292 ":skia",
1293 "//third_party/jsoncpp",
1294 ]
mtklein046cb562016-09-16 10:23:12 -07001295 }
mtkleinecbc5262016-09-22 11:51:24 -07001296
Mike Kleine6682eb2017-01-05 10:54:57 -05001297 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001298 sources = [
1299 "tools/colorspaceinfo.cpp",
1300 ]
1301 deps = [
1302 ":flags",
1303 ":skia",
1304 ":tool_utils",
1305 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001306 }
1307
Mike Klein7d302882016-11-03 14:06:31 -04001308 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001309 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001310 sources = [
1311 "tools/skiaserve/Request.cpp",
1312 "tools/skiaserve/Response.cpp",
1313 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001314 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1315 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1316 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1317 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1318 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1319 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1320 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1321 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1322 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001323 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1324 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001325 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1326 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1327 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1328 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1329 ]
1330 deps = [
1331 ":flags",
1332 ":gpu_tool_utils",
1333 ":skia",
1334 ":tool_utils",
1335 "//third_party/jsoncpp",
1336 "//third_party/libmicrohttpd",
1337 "//third_party/libpng",
1338 ]
Mike Klein7d302882016-11-03 14:06:31 -04001339 }
mtkleinecbc5262016-09-22 11:51:24 -07001340 }
kjlubick14f984b2016-10-03 11:49:45 -07001341
Mike Kleine6682eb2017-01-05 10:54:57 -05001342 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001343 sources = [
1344 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001345 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001346 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001347 "fuzz/FuzzGradients.cpp",
1348 "fuzz/FuzzParsePath.cpp",
1349 "fuzz/FuzzPathop.cpp",
1350 "fuzz/FuzzScaleToSides.cpp",
1351 "fuzz/fuzz.cpp",
1352 ]
1353 deps = [
1354 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001355 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001356 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001357 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001358 ]
kjlubick14f984b2016-10-03 11:49:45 -07001359 }
Mike Klein38312422016-10-05 15:41:01 -04001360
Mike Kleine6682eb2017-01-05 10:54:57 -05001361 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001362 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001363 rebase_path("tests/skia_test.cpp"),
1364 rebase_path("tests/Test.cpp"),
1365 ]
caryclark9feb6322016-10-25 08:58:26 -07001366 deps = [
1367 ":flags",
1368 ":gpu_tool_utils",
1369 ":skia",
1370 ":tool_utils",
1371 ]
caryclark9feb6322016-10-25 08:58:26 -07001372 }
1373
Mike Kleine6682eb2017-01-05 10:54:57 -05001374 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001375 sources = [
1376 "tools/DumpRecord.cpp",
1377 "tools/dump_record.cpp",
1378 ]
1379 deps = [
1380 ":flags",
1381 ":skia",
1382 ]
Mike Klein38312422016-10-05 15:41:01 -04001383 }
bungemanfe917272016-10-13 17:36:40 -04001384
Mike Kleine6682eb2017-01-05 10:54:57 -05001385 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001386 sources = [
1387 "tools/skdiff/skdiff.cpp",
1388 "tools/skdiff/skdiff_html.cpp",
1389 "tools/skdiff/skdiff_main.cpp",
1390 "tools/skdiff/skdiff_utils.cpp",
1391 ]
1392 deps = [
1393 ":skia",
1394 ":tool_utils",
1395 ]
bungemanfe917272016-10-13 17:36:40 -04001396 }
halcanarya73d76a2016-10-17 13:19:02 -07001397
Mike Kleine6682eb2017-01-05 10:54:57 -05001398 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001399 sources = [
1400 "tools/skp_parser.cpp",
1401 ]
1402 deps = [
1403 ":skia",
1404 ":tool_utils",
1405 "//third_party/jsoncpp",
1406 ]
halcanarya73d76a2016-10-17 13:19:02 -07001407 }
Brian Osman16adfa32016-10-18 14:42:44 -04001408
Mike Kleina92c3832016-12-08 09:49:39 -05001409 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001410 test_app("viewer") {
1411 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001412 sources = [
1413 "tools/viewer/GMSlide.cpp",
1414 "tools/viewer/ImageSlide.cpp",
1415 "tools/viewer/SKPSlide.cpp",
1416 "tools/viewer/SampleSlide.cpp",
1417 "tools/viewer/Viewer.cpp",
1418 "tools/viewer/sk_app/CommandSet.cpp",
1419 "tools/viewer/sk_app/GLWindowContext.cpp",
1420 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001421 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001422 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001423
Jim Van Verth4e56a912016-10-21 10:58:52 -04001424 if (is_android) {
1425 sources += [
1426 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1427 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1428 "tools/viewer/sk_app/android/Window_android.cpp",
1429 "tools/viewer/sk_app/android/main_android.cpp",
1430 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1431 ]
Brian Osman462334e2017-02-09 11:22:57 -05001432 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001433 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001434 sources += [
1435 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1436 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1437 "tools/viewer/sk_app/unix/Window_unix.cpp",
1438 "tools/viewer/sk_app/unix/main_unix.cpp",
1439 ]
1440 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001441 sources += [
1442 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1443 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1444 "tools/viewer/sk_app/win/Window_win.cpp",
1445 "tools/viewer/sk_app/win/main_win.cpp",
1446 ]
Mike Klein43c25262016-10-20 10:17:47 -04001447 } else if (is_mac) {
1448 sources += [
1449 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1450 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1451 "tools/viewer/sk_app/mac/Window_mac.cpp",
1452 "tools/viewer/sk_app/mac/main_mac.cpp",
1453 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001454 }
1455
1456 if (skia_use_vulkan) {
1457 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001458 if (is_android) {
1459 sources +=
1460 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001461 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001462 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1463 libs += [ "X11-xcb" ]
1464 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001465 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1466 }
1467 }
1468
1469 include_dirs = []
1470 deps = [
1471 ":flags",
1472 ":gm",
1473 ":gpu_tool_utils",
1474 ":samples",
1475 ":skia",
1476 ":tool_utils",
1477 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001478 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001479 "//third_party/jsoncpp",
1480 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001481 if (is_android) {
1482 deps += [ "//third_party/native_app_glue" ]
1483 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001484 deps += [ "//third_party/libsdl" ]
1485 }
Mike Kleina92c3832016-12-08 09:49:39 -05001486 }
Brian Osman16adfa32016-10-18 14:42:44 -04001487 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001488
Mike Kleine459afd2017-03-03 09:21:30 -05001489 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001490 copy("gdbserver") {
1491 sources = [
1492 "$ndk/$ndk_gdbserver",
1493 ]
1494 outputs = [
1495 "$root_out_dir/gdbserver",
1496 ]
1497 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001498 }
1499
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001500 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001501 test_app("skslc") {
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001502 defines = [ "SKSL_STANDALONE" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001503 sources = [
1504 "src/sksl/SkSLMain.cpp",
1505 ]
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001506 sources += skia_sksl_sources
1507 include_dirs = [ "src/sksl" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001508 }
1509 }
mtklein25c81d42016-07-27 13:55:26 -07001510}