blob: 790dd21a235afefffe13579dba9f859ae5e4c69c [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
mtklein3e8012e2016-09-21 09:14:19 -07009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12
mtkleinc04ff472016-06-23 10:29:30 -070013declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000014 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070015 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070016 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070017 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040018 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040019 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070020 skia_use_libjpeg_turbo = true
21 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070022 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050023 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070024 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040025 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070026 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070027
28 skia_enable_android_framework_defines = false
mtklein06c35c02016-09-20 12:28:12 -070029 skia_enable_gpu = true
mtklein3e8012e2016-09-21 09:14:19 -070030 skia_enable_tools = is_skia_standalone
31 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040032 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070033}
Brian Salomon23d73ea2016-10-27 13:31:37 -040034declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080035 skia_use_dng_sdk =
36 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040037 skia_use_sfntly = skia_use_icu
38
Mike Klein4d598a32016-10-31 13:44:49 -040039 if (is_android) {
40 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
41 } else {
42 skia_use_vulkan = skia_vulkan_sdk != ""
43 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040044}
Brian Salomon789e25e2016-09-30 13:41:03 -040045
mtklein38925aa2016-09-21 10:11:25 -070046# Our tools require static linking (they use non-exported symbols).
47skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070048
mtkleina45be612016-08-29 15:22:10 -070049fontmgr_android_enabled = skia_use_expat && skia_use_freetype
50
mtklein1211e0c2016-07-26 13:55:45 -070051skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070052 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070053 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070054 "include/codec",
55 "include/config",
56 "include/core",
57 "include/effects",
58 "include/gpu",
59 "include/gpu/gl",
60 "include/images",
61 "include/pathops",
62 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070063 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070064 "include/utils",
65 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070066 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070067]
68
mtkleinc04ff472016-06-23 10:29:30 -070069# Skia public API, generally provided by :skia.
70config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070071 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040072 defines = []
73 if (is_component_build) {
74 defines += [ "SKIA_DLL" ]
75 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040076 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070077 defines += [ "SK_SAMPLES_FOR_X" ]
78 }
mtkleincae1be52016-09-20 08:24:34 -070079 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040080 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070081 }
mtklein06c35c02016-09-20 12:28:12 -070082 if (!skia_enable_gpu) {
83 defines += [ "SK_SUPPORT_GPU=0" ]
84 }
mtkleinc04ff472016-06-23 10:29:30 -070085}
86
87# Skia internal APIs, used by Skia itself and a few test tools.
88config("skia_private") {
89 visibility = [ ":*" ]
90
91 include_dirs = [
92 "include/private",
93 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070094 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070095 "src/config",
96 "src/core",
97 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070098 "src/effects/gradients",
99 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700100 "src/gpu",
101 "src/image",
102 "src/images",
103 "src/lazy",
104 "src/opts",
105 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700106 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700107 "src/ports",
108 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700109 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700111 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700112 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700113 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700114 "third_party/ktx",
115 ]
mtklein150d1132016-08-01 06:56:40 -0700116
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400117 defines = [
118 "SK_GAMMA_APPLY_TO_A8",
119 "SK_INTERNAL",
120 ]
mtkleinb37c0342016-09-09 11:07:45 -0700121 if (is_android) {
122 defines += [
123 "SK_GAMMA_EXPONENT=1.4",
124 "SK_GAMMA_CONTRAST=0.0",
125 ]
126 }
mtklein88a7ac02016-09-14 11:16:49 -0700127 if (is_official_build || is_android) {
128 # TODO(bsalomon): it'd be nice to make Android normal.
129 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
130 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400131 libs = []
132 lib_dirs = []
133 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400134 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400135 if (is_win) {
136 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
137 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
138 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400139 include_dirs += [ "$skia_vulkan_sdk/include/" ]
140 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400141 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400142 }
Mike Klein487bfc22016-10-14 14:04:56 -0400143 if (is_win) {
144 libs += [ "vulkan-1.lib" ]
145 } else {
146 libs += [ "vulkan" ]
147 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400148 }
Brian Osman34755e22016-12-05 09:46:02 -0500149 if (skia_use_angle) {
150 defines += [ "SK_ANGLE" ]
151 }
mtkleinc04ff472016-06-23 10:29:30 -0700152}
153
154# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
155config("skia_library") {
156 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700157 defines = [ "SKIA_IMPLEMENTATION=1" ]
158}
159
160skia_library_configs = [
161 ":skia_public",
162 ":skia_private",
163 ":skia_library",
164]
165
mtklein9b8583d2016-08-24 17:32:30 -0700166# Use for CPU-specific Skia code that needs particular compiler flags.
167template("opts") {
168 if (invoker.enabled) {
169 source_set(target_name) {
170 forward_variables_from(invoker, "*")
171 configs += skia_library_configs
172 }
173 } else {
174 # If not enabled, a phony empty target that swallows all otherwise unused variables.
175 source_set(target_name) {
176 forward_variables_from(invoker,
177 "*",
178 [
179 "sources",
180 "cflags",
181 ])
182 }
183 }
anmittala7eaf2e2016-08-17 13:57:26 -0700184}
185
mtklein422310d2016-08-16 18:28:43 -0700186is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700187
mtklein7d6fb2c2016-08-25 14:50:44 -0700188opts("none") {
189 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700190 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700191 cflags = []
192}
193
mtklein7d6fb2c2016-08-25 14:50:44 -0700194opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700195 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700196 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700197 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700198}
199
200opts("arm64") {
201 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700202 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700203 cflags = []
204}
205
206opts("crc32") {
207 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700208 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700209 cflags = [ "-march=armv8-a+crc" ]
210}
211
mtklein9b8583d2016-08-24 17:32:30 -0700212opts("sse2") {
213 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400215 if (is_win) {
216 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
217 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400218 cflags = [ "-msse2" ]
219 }
mtklein9b8583d2016-08-24 17:32:30 -0700220}
mtkleinc04ff472016-06-23 10:29:30 -0700221
mtklein9b8583d2016-08-24 17:32:30 -0700222opts("ssse3") {
223 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700224 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400225 if (is_win) {
226 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
227 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400228 cflags = [ "-mssse3" ]
229 }
mtklein9b8583d2016-08-24 17:32:30 -0700230}
mtkleinc04ff472016-06-23 10:29:30 -0700231
mtklein9b8583d2016-08-24 17:32:30 -0700232opts("sse41") {
233 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700234 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400235 if (is_win) {
236 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
237 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400238 cflags = [ "-msse4.1" ]
239 }
mtklein9b8583d2016-08-24 17:32:30 -0700240}
mtklein4e976072016-08-08 09:06:27 -0700241
mtklein9b8583d2016-08-24 17:32:30 -0700242opts("sse42") {
243 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400245 if (is_win) {
246 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
247 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400248 cflags = [ "-msse4.2" ]
249 }
mtklein9b8583d2016-08-24 17:32:30 -0700250}
251
252opts("avx") {
253 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700254 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400255 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000256 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400257 } else {
258 cflags = [ "-mavx" ]
259 }
mtkleinc04ff472016-06-23 10:29:30 -0700260}
261
Mike Klein78d5a3b2016-09-30 10:48:01 -0400262opts("hsw") {
263 enabled = is_x86
264 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400265 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000266 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400267 } else {
268 cflags = [
269 "-mavx2",
270 "-mbmi",
271 "-mbmi2",
272 "-mf16c",
273 "-mfma",
274 ]
275 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400276}
277
mtklein349cece2016-08-26 08:13:04 -0700278opts("dsp") {
279 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700280 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700281 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700282}
283
mtkleinc095df52016-08-24 12:23:52 -0700284# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700285template("optional") {
286 if (invoker.enabled) {
287 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700288 if (defined(invoker.public_defines)) {
289 defines = invoker.public_defines
290 }
mtklein457b42a2016-08-23 13:56:37 -0700291 }
292 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700293 forward_variables_from(invoker,
294 "*",
295 [
296 "public_defines",
297 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700298 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700299 ])
mtklein457b42a2016-08-23 13:56:37 -0700300 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700301 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700302 if (defined(invoker.configs_to_remove)) {
303 configs -= invoker.configs_to_remove
304 }
mtklein457b42a2016-08-23 13:56:37 -0700305 }
306 } else {
mtklein457b42a2016-08-23 13:56:37 -0700307 source_set(target_name) {
308 forward_variables_from(invoker,
309 "*",
310 [
311 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700312 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700313 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700314 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700315 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700316 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700317 ])
mtkleincd01b032016-08-31 04:58:19 -0700318 if (defined(invoker.sources_when_disabled)) {
319 sources = invoker.sources_when_disabled
320 }
321 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700322 }
mtkleineb3c4252016-08-23 07:38:09 -0700323 }
mtklein457b42a2016-08-23 13:56:37 -0700324}
mtklein457b42a2016-08-23 13:56:37 -0700325
mtkleina45be612016-08-29 15:22:10 -0700326optional("fontmgr_android") {
327 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700328
329 deps = [
330 "//third_party/expat",
331 "//third_party/freetype2",
332 ]
333 sources = [
334 "src/ports/SkFontMgr_android.cpp",
335 "src/ports/SkFontMgr_android_factory.cpp",
336 "src/ports/SkFontMgr_android_parser.cpp",
337 ]
338}
339
mtkleind2e39db2016-09-07 07:52:55 -0700340optional("fontmgr_custom") {
341 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
342
343 deps = [
344 "//third_party/freetype2",
345 ]
346 sources = [
347 "src/ports/SkFontMgr_custom.cpp",
348 "src/ports/SkFontMgr_custom_directory_factory.cpp",
349 ]
350}
351
mtklein3cc22182016-08-29 13:26:14 -0700352optional("fontmgr_fontconfig") {
353 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700354
355 deps = [
356 "//third_party:fontconfig",
357 "//third_party/freetype2",
358 ]
359 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700360 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700361 "src/ports/SkFontConfigInterface_direct.cpp",
362 "src/ports/SkFontConfigInterface_direct_factory.cpp",
363 "src/ports/SkFontMgr_FontConfigInterface.cpp",
364 "src/ports/SkFontMgr_fontconfig.cpp",
365 "src/ports/SkFontMgr_fontconfig_factory.cpp",
366 ]
367}
368
mtkleincdedd0e2016-09-12 15:15:44 -0700369optional("fontmgr_fuchsia") {
370 enabled = is_fuchsia && skia_use_freetype
371
372 deps = [
373 "//third_party/freetype2",
374 ]
375 sources = [
376 "src/ports/SkFontMgr_custom.cpp",
377 "src/ports/SkFontMgr_custom_empty_factory.cpp",
378 ]
379}
380
mtklein06c35c02016-09-20 12:28:12 -0700381optional("gpu") {
382 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700383 public_defines = []
384
mtklein06c35c02016-09-20 12:28:12 -0700385 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
386
387 # These paths need to be absolute to match the ones produced by shared_sources.gni.
388 sources -= get_path_info([
389 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
390 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
391 ],
392 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400393 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700394 if (is_android) {
395 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
396 } else if (is_linux) {
397 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
398 } else if (is_mac) {
399 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800400 } else if (is_ios) {
401 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400402 } else if (is_win) {
403 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
404 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700405 } else {
406 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
407 }
mtkleine9fb3d52016-09-20 15:11:46 -0700408
409 if (skia_use_vulkan) {
410 public_defines += [ "SK_VULKAN" ]
411 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700412 if (skia_enable_vulkan_debug_layers) {
413 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
414 }
mtkleine9fb3d52016-09-20 15:11:46 -0700415 }
mtklein06c35c02016-09-20 12:28:12 -0700416}
417
mtklein63213812016-08-24 09:55:56 -0700418optional("jpeg") {
419 enabled = skia_use_libjpeg_turbo
420 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
421
mtklein63213812016-08-24 09:55:56 -0700422 deps = [
423 "//third_party/libjpeg-turbo:libjpeg",
424 ]
425 sources = [
426 "src/codec/SkJpegCodec.cpp",
427 "src/codec/SkJpegDecoderMgr.cpp",
428 "src/codec/SkJpegUtility.cpp",
429 "src/images/SkJPEGImageEncoder.cpp",
430 "src/images/SkJPEGWriteUtility.cpp",
431 ]
432}
433
434optional("pdf") {
435 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700436
mtklein63213812016-08-24 09:55:56 -0700437 deps = [
438 "//third_party/zlib",
439 ]
brettwb9447282016-09-01 14:24:39 -0700440 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700441 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700442
443 if (skia_use_sfntly) {
444 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700445 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700446 }
447}
448
449optional("png") {
450 enabled = skia_use_libpng
451 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
452
mtklein63213812016-08-24 09:55:56 -0700453 deps = [
454 "//third_party/libpng",
455 ]
456 sources = [
457 "src/codec/SkIcoCodec.cpp",
458 "src/codec/SkPngCodec.cpp",
459 "src/images/SkPNGImageEncoder.cpp",
460 ]
461}
462
scroggof84ad642016-10-31 09:02:57 -0700463optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400464 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700465 public_defines = [ "SK_CODEC_DECODES_RAW" ]
466
467 deps = [
468 "//third_party/dng_sdk",
469 "//third_party/libjpeg-turbo:libjpeg",
470 "//third_party/piex",
471 ]
472
473 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
474 # Skia.
475 configs_to_remove = [ "//gn:no_exceptions" ]
476
477 sources = [
478 "src/codec/SkRawAdapterCodec.cpp",
479 "src/codec/SkRawCodec.cpp",
480 ]
481}
482
mtklein3cc22182016-08-29 13:26:14 -0700483optional("typeface_freetype") {
484 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700485
486 deps = [
487 "//third_party/freetype2",
488 ]
489 sources = [
490 "src/ports/SkFontHost_FreeType.cpp",
491 "src/ports/SkFontHost_FreeType_common.cpp",
492 ]
493}
494
mtklein457b42a2016-08-23 13:56:37 -0700495optional("webp") {
496 enabled = skia_use_libwebp
497 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
498
mtklein457b42a2016-08-23 13:56:37 -0700499 deps = [
500 "//third_party/libwebp",
501 ]
502 sources = [
503 "src/codec/SkWebpAdapterCodec.cpp",
504 "src/codec/SkWebpCodec.cpp",
505 "src/images/SkWEBPImageEncoder.cpp",
506 ]
mtkleineb3c4252016-08-23 07:38:09 -0700507}
508
mtklein63213812016-08-24 09:55:56 -0700509optional("xml") {
510 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000511 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700512
mtklein63213812016-08-24 09:55:56 -0700513 deps = [
514 "//third_party/expat",
515 ]
516 sources = [
517 "src/xml/SkDOM.cpp",
518 "src/xml/SkXMLParser.cpp",
519 "src/xml/SkXMLWriter.cpp",
520 ]
521}
522
mtkleinc04ff472016-06-23 10:29:30 -0700523component("skia") {
524 public_configs = [ ":skia_public" ]
525 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700526
527 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700528 ":arm64",
529 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700530 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700531 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700532 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700533 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700534 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700535 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700536 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700537 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400538 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700539 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700540 ":none",
mtklein63213812016-08-24 09:55:56 -0700541 ":pdf",
542 ":png",
scroggof84ad642016-10-31 09:02:57 -0700543 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700544 ":sse2",
545 ":sse41",
546 ":sse42",
547 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700548 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700549 ":webp",
mtklein63213812016-08-24 09:55:56 -0700550 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700551 ]
552
Chinmay Garde43f115c2016-11-16 15:04:12 -0800553 # This file (and all GN files in Skia) are designed to work with an
554 # empty sources assignment filter; we handle all that explicitly.
555 # We clear the filter here for clients who may have set up a global filter.
556 set_sources_assignment_filter([])
557
mtkleinc04ff472016-06-23 10:29:30 -0700558 sources = []
brettwb9447282016-09-01 14:24:39 -0700559 sources += skia_core_sources
560 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700561 sources += skia_sksl_sources
562 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700563 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700564 "src/android/SkBitmapRegionCodec.cpp",
565 "src/android/SkBitmapRegionDecoder.cpp",
566 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700567 "src/codec/SkBmpCodec.cpp",
568 "src/codec/SkBmpMaskCodec.cpp",
569 "src/codec/SkBmpRLECodec.cpp",
570 "src/codec/SkBmpStandardCodec.cpp",
571 "src/codec/SkCodec.cpp",
572 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700573 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700574 "src/codec/SkMaskSwizzler.cpp",
575 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700576 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700577 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700578 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700579 "src/codec/SkSwizzler.cpp",
580 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700581 "src/images/SkImageEncoder.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700582 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700583 "src/ports/SkDiscardableMemory_none.cpp",
584 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700585 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700586 "src/ports/SkMemory_malloc.cpp",
587 "src/ports/SkOSFile_stdio.cpp",
588 "src/sfnt/SkOTTable_name.cpp",
589 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700590 "src/svg/SkSVGCanvas.cpp",
591 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700592 "src/utils/mac/SkStream_mac.cpp",
593 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700594 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700595 "third_party/ktx/ktx.cpp",
596 ]
brettwb9447282016-09-01 14:24:39 -0700597
mtklein7d6fb2c2016-08-25 14:50:44 -0700598 libs = []
599
mtkleinc04ff472016-06-23 10:29:30 -0700600 if (is_win) {
601 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400602 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700603 "src/ports/SkDebug_win.cpp",
604 "src/ports/SkFontHost_win.cpp",
605 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700606 "src/ports/SkImageEncoder_WIC.cpp",
607 "src/ports/SkImageGeneratorWIC.cpp",
608 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700609 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700610 "src/ports/SkScalerContext_win_dw.cpp",
611 "src/ports/SkTLS_win.cpp",
612 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700613 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400614 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700615 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400616 if (skia_use_gdi) {
617 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
618 libs += [
619 "Gdi32.lib",
620 "Usp10.lib",
621 ]
622 } else {
623 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
624 }
mtkleinb9be9792016-09-16 14:44:18 -0700625 sources -=
626 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400627 libs += [
628 "FontSub.lib",
629 "Ole32.lib",
630 "OleAut32.lib",
631 "User32.lib",
632 ]
mtkleinc04ff472016-06-23 10:29:30 -0700633 } else {
634 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700635 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700636 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700637 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700638 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700639 ]
640 }
641
mtklein7d6fb2c2016-08-25 14:50:44 -0700642 if (is_android) {
643 deps += [
644 "//third_party/cpu-features",
645 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700646 ]
mtklein06c35c02016-09-20 12:28:12 -0700647 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700648 libs += [
649 "EGL",
650 "GLESv2",
651 "log",
652 ]
653 }
654
mtkleinc04ff472016-06-23 10:29:30 -0700655 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700656 libs += [
657 "GL",
658 "GLU",
659 "X11",
660 ]
mtklein06c35c02016-09-20 12:28:12 -0700661 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700662 }
663
664 if (is_mac) {
665 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700666 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700667 "src/ports/SkFontHost_mac.cpp",
668 "src/ports/SkImageEncoder_CG.cpp",
669 "src/ports/SkImageGeneratorCG.cpp",
670 ]
mtklein09e61f72016-08-23 13:35:28 -0700671 libs += [
672 "ApplicationServices.framework",
673 "OpenGL.framework",
674 ]
mtkleinc04ff472016-06-23 10:29:30 -0700675 }
abarth6fc8ff02016-07-15 15:15:15 -0700676
Mike Klein7d302882016-11-03 14:06:31 -0400677 if (is_ios) {
678 sources += [
679 "src/ports/SkDebug_stdio.cpp",
680 "src/ports/SkFontHost_mac.cpp",
681 "src/ports/SkImageEncoder_CG.cpp",
682 "src/ports/SkImageGeneratorCG.cpp",
683 ]
684 libs += [
685 "CoreFoundation.framework",
686 "CoreGraphics.framework",
687 "CoreText.framework",
688 "ImageIO.framework",
689 "MobileCoreServices.framework",
690 ]
691 }
692
abarth6fc8ff02016-07-15 15:15:15 -0700693 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700694 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700695 }
mtkleinc04ff472016-06-23 10:29:30 -0700696}
697
mtkleinc095df52016-08-24 12:23:52 -0700698# Targets guarded by skia_enable_tools may use //third_party freely.
699if (skia_enable_tools) {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500700 config("skia.h_config") {
701 include_dirs = [ "$target_gen_dir" ]
702 }
703 action("skia.h") {
704 public_configs = [ ":skia.h_config" ]
705 skia_h = "$target_gen_dir/skia.h"
706 script = "gn/find_headers.py"
707 args = [ rebase_path(skia_h, root_build_dir) ] +
708 rebase_path(skia_public_includes)
709 depfile = "$skia_h.deps"
710 outputs = [
711 skia_h,
712 ]
713 }
714
715 if (skia_enable_gpu && target_cpu == "x64") {
716 # Our bots only have 64-bit libOSMesa installed.
717 # TODO: worth fixing?
718 executable("fiddle") {
719 libs = []
720 if (is_linux) {
721 libs += [ "OSMesa" ]
722 }
723
724 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500725 "tools/fiddle/draw.cpp",
726 "tools/fiddle/fiddle_main.cpp",
727 ]
728 deps = [
729 ":skia",
730 ":skia.h",
731 ]
732 }
733 }
734
735 if (skia_enable_gpu) {
736 source_set("public_headers_warnings_check") {
737 sources = [
738 "tools/public_headers_warnings_check.cpp",
739 ]
740 configs -= [ "//gn:warnings_except_public_headers" ]
741 deps = [
742 ":skia",
743 ":skia.h",
744 ]
745 }
746 }
747
mtkleinc095df52016-08-24 12:23:52 -0700748 template("test_lib") {
749 config(target_name + "_config") {
750 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700751 if (defined(invoker.public_defines)) {
752 defines = invoker.public_defines
753 }
mtklein25c81d42016-07-27 13:55:26 -0700754 }
mtkleinc095df52016-08-24 12:23:52 -0700755 source_set(target_name) {
756 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
757 public_configs = [
758 ":" + target_name + "_config",
759 ":skia_private",
760 ]
761
762 if (!defined(deps)) {
763 deps = []
764 }
765 deps += [ ":skia" ]
766 testonly = true
767 }
mtklein25c81d42016-07-27 13:55:26 -0700768 }
mtklein25c81d42016-07-27 13:55:26 -0700769
mtkleinc095df52016-08-24 12:23:52 -0700770 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700771 public_include_dirs = []
772 if (skia_enable_gpu) {
773 public_defines = []
774 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700775
776 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700777 sources = [
778 "tools/gpu/GrContextFactory.cpp",
779 "tools/gpu/GrTest.cpp",
780 "tools/gpu/TestContext.cpp",
781 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700782 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700783 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
784 "tools/gpu/gl/debug/GrBufferObj.cpp",
785 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
786 "tools/gpu/gl/debug/GrProgramObj.cpp",
787 "tools/gpu/gl/debug/GrShaderObj.cpp",
788 "tools/gpu/gl/debug/GrTextureObj.cpp",
789 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
790 "tools/gpu/gl/null/NullGLTestContext.cpp",
791 ]
792 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700793
mtklein38925aa2016-09-21 10:11:25 -0700794 if (is_android) {
795 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400796 } else if (is_ios) {
797 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
798 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700799 } else if (is_linux) {
800 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
801 } else if (is_mac) {
802 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400803 } else if (is_win) {
804 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
805 libs += [
806 "Gdi32.lib",
807 "OpenGL32.lib",
808 ]
mtklein38925aa2016-09-21 10:11:25 -0700809 }
mtklein6ef69992016-09-14 06:12:09 -0700810
Mike Kleinc168a3a2016-11-14 14:53:13 +0000811 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000812 deps += [ "//third_party/angle2" ]
813 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
814 }
mtklein38925aa2016-09-21 10:11:25 -0700815 if (skia_use_mesa) {
816 public_defines += [ "SK_MESA" ]
817 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
818 libs += [ "OSMesa" ]
819 }
mtkleind68f9b02016-09-23 13:18:41 -0700820 if (skia_use_vulkan) {
821 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
822 }
mtkleina627b5c2016-09-20 13:36:47 -0700823 }
mtklein25c81d42016-07-27 13:55:26 -0700824 }
mtklein25c81d42016-07-27 13:55:26 -0700825
mtkleinc095df52016-08-24 12:23:52 -0700826 test_lib("flags") {
827 public_include_dirs = [ "tools/flags" ]
828 sources = [
829 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700830 ]
831 }
832 test_lib("common_flags") {
833 public_include_dirs = [ "tools/flags" ]
834 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700835 "tools/flags/SkCommonFlags.cpp",
836 "tools/flags/SkCommonFlagsConfig.cpp",
837 ]
838 deps = [
mtklein046cb562016-09-16 10:23:12 -0700839 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700840 ":gpu_tool_utils",
841 ]
842 }
mtklein25c81d42016-07-27 13:55:26 -0700843
mtkleinc095df52016-08-24 12:23:52 -0700844 test_lib("tool_utils") {
845 public_include_dirs = [
846 "tools",
847 "tools/debugger",
848 "tools/timer",
849 ]
850 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700851 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700852 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700853 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700854 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700855 "tools/ProcStats.cpp",
856 "tools/Resources.cpp",
857 "tools/ThermalManager.cpp",
858 "tools/UrlDataManager.cpp",
859 "tools/debugger/SkDebugCanvas.cpp",
860 "tools/debugger/SkDrawCommand.cpp",
861 "tools/debugger/SkJsonWriteBuffer.cpp",
862 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700863 "tools/picture_utils.cpp",
864 "tools/random_parse_path.cpp",
865 "tools/sk_tool_utils.cpp",
866 "tools/sk_tool_utils_font.cpp",
867 "tools/timer/Timer.cpp",
868 ]
869 deps = [
mtklein046cb562016-09-16 10:23:12 -0700870 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700871 ":flags",
872 "//third_party/libpng",
873 ]
874 public_deps = [
875 "//third_party/jsoncpp",
876 ]
877 }
mtklein25c81d42016-07-27 13:55:26 -0700878
Mike Klein6e744122016-10-27 12:21:40 -0400879 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700880 test_lib("gm") {
881 public_include_dirs = [ "gm" ]
882 sources = gm_sources
883 deps = [
scroggo19b91532016-10-24 09:03:26 -0700884 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700885 ":gpu_tool_utils",
886 ":skia",
887 ":tool_utils",
888 ]
889 }
mtklein25c81d42016-07-27 13:55:26 -0700890
Mike Klein6e744122016-10-27 12:21:40 -0400891 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700892 test_lib("tests") {
893 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400894 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700895 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400896 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700897 }
mtkleinc095df52016-08-24 12:23:52 -0700898 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700899 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700900 ":flags",
901 ":gpu_tool_utils",
902 ":skia",
903 ":tool_utils",
904 "//third_party/libpng",
905 "//third_party/zlib",
906 ]
907 }
mtklein2f3416d2016-08-02 16:02:05 -0700908
Mike Klein6e744122016-10-27 12:21:40 -0400909 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700910 test_lib("bench") {
911 public_include_dirs = [ "bench" ]
912 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700913 deps = [
914 ":flags",
915 ":gm",
916 ":gpu_tool_utils",
917 ":skia",
918 ":tool_utils",
919 ]
920 }
mtklein2b6870c2016-07-28 14:17:33 -0700921
mtkleinc095df52016-08-24 12:23:52 -0700922 test_lib("experimental_svg_model") {
923 public_include_dirs = [ "experimental/svg/model" ]
924 sources = [
925 "experimental/svg/model/SkSVGAttribute.cpp",
926 "experimental/svg/model/SkSVGAttributeParser.cpp",
927 "experimental/svg/model/SkSVGCircle.cpp",
928 "experimental/svg/model/SkSVGContainer.cpp",
929 "experimental/svg/model/SkSVGDOM.cpp",
930 "experimental/svg/model/SkSVGEllipse.cpp",
931 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700932 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700933 "experimental/svg/model/SkSVGNode.cpp",
934 "experimental/svg/model/SkSVGPath.cpp",
935 "experimental/svg/model/SkSVGPoly.cpp",
936 "experimental/svg/model/SkSVGRect.cpp",
937 "experimental/svg/model/SkSVGRenderContext.cpp",
938 "experimental/svg/model/SkSVGSVG.cpp",
939 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700940 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700941 "experimental/svg/model/SkSVGTransformableNode.cpp",
942 "experimental/svg/model/SkSVGValue.cpp",
943 ]
944 deps = [
945 ":skia",
946 ]
947 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700948
Brian Osman16adfa32016-10-18 14:42:44 -0400949 test_lib("views") {
950 public_include_dirs = [ "include/views" ]
951 sources = [
952 "src/views/SkEvent.cpp",
953 "src/views/SkEventSink.cpp",
954 "src/views/SkOSMenu.cpp",
955 "src/views/SkTagList.cpp",
956 "src/views/SkTouchGesture.cpp",
957 "src/views/SkView.cpp",
958 "src/views/SkViewPriv.cpp",
959 ]
960 libs = []
Brian Osman34755e22016-12-05 09:46:02 -0500961 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -0400962 if (!is_android) {
963 sources += [ "src/views/SkWindow.cpp" ]
964 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400965 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400966 public_include_dirs += [ "src/views/unix" ]
967 sources += [
968 "src/views/unix/SkOSWindow_Unix.cpp",
969 "src/views/unix/keysym2ucs.c",
970 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400971 } else if (is_mac) {
972 sources += [
973 "src/views/mac/SkEventNotifier.mm",
974 "src/views/mac/SkNSView.mm",
975 "src/views/mac/SkOSWindow_Mac.mm",
976 "src/views/mac/SkTextFieldCell.m",
977 ]
978 libs += [
979 "QuartzCore.framework",
980 "Cocoa.framework",
981 "Foundation.framework",
982 ]
983 } else if (is_win) {
984 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
985 }
Brian Osman34755e22016-12-05 09:46:02 -0500986 if (skia_use_angle) {
987 deps += [ "//third_party/angle2" ]
988 }
Brian Osman16adfa32016-10-18 14:42:44 -0400989 }
990
Mike Klein38af9432016-11-11 11:39:44 -0500991 if (skia_use_lua) {
992 test_lib("lua") {
993 public_include_dirs = []
994 sources = [
995 "src/utils/SkLua.cpp",
996 "src/utils/SkLuaCanvas.cpp",
997 ]
998 deps = [
999 "//third_party/lua",
1000 ]
1001 }
1002
1003 executable("lua_app") {
1004 sources = [
1005 "tools/lua/lua_app.cpp",
1006 ]
1007 deps = [
1008 ":lua",
1009 ":skia",
1010 "//third_party/lua",
1011 ]
1012 testonly = true
1013 }
1014
1015 executable("lua_pictures") {
1016 sources = [
1017 "tools/lua/lua_pictures.cpp",
1018 ]
1019 deps = [
1020 ":flags",
1021 ":lua",
1022 ":skia",
1023 ":tool_utils",
1024 "//third_party/lua",
1025 ]
1026 testonly = true
1027 }
1028 }
1029
Mike Klein6e744122016-10-27 12:21:40 -04001030 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001031 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001032 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001033 include_dirs = [ "experimental" ]
1034 sources = samples_sources + [
1035 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1036 "experimental/SkSetPoly3To3.cpp",
1037 "experimental/SkSetPoly3To3_A.cpp",
1038 "experimental/SkSetPoly3To3_D.cpp",
1039 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001040 deps = [
1041 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001042 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001043 ":tool_utils",
1044 ":views",
1045 ":xml",
1046 ]
Mike Klein38af9432016-11-11 11:39:44 -05001047
1048 if (skia_use_lua) {
1049 sources += [ "samplecode/SampleLua.cpp" ]
1050 deps += [
1051 ":lua",
1052 "//third_party/lua",
1053 ]
1054 }
Brian Osman16adfa32016-10-18 14:42:44 -04001055 }
1056
mtklein2b6870c2016-07-28 14:17:33 -07001057 executable("dm") {
1058 sources = [
1059 "dm/DM.cpp",
1060 "dm/DMJsonWriter.cpp",
1061 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001062 ]
1063 include_dirs = [ "tests" ]
1064 deps = [
mtklein046cb562016-09-16 10:23:12 -07001065 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001066 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001067 ":flags",
1068 ":gm",
1069 ":gpu_tool_utils",
1070 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001071 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001072 ":tool_utils",
1073 "//third_party/jsoncpp",
1074 "//third_party/libpng",
1075 ]
1076 testonly = true
1077 }
1078
Mike Kleina3430172016-09-27 16:46:29 -04001079 if (!is_debug) { # I've benchmarked debug code once too many times...
1080 executable("monobench") {
1081 sources = [
1082 "tools/monobench.cpp",
1083 ]
1084 deps = [
1085 ":bench",
1086 ":skia",
1087 ]
1088 testonly = true
1089 }
mtklein2b6870c2016-07-28 14:17:33 -07001090 }
1091
1092 executable("nanobench") {
1093 sources = [
1094 "bench/nanobench.cpp",
1095 ]
1096 deps = [
1097 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001098 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001099 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001100 ":flags",
1101 ":gm",
1102 ":gpu_tool_utils",
1103 ":skia",
1104 ":tool_utils",
1105 "//third_party/jsoncpp",
1106 ]
1107 testonly = true
1108 }
halcanary19a97202016-08-03 15:08:04 -07001109
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001110 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001111 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001112 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001113 "samplecode/SampleApp.cpp",
1114 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001115 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001116 if (is_mac) {
1117 sources += [ "src/views/mac/skia_mac.mm" ]
1118 } else if (is_win) {
1119 sources += [ "src/views/win/skia_win.cpp" ]
1120 } else if (is_linux) {
1121 sources += [ "src/views/unix/skia_unix.cpp" ]
1122 }
mtklein38925aa2016-09-21 10:11:25 -07001123 deps = [
1124 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001125 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001126 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001127 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001128 ":skia",
1129 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001130 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001131 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001132 if (skia_use_angle) {
1133 deps += [ "//third_party/angle2" ]
1134 }
mtklein38925aa2016-09-21 10:11:25 -07001135 testonly = true
1136 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001137 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001138
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001139 if (skia_enable_gpu) {
1140 executable("skpbench") {
1141 sources = [
1142 "tools/skpbench/skpbench.cpp",
1143 ]
1144 deps = [
1145 ":flags",
1146 ":gpu_tool_utils",
1147 ":skia",
1148 ":tool_utils",
1149 ]
1150 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001151 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001152 }
1153
Mike Klein7d302882016-11-03 14:06:31 -04001154 # We can't yet build ICU on iOS or Windows.
1155 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001156 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001157 sources = [
1158 "tools/SkShaper_harfbuzz.cpp",
1159 "tools/using_skia_and_harfbuzz.cpp",
1160 ]
1161 deps = [
1162 ":skia",
1163 "//third_party/harfbuzz",
1164 ]
1165 testonly = true
1166 }
halcanary19a97202016-08-03 15:08:04 -07001167 }
halcanary3eee9d92016-09-10 07:01:53 -07001168 executable("sktexttopdf") {
1169 sources = [
1170 "tools/SkShaper_primitive.cpp",
1171 "tools/using_skia_and_harfbuzz.cpp",
1172 ]
1173 deps = [
1174 ":skia",
1175 ]
1176 testonly = true
1177 }
mtklein046cb562016-09-16 10:23:12 -07001178
1179 executable("get_images_from_skps") {
1180 sources = [
1181 "tools/get_images_from_skps.cpp",
1182 ]
1183 deps = [
1184 ":flags",
1185 ":skia",
1186 "//third_party/jsoncpp",
1187 ]
1188 testonly = true
1189 }
mtkleinecbc5262016-09-22 11:51:24 -07001190
Matt Sarett8740d582016-11-11 13:59:14 -05001191 executable("colorspaceinfo") {
1192 sources = [
1193 "tools/colorspaceinfo.cpp",
1194 ]
1195 deps = [
1196 ":flags",
1197 ":skia",
1198 ":tool_utils",
1199 ]
1200 testonly = true
1201 }
1202
Mike Klein7d302882016-11-03 14:06:31 -04001203 if (!is_ios) {
1204 executable("skiaserve") {
1205 sources = [
1206 "tools/skiaserve/Request.cpp",
1207 "tools/skiaserve/Response.cpp",
1208 "tools/skiaserve/skiaserve.cpp",
1209 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1210 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1211 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1212 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1213 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1214 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1215 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1216 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1217 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1218 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1219 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1220 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1221 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1222 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1223 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1224 ]
1225 deps = [
1226 ":flags",
1227 ":gpu_tool_utils",
1228 ":skia",
1229 ":tool_utils",
1230 "//third_party/jsoncpp",
1231 "//third_party/libmicrohttpd",
1232 "//third_party/libpng",
1233 ]
1234 testonly = true
1235 }
mtkleinecbc5262016-09-22 11:51:24 -07001236 }
kjlubick14f984b2016-10-03 11:49:45 -07001237
1238 executable("fuzz") {
1239 sources = [
1240 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001241 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001242 "fuzz/FuzzGradients.cpp",
1243 "fuzz/FuzzParsePath.cpp",
1244 "fuzz/FuzzPathop.cpp",
1245 "fuzz/FuzzScaleToSides.cpp",
1246 "fuzz/fuzz.cpp",
1247 ]
1248 deps = [
1249 ":flags",
1250 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001251 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001252 ]
1253 testonly = true
1254 }
Mike Klein38312422016-10-05 15:41:01 -04001255
caryclark9feb6322016-10-25 08:58:26 -07001256 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001257 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001258 rebase_path("tests/skia_test.cpp"),
1259 rebase_path("tests/Test.cpp"),
1260 ]
caryclark9feb6322016-10-25 08:58:26 -07001261 deps = [
1262 ":flags",
1263 ":gpu_tool_utils",
1264 ":skia",
1265 ":tool_utils",
1266 ]
1267 testonly = true
1268 }
1269
Mike Klein38312422016-10-05 15:41:01 -04001270 executable("dump_record") {
1271 sources = [
1272 "tools/DumpRecord.cpp",
1273 "tools/dump_record.cpp",
1274 ]
1275 deps = [
1276 ":flags",
1277 ":skia",
1278 ]
1279 testonly = true
1280 }
bungemanfe917272016-10-13 17:36:40 -04001281
1282 executable("skdiff") {
1283 sources = [
1284 "tools/skdiff/skdiff.cpp",
1285 "tools/skdiff/skdiff_html.cpp",
1286 "tools/skdiff/skdiff_main.cpp",
1287 "tools/skdiff/skdiff_utils.cpp",
1288 ]
1289 deps = [
1290 ":skia",
1291 ":tool_utils",
1292 ]
1293 testonly = true
1294 }
halcanarya73d76a2016-10-17 13:19:02 -07001295
1296 executable("skp_parser") {
1297 sources = [
1298 "tools/skp_parser.cpp",
1299 ]
1300 deps = [
1301 ":skia",
1302 ":tool_utils",
1303 "//third_party/jsoncpp",
1304 ]
1305 testonly = true
1306 }
Brian Osman16adfa32016-10-18 14:42:44 -04001307
Mike Klein43c25262016-10-20 10:17:47 -04001308 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001309 executable("viewer") {
1310 sources = [
1311 "tools/viewer/GMSlide.cpp",
1312 "tools/viewer/ImageSlide.cpp",
1313 "tools/viewer/SKPSlide.cpp",
1314 "tools/viewer/SampleSlide.cpp",
1315 "tools/viewer/Viewer.cpp",
1316 "tools/viewer/sk_app/CommandSet.cpp",
1317 "tools/viewer/sk_app/GLWindowContext.cpp",
1318 "tools/viewer/sk_app/Window.cpp",
1319 "tools/viewer/sk_app/WindowContext.cpp",
1320 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001321 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001322
Jim Van Verth4e56a912016-10-21 10:58:52 -04001323 if (is_android) {
1324 sources += [
1325 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1326 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1327 "tools/viewer/sk_app/android/Window_android.cpp",
1328 "tools/viewer/sk_app/android/main_android.cpp",
1329 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1330 ]
1331 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001332 sources += [
1333 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1334 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1335 "tools/viewer/sk_app/unix/Window_unix.cpp",
1336 "tools/viewer/sk_app/unix/main_unix.cpp",
1337 ]
1338 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001339 sources += [
1340 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1341 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1342 "tools/viewer/sk_app/win/Window_win.cpp",
1343 "tools/viewer/sk_app/win/main_win.cpp",
1344 ]
Mike Klein43c25262016-10-20 10:17:47 -04001345 } else if (is_mac) {
1346 sources += [
1347 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1348 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1349 "tools/viewer/sk_app/mac/Window_mac.cpp",
1350 "tools/viewer/sk_app/mac/main_mac.cpp",
1351 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001352 }
1353
1354 if (skia_use_vulkan) {
1355 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001356 if (is_android) {
1357 sources +=
1358 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1359 libs += [ "android" ]
1360 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001361 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1362 libs += [ "X11-xcb" ]
1363 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001364 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1365 }
1366 }
1367
1368 include_dirs = []
1369 deps = [
1370 ":flags",
1371 ":gm",
1372 ":gpu_tool_utils",
1373 ":samples",
1374 ":skia",
1375 ":tool_utils",
1376 ":views",
1377 "//third_party/jsoncpp",
1378 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001379 if (is_android) {
1380 deps += [ "//third_party/native_app_glue" ]
1381 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001382 deps += [ "//third_party/libsdl" ]
1383 }
Brian Osman16adfa32016-10-18 14:42:44 -04001384 testonly = true
1385 }
1386 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001387
1388 if (skia_enable_gpu) {
1389 executable("skslc") {
1390 sources = [
1391 "src/sksl/SkSLMain.cpp",
1392 ]
1393 deps = [
1394 ":flags",
1395 ":skia",
1396 ]
1397 testonly = true
1398 }
1399 }
mtklein25c81d42016-07-27 13:55:26 -07001400}