blob: 7595076a02b12139ba0fe8e2b0e174603efe6bde [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" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400489
490 # this lib is required to link against AHardwareBuffer
491 if (defined(ndk_api) && ndk_api >= 26) {
492 libs += [ "android" ]
493 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400494 } else if (skia_use_egl) {
495 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
496 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700497 } else if (is_linux) {
498 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500499 libs += [
500 "GL",
501 "GLU",
502 ]
mtklein06c35c02016-09-20 12:28:12 -0700503 } else if (is_mac) {
504 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800505 } else if (is_ios) {
506 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400507 } else if (is_win) {
508 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
509 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700510 } else {
511 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
512 }
mtkleine9fb3d52016-09-20 15:11:46 -0700513
514 if (skia_use_vulkan) {
515 public_defines += [ "SK_VULKAN" ]
516 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700517 if (skia_enable_vulkan_debug_layers) {
518 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
519 }
mtkleine9fb3d52016-09-20 15:11:46 -0700520 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400521 if (skia_enable_spirv_validation) {
Ethan Nicholasc0709392017-06-27 11:20:22 -0400522 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400523 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
524 }
mtklein06c35c02016-09-20 12:28:12 -0700525}
526
mtklein63213812016-08-24 09:55:56 -0700527optional("jpeg") {
528 enabled = skia_use_libjpeg_turbo
529 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
530
mtklein63213812016-08-24 09:55:56 -0700531 deps = [
532 "//third_party/libjpeg-turbo:libjpeg",
533 ]
534 sources = [
535 "src/codec/SkJpegCodec.cpp",
536 "src/codec/SkJpegDecoderMgr.cpp",
537 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700538 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400539 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700540 ]
541}
542
543optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500544 enabled = skia_use_zlib && skia_enable_pdf
545 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700546
mtklein63213812016-08-24 09:55:56 -0700547 deps = [
548 "//third_party/zlib",
549 ]
brettwb9447282016-09-01 14:24:39 -0700550 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700551 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700552
553 if (skia_use_sfntly) {
554 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500555 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700556 }
557}
558
559optional("png") {
560 enabled = skia_use_libpng
561 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
562
mtklein63213812016-08-24 09:55:56 -0700563 deps = [
564 "//third_party/libpng",
565 ]
566 sources = [
567 "src/codec/SkIcoCodec.cpp",
568 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400569 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700570 ]
571}
572
scroggof84ad642016-10-31 09:02:57 -0700573optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400574 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700575 public_defines = [ "SK_CODEC_DECODES_RAW" ]
576
577 deps = [
578 "//third_party/dng_sdk",
579 "//third_party/libjpeg-turbo:libjpeg",
580 "//third_party/piex",
581 ]
582
583 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
584 # Skia.
585 configs_to_remove = [ "//gn:no_exceptions" ]
586
587 sources = [
588 "src/codec/SkRawAdapterCodec.cpp",
589 "src/codec/SkRawCodec.cpp",
590 ]
591}
592
mtklein3cc22182016-08-29 13:26:14 -0700593optional("typeface_freetype") {
594 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700595
596 deps = [
597 "//third_party/freetype2",
598 ]
599 sources = [
600 "src/ports/SkFontHost_FreeType.cpp",
601 "src/ports/SkFontHost_FreeType_common.cpp",
602 ]
603}
604
mtklein457b42a2016-08-23 13:56:37 -0700605optional("webp") {
606 enabled = skia_use_libwebp
607 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
608
mtklein457b42a2016-08-23 13:56:37 -0700609 deps = [
610 "//third_party/libwebp",
611 ]
612 sources = [
613 "src/codec/SkWebpAdapterCodec.cpp",
614 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400615 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700616 ]
mtkleineb3c4252016-08-23 07:38:09 -0700617}
618
mtklein63213812016-08-24 09:55:56 -0700619optional("xml") {
620 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000621 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700622
mtklein63213812016-08-24 09:55:56 -0700623 deps = [
624 "//third_party/expat",
625 ]
626 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500627 "src/svg/SkSVGCanvas.cpp",
628 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700629 "src/xml/SkDOM.cpp",
630 "src/xml/SkXMLParser.cpp",
631 "src/xml/SkXMLWriter.cpp",
632 ]
633}
634
mtkleinc04ff472016-06-23 10:29:30 -0700635component("skia") {
636 public_configs = [ ":skia_public" ]
637 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700638
639 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700640 ":arm64",
641 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700642 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700643 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500644 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700645 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700646 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700647 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700648 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700649 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400650 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700651 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700652 ":none",
mtklein63213812016-08-24 09:55:56 -0700653 ":pdf",
654 ":png",
scroggof84ad642016-10-31 09:02:57 -0700655 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700656 ":sse2",
657 ":sse41",
658 ":sse42",
659 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700660 ":webp",
mtklein63213812016-08-24 09:55:56 -0700661 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700662 ]
663
Chinmay Garde43f115c2016-11-16 15:04:12 -0800664 # This file (and all GN files in Skia) are designed to work with an
665 # empty sources assignment filter; we handle all that explicitly.
666 # We clear the filter here for clients who may have set up a global filter.
667 set_sources_assignment_filter([])
668
mtkleinc04ff472016-06-23 10:29:30 -0700669 sources = []
brettwb9447282016-09-01 14:24:39 -0700670 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700671 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500672 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700673 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700674 "src/android/SkBitmapRegionCodec.cpp",
675 "src/android/SkBitmapRegionDecoder.cpp",
676 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400677 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700678 "src/codec/SkBmpCodec.cpp",
679 "src/codec/SkBmpMaskCodec.cpp",
680 "src/codec/SkBmpRLECodec.cpp",
681 "src/codec/SkBmpStandardCodec.cpp",
682 "src/codec/SkCodec.cpp",
683 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700684 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700685 "src/codec/SkMaskSwizzler.cpp",
686 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700687 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700688 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700689 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700690 "src/codec/SkSwizzler.cpp",
691 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700692 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700693 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700694 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700695 "src/ports/SkMemory_malloc.cpp",
696 "src/ports/SkOSFile_stdio.cpp",
697 "src/sfnt/SkOTTable_name.cpp",
698 "src/sfnt/SkOTUtils.cpp",
699 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700700 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700701 ]
brettwb9447282016-09-01 14:24:39 -0700702
mtklein7d6fb2c2016-08-25 14:50:44 -0700703 libs = []
704
mtkleinc04ff472016-06-23 10:29:30 -0700705 if (is_win) {
706 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400707 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700708 "src/ports/SkDebug_win.cpp",
709 "src/ports/SkFontHost_win.cpp",
710 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700711 "src/ports/SkImageEncoder_WIC.cpp",
712 "src/ports/SkImageGeneratorWIC.cpp",
713 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700714 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700715 "src/ports/SkScalerContext_win_dw.cpp",
716 "src/ports/SkTLS_win.cpp",
717 "src/ports/SkTypeface_win_dw.cpp",
718 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400719 if (skia_use_gdi) {
720 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
721 libs += [
722 "Gdi32.lib",
723 "Usp10.lib",
724 ]
725 } else {
726 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
727 }
mtkleinb9be9792016-09-16 14:44:18 -0700728 sources -=
729 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400730 libs += [
731 "FontSub.lib",
732 "Ole32.lib",
733 "OleAut32.lib",
734 "User32.lib",
735 ]
mtkleinc04ff472016-06-23 10:29:30 -0700736 } else {
737 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700738 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700739 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700740 "src/ports/SkTLS_pthread.cpp",
741 ]
742 }
743
mtklein7d6fb2c2016-08-25 14:50:44 -0700744 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500745 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500746 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500747 deps += [ "//third_party/cpu-features" ]
748 }
mtklein06c35c02016-09-20 12:28:12 -0700749 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700750 libs += [
751 "EGL",
752 "GLESv2",
753 "log",
754 ]
755 }
756
mtkleinc04ff472016-06-23 10:29:30 -0700757 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700758 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700759 }
760
761 if (is_mac) {
762 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700763 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700764 "src/ports/SkFontHost_mac.cpp",
765 "src/ports/SkImageEncoder_CG.cpp",
766 "src/ports/SkImageGeneratorCG.cpp",
767 ]
mtklein09e61f72016-08-23 13:35:28 -0700768 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400769 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
770 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700771 "ApplicationServices.framework",
772 "OpenGL.framework",
773 ]
mtkleinc04ff472016-06-23 10:29:30 -0700774 }
abarth6fc8ff02016-07-15 15:15:15 -0700775
Mike Klein7d302882016-11-03 14:06:31 -0400776 if (is_ios) {
777 sources += [
778 "src/ports/SkDebug_stdio.cpp",
779 "src/ports/SkFontHost_mac.cpp",
780 "src/ports/SkImageEncoder_CG.cpp",
781 "src/ports/SkImageGeneratorCG.cpp",
782 ]
783 libs += [
784 "CoreFoundation.framework",
785 "CoreGraphics.framework",
786 "CoreText.framework",
787 "ImageIO.framework",
788 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400789
790 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
791 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400792 ]
793 }
794
abarth6fc8ff02016-07-15 15:15:15 -0700795 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700796 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700797 }
mtkleinc04ff472016-06-23 10:29:30 -0700798}
799
mtkleinc095df52016-08-24 12:23:52 -0700800# Targets guarded by skia_enable_tools may use //third_party freely.
801if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500802 # Used by gn_to_bp.py to list our public include dirs.
803 source_set("public") {
804 configs += [ ":skia_public" ]
805 }
806
Mike Kleinc36dedf2016-11-18 09:35:28 -0500807 config("skia.h_config") {
808 include_dirs = [ "$target_gen_dir" ]
809 }
810 action("skia.h") {
811 public_configs = [ ":skia.h_config" ]
812 skia_h = "$target_gen_dir/skia.h"
813 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400814 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000815 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500816 depfile = "$skia_h.deps"
817 outputs = [
818 skia_h,
819 ]
820 }
821
822 if (skia_enable_gpu && target_cpu == "x64") {
823 # Our bots only have 64-bit libOSMesa installed.
824 # TODO: worth fixing?
825 executable("fiddle") {
826 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500827 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500828 "tools/fiddle/draw.cpp",
829 "tools/fiddle/fiddle_main.cpp",
830 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400831
832 if (skia_use_egl) {
833 sources += [ "tools/fiddle/egl_context.cpp" ]
834 } else if (skia_use_mesa) {
835 sources += [ "tools/fiddle/mesa_context.cpp" ]
836 if (is_linux) {
837 libs += [ "OSMesa" ]
838 }
839 } else {
840 sources += [ "tools/fiddle/null_context.cpp" ]
841 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400842 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500843 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400844 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500845 ":skia",
846 ":skia.h",
847 ]
848 }
849 }
850
851 if (skia_enable_gpu) {
852 source_set("public_headers_warnings_check") {
853 sources = [
854 "tools/public_headers_warnings_check.cpp",
855 ]
856 configs -= [ "//gn:warnings_except_public_headers" ]
857 deps = [
858 ":skia",
859 ":skia.h",
860 ]
861 }
862 }
863
mtkleinc095df52016-08-24 12:23:52 -0700864 template("test_lib") {
865 config(target_name + "_config") {
866 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700867 if (defined(invoker.public_defines)) {
868 defines = invoker.public_defines
869 }
mtklein25c81d42016-07-27 13:55:26 -0700870 }
mtkleinc095df52016-08-24 12:23:52 -0700871 source_set(target_name) {
872 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
873 public_configs = [
874 ":" + target_name + "_config",
875 ":skia_private",
876 ]
877
878 if (!defined(deps)) {
879 deps = []
880 }
881 deps += [ ":skia" ]
882 testonly = true
883 }
mtklein25c81d42016-07-27 13:55:26 -0700884 }
mtklein25c81d42016-07-27 13:55:26 -0700885
Mike Kleine6682eb2017-01-05 10:54:57 -0500886 template("test_app") {
887 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
888 shared_library("lib" + target_name) {
889 forward_variables_from(invoker, "*", [ "is_shared_library" ])
890 testonly = true
891 }
892 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500893 _executable = target_name
894 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500895 forward_variables_from(invoker, "*", [ "is_shared_library" ])
896 testonly = true
897 }
898 }
Mike Klein7d921032017-01-05 12:20:41 -0500899 if (is_android && skia_android_serial != "" && defined(_executable)) {
900 action("push_" + target_name) {
901 script = "gn/push_to_android.py"
902 deps = [
903 ":" + _executable,
904 ]
905 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
906 outputs = [
907 _stamp,
908 ]
909 args = [
910 rebase_path("$root_build_dir/$_executable"),
911 skia_android_serial,
912 rebase_path(_stamp),
913 ]
914 testonly = true
915 }
916 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500917 }
918
mtkleinc095df52016-08-24 12:23:52 -0700919 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700920 public_include_dirs = []
921 if (skia_enable_gpu) {
922 public_defines = []
923 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700924
925 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700926 sources = [
927 "tools/gpu/GrContextFactory.cpp",
928 "tools/gpu/GrTest.cpp",
929 "tools/gpu/TestContext.cpp",
930 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700931 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700932 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
933 "tools/gpu/gl/debug/GrBufferObj.cpp",
934 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
935 "tools/gpu/gl/debug/GrProgramObj.cpp",
936 "tools/gpu/gl/debug/GrShaderObj.cpp",
937 "tools/gpu/gl/debug/GrTextureObj.cpp",
938 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
939 "tools/gpu/gl/null/NullGLTestContext.cpp",
940 ]
941 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700942
Kevin Lubick4a24e102017-03-29 11:19:01 -0400943 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700944 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400945 } else if (is_ios) {
946 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
947 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700948 } else if (is_linux) {
949 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500950 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700951 } else if (is_mac) {
952 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400953 } else if (is_win) {
954 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
955 libs += [
956 "Gdi32.lib",
957 "OpenGL32.lib",
958 ]
mtklein38925aa2016-09-21 10:11:25 -0700959 }
mtklein6ef69992016-09-14 06:12:09 -0700960
Mike Kleinc168a3a2016-11-14 14:53:13 +0000961 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000962 deps += [ "//third_party/angle2" ]
963 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
964 }
mtklein38925aa2016-09-21 10:11:25 -0700965 if (skia_use_mesa) {
966 public_defines += [ "SK_MESA" ]
967 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
968 libs += [ "OSMesa" ]
969 }
mtkleind68f9b02016-09-23 13:18:41 -0700970 if (skia_use_vulkan) {
971 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400972 if (is_win) {
973 libs += [ "vulkan-1.lib" ]
974 } else {
975 libs += [ "vulkan" ]
976 }
mtkleind68f9b02016-09-23 13:18:41 -0700977 }
mtkleina627b5c2016-09-20 13:36:47 -0700978 }
mtklein25c81d42016-07-27 13:55:26 -0700979 }
mtklein25c81d42016-07-27 13:55:26 -0700980
mtkleinc095df52016-08-24 12:23:52 -0700981 test_lib("flags") {
982 public_include_dirs = [ "tools/flags" ]
983 sources = [
984 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700985 ]
986 }
987 test_lib("common_flags") {
988 public_include_dirs = [ "tools/flags" ]
989 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700990 "tools/flags/SkCommonFlags.cpp",
991 "tools/flags/SkCommonFlagsConfig.cpp",
992 ]
993 deps = [
mtklein046cb562016-09-16 10:23:12 -0700994 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700995 ":gpu_tool_utils",
996 ]
997 }
mtklein25c81d42016-07-27 13:55:26 -0700998
mtkleinc095df52016-08-24 12:23:52 -0700999 test_lib("tool_utils") {
1000 public_include_dirs = [
1001 "tools",
1002 "tools/debugger",
1003 "tools/timer",
1004 ]
1005 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001006 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001007 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001008 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001009 "tools/ProcStats.cpp",
1010 "tools/Resources.cpp",
1011 "tools/ThermalManager.cpp",
1012 "tools/UrlDataManager.cpp",
1013 "tools/debugger/SkDebugCanvas.cpp",
1014 "tools/debugger/SkDrawCommand.cpp",
1015 "tools/debugger/SkJsonWriteBuffer.cpp",
1016 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001017 "tools/picture_utils.cpp",
1018 "tools/random_parse_path.cpp",
1019 "tools/sk_tool_utils.cpp",
1020 "tools/sk_tool_utils_font.cpp",
1021 "tools/timer/Timer.cpp",
1022 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001023 libs = []
1024 if (is_ios) {
1025 sources += [ "tools/ios_utils.m" ]
1026 libs += [ "Foundation.framework" ]
1027 }
mtkleinc095df52016-08-24 12:23:52 -07001028 deps = [
mtklein046cb562016-09-16 10:23:12 -07001029 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001030 ":flags",
1031 "//third_party/libpng",
1032 ]
1033 public_deps = [
1034 "//third_party/jsoncpp",
1035 ]
1036 }
mtklein25c81d42016-07-27 13:55:26 -07001037
Mike Klein6e744122016-10-27 12:21:40 -04001038 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001039 test_lib("gm") {
1040 public_include_dirs = [ "gm" ]
1041 sources = gm_sources
1042 deps = [
scroggo19b91532016-10-24 09:03:26 -07001043 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001044 ":gpu_tool_utils",
1045 ":skia",
1046 ":tool_utils",
1047 ]
1048 }
mtklein25c81d42016-07-27 13:55:26 -07001049
Mike Klein6e744122016-10-27 12:21:40 -04001050 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001051 test_lib("tests") {
1052 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001053 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001054 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001055 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001056 }
mtkleinc095df52016-08-24 12:23:52 -07001057 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001058 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001059 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001060 ":skia",
1061 ":tool_utils",
1062 "//third_party/libpng",
1063 "//third_party/zlib",
1064 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001065 public_deps = [
1066 ":gpu_tool_utils", # Test.h #includes headers from this target.
1067 ]
mtkleinc095df52016-08-24 12:23:52 -07001068 }
mtklein2f3416d2016-08-02 16:02:05 -07001069
Mike Klein6e744122016-10-27 12:21:40 -04001070 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001071 test_lib("bench") {
1072 public_include_dirs = [ "bench" ]
1073 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001074 deps = [
1075 ":flags",
1076 ":gm",
1077 ":gpu_tool_utils",
1078 ":skia",
1079 ":tool_utils",
1080 ]
1081 }
mtklein2b6870c2016-07-28 14:17:33 -07001082
mtkleinc095df52016-08-24 12:23:52 -07001083 test_lib("experimental_svg_model") {
1084 public_include_dirs = [ "experimental/svg/model" ]
1085 sources = [
1086 "experimental/svg/model/SkSVGAttribute.cpp",
1087 "experimental/svg/model/SkSVGAttributeParser.cpp",
1088 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001089 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001090 "experimental/svg/model/SkSVGContainer.cpp",
1091 "experimental/svg/model/SkSVGDOM.cpp",
1092 "experimental/svg/model/SkSVGEllipse.cpp",
1093 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001094 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001095 "experimental/svg/model/SkSVGNode.cpp",
1096 "experimental/svg/model/SkSVGPath.cpp",
1097 "experimental/svg/model/SkSVGPoly.cpp",
1098 "experimental/svg/model/SkSVGRect.cpp",
1099 "experimental/svg/model/SkSVGRenderContext.cpp",
1100 "experimental/svg/model/SkSVGSVG.cpp",
1101 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001102 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001103 "experimental/svg/model/SkSVGTransformableNode.cpp",
1104 "experimental/svg/model/SkSVGValue.cpp",
1105 ]
1106 deps = [
1107 ":skia",
1108 ]
1109 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001110
Brian Osman16adfa32016-10-18 14:42:44 -04001111 test_lib("views") {
1112 public_include_dirs = [ "include/views" ]
1113 sources = [
1114 "src/views/SkEvent.cpp",
1115 "src/views/SkEventSink.cpp",
1116 "src/views/SkOSMenu.cpp",
1117 "src/views/SkTagList.cpp",
1118 "src/views/SkTouchGesture.cpp",
1119 "src/views/SkView.cpp",
1120 "src/views/SkViewPriv.cpp",
1121 ]
1122 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001123 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001124 if (!is_android) {
1125 sources += [ "src/views/SkWindow.cpp" ]
1126 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001127 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001128 public_include_dirs += [ "src/views/unix" ]
1129 sources += [
1130 "src/views/unix/SkOSWindow_Unix.cpp",
1131 "src/views/unix/keysym2ucs.c",
1132 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001133 libs += [
1134 "GL",
1135 "X11",
1136 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001137 } else if (is_mac) {
1138 sources += [
1139 "src/views/mac/SkEventNotifier.mm",
1140 "src/views/mac/SkNSView.mm",
1141 "src/views/mac/SkOSWindow_Mac.mm",
1142 "src/views/mac/SkTextFieldCell.m",
1143 ]
1144 libs += [
1145 "QuartzCore.framework",
1146 "Cocoa.framework",
1147 "Foundation.framework",
1148 ]
1149 } else if (is_win) {
1150 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1151 }
Brian Osman34755e22016-12-05 09:46:02 -05001152 if (skia_use_angle) {
1153 deps += [ "//third_party/angle2" ]
1154 }
Brian Osman16adfa32016-10-18 14:42:44 -04001155 }
1156
Mike Klein38af9432016-11-11 11:39:44 -05001157 if (skia_use_lua) {
1158 test_lib("lua") {
1159 public_include_dirs = []
1160 sources = [
1161 "src/utils/SkLua.cpp",
1162 "src/utils/SkLuaCanvas.cpp",
1163 ]
1164 deps = [
1165 "//third_party/lua",
1166 ]
1167 }
1168
Mike Kleine6682eb2017-01-05 10:54:57 -05001169 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001170 sources = [
1171 "tools/lua/lua_app.cpp",
1172 ]
1173 deps = [
1174 ":lua",
1175 ":skia",
1176 "//third_party/lua",
1177 ]
Mike Klein38af9432016-11-11 11:39:44 -05001178 }
1179
Mike Kleine6682eb2017-01-05 10:54:57 -05001180 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001181 sources = [
1182 "tools/lua/lua_pictures.cpp",
1183 ]
1184 deps = [
1185 ":flags",
1186 ":lua",
1187 ":skia",
1188 ":tool_utils",
1189 "//third_party/lua",
1190 ]
Mike Klein38af9432016-11-11 11:39:44 -05001191 }
1192 }
1193
Mike Klein6e744122016-10-27 12:21:40 -04001194 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001195 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001196 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001197 include_dirs = [ "experimental" ]
1198 sources = samples_sources + [
Mike Klein6e744122016-10-27 12:21:40 -04001199 "experimental/SkSetPoly3To3.cpp",
1200 "experimental/SkSetPoly3To3_A.cpp",
1201 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001202
1203 # Relocating these files here, so that clients don't try to build them while they're
1204 # still in active development. Clang's thread safety analysis gets tripped up by
1205 # conditional locks.
1206 "src/core/SkThreadedBMPDevice.cpp",
1207 "src/core/SkThreadedBMPDevice.h",
Mike Klein6e744122016-10-27 12:21:40 -04001208 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001209 deps = [
1210 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001211 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001212 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001213 ":tool_utils",
1214 ":views",
1215 ":xml",
1216 ]
Mike Klein38af9432016-11-11 11:39:44 -05001217
1218 if (skia_use_lua) {
1219 sources += [ "samplecode/SampleLua.cpp" ]
1220 deps += [
1221 ":lua",
1222 "//third_party/lua",
1223 ]
1224 }
Brian Osman16adfa32016-10-18 14:42:44 -04001225 }
1226
Mike Kleine6682eb2017-01-05 10:54:57 -05001227 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001228 sources = [
1229 "dm/DM.cpp",
1230 "dm/DMJsonWriter.cpp",
1231 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001232 ]
1233 include_dirs = [ "tests" ]
1234 deps = [
mtklein046cb562016-09-16 10:23:12 -07001235 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001236 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001237 ":flags",
1238 ":gm",
1239 ":gpu_tool_utils",
1240 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001241 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001242 ":tool_utils",
1243 "//third_party/jsoncpp",
1244 "//third_party/libpng",
1245 ]
mtklein2b6870c2016-07-28 14:17:33 -07001246 }
1247
Mike Klein06432b22017-03-21 13:14:33 -04001248 test_app("ok") {
1249 sources = [
1250 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001251 "tools/ok_dsts.cpp",
1252 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001253 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001254 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001255 ]
1256 deps = [
1257 ":gm",
1258 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001259 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001260 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001261 ]
1262 }
1263
Mike Kleina3430172016-09-27 16:46:29 -04001264 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001265 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001266 sources = [
1267 "tools/monobench.cpp",
1268 ]
1269 deps = [
1270 ":bench",
1271 ":skia",
1272 ]
Mike Kleina3430172016-09-27 16:46:29 -04001273 }
mtklein2b6870c2016-07-28 14:17:33 -07001274 }
1275
Mike Kleine6682eb2017-01-05 10:54:57 -05001276 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001277 sources = [
1278 "bench/nanobench.cpp",
1279 ]
1280 deps = [
1281 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001282 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001283 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001284 ":flags",
1285 ":gm",
1286 ":gpu_tool_utils",
1287 ":skia",
1288 ":tool_utils",
1289 "//third_party/jsoncpp",
1290 ]
mtklein2b6870c2016-07-28 14:17:33 -07001291 }
halcanary19a97202016-08-03 15:08:04 -07001292
Ravi Mistry10d36c52017-01-31 09:49:18 -05001293 test_app("skpinfo") {
1294 sources = [
1295 "tools/skpinfo.cpp",
1296 ]
1297 deps = [
1298 ":flags",
1299 ":skia",
1300 ]
1301 }
1302
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001303 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001304 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001305 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001306 "samplecode/SampleApp.cpp",
1307 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001308 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001309 if (is_mac) {
1310 sources += [ "src/views/mac/skia_mac.mm" ]
1311 } else if (is_win) {
1312 sources += [ "src/views/win/skia_win.cpp" ]
1313 } else if (is_linux) {
1314 sources += [ "src/views/unix/skia_unix.cpp" ]
1315 }
mtklein38925aa2016-09-21 10:11:25 -07001316 deps = [
1317 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001318 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001319 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001320 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001321 ":skia",
1322 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001323 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001324 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001325 if (skia_use_angle) {
1326 deps += [ "//third_party/angle2" ]
1327 }
mtklein38925aa2016-09-21 10:11:25 -07001328 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001329 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001330
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001331 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001332 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001333 sources = [
1334 "tools/skpbench/skpbench.cpp",
1335 ]
1336 deps = [
1337 ":flags",
1338 ":gpu_tool_utils",
1339 ":skia",
1340 ":tool_utils",
1341 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001342 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001343 }
1344
Mike Klein7d302882016-11-03 14:06:31 -04001345 # We can't yet build ICU on iOS or Windows.
1346 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001347 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001348 sources = [
1349 "tools/SkShaper_harfbuzz.cpp",
1350 "tools/using_skia_and_harfbuzz.cpp",
1351 ]
1352 deps = [
1353 ":skia",
1354 "//third_party/harfbuzz",
1355 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001356 }
halcanary19a97202016-08-03 15:08:04 -07001357 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001358 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001359 sources = [
1360 "tools/SkShaper_primitive.cpp",
1361 "tools/using_skia_and_harfbuzz.cpp",
1362 ]
1363 deps = [
1364 ":skia",
1365 ]
halcanary3eee9d92016-09-10 07:01:53 -07001366 }
mtklein046cb562016-09-16 10:23:12 -07001367
Matt Sarett9f1c4032017-05-17 10:06:32 -04001368 test_app("create_flutter_test_images") {
1369 sources = [
1370 "tools/create_flutter_test_images.cpp",
1371 ]
1372 deps = [
1373 ":skia",
1374 ":tool_utils",
1375 ]
1376 }
1377
Mike Kleine6682eb2017-01-05 10:54:57 -05001378 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001379 sources = [
1380 "tools/get_images_from_skps.cpp",
1381 ]
1382 deps = [
1383 ":flags",
1384 ":skia",
1385 "//third_party/jsoncpp",
1386 ]
mtklein046cb562016-09-16 10:23:12 -07001387 }
mtkleinecbc5262016-09-22 11:51:24 -07001388
Mike Kleine6682eb2017-01-05 10:54:57 -05001389 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001390 sources = [
1391 "tools/colorspaceinfo.cpp",
1392 ]
1393 deps = [
1394 ":flags",
1395 ":skia",
1396 ":tool_utils",
1397 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001398 }
1399
Mike Klein7d302882016-11-03 14:06:31 -04001400 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001401 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001402 sources = [
1403 "tools/skiaserve/Request.cpp",
1404 "tools/skiaserve/Response.cpp",
1405 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001406 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1407 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1408 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1409 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1410 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1411 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1412 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1413 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1414 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001415 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1416 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001417 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1418 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1419 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1420 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1421 ]
1422 deps = [
1423 ":flags",
1424 ":gpu_tool_utils",
1425 ":skia",
1426 ":tool_utils",
1427 "//third_party/jsoncpp",
1428 "//third_party/libmicrohttpd",
1429 "//third_party/libpng",
1430 ]
Mike Klein7d302882016-11-03 14:06:31 -04001431 }
mtkleinecbc5262016-09-22 11:51:24 -07001432 }
kjlubick14f984b2016-10-03 11:49:45 -07001433
Mike Kleine6682eb2017-01-05 10:54:57 -05001434 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001435 sources = [
1436 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001437 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001438 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001439 "fuzz/FuzzGradients.cpp",
1440 "fuzz/FuzzParsePath.cpp",
1441 "fuzz/FuzzPathop.cpp",
1442 "fuzz/FuzzScaleToSides.cpp",
1443 "fuzz/fuzz.cpp",
1444 ]
1445 deps = [
1446 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001447 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001448 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001449 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001450 ]
kjlubick14f984b2016-10-03 11:49:45 -07001451 }
Mike Klein38312422016-10-05 15:41:01 -04001452
Mike Kleine6682eb2017-01-05 10:54:57 -05001453 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001454 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001455 rebase_path("tests/skia_test.cpp"),
1456 rebase_path("tests/Test.cpp"),
1457 ]
caryclark9feb6322016-10-25 08:58:26 -07001458 deps = [
1459 ":flags",
1460 ":gpu_tool_utils",
1461 ":skia",
1462 ":tool_utils",
1463 ]
caryclark9feb6322016-10-25 08:58:26 -07001464 }
1465
Mike Kleine6682eb2017-01-05 10:54:57 -05001466 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001467 sources = [
1468 "tools/DumpRecord.cpp",
1469 "tools/dump_record.cpp",
1470 ]
1471 deps = [
1472 ":flags",
1473 ":skia",
1474 ]
Mike Klein38312422016-10-05 15:41:01 -04001475 }
bungemanfe917272016-10-13 17:36:40 -04001476
Mike Kleine6682eb2017-01-05 10:54:57 -05001477 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001478 sources = [
1479 "tools/skdiff/skdiff.cpp",
1480 "tools/skdiff/skdiff_html.cpp",
1481 "tools/skdiff/skdiff_main.cpp",
1482 "tools/skdiff/skdiff_utils.cpp",
1483 ]
1484 deps = [
1485 ":skia",
1486 ":tool_utils",
1487 ]
bungemanfe917272016-10-13 17:36:40 -04001488 }
halcanarya73d76a2016-10-17 13:19:02 -07001489
Mike Kleine6682eb2017-01-05 10:54:57 -05001490 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001491 sources = [
1492 "tools/skp_parser.cpp",
1493 ]
1494 deps = [
1495 ":skia",
1496 ":tool_utils",
1497 "//third_party/jsoncpp",
1498 ]
halcanarya73d76a2016-10-17 13:19:02 -07001499 }
Brian Osman16adfa32016-10-18 14:42:44 -04001500
Mike Kleina92c3832016-12-08 09:49:39 -05001501 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001502 test_app("viewer") {
1503 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001504 sources = [
1505 "tools/viewer/GMSlide.cpp",
1506 "tools/viewer/ImageSlide.cpp",
1507 "tools/viewer/SKPSlide.cpp",
1508 "tools/viewer/SampleSlide.cpp",
1509 "tools/viewer/Viewer.cpp",
1510 "tools/viewer/sk_app/CommandSet.cpp",
1511 "tools/viewer/sk_app/GLWindowContext.cpp",
1512 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001513 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001514 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001515
Jim Van Verth4e56a912016-10-21 10:58:52 -04001516 if (is_android) {
1517 sources += [
1518 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1519 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1520 "tools/viewer/sk_app/android/Window_android.cpp",
1521 "tools/viewer/sk_app/android/main_android.cpp",
1522 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1523 ]
Brian Osman462334e2017-02-09 11:22:57 -05001524 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001525 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001526 sources += [
1527 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1528 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1529 "tools/viewer/sk_app/unix/Window_unix.cpp",
1530 "tools/viewer/sk_app/unix/main_unix.cpp",
1531 ]
1532 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001533 sources += [
1534 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1535 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1536 "tools/viewer/sk_app/win/Window_win.cpp",
1537 "tools/viewer/sk_app/win/main_win.cpp",
1538 ]
Mike Klein43c25262016-10-20 10:17:47 -04001539 } else if (is_mac) {
1540 sources += [
1541 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1542 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1543 "tools/viewer/sk_app/mac/Window_mac.cpp",
1544 "tools/viewer/sk_app/mac/main_mac.cpp",
1545 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001546 }
1547
1548 if (skia_use_vulkan) {
1549 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001550 if (is_android) {
1551 sources +=
1552 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001553 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001554 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1555 libs += [ "X11-xcb" ]
1556 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001557 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1558 }
1559 }
1560
1561 include_dirs = []
1562 deps = [
1563 ":flags",
1564 ":gm",
1565 ":gpu_tool_utils",
1566 ":samples",
1567 ":skia",
1568 ":tool_utils",
1569 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001570 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001571 "//third_party/jsoncpp",
1572 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001573 if (is_android) {
1574 deps += [ "//third_party/native_app_glue" ]
1575 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001576 deps += [ "//third_party/libsdl" ]
1577 }
Mike Kleina92c3832016-12-08 09:49:39 -05001578 }
Brian Osman16adfa32016-10-18 14:42:44 -04001579 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001580
Mike Kleine459afd2017-03-03 09:21:30 -05001581 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001582 copy("gdbserver") {
1583 sources = [
1584 "$ndk/$ndk_gdbserver",
1585 ]
1586 outputs = [
1587 "$root_out_dir/gdbserver",
1588 ]
1589 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001590 }
mtklein25c81d42016-07-27 13:55:26 -07001591}