blob: e3f87bce65ba12cf6e9d3c576920bad2d02011d2 [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() {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000058 skia_vulkan_headers = ""
Greg Danielec6ae522017-04-25 13:38:26 -040059 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000060 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040061 if (is_fuchsia) {
62 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
63 } else if (is_linux || is_win) {
64 skia_vulkan_headers = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040065 }
Greg Danielec6ae522017-04-25 13:38:26 -040066 }
67}
Brian Salomon789e25e2016-09-30 13:41:03 -040068
mtklein38925aa2016-09-21 10:11:25 -070069# Our tools require static linking (they use non-exported symbols).
70skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070071
mtkleina45be612016-08-29 15:22:10 -070072fontmgr_android_enabled = skia_use_expat && skia_use_freetype
73
mtklein1211e0c2016-07-26 13:55:45 -070074skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070075 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070076 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070077 "include/codec",
78 "include/config",
79 "include/core",
80 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040081 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070082 "include/gpu",
83 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070084 "include/pathops",
85 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070086 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070087 "include/utils",
88 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070089]
90
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000091if (skia_use_vulkan) {
92 skia_public_includes += [ "include/gpu/vk" ]
93}
94
mtkleinc04ff472016-06-23 10:29:30 -070095# Skia public API, generally provided by :skia.
96config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070097 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -040098 if (skia_vulkan_headers != "") {
99 include_dirs += [ skia_vulkan_headers ]
100 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400101 defines = []
102 if (is_component_build) {
103 defines += [ "SKIA_DLL" ]
104 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400105 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700106 defines += [ "SK_SAMPLES_FOR_X" ]
107 }
mtkleincae1be52016-09-20 08:24:34 -0700108 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -0400109 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -0700110 }
mtklein06c35c02016-09-20 12:28:12 -0700111 if (!skia_enable_gpu) {
112 defines += [ "SK_SUPPORT_GPU=0" ]
113 }
mtkleinc04ff472016-06-23 10:29:30 -0700114}
115
116# Skia internal APIs, used by Skia itself and a few test tools.
117config("skia_private") {
118 visibility = [ ":*" ]
119
120 include_dirs = [
121 "include/private",
122 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700123 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700124 "src/core",
125 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700126 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700127 "src/image",
128 "src/images",
129 "src/lazy",
130 "src/opts",
131 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700132 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700133 "src/ports",
134 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400135 "src/shaders",
136 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700137 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700138 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700139 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500140 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700141 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700142 ]
mtklein150d1132016-08-01 06:56:40 -0700143
Mike Reeda9e241d2017-05-03 10:52:00 -0400144 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700145 if (is_android) {
146 defines += [
147 "SK_GAMMA_EXPONENT=1.4",
148 "SK_GAMMA_CONTRAST=0.0",
149 ]
150 }
mtklein88a7ac02016-09-14 11:16:49 -0700151 if (is_official_build || is_android) {
152 # TODO(bsalomon): it'd be nice to make Android normal.
153 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
154 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400155 libs = []
156 lib_dirs = []
157 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700158 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400159 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400160 lib_dirs += [
161 "$skia_vulkan_sdk/Bin",
162 "$skia_vulkan_sdk/Lib",
163 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400164 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400165 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400166 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400167 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400168 }
Brian Salomon03e05842017-02-23 12:23:47 -0500169 if (skia_enable_gpu) {
170 include_dirs += [ "src/gpu" ]
171 }
Brian Osman34755e22016-12-05 09:46:02 -0500172 if (skia_use_angle) {
173 defines += [ "SK_ANGLE" ]
174 }
Brian Osman3f375d02016-12-28 11:19:22 -0500175 if (skia_enable_discrete_gpu) {
176 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
177 }
mtkleinc04ff472016-06-23 10:29:30 -0700178}
179
180# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
181config("skia_library") {
182 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700183 defines = [ "SKIA_IMPLEMENTATION=1" ]
184}
185
186skia_library_configs = [
187 ":skia_public",
188 ":skia_private",
189 ":skia_library",
190]
191
mtklein9b8583d2016-08-24 17:32:30 -0700192# Use for CPU-specific Skia code that needs particular compiler flags.
193template("opts") {
194 if (invoker.enabled) {
195 source_set(target_name) {
196 forward_variables_from(invoker, "*")
197 configs += skia_library_configs
198 }
199 } else {
200 # If not enabled, a phony empty target that swallows all otherwise unused variables.
201 source_set(target_name) {
202 forward_variables_from(invoker,
203 "*",
204 [
205 "sources",
206 "cflags",
207 ])
208 }
209 }
anmittala7eaf2e2016-08-17 13:57:26 -0700210}
211
mtklein422310d2016-08-16 18:28:43 -0700212is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700213
mtklein7d6fb2c2016-08-25 14:50:44 -0700214opts("none") {
215 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700216 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700217 cflags = []
218}
219
mtklein7d6fb2c2016-08-25 14:50:44 -0700220opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700221 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700222 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700223 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700224}
225
226opts("arm64") {
227 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700228 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700229 cflags = []
230}
231
232opts("crc32") {
233 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700234 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700235 cflags = [ "-march=armv8-a+crc" ]
236}
237
mtklein9b8583d2016-08-24 17:32:30 -0700238opts("sse2") {
239 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400241 if (is_win) {
242 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
243 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400244 cflags = [ "-msse2" ]
245 }
mtklein9b8583d2016-08-24 17:32:30 -0700246}
mtkleinc04ff472016-06-23 10:29:30 -0700247
mtklein9b8583d2016-08-24 17:32:30 -0700248opts("ssse3") {
249 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400251 if (is_win) {
252 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
253 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400254 cflags = [ "-mssse3" ]
255 }
mtklein9b8583d2016-08-24 17:32:30 -0700256}
mtkleinc04ff472016-06-23 10:29:30 -0700257
mtklein9b8583d2016-08-24 17:32:30 -0700258opts("sse41") {
259 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700260 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400261 if (is_win) {
262 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
263 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400264 cflags = [ "-msse4.1" ]
265 }
mtklein9b8583d2016-08-24 17:32:30 -0700266}
mtklein4e976072016-08-08 09:06:27 -0700267
mtklein9b8583d2016-08-24 17:32:30 -0700268opts("sse42") {
269 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700270 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400271 if (is_win) {
272 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
273 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400274 cflags = [ "-msse4.2" ]
275 }
mtklein9b8583d2016-08-24 17:32:30 -0700276}
277
278opts("avx") {
279 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700280 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400281 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000282 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400283 } else {
284 cflags = [ "-mavx" ]
285 }
mtkleinc04ff472016-06-23 10:29:30 -0700286}
287
Mike Klein78d5a3b2016-09-30 10:48:01 -0400288opts("hsw") {
289 enabled = is_x86
290 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400291 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000292 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400293 } else {
294 cflags = [
295 "-mavx2",
296 "-mbmi",
297 "-mbmi2",
298 "-mf16c",
299 "-mfma",
300 ]
301 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400302}
303
mtkleinc095df52016-08-24 12:23:52 -0700304# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700305template("optional") {
306 if (invoker.enabled) {
307 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700308 if (defined(invoker.public_defines)) {
309 defines = invoker.public_defines
310 }
mtklein457b42a2016-08-23 13:56:37 -0700311 }
312 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700313 forward_variables_from(invoker,
314 "*",
315 [
316 "public_defines",
317 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700318 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700319 ])
mtklein457b42a2016-08-23 13:56:37 -0700320 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700321 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700322 if (defined(invoker.configs_to_remove)) {
323 configs -= invoker.configs_to_remove
324 }
mtklein457b42a2016-08-23 13:56:37 -0700325 }
326 } else {
mtklein457b42a2016-08-23 13:56:37 -0700327 source_set(target_name) {
328 forward_variables_from(invoker,
329 "*",
330 [
331 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700332 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700333 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700334 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700335 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700336 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700337 ])
mtkleincd01b032016-08-31 04:58:19 -0700338 if (defined(invoker.sources_when_disabled)) {
339 sources = invoker.sources_when_disabled
340 }
341 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700342 }
mtkleineb3c4252016-08-23 07:38:09 -0700343 }
mtklein457b42a2016-08-23 13:56:37 -0700344}
mtklein457b42a2016-08-23 13:56:37 -0700345
Mike Kleina04bb452017-02-09 12:24:07 -0500346optional("effects") {
347 enabled = skia_enable_effects
348 sources =
349 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
350 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
351}
352
mtkleina45be612016-08-29 15:22:10 -0700353optional("fontmgr_android") {
354 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700355
356 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500357 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700358 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700359 ]
360 sources = [
361 "src/ports/SkFontMgr_android.cpp",
362 "src/ports/SkFontMgr_android_factory.cpp",
363 "src/ports/SkFontMgr_android_parser.cpp",
364 ]
365}
366
mtkleind2e39db2016-09-07 07:52:55 -0700367optional("fontmgr_custom") {
368 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
369
370 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500371 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700372 ]
373 sources = [
374 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500375 "src/ports/SkFontMgr_custom.h",
376 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700377 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500378 "src/ports/SkFontMgr_custom_embedded.cpp",
379 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700380 ]
381}
382
mtklein3cc22182016-08-29 13:26:14 -0700383optional("fontmgr_fontconfig") {
384 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700385
386 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500387 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700388 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700389 ]
390 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700391 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700392 "src/ports/SkFontConfigInterface_direct.cpp",
393 "src/ports/SkFontConfigInterface_direct_factory.cpp",
394 "src/ports/SkFontMgr_FontConfigInterface.cpp",
395 "src/ports/SkFontMgr_fontconfig.cpp",
396 "src/ports/SkFontMgr_fontconfig_factory.cpp",
397 ]
398}
399
mtkleincdedd0e2016-09-12 15:15:44 -0700400optional("fontmgr_fuchsia") {
401 enabled = is_fuchsia && skia_use_freetype
402
403 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500404 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700405 ]
406 sources = [
407 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500408 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700409 "src/ports/SkFontMgr_custom_empty_factory.cpp",
410 ]
411}
412
mtklein06c35c02016-09-20 12:28:12 -0700413optional("gpu") {
414 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700415 public_defines = []
416
Mike Klein29b3e582017-02-09 11:57:32 -0500417 sources = skia_gpu_sources + skia_sksl_sources +
418 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700419
420 # These paths need to be absolute to match the ones produced by shared_sources.gni.
421 sources -= get_path_info([
422 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
423 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
424 ],
425 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400426 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700427 if (is_android) {
428 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400429 } else if (skia_use_egl) {
430 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
431 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700432 } else if (is_linux) {
433 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500434 libs += [
435 "GL",
436 "GLU",
437 ]
mtklein06c35c02016-09-20 12:28:12 -0700438 } else if (is_mac) {
439 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800440 } else if (is_ios) {
441 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400442 } else if (is_win) {
443 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
444 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700445 } else {
446 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
447 }
mtkleine9fb3d52016-09-20 15:11:46 -0700448
449 if (skia_use_vulkan) {
450 public_defines += [ "SK_VULKAN" ]
451 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700452 if (skia_enable_vulkan_debug_layers) {
453 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
454 }
mtkleine9fb3d52016-09-20 15:11:46 -0700455 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400456 if (skia_enable_spirv_validation) {
457 deps = [
458 "//third_party/spirv-tools",
459 ]
460 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
461 }
mtklein06c35c02016-09-20 12:28:12 -0700462}
463
mtklein63213812016-08-24 09:55:56 -0700464optional("jpeg") {
465 enabled = skia_use_libjpeg_turbo
466 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
467
mtklein63213812016-08-24 09:55:56 -0700468 deps = [
469 "//third_party/libjpeg-turbo:libjpeg",
470 ]
471 sources = [
472 "src/codec/SkJpegCodec.cpp",
473 "src/codec/SkJpegDecoderMgr.cpp",
474 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700475 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400476 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700477 ]
478}
479
480optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500481 enabled = skia_use_zlib && skia_enable_pdf
482 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700483
mtklein63213812016-08-24 09:55:56 -0700484 deps = [
485 "//third_party/zlib",
486 ]
brettwb9447282016-09-01 14:24:39 -0700487 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700488 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700489
490 if (skia_use_sfntly) {
491 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500492 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700493 }
494}
495
496optional("png") {
497 enabled = skia_use_libpng
498 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
499
mtklein63213812016-08-24 09:55:56 -0700500 deps = [
501 "//third_party/libpng",
502 ]
503 sources = [
504 "src/codec/SkIcoCodec.cpp",
505 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400506 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700507 ]
508}
509
scroggof84ad642016-10-31 09:02:57 -0700510optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400511 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700512 public_defines = [ "SK_CODEC_DECODES_RAW" ]
513
514 deps = [
515 "//third_party/dng_sdk",
516 "//third_party/libjpeg-turbo:libjpeg",
517 "//third_party/piex",
518 ]
519
520 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
521 # Skia.
522 configs_to_remove = [ "//gn:no_exceptions" ]
523
524 sources = [
525 "src/codec/SkRawAdapterCodec.cpp",
526 "src/codec/SkRawCodec.cpp",
527 ]
528}
529
mtklein3cc22182016-08-29 13:26:14 -0700530optional("typeface_freetype") {
531 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700532
533 deps = [
534 "//third_party/freetype2",
535 ]
536 sources = [
537 "src/ports/SkFontHost_FreeType.cpp",
538 "src/ports/SkFontHost_FreeType_common.cpp",
539 ]
540}
541
mtklein457b42a2016-08-23 13:56:37 -0700542optional("webp") {
543 enabled = skia_use_libwebp
544 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
545
mtklein457b42a2016-08-23 13:56:37 -0700546 deps = [
547 "//third_party/libwebp",
548 ]
549 sources = [
550 "src/codec/SkWebpAdapterCodec.cpp",
551 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400552 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700553 ]
mtkleineb3c4252016-08-23 07:38:09 -0700554}
555
mtklein63213812016-08-24 09:55:56 -0700556optional("xml") {
557 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000558 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700559
mtklein63213812016-08-24 09:55:56 -0700560 deps = [
561 "//third_party/expat",
562 ]
563 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500564 "src/svg/SkSVGCanvas.cpp",
565 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700566 "src/xml/SkDOM.cpp",
567 "src/xml/SkXMLParser.cpp",
568 "src/xml/SkXMLWriter.cpp",
569 ]
570}
571
mtkleinc04ff472016-06-23 10:29:30 -0700572component("skia") {
573 public_configs = [ ":skia_public" ]
574 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700575
576 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700577 ":arm64",
578 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700579 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700580 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500581 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700582 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700583 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700584 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700585 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700586 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400587 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700588 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700589 ":none",
mtklein63213812016-08-24 09:55:56 -0700590 ":pdf",
591 ":png",
scroggof84ad642016-10-31 09:02:57 -0700592 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700593 ":sse2",
594 ":sse41",
595 ":sse42",
596 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700597 ":webp",
mtklein63213812016-08-24 09:55:56 -0700598 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700599 ]
600
Chinmay Garde43f115c2016-11-16 15:04:12 -0800601 # This file (and all GN files in Skia) are designed to work with an
602 # empty sources assignment filter; we handle all that explicitly.
603 # We clear the filter here for clients who may have set up a global filter.
604 set_sources_assignment_filter([])
605
mtkleinc04ff472016-06-23 10:29:30 -0700606 sources = []
brettwb9447282016-09-01 14:24:39 -0700607 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700608 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500609 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700610 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700611 "src/android/SkBitmapRegionCodec.cpp",
612 "src/android/SkBitmapRegionDecoder.cpp",
613 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400614 "src/codec/SkBmpBaseCodec.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",
scroggo3d3a65c2016-10-24 12:28:30 -0700637 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700638 ]
brettwb9447282016-09-01 14:24:39 -0700639
mtklein7d6fb2c2016-08-25 14:50:44 -0700640 libs = []
641
mtkleinc04ff472016-06-23 10:29:30 -0700642 if (is_win) {
643 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400644 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700645 "src/ports/SkDebug_win.cpp",
646 "src/ports/SkFontHost_win.cpp",
647 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700648 "src/ports/SkImageEncoder_WIC.cpp",
649 "src/ports/SkImageGeneratorWIC.cpp",
650 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700651 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700652 "src/ports/SkScalerContext_win_dw.cpp",
653 "src/ports/SkTLS_win.cpp",
654 "src/ports/SkTypeface_win_dw.cpp",
655 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400656 if (skia_use_gdi) {
657 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
658 libs += [
659 "Gdi32.lib",
660 "Usp10.lib",
661 ]
662 } else {
663 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
664 }
mtkleinb9be9792016-09-16 14:44:18 -0700665 sources -=
666 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400667 libs += [
668 "FontSub.lib",
669 "Ole32.lib",
670 "OleAut32.lib",
671 "User32.lib",
672 ]
mtkleinc04ff472016-06-23 10:29:30 -0700673 } else {
674 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700675 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700676 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700677 "src/ports/SkTLS_pthread.cpp",
678 ]
679 }
680
mtklein7d6fb2c2016-08-25 14:50:44 -0700681 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500682 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500683 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500684 deps += [ "//third_party/cpu-features" ]
685 }
mtklein06c35c02016-09-20 12:28:12 -0700686 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700687 libs += [
688 "EGL",
689 "GLESv2",
690 "log",
691 ]
692 }
693
mtkleinc04ff472016-06-23 10:29:30 -0700694 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700695 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700696 }
697
698 if (is_mac) {
699 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700700 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700701 "src/ports/SkFontHost_mac.cpp",
702 "src/ports/SkImageEncoder_CG.cpp",
703 "src/ports/SkImageGeneratorCG.cpp",
704 ]
mtklein09e61f72016-08-23 13:35:28 -0700705 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400706 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
707 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700708 "ApplicationServices.framework",
709 "OpenGL.framework",
710 ]
mtkleinc04ff472016-06-23 10:29:30 -0700711 }
abarth6fc8ff02016-07-15 15:15:15 -0700712
Mike Klein7d302882016-11-03 14:06:31 -0400713 if (is_ios) {
714 sources += [
715 "src/ports/SkDebug_stdio.cpp",
716 "src/ports/SkFontHost_mac.cpp",
717 "src/ports/SkImageEncoder_CG.cpp",
718 "src/ports/SkImageGeneratorCG.cpp",
719 ]
720 libs += [
721 "CoreFoundation.framework",
722 "CoreGraphics.framework",
723 "CoreText.framework",
724 "ImageIO.framework",
725 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400726
727 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
728 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400729 ]
730 }
731
abarth6fc8ff02016-07-15 15:15:15 -0700732 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700733 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700734 }
mtkleinc04ff472016-06-23 10:29:30 -0700735}
736
mtkleinc095df52016-08-24 12:23:52 -0700737# Targets guarded by skia_enable_tools may use //third_party freely.
738if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500739 # Used by gn_to_bp.py to list our public include dirs.
740 source_set("public") {
741 configs += [ ":skia_public" ]
742 }
743
Mike Kleinc36dedf2016-11-18 09:35:28 -0500744 config("skia.h_config") {
745 include_dirs = [ "$target_gen_dir" ]
746 }
747 action("skia.h") {
748 public_configs = [ ":skia.h_config" ]
749 skia_h = "$target_gen_dir/skia.h"
750 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400751 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000752 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500753 depfile = "$skia_h.deps"
754 outputs = [
755 skia_h,
756 ]
757 }
758
759 if (skia_enable_gpu && target_cpu == "x64") {
760 # Our bots only have 64-bit libOSMesa installed.
761 # TODO: worth fixing?
762 executable("fiddle") {
763 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500764 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500765 "tools/fiddle/draw.cpp",
766 "tools/fiddle/fiddle_main.cpp",
767 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400768
769 if (skia_use_egl) {
770 sources += [ "tools/fiddle/egl_context.cpp" ]
771 } else if (skia_use_mesa) {
772 sources += [ "tools/fiddle/mesa_context.cpp" ]
773 if (is_linux) {
774 libs += [ "OSMesa" ]
775 }
776 } else {
777 sources += [ "tools/fiddle/null_context.cpp" ]
778 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400779 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500780 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400781 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500782 ":skia",
783 ":skia.h",
784 ]
785 }
786 }
787
788 if (skia_enable_gpu) {
789 source_set("public_headers_warnings_check") {
790 sources = [
791 "tools/public_headers_warnings_check.cpp",
792 ]
793 configs -= [ "//gn:warnings_except_public_headers" ]
794 deps = [
795 ":skia",
796 ":skia.h",
797 ]
798 }
799 }
800
mtkleinc095df52016-08-24 12:23:52 -0700801 template("test_lib") {
802 config(target_name + "_config") {
803 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700804 if (defined(invoker.public_defines)) {
805 defines = invoker.public_defines
806 }
mtklein25c81d42016-07-27 13:55:26 -0700807 }
mtkleinc095df52016-08-24 12:23:52 -0700808 source_set(target_name) {
809 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
810 public_configs = [
811 ":" + target_name + "_config",
812 ":skia_private",
813 ]
814
815 if (!defined(deps)) {
816 deps = []
817 }
818 deps += [ ":skia" ]
819 testonly = true
820 }
mtklein25c81d42016-07-27 13:55:26 -0700821 }
mtklein25c81d42016-07-27 13:55:26 -0700822
Mike Kleine6682eb2017-01-05 10:54:57 -0500823 template("test_app") {
824 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
825 shared_library("lib" + target_name) {
826 forward_variables_from(invoker, "*", [ "is_shared_library" ])
827 testonly = true
828 }
829 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500830 _executable = target_name
831 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500832 forward_variables_from(invoker, "*", [ "is_shared_library" ])
833 testonly = true
834 }
835 }
Mike Klein7d921032017-01-05 12:20:41 -0500836 if (is_android && skia_android_serial != "" && defined(_executable)) {
837 action("push_" + target_name) {
838 script = "gn/push_to_android.py"
839 deps = [
840 ":" + _executable,
841 ]
842 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
843 outputs = [
844 _stamp,
845 ]
846 args = [
847 rebase_path("$root_build_dir/$_executable"),
848 skia_android_serial,
849 rebase_path(_stamp),
850 ]
851 testonly = true
852 }
853 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500854 }
855
mtkleinc095df52016-08-24 12:23:52 -0700856 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700857 public_include_dirs = []
858 if (skia_enable_gpu) {
859 public_defines = []
860 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700861
862 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700863 sources = [
864 "tools/gpu/GrContextFactory.cpp",
865 "tools/gpu/GrTest.cpp",
866 "tools/gpu/TestContext.cpp",
867 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700868 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700869 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
870 "tools/gpu/gl/debug/GrBufferObj.cpp",
871 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
872 "tools/gpu/gl/debug/GrProgramObj.cpp",
873 "tools/gpu/gl/debug/GrShaderObj.cpp",
874 "tools/gpu/gl/debug/GrTextureObj.cpp",
875 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
876 "tools/gpu/gl/null/NullGLTestContext.cpp",
877 ]
878 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700879
Kevin Lubick4a24e102017-03-29 11:19:01 -0400880 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700881 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400882 } else if (is_ios) {
883 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
884 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700885 } else if (is_linux) {
886 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500887 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700888 } else if (is_mac) {
889 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400890 } else if (is_win) {
891 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
892 libs += [
893 "Gdi32.lib",
894 "OpenGL32.lib",
895 ]
mtklein38925aa2016-09-21 10:11:25 -0700896 }
mtklein6ef69992016-09-14 06:12:09 -0700897
Mike Kleinc168a3a2016-11-14 14:53:13 +0000898 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000899 deps += [ "//third_party/angle2" ]
900 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
901 }
mtklein38925aa2016-09-21 10:11:25 -0700902 if (skia_use_mesa) {
903 public_defines += [ "SK_MESA" ]
904 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
905 libs += [ "OSMesa" ]
906 }
mtkleind68f9b02016-09-23 13:18:41 -0700907 if (skia_use_vulkan) {
908 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400909 if (is_win) {
910 libs += [ "vulkan-1.lib" ]
911 } else {
912 libs += [ "vulkan" ]
913 }
mtkleind68f9b02016-09-23 13:18:41 -0700914 }
mtkleina627b5c2016-09-20 13:36:47 -0700915 }
mtklein25c81d42016-07-27 13:55:26 -0700916 }
mtklein25c81d42016-07-27 13:55:26 -0700917
mtkleinc095df52016-08-24 12:23:52 -0700918 test_lib("flags") {
919 public_include_dirs = [ "tools/flags" ]
920 sources = [
921 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700922 ]
923 }
924 test_lib("common_flags") {
925 public_include_dirs = [ "tools/flags" ]
926 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700927 "tools/flags/SkCommonFlags.cpp",
928 "tools/flags/SkCommonFlagsConfig.cpp",
929 ]
930 deps = [
mtklein046cb562016-09-16 10:23:12 -0700931 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700932 ":gpu_tool_utils",
933 ]
934 }
mtklein25c81d42016-07-27 13:55:26 -0700935
mtkleinc095df52016-08-24 12:23:52 -0700936 test_lib("tool_utils") {
937 public_include_dirs = [
938 "tools",
939 "tools/debugger",
940 "tools/timer",
941 ]
942 sources = [
mtkleinb37c0342016-09-09 11:07:45 -0700943 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700944 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700945 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700946 "tools/ProcStats.cpp",
947 "tools/Resources.cpp",
948 "tools/ThermalManager.cpp",
949 "tools/UrlDataManager.cpp",
950 "tools/debugger/SkDebugCanvas.cpp",
951 "tools/debugger/SkDrawCommand.cpp",
952 "tools/debugger/SkJsonWriteBuffer.cpp",
953 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700954 "tools/picture_utils.cpp",
955 "tools/random_parse_path.cpp",
956 "tools/sk_tool_utils.cpp",
957 "tools/sk_tool_utils_font.cpp",
958 "tools/timer/Timer.cpp",
959 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500960 libs = []
961 if (is_ios) {
962 sources += [ "tools/ios_utils.m" ]
963 libs += [ "Foundation.framework" ]
964 }
mtkleinc095df52016-08-24 12:23:52 -0700965 deps = [
mtklein046cb562016-09-16 10:23:12 -0700966 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700967 ":flags",
968 "//third_party/libpng",
969 ]
970 public_deps = [
971 "//third_party/jsoncpp",
972 ]
973 }
mtklein25c81d42016-07-27 13:55:26 -0700974
Mike Klein6e744122016-10-27 12:21:40 -0400975 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700976 test_lib("gm") {
977 public_include_dirs = [ "gm" ]
978 sources = gm_sources
979 deps = [
scroggo19b91532016-10-24 09:03:26 -0700980 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700981 ":gpu_tool_utils",
982 ":skia",
983 ":tool_utils",
984 ]
985 }
mtklein25c81d42016-07-27 13:55:26 -0700986
Mike Klein6e744122016-10-27 12:21:40 -0400987 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700988 test_lib("tests") {
989 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400990 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700991 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400992 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700993 }
mtkleinc095df52016-08-24 12:23:52 -0700994 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700995 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700996 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700997 ":skia",
998 ":tool_utils",
999 "//third_party/libpng",
1000 "//third_party/zlib",
1001 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001002 public_deps = [
1003 ":gpu_tool_utils", # Test.h #includes headers from this target.
1004 ]
mtkleinc095df52016-08-24 12:23:52 -07001005 }
mtklein2f3416d2016-08-02 16:02:05 -07001006
Mike Klein6e744122016-10-27 12:21:40 -04001007 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001008 test_lib("bench") {
1009 public_include_dirs = [ "bench" ]
1010 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001011 deps = [
1012 ":flags",
1013 ":gm",
1014 ":gpu_tool_utils",
1015 ":skia",
1016 ":tool_utils",
1017 ]
1018 }
mtklein2b6870c2016-07-28 14:17:33 -07001019
mtkleinc095df52016-08-24 12:23:52 -07001020 test_lib("experimental_svg_model") {
1021 public_include_dirs = [ "experimental/svg/model" ]
1022 sources = [
1023 "experimental/svg/model/SkSVGAttribute.cpp",
1024 "experimental/svg/model/SkSVGAttributeParser.cpp",
1025 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001026 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001027 "experimental/svg/model/SkSVGContainer.cpp",
1028 "experimental/svg/model/SkSVGDOM.cpp",
1029 "experimental/svg/model/SkSVGEllipse.cpp",
1030 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001031 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001032 "experimental/svg/model/SkSVGNode.cpp",
1033 "experimental/svg/model/SkSVGPath.cpp",
1034 "experimental/svg/model/SkSVGPoly.cpp",
1035 "experimental/svg/model/SkSVGRect.cpp",
1036 "experimental/svg/model/SkSVGRenderContext.cpp",
1037 "experimental/svg/model/SkSVGSVG.cpp",
1038 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001039 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001040 "experimental/svg/model/SkSVGTransformableNode.cpp",
1041 "experimental/svg/model/SkSVGValue.cpp",
1042 ]
1043 deps = [
1044 ":skia",
1045 ]
1046 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001047
Brian Osman16adfa32016-10-18 14:42:44 -04001048 test_lib("views") {
1049 public_include_dirs = [ "include/views" ]
1050 sources = [
1051 "src/views/SkEvent.cpp",
1052 "src/views/SkEventSink.cpp",
1053 "src/views/SkOSMenu.cpp",
1054 "src/views/SkTagList.cpp",
1055 "src/views/SkTouchGesture.cpp",
1056 "src/views/SkView.cpp",
1057 "src/views/SkViewPriv.cpp",
1058 ]
1059 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001060 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001061 if (!is_android) {
1062 sources += [ "src/views/SkWindow.cpp" ]
1063 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001064 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001065 public_include_dirs += [ "src/views/unix" ]
1066 sources += [
1067 "src/views/unix/SkOSWindow_Unix.cpp",
1068 "src/views/unix/keysym2ucs.c",
1069 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001070 libs += [
1071 "GL",
1072 "X11",
1073 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001074 } else if (is_mac) {
1075 sources += [
1076 "src/views/mac/SkEventNotifier.mm",
1077 "src/views/mac/SkNSView.mm",
1078 "src/views/mac/SkOSWindow_Mac.mm",
1079 "src/views/mac/SkTextFieldCell.m",
1080 ]
1081 libs += [
1082 "QuartzCore.framework",
1083 "Cocoa.framework",
1084 "Foundation.framework",
1085 ]
1086 } else if (is_win) {
1087 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1088 }
Brian Osman34755e22016-12-05 09:46:02 -05001089 if (skia_use_angle) {
1090 deps += [ "//third_party/angle2" ]
1091 }
Brian Osman16adfa32016-10-18 14:42:44 -04001092 }
1093
Mike Klein38af9432016-11-11 11:39:44 -05001094 if (skia_use_lua) {
1095 test_lib("lua") {
1096 public_include_dirs = []
1097 sources = [
1098 "src/utils/SkLua.cpp",
1099 "src/utils/SkLuaCanvas.cpp",
1100 ]
1101 deps = [
1102 "//third_party/lua",
1103 ]
1104 }
1105
Mike Kleine6682eb2017-01-05 10:54:57 -05001106 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001107 sources = [
1108 "tools/lua/lua_app.cpp",
1109 ]
1110 deps = [
1111 ":lua",
1112 ":skia",
1113 "//third_party/lua",
1114 ]
Mike Klein38af9432016-11-11 11:39:44 -05001115 }
1116
Mike Kleine6682eb2017-01-05 10:54:57 -05001117 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001118 sources = [
1119 "tools/lua/lua_pictures.cpp",
1120 ]
1121 deps = [
1122 ":flags",
1123 ":lua",
1124 ":skia",
1125 ":tool_utils",
1126 "//third_party/lua",
1127 ]
Mike Klein38af9432016-11-11 11:39:44 -05001128 }
1129 }
1130
Mike Klein6e744122016-10-27 12:21:40 -04001131 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001132 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001133 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001134 include_dirs = [ "experimental" ]
1135 sources = samples_sources + [
Mike Klein6e744122016-10-27 12:21:40 -04001136 "experimental/SkSetPoly3To3.cpp",
1137 "experimental/SkSetPoly3To3_A.cpp",
1138 "experimental/SkSetPoly3To3_D.cpp",
1139 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001140 deps = [
1141 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001142 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001143 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001144 ":tool_utils",
1145 ":views",
1146 ":xml",
1147 ]
Mike Klein38af9432016-11-11 11:39:44 -05001148
1149 if (skia_use_lua) {
1150 sources += [ "samplecode/SampleLua.cpp" ]
1151 deps += [
1152 ":lua",
1153 "//third_party/lua",
1154 ]
1155 }
Brian Osman16adfa32016-10-18 14:42:44 -04001156 }
1157
Mike Kleine6682eb2017-01-05 10:54:57 -05001158 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001159 sources = [
1160 "dm/DM.cpp",
1161 "dm/DMJsonWriter.cpp",
1162 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001163 ]
1164 include_dirs = [ "tests" ]
1165 deps = [
mtklein046cb562016-09-16 10:23:12 -07001166 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001167 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001168 ":flags",
1169 ":gm",
1170 ":gpu_tool_utils",
1171 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001172 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001173 ":tool_utils",
1174 "//third_party/jsoncpp",
1175 "//third_party/libpng",
1176 ]
mtklein2b6870c2016-07-28 14:17:33 -07001177 }
1178
Mike Klein06432b22017-03-21 13:14:33 -04001179 test_app("ok") {
1180 sources = [
1181 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001182 "tools/ok_dsts.cpp",
1183 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001184 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001185 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001186 ]
1187 deps = [
1188 ":gm",
1189 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001190 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001191 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001192 ]
1193 }
1194
Mike Kleina3430172016-09-27 16:46:29 -04001195 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001196 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001197 sources = [
1198 "tools/monobench.cpp",
1199 ]
1200 deps = [
1201 ":bench",
1202 ":skia",
1203 ]
Mike Kleina3430172016-09-27 16:46:29 -04001204 }
mtklein2b6870c2016-07-28 14:17:33 -07001205 }
1206
Mike Kleine6682eb2017-01-05 10:54:57 -05001207 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001208 sources = [
1209 "bench/nanobench.cpp",
1210 ]
1211 deps = [
1212 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001213 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001214 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001215 ":flags",
1216 ":gm",
1217 ":gpu_tool_utils",
1218 ":skia",
1219 ":tool_utils",
1220 "//third_party/jsoncpp",
1221 ]
mtklein2b6870c2016-07-28 14:17:33 -07001222 }
halcanary19a97202016-08-03 15:08:04 -07001223
Ravi Mistry10d36c52017-01-31 09:49:18 -05001224 test_app("skpinfo") {
1225 sources = [
1226 "tools/skpinfo.cpp",
1227 ]
1228 deps = [
1229 ":flags",
1230 ":skia",
1231 ]
1232 }
1233
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001234 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001235 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001236 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001237 "samplecode/SampleApp.cpp",
1238 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001239 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001240 if (is_mac) {
1241 sources += [ "src/views/mac/skia_mac.mm" ]
1242 } else if (is_win) {
1243 sources += [ "src/views/win/skia_win.cpp" ]
1244 } else if (is_linux) {
1245 sources += [ "src/views/unix/skia_unix.cpp" ]
1246 }
mtklein38925aa2016-09-21 10:11:25 -07001247 deps = [
1248 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001249 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001250 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001251 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001252 ":skia",
1253 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001254 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001255 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001256 if (skia_use_angle) {
1257 deps += [ "//third_party/angle2" ]
1258 }
mtklein38925aa2016-09-21 10:11:25 -07001259 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001260 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001261
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001262 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001263 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001264 sources = [
1265 "tools/skpbench/skpbench.cpp",
1266 ]
1267 deps = [
1268 ":flags",
1269 ":gpu_tool_utils",
1270 ":skia",
1271 ":tool_utils",
1272 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001273 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001274 }
1275
Mike Klein7d302882016-11-03 14:06:31 -04001276 # We can't yet build ICU on iOS or Windows.
1277 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001278 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001279 sources = [
1280 "tools/SkShaper_harfbuzz.cpp",
1281 "tools/using_skia_and_harfbuzz.cpp",
1282 ]
1283 deps = [
1284 ":skia",
1285 "//third_party/harfbuzz",
1286 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001287 }
halcanary19a97202016-08-03 15:08:04 -07001288 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001289 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001290 sources = [
1291 "tools/SkShaper_primitive.cpp",
1292 "tools/using_skia_and_harfbuzz.cpp",
1293 ]
1294 deps = [
1295 ":skia",
1296 ]
halcanary3eee9d92016-09-10 07:01:53 -07001297 }
mtklein046cb562016-09-16 10:23:12 -07001298
Matt Sarett9f1c4032017-05-17 10:06:32 -04001299 test_app("create_flutter_test_images") {
1300 sources = [
1301 "tools/create_flutter_test_images.cpp",
1302 ]
1303 deps = [
1304 ":skia",
1305 ":tool_utils",
1306 ]
1307 }
1308
Mike Kleine6682eb2017-01-05 10:54:57 -05001309 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001310 sources = [
1311 "tools/get_images_from_skps.cpp",
1312 ]
1313 deps = [
1314 ":flags",
1315 ":skia",
1316 "//third_party/jsoncpp",
1317 ]
mtklein046cb562016-09-16 10:23:12 -07001318 }
mtkleinecbc5262016-09-22 11:51:24 -07001319
Mike Kleine6682eb2017-01-05 10:54:57 -05001320 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001321 sources = [
1322 "tools/colorspaceinfo.cpp",
1323 ]
1324 deps = [
1325 ":flags",
1326 ":skia",
1327 ":tool_utils",
1328 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001329 }
1330
Mike Klein7d302882016-11-03 14:06:31 -04001331 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001332 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001333 sources = [
1334 "tools/skiaserve/Request.cpp",
1335 "tools/skiaserve/Response.cpp",
1336 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001337 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1338 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1339 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1340 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1341 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1342 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1343 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1344 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1345 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001346 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1347 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001348 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1349 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1350 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1351 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1352 ]
1353 deps = [
1354 ":flags",
1355 ":gpu_tool_utils",
1356 ":skia",
1357 ":tool_utils",
1358 "//third_party/jsoncpp",
1359 "//third_party/libmicrohttpd",
1360 "//third_party/libpng",
1361 ]
Mike Klein7d302882016-11-03 14:06:31 -04001362 }
mtkleinecbc5262016-09-22 11:51:24 -07001363 }
kjlubick14f984b2016-10-03 11:49:45 -07001364
Mike Kleine6682eb2017-01-05 10:54:57 -05001365 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001366 sources = [
1367 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001368 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001369 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001370 "fuzz/FuzzGradients.cpp",
1371 "fuzz/FuzzParsePath.cpp",
1372 "fuzz/FuzzPathop.cpp",
1373 "fuzz/FuzzScaleToSides.cpp",
1374 "fuzz/fuzz.cpp",
1375 ]
1376 deps = [
1377 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001378 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001379 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001380 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001381 ]
kjlubick14f984b2016-10-03 11:49:45 -07001382 }
Mike Klein38312422016-10-05 15:41:01 -04001383
Mike Kleine6682eb2017-01-05 10:54:57 -05001384 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001385 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001386 rebase_path("tests/skia_test.cpp"),
1387 rebase_path("tests/Test.cpp"),
1388 ]
caryclark9feb6322016-10-25 08:58:26 -07001389 deps = [
1390 ":flags",
1391 ":gpu_tool_utils",
1392 ":skia",
1393 ":tool_utils",
1394 ]
caryclark9feb6322016-10-25 08:58:26 -07001395 }
1396
Mike Kleine6682eb2017-01-05 10:54:57 -05001397 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001398 sources = [
1399 "tools/DumpRecord.cpp",
1400 "tools/dump_record.cpp",
1401 ]
1402 deps = [
1403 ":flags",
1404 ":skia",
1405 ]
Mike Klein38312422016-10-05 15:41:01 -04001406 }
bungemanfe917272016-10-13 17:36:40 -04001407
Mike Kleine6682eb2017-01-05 10:54:57 -05001408 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001409 sources = [
1410 "tools/skdiff/skdiff.cpp",
1411 "tools/skdiff/skdiff_html.cpp",
1412 "tools/skdiff/skdiff_main.cpp",
1413 "tools/skdiff/skdiff_utils.cpp",
1414 ]
1415 deps = [
1416 ":skia",
1417 ":tool_utils",
1418 ]
bungemanfe917272016-10-13 17:36:40 -04001419 }
halcanarya73d76a2016-10-17 13:19:02 -07001420
Mike Kleine6682eb2017-01-05 10:54:57 -05001421 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001422 sources = [
1423 "tools/skp_parser.cpp",
1424 ]
1425 deps = [
1426 ":skia",
1427 ":tool_utils",
1428 "//third_party/jsoncpp",
1429 ]
halcanarya73d76a2016-10-17 13:19:02 -07001430 }
Brian Osman16adfa32016-10-18 14:42:44 -04001431
Mike Kleina92c3832016-12-08 09:49:39 -05001432 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001433 test_app("viewer") {
1434 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001435 sources = [
1436 "tools/viewer/GMSlide.cpp",
1437 "tools/viewer/ImageSlide.cpp",
1438 "tools/viewer/SKPSlide.cpp",
1439 "tools/viewer/SampleSlide.cpp",
1440 "tools/viewer/Viewer.cpp",
1441 "tools/viewer/sk_app/CommandSet.cpp",
1442 "tools/viewer/sk_app/GLWindowContext.cpp",
1443 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001444 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001445 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001446
Jim Van Verth4e56a912016-10-21 10:58:52 -04001447 if (is_android) {
1448 sources += [
1449 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1450 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1451 "tools/viewer/sk_app/android/Window_android.cpp",
1452 "tools/viewer/sk_app/android/main_android.cpp",
1453 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1454 ]
Brian Osman462334e2017-02-09 11:22:57 -05001455 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001456 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001457 sources += [
1458 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1459 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1460 "tools/viewer/sk_app/unix/Window_unix.cpp",
1461 "tools/viewer/sk_app/unix/main_unix.cpp",
1462 ]
1463 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001464 sources += [
1465 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1466 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1467 "tools/viewer/sk_app/win/Window_win.cpp",
1468 "tools/viewer/sk_app/win/main_win.cpp",
1469 ]
Mike Klein43c25262016-10-20 10:17:47 -04001470 } else if (is_mac) {
1471 sources += [
1472 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1473 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1474 "tools/viewer/sk_app/mac/Window_mac.cpp",
1475 "tools/viewer/sk_app/mac/main_mac.cpp",
1476 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001477 }
1478
1479 if (skia_use_vulkan) {
1480 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001481 if (is_android) {
1482 sources +=
1483 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001484 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001485 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1486 libs += [ "X11-xcb" ]
1487 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001488 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1489 }
1490 }
1491
1492 include_dirs = []
1493 deps = [
1494 ":flags",
1495 ":gm",
1496 ":gpu_tool_utils",
1497 ":samples",
1498 ":skia",
1499 ":tool_utils",
1500 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001501 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001502 "//third_party/jsoncpp",
1503 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001504 if (is_android) {
1505 deps += [ "//third_party/native_app_glue" ]
1506 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001507 deps += [ "//third_party/libsdl" ]
1508 }
Mike Kleina92c3832016-12-08 09:49:39 -05001509 }
Brian Osman16adfa32016-10-18 14:42:44 -04001510 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001511
Mike Kleine459afd2017-03-03 09:21:30 -05001512 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001513 copy("gdbserver") {
1514 sources = [
1515 "$ndk/$ndk_gdbserver",
1516 ]
1517 outputs = [
1518 "$root_out_dir/gdbserver",
1519 ]
1520 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001521 }
1522
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001523 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001524 test_app("skslc") {
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001525 defines = [ "SKSL_STANDALONE" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001526 sources = [
1527 "src/sksl/SkSLMain.cpp",
1528 ]
Ethan Nicholas0df1b042017-03-31 13:56:23 -04001529 sources += skia_sksl_sources
1530 include_dirs = [ "src/sksl" ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001531 }
1532 }
mtklein25c81d42016-07-27 13:55:26 -07001533}