blob: 6ead044ff463f7c8c66f3c7a148a3c28b967a98e [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",
Ethan Nicholasc0709392017-06-27 11:20:22 -0400142 "$target_gen_dir",
mtkleinc04ff472016-06-23 10:29:30 -0700143 ]
mtklein150d1132016-08-01 06:56:40 -0700144
Mike Reeda9e241d2017-05-03 10:52:00 -0400145 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700146 if (is_android) {
147 defines += [
148 "SK_GAMMA_EXPONENT=1.4",
149 "SK_GAMMA_CONTRAST=0.0",
150 ]
151 }
mtklein88a7ac02016-09-14 11:16:49 -0700152 if (is_official_build || is_android) {
153 # TODO(bsalomon): it'd be nice to make Android normal.
154 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
155 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400156 libs = []
157 lib_dirs = []
158 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700159 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400160 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400161 lib_dirs += [
162 "$skia_vulkan_sdk/Bin",
163 "$skia_vulkan_sdk/Lib",
164 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400165 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400166 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400167 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400168 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400169 }
Brian Salomon03e05842017-02-23 12:23:47 -0500170 if (skia_enable_gpu) {
171 include_dirs += [ "src/gpu" ]
172 }
Brian Osman34755e22016-12-05 09:46:02 -0500173 if (skia_use_angle) {
174 defines += [ "SK_ANGLE" ]
175 }
Brian Osman3f375d02016-12-28 11:19:22 -0500176 if (skia_enable_discrete_gpu) {
177 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
178 }
mtkleinc04ff472016-06-23 10:29:30 -0700179}
180
181# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
182config("skia_library") {
183 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700184 defines = [ "SKIA_IMPLEMENTATION=1" ]
185}
186
187skia_library_configs = [
188 ":skia_public",
189 ":skia_private",
190 ":skia_library",
191]
192
mtklein9b8583d2016-08-24 17:32:30 -0700193# Use for CPU-specific Skia code that needs particular compiler flags.
194template("opts") {
195 if (invoker.enabled) {
196 source_set(target_name) {
197 forward_variables_from(invoker, "*")
198 configs += skia_library_configs
199 }
200 } else {
201 # If not enabled, a phony empty target that swallows all otherwise unused variables.
202 source_set(target_name) {
203 forward_variables_from(invoker,
204 "*",
205 [
206 "sources",
207 "cflags",
208 ])
209 }
210 }
anmittala7eaf2e2016-08-17 13:57:26 -0700211}
212
mtklein422310d2016-08-16 18:28:43 -0700213is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700214
mtklein7d6fb2c2016-08-25 14:50:44 -0700215opts("none") {
216 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700217 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700218 cflags = []
219}
220
mtklein7d6fb2c2016-08-25 14:50:44 -0700221opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700222 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700223 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700224 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700225}
226
227opts("arm64") {
228 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700230 cflags = []
231}
232
233opts("crc32") {
234 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700235 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700236 cflags = [ "-march=armv8-a+crc" ]
237}
238
mtklein9b8583d2016-08-24 17:32:30 -0700239opts("sse2") {
240 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400242 if (is_win) {
243 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
244 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400245 cflags = [ "-msse2" ]
246 }
mtklein9b8583d2016-08-24 17:32:30 -0700247}
mtkleinc04ff472016-06-23 10:29:30 -0700248
mtklein9b8583d2016-08-24 17:32:30 -0700249opts("ssse3") {
250 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400252 if (is_win) {
253 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
254 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400255 cflags = [ "-mssse3" ]
256 }
mtklein9b8583d2016-08-24 17:32:30 -0700257}
mtkleinc04ff472016-06-23 10:29:30 -0700258
mtklein9b8583d2016-08-24 17:32:30 -0700259opts("sse41") {
260 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700261 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400262 if (is_win) {
263 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
264 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400265 cflags = [ "-msse4.1" ]
266 }
mtklein9b8583d2016-08-24 17:32:30 -0700267}
mtklein4e976072016-08-08 09:06:27 -0700268
mtklein9b8583d2016-08-24 17:32:30 -0700269opts("sse42") {
270 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700271 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400272 if (is_win) {
273 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
274 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400275 cflags = [ "-msse4.2" ]
276 }
mtklein9b8583d2016-08-24 17:32:30 -0700277}
278
279opts("avx") {
280 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700281 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400282 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000283 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400284 } else {
285 cflags = [ "-mavx" ]
286 }
mtkleinc04ff472016-06-23 10:29:30 -0700287}
288
Mike Klein78d5a3b2016-09-30 10:48:01 -0400289opts("hsw") {
290 enabled = is_x86
291 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400292 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000293 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400294 } else {
295 cflags = [
296 "-mavx2",
297 "-mbmi",
298 "-mbmi2",
299 "-mf16c",
300 "-mfma",
301 ]
302 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400303}
304
mtkleinc095df52016-08-24 12:23:52 -0700305# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700306template("optional") {
307 if (invoker.enabled) {
308 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700309 if (defined(invoker.public_defines)) {
310 defines = invoker.public_defines
311 }
mtklein457b42a2016-08-23 13:56:37 -0700312 }
313 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700314 forward_variables_from(invoker,
315 "*",
316 [
317 "public_defines",
318 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700319 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700320 ])
mtklein457b42a2016-08-23 13:56:37 -0700321 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700322 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700323 if (defined(invoker.configs_to_remove)) {
324 configs -= invoker.configs_to_remove
325 }
mtklein457b42a2016-08-23 13:56:37 -0700326 }
327 } else {
mtklein457b42a2016-08-23 13:56:37 -0700328 source_set(target_name) {
329 forward_variables_from(invoker,
330 "*",
331 [
332 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700333 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700334 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700335 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700336 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700337 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700338 ])
mtkleincd01b032016-08-31 04:58:19 -0700339 if (defined(invoker.sources_when_disabled)) {
340 sources = invoker.sources_when_disabled
341 }
342 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700343 }
mtkleineb3c4252016-08-23 07:38:09 -0700344 }
mtklein457b42a2016-08-23 13:56:37 -0700345}
mtklein457b42a2016-08-23 13:56:37 -0700346
Mike Kleina04bb452017-02-09 12:24:07 -0500347optional("effects") {
348 enabled = skia_enable_effects
Ethan Nicholasc0709392017-06-27 11:20:22 -0400349 deps = [
350 ":compile_processors",
351 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500352 sources =
353 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
354 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
355}
356
mtkleina45be612016-08-29 15:22:10 -0700357optional("fontmgr_android") {
358 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700359
360 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500361 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700362 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700363 ]
364 sources = [
365 "src/ports/SkFontMgr_android.cpp",
366 "src/ports/SkFontMgr_android_factory.cpp",
367 "src/ports/SkFontMgr_android_parser.cpp",
368 ]
369}
370
mtkleind2e39db2016-09-07 07:52:55 -0700371optional("fontmgr_custom") {
372 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
373
374 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500375 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700376 ]
377 sources = [
378 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500379 "src/ports/SkFontMgr_custom.h",
380 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700381 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500382 "src/ports/SkFontMgr_custom_embedded.cpp",
383 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700384 ]
385}
386
mtklein3cc22182016-08-29 13:26:14 -0700387optional("fontmgr_fontconfig") {
388 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700389
390 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500391 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700392 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700393 ]
394 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700395 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700396 "src/ports/SkFontConfigInterface_direct.cpp",
397 "src/ports/SkFontConfigInterface_direct_factory.cpp",
398 "src/ports/SkFontMgr_FontConfigInterface.cpp",
399 "src/ports/SkFontMgr_fontconfig.cpp",
400 "src/ports/SkFontMgr_fontconfig_factory.cpp",
401 ]
402}
403
mtkleincdedd0e2016-09-12 15:15:44 -0700404optional("fontmgr_fuchsia") {
405 enabled = is_fuchsia && skia_use_freetype
406
407 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500408 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700409 ]
410 sources = [
411 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500412 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700413 "src/ports/SkFontMgr_custom_empty_factory.cpp",
414 ]
415}
416
Ethan Nicholasc0709392017-06-27 11:20:22 -0400417if (skia_enable_gpu && skia_gpu_processor_sources != []) {
418 executable("skslc") {
419 defines = [ "SKSL_STANDALONE" ]
420 sources = [
421 "src/sksl/SkSLMain.cpp",
422 ]
423 sources += skia_sksl_sources
424 include_dirs = [
425 "src/gpu",
426 "src/sksl",
427 ]
428 deps = [
429 "//third_party/spirv-tools",
430 ]
431 }
432
433 skia_gpu_processor_outputs = []
434 foreach(src, skia_gpu_processor_sources) {
435 name = get_path_info(src, "name")
436 skia_gpu_processor_outputs += [
437 "$target_gen_dir/effects/$name.h",
438 "$target_gen_dir/effects/$name.cpp",
439 ]
440 }
441
442 action("compile_processors") {
443 script = "gn/compile_processors.py"
444 deps = [
445 ":skslc(//gn/toolchain:$host_toolchain)",
446 ]
447 sources = skia_gpu_processor_sources
448 outputs = skia_gpu_processor_outputs
449 skslc_path = "$root_out_dir/"
450 if (host_toolchain != default_toolchain_name) {
451 skslc_path += "$host_toolchain/"
452 }
453 skslc_path += "skslc"
454 if (host_os == "win") {
455 skslc_path = ".exe"
456 }
457 args = [
458 rebase_path(skslc_path),
459 rebase_path("$target_gen_dir/effects"),
460 ]
461 args += rebase_path(skia_gpu_processor_sources)
462 }
463} else {
464 skia_gpu_processor_outputs = []
465 group("compile_processors") {
466 }
467}
468
mtklein06c35c02016-09-20 12:28:12 -0700469optional("gpu") {
470 enabled = skia_enable_gpu
Ethan Nicholasc0709392017-06-27 11:20:22 -0400471 deps = [
472 ":compile_processors",
473 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700474 public_defines = []
475
Mike Klein29b3e582017-02-09 11:57:32 -0500476 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholasc0709392017-06-27 11:20:22 -0400477 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
478 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700479
480 # These paths need to be absolute to match the ones produced by shared_sources.gni.
481 sources -= get_path_info([
482 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
483 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
484 ],
485 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400486 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700487 if (is_android) {
488 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400489 } else if (skia_use_egl) {
490 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
491 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700492 } else if (is_linux) {
493 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500494 libs += [
495 "GL",
496 "GLU",
497 ]
mtklein06c35c02016-09-20 12:28:12 -0700498 } else if (is_mac) {
499 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800500 } else if (is_ios) {
501 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400502 } else if (is_win) {
503 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
504 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700505 } else {
506 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
507 }
mtkleine9fb3d52016-09-20 15:11:46 -0700508
509 if (skia_use_vulkan) {
510 public_defines += [ "SK_VULKAN" ]
511 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700512 if (skia_enable_vulkan_debug_layers) {
513 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
514 }
mtkleine9fb3d52016-09-20 15:11:46 -0700515 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400516 if (skia_enable_spirv_validation) {
Ethan Nicholasc0709392017-06-27 11:20:22 -0400517 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400518 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
519 }
mtklein06c35c02016-09-20 12:28:12 -0700520}
521
mtklein63213812016-08-24 09:55:56 -0700522optional("jpeg") {
523 enabled = skia_use_libjpeg_turbo
524 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
525
mtklein63213812016-08-24 09:55:56 -0700526 deps = [
527 "//third_party/libjpeg-turbo:libjpeg",
528 ]
529 sources = [
530 "src/codec/SkJpegCodec.cpp",
531 "src/codec/SkJpegDecoderMgr.cpp",
532 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700533 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400534 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700535 ]
536}
537
538optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500539 enabled = skia_use_zlib && skia_enable_pdf
540 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700541
mtklein63213812016-08-24 09:55:56 -0700542 deps = [
543 "//third_party/zlib",
544 ]
brettwb9447282016-09-01 14:24:39 -0700545 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700546 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700547
548 if (skia_use_sfntly) {
549 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500550 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700551 }
552}
553
554optional("png") {
555 enabled = skia_use_libpng
556 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
557
mtklein63213812016-08-24 09:55:56 -0700558 deps = [
559 "//third_party/libpng",
560 ]
561 sources = [
562 "src/codec/SkIcoCodec.cpp",
563 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400564 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700565 ]
566}
567
scroggof84ad642016-10-31 09:02:57 -0700568optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400569 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700570 public_defines = [ "SK_CODEC_DECODES_RAW" ]
571
572 deps = [
573 "//third_party/dng_sdk",
574 "//third_party/libjpeg-turbo:libjpeg",
575 "//third_party/piex",
576 ]
577
578 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
579 # Skia.
580 configs_to_remove = [ "//gn:no_exceptions" ]
581
582 sources = [
583 "src/codec/SkRawAdapterCodec.cpp",
584 "src/codec/SkRawCodec.cpp",
585 ]
586}
587
mtklein3cc22182016-08-29 13:26:14 -0700588optional("typeface_freetype") {
589 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700590
591 deps = [
592 "//third_party/freetype2",
593 ]
594 sources = [
595 "src/ports/SkFontHost_FreeType.cpp",
596 "src/ports/SkFontHost_FreeType_common.cpp",
597 ]
598}
599
mtklein457b42a2016-08-23 13:56:37 -0700600optional("webp") {
601 enabled = skia_use_libwebp
602 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
603
mtklein457b42a2016-08-23 13:56:37 -0700604 deps = [
605 "//third_party/libwebp",
606 ]
607 sources = [
608 "src/codec/SkWebpAdapterCodec.cpp",
609 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400610 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700611 ]
mtkleineb3c4252016-08-23 07:38:09 -0700612}
613
mtklein63213812016-08-24 09:55:56 -0700614optional("xml") {
615 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000616 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700617
mtklein63213812016-08-24 09:55:56 -0700618 deps = [
619 "//third_party/expat",
620 ]
621 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500622 "src/svg/SkSVGCanvas.cpp",
623 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700624 "src/xml/SkDOM.cpp",
625 "src/xml/SkXMLParser.cpp",
626 "src/xml/SkXMLWriter.cpp",
627 ]
628}
629
mtkleinc04ff472016-06-23 10:29:30 -0700630component("skia") {
631 public_configs = [ ":skia_public" ]
632 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700633
634 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700635 ":arm64",
636 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700637 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700638 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500639 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700640 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700641 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700642 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700643 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700644 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400645 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700646 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700647 ":none",
mtklein63213812016-08-24 09:55:56 -0700648 ":pdf",
649 ":png",
scroggof84ad642016-10-31 09:02:57 -0700650 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700651 ":sse2",
652 ":sse41",
653 ":sse42",
654 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700655 ":webp",
mtklein63213812016-08-24 09:55:56 -0700656 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700657 ]
658
Chinmay Garde43f115c2016-11-16 15:04:12 -0800659 # This file (and all GN files in Skia) are designed to work with an
660 # empty sources assignment filter; we handle all that explicitly.
661 # We clear the filter here for clients who may have set up a global filter.
662 set_sources_assignment_filter([])
663
mtkleinc04ff472016-06-23 10:29:30 -0700664 sources = []
brettwb9447282016-09-01 14:24:39 -0700665 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700666 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500667 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700668 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700669 "src/android/SkBitmapRegionCodec.cpp",
670 "src/android/SkBitmapRegionDecoder.cpp",
671 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400672 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700673 "src/codec/SkBmpCodec.cpp",
674 "src/codec/SkBmpMaskCodec.cpp",
675 "src/codec/SkBmpRLECodec.cpp",
676 "src/codec/SkBmpStandardCodec.cpp",
677 "src/codec/SkCodec.cpp",
678 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700679 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700680 "src/codec/SkMaskSwizzler.cpp",
681 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700682 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700683 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700684 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700685 "src/codec/SkSwizzler.cpp",
686 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700687 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700688 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700689 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700690 "src/ports/SkMemory_malloc.cpp",
691 "src/ports/SkOSFile_stdio.cpp",
692 "src/sfnt/SkOTTable_name.cpp",
693 "src/sfnt/SkOTUtils.cpp",
694 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700695 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700696 ]
brettwb9447282016-09-01 14:24:39 -0700697
mtklein7d6fb2c2016-08-25 14:50:44 -0700698 libs = []
699
mtkleinc04ff472016-06-23 10:29:30 -0700700 if (is_win) {
701 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400702 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700703 "src/ports/SkDebug_win.cpp",
704 "src/ports/SkFontHost_win.cpp",
705 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700706 "src/ports/SkImageEncoder_WIC.cpp",
707 "src/ports/SkImageGeneratorWIC.cpp",
708 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700709 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700710 "src/ports/SkScalerContext_win_dw.cpp",
711 "src/ports/SkTLS_win.cpp",
712 "src/ports/SkTypeface_win_dw.cpp",
713 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400714 if (skia_use_gdi) {
715 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
716 libs += [
717 "Gdi32.lib",
718 "Usp10.lib",
719 ]
720 } else {
721 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
722 }
mtkleinb9be9792016-09-16 14:44:18 -0700723 sources -=
724 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400725 libs += [
726 "FontSub.lib",
727 "Ole32.lib",
728 "OleAut32.lib",
729 "User32.lib",
730 ]
mtkleinc04ff472016-06-23 10:29:30 -0700731 } else {
732 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700733 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700734 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700735 "src/ports/SkTLS_pthread.cpp",
736 ]
737 }
738
mtklein7d6fb2c2016-08-25 14:50:44 -0700739 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500740 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500741 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500742 deps += [ "//third_party/cpu-features" ]
743 }
mtklein06c35c02016-09-20 12:28:12 -0700744 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700745 libs += [
746 "EGL",
747 "GLESv2",
748 "log",
749 ]
750 }
751
mtkleinc04ff472016-06-23 10:29:30 -0700752 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700753 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700754 }
755
756 if (is_mac) {
757 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700758 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700759 "src/ports/SkFontHost_mac.cpp",
760 "src/ports/SkImageEncoder_CG.cpp",
761 "src/ports/SkImageGeneratorCG.cpp",
762 ]
mtklein09e61f72016-08-23 13:35:28 -0700763 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400764 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
765 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700766 "ApplicationServices.framework",
767 "OpenGL.framework",
768 ]
mtkleinc04ff472016-06-23 10:29:30 -0700769 }
abarth6fc8ff02016-07-15 15:15:15 -0700770
Mike Klein7d302882016-11-03 14:06:31 -0400771 if (is_ios) {
772 sources += [
773 "src/ports/SkDebug_stdio.cpp",
774 "src/ports/SkFontHost_mac.cpp",
775 "src/ports/SkImageEncoder_CG.cpp",
776 "src/ports/SkImageGeneratorCG.cpp",
777 ]
778 libs += [
779 "CoreFoundation.framework",
780 "CoreGraphics.framework",
781 "CoreText.framework",
782 "ImageIO.framework",
783 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400784
785 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
786 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400787 ]
788 }
789
abarth6fc8ff02016-07-15 15:15:15 -0700790 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700791 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700792 }
mtkleinc04ff472016-06-23 10:29:30 -0700793}
794
mtkleinc095df52016-08-24 12:23:52 -0700795# Targets guarded by skia_enable_tools may use //third_party freely.
796if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500797 # Used by gn_to_bp.py to list our public include dirs.
798 source_set("public") {
799 configs += [ ":skia_public" ]
800 }
801
Mike Kleinc36dedf2016-11-18 09:35:28 -0500802 config("skia.h_config") {
803 include_dirs = [ "$target_gen_dir" ]
804 }
805 action("skia.h") {
806 public_configs = [ ":skia.h_config" ]
807 skia_h = "$target_gen_dir/skia.h"
808 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400809 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000810 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500811 depfile = "$skia_h.deps"
812 outputs = [
813 skia_h,
814 ]
815 }
816
817 if (skia_enable_gpu && target_cpu == "x64") {
818 # Our bots only have 64-bit libOSMesa installed.
819 # TODO: worth fixing?
820 executable("fiddle") {
821 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500822 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500823 "tools/fiddle/draw.cpp",
824 "tools/fiddle/fiddle_main.cpp",
825 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400826
827 if (skia_use_egl) {
828 sources += [ "tools/fiddle/egl_context.cpp" ]
829 } else if (skia_use_mesa) {
830 sources += [ "tools/fiddle/mesa_context.cpp" ]
831 if (is_linux) {
832 libs += [ "OSMesa" ]
833 }
834 } else {
835 sources += [ "tools/fiddle/null_context.cpp" ]
836 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400837 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500838 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400839 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500840 ":skia",
841 ":skia.h",
842 ]
843 }
844 }
845
846 if (skia_enable_gpu) {
847 source_set("public_headers_warnings_check") {
848 sources = [
849 "tools/public_headers_warnings_check.cpp",
850 ]
851 configs -= [ "//gn:warnings_except_public_headers" ]
852 deps = [
853 ":skia",
854 ":skia.h",
855 ]
856 }
857 }
858
mtkleinc095df52016-08-24 12:23:52 -0700859 template("test_lib") {
860 config(target_name + "_config") {
861 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700862 if (defined(invoker.public_defines)) {
863 defines = invoker.public_defines
864 }
mtklein25c81d42016-07-27 13:55:26 -0700865 }
mtkleinc095df52016-08-24 12:23:52 -0700866 source_set(target_name) {
867 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
868 public_configs = [
869 ":" + target_name + "_config",
870 ":skia_private",
871 ]
872
873 if (!defined(deps)) {
874 deps = []
875 }
876 deps += [ ":skia" ]
877 testonly = true
878 }
mtklein25c81d42016-07-27 13:55:26 -0700879 }
mtklein25c81d42016-07-27 13:55:26 -0700880
Mike Kleine6682eb2017-01-05 10:54:57 -0500881 template("test_app") {
882 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
883 shared_library("lib" + target_name) {
884 forward_variables_from(invoker, "*", [ "is_shared_library" ])
885 testonly = true
886 }
887 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500888 _executable = target_name
889 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500890 forward_variables_from(invoker, "*", [ "is_shared_library" ])
891 testonly = true
892 }
893 }
Mike Klein7d921032017-01-05 12:20:41 -0500894 if (is_android && skia_android_serial != "" && defined(_executable)) {
895 action("push_" + target_name) {
896 script = "gn/push_to_android.py"
897 deps = [
898 ":" + _executable,
899 ]
900 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
901 outputs = [
902 _stamp,
903 ]
904 args = [
905 rebase_path("$root_build_dir/$_executable"),
906 skia_android_serial,
907 rebase_path(_stamp),
908 ]
909 testonly = true
910 }
911 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500912 }
913
mtkleinc095df52016-08-24 12:23:52 -0700914 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700915 public_include_dirs = []
916 if (skia_enable_gpu) {
917 public_defines = []
918 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700919
920 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700921 sources = [
922 "tools/gpu/GrContextFactory.cpp",
923 "tools/gpu/GrTest.cpp",
924 "tools/gpu/TestContext.cpp",
925 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700926 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700927 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
928 "tools/gpu/gl/debug/GrBufferObj.cpp",
929 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
930 "tools/gpu/gl/debug/GrProgramObj.cpp",
931 "tools/gpu/gl/debug/GrShaderObj.cpp",
932 "tools/gpu/gl/debug/GrTextureObj.cpp",
933 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
934 "tools/gpu/gl/null/NullGLTestContext.cpp",
935 ]
936 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700937
Kevin Lubick4a24e102017-03-29 11:19:01 -0400938 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700939 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400940 } else if (is_ios) {
941 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
942 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700943 } else if (is_linux) {
944 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500945 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700946 } else if (is_mac) {
947 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400948 } else if (is_win) {
949 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
950 libs += [
951 "Gdi32.lib",
952 "OpenGL32.lib",
953 ]
mtklein38925aa2016-09-21 10:11:25 -0700954 }
mtklein6ef69992016-09-14 06:12:09 -0700955
Mike Kleinc168a3a2016-11-14 14:53:13 +0000956 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000957 deps += [ "//third_party/angle2" ]
958 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
959 }
mtklein38925aa2016-09-21 10:11:25 -0700960 if (skia_use_mesa) {
961 public_defines += [ "SK_MESA" ]
962 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
963 libs += [ "OSMesa" ]
964 }
mtkleind68f9b02016-09-23 13:18:41 -0700965 if (skia_use_vulkan) {
966 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400967 if (is_win) {
968 libs += [ "vulkan-1.lib" ]
969 } else {
970 libs += [ "vulkan" ]
971 }
mtkleind68f9b02016-09-23 13:18:41 -0700972 }
mtkleina627b5c2016-09-20 13:36:47 -0700973 }
mtklein25c81d42016-07-27 13:55:26 -0700974 }
mtklein25c81d42016-07-27 13:55:26 -0700975
mtkleinc095df52016-08-24 12:23:52 -0700976 test_lib("flags") {
977 public_include_dirs = [ "tools/flags" ]
978 sources = [
979 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700980 ]
981 }
982 test_lib("common_flags") {
983 public_include_dirs = [ "tools/flags" ]
984 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700985 "tools/flags/SkCommonFlags.cpp",
986 "tools/flags/SkCommonFlagsConfig.cpp",
987 ]
988 deps = [
mtklein046cb562016-09-16 10:23:12 -0700989 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700990 ":gpu_tool_utils",
991 ]
992 }
mtklein25c81d42016-07-27 13:55:26 -0700993
mtkleinc095df52016-08-24 12:23:52 -0700994 test_lib("tool_utils") {
995 public_include_dirs = [
996 "tools",
997 "tools/debugger",
998 "tools/timer",
999 ]
1000 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001001 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001002 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001003 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001004 "tools/ProcStats.cpp",
1005 "tools/Resources.cpp",
1006 "tools/ThermalManager.cpp",
1007 "tools/UrlDataManager.cpp",
1008 "tools/debugger/SkDebugCanvas.cpp",
1009 "tools/debugger/SkDrawCommand.cpp",
1010 "tools/debugger/SkJsonWriteBuffer.cpp",
1011 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001012 "tools/picture_utils.cpp",
1013 "tools/random_parse_path.cpp",
1014 "tools/sk_tool_utils.cpp",
1015 "tools/sk_tool_utils_font.cpp",
1016 "tools/timer/Timer.cpp",
1017 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001018 libs = []
1019 if (is_ios) {
1020 sources += [ "tools/ios_utils.m" ]
1021 libs += [ "Foundation.framework" ]
1022 }
mtkleinc095df52016-08-24 12:23:52 -07001023 deps = [
mtklein046cb562016-09-16 10:23:12 -07001024 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001025 ":flags",
1026 "//third_party/libpng",
1027 ]
1028 public_deps = [
1029 "//third_party/jsoncpp",
1030 ]
1031 }
mtklein25c81d42016-07-27 13:55:26 -07001032
Mike Klein6e744122016-10-27 12:21:40 -04001033 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001034 test_lib("gm") {
1035 public_include_dirs = [ "gm" ]
1036 sources = gm_sources
1037 deps = [
scroggo19b91532016-10-24 09:03:26 -07001038 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001039 ":gpu_tool_utils",
1040 ":skia",
1041 ":tool_utils",
1042 ]
1043 }
mtklein25c81d42016-07-27 13:55:26 -07001044
Mike Klein6e744122016-10-27 12:21:40 -04001045 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001046 test_lib("tests") {
1047 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001048 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001049 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001050 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001051 }
mtkleinc095df52016-08-24 12:23:52 -07001052 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001053 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001054 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001055 ":skia",
1056 ":tool_utils",
1057 "//third_party/libpng",
1058 "//third_party/zlib",
1059 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001060 public_deps = [
1061 ":gpu_tool_utils", # Test.h #includes headers from this target.
1062 ]
mtkleinc095df52016-08-24 12:23:52 -07001063 }
mtklein2f3416d2016-08-02 16:02:05 -07001064
Mike Klein6e744122016-10-27 12:21:40 -04001065 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001066 test_lib("bench") {
1067 public_include_dirs = [ "bench" ]
1068 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001069 deps = [
1070 ":flags",
1071 ":gm",
1072 ":gpu_tool_utils",
1073 ":skia",
1074 ":tool_utils",
1075 ]
1076 }
mtklein2b6870c2016-07-28 14:17:33 -07001077
mtkleinc095df52016-08-24 12:23:52 -07001078 test_lib("experimental_svg_model") {
1079 public_include_dirs = [ "experimental/svg/model" ]
1080 sources = [
1081 "experimental/svg/model/SkSVGAttribute.cpp",
1082 "experimental/svg/model/SkSVGAttributeParser.cpp",
1083 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001084 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001085 "experimental/svg/model/SkSVGContainer.cpp",
1086 "experimental/svg/model/SkSVGDOM.cpp",
1087 "experimental/svg/model/SkSVGEllipse.cpp",
1088 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001089 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001090 "experimental/svg/model/SkSVGNode.cpp",
1091 "experimental/svg/model/SkSVGPath.cpp",
1092 "experimental/svg/model/SkSVGPoly.cpp",
1093 "experimental/svg/model/SkSVGRect.cpp",
1094 "experimental/svg/model/SkSVGRenderContext.cpp",
1095 "experimental/svg/model/SkSVGSVG.cpp",
1096 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001097 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001098 "experimental/svg/model/SkSVGTransformableNode.cpp",
1099 "experimental/svg/model/SkSVGValue.cpp",
1100 ]
1101 deps = [
1102 ":skia",
1103 ]
1104 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001105
Brian Osman16adfa32016-10-18 14:42:44 -04001106 test_lib("views") {
1107 public_include_dirs = [ "include/views" ]
1108 sources = [
1109 "src/views/SkEvent.cpp",
1110 "src/views/SkEventSink.cpp",
1111 "src/views/SkOSMenu.cpp",
1112 "src/views/SkTagList.cpp",
1113 "src/views/SkTouchGesture.cpp",
1114 "src/views/SkView.cpp",
1115 "src/views/SkViewPriv.cpp",
1116 ]
1117 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001118 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001119 if (!is_android) {
1120 sources += [ "src/views/SkWindow.cpp" ]
1121 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001122 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001123 public_include_dirs += [ "src/views/unix" ]
1124 sources += [
1125 "src/views/unix/SkOSWindow_Unix.cpp",
1126 "src/views/unix/keysym2ucs.c",
1127 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001128 libs += [
1129 "GL",
1130 "X11",
1131 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001132 } else if (is_mac) {
1133 sources += [
1134 "src/views/mac/SkEventNotifier.mm",
1135 "src/views/mac/SkNSView.mm",
1136 "src/views/mac/SkOSWindow_Mac.mm",
1137 "src/views/mac/SkTextFieldCell.m",
1138 ]
1139 libs += [
1140 "QuartzCore.framework",
1141 "Cocoa.framework",
1142 "Foundation.framework",
1143 ]
1144 } else if (is_win) {
1145 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1146 }
Brian Osman34755e22016-12-05 09:46:02 -05001147 if (skia_use_angle) {
1148 deps += [ "//third_party/angle2" ]
1149 }
Brian Osman16adfa32016-10-18 14:42:44 -04001150 }
1151
Mike Klein38af9432016-11-11 11:39:44 -05001152 if (skia_use_lua) {
1153 test_lib("lua") {
1154 public_include_dirs = []
1155 sources = [
1156 "src/utils/SkLua.cpp",
1157 "src/utils/SkLuaCanvas.cpp",
1158 ]
1159 deps = [
1160 "//third_party/lua",
1161 ]
1162 }
1163
Mike Kleine6682eb2017-01-05 10:54:57 -05001164 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001165 sources = [
1166 "tools/lua/lua_app.cpp",
1167 ]
1168 deps = [
1169 ":lua",
1170 ":skia",
1171 "//third_party/lua",
1172 ]
Mike Klein38af9432016-11-11 11:39:44 -05001173 }
1174
Mike Kleine6682eb2017-01-05 10:54:57 -05001175 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001176 sources = [
1177 "tools/lua/lua_pictures.cpp",
1178 ]
1179 deps = [
1180 ":flags",
1181 ":lua",
1182 ":skia",
1183 ":tool_utils",
1184 "//third_party/lua",
1185 ]
Mike Klein38af9432016-11-11 11:39:44 -05001186 }
1187 }
1188
Mike Klein6e744122016-10-27 12:21:40 -04001189 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001190 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001191 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001192 include_dirs = [ "experimental" ]
1193 sources = samples_sources + [
Mike Klein6e744122016-10-27 12:21:40 -04001194 "experimental/SkSetPoly3To3.cpp",
1195 "experimental/SkSetPoly3To3_A.cpp",
1196 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001197
1198 # Relocating these files here, so that clients don't try to build them while they're
1199 # still in active development. Clang's thread safety analysis gets tripped up by
1200 # conditional locks.
1201 "src/core/SkThreadedBMPDevice.cpp",
1202 "src/core/SkThreadedBMPDevice.h",
Mike Klein6e744122016-10-27 12:21:40 -04001203 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001204 deps = [
1205 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001206 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001207 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001208 ":tool_utils",
1209 ":views",
1210 ":xml",
1211 ]
Mike Klein38af9432016-11-11 11:39:44 -05001212
1213 if (skia_use_lua) {
1214 sources += [ "samplecode/SampleLua.cpp" ]
1215 deps += [
1216 ":lua",
1217 "//third_party/lua",
1218 ]
1219 }
Brian Osman16adfa32016-10-18 14:42:44 -04001220 }
1221
Mike Kleine6682eb2017-01-05 10:54:57 -05001222 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001223 sources = [
1224 "dm/DM.cpp",
1225 "dm/DMJsonWriter.cpp",
1226 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001227 ]
1228 include_dirs = [ "tests" ]
1229 deps = [
mtklein046cb562016-09-16 10:23:12 -07001230 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001231 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001232 ":flags",
1233 ":gm",
1234 ":gpu_tool_utils",
1235 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001236 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001237 ":tool_utils",
1238 "//third_party/jsoncpp",
1239 "//third_party/libpng",
1240 ]
mtklein2b6870c2016-07-28 14:17:33 -07001241 }
1242
Mike Klein06432b22017-03-21 13:14:33 -04001243 test_app("ok") {
1244 sources = [
1245 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001246 "tools/ok_dsts.cpp",
1247 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001248 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001249 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001250 ]
1251 deps = [
1252 ":gm",
1253 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001254 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001255 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001256 ]
1257 }
1258
Mike Kleina3430172016-09-27 16:46:29 -04001259 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001260 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001261 sources = [
1262 "tools/monobench.cpp",
1263 ]
1264 deps = [
1265 ":bench",
1266 ":skia",
1267 ]
Mike Kleina3430172016-09-27 16:46:29 -04001268 }
mtklein2b6870c2016-07-28 14:17:33 -07001269 }
1270
Mike Kleine6682eb2017-01-05 10:54:57 -05001271 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001272 sources = [
1273 "bench/nanobench.cpp",
1274 ]
1275 deps = [
1276 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001277 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001278 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001279 ":flags",
1280 ":gm",
1281 ":gpu_tool_utils",
1282 ":skia",
1283 ":tool_utils",
1284 "//third_party/jsoncpp",
1285 ]
mtklein2b6870c2016-07-28 14:17:33 -07001286 }
halcanary19a97202016-08-03 15:08:04 -07001287
Ravi Mistry10d36c52017-01-31 09:49:18 -05001288 test_app("skpinfo") {
1289 sources = [
1290 "tools/skpinfo.cpp",
1291 ]
1292 deps = [
1293 ":flags",
1294 ":skia",
1295 ]
1296 }
1297
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001298 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001299 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001300 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001301 "samplecode/SampleApp.cpp",
1302 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001303 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001304 if (is_mac) {
1305 sources += [ "src/views/mac/skia_mac.mm" ]
1306 } else if (is_win) {
1307 sources += [ "src/views/win/skia_win.cpp" ]
1308 } else if (is_linux) {
1309 sources += [ "src/views/unix/skia_unix.cpp" ]
1310 }
mtklein38925aa2016-09-21 10:11:25 -07001311 deps = [
1312 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001313 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001314 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001315 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001316 ":skia",
1317 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001318 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001319 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001320 if (skia_use_angle) {
1321 deps += [ "//third_party/angle2" ]
1322 }
mtklein38925aa2016-09-21 10:11:25 -07001323 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001324 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001325
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001326 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001327 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001328 sources = [
1329 "tools/skpbench/skpbench.cpp",
1330 ]
1331 deps = [
1332 ":flags",
1333 ":gpu_tool_utils",
1334 ":skia",
1335 ":tool_utils",
1336 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001337 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001338 }
1339
Mike Klein7d302882016-11-03 14:06:31 -04001340 # We can't yet build ICU on iOS or Windows.
1341 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001342 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001343 sources = [
1344 "tools/SkShaper_harfbuzz.cpp",
1345 "tools/using_skia_and_harfbuzz.cpp",
1346 ]
1347 deps = [
1348 ":skia",
1349 "//third_party/harfbuzz",
1350 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001351 }
halcanary19a97202016-08-03 15:08:04 -07001352 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001353 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001354 sources = [
1355 "tools/SkShaper_primitive.cpp",
1356 "tools/using_skia_and_harfbuzz.cpp",
1357 ]
1358 deps = [
1359 ":skia",
1360 ]
halcanary3eee9d92016-09-10 07:01:53 -07001361 }
mtklein046cb562016-09-16 10:23:12 -07001362
Matt Sarett9f1c4032017-05-17 10:06:32 -04001363 test_app("create_flutter_test_images") {
1364 sources = [
1365 "tools/create_flutter_test_images.cpp",
1366 ]
1367 deps = [
1368 ":skia",
1369 ":tool_utils",
1370 ]
1371 }
1372
Mike Kleine6682eb2017-01-05 10:54:57 -05001373 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001374 sources = [
1375 "tools/get_images_from_skps.cpp",
1376 ]
1377 deps = [
1378 ":flags",
1379 ":skia",
1380 "//third_party/jsoncpp",
1381 ]
mtklein046cb562016-09-16 10:23:12 -07001382 }
mtkleinecbc5262016-09-22 11:51:24 -07001383
Mike Kleine6682eb2017-01-05 10:54:57 -05001384 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001385 sources = [
1386 "tools/colorspaceinfo.cpp",
1387 ]
1388 deps = [
1389 ":flags",
1390 ":skia",
1391 ":tool_utils",
1392 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001393 }
1394
Mike Klein7d302882016-11-03 14:06:31 -04001395 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001396 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001397 sources = [
1398 "tools/skiaserve/Request.cpp",
1399 "tools/skiaserve/Response.cpp",
1400 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001401 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1402 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1403 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1404 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1405 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1406 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1407 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1408 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1409 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001410 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1411 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001412 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1413 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1414 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1415 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1416 ]
1417 deps = [
1418 ":flags",
1419 ":gpu_tool_utils",
1420 ":skia",
1421 ":tool_utils",
1422 "//third_party/jsoncpp",
1423 "//third_party/libmicrohttpd",
1424 "//third_party/libpng",
1425 ]
Mike Klein7d302882016-11-03 14:06:31 -04001426 }
mtkleinecbc5262016-09-22 11:51:24 -07001427 }
kjlubick14f984b2016-10-03 11:49:45 -07001428
Mike Kleine6682eb2017-01-05 10:54:57 -05001429 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001430 sources = [
1431 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001432 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001433 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001434 "fuzz/FuzzGradients.cpp",
1435 "fuzz/FuzzParsePath.cpp",
1436 "fuzz/FuzzPathop.cpp",
1437 "fuzz/FuzzScaleToSides.cpp",
1438 "fuzz/fuzz.cpp",
1439 ]
1440 deps = [
1441 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001442 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001443 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001444 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001445 ]
kjlubick14f984b2016-10-03 11:49:45 -07001446 }
Mike Klein38312422016-10-05 15:41:01 -04001447
Mike Kleine6682eb2017-01-05 10:54:57 -05001448 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001449 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001450 rebase_path("tests/skia_test.cpp"),
1451 rebase_path("tests/Test.cpp"),
1452 ]
caryclark9feb6322016-10-25 08:58:26 -07001453 deps = [
1454 ":flags",
1455 ":gpu_tool_utils",
1456 ":skia",
1457 ":tool_utils",
1458 ]
caryclark9feb6322016-10-25 08:58:26 -07001459 }
1460
Mike Kleine6682eb2017-01-05 10:54:57 -05001461 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001462 sources = [
1463 "tools/DumpRecord.cpp",
1464 "tools/dump_record.cpp",
1465 ]
1466 deps = [
1467 ":flags",
1468 ":skia",
1469 ]
Mike Klein38312422016-10-05 15:41:01 -04001470 }
bungemanfe917272016-10-13 17:36:40 -04001471
Mike Kleine6682eb2017-01-05 10:54:57 -05001472 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001473 sources = [
1474 "tools/skdiff/skdiff.cpp",
1475 "tools/skdiff/skdiff_html.cpp",
1476 "tools/skdiff/skdiff_main.cpp",
1477 "tools/skdiff/skdiff_utils.cpp",
1478 ]
1479 deps = [
1480 ":skia",
1481 ":tool_utils",
1482 ]
bungemanfe917272016-10-13 17:36:40 -04001483 }
halcanarya73d76a2016-10-17 13:19:02 -07001484
Mike Kleine6682eb2017-01-05 10:54:57 -05001485 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001486 sources = [
1487 "tools/skp_parser.cpp",
1488 ]
1489 deps = [
1490 ":skia",
1491 ":tool_utils",
1492 "//third_party/jsoncpp",
1493 ]
halcanarya73d76a2016-10-17 13:19:02 -07001494 }
Brian Osman16adfa32016-10-18 14:42:44 -04001495
Mike Kleina92c3832016-12-08 09:49:39 -05001496 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001497 test_app("viewer") {
1498 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001499 sources = [
1500 "tools/viewer/GMSlide.cpp",
1501 "tools/viewer/ImageSlide.cpp",
1502 "tools/viewer/SKPSlide.cpp",
1503 "tools/viewer/SampleSlide.cpp",
1504 "tools/viewer/Viewer.cpp",
1505 "tools/viewer/sk_app/CommandSet.cpp",
1506 "tools/viewer/sk_app/GLWindowContext.cpp",
1507 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001508 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001509 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001510
Jim Van Verth4e56a912016-10-21 10:58:52 -04001511 if (is_android) {
1512 sources += [
1513 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1514 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1515 "tools/viewer/sk_app/android/Window_android.cpp",
1516 "tools/viewer/sk_app/android/main_android.cpp",
1517 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1518 ]
Brian Osman462334e2017-02-09 11:22:57 -05001519 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001520 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001521 sources += [
1522 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1523 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1524 "tools/viewer/sk_app/unix/Window_unix.cpp",
1525 "tools/viewer/sk_app/unix/main_unix.cpp",
1526 ]
1527 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001528 sources += [
1529 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1530 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1531 "tools/viewer/sk_app/win/Window_win.cpp",
1532 "tools/viewer/sk_app/win/main_win.cpp",
1533 ]
Mike Klein43c25262016-10-20 10:17:47 -04001534 } else if (is_mac) {
1535 sources += [
1536 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1537 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1538 "tools/viewer/sk_app/mac/Window_mac.cpp",
1539 "tools/viewer/sk_app/mac/main_mac.cpp",
1540 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001541 }
1542
1543 if (skia_use_vulkan) {
1544 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001545 if (is_android) {
1546 sources +=
1547 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001548 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001549 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1550 libs += [ "X11-xcb" ]
1551 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001552 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1553 }
1554 }
1555
1556 include_dirs = []
1557 deps = [
1558 ":flags",
1559 ":gm",
1560 ":gpu_tool_utils",
1561 ":samples",
1562 ":skia",
1563 ":tool_utils",
1564 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001565 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001566 "//third_party/jsoncpp",
1567 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001568 if (is_android) {
1569 deps += [ "//third_party/native_app_glue" ]
1570 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001571 deps += [ "//third_party/libsdl" ]
1572 }
Mike Kleina92c3832016-12-08 09:49:39 -05001573 }
Brian Osman16adfa32016-10-18 14:42:44 -04001574 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001575
Mike Kleine459afd2017-03-03 09:21:30 -05001576 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001577 copy("gdbserver") {
1578 sources = [
1579 "$ndk/$ndk_gdbserver",
1580 ]
1581 outputs = [
1582 "$root_out_dir/gdbserver",
1583 ]
1584 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001585 }
mtklein25c81d42016-07-27 13:55:26 -07001586}