blob: 29acd54decda1b5f4baa588469737127b87d8dc1 [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 Klein308b5ac2016-12-06 16:03:52 -0500700 # Used by gn_to_bp.py to list our public include dirs.
701 source_set("public") {
702 configs += [ ":skia_public" ]
703 }
704
Mike Kleinc36dedf2016-11-18 09:35:28 -0500705 config("skia.h_config") {
706 include_dirs = [ "$target_gen_dir" ]
707 }
708 action("skia.h") {
709 public_configs = [ ":skia.h_config" ]
710 skia_h = "$target_gen_dir/skia.h"
711 script = "gn/find_headers.py"
712 args = [ rebase_path(skia_h, root_build_dir) ] +
713 rebase_path(skia_public_includes)
714 depfile = "$skia_h.deps"
715 outputs = [
716 skia_h,
717 ]
718 }
719
720 if (skia_enable_gpu && target_cpu == "x64") {
721 # Our bots only have 64-bit libOSMesa installed.
722 # TODO: worth fixing?
723 executable("fiddle") {
724 libs = []
725 if (is_linux) {
726 libs += [ "OSMesa" ]
727 }
728
729 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500730 "tools/fiddle/draw.cpp",
731 "tools/fiddle/fiddle_main.cpp",
732 ]
733 deps = [
734 ":skia",
735 ":skia.h",
736 ]
737 }
738 }
739
740 if (skia_enable_gpu) {
741 source_set("public_headers_warnings_check") {
742 sources = [
743 "tools/public_headers_warnings_check.cpp",
744 ]
745 configs -= [ "//gn:warnings_except_public_headers" ]
746 deps = [
747 ":skia",
748 ":skia.h",
749 ]
750 }
751 }
752
mtkleinc095df52016-08-24 12:23:52 -0700753 template("test_lib") {
754 config(target_name + "_config") {
755 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700756 if (defined(invoker.public_defines)) {
757 defines = invoker.public_defines
758 }
mtklein25c81d42016-07-27 13:55:26 -0700759 }
mtkleinc095df52016-08-24 12:23:52 -0700760 source_set(target_name) {
761 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
762 public_configs = [
763 ":" + target_name + "_config",
764 ":skia_private",
765 ]
766
767 if (!defined(deps)) {
768 deps = []
769 }
770 deps += [ ":skia" ]
771 testonly = true
772 }
mtklein25c81d42016-07-27 13:55:26 -0700773 }
mtklein25c81d42016-07-27 13:55:26 -0700774
mtkleinc095df52016-08-24 12:23:52 -0700775 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700776 public_include_dirs = []
777 if (skia_enable_gpu) {
778 public_defines = []
779 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700780
781 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700782 sources = [
783 "tools/gpu/GrContextFactory.cpp",
784 "tools/gpu/GrTest.cpp",
785 "tools/gpu/TestContext.cpp",
786 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700787 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700788 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
789 "tools/gpu/gl/debug/GrBufferObj.cpp",
790 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
791 "tools/gpu/gl/debug/GrProgramObj.cpp",
792 "tools/gpu/gl/debug/GrShaderObj.cpp",
793 "tools/gpu/gl/debug/GrTextureObj.cpp",
794 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
795 "tools/gpu/gl/null/NullGLTestContext.cpp",
796 ]
797 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700798
mtklein38925aa2016-09-21 10:11:25 -0700799 if (is_android) {
800 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400801 } else if (is_ios) {
802 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
803 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700804 } else if (is_linux) {
805 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
806 } else if (is_mac) {
807 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400808 } else if (is_win) {
809 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
810 libs += [
811 "Gdi32.lib",
812 "OpenGL32.lib",
813 ]
mtklein38925aa2016-09-21 10:11:25 -0700814 }
mtklein6ef69992016-09-14 06:12:09 -0700815
Mike Kleinc168a3a2016-11-14 14:53:13 +0000816 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000817 deps += [ "//third_party/angle2" ]
818 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
819 }
mtklein38925aa2016-09-21 10:11:25 -0700820 if (skia_use_mesa) {
821 public_defines += [ "SK_MESA" ]
822 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
823 libs += [ "OSMesa" ]
824 }
mtkleind68f9b02016-09-23 13:18:41 -0700825 if (skia_use_vulkan) {
826 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
827 }
mtkleina627b5c2016-09-20 13:36:47 -0700828 }
mtklein25c81d42016-07-27 13:55:26 -0700829 }
mtklein25c81d42016-07-27 13:55:26 -0700830
mtkleinc095df52016-08-24 12:23:52 -0700831 test_lib("flags") {
832 public_include_dirs = [ "tools/flags" ]
833 sources = [
834 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700835 ]
836 }
837 test_lib("common_flags") {
838 public_include_dirs = [ "tools/flags" ]
839 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700840 "tools/flags/SkCommonFlags.cpp",
841 "tools/flags/SkCommonFlagsConfig.cpp",
842 ]
843 deps = [
mtklein046cb562016-09-16 10:23:12 -0700844 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700845 ":gpu_tool_utils",
846 ]
847 }
mtklein25c81d42016-07-27 13:55:26 -0700848
mtkleinc095df52016-08-24 12:23:52 -0700849 test_lib("tool_utils") {
850 public_include_dirs = [
851 "tools",
852 "tools/debugger",
853 "tools/timer",
854 ]
855 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700856 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700857 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700858 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700859 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700860 "tools/ProcStats.cpp",
861 "tools/Resources.cpp",
862 "tools/ThermalManager.cpp",
863 "tools/UrlDataManager.cpp",
864 "tools/debugger/SkDebugCanvas.cpp",
865 "tools/debugger/SkDrawCommand.cpp",
866 "tools/debugger/SkJsonWriteBuffer.cpp",
867 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700868 "tools/picture_utils.cpp",
869 "tools/random_parse_path.cpp",
870 "tools/sk_tool_utils.cpp",
871 "tools/sk_tool_utils_font.cpp",
872 "tools/timer/Timer.cpp",
873 ]
874 deps = [
mtklein046cb562016-09-16 10:23:12 -0700875 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700876 ":flags",
877 "//third_party/libpng",
878 ]
879 public_deps = [
880 "//third_party/jsoncpp",
881 ]
882 }
mtklein25c81d42016-07-27 13:55:26 -0700883
Mike Klein6e744122016-10-27 12:21:40 -0400884 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700885 test_lib("gm") {
886 public_include_dirs = [ "gm" ]
887 sources = gm_sources
888 deps = [
scroggo19b91532016-10-24 09:03:26 -0700889 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700890 ":gpu_tool_utils",
891 ":skia",
892 ":tool_utils",
893 ]
894 }
mtklein25c81d42016-07-27 13:55:26 -0700895
Mike Klein6e744122016-10-27 12:21:40 -0400896 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700897 test_lib("tests") {
898 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400899 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700900 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400901 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700902 }
mtkleinc095df52016-08-24 12:23:52 -0700903 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700904 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700905 ":flags",
906 ":gpu_tool_utils",
907 ":skia",
908 ":tool_utils",
909 "//third_party/libpng",
910 "//third_party/zlib",
911 ]
912 }
mtklein2f3416d2016-08-02 16:02:05 -0700913
Mike Klein6e744122016-10-27 12:21:40 -0400914 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700915 test_lib("bench") {
916 public_include_dirs = [ "bench" ]
917 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700918 deps = [
919 ":flags",
920 ":gm",
921 ":gpu_tool_utils",
922 ":skia",
923 ":tool_utils",
924 ]
925 }
mtklein2b6870c2016-07-28 14:17:33 -0700926
mtkleinc095df52016-08-24 12:23:52 -0700927 test_lib("experimental_svg_model") {
928 public_include_dirs = [ "experimental/svg/model" ]
929 sources = [
930 "experimental/svg/model/SkSVGAttribute.cpp",
931 "experimental/svg/model/SkSVGAttributeParser.cpp",
932 "experimental/svg/model/SkSVGCircle.cpp",
933 "experimental/svg/model/SkSVGContainer.cpp",
934 "experimental/svg/model/SkSVGDOM.cpp",
935 "experimental/svg/model/SkSVGEllipse.cpp",
936 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700937 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700938 "experimental/svg/model/SkSVGNode.cpp",
939 "experimental/svg/model/SkSVGPath.cpp",
940 "experimental/svg/model/SkSVGPoly.cpp",
941 "experimental/svg/model/SkSVGRect.cpp",
942 "experimental/svg/model/SkSVGRenderContext.cpp",
943 "experimental/svg/model/SkSVGSVG.cpp",
944 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700945 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700946 "experimental/svg/model/SkSVGTransformableNode.cpp",
947 "experimental/svg/model/SkSVGValue.cpp",
948 ]
949 deps = [
950 ":skia",
951 ]
952 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700953
Brian Osman16adfa32016-10-18 14:42:44 -0400954 test_lib("views") {
955 public_include_dirs = [ "include/views" ]
956 sources = [
957 "src/views/SkEvent.cpp",
958 "src/views/SkEventSink.cpp",
959 "src/views/SkOSMenu.cpp",
960 "src/views/SkTagList.cpp",
961 "src/views/SkTouchGesture.cpp",
962 "src/views/SkView.cpp",
963 "src/views/SkViewPriv.cpp",
964 ]
965 libs = []
Brian Osman34755e22016-12-05 09:46:02 -0500966 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -0400967 if (!is_android) {
968 sources += [ "src/views/SkWindow.cpp" ]
969 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400970 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400971 public_include_dirs += [ "src/views/unix" ]
972 sources += [
973 "src/views/unix/SkOSWindow_Unix.cpp",
974 "src/views/unix/keysym2ucs.c",
975 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400976 } else if (is_mac) {
977 sources += [
978 "src/views/mac/SkEventNotifier.mm",
979 "src/views/mac/SkNSView.mm",
980 "src/views/mac/SkOSWindow_Mac.mm",
981 "src/views/mac/SkTextFieldCell.m",
982 ]
983 libs += [
984 "QuartzCore.framework",
985 "Cocoa.framework",
986 "Foundation.framework",
987 ]
988 } else if (is_win) {
989 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
990 }
Brian Osman34755e22016-12-05 09:46:02 -0500991 if (skia_use_angle) {
992 deps += [ "//third_party/angle2" ]
993 }
Brian Osman16adfa32016-10-18 14:42:44 -0400994 }
995
Mike Klein38af9432016-11-11 11:39:44 -0500996 if (skia_use_lua) {
997 test_lib("lua") {
998 public_include_dirs = []
999 sources = [
1000 "src/utils/SkLua.cpp",
1001 "src/utils/SkLuaCanvas.cpp",
1002 ]
1003 deps = [
1004 "//third_party/lua",
1005 ]
1006 }
1007
1008 executable("lua_app") {
1009 sources = [
1010 "tools/lua/lua_app.cpp",
1011 ]
1012 deps = [
1013 ":lua",
1014 ":skia",
1015 "//third_party/lua",
1016 ]
1017 testonly = true
1018 }
1019
1020 executable("lua_pictures") {
1021 sources = [
1022 "tools/lua/lua_pictures.cpp",
1023 ]
1024 deps = [
1025 ":flags",
1026 ":lua",
1027 ":skia",
1028 ":tool_utils",
1029 "//third_party/lua",
1030 ]
1031 testonly = true
1032 }
1033 }
1034
Mike Klein6e744122016-10-27 12:21:40 -04001035 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001036 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001037 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001038 include_dirs = [ "experimental" ]
1039 sources = samples_sources + [
1040 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1041 "experimental/SkSetPoly3To3.cpp",
1042 "experimental/SkSetPoly3To3_A.cpp",
1043 "experimental/SkSetPoly3To3_D.cpp",
1044 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001045 deps = [
1046 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001047 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001048 ":tool_utils",
1049 ":views",
1050 ":xml",
1051 ]
Mike Klein38af9432016-11-11 11:39:44 -05001052
1053 if (skia_use_lua) {
1054 sources += [ "samplecode/SampleLua.cpp" ]
1055 deps += [
1056 ":lua",
1057 "//third_party/lua",
1058 ]
1059 }
Brian Osman16adfa32016-10-18 14:42:44 -04001060 }
1061
mtklein2b6870c2016-07-28 14:17:33 -07001062 executable("dm") {
1063 sources = [
1064 "dm/DM.cpp",
1065 "dm/DMJsonWriter.cpp",
1066 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001067 ]
1068 include_dirs = [ "tests" ]
1069 deps = [
mtklein046cb562016-09-16 10:23:12 -07001070 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001071 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001072 ":flags",
1073 ":gm",
1074 ":gpu_tool_utils",
1075 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001076 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001077 ":tool_utils",
1078 "//third_party/jsoncpp",
1079 "//third_party/libpng",
1080 ]
1081 testonly = true
1082 }
1083
Mike Kleina3430172016-09-27 16:46:29 -04001084 if (!is_debug) { # I've benchmarked debug code once too many times...
1085 executable("monobench") {
1086 sources = [
1087 "tools/monobench.cpp",
1088 ]
1089 deps = [
1090 ":bench",
1091 ":skia",
1092 ]
1093 testonly = true
1094 }
mtklein2b6870c2016-07-28 14:17:33 -07001095 }
1096
1097 executable("nanobench") {
1098 sources = [
1099 "bench/nanobench.cpp",
1100 ]
1101 deps = [
1102 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001103 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001104 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001105 ":flags",
1106 ":gm",
1107 ":gpu_tool_utils",
1108 ":skia",
1109 ":tool_utils",
1110 "//third_party/jsoncpp",
1111 ]
1112 testonly = true
1113 }
halcanary19a97202016-08-03 15:08:04 -07001114
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001115 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001116 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001117 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001118 "samplecode/SampleApp.cpp",
1119 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001120 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001121 if (is_mac) {
1122 sources += [ "src/views/mac/skia_mac.mm" ]
1123 } else if (is_win) {
1124 sources += [ "src/views/win/skia_win.cpp" ]
1125 } else if (is_linux) {
1126 sources += [ "src/views/unix/skia_unix.cpp" ]
1127 }
mtklein38925aa2016-09-21 10:11:25 -07001128 deps = [
1129 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001130 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001131 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001132 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001133 ":skia",
1134 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001135 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001136 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001137 if (skia_use_angle) {
1138 deps += [ "//third_party/angle2" ]
1139 }
mtklein38925aa2016-09-21 10:11:25 -07001140 testonly = true
1141 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001142 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001143
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001144 if (skia_enable_gpu) {
1145 executable("skpbench") {
1146 sources = [
1147 "tools/skpbench/skpbench.cpp",
1148 ]
1149 deps = [
1150 ":flags",
1151 ":gpu_tool_utils",
1152 ":skia",
1153 ":tool_utils",
1154 ]
1155 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001156 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001157 }
1158
Mike Klein7d302882016-11-03 14:06:31 -04001159 # We can't yet build ICU on iOS or Windows.
1160 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001161 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001162 sources = [
1163 "tools/SkShaper_harfbuzz.cpp",
1164 "tools/using_skia_and_harfbuzz.cpp",
1165 ]
1166 deps = [
1167 ":skia",
1168 "//third_party/harfbuzz",
1169 ]
1170 testonly = true
1171 }
halcanary19a97202016-08-03 15:08:04 -07001172 }
halcanary3eee9d92016-09-10 07:01:53 -07001173 executable("sktexttopdf") {
1174 sources = [
1175 "tools/SkShaper_primitive.cpp",
1176 "tools/using_skia_and_harfbuzz.cpp",
1177 ]
1178 deps = [
1179 ":skia",
1180 ]
1181 testonly = true
1182 }
mtklein046cb562016-09-16 10:23:12 -07001183
1184 executable("get_images_from_skps") {
1185 sources = [
1186 "tools/get_images_from_skps.cpp",
1187 ]
1188 deps = [
1189 ":flags",
1190 ":skia",
1191 "//third_party/jsoncpp",
1192 ]
1193 testonly = true
1194 }
mtkleinecbc5262016-09-22 11:51:24 -07001195
Matt Sarett8740d582016-11-11 13:59:14 -05001196 executable("colorspaceinfo") {
1197 sources = [
1198 "tools/colorspaceinfo.cpp",
1199 ]
1200 deps = [
1201 ":flags",
1202 ":skia",
1203 ":tool_utils",
1204 ]
1205 testonly = true
1206 }
1207
Mike Klein7d302882016-11-03 14:06:31 -04001208 if (!is_ios) {
1209 executable("skiaserve") {
1210 sources = [
1211 "tools/skiaserve/Request.cpp",
1212 "tools/skiaserve/Response.cpp",
1213 "tools/skiaserve/skiaserve.cpp",
1214 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1215 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1216 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1217 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1218 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1219 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1220 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1221 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1222 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1223 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1224 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1225 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1226 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1227 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1228 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1229 ]
1230 deps = [
1231 ":flags",
1232 ":gpu_tool_utils",
1233 ":skia",
1234 ":tool_utils",
1235 "//third_party/jsoncpp",
1236 "//third_party/libmicrohttpd",
1237 "//third_party/libpng",
1238 ]
1239 testonly = true
1240 }
mtkleinecbc5262016-09-22 11:51:24 -07001241 }
kjlubick14f984b2016-10-03 11:49:45 -07001242
1243 executable("fuzz") {
1244 sources = [
1245 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001246 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001247 "fuzz/FuzzGradients.cpp",
1248 "fuzz/FuzzParsePath.cpp",
1249 "fuzz/FuzzPathop.cpp",
1250 "fuzz/FuzzScaleToSides.cpp",
1251 "fuzz/fuzz.cpp",
1252 ]
1253 deps = [
1254 ":flags",
1255 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001256 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001257 ]
1258 testonly = true
1259 }
Mike Klein38312422016-10-05 15:41:01 -04001260
caryclark9feb6322016-10-25 08:58:26 -07001261 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001262 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001263 rebase_path("tests/skia_test.cpp"),
1264 rebase_path("tests/Test.cpp"),
1265 ]
caryclark9feb6322016-10-25 08:58:26 -07001266 deps = [
1267 ":flags",
1268 ":gpu_tool_utils",
1269 ":skia",
1270 ":tool_utils",
1271 ]
1272 testonly = true
1273 }
1274
Mike Klein38312422016-10-05 15:41:01 -04001275 executable("dump_record") {
1276 sources = [
1277 "tools/DumpRecord.cpp",
1278 "tools/dump_record.cpp",
1279 ]
1280 deps = [
1281 ":flags",
1282 ":skia",
1283 ]
1284 testonly = true
1285 }
bungemanfe917272016-10-13 17:36:40 -04001286
1287 executable("skdiff") {
1288 sources = [
1289 "tools/skdiff/skdiff.cpp",
1290 "tools/skdiff/skdiff_html.cpp",
1291 "tools/skdiff/skdiff_main.cpp",
1292 "tools/skdiff/skdiff_utils.cpp",
1293 ]
1294 deps = [
1295 ":skia",
1296 ":tool_utils",
1297 ]
1298 testonly = true
1299 }
halcanarya73d76a2016-10-17 13:19:02 -07001300
1301 executable("skp_parser") {
1302 sources = [
1303 "tools/skp_parser.cpp",
1304 ]
1305 deps = [
1306 ":skia",
1307 ":tool_utils",
1308 "//third_party/jsoncpp",
1309 ]
1310 testonly = true
1311 }
Brian Osman16adfa32016-10-18 14:42:44 -04001312
Mike Klein43c25262016-10-20 10:17:47 -04001313 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001314 executable("viewer") {
1315 sources = [
1316 "tools/viewer/GMSlide.cpp",
1317 "tools/viewer/ImageSlide.cpp",
1318 "tools/viewer/SKPSlide.cpp",
1319 "tools/viewer/SampleSlide.cpp",
1320 "tools/viewer/Viewer.cpp",
1321 "tools/viewer/sk_app/CommandSet.cpp",
1322 "tools/viewer/sk_app/GLWindowContext.cpp",
1323 "tools/viewer/sk_app/Window.cpp",
1324 "tools/viewer/sk_app/WindowContext.cpp",
1325 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001326 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001327
Jim Van Verth4e56a912016-10-21 10:58:52 -04001328 if (is_android) {
1329 sources += [
1330 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1331 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1332 "tools/viewer/sk_app/android/Window_android.cpp",
1333 "tools/viewer/sk_app/android/main_android.cpp",
1334 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1335 ]
1336 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001337 sources += [
1338 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1339 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1340 "tools/viewer/sk_app/unix/Window_unix.cpp",
1341 "tools/viewer/sk_app/unix/main_unix.cpp",
1342 ]
1343 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001344 sources += [
1345 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1346 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1347 "tools/viewer/sk_app/win/Window_win.cpp",
1348 "tools/viewer/sk_app/win/main_win.cpp",
1349 ]
Mike Klein43c25262016-10-20 10:17:47 -04001350 } else if (is_mac) {
1351 sources += [
1352 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1353 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1354 "tools/viewer/sk_app/mac/Window_mac.cpp",
1355 "tools/viewer/sk_app/mac/main_mac.cpp",
1356 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001357 }
1358
1359 if (skia_use_vulkan) {
1360 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001361 if (is_android) {
1362 sources +=
1363 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1364 libs += [ "android" ]
1365 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001366 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1367 libs += [ "X11-xcb" ]
1368 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001369 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1370 }
1371 }
1372
1373 include_dirs = []
1374 deps = [
1375 ":flags",
1376 ":gm",
1377 ":gpu_tool_utils",
1378 ":samples",
1379 ":skia",
1380 ":tool_utils",
1381 ":views",
1382 "//third_party/jsoncpp",
1383 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001384 if (is_android) {
1385 deps += [ "//third_party/native_app_glue" ]
1386 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001387 deps += [ "//third_party/libsdl" ]
1388 }
Brian Osman16adfa32016-10-18 14:42:44 -04001389 testonly = true
1390 }
1391 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001392
1393 if (skia_enable_gpu) {
1394 executable("skslc") {
1395 sources = [
1396 "src/sksl/SkSLMain.cpp",
1397 ]
1398 deps = [
1399 ":flags",
1400 ":skia",
1401 ]
1402 testonly = true
1403 }
1404 }
mtklein25c81d42016-07-27 13:55:26 -07001405}