blob: 102b7853e5d4a4060b39b6869d004a3294030255 [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/core",
96 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070097 "src/effects/gradients",
98 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070099 "src/gpu",
100 "src/image",
101 "src/images",
102 "src/lazy",
103 "src/opts",
104 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700105 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700106 "src/ports",
107 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700108 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700109 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700110 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700111 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700112 "third_party/gif",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000113 "third_party/ktx",
mtkleinc04ff472016-06-23 10:29:30 -0700114 ]
mtklein150d1132016-08-01 06:56:40 -0700115
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400116 defines = [
117 "SK_GAMMA_APPLY_TO_A8",
118 "SK_INTERNAL",
119 ]
mtkleinb37c0342016-09-09 11:07:45 -0700120 if (is_android) {
121 defines += [
122 "SK_GAMMA_EXPONENT=1.4",
123 "SK_GAMMA_CONTRAST=0.0",
124 ]
125 }
mtklein88a7ac02016-09-14 11:16:49 -0700126 if (is_official_build || is_android) {
127 # TODO(bsalomon): it'd be nice to make Android normal.
128 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
129 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400130 libs = []
131 lib_dirs = []
132 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400133 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400134 if (is_win) {
135 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
136 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
137 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400138 include_dirs += [ "$skia_vulkan_sdk/include/" ]
139 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400140 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400141 }
Mike Klein487bfc22016-10-14 14:04:56 -0400142 if (is_win) {
143 libs += [ "vulkan-1.lib" ]
144 } else {
145 libs += [ "vulkan" ]
146 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400147 }
Brian Osman34755e22016-12-05 09:46:02 -0500148 if (skia_use_angle) {
149 defines += [ "SK_ANGLE" ]
150 }
mtkleinc04ff472016-06-23 10:29:30 -0700151}
152
153# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
154config("skia_library") {
155 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700156 defines = [ "SKIA_IMPLEMENTATION=1" ]
157}
158
159skia_library_configs = [
160 ":skia_public",
161 ":skia_private",
162 ":skia_library",
163]
164
mtklein9b8583d2016-08-24 17:32:30 -0700165# Use for CPU-specific Skia code that needs particular compiler flags.
166template("opts") {
167 if (invoker.enabled) {
168 source_set(target_name) {
169 forward_variables_from(invoker, "*")
170 configs += skia_library_configs
171 }
172 } else {
173 # If not enabled, a phony empty target that swallows all otherwise unused variables.
174 source_set(target_name) {
175 forward_variables_from(invoker,
176 "*",
177 [
178 "sources",
179 "cflags",
180 ])
181 }
182 }
anmittala7eaf2e2016-08-17 13:57:26 -0700183}
184
mtklein422310d2016-08-16 18:28:43 -0700185is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700186
mtklein7d6fb2c2016-08-25 14:50:44 -0700187opts("none") {
188 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700189 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700190 cflags = []
191}
192
mtklein7d6fb2c2016-08-25 14:50:44 -0700193opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700194 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700195 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700196 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700197}
198
199opts("arm64") {
200 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700201 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700202 cflags = []
203}
204
205opts("crc32") {
206 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700208 cflags = [ "-march=armv8-a+crc" ]
209}
210
mtklein9b8583d2016-08-24 17:32:30 -0700211opts("sse2") {
212 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700213 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400214 if (is_win) {
215 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
216 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400217 cflags = [ "-msse2" ]
218 }
mtklein9b8583d2016-08-24 17:32:30 -0700219}
mtkleinc04ff472016-06-23 10:29:30 -0700220
mtklein9b8583d2016-08-24 17:32:30 -0700221opts("ssse3") {
222 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700223 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400224 if (is_win) {
225 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
226 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400227 cflags = [ "-mssse3" ]
228 }
mtklein9b8583d2016-08-24 17:32:30 -0700229}
mtkleinc04ff472016-06-23 10:29:30 -0700230
mtklein9b8583d2016-08-24 17:32:30 -0700231opts("sse41") {
232 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700233 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400234 if (is_win) {
235 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
236 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400237 cflags = [ "-msse4.1" ]
238 }
mtklein9b8583d2016-08-24 17:32:30 -0700239}
mtklein4e976072016-08-08 09:06:27 -0700240
mtklein9b8583d2016-08-24 17:32:30 -0700241opts("sse42") {
242 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400244 if (is_win) {
245 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
246 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400247 cflags = [ "-msse4.2" ]
248 }
mtklein9b8583d2016-08-24 17:32:30 -0700249}
250
251opts("avx") {
252 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400254 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000255 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400256 } else {
257 cflags = [ "-mavx" ]
258 }
mtkleinc04ff472016-06-23 10:29:30 -0700259}
260
Mike Klein78d5a3b2016-09-30 10:48:01 -0400261opts("hsw") {
262 enabled = is_x86
263 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400264 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000265 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400266 } else {
267 cflags = [
268 "-mavx2",
269 "-mbmi",
270 "-mbmi2",
271 "-mf16c",
272 "-mfma",
273 ]
274 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400275}
276
mtkleinc095df52016-08-24 12:23:52 -0700277# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700278template("optional") {
279 if (invoker.enabled) {
280 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700281 if (defined(invoker.public_defines)) {
282 defines = invoker.public_defines
283 }
mtklein457b42a2016-08-23 13:56:37 -0700284 }
285 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700286 forward_variables_from(invoker,
287 "*",
288 [
289 "public_defines",
290 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700291 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700292 ])
mtklein457b42a2016-08-23 13:56:37 -0700293 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700294 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700295 if (defined(invoker.configs_to_remove)) {
296 configs -= invoker.configs_to_remove
297 }
mtklein457b42a2016-08-23 13:56:37 -0700298 }
299 } else {
mtklein457b42a2016-08-23 13:56:37 -0700300 source_set(target_name) {
301 forward_variables_from(invoker,
302 "*",
303 [
304 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700305 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700306 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700307 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700308 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700309 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700310 ])
mtkleincd01b032016-08-31 04:58:19 -0700311 if (defined(invoker.sources_when_disabled)) {
312 sources = invoker.sources_when_disabled
313 }
314 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700315 }
mtkleineb3c4252016-08-23 07:38:09 -0700316 }
mtklein457b42a2016-08-23 13:56:37 -0700317}
mtklein457b42a2016-08-23 13:56:37 -0700318
mtkleina45be612016-08-29 15:22:10 -0700319optional("fontmgr_android") {
320 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700321
322 deps = [
323 "//third_party/expat",
324 "//third_party/freetype2",
325 ]
326 sources = [
327 "src/ports/SkFontMgr_android.cpp",
328 "src/ports/SkFontMgr_android_factory.cpp",
329 "src/ports/SkFontMgr_android_parser.cpp",
330 ]
331}
332
mtkleind2e39db2016-09-07 07:52:55 -0700333optional("fontmgr_custom") {
334 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
335
336 deps = [
337 "//third_party/freetype2",
338 ]
339 sources = [
340 "src/ports/SkFontMgr_custom.cpp",
341 "src/ports/SkFontMgr_custom_directory_factory.cpp",
342 ]
343}
344
mtklein3cc22182016-08-29 13:26:14 -0700345optional("fontmgr_fontconfig") {
346 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700347
348 deps = [
349 "//third_party:fontconfig",
350 "//third_party/freetype2",
351 ]
352 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700353 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700354 "src/ports/SkFontConfigInterface_direct.cpp",
355 "src/ports/SkFontConfigInterface_direct_factory.cpp",
356 "src/ports/SkFontMgr_FontConfigInterface.cpp",
357 "src/ports/SkFontMgr_fontconfig.cpp",
358 "src/ports/SkFontMgr_fontconfig_factory.cpp",
359 ]
360}
361
mtkleincdedd0e2016-09-12 15:15:44 -0700362optional("fontmgr_fuchsia") {
363 enabled = is_fuchsia && skia_use_freetype
364
365 deps = [
366 "//third_party/freetype2",
367 ]
368 sources = [
369 "src/ports/SkFontMgr_custom.cpp",
370 "src/ports/SkFontMgr_custom_empty_factory.cpp",
371 ]
372}
373
mtklein06c35c02016-09-20 12:28:12 -0700374optional("gpu") {
375 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700376 public_defines = []
377
mtklein06c35c02016-09-20 12:28:12 -0700378 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
379
380 # These paths need to be absolute to match the ones produced by shared_sources.gni.
381 sources -= get_path_info([
382 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
383 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
384 ],
385 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400386 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700387 if (is_android) {
388 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
389 } else if (is_linux) {
390 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
391 } else if (is_mac) {
392 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800393 } else if (is_ios) {
394 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400395 } else if (is_win) {
396 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
397 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700398 } else {
399 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
400 }
mtkleine9fb3d52016-09-20 15:11:46 -0700401
402 if (skia_use_vulkan) {
403 public_defines += [ "SK_VULKAN" ]
404 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700405 if (skia_enable_vulkan_debug_layers) {
406 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
407 }
mtkleine9fb3d52016-09-20 15:11:46 -0700408 }
mtklein06c35c02016-09-20 12:28:12 -0700409}
410
mtklein63213812016-08-24 09:55:56 -0700411optional("jpeg") {
412 enabled = skia_use_libjpeg_turbo
413 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
414
mtklein63213812016-08-24 09:55:56 -0700415 deps = [
416 "//third_party/libjpeg-turbo:libjpeg",
417 ]
418 sources = [
419 "src/codec/SkJpegCodec.cpp",
420 "src/codec/SkJpegDecoderMgr.cpp",
421 "src/codec/SkJpegUtility.cpp",
422 "src/images/SkJPEGImageEncoder.cpp",
423 "src/images/SkJPEGWriteUtility.cpp",
424 ]
425}
426
427optional("pdf") {
428 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700429
mtklein63213812016-08-24 09:55:56 -0700430 deps = [
431 "//third_party/zlib",
432 ]
brettwb9447282016-09-01 14:24:39 -0700433 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700434 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700435
436 if (skia_use_sfntly) {
437 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700438 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700439 }
440}
441
442optional("png") {
443 enabled = skia_use_libpng
444 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
445
mtklein63213812016-08-24 09:55:56 -0700446 deps = [
447 "//third_party/libpng",
448 ]
449 sources = [
450 "src/codec/SkIcoCodec.cpp",
451 "src/codec/SkPngCodec.cpp",
452 "src/images/SkPNGImageEncoder.cpp",
453 ]
454}
455
scroggof84ad642016-10-31 09:02:57 -0700456optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400457 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700458 public_defines = [ "SK_CODEC_DECODES_RAW" ]
459
460 deps = [
461 "//third_party/dng_sdk",
462 "//third_party/libjpeg-turbo:libjpeg",
463 "//third_party/piex",
464 ]
465
466 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
467 # Skia.
468 configs_to_remove = [ "//gn:no_exceptions" ]
469
470 sources = [
471 "src/codec/SkRawAdapterCodec.cpp",
472 "src/codec/SkRawCodec.cpp",
473 ]
474}
475
mtklein3cc22182016-08-29 13:26:14 -0700476optional("typeface_freetype") {
477 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700478
479 deps = [
480 "//third_party/freetype2",
481 ]
482 sources = [
483 "src/ports/SkFontHost_FreeType.cpp",
484 "src/ports/SkFontHost_FreeType_common.cpp",
485 ]
486}
487
mtklein457b42a2016-08-23 13:56:37 -0700488optional("webp") {
489 enabled = skia_use_libwebp
490 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
491
mtklein457b42a2016-08-23 13:56:37 -0700492 deps = [
493 "//third_party/libwebp",
494 ]
495 sources = [
496 "src/codec/SkWebpAdapterCodec.cpp",
497 "src/codec/SkWebpCodec.cpp",
498 "src/images/SkWEBPImageEncoder.cpp",
499 ]
mtkleineb3c4252016-08-23 07:38:09 -0700500}
501
mtklein63213812016-08-24 09:55:56 -0700502optional("xml") {
503 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000504 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700505
mtklein63213812016-08-24 09:55:56 -0700506 deps = [
507 "//third_party/expat",
508 ]
509 sources = [
510 "src/xml/SkDOM.cpp",
511 "src/xml/SkXMLParser.cpp",
512 "src/xml/SkXMLWriter.cpp",
513 ]
514}
515
mtkleinc04ff472016-06-23 10:29:30 -0700516component("skia") {
517 public_configs = [ ":skia_public" ]
518 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700519
520 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700521 ":arm64",
522 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700523 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700524 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700525 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700526 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700527 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700528 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700529 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400530 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700531 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700532 ":none",
mtklein63213812016-08-24 09:55:56 -0700533 ":pdf",
534 ":png",
scroggof84ad642016-10-31 09:02:57 -0700535 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700536 ":sse2",
537 ":sse41",
538 ":sse42",
539 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700540 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700541 ":webp",
mtklein63213812016-08-24 09:55:56 -0700542 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700543 ]
544
Chinmay Garde43f115c2016-11-16 15:04:12 -0800545 # This file (and all GN files in Skia) are designed to work with an
546 # empty sources assignment filter; we handle all that explicitly.
547 # We clear the filter here for clients who may have set up a global filter.
548 set_sources_assignment_filter([])
549
mtkleinc04ff472016-06-23 10:29:30 -0700550 sources = []
brettwb9447282016-09-01 14:24:39 -0700551 sources += skia_core_sources
552 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700553 sources += skia_sksl_sources
554 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500555 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700556 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700557 "src/android/SkBitmapRegionCodec.cpp",
558 "src/android/SkBitmapRegionDecoder.cpp",
559 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700560 "src/codec/SkBmpCodec.cpp",
561 "src/codec/SkBmpMaskCodec.cpp",
562 "src/codec/SkBmpRLECodec.cpp",
563 "src/codec/SkBmpStandardCodec.cpp",
564 "src/codec/SkCodec.cpp",
565 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700566 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700567 "src/codec/SkMaskSwizzler.cpp",
568 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700569 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700570 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700571 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700572 "src/codec/SkSwizzler.cpp",
573 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700574 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700575 "src/ports/SkDiscardableMemory_none.cpp",
576 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700577 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700578 "src/ports/SkMemory_malloc.cpp",
579 "src/ports/SkOSFile_stdio.cpp",
580 "src/sfnt/SkOTTable_name.cpp",
581 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700582 "src/svg/SkSVGCanvas.cpp",
583 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700584 "src/utils/mac/SkStream_mac.cpp",
585 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700586 "third_party/gif/SkGifImageReader.cpp",
Leon Scroggins427da6f2016-12-16 13:51:59 +0000587 "third_party/ktx/ktx.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700588 ]
brettwb9447282016-09-01 14:24:39 -0700589
mtklein7d6fb2c2016-08-25 14:50:44 -0700590 libs = []
591
mtkleinc04ff472016-06-23 10:29:30 -0700592 if (is_win) {
593 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400594 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700595 "src/ports/SkDebug_win.cpp",
596 "src/ports/SkFontHost_win.cpp",
597 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700598 "src/ports/SkImageEncoder_WIC.cpp",
599 "src/ports/SkImageGeneratorWIC.cpp",
600 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700601 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700602 "src/ports/SkScalerContext_win_dw.cpp",
603 "src/ports/SkTLS_win.cpp",
604 "src/ports/SkTypeface_win_dw.cpp",
605 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400606 if (skia_use_gdi) {
607 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
608 libs += [
609 "Gdi32.lib",
610 "Usp10.lib",
611 ]
612 } else {
613 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
614 }
mtkleinb9be9792016-09-16 14:44:18 -0700615 sources -=
616 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400617 libs += [
618 "FontSub.lib",
619 "Ole32.lib",
620 "OleAut32.lib",
621 "User32.lib",
622 ]
mtkleinc04ff472016-06-23 10:29:30 -0700623 } else {
624 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700625 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700626 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700627 "src/ports/SkTLS_pthread.cpp",
628 ]
629 }
630
mtklein7d6fb2c2016-08-25 14:50:44 -0700631 if (is_android) {
Mike Kleinc3083332016-12-12 09:03:56 -0500632 deps += [ "//third_party/expat" ]
mtklein06c35c02016-09-20 12:28:12 -0700633 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700634 libs += [
635 "EGL",
636 "GLESv2",
637 "log",
638 ]
639 }
640
mtkleinc04ff472016-06-23 10:29:30 -0700641 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700642 libs += [
643 "GL",
644 "GLU",
645 "X11",
646 ]
mtklein06c35c02016-09-20 12:28:12 -0700647 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700648 }
649
650 if (is_mac) {
651 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700652 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700653 "src/ports/SkFontHost_mac.cpp",
654 "src/ports/SkImageEncoder_CG.cpp",
655 "src/ports/SkImageGeneratorCG.cpp",
656 ]
mtklein09e61f72016-08-23 13:35:28 -0700657 libs += [
658 "ApplicationServices.framework",
659 "OpenGL.framework",
660 ]
mtkleinc04ff472016-06-23 10:29:30 -0700661 }
abarth6fc8ff02016-07-15 15:15:15 -0700662
Mike Klein7d302882016-11-03 14:06:31 -0400663 if (is_ios) {
664 sources += [
665 "src/ports/SkDebug_stdio.cpp",
666 "src/ports/SkFontHost_mac.cpp",
667 "src/ports/SkImageEncoder_CG.cpp",
668 "src/ports/SkImageGeneratorCG.cpp",
669 ]
670 libs += [
671 "CoreFoundation.framework",
672 "CoreGraphics.framework",
673 "CoreText.framework",
674 "ImageIO.framework",
675 "MobileCoreServices.framework",
676 ]
677 }
678
abarth6fc8ff02016-07-15 15:15:15 -0700679 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700680 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700681 }
mtkleinc04ff472016-06-23 10:29:30 -0700682}
683
mtkleinc095df52016-08-24 12:23:52 -0700684# Targets guarded by skia_enable_tools may use //third_party freely.
685if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500686 # Used by gn_to_bp.py to list our public include dirs.
687 source_set("public") {
688 configs += [ ":skia_public" ]
689 }
690
Mike Kleinc36dedf2016-11-18 09:35:28 -0500691 config("skia.h_config") {
692 include_dirs = [ "$target_gen_dir" ]
693 }
694 action("skia.h") {
695 public_configs = [ ":skia.h_config" ]
696 skia_h = "$target_gen_dir/skia.h"
697 script = "gn/find_headers.py"
698 args = [ rebase_path(skia_h, root_build_dir) ] +
699 rebase_path(skia_public_includes)
700 depfile = "$skia_h.deps"
701 outputs = [
702 skia_h,
703 ]
704 }
705
706 if (skia_enable_gpu && target_cpu == "x64") {
707 # Our bots only have 64-bit libOSMesa installed.
708 # TODO: worth fixing?
709 executable("fiddle") {
710 libs = []
711 if (is_linux) {
712 libs += [ "OSMesa" ]
713 }
714
715 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500716 "tools/fiddle/draw.cpp",
717 "tools/fiddle/fiddle_main.cpp",
718 ]
719 deps = [
720 ":skia",
721 ":skia.h",
722 ]
723 }
724 }
725
726 if (skia_enable_gpu) {
727 source_set("public_headers_warnings_check") {
728 sources = [
729 "tools/public_headers_warnings_check.cpp",
730 ]
731 configs -= [ "//gn:warnings_except_public_headers" ]
732 deps = [
733 ":skia",
734 ":skia.h",
735 ]
736 }
737 }
738
mtkleinc095df52016-08-24 12:23:52 -0700739 template("test_lib") {
740 config(target_name + "_config") {
741 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700742 if (defined(invoker.public_defines)) {
743 defines = invoker.public_defines
744 }
mtklein25c81d42016-07-27 13:55:26 -0700745 }
mtkleinc095df52016-08-24 12:23:52 -0700746 source_set(target_name) {
747 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
748 public_configs = [
749 ":" + target_name + "_config",
750 ":skia_private",
751 ]
752
753 if (!defined(deps)) {
754 deps = []
755 }
756 deps += [ ":skia" ]
757 testonly = true
758 }
mtklein25c81d42016-07-27 13:55:26 -0700759 }
mtklein25c81d42016-07-27 13:55:26 -0700760
mtkleinc095df52016-08-24 12:23:52 -0700761 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700762 public_include_dirs = []
763 if (skia_enable_gpu) {
764 public_defines = []
765 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700766
767 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700768 sources = [
769 "tools/gpu/GrContextFactory.cpp",
770 "tools/gpu/GrTest.cpp",
771 "tools/gpu/TestContext.cpp",
772 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700773 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700774 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
775 "tools/gpu/gl/debug/GrBufferObj.cpp",
776 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
777 "tools/gpu/gl/debug/GrProgramObj.cpp",
778 "tools/gpu/gl/debug/GrShaderObj.cpp",
779 "tools/gpu/gl/debug/GrTextureObj.cpp",
780 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
781 "tools/gpu/gl/null/NullGLTestContext.cpp",
782 ]
783 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700784
mtklein38925aa2016-09-21 10:11:25 -0700785 if (is_android) {
786 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400787 } else if (is_ios) {
788 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
789 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700790 } else if (is_linux) {
791 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
792 } else if (is_mac) {
793 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400794 } else if (is_win) {
795 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
796 libs += [
797 "Gdi32.lib",
798 "OpenGL32.lib",
799 ]
mtklein38925aa2016-09-21 10:11:25 -0700800 }
mtklein6ef69992016-09-14 06:12:09 -0700801
Mike Kleinc168a3a2016-11-14 14:53:13 +0000802 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000803 deps += [ "//third_party/angle2" ]
804 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
805 }
mtklein38925aa2016-09-21 10:11:25 -0700806 if (skia_use_mesa) {
807 public_defines += [ "SK_MESA" ]
808 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
809 libs += [ "OSMesa" ]
810 }
mtkleind68f9b02016-09-23 13:18:41 -0700811 if (skia_use_vulkan) {
812 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
813 }
mtkleina627b5c2016-09-20 13:36:47 -0700814 }
mtklein25c81d42016-07-27 13:55:26 -0700815 }
mtklein25c81d42016-07-27 13:55:26 -0700816
mtkleinc095df52016-08-24 12:23:52 -0700817 test_lib("flags") {
818 public_include_dirs = [ "tools/flags" ]
819 sources = [
820 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700821 ]
822 }
823 test_lib("common_flags") {
824 public_include_dirs = [ "tools/flags" ]
825 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700826 "tools/flags/SkCommonFlags.cpp",
827 "tools/flags/SkCommonFlagsConfig.cpp",
828 ]
829 deps = [
mtklein046cb562016-09-16 10:23:12 -0700830 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700831 ":gpu_tool_utils",
832 ]
833 }
mtklein25c81d42016-07-27 13:55:26 -0700834
mtkleinc095df52016-08-24 12:23:52 -0700835 test_lib("tool_utils") {
836 public_include_dirs = [
837 "tools",
838 "tools/debugger",
839 "tools/timer",
840 ]
841 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700842 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700843 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700844 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700845 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700846 "tools/ProcStats.cpp",
847 "tools/Resources.cpp",
848 "tools/ThermalManager.cpp",
849 "tools/UrlDataManager.cpp",
850 "tools/debugger/SkDebugCanvas.cpp",
851 "tools/debugger/SkDrawCommand.cpp",
852 "tools/debugger/SkJsonWriteBuffer.cpp",
853 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700854 "tools/picture_utils.cpp",
855 "tools/random_parse_path.cpp",
856 "tools/sk_tool_utils.cpp",
857 "tools/sk_tool_utils_font.cpp",
858 "tools/timer/Timer.cpp",
859 ]
860 deps = [
mtklein046cb562016-09-16 10:23:12 -0700861 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700862 ":flags",
863 "//third_party/libpng",
864 ]
865 public_deps = [
866 "//third_party/jsoncpp",
867 ]
868 }
mtklein25c81d42016-07-27 13:55:26 -0700869
Mike Klein6e744122016-10-27 12:21:40 -0400870 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700871 test_lib("gm") {
872 public_include_dirs = [ "gm" ]
873 sources = gm_sources
874 deps = [
scroggo19b91532016-10-24 09:03:26 -0700875 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700876 ":gpu_tool_utils",
877 ":skia",
878 ":tool_utils",
879 ]
880 }
mtklein25c81d42016-07-27 13:55:26 -0700881
Mike Klein6e744122016-10-27 12:21:40 -0400882 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700883 test_lib("tests") {
884 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400885 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700886 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400887 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700888 }
mtkleinc095df52016-08-24 12:23:52 -0700889 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700890 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700891 ":flags",
892 ":gpu_tool_utils",
893 ":skia",
894 ":tool_utils",
895 "//third_party/libpng",
896 "//third_party/zlib",
897 ]
898 }
mtklein2f3416d2016-08-02 16:02:05 -0700899
Mike Klein6e744122016-10-27 12:21:40 -0400900 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700901 test_lib("bench") {
902 public_include_dirs = [ "bench" ]
903 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700904 deps = [
905 ":flags",
906 ":gm",
907 ":gpu_tool_utils",
908 ":skia",
909 ":tool_utils",
910 ]
911 }
mtklein2b6870c2016-07-28 14:17:33 -0700912
mtkleinc095df52016-08-24 12:23:52 -0700913 test_lib("experimental_svg_model") {
914 public_include_dirs = [ "experimental/svg/model" ]
915 sources = [
916 "experimental/svg/model/SkSVGAttribute.cpp",
917 "experimental/svg/model/SkSVGAttributeParser.cpp",
918 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -0500919 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700920 "experimental/svg/model/SkSVGContainer.cpp",
921 "experimental/svg/model/SkSVGDOM.cpp",
922 "experimental/svg/model/SkSVGEllipse.cpp",
923 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700924 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700925 "experimental/svg/model/SkSVGNode.cpp",
926 "experimental/svg/model/SkSVGPath.cpp",
927 "experimental/svg/model/SkSVGPoly.cpp",
928 "experimental/svg/model/SkSVGRect.cpp",
929 "experimental/svg/model/SkSVGRenderContext.cpp",
930 "experimental/svg/model/SkSVGSVG.cpp",
931 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700932 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700933 "experimental/svg/model/SkSVGTransformableNode.cpp",
934 "experimental/svg/model/SkSVGValue.cpp",
935 ]
936 deps = [
937 ":skia",
938 ]
939 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700940
Brian Osman16adfa32016-10-18 14:42:44 -0400941 test_lib("views") {
942 public_include_dirs = [ "include/views" ]
943 sources = [
944 "src/views/SkEvent.cpp",
945 "src/views/SkEventSink.cpp",
946 "src/views/SkOSMenu.cpp",
947 "src/views/SkTagList.cpp",
948 "src/views/SkTouchGesture.cpp",
949 "src/views/SkView.cpp",
950 "src/views/SkViewPriv.cpp",
951 ]
952 libs = []
Brian Osman34755e22016-12-05 09:46:02 -0500953 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -0400954 if (!is_android) {
955 sources += [ "src/views/SkWindow.cpp" ]
956 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400957 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400958 public_include_dirs += [ "src/views/unix" ]
959 sources += [
960 "src/views/unix/SkOSWindow_Unix.cpp",
961 "src/views/unix/keysym2ucs.c",
962 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400963 } else if (is_mac) {
964 sources += [
965 "src/views/mac/SkEventNotifier.mm",
966 "src/views/mac/SkNSView.mm",
967 "src/views/mac/SkOSWindow_Mac.mm",
968 "src/views/mac/SkTextFieldCell.m",
969 ]
970 libs += [
971 "QuartzCore.framework",
972 "Cocoa.framework",
973 "Foundation.framework",
974 ]
975 } else if (is_win) {
976 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
977 }
Brian Osman34755e22016-12-05 09:46:02 -0500978 if (skia_use_angle) {
979 deps += [ "//third_party/angle2" ]
980 }
Brian Osman16adfa32016-10-18 14:42:44 -0400981 }
982
Mike Klein38af9432016-11-11 11:39:44 -0500983 if (skia_use_lua) {
984 test_lib("lua") {
985 public_include_dirs = []
986 sources = [
987 "src/utils/SkLua.cpp",
988 "src/utils/SkLuaCanvas.cpp",
989 ]
990 deps = [
991 "//third_party/lua",
992 ]
993 }
994
995 executable("lua_app") {
996 sources = [
997 "tools/lua/lua_app.cpp",
998 ]
999 deps = [
1000 ":lua",
1001 ":skia",
1002 "//third_party/lua",
1003 ]
1004 testonly = true
1005 }
1006
1007 executable("lua_pictures") {
1008 sources = [
1009 "tools/lua/lua_pictures.cpp",
1010 ]
1011 deps = [
1012 ":flags",
1013 ":lua",
1014 ":skia",
1015 ":tool_utils",
1016 "//third_party/lua",
1017 ]
1018 testonly = true
1019 }
1020 }
1021
Mike Klein6e744122016-10-27 12:21:40 -04001022 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001023 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001024 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001025 include_dirs = [ "experimental" ]
1026 sources = samples_sources + [
1027 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1028 "experimental/SkSetPoly3To3.cpp",
1029 "experimental/SkSetPoly3To3_A.cpp",
1030 "experimental/SkSetPoly3To3_D.cpp",
1031 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001032 deps = [
1033 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001034 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001035 ":tool_utils",
1036 ":views",
1037 ":xml",
1038 ]
Mike Klein38af9432016-11-11 11:39:44 -05001039
1040 if (skia_use_lua) {
1041 sources += [ "samplecode/SampleLua.cpp" ]
1042 deps += [
1043 ":lua",
1044 "//third_party/lua",
1045 ]
1046 }
Brian Osman16adfa32016-10-18 14:42:44 -04001047 }
1048
mtklein2b6870c2016-07-28 14:17:33 -07001049 executable("dm") {
1050 sources = [
1051 "dm/DM.cpp",
1052 "dm/DMJsonWriter.cpp",
1053 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001054 ]
1055 include_dirs = [ "tests" ]
1056 deps = [
mtklein046cb562016-09-16 10:23:12 -07001057 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001058 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001059 ":flags",
1060 ":gm",
1061 ":gpu_tool_utils",
1062 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001063 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001064 ":tool_utils",
1065 "//third_party/jsoncpp",
1066 "//third_party/libpng",
1067 ]
1068 testonly = true
1069 }
1070
Mike Kleina3430172016-09-27 16:46:29 -04001071 if (!is_debug) { # I've benchmarked debug code once too many times...
1072 executable("monobench") {
1073 sources = [
1074 "tools/monobench.cpp",
1075 ]
1076 deps = [
1077 ":bench",
1078 ":skia",
1079 ]
1080 testonly = true
1081 }
mtklein2b6870c2016-07-28 14:17:33 -07001082 }
1083
1084 executable("nanobench") {
1085 sources = [
1086 "bench/nanobench.cpp",
1087 ]
1088 deps = [
1089 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001090 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001091 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001092 ":flags",
1093 ":gm",
1094 ":gpu_tool_utils",
1095 ":skia",
1096 ":tool_utils",
1097 "//third_party/jsoncpp",
1098 ]
1099 testonly = true
1100 }
halcanary19a97202016-08-03 15:08:04 -07001101
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001102 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001103 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001104 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001105 "samplecode/SampleApp.cpp",
1106 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001107 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001108 if (is_mac) {
1109 sources += [ "src/views/mac/skia_mac.mm" ]
1110 } else if (is_win) {
1111 sources += [ "src/views/win/skia_win.cpp" ]
1112 } else if (is_linux) {
1113 sources += [ "src/views/unix/skia_unix.cpp" ]
1114 }
mtklein38925aa2016-09-21 10:11:25 -07001115 deps = [
1116 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001117 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001118 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001119 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001120 ":skia",
1121 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001122 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001123 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001124 if (skia_use_angle) {
1125 deps += [ "//third_party/angle2" ]
1126 }
mtklein38925aa2016-09-21 10:11:25 -07001127 testonly = true
1128 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001129 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001130
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001131 if (skia_enable_gpu) {
1132 executable("skpbench") {
1133 sources = [
1134 "tools/skpbench/skpbench.cpp",
1135 ]
1136 deps = [
1137 ":flags",
1138 ":gpu_tool_utils",
1139 ":skia",
1140 ":tool_utils",
1141 ]
1142 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001143 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001144 }
1145
Mike Klein7d302882016-11-03 14:06:31 -04001146 # We can't yet build ICU on iOS or Windows.
1147 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001148 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001149 sources = [
1150 "tools/SkShaper_harfbuzz.cpp",
1151 "tools/using_skia_and_harfbuzz.cpp",
1152 ]
1153 deps = [
1154 ":skia",
1155 "//third_party/harfbuzz",
1156 ]
1157 testonly = true
1158 }
halcanary19a97202016-08-03 15:08:04 -07001159 }
halcanary3eee9d92016-09-10 07:01:53 -07001160 executable("sktexttopdf") {
1161 sources = [
1162 "tools/SkShaper_primitive.cpp",
1163 "tools/using_skia_and_harfbuzz.cpp",
1164 ]
1165 deps = [
1166 ":skia",
1167 ]
1168 testonly = true
1169 }
mtklein046cb562016-09-16 10:23:12 -07001170
1171 executable("get_images_from_skps") {
1172 sources = [
1173 "tools/get_images_from_skps.cpp",
1174 ]
1175 deps = [
1176 ":flags",
1177 ":skia",
1178 "//third_party/jsoncpp",
1179 ]
1180 testonly = true
1181 }
mtkleinecbc5262016-09-22 11:51:24 -07001182
Matt Sarett8740d582016-11-11 13:59:14 -05001183 executable("colorspaceinfo") {
1184 sources = [
1185 "tools/colorspaceinfo.cpp",
1186 ]
1187 deps = [
1188 ":flags",
1189 ":skia",
1190 ":tool_utils",
1191 ]
1192 testonly = true
1193 }
1194
Mike Klein7d302882016-11-03 14:06:31 -04001195 if (!is_ios) {
1196 executable("skiaserve") {
1197 sources = [
1198 "tools/skiaserve/Request.cpp",
1199 "tools/skiaserve/Response.cpp",
1200 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001201 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1202 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1203 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1204 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1205 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1206 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1207 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1208 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1209 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001210 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1211 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001212 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1213 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1214 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1215 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1216 ]
1217 deps = [
1218 ":flags",
1219 ":gpu_tool_utils",
1220 ":skia",
1221 ":tool_utils",
1222 "//third_party/jsoncpp",
1223 "//third_party/libmicrohttpd",
1224 "//third_party/libpng",
1225 ]
1226 testonly = true
1227 }
mtkleinecbc5262016-09-22 11:51:24 -07001228 }
kjlubick14f984b2016-10-03 11:49:45 -07001229
1230 executable("fuzz") {
1231 sources = [
1232 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001233 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001234 "fuzz/FuzzGradients.cpp",
1235 "fuzz/FuzzParsePath.cpp",
1236 "fuzz/FuzzPathop.cpp",
1237 "fuzz/FuzzScaleToSides.cpp",
1238 "fuzz/fuzz.cpp",
1239 ]
1240 deps = [
1241 ":flags",
1242 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001243 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001244 ]
1245 testonly = true
1246 }
Mike Klein38312422016-10-05 15:41:01 -04001247
caryclark9feb6322016-10-25 08:58:26 -07001248 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001249 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001250 rebase_path("tests/skia_test.cpp"),
1251 rebase_path("tests/Test.cpp"),
1252 ]
caryclark9feb6322016-10-25 08:58:26 -07001253 deps = [
1254 ":flags",
1255 ":gpu_tool_utils",
1256 ":skia",
1257 ":tool_utils",
1258 ]
1259 testonly = true
1260 }
1261
Mike Klein38312422016-10-05 15:41:01 -04001262 executable("dump_record") {
1263 sources = [
1264 "tools/DumpRecord.cpp",
1265 "tools/dump_record.cpp",
1266 ]
1267 deps = [
1268 ":flags",
1269 ":skia",
1270 ]
1271 testonly = true
1272 }
bungemanfe917272016-10-13 17:36:40 -04001273
1274 executable("skdiff") {
1275 sources = [
1276 "tools/skdiff/skdiff.cpp",
1277 "tools/skdiff/skdiff_html.cpp",
1278 "tools/skdiff/skdiff_main.cpp",
1279 "tools/skdiff/skdiff_utils.cpp",
1280 ]
1281 deps = [
1282 ":skia",
1283 ":tool_utils",
1284 ]
1285 testonly = true
1286 }
halcanarya73d76a2016-10-17 13:19:02 -07001287
1288 executable("skp_parser") {
1289 sources = [
1290 "tools/skp_parser.cpp",
1291 ]
1292 deps = [
1293 ":skia",
1294 ":tool_utils",
1295 "//third_party/jsoncpp",
1296 ]
1297 testonly = true
1298 }
Brian Osman16adfa32016-10-18 14:42:44 -04001299
Mike Kleina92c3832016-12-08 09:49:39 -05001300 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
1301 source_set("viewer_sources") {
Brian Osman16adfa32016-10-18 14:42:44 -04001302 sources = [
1303 "tools/viewer/GMSlide.cpp",
1304 "tools/viewer/ImageSlide.cpp",
1305 "tools/viewer/SKPSlide.cpp",
1306 "tools/viewer/SampleSlide.cpp",
1307 "tools/viewer/Viewer.cpp",
1308 "tools/viewer/sk_app/CommandSet.cpp",
1309 "tools/viewer/sk_app/GLWindowContext.cpp",
1310 "tools/viewer/sk_app/Window.cpp",
1311 "tools/viewer/sk_app/WindowContext.cpp",
1312 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001313 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001314
Jim Van Verth4e56a912016-10-21 10:58:52 -04001315 if (is_android) {
1316 sources += [
1317 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1318 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1319 "tools/viewer/sk_app/android/Window_android.cpp",
1320 "tools/viewer/sk_app/android/main_android.cpp",
1321 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1322 ]
1323 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001324 sources += [
1325 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1326 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1327 "tools/viewer/sk_app/unix/Window_unix.cpp",
1328 "tools/viewer/sk_app/unix/main_unix.cpp",
1329 ]
1330 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001331 sources += [
1332 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1333 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1334 "tools/viewer/sk_app/win/Window_win.cpp",
1335 "tools/viewer/sk_app/win/main_win.cpp",
1336 ]
Mike Klein43c25262016-10-20 10:17:47 -04001337 } else if (is_mac) {
1338 sources += [
1339 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1340 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1341 "tools/viewer/sk_app/mac/Window_mac.cpp",
1342 "tools/viewer/sk_app/mac/main_mac.cpp",
1343 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001344 }
1345
1346 if (skia_use_vulkan) {
1347 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001348 if (is_android) {
1349 sources +=
1350 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1351 libs += [ "android" ]
1352 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001353 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1354 libs += [ "X11-xcb" ]
1355 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001356 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1357 }
1358 }
1359
1360 include_dirs = []
1361 deps = [
1362 ":flags",
1363 ":gm",
1364 ":gpu_tool_utils",
1365 ":samples",
1366 ":skia",
1367 ":tool_utils",
1368 ":views",
1369 "//third_party/jsoncpp",
1370 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001371 if (is_android) {
1372 deps += [ "//third_party/native_app_glue" ]
1373 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001374 deps += [ "//third_party/libsdl" ]
1375 }
Brian Osman16adfa32016-10-18 14:42:44 -04001376 testonly = true
1377 }
Mike Kleina92c3832016-12-08 09:49:39 -05001378
1379 if (is_android) {
1380 shared_library("libviewer") {
1381 deps = [
1382 ":viewer_sources",
1383 ]
1384 testonly = true
1385 }
1386 } else {
1387 executable("viewer") {
1388 deps = [
1389 ":viewer_sources",
1390 ]
1391 testonly = true
1392 }
1393 }
Brian Osman16adfa32016-10-18 14:42:44 -04001394 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001395
1396 if (skia_enable_gpu) {
1397 executable("skslc") {
1398 sources = [
1399 "src/sksl/SkSLMain.cpp",
1400 ]
1401 deps = [
1402 ":flags",
1403 ":skia",
1404 ]
1405 testonly = true
1406 }
1407 }
mtklein25c81d42016-07-27 13:55:26 -07001408}