blob: 9ba71b2bbb7059fb356bae8f5cc7563b2b04e2fa [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 +
Mike Klein5ce39722017-06-27 22:52:03 +0000418 [ "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" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400429
430 # this lib is required to link against AHardwareBuffer
431 if (defined(ndk_api) && ndk_api >= 26) {
432 libs += [ "android" ]
433 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400434 } else if (skia_use_egl) {
435 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
436 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700437 } else if (is_linux) {
438 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500439 libs += [
440 "GL",
441 "GLU",
442 ]
mtklein06c35c02016-09-20 12:28:12 -0700443 } else if (is_mac) {
444 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800445 } else if (is_ios) {
446 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400447 } else if (is_win) {
448 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
449 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700450 } else {
451 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
452 }
mtkleine9fb3d52016-09-20 15:11:46 -0700453
454 if (skia_use_vulkan) {
455 public_defines += [ "SK_VULKAN" ]
456 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700457 if (skia_enable_vulkan_debug_layers) {
458 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
459 }
mtkleine9fb3d52016-09-20 15:11:46 -0700460 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400461 if (skia_enable_spirv_validation) {
Mike Klein5ce39722017-06-27 22:52:03 +0000462 deps = [
463 "//third_party/spirv-tools",
464 ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400465 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
466 }
mtklein06c35c02016-09-20 12:28:12 -0700467}
468
mtklein63213812016-08-24 09:55:56 -0700469optional("jpeg") {
470 enabled = skia_use_libjpeg_turbo
471 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
472
mtklein63213812016-08-24 09:55:56 -0700473 deps = [
474 "//third_party/libjpeg-turbo:libjpeg",
475 ]
476 sources = [
477 "src/codec/SkJpegCodec.cpp",
478 "src/codec/SkJpegDecoderMgr.cpp",
479 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700480 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400481 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700482 ]
483}
484
485optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500486 enabled = skia_use_zlib && skia_enable_pdf
487 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700488
mtklein63213812016-08-24 09:55:56 -0700489 deps = [
490 "//third_party/zlib",
491 ]
brettwb9447282016-09-01 14:24:39 -0700492 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700493 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700494
495 if (skia_use_sfntly) {
496 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500497 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700498 }
499}
500
501optional("png") {
502 enabled = skia_use_libpng
503 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
504
mtklein63213812016-08-24 09:55:56 -0700505 deps = [
506 "//third_party/libpng",
507 ]
508 sources = [
509 "src/codec/SkIcoCodec.cpp",
510 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400511 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700512 ]
513}
514
scroggof84ad642016-10-31 09:02:57 -0700515optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400516 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700517 public_defines = [ "SK_CODEC_DECODES_RAW" ]
518
519 deps = [
520 "//third_party/dng_sdk",
521 "//third_party/libjpeg-turbo:libjpeg",
522 "//third_party/piex",
523 ]
524
525 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
526 # Skia.
527 configs_to_remove = [ "//gn:no_exceptions" ]
528
529 sources = [
530 "src/codec/SkRawAdapterCodec.cpp",
531 "src/codec/SkRawCodec.cpp",
532 ]
533}
534
mtklein3cc22182016-08-29 13:26:14 -0700535optional("typeface_freetype") {
536 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700537
538 deps = [
539 "//third_party/freetype2",
540 ]
541 sources = [
542 "src/ports/SkFontHost_FreeType.cpp",
543 "src/ports/SkFontHost_FreeType_common.cpp",
544 ]
545}
546
mtklein457b42a2016-08-23 13:56:37 -0700547optional("webp") {
548 enabled = skia_use_libwebp
549 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
550
mtklein457b42a2016-08-23 13:56:37 -0700551 deps = [
552 "//third_party/libwebp",
553 ]
554 sources = [
555 "src/codec/SkWebpAdapterCodec.cpp",
556 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400557 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700558 ]
mtkleineb3c4252016-08-23 07:38:09 -0700559}
560
mtklein63213812016-08-24 09:55:56 -0700561optional("xml") {
562 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000563 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700564
mtklein63213812016-08-24 09:55:56 -0700565 deps = [
566 "//third_party/expat",
567 ]
568 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500569 "src/svg/SkSVGCanvas.cpp",
570 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700571 "src/xml/SkDOM.cpp",
572 "src/xml/SkXMLParser.cpp",
573 "src/xml/SkXMLWriter.cpp",
574 ]
575}
576
mtkleinc04ff472016-06-23 10:29:30 -0700577component("skia") {
578 public_configs = [ ":skia_public" ]
579 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700580
581 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700582 ":arm64",
583 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700584 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700585 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500586 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700587 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700588 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700589 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700590 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700591 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400592 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700593 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700594 ":none",
mtklein63213812016-08-24 09:55:56 -0700595 ":pdf",
596 ":png",
scroggof84ad642016-10-31 09:02:57 -0700597 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700598 ":sse2",
599 ":sse41",
600 ":sse42",
601 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700602 ":webp",
mtklein63213812016-08-24 09:55:56 -0700603 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700604 ]
605
Chinmay Garde43f115c2016-11-16 15:04:12 -0800606 # This file (and all GN files in Skia) are designed to work with an
607 # empty sources assignment filter; we handle all that explicitly.
608 # We clear the filter here for clients who may have set up a global filter.
609 set_sources_assignment_filter([])
610
mtkleinc04ff472016-06-23 10:29:30 -0700611 sources = []
brettwb9447282016-09-01 14:24:39 -0700612 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700613 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500614 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700615 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700616 "src/android/SkBitmapRegionCodec.cpp",
617 "src/android/SkBitmapRegionDecoder.cpp",
618 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400619 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700620 "src/codec/SkBmpCodec.cpp",
621 "src/codec/SkBmpMaskCodec.cpp",
622 "src/codec/SkBmpRLECodec.cpp",
623 "src/codec/SkBmpStandardCodec.cpp",
624 "src/codec/SkCodec.cpp",
625 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700626 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700627 "src/codec/SkMaskSwizzler.cpp",
628 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700629 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700630 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700631 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700632 "src/codec/SkSwizzler.cpp",
633 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700634 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700635 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700636 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700637 "src/ports/SkMemory_malloc.cpp",
638 "src/ports/SkOSFile_stdio.cpp",
639 "src/sfnt/SkOTTable_name.cpp",
640 "src/sfnt/SkOTUtils.cpp",
641 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700642 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700643 ]
brettwb9447282016-09-01 14:24:39 -0700644
mtklein7d6fb2c2016-08-25 14:50:44 -0700645 libs = []
646
mtkleinc04ff472016-06-23 10:29:30 -0700647 if (is_win) {
648 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400649 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700650 "src/ports/SkDebug_win.cpp",
651 "src/ports/SkFontHost_win.cpp",
652 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700653 "src/ports/SkImageEncoder_WIC.cpp",
654 "src/ports/SkImageGeneratorWIC.cpp",
655 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700656 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700657 "src/ports/SkScalerContext_win_dw.cpp",
658 "src/ports/SkTLS_win.cpp",
659 "src/ports/SkTypeface_win_dw.cpp",
660 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400661 if (skia_use_gdi) {
662 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
663 libs += [
664 "Gdi32.lib",
665 "Usp10.lib",
666 ]
667 } else {
668 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
669 }
mtkleinb9be9792016-09-16 14:44:18 -0700670 sources -=
671 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400672 libs += [
673 "FontSub.lib",
674 "Ole32.lib",
675 "OleAut32.lib",
676 "User32.lib",
677 ]
mtkleinc04ff472016-06-23 10:29:30 -0700678 } else {
679 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700680 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700681 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700682 "src/ports/SkTLS_pthread.cpp",
683 ]
684 }
685
mtklein7d6fb2c2016-08-25 14:50:44 -0700686 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500687 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500688 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500689 deps += [ "//third_party/cpu-features" ]
690 }
mtklein06c35c02016-09-20 12:28:12 -0700691 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700692 libs += [
693 "EGL",
694 "GLESv2",
695 "log",
696 ]
697 }
698
mtkleinc04ff472016-06-23 10:29:30 -0700699 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700700 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700701 }
702
703 if (is_mac) {
704 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700705 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700706 "src/ports/SkFontHost_mac.cpp",
707 "src/ports/SkImageEncoder_CG.cpp",
708 "src/ports/SkImageGeneratorCG.cpp",
709 ]
mtklein09e61f72016-08-23 13:35:28 -0700710 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400711 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
712 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700713 "ApplicationServices.framework",
714 "OpenGL.framework",
715 ]
mtkleinc04ff472016-06-23 10:29:30 -0700716 }
abarth6fc8ff02016-07-15 15:15:15 -0700717
Mike Klein7d302882016-11-03 14:06:31 -0400718 if (is_ios) {
719 sources += [
720 "src/ports/SkDebug_stdio.cpp",
721 "src/ports/SkFontHost_mac.cpp",
722 "src/ports/SkImageEncoder_CG.cpp",
723 "src/ports/SkImageGeneratorCG.cpp",
724 ]
725 libs += [
726 "CoreFoundation.framework",
727 "CoreGraphics.framework",
728 "CoreText.framework",
729 "ImageIO.framework",
730 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400731
732 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
733 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400734 ]
735 }
736
abarth6fc8ff02016-07-15 15:15:15 -0700737 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700738 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700739 }
mtkleinc04ff472016-06-23 10:29:30 -0700740}
741
mtkleinc095df52016-08-24 12:23:52 -0700742# Targets guarded by skia_enable_tools may use //third_party freely.
743if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500744 # Used by gn_to_bp.py to list our public include dirs.
745 source_set("public") {
746 configs += [ ":skia_public" ]
747 }
748
Mike Kleinc36dedf2016-11-18 09:35:28 -0500749 config("skia.h_config") {
750 include_dirs = [ "$target_gen_dir" ]
751 }
752 action("skia.h") {
753 public_configs = [ ":skia.h_config" ]
754 skia_h = "$target_gen_dir/skia.h"
755 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400756 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000757 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500758 depfile = "$skia_h.deps"
759 outputs = [
760 skia_h,
761 ]
762 }
763
764 if (skia_enable_gpu && target_cpu == "x64") {
765 # Our bots only have 64-bit libOSMesa installed.
766 # TODO: worth fixing?
767 executable("fiddle") {
768 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500769 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500770 "tools/fiddle/draw.cpp",
771 "tools/fiddle/fiddle_main.cpp",
772 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400773
774 if (skia_use_egl) {
775 sources += [ "tools/fiddle/egl_context.cpp" ]
776 } else if (skia_use_mesa) {
777 sources += [ "tools/fiddle/mesa_context.cpp" ]
778 if (is_linux) {
779 libs += [ "OSMesa" ]
780 }
781 } else {
782 sources += [ "tools/fiddle/null_context.cpp" ]
783 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400784 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500785 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400786 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500787 ":skia",
788 ":skia.h",
789 ]
790 }
791 }
792
793 if (skia_enable_gpu) {
794 source_set("public_headers_warnings_check") {
795 sources = [
796 "tools/public_headers_warnings_check.cpp",
797 ]
798 configs -= [ "//gn:warnings_except_public_headers" ]
799 deps = [
800 ":skia",
801 ":skia.h",
802 ]
803 }
804 }
805
mtkleinc095df52016-08-24 12:23:52 -0700806 template("test_lib") {
807 config(target_name + "_config") {
808 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700809 if (defined(invoker.public_defines)) {
810 defines = invoker.public_defines
811 }
mtklein25c81d42016-07-27 13:55:26 -0700812 }
mtkleinc095df52016-08-24 12:23:52 -0700813 source_set(target_name) {
814 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
815 public_configs = [
816 ":" + target_name + "_config",
817 ":skia_private",
818 ]
819
820 if (!defined(deps)) {
821 deps = []
822 }
823 deps += [ ":skia" ]
824 testonly = true
825 }
mtklein25c81d42016-07-27 13:55:26 -0700826 }
mtklein25c81d42016-07-27 13:55:26 -0700827
Mike Kleine6682eb2017-01-05 10:54:57 -0500828 template("test_app") {
829 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
830 shared_library("lib" + target_name) {
831 forward_variables_from(invoker, "*", [ "is_shared_library" ])
832 testonly = true
833 }
834 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500835 _executable = target_name
836 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500837 forward_variables_from(invoker, "*", [ "is_shared_library" ])
838 testonly = true
839 }
840 }
Mike Klein7d921032017-01-05 12:20:41 -0500841 if (is_android && skia_android_serial != "" && defined(_executable)) {
842 action("push_" + target_name) {
843 script = "gn/push_to_android.py"
844 deps = [
845 ":" + _executable,
846 ]
847 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
848 outputs = [
849 _stamp,
850 ]
851 args = [
852 rebase_path("$root_build_dir/$_executable"),
853 skia_android_serial,
854 rebase_path(_stamp),
855 ]
856 testonly = true
857 }
858 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500859 }
860
mtkleinc095df52016-08-24 12:23:52 -0700861 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700862 public_include_dirs = []
863 if (skia_enable_gpu) {
864 public_defines = []
865 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700866
867 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700868 sources = [
869 "tools/gpu/GrContextFactory.cpp",
870 "tools/gpu/GrTest.cpp",
871 "tools/gpu/TestContext.cpp",
872 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700873 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700874 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
875 "tools/gpu/gl/debug/GrBufferObj.cpp",
876 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
877 "tools/gpu/gl/debug/GrProgramObj.cpp",
878 "tools/gpu/gl/debug/GrShaderObj.cpp",
879 "tools/gpu/gl/debug/GrTextureObj.cpp",
880 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
881 "tools/gpu/gl/null/NullGLTestContext.cpp",
882 ]
883 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700884
Kevin Lubick4a24e102017-03-29 11:19:01 -0400885 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700886 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400887 } else if (is_ios) {
888 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
889 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700890 } else if (is_linux) {
891 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500892 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700893 } else if (is_mac) {
894 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400895 } else if (is_win) {
896 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
897 libs += [
898 "Gdi32.lib",
899 "OpenGL32.lib",
900 ]
mtklein38925aa2016-09-21 10:11:25 -0700901 }
mtklein6ef69992016-09-14 06:12:09 -0700902
Mike Kleinc168a3a2016-11-14 14:53:13 +0000903 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000904 deps += [ "//third_party/angle2" ]
905 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
906 }
mtklein38925aa2016-09-21 10:11:25 -0700907 if (skia_use_mesa) {
908 public_defines += [ "SK_MESA" ]
909 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
910 libs += [ "OSMesa" ]
911 }
mtkleind68f9b02016-09-23 13:18:41 -0700912 if (skia_use_vulkan) {
913 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400914 if (is_win) {
915 libs += [ "vulkan-1.lib" ]
916 } else {
917 libs += [ "vulkan" ]
918 }
mtkleind68f9b02016-09-23 13:18:41 -0700919 }
mtkleina627b5c2016-09-20 13:36:47 -0700920 }
mtklein25c81d42016-07-27 13:55:26 -0700921 }
mtklein25c81d42016-07-27 13:55:26 -0700922
mtkleinc095df52016-08-24 12:23:52 -0700923 test_lib("flags") {
924 public_include_dirs = [ "tools/flags" ]
925 sources = [
926 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700927 ]
928 }
929 test_lib("common_flags") {
930 public_include_dirs = [ "tools/flags" ]
931 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700932 "tools/flags/SkCommonFlags.cpp",
933 "tools/flags/SkCommonFlagsConfig.cpp",
934 ]
935 deps = [
mtklein046cb562016-09-16 10:23:12 -0700936 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700937 ":gpu_tool_utils",
938 ]
939 }
mtklein25c81d42016-07-27 13:55:26 -0700940
mtkleinc095df52016-08-24 12:23:52 -0700941 test_lib("tool_utils") {
942 public_include_dirs = [
943 "tools",
944 "tools/debugger",
945 "tools/timer",
946 ]
947 sources = [
mtkleinb37c0342016-09-09 11:07:45 -0700948 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700949 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700950 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700951 "tools/ProcStats.cpp",
952 "tools/Resources.cpp",
953 "tools/ThermalManager.cpp",
954 "tools/UrlDataManager.cpp",
955 "tools/debugger/SkDebugCanvas.cpp",
956 "tools/debugger/SkDrawCommand.cpp",
957 "tools/debugger/SkJsonWriteBuffer.cpp",
958 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700959 "tools/picture_utils.cpp",
960 "tools/random_parse_path.cpp",
961 "tools/sk_tool_utils.cpp",
962 "tools/sk_tool_utils_font.cpp",
963 "tools/timer/Timer.cpp",
964 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500965 libs = []
966 if (is_ios) {
967 sources += [ "tools/ios_utils.m" ]
968 libs += [ "Foundation.framework" ]
969 }
mtkleinc095df52016-08-24 12:23:52 -0700970 deps = [
mtklein046cb562016-09-16 10:23:12 -0700971 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700972 ":flags",
973 "//third_party/libpng",
974 ]
975 public_deps = [
976 "//third_party/jsoncpp",
977 ]
978 }
mtklein25c81d42016-07-27 13:55:26 -0700979
Mike Klein6e744122016-10-27 12:21:40 -0400980 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700981 test_lib("gm") {
982 public_include_dirs = [ "gm" ]
983 sources = gm_sources
984 deps = [
scroggo19b91532016-10-24 09:03:26 -0700985 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700986 ":gpu_tool_utils",
987 ":skia",
988 ":tool_utils",
989 ]
990 }
mtklein25c81d42016-07-27 13:55:26 -0700991
Mike Klein6e744122016-10-27 12:21:40 -0400992 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700993 test_lib("tests") {
994 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400995 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700996 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400997 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700998 }
mtkleinc095df52016-08-24 12:23:52 -0700999 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001000 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001001 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001002 ":skia",
1003 ":tool_utils",
1004 "//third_party/libpng",
1005 "//third_party/zlib",
1006 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001007 public_deps = [
1008 ":gpu_tool_utils", # Test.h #includes headers from this target.
1009 ]
mtkleinc095df52016-08-24 12:23:52 -07001010 }
mtklein2f3416d2016-08-02 16:02:05 -07001011
Mike Klein6e744122016-10-27 12:21:40 -04001012 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001013 test_lib("bench") {
1014 public_include_dirs = [ "bench" ]
1015 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001016 deps = [
1017 ":flags",
1018 ":gm",
1019 ":gpu_tool_utils",
1020 ":skia",
1021 ":tool_utils",
1022 ]
1023 }
mtklein2b6870c2016-07-28 14:17:33 -07001024
mtkleinc095df52016-08-24 12:23:52 -07001025 test_lib("experimental_svg_model") {
1026 public_include_dirs = [ "experimental/svg/model" ]
1027 sources = [
1028 "experimental/svg/model/SkSVGAttribute.cpp",
1029 "experimental/svg/model/SkSVGAttributeParser.cpp",
1030 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001031 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001032 "experimental/svg/model/SkSVGContainer.cpp",
1033 "experimental/svg/model/SkSVGDOM.cpp",
1034 "experimental/svg/model/SkSVGEllipse.cpp",
1035 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001036 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001037 "experimental/svg/model/SkSVGNode.cpp",
1038 "experimental/svg/model/SkSVGPath.cpp",
1039 "experimental/svg/model/SkSVGPoly.cpp",
1040 "experimental/svg/model/SkSVGRect.cpp",
1041 "experimental/svg/model/SkSVGRenderContext.cpp",
1042 "experimental/svg/model/SkSVGSVG.cpp",
1043 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001044 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001045 "experimental/svg/model/SkSVGTransformableNode.cpp",
1046 "experimental/svg/model/SkSVGValue.cpp",
1047 ]
1048 deps = [
1049 ":skia",
1050 ]
1051 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001052
Brian Osman16adfa32016-10-18 14:42:44 -04001053 test_lib("views") {
1054 public_include_dirs = [ "include/views" ]
1055 sources = [
1056 "src/views/SkEvent.cpp",
1057 "src/views/SkEventSink.cpp",
1058 "src/views/SkOSMenu.cpp",
1059 "src/views/SkTagList.cpp",
1060 "src/views/SkTouchGesture.cpp",
1061 "src/views/SkView.cpp",
1062 "src/views/SkViewPriv.cpp",
1063 ]
1064 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001065 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001066 if (!is_android) {
1067 sources += [ "src/views/SkWindow.cpp" ]
1068 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001069 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001070 public_include_dirs += [ "src/views/unix" ]
1071 sources += [
1072 "src/views/unix/SkOSWindow_Unix.cpp",
1073 "src/views/unix/keysym2ucs.c",
1074 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001075 libs += [
1076 "GL",
1077 "X11",
1078 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001079 } else if (is_mac) {
1080 sources += [
1081 "src/views/mac/SkEventNotifier.mm",
1082 "src/views/mac/SkNSView.mm",
1083 "src/views/mac/SkOSWindow_Mac.mm",
1084 "src/views/mac/SkTextFieldCell.m",
1085 ]
1086 libs += [
1087 "QuartzCore.framework",
1088 "Cocoa.framework",
1089 "Foundation.framework",
1090 ]
1091 } else if (is_win) {
1092 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1093 }
Brian Osman34755e22016-12-05 09:46:02 -05001094 if (skia_use_angle) {
1095 deps += [ "//third_party/angle2" ]
1096 }
Brian Osman16adfa32016-10-18 14:42:44 -04001097 }
1098
Mike Klein38af9432016-11-11 11:39:44 -05001099 if (skia_use_lua) {
1100 test_lib("lua") {
1101 public_include_dirs = []
1102 sources = [
1103 "src/utils/SkLua.cpp",
1104 "src/utils/SkLuaCanvas.cpp",
1105 ]
1106 deps = [
1107 "//third_party/lua",
1108 ]
1109 }
1110
Mike Kleine6682eb2017-01-05 10:54:57 -05001111 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001112 sources = [
1113 "tools/lua/lua_app.cpp",
1114 ]
1115 deps = [
1116 ":lua",
1117 ":skia",
1118 "//third_party/lua",
1119 ]
Mike Klein38af9432016-11-11 11:39:44 -05001120 }
1121
Mike Kleine6682eb2017-01-05 10:54:57 -05001122 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001123 sources = [
1124 "tools/lua/lua_pictures.cpp",
1125 ]
1126 deps = [
1127 ":flags",
1128 ":lua",
1129 ":skia",
1130 ":tool_utils",
1131 "//third_party/lua",
1132 ]
Mike Klein38af9432016-11-11 11:39:44 -05001133 }
1134 }
1135
Mike Klein6e744122016-10-27 12:21:40 -04001136 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001137 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001138 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001139 include_dirs = [ "experimental" ]
1140 sources = samples_sources + [
Mike Klein6e744122016-10-27 12:21:40 -04001141 "experimental/SkSetPoly3To3.cpp",
1142 "experimental/SkSetPoly3To3_A.cpp",
1143 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001144
1145 # Relocating these files here, so that clients don't try to build them while they're
1146 # still in active development. Clang's thread safety analysis gets tripped up by
1147 # conditional locks.
1148 "src/core/SkThreadedBMPDevice.cpp",
1149 "src/core/SkThreadedBMPDevice.h",
Mike Klein6e744122016-10-27 12:21:40 -04001150 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001151 deps = [
1152 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001153 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001154 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001155 ":tool_utils",
1156 ":views",
1157 ":xml",
1158 ]
Mike Klein38af9432016-11-11 11:39:44 -05001159
1160 if (skia_use_lua) {
1161 sources += [ "samplecode/SampleLua.cpp" ]
1162 deps += [
1163 ":lua",
1164 "//third_party/lua",
1165 ]
1166 }
Brian Osman16adfa32016-10-18 14:42:44 -04001167 }
1168
Mike Kleine6682eb2017-01-05 10:54:57 -05001169 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001170 sources = [
1171 "dm/DM.cpp",
1172 "dm/DMJsonWriter.cpp",
1173 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001174 ]
1175 include_dirs = [ "tests" ]
1176 deps = [
mtklein046cb562016-09-16 10:23:12 -07001177 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001178 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001179 ":flags",
1180 ":gm",
1181 ":gpu_tool_utils",
1182 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001183 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001184 ":tool_utils",
1185 "//third_party/jsoncpp",
1186 "//third_party/libpng",
1187 ]
mtklein2b6870c2016-07-28 14:17:33 -07001188 }
1189
Mike Klein06432b22017-03-21 13:14:33 -04001190 test_app("ok") {
1191 sources = [
1192 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001193 "tools/ok_dsts.cpp",
1194 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001195 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001196 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001197 ]
1198 deps = [
1199 ":gm",
1200 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001201 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001202 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001203 ]
1204 }
1205
Mike Kleina3430172016-09-27 16:46:29 -04001206 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001207 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001208 sources = [
1209 "tools/monobench.cpp",
1210 ]
1211 deps = [
1212 ":bench",
1213 ":skia",
1214 ]
Mike Kleina3430172016-09-27 16:46:29 -04001215 }
mtklein2b6870c2016-07-28 14:17:33 -07001216 }
1217
Mike Kleine6682eb2017-01-05 10:54:57 -05001218 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001219 sources = [
1220 "bench/nanobench.cpp",
1221 ]
1222 deps = [
1223 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001224 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001225 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001226 ":flags",
1227 ":gm",
1228 ":gpu_tool_utils",
1229 ":skia",
1230 ":tool_utils",
1231 "//third_party/jsoncpp",
1232 ]
mtklein2b6870c2016-07-28 14:17:33 -07001233 }
halcanary19a97202016-08-03 15:08:04 -07001234
Ravi Mistry10d36c52017-01-31 09:49:18 -05001235 test_app("skpinfo") {
1236 sources = [
1237 "tools/skpinfo.cpp",
1238 ]
1239 deps = [
1240 ":flags",
1241 ":skia",
1242 ]
1243 }
1244
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001245 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001246 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001247 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001248 "samplecode/SampleApp.cpp",
1249 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001250 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001251 if (is_mac) {
1252 sources += [ "src/views/mac/skia_mac.mm" ]
1253 } else if (is_win) {
1254 sources += [ "src/views/win/skia_win.cpp" ]
1255 } else if (is_linux) {
1256 sources += [ "src/views/unix/skia_unix.cpp" ]
1257 }
mtklein38925aa2016-09-21 10:11:25 -07001258 deps = [
1259 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001260 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001261 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001262 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001263 ":skia",
1264 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001265 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001266 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001267 if (skia_use_angle) {
1268 deps += [ "//third_party/angle2" ]
1269 }
mtklein38925aa2016-09-21 10:11:25 -07001270 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001271 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001272
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001273 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001274 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001275 sources = [
1276 "tools/skpbench/skpbench.cpp",
1277 ]
1278 deps = [
1279 ":flags",
1280 ":gpu_tool_utils",
1281 ":skia",
1282 ":tool_utils",
1283 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001284 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001285 }
1286
Mike Klein7d302882016-11-03 14:06:31 -04001287 # We can't yet build ICU on iOS or Windows.
1288 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001289 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001290 sources = [
1291 "tools/SkShaper_harfbuzz.cpp",
1292 "tools/using_skia_and_harfbuzz.cpp",
1293 ]
1294 deps = [
1295 ":skia",
1296 "//third_party/harfbuzz",
1297 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001298 }
halcanary19a97202016-08-03 15:08:04 -07001299 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001300 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001301 sources = [
1302 "tools/SkShaper_primitive.cpp",
1303 "tools/using_skia_and_harfbuzz.cpp",
1304 ]
1305 deps = [
1306 ":skia",
1307 ]
halcanary3eee9d92016-09-10 07:01:53 -07001308 }
mtklein046cb562016-09-16 10:23:12 -07001309
Matt Sarett9f1c4032017-05-17 10:06:32 -04001310 test_app("create_flutter_test_images") {
1311 sources = [
1312 "tools/create_flutter_test_images.cpp",
1313 ]
1314 deps = [
1315 ":skia",
1316 ":tool_utils",
1317 ]
1318 }
1319
Mike Kleine6682eb2017-01-05 10:54:57 -05001320 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001321 sources = [
1322 "tools/get_images_from_skps.cpp",
1323 ]
1324 deps = [
1325 ":flags",
1326 ":skia",
1327 "//third_party/jsoncpp",
1328 ]
mtklein046cb562016-09-16 10:23:12 -07001329 }
mtkleinecbc5262016-09-22 11:51:24 -07001330
Mike Kleine6682eb2017-01-05 10:54:57 -05001331 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001332 sources = [
1333 "tools/colorspaceinfo.cpp",
1334 ]
1335 deps = [
1336 ":flags",
1337 ":skia",
1338 ":tool_utils",
1339 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001340 }
1341
Mike Klein7d302882016-11-03 14:06:31 -04001342 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001343 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001344 sources = [
1345 "tools/skiaserve/Request.cpp",
1346 "tools/skiaserve/Response.cpp",
1347 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001348 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1349 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1350 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1351 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1352 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1353 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1354 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1355 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1356 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001357 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1358 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001359 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1360 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1361 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1362 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1363 ]
1364 deps = [
1365 ":flags",
1366 ":gpu_tool_utils",
1367 ":skia",
1368 ":tool_utils",
1369 "//third_party/jsoncpp",
1370 "//third_party/libmicrohttpd",
1371 "//third_party/libpng",
1372 ]
Mike Klein7d302882016-11-03 14:06:31 -04001373 }
mtkleinecbc5262016-09-22 11:51:24 -07001374 }
kjlubick14f984b2016-10-03 11:49:45 -07001375
Mike Kleine6682eb2017-01-05 10:54:57 -05001376 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001377 sources = [
1378 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001379 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001380 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001381 "fuzz/FuzzGradients.cpp",
1382 "fuzz/FuzzParsePath.cpp",
1383 "fuzz/FuzzPathop.cpp",
1384 "fuzz/FuzzScaleToSides.cpp",
1385 "fuzz/fuzz.cpp",
1386 ]
1387 deps = [
1388 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001389 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001390 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001391 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001392 ]
kjlubick14f984b2016-10-03 11:49:45 -07001393 }
Mike Klein38312422016-10-05 15:41:01 -04001394
Mike Kleine6682eb2017-01-05 10:54:57 -05001395 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001396 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001397 rebase_path("tests/skia_test.cpp"),
1398 rebase_path("tests/Test.cpp"),
1399 ]
caryclark9feb6322016-10-25 08:58:26 -07001400 deps = [
1401 ":flags",
1402 ":gpu_tool_utils",
1403 ":skia",
1404 ":tool_utils",
1405 ]
caryclark9feb6322016-10-25 08:58:26 -07001406 }
1407
Mike Kleine6682eb2017-01-05 10:54:57 -05001408 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001409 sources = [
1410 "tools/DumpRecord.cpp",
1411 "tools/dump_record.cpp",
1412 ]
1413 deps = [
1414 ":flags",
1415 ":skia",
1416 ]
Mike Klein38312422016-10-05 15:41:01 -04001417 }
bungemanfe917272016-10-13 17:36:40 -04001418
Mike Kleine6682eb2017-01-05 10:54:57 -05001419 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001420 sources = [
1421 "tools/skdiff/skdiff.cpp",
1422 "tools/skdiff/skdiff_html.cpp",
1423 "tools/skdiff/skdiff_main.cpp",
1424 "tools/skdiff/skdiff_utils.cpp",
1425 ]
1426 deps = [
1427 ":skia",
1428 ":tool_utils",
1429 ]
bungemanfe917272016-10-13 17:36:40 -04001430 }
halcanarya73d76a2016-10-17 13:19:02 -07001431
Mike Kleine6682eb2017-01-05 10:54:57 -05001432 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001433 sources = [
1434 "tools/skp_parser.cpp",
1435 ]
1436 deps = [
1437 ":skia",
1438 ":tool_utils",
1439 "//third_party/jsoncpp",
1440 ]
halcanarya73d76a2016-10-17 13:19:02 -07001441 }
Brian Osman16adfa32016-10-18 14:42:44 -04001442
Mike Kleina92c3832016-12-08 09:49:39 -05001443 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001444 test_app("viewer") {
1445 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001446 sources = [
1447 "tools/viewer/GMSlide.cpp",
1448 "tools/viewer/ImageSlide.cpp",
1449 "tools/viewer/SKPSlide.cpp",
1450 "tools/viewer/SampleSlide.cpp",
1451 "tools/viewer/Viewer.cpp",
1452 "tools/viewer/sk_app/CommandSet.cpp",
1453 "tools/viewer/sk_app/GLWindowContext.cpp",
1454 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001455 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001456 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001457
Jim Van Verth4e56a912016-10-21 10:58:52 -04001458 if (is_android) {
1459 sources += [
1460 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1461 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1462 "tools/viewer/sk_app/android/Window_android.cpp",
1463 "tools/viewer/sk_app/android/main_android.cpp",
1464 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1465 ]
Brian Osman462334e2017-02-09 11:22:57 -05001466 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001467 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001468 sources += [
1469 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1470 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1471 "tools/viewer/sk_app/unix/Window_unix.cpp",
1472 "tools/viewer/sk_app/unix/main_unix.cpp",
1473 ]
1474 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001475 sources += [
1476 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1477 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1478 "tools/viewer/sk_app/win/Window_win.cpp",
1479 "tools/viewer/sk_app/win/main_win.cpp",
1480 ]
Mike Klein43c25262016-10-20 10:17:47 -04001481 } else if (is_mac) {
1482 sources += [
1483 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1484 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1485 "tools/viewer/sk_app/mac/Window_mac.cpp",
1486 "tools/viewer/sk_app/mac/main_mac.cpp",
1487 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001488 }
1489
1490 if (skia_use_vulkan) {
1491 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001492 if (is_android) {
1493 sources +=
1494 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001495 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001496 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1497 libs += [ "X11-xcb" ]
1498 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001499 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1500 }
1501 }
1502
1503 include_dirs = []
1504 deps = [
1505 ":flags",
1506 ":gm",
1507 ":gpu_tool_utils",
1508 ":samples",
1509 ":skia",
1510 ":tool_utils",
1511 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001512 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001513 "//third_party/jsoncpp",
1514 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001515 if (is_android) {
1516 deps += [ "//third_party/native_app_glue" ]
1517 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001518 deps += [ "//third_party/libsdl" ]
1519 }
Mike Kleina92c3832016-12-08 09:49:39 -05001520 }
Brian Osman16adfa32016-10-18 14:42:44 -04001521 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001522
Mike Kleine459afd2017-03-03 09:21:30 -05001523 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001524 copy("gdbserver") {
1525 sources = [
1526 "$ndk/$ndk_gdbserver",
1527 ]
1528 outputs = [
1529 "$root_out_dir/gdbserver",
1530 ]
1531 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001532 }
Mike Klein5ce39722017-06-27 22:52:03 +00001533
1534 if (skia_enable_gpu) {
1535 test_app("skslc") {
1536 defines = [ "SKSL_STANDALONE" ]
1537 sources = [
1538 "src/sksl/SkSLMain.cpp",
1539 ]
1540 sources += skia_sksl_sources
1541 include_dirs = [ "src/sksl" ]
1542 }
1543 }
mtklein25c81d42016-07-27 13:55:26 -07001544}