blob: 76cfbd295f7d099b26bd4bb747c0e78abf401459 [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
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040024 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040025 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070026 skia_use_libjpeg_turbo = true
27 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070028 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050029 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070030 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040031 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070032 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070035 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
mtklein06c35c02016-09-20 12:28:12 -070038 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050039 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050041 skia_enable_tools = is_skia_dev_build
42 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040043 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070044}
Brian Salomon23d73ea2016-10-27 13:31:37 -040045declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040046 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040047 skia_use_sfntly = skia_use_icu
48
Mike Klein4d598a32016-10-31 13:44:49 -040049 if (is_android) {
50 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070051 } else if (is_fuchsia) {
52 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040053 } else {
54 skia_use_vulkan = skia_vulkan_sdk != ""
55 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040056}
Greg Danielec6ae522017-04-25 13:38:26 -040057declare_args() {
58 if (skia_use_vulkan) {
59 if (is_fuchsia) {
60 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
61 } else if (is_linux || is_win) {
62 skia_vulkan_headers = "$skia_vulkan_sdk/include"
63 } else {
64 # When buliding on Android we get the header via the NDK
65 skia_vulkan_headers = ""
66 }
67 } else {
68 skia_vulkan_headers = "third_party/vulkan"
69 }
70}
Brian Salomon789e25e2016-09-30 13:41:03 -040071
mtklein38925aa2016-09-21 10:11:25 -070072# Our tools require static linking (they use non-exported symbols).
73skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070074
mtkleina45be612016-08-29 15:22:10 -070075fontmgr_android_enabled = skia_use_expat && skia_use_freetype
76
mtklein1211e0c2016-07-26 13:55:45 -070077skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070078 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070079 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070080 "include/codec",
81 "include/config",
82 "include/core",
83 "include/effects",
84 "include/gpu",
85 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070086 "include/pathops",
87 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070088 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070089 "include/utils",
90 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070091]
92
mtkleinc04ff472016-06-23 10:29:30 -070093# Skia public API, generally provided by :skia.
94config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070095 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -040096 if (skia_vulkan_headers != "") {
97 include_dirs += [ skia_vulkan_headers ]
98 }
Mike Kleinae7e6712016-10-11 17:49:33 -040099 defines = []
100 if (is_component_build) {
101 defines += [ "SKIA_DLL" ]
102 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400103 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700104 defines += [ "SK_SAMPLES_FOR_X" ]
105 }
mtkleincae1be52016-09-20 08:24:34 -0700106 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -0400107 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -0700108 }
mtklein06c35c02016-09-20 12:28:12 -0700109 if (!skia_enable_gpu) {
110 defines += [ "SK_SUPPORT_GPU=0" ]
111 }
mtkleinc04ff472016-06-23 10:29:30 -0700112}
113
114# Skia internal APIs, used by Skia itself and a few test tools.
115config("skia_private") {
116 visibility = [ ":*" ]
117
118 include_dirs = [
119 "include/private",
120 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700121 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700122 "src/core",
123 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700124 "src/effects/gradients",
125 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700126 "src/image",
127 "src/images",
128 "src/lazy",
129 "src/opts",
130 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700131 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700132 "src/ports",
133 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700134 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700135 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700136 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500137 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700138 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700139 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700140 ]
mtklein150d1132016-08-01 06:56:40 -0700141
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400142 defines = [
143 "SK_GAMMA_APPLY_TO_A8",
144 "SK_INTERNAL",
145 ]
mtkleinb37c0342016-09-09 11:07:45 -0700146 if (is_android) {
147 defines += [
148 "SK_GAMMA_EXPONENT=1.4",
149 "SK_GAMMA_CONTRAST=0.0",
150 ]
151 }
mtklein88a7ac02016-09-14 11:16:49 -0700152 if (is_official_build || is_android) {
153 # TODO(bsalomon): it'd be nice to make Android normal.
154 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
155 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400156 libs = []
157 lib_dirs = []
158 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700159 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400160 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400161 lib_dirs += [
162 "$skia_vulkan_sdk/Bin",
163 "$skia_vulkan_sdk/Lib",
164 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400165 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400166 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400167 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400168 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400169 }
Brian Salomon03e05842017-02-23 12:23:47 -0500170 if (skia_enable_gpu) {
171 include_dirs += [ "src/gpu" ]
172 }
Brian Osman34755e22016-12-05 09:46:02 -0500173 if (skia_use_angle) {
174 defines += [ "SK_ANGLE" ]
175 }
Brian Osman3f375d02016-12-28 11:19:22 -0500176 if (skia_enable_discrete_gpu) {
177 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
178 }
mtkleinc04ff472016-06-23 10:29:30 -0700179}
180
181# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
182config("skia_library") {
183 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700184 defines = [ "SKIA_IMPLEMENTATION=1" ]
185}
186
187skia_library_configs = [
188 ":skia_public",
189 ":skia_private",
190 ":skia_library",
191]
192
mtklein9b8583d2016-08-24 17:32:30 -0700193# Use for CPU-specific Skia code that needs particular compiler flags.
194template("opts") {
195 if (invoker.enabled) {
196 source_set(target_name) {
197 forward_variables_from(invoker, "*")
198 configs += skia_library_configs
199 }
200 } else {
201 # If not enabled, a phony empty target that swallows all otherwise unused variables.
202 source_set(target_name) {
203 forward_variables_from(invoker,
204 "*",
205 [
206 "sources",
207 "cflags",
208 ])
209 }
210 }
anmittala7eaf2e2016-08-17 13:57:26 -0700211}
212
mtklein422310d2016-08-16 18:28:43 -0700213is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700214
mtklein7d6fb2c2016-08-25 14:50:44 -0700215opts("none") {
216 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700217 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700218 cflags = []
219}
220
mtklein7d6fb2c2016-08-25 14:50:44 -0700221opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700222 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700223 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700224 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700225}
226
227opts("arm64") {
228 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700230 cflags = []
231}
232
233opts("crc32") {
234 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700235 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700236 cflags = [ "-march=armv8-a+crc" ]
237}
238
mtklein9b8583d2016-08-24 17:32:30 -0700239opts("sse2") {
240 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400242 if (is_win) {
243 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
244 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400245 cflags = [ "-msse2" ]
246 }
mtklein9b8583d2016-08-24 17:32:30 -0700247}
mtkleinc04ff472016-06-23 10:29:30 -0700248
mtklein9b8583d2016-08-24 17:32:30 -0700249opts("ssse3") {
250 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400252 if (is_win) {
253 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
254 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400255 cflags = [ "-mssse3" ]
256 }
mtklein9b8583d2016-08-24 17:32:30 -0700257}
mtkleinc04ff472016-06-23 10:29:30 -0700258
mtklein9b8583d2016-08-24 17:32:30 -0700259opts("sse41") {
260 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700261 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400262 if (is_win) {
263 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
264 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400265 cflags = [ "-msse4.1" ]
266 }
mtklein9b8583d2016-08-24 17:32:30 -0700267}
mtklein4e976072016-08-08 09:06:27 -0700268
mtklein9b8583d2016-08-24 17:32:30 -0700269opts("sse42") {
270 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700271 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400272 if (is_win) {
273 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
274 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400275 cflags = [ "-msse4.2" ]
276 }
mtklein9b8583d2016-08-24 17:32:30 -0700277}
278
279opts("avx") {
280 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700281 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400282 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000283 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400284 } else {
285 cflags = [ "-mavx" ]
286 }
mtkleinc04ff472016-06-23 10:29:30 -0700287}
288
Mike Klein78d5a3b2016-09-30 10:48:01 -0400289opts("hsw") {
290 enabled = is_x86
291 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400292 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000293 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400294 } else {
295 cflags = [
296 "-mavx2",
297 "-mbmi",
298 "-mbmi2",
299 "-mf16c",
300 "-mfma",
301 ]
302 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400303}
304
mtkleinc095df52016-08-24 12:23:52 -0700305# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700306template("optional") {
307 if (invoker.enabled) {
308 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700309 if (defined(invoker.public_defines)) {
310 defines = invoker.public_defines
311 }
mtklein457b42a2016-08-23 13:56:37 -0700312 }
313 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700314 forward_variables_from(invoker,
315 "*",
316 [
317 "public_defines",
318 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700319 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700320 ])
mtklein457b42a2016-08-23 13:56:37 -0700321 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700322 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700323 if (defined(invoker.configs_to_remove)) {
324 configs -= invoker.configs_to_remove
325 }
mtklein457b42a2016-08-23 13:56:37 -0700326 }
327 } else {
mtklein457b42a2016-08-23 13:56:37 -0700328 source_set(target_name) {
329 forward_variables_from(invoker,
330 "*",
331 [
332 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700333 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700334 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700335 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700336 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700337 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700338 ])
mtkleincd01b032016-08-31 04:58:19 -0700339 if (defined(invoker.sources_when_disabled)) {
340 sources = invoker.sources_when_disabled
341 }
342 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700343 }
mtkleineb3c4252016-08-23 07:38:09 -0700344 }
mtklein457b42a2016-08-23 13:56:37 -0700345}
mtklein457b42a2016-08-23 13:56:37 -0700346
Mike Kleina04bb452017-02-09 12:24:07 -0500347optional("effects") {
348 enabled = skia_enable_effects
349 sources =
350 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
351 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
352}
353
mtkleina45be612016-08-29 15:22:10 -0700354optional("fontmgr_android") {
355 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700356
357 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500358 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700359 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700360 ]
361 sources = [
362 "src/ports/SkFontMgr_android.cpp",
363 "src/ports/SkFontMgr_android_factory.cpp",
364 "src/ports/SkFontMgr_android_parser.cpp",
365 ]
366}
367
mtkleind2e39db2016-09-07 07:52:55 -0700368optional("fontmgr_custom") {
369 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
370
371 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500372 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700373 ]
374 sources = [
375 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500376 "src/ports/SkFontMgr_custom.h",
377 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700378 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500379 "src/ports/SkFontMgr_custom_embedded.cpp",
380 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700381 ]
382}
383
mtklein3cc22182016-08-29 13:26:14 -0700384optional("fontmgr_fontconfig") {
385 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700386
387 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500388 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700389 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700390 ]
391 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700392 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700393 "src/ports/SkFontConfigInterface_direct.cpp",
394 "src/ports/SkFontConfigInterface_direct_factory.cpp",
395 "src/ports/SkFontMgr_FontConfigInterface.cpp",
396 "src/ports/SkFontMgr_fontconfig.cpp",
397 "src/ports/SkFontMgr_fontconfig_factory.cpp",
398 ]
399}
400
mtkleincdedd0e2016-09-12 15:15:44 -0700401optional("fontmgr_fuchsia") {
402 enabled = is_fuchsia && skia_use_freetype
403
404 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500405 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700406 ]
407 sources = [
408 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500409 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700410 "src/ports/SkFontMgr_custom_empty_factory.cpp",
411 ]
412}
413
mtklein06c35c02016-09-20 12:28:12 -0700414optional("gpu") {
415 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700416 public_defines = []
417
Mike Klein29b3e582017-02-09 11:57:32 -0500418 sources = skia_gpu_sources + skia_sksl_sources +
419 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700420
421 # These paths need to be absolute to match the ones produced by shared_sources.gni.
422 sources -= get_path_info([
423 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
424 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
425 ],
426 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400427 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700428 if (is_android) {
429 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400430 } else if (skia_use_egl) {
431 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
432 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700433 } else if (is_linux) {
434 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500435 libs += [
436 "GL",
437 "GLU",
438 ]
mtklein06c35c02016-09-20 12:28:12 -0700439 } else if (is_mac) {
440 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800441 } else if (is_ios) {
442 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400443 } else if (is_win) {
444 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
445 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700446 } else {
447 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
448 }
mtkleine9fb3d52016-09-20 15:11:46 -0700449
450 if (skia_use_vulkan) {
451 public_defines += [ "SK_VULKAN" ]
452 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700453 if (skia_enable_vulkan_debug_layers) {
454 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
455 }
mtkleine9fb3d52016-09-20 15:11:46 -0700456 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400457 if (skia_enable_spirv_validation) {
458 deps = [
459 "//third_party/spirv-tools",
460 ]
461 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
462 }
mtklein06c35c02016-09-20 12:28:12 -0700463}
464
mtklein63213812016-08-24 09:55:56 -0700465optional("jpeg") {
466 enabled = skia_use_libjpeg_turbo
467 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
468
mtklein63213812016-08-24 09:55:56 -0700469 deps = [
470 "//third_party/libjpeg-turbo:libjpeg",
471 ]
472 sources = [
473 "src/codec/SkJpegCodec.cpp",
474 "src/codec/SkJpegDecoderMgr.cpp",
475 "src/codec/SkJpegUtility.cpp",
476 "src/images/SkJPEGImageEncoder.cpp",
477 "src/images/SkJPEGWriteUtility.cpp",
478 ]
479}
480
481optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500482 enabled = skia_use_zlib && skia_enable_pdf
483 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700484
mtklein63213812016-08-24 09:55:56 -0700485 deps = [
486 "//third_party/zlib",
487 ]
brettwb9447282016-09-01 14:24:39 -0700488 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700489 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700490
491 if (skia_use_sfntly) {
492 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500493 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700494 }
495}
496
497optional("png") {
498 enabled = skia_use_libpng
499 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
500
mtklein63213812016-08-24 09:55:56 -0700501 deps = [
502 "//third_party/libpng",
503 ]
504 sources = [
505 "src/codec/SkIcoCodec.cpp",
506 "src/codec/SkPngCodec.cpp",
507 "src/images/SkPNGImageEncoder.cpp",
508 ]
509}
510
scroggof84ad642016-10-31 09:02:57 -0700511optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400512 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700513 public_defines = [ "SK_CODEC_DECODES_RAW" ]
514
515 deps = [
516 "//third_party/dng_sdk",
517 "//third_party/libjpeg-turbo:libjpeg",
518 "//third_party/piex",
519 ]
520
521 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
522 # Skia.
523 configs_to_remove = [ "//gn:no_exceptions" ]
524
525 sources = [
526 "src/codec/SkRawAdapterCodec.cpp",
527 "src/codec/SkRawCodec.cpp",
528 ]
529}
530
mtklein3cc22182016-08-29 13:26:14 -0700531optional("typeface_freetype") {
532 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700533
534 deps = [
535 "//third_party/freetype2",
536 ]
537 sources = [
538 "src/ports/SkFontHost_FreeType.cpp",
539 "src/ports/SkFontHost_FreeType_common.cpp",
540 ]
541}
542
mtklein457b42a2016-08-23 13:56:37 -0700543optional("webp") {
544 enabled = skia_use_libwebp
545 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
546
mtklein457b42a2016-08-23 13:56:37 -0700547 deps = [
548 "//third_party/libwebp",
549 ]
550 sources = [
551 "src/codec/SkWebpAdapterCodec.cpp",
552 "src/codec/SkWebpCodec.cpp",
553 "src/images/SkWEBPImageEncoder.cpp",
554 ]
mtkleineb3c4252016-08-23 07:38:09 -0700555}
556
mtklein63213812016-08-24 09:55:56 -0700557optional("xml") {
558 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000559 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700560
mtklein63213812016-08-24 09:55:56 -0700561 deps = [
562 "//third_party/expat",
563 ]
564 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500565 "src/svg/SkSVGCanvas.cpp",
566 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700567 "src/xml/SkDOM.cpp",
568 "src/xml/SkXMLParser.cpp",
569 "src/xml/SkXMLWriter.cpp",
570 ]
571}
572
mtkleinc04ff472016-06-23 10:29:30 -0700573component("skia") {
574 public_configs = [ ":skia_public" ]
575 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700576
577 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700578 ":arm64",
579 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700580 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700581 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500582 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700583 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700584 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700585 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700586 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700587 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400588 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700589 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700590 ":none",
mtklein63213812016-08-24 09:55:56 -0700591 ":pdf",
592 ":png",
scroggof84ad642016-10-31 09:02:57 -0700593 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700594 ":sse2",
595 ":sse41",
596 ":sse42",
597 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700598 ":webp",
mtklein63213812016-08-24 09:55:56 -0700599 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700600 ]
601
Chinmay Garde43f115c2016-11-16 15:04:12 -0800602 # This file (and all GN files in Skia) are designed to work with an
603 # empty sources assignment filter; we handle all that explicitly.
604 # We clear the filter here for clients who may have set up a global filter.
605 set_sources_assignment_filter([])
606
mtkleinc04ff472016-06-23 10:29:30 -0700607 sources = []
brettwb9447282016-09-01 14:24:39 -0700608 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700609 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500610 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700611 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700612 "src/android/SkBitmapRegionCodec.cpp",
613 "src/android/SkBitmapRegionDecoder.cpp",
614 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700615 "src/codec/SkBmpCodec.cpp",
616 "src/codec/SkBmpMaskCodec.cpp",
617 "src/codec/SkBmpRLECodec.cpp",
618 "src/codec/SkBmpStandardCodec.cpp",
619 "src/codec/SkCodec.cpp",
620 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700621 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700622 "src/codec/SkMaskSwizzler.cpp",
623 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700624 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700625 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700626 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700627 "src/codec/SkSwizzler.cpp",
628 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700629 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700630 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700631 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700632 "src/ports/SkMemory_malloc.cpp",
633 "src/ports/SkOSFile_stdio.cpp",
634 "src/sfnt/SkOTTable_name.cpp",
635 "src/sfnt/SkOTUtils.cpp",
636 "src/utils/mac/SkStream_mac.cpp",
637 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700638 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700639 ]
brettwb9447282016-09-01 14:24:39 -0700640
mtklein7d6fb2c2016-08-25 14:50:44 -0700641 libs = []
642
mtkleinc04ff472016-06-23 10:29:30 -0700643 if (is_win) {
644 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400645 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700646 "src/ports/SkDebug_win.cpp",
647 "src/ports/SkFontHost_win.cpp",
648 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700649 "src/ports/SkImageEncoder_WIC.cpp",
650 "src/ports/SkImageGeneratorWIC.cpp",
651 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700652 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700653 "src/ports/SkScalerContext_win_dw.cpp",
654 "src/ports/SkTLS_win.cpp",
655 "src/ports/SkTypeface_win_dw.cpp",
656 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400657 if (skia_use_gdi) {
658 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
659 libs += [
660 "Gdi32.lib",
661 "Usp10.lib",
662 ]
663 } else {
664 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
665 }
mtkleinb9be9792016-09-16 14:44:18 -0700666 sources -=
667 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400668 libs += [
669 "FontSub.lib",
670 "Ole32.lib",
671 "OleAut32.lib",
672 "User32.lib",
673 ]
mtkleinc04ff472016-06-23 10:29:30 -0700674 } else {
675 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700676 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700677 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700678 "src/ports/SkTLS_pthread.cpp",
679 ]
680 }
681
mtklein7d6fb2c2016-08-25 14:50:44 -0700682 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500683 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500684 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500685 deps += [ "//third_party/cpu-features" ]
686 }
mtklein06c35c02016-09-20 12:28:12 -0700687 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700688 libs += [
689 "EGL",
690 "GLESv2",
691 "log",
692 ]
693 }
694
mtkleinc04ff472016-06-23 10:29:30 -0700695 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700696 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700697 }
698
699 if (is_mac) {
700 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700701 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700702 "src/ports/SkFontHost_mac.cpp",
703 "src/ports/SkImageEncoder_CG.cpp",
704 "src/ports/SkImageGeneratorCG.cpp",
705 ]
mtklein09e61f72016-08-23 13:35:28 -0700706 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400707 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
708 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700709 "ApplicationServices.framework",
710 "OpenGL.framework",
711 ]
mtkleinc04ff472016-06-23 10:29:30 -0700712 }
abarth6fc8ff02016-07-15 15:15:15 -0700713
Mike Klein7d302882016-11-03 14:06:31 -0400714 if (is_ios) {
715 sources += [
716 "src/ports/SkDebug_stdio.cpp",
717 "src/ports/SkFontHost_mac.cpp",
718 "src/ports/SkImageEncoder_CG.cpp",
719 "src/ports/SkImageGeneratorCG.cpp",
720 ]
721 libs += [
722 "CoreFoundation.framework",
723 "CoreGraphics.framework",
724 "CoreText.framework",
725 "ImageIO.framework",
726 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400727
728 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
729 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400730 ]
731 }
732
abarth6fc8ff02016-07-15 15:15:15 -0700733 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700734 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700735 }
mtkleinc04ff472016-06-23 10:29:30 -0700736}
737
mtkleinc095df52016-08-24 12:23:52 -0700738# Targets guarded by skia_enable_tools may use //third_party freely.
739if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500740 # Used by gn_to_bp.py to list our public include dirs.
741 source_set("public") {
742 configs += [ ":skia_public" ]
743 }
744
Mike Kleinc36dedf2016-11-18 09:35:28 -0500745 config("skia.h_config") {
746 include_dirs = [ "$target_gen_dir" ]
747 }
748 action("skia.h") {
749 public_configs = [ ":skia.h_config" ]
750 skia_h = "$target_gen_dir/skia.h"
751 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400752 args = [ rebase_path(skia_h, root_build_dir) ] +
Greg Danielec6ae522017-04-25 13:38:26 -0400753 rebase_path(skia_public_includes) +
754 [ rebase_path("third_party/vulkan") ]
Mike Kleinc36dedf2016-11-18 09:35:28 -0500755 depfile = "$skia_h.deps"
756 outputs = [
757 skia_h,
758 ]
759 }
760
761 if (skia_enable_gpu && target_cpu == "x64") {
762 # Our bots only have 64-bit libOSMesa installed.
763 # TODO: worth fixing?
764 executable("fiddle") {
765 libs = []
766 if (is_linux) {
767 libs += [ "OSMesa" ]
768 }
769
770 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500771 "tools/fiddle/draw.cpp",
772 "tools/fiddle/fiddle_main.cpp",
773 ]
Joe Gregorio1e735c02017-04-19 14:05:14 -0400774 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500775 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400776 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500777 ":skia",
778 ":skia.h",
779 ]
780 }
781 }
782
783 if (skia_enable_gpu) {
784 source_set("public_headers_warnings_check") {
785 sources = [
786 "tools/public_headers_warnings_check.cpp",
787 ]
788 configs -= [ "//gn:warnings_except_public_headers" ]
789 deps = [
790 ":skia",
791 ":skia.h",
792 ]
793 }
794 }
795
mtkleinc095df52016-08-24 12:23:52 -0700796 template("test_lib") {
797 config(target_name + "_config") {
798 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700799 if (defined(invoker.public_defines)) {
800 defines = invoker.public_defines
801 }
mtklein25c81d42016-07-27 13:55:26 -0700802 }
mtkleinc095df52016-08-24 12:23:52 -0700803 source_set(target_name) {
804 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
805 public_configs = [
806 ":" + target_name + "_config",
807 ":skia_private",
808 ]
809
810 if (!defined(deps)) {
811 deps = []
812 }
813 deps += [ ":skia" ]
814 testonly = true
815 }
mtklein25c81d42016-07-27 13:55:26 -0700816 }
mtklein25c81d42016-07-27 13:55:26 -0700817
Mike Kleine6682eb2017-01-05 10:54:57 -0500818 template("test_app") {
819 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
820 shared_library("lib" + target_name) {
821 forward_variables_from(invoker, "*", [ "is_shared_library" ])
822 testonly = true
823 }
824 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500825 _executable = target_name
826 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500827 forward_variables_from(invoker, "*", [ "is_shared_library" ])
828 testonly = true
829 }
830 }
Mike Klein7d921032017-01-05 12:20:41 -0500831 if (is_android && skia_android_serial != "" && defined(_executable)) {
832 action("push_" + target_name) {
833 script = "gn/push_to_android.py"
834 deps = [
835 ":" + _executable,
836 ]
837 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
838 outputs = [
839 _stamp,
840 ]
841 args = [
842 rebase_path("$root_build_dir/$_executable"),
843 skia_android_serial,
844 rebase_path(_stamp),
845 ]
846 testonly = true
847 }
848 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500849 }
850
mtkleinc095df52016-08-24 12:23:52 -0700851 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700852 public_include_dirs = []
853 if (skia_enable_gpu) {
854 public_defines = []
855 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700856
857 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700858 sources = [
859 "tools/gpu/GrContextFactory.cpp",
860 "tools/gpu/GrTest.cpp",
861 "tools/gpu/TestContext.cpp",
862 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700863 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700864 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
865 "tools/gpu/gl/debug/GrBufferObj.cpp",
866 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
867 "tools/gpu/gl/debug/GrProgramObj.cpp",
868 "tools/gpu/gl/debug/GrShaderObj.cpp",
869 "tools/gpu/gl/debug/GrTextureObj.cpp",
870 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
871 "tools/gpu/gl/null/NullGLTestContext.cpp",
872 ]
873 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700874
Kevin Lubick4a24e102017-03-29 11:19:01 -0400875 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700876 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400877 } else if (is_ios) {
878 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
879 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700880 } else if (is_linux) {
881 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500882 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700883 } else if (is_mac) {
884 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400885 } else if (is_win) {
886 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
887 libs += [
888 "Gdi32.lib",
889 "OpenGL32.lib",
890 ]
mtklein38925aa2016-09-21 10:11:25 -0700891 }
mtklein6ef69992016-09-14 06:12:09 -0700892
Mike Kleinc168a3a2016-11-14 14:53:13 +0000893 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000894 deps += [ "//third_party/angle2" ]
895 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
896 }
mtklein38925aa2016-09-21 10:11:25 -0700897 if (skia_use_mesa) {
898 public_defines += [ "SK_MESA" ]
899 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
900 libs += [ "OSMesa" ]
901 }
mtkleind68f9b02016-09-23 13:18:41 -0700902 if (skia_use_vulkan) {
903 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400904 if (is_win) {
905 libs += [ "vulkan-1.lib" ]
906 } else {
907 libs += [ "vulkan" ]
908 }
mtkleind68f9b02016-09-23 13:18:41 -0700909 }
mtkleina627b5c2016-09-20 13:36:47 -0700910 }
mtklein25c81d42016-07-27 13:55:26 -0700911 }
mtklein25c81d42016-07-27 13:55:26 -0700912
mtkleinc095df52016-08-24 12:23:52 -0700913 test_lib("flags") {
914 public_include_dirs = [ "tools/flags" ]
915 sources = [
916 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700917 ]
918 }
919 test_lib("common_flags") {
920 public_include_dirs = [ "tools/flags" ]
921 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700922 "tools/flags/SkCommonFlags.cpp",
923 "tools/flags/SkCommonFlagsConfig.cpp",
924 ]
925 deps = [
mtklein046cb562016-09-16 10:23:12 -0700926 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700927 ":gpu_tool_utils",
928 ]
929 }
mtklein25c81d42016-07-27 13:55:26 -0700930
mtkleinc095df52016-08-24 12:23:52 -0700931 test_lib("tool_utils") {
932 public_include_dirs = [
933 "tools",
934 "tools/debugger",
935 "tools/timer",
936 ]
937 sources = [
mtkleinb37c0342016-09-09 11:07:45 -0700938 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700939 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700940 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700941 "tools/ProcStats.cpp",
942 "tools/Resources.cpp",
943 "tools/ThermalManager.cpp",
944 "tools/UrlDataManager.cpp",
945 "tools/debugger/SkDebugCanvas.cpp",
946 "tools/debugger/SkDrawCommand.cpp",
947 "tools/debugger/SkJsonWriteBuffer.cpp",
948 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700949 "tools/picture_utils.cpp",
950 "tools/random_parse_path.cpp",
951 "tools/sk_tool_utils.cpp",
952 "tools/sk_tool_utils_font.cpp",
953 "tools/timer/Timer.cpp",
954 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500955 libs = []
956 if (is_ios) {
957 sources += [ "tools/ios_utils.m" ]
958 libs += [ "Foundation.framework" ]
959 }
mtkleinc095df52016-08-24 12:23:52 -0700960 deps = [
mtklein046cb562016-09-16 10:23:12 -0700961 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700962 ":flags",
963 "//third_party/libpng",
964 ]
965 public_deps = [
966 "//third_party/jsoncpp",
967 ]
968 }
mtklein25c81d42016-07-27 13:55:26 -0700969
Mike Klein6e744122016-10-27 12:21:40 -0400970 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700971 test_lib("gm") {
972 public_include_dirs = [ "gm" ]
973 sources = gm_sources
974 deps = [
scroggo19b91532016-10-24 09:03:26 -0700975 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700976 ":gpu_tool_utils",
977 ":skia",
978 ":tool_utils",
979 ]
980 }
mtklein25c81d42016-07-27 13:55:26 -0700981
Mike Klein6e744122016-10-27 12:21:40 -0400982 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700983 test_lib("tests") {
984 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400985 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700986 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400987 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700988 }
mtkleinc095df52016-08-24 12:23:52 -0700989 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700990 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700991 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700992 ":skia",
993 ":tool_utils",
994 "//third_party/libpng",
995 "//third_party/zlib",
996 ]
Mike Kleind63442d2017-03-27 14:16:04 -0400997 public_deps = [
998 ":gpu_tool_utils", # Test.h #includes headers from this target.
999 ]
mtkleinc095df52016-08-24 12:23:52 -07001000 }
mtklein2f3416d2016-08-02 16:02:05 -07001001
Mike Klein6e744122016-10-27 12:21:40 -04001002 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001003 test_lib("bench") {
1004 public_include_dirs = [ "bench" ]
1005 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001006 deps = [
1007 ":flags",
1008 ":gm",
1009 ":gpu_tool_utils",
1010 ":skia",
1011 ":tool_utils",
1012 ]
1013 }
mtklein2b6870c2016-07-28 14:17:33 -07001014
mtkleinc095df52016-08-24 12:23:52 -07001015 test_lib("experimental_svg_model") {
1016 public_include_dirs = [ "experimental/svg/model" ]
1017 sources = [
1018 "experimental/svg/model/SkSVGAttribute.cpp",
1019 "experimental/svg/model/SkSVGAttributeParser.cpp",
1020 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001021 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001022 "experimental/svg/model/SkSVGContainer.cpp",
1023 "experimental/svg/model/SkSVGDOM.cpp",
1024 "experimental/svg/model/SkSVGEllipse.cpp",
1025 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001026 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001027 "experimental/svg/model/SkSVGNode.cpp",
1028 "experimental/svg/model/SkSVGPath.cpp",
1029 "experimental/svg/model/SkSVGPoly.cpp",
1030 "experimental/svg/model/SkSVGRect.cpp",
1031 "experimental/svg/model/SkSVGRenderContext.cpp",
1032 "experimental/svg/model/SkSVGSVG.cpp",
1033 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001034 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001035 "experimental/svg/model/SkSVGTransformableNode.cpp",
1036 "experimental/svg/model/SkSVGValue.cpp",
1037 ]
1038 deps = [
1039 ":skia",
1040 ]
1041 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001042
Brian Osman16adfa32016-10-18 14:42:44 -04001043 test_lib("views") {
1044 public_include_dirs = [ "include/views" ]
1045 sources = [
1046 "src/views/SkEvent.cpp",
1047 "src/views/SkEventSink.cpp",
1048 "src/views/SkOSMenu.cpp",
1049 "src/views/SkTagList.cpp",
1050 "src/views/SkTouchGesture.cpp",
1051 "src/views/SkView.cpp",
1052 "src/views/SkViewPriv.cpp",
1053 ]
1054 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001055 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001056 if (!is_android) {
1057 sources += [ "src/views/SkWindow.cpp" ]
1058 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001059 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001060 public_include_dirs += [ "src/views/unix" ]
1061 sources += [
1062 "src/views/unix/SkOSWindow_Unix.cpp",
1063 "src/views/unix/keysym2ucs.c",
1064 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001065 libs += [
1066 "GL",
1067 "X11",
1068 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001069 } else if (is_mac) {
1070 sources += [
1071 "src/views/mac/SkEventNotifier.mm",
1072 "src/views/mac/SkNSView.mm",
1073 "src/views/mac/SkOSWindow_Mac.mm",
1074 "src/views/mac/SkTextFieldCell.m",
1075 ]
1076 libs += [
1077 "QuartzCore.framework",
1078 "Cocoa.framework",
1079 "Foundation.framework",
1080 ]
1081 } else if (is_win) {
1082 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1083 }
Brian Osman34755e22016-12-05 09:46:02 -05001084 if (skia_use_angle) {
1085 deps += [ "//third_party/angle2" ]
1086 }
Brian Osman16adfa32016-10-18 14:42:44 -04001087 }
1088
Mike Klein38af9432016-11-11 11:39:44 -05001089 if (skia_use_lua) {
1090 test_lib("lua") {
1091 public_include_dirs = []
1092 sources = [
1093 "src/utils/SkLua.cpp",
1094 "src/utils/SkLuaCanvas.cpp",
1095 ]
1096 deps = [
1097 "//third_party/lua",
1098 ]
1099 }
1100
Mike Kleine6682eb2017-01-05 10:54:57 -05001101 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001102 sources = [
1103 "tools/lua/lua_app.cpp",
1104 ]
1105 deps = [
1106 ":lua",
1107 ":skia",
1108 "//third_party/lua",
1109 ]
Mike Klein38af9432016-11-11 11:39:44 -05001110 }
1111
Mike Kleine6682eb2017-01-05 10:54:57 -05001112 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001113 sources = [
1114 "tools/lua/lua_pictures.cpp",
1115 ]
1116 deps = [
1117 ":flags",
1118 ":lua",
1119 ":skia",
1120 ":tool_utils",
1121 "//third_party/lua",
1122 ]
Mike Klein38af9432016-11-11 11:39:44 -05001123 }
1124 }
1125
Mike Klein6e744122016-10-27 12:21:40 -04001126 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001127 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001128 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001129 include_dirs = [ "experimental" ]
1130 sources = samples_sources + [
1131 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1132 "experimental/SkSetPoly3To3.cpp",
1133 "experimental/SkSetPoly3To3_A.cpp",
1134 "experimental/SkSetPoly3To3_D.cpp",
1135 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001136 deps = [
1137 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001138 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001139 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001140 ":tool_utils",
1141 ":views",
1142 ":xml",
1143 ]
Mike Klein38af9432016-11-11 11:39:44 -05001144
1145 if (skia_use_lua) {
1146 sources += [ "samplecode/SampleLua.cpp" ]
1147 deps += [
1148 ":lua",
1149 "//third_party/lua",
1150 ]
1151 }
Brian Osman16adfa32016-10-18 14:42:44 -04001152 }
1153
Mike Kleine6682eb2017-01-05 10:54:57 -05001154 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001155 sources = [
1156 "dm/DM.cpp",
1157 "dm/DMJsonWriter.cpp",
1158 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001159 ]
1160 include_dirs = [ "tests" ]
1161 deps = [
mtklein046cb562016-09-16 10:23:12 -07001162 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001163 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001164 ":flags",
1165 ":gm",
1166 ":gpu_tool_utils",
1167 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001168 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001169 ":tool_utils",
1170 "//third_party/jsoncpp",
1171 "//third_party/libpng",
1172 ]
mtklein2b6870c2016-07-28 14:17:33 -07001173 }
1174
Mike Klein06432b22017-03-21 13:14:33 -04001175 test_app("ok") {
1176 sources = [
1177 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001178 "tools/ok_dsts.cpp",
1179 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001180 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001181 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001182 ]
1183 deps = [
1184 ":gm",
1185 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001186 ":tests",
Mike Klein06432b22017-03-21 13:14:33 -04001187 ]
1188 }
1189
Mike Kleina3430172016-09-27 16:46:29 -04001190 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001191 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001192 sources = [
1193 "tools/monobench.cpp",
1194 ]
1195 deps = [
1196 ":bench",
1197 ":skia",
1198 ]
Mike Kleina3430172016-09-27 16:46:29 -04001199 }
mtklein2b6870c2016-07-28 14:17:33 -07001200 }
1201
Mike Kleine6682eb2017-01-05 10:54:57 -05001202 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001203 sources = [
1204 "bench/nanobench.cpp",
1205 ]
1206 deps = [
1207 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001208 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001209 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001210 ":flags",
1211 ":gm",
1212 ":gpu_tool_utils",
1213 ":skia",
1214 ":tool_utils",
1215 "//third_party/jsoncpp",
1216 ]
mtklein2b6870c2016-07-28 14:17:33 -07001217 }
halcanary19a97202016-08-03 15:08:04 -07001218
Ravi Mistry10d36c52017-01-31 09:49:18 -05001219 test_app("skpinfo") {
1220 sources = [
1221 "tools/skpinfo.cpp",
1222 ]
1223 deps = [
1224 ":flags",
1225 ":skia",
1226 ]
1227 }
1228
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001229 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001230 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001231 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001232 "samplecode/SampleApp.cpp",
1233 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001234 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001235 if (is_mac) {
1236 sources += [ "src/views/mac/skia_mac.mm" ]
1237 } else if (is_win) {
1238 sources += [ "src/views/win/skia_win.cpp" ]
1239 } else if (is_linux) {
1240 sources += [ "src/views/unix/skia_unix.cpp" ]
1241 }
mtklein38925aa2016-09-21 10:11:25 -07001242 deps = [
1243 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001244 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001245 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001246 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001247 ":skia",
1248 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001249 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001250 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001251 if (skia_use_angle) {
1252 deps += [ "//third_party/angle2" ]
1253 }
mtklein38925aa2016-09-21 10:11:25 -07001254 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001255 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001256
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001257 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001258 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001259 sources = [
1260 "tools/skpbench/skpbench.cpp",
1261 ]
1262 deps = [
1263 ":flags",
1264 ":gpu_tool_utils",
1265 ":skia",
1266 ":tool_utils",
1267 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001268 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001269 }
1270
Mike Klein7d302882016-11-03 14:06:31 -04001271 # We can't yet build ICU on iOS or Windows.
1272 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001273 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001274 sources = [
1275 "tools/SkShaper_harfbuzz.cpp",
1276 "tools/using_skia_and_harfbuzz.cpp",
1277 ]
1278 deps = [
1279 ":skia",
1280 "//third_party/harfbuzz",
1281 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001282 }
halcanary19a97202016-08-03 15:08:04 -07001283 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001284 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001285 sources = [
1286 "tools/SkShaper_primitive.cpp",
1287 "tools/using_skia_and_harfbuzz.cpp",
1288 ]
1289 deps = [
1290 ":skia",
1291 ]
halcanary3eee9d92016-09-10 07:01:53 -07001292 }
mtklein046cb562016-09-16 10:23:12 -07001293
Mike Kleine6682eb2017-01-05 10:54:57 -05001294 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001295 sources = [
1296 "tools/get_images_from_skps.cpp",
1297 ]
1298 deps = [
1299 ":flags",
1300 ":skia",
1301 "//third_party/jsoncpp",
1302 ]
mtklein046cb562016-09-16 10:23:12 -07001303 }
mtkleinecbc5262016-09-22 11:51:24 -07001304
Mike Kleine6682eb2017-01-05 10:54:57 -05001305 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001306 sources = [
1307 "tools/colorspaceinfo.cpp",
1308 ]
1309 deps = [
1310 ":flags",
1311 ":skia",
1312 ":tool_utils",
1313 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001314 }
1315
Mike Klein7d302882016-11-03 14:06:31 -04001316 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001317 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001318 sources = [
1319 "tools/skiaserve/Request.cpp",
1320 "tools/skiaserve/Response.cpp",
1321 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001322 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1323 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1324 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1325 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1326 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1327 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1328 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1329 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1330 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001331 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1332 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001333 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1334 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1335 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1336 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1337 ]
1338 deps = [
1339 ":flags",
1340 ":gpu_tool_utils",
1341 ":skia",
1342 ":tool_utils",
1343 "//third_party/jsoncpp",
1344 "//third_party/libmicrohttpd",
1345 "//third_party/libpng",
1346 ]
Mike Klein7d302882016-11-03 14:06:31 -04001347 }
mtkleinecbc5262016-09-22 11:51:24 -07001348 }
kjlubick14f984b2016-10-03 11:49:45 -07001349
Mike Kleine6682eb2017-01-05 10:54:57 -05001350 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001351 sources = [
1352 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001353 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001354 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001355 "fuzz/FuzzGradients.cpp",
1356 "fuzz/FuzzParsePath.cpp",
1357 "fuzz/FuzzPathop.cpp",
1358 "fuzz/FuzzScaleToSides.cpp",
1359 "fuzz/fuzz.cpp",
1360 ]
1361 deps = [
1362 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001363 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001364 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001365 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001366 ]
kjlubick14f984b2016-10-03 11:49:45 -07001367 }
Mike Klein38312422016-10-05 15:41:01 -04001368
Mike Kleine6682eb2017-01-05 10:54:57 -05001369 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001370 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001371 rebase_path("tests/skia_test.cpp"),
1372 rebase_path("tests/Test.cpp"),
1373 ]
caryclark9feb6322016-10-25 08:58:26 -07001374 deps = [
1375 ":flags",
1376 ":gpu_tool_utils",
1377 ":skia",
1378 ":tool_utils",
1379 ]
caryclark9feb6322016-10-25 08:58:26 -07001380 }
1381
Mike Kleine6682eb2017-01-05 10:54:57 -05001382 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001383 sources = [
1384 "tools/DumpRecord.cpp",
1385 "tools/dump_record.cpp",
1386 ]
1387 deps = [
1388 ":flags",
1389 ":skia",
1390 ]
Mike Klein38312422016-10-05 15:41:01 -04001391 }
bungemanfe917272016-10-13 17:36:40 -04001392
Mike Kleine6682eb2017-01-05 10:54:57 -05001393 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001394 sources = [
1395 "tools/skdiff/skdiff.cpp",
1396 "tools/skdiff/skdiff_html.cpp",
1397 "tools/skdiff/skdiff_main.cpp",
1398 "tools/skdiff/skdiff_utils.cpp",
1399 ]
1400 deps = [
1401 ":skia",
1402 ":tool_utils",
1403 ]
bungemanfe917272016-10-13 17:36:40 -04001404 }
halcanarya73d76a2016-10-17 13:19:02 -07001405
Mike Kleine6682eb2017-01-05 10:54:57 -05001406 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001407 sources = [
1408 "tools/skp_parser.cpp",
1409 ]
1410 deps = [
1411 ":skia",
1412 ":tool_utils",
1413 "//third_party/jsoncpp",
1414 ]
halcanarya73d76a2016-10-17 13:19:02 -07001415 }
Brian Osman16adfa32016-10-18 14:42:44 -04001416
Mike Kleina92c3832016-12-08 09:49:39 -05001417 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001418 test_app("viewer") {
1419 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001420 sources = [
1421 "tools/viewer/GMSlide.cpp",
1422 "tools/viewer/ImageSlide.cpp",
1423 "tools/viewer/SKPSlide.cpp",
1424 "tools/viewer/SampleSlide.cpp",
1425 "tools/viewer/Viewer.cpp",
1426 "tools/viewer/sk_app/CommandSet.cpp",
1427 "tools/viewer/sk_app/GLWindowContext.cpp",
1428 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001429 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001430 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001431
Jim Van Verth4e56a912016-10-21 10:58:52 -04001432 if (is_android) {
1433 sources += [
1434 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1435 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1436 "tools/viewer/sk_app/android/Window_android.cpp",
1437 "tools/viewer/sk_app/android/main_android.cpp",
1438 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1439 ]
Brian Osman462334e2017-02-09 11:22:57 -05001440 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001441 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001442 sources += [
1443 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1444 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1445 "tools/viewer/sk_app/unix/Window_unix.cpp",
1446 "tools/viewer/sk_app/unix/main_unix.cpp",
1447 ]
1448 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001449 sources += [
1450 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1451 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1452 "tools/viewer/sk_app/win/Window_win.cpp",
1453 "tools/viewer/sk_app/win/main_win.cpp",
1454 ]
Mike Klein43c25262016-10-20 10:17:47 -04001455 } else if (is_mac) {
1456 sources += [
1457 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1458 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1459 "tools/viewer/sk_app/mac/Window_mac.cpp",
1460 "tools/viewer/sk_app/mac/main_mac.cpp",
1461 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001462 }
1463
1464 if (skia_use_vulkan) {
1465 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001466 if (is_android) {
1467 sources +=
1468 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001469 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001470 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1471 libs += [ "X11-xcb" ]
1472 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001473 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1474 }
1475 }
1476
1477 include_dirs = []
1478 deps = [
1479 ":flags",
1480 ":gm",
1481 ":gpu_tool_utils",
1482 ":samples",
1483 ":skia",
1484 ":tool_utils",
1485 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001486 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001487 "//third_party/jsoncpp",
1488 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001489 if (is_android) {
1490 deps += [ "//third_party/native_app_glue" ]
1491 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001492 deps += [ "//third_party/libsdl" ]
1493 }
Mike Kleina92c3832016-12-08 09:49:39 -05001494 }
Brian Osman16adfa32016-10-18 14:42:44 -04001495 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001496
Mike Kleine459afd2017-03-03 09:21:30 -05001497 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001498 copy("gdbserver") {
1499 sources = [
1500 "$ndk/$ndk_gdbserver",
1501 ]
1502 outputs = [
1503 "$root_out_dir/gdbserver",
1504 ]
1505 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001506 }
1507
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001508 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001509 test_app("skslc") {
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001510 defines = [ "SKSL_STANDALONE" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001511 sources = [
1512 "src/sksl/SkSLMain.cpp",
1513 ]
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001514 sources += skia_sksl_sources
1515 include_dirs = [ "src/sksl" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001516 }
1517 }
mtklein25c81d42016-07-27 13:55:26 -07001518}