blob: 224453047e5c5f03b1a6184def814df99924380c [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() {
mtkleind68f9b02016-09-23 13:18:41 -070014 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 Klein10d665d2016-11-01 11:46:10 -040019 skia_use_icu = !is_fuchsia && !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
mtkleina627b5c2016-09-20 13:36:47 -070023 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040024 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070025 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070026
27 skia_enable_android_framework_defines = false
mtklein06c35c02016-09-20 12:28:12 -070028 skia_enable_gpu = true
mtklein3e8012e2016-09-21 09:14:19 -070029 skia_enable_tools = is_skia_standalone
30 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040031 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070032}
Brian Salomon23d73ea2016-10-27 13:31:37 -040033declare_args() {
Mike Klein10d665d2016-11-01 11:46:10 -040034 skia_use_dng_sdk = !is_win && skia_use_libjpeg_turbo && skia_use_zlib
35 skia_use_sfntly = skia_use_icu
36
Mike Klein4d598a32016-10-31 13:44:49 -040037 if (is_android) {
38 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
39 } else {
40 skia_use_vulkan = skia_vulkan_sdk != ""
41 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040042}
Brian Salomon789e25e2016-09-30 13:41:03 -040043
mtklein38925aa2016-09-21 10:11:25 -070044# Our tools require static linking (they use non-exported symbols).
45skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070046
mtkleina45be612016-08-29 15:22:10 -070047fontmgr_android_enabled = skia_use_expat && skia_use_freetype
48
mtklein1211e0c2016-07-26 13:55:45 -070049skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070050 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070051 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070052 "include/codec",
53 "include/config",
54 "include/core",
55 "include/effects",
56 "include/gpu",
57 "include/gpu/gl",
58 "include/images",
59 "include/pathops",
60 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070061 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070062 "include/utils",
63 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070064 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070065]
66
mtkleinc04ff472016-06-23 10:29:30 -070067# Skia public API, generally provided by :skia.
68config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070069 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040070 defines = []
71 if (is_component_build) {
72 defines += [ "SKIA_DLL" ]
73 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040074 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070075 defines += [ "SK_SAMPLES_FOR_X" ]
76 }
mtkleincae1be52016-09-20 08:24:34 -070077 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040078 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070079 }
mtklein06c35c02016-09-20 12:28:12 -070080 if (!skia_enable_gpu) {
81 defines += [ "SK_SUPPORT_GPU=0" ]
82 }
mtkleinc04ff472016-06-23 10:29:30 -070083}
84
85# Skia internal APIs, used by Skia itself and a few test tools.
86config("skia_private") {
87 visibility = [ ":*" ]
88
89 include_dirs = [
90 "include/private",
91 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070092 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070093 "src/config",
94 "src/core",
95 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070096 "src/effects/gradients",
97 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070098 "src/gpu",
99 "src/image",
100 "src/images",
101 "src/lazy",
102 "src/opts",
103 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700104 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700105 "src/ports",
106 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700107 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700108 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700109 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700111 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700112 "third_party/ktx",
113 ]
mtklein150d1132016-08-01 06:56:40 -0700114
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400115 defines = [
116 "SK_GAMMA_APPLY_TO_A8",
117 "SK_INTERNAL",
118 ]
mtkleinb37c0342016-09-09 11:07:45 -0700119 if (is_android) {
120 defines += [
121 "SK_GAMMA_EXPONENT=1.4",
122 "SK_GAMMA_CONTRAST=0.0",
123 ]
124 }
mtklein88a7ac02016-09-14 11:16:49 -0700125 if (is_official_build || is_android) {
126 # TODO(bsalomon): it'd be nice to make Android normal.
127 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
128 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400129 libs = []
130 lib_dirs = []
131 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400132 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400133 if (is_win) {
134 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
135 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
136 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400137 include_dirs += [ "$skia_vulkan_sdk/include/" ]
138 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400139 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400140 }
Mike Klein487bfc22016-10-14 14:04:56 -0400141 if (is_win) {
142 libs += [ "vulkan-1.lib" ]
143 } else {
144 libs += [ "vulkan" ]
145 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400146 }
mtkleinc04ff472016-06-23 10:29:30 -0700147}
148
149# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
150config("skia_library") {
151 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700152 defines = [ "SKIA_IMPLEMENTATION=1" ]
153}
154
155skia_library_configs = [
156 ":skia_public",
157 ":skia_private",
158 ":skia_library",
159]
160
mtklein9b8583d2016-08-24 17:32:30 -0700161# Use for CPU-specific Skia code that needs particular compiler flags.
162template("opts") {
163 if (invoker.enabled) {
164 source_set(target_name) {
165 forward_variables_from(invoker, "*")
166 configs += skia_library_configs
167 }
168 } else {
169 # If not enabled, a phony empty target that swallows all otherwise unused variables.
170 source_set(target_name) {
171 forward_variables_from(invoker,
172 "*",
173 [
174 "sources",
175 "cflags",
176 ])
177 }
178 }
anmittala7eaf2e2016-08-17 13:57:26 -0700179}
180
mtklein422310d2016-08-16 18:28:43 -0700181is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700182
mtklein7d6fb2c2016-08-25 14:50:44 -0700183opts("none") {
184 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700185 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700186 cflags = []
187}
188
mtklein7d6fb2c2016-08-25 14:50:44 -0700189opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700190 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700191 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700192 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700193}
194
195opts("arm64") {
196 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700197 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700198 cflags = []
199}
200
201opts("crc32") {
202 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700203 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700204 cflags = [ "-march=armv8-a+crc" ]
205}
206
mtklein9b8583d2016-08-24 17:32:30 -0700207opts("sse2") {
208 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700209 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400210 if (is_win) {
211 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
212 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400213 cflags = [ "-msse2" ]
214 }
mtklein9b8583d2016-08-24 17:32:30 -0700215}
mtkleinc04ff472016-06-23 10:29:30 -0700216
mtklein9b8583d2016-08-24 17:32:30 -0700217opts("ssse3") {
218 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700219 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400220 if (is_win) {
221 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
222 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400223 cflags = [ "-mssse3" ]
224 }
mtklein9b8583d2016-08-24 17:32:30 -0700225}
mtkleinc04ff472016-06-23 10:29:30 -0700226
mtklein9b8583d2016-08-24 17:32:30 -0700227opts("sse41") {
228 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400230 if (is_win) {
231 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
232 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400233 cflags = [ "-msse4.1" ]
234 }
mtklein9b8583d2016-08-24 17:32:30 -0700235}
mtklein4e976072016-08-08 09:06:27 -0700236
mtklein9b8583d2016-08-24 17:32:30 -0700237opts("sse42") {
238 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400240 if (is_win) {
241 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
242 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400243 cflags = [ "-msse4.2" ]
244 }
mtklein9b8583d2016-08-24 17:32:30 -0700245}
246
247opts("avx") {
248 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400250 if (is_win) {
251 cflags = [ "/arch:AVX" ]
252 } else {
253 cflags = [ "-mavx" ]
254 }
mtkleinc04ff472016-06-23 10:29:30 -0700255}
256
Mike Klein78d5a3b2016-09-30 10:48:01 -0400257opts("hsw") {
258 enabled = is_x86
259 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400260 if (is_win) {
261 cflags = [ "/arch:AVX2" ]
262 } else {
263 cflags = [
264 "-mavx2",
265 "-mbmi",
266 "-mbmi2",
267 "-mf16c",
268 "-mfma",
269 ]
270 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400271}
272
mtklein349cece2016-08-26 08:13:04 -0700273opts("dsp") {
274 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700275 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700276 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700277}
278
mtkleinc095df52016-08-24 12:23:52 -0700279# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700280template("optional") {
281 if (invoker.enabled) {
282 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700283 if (defined(invoker.public_defines)) {
284 defines = invoker.public_defines
285 }
mtklein457b42a2016-08-23 13:56:37 -0700286 }
287 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700288 forward_variables_from(invoker,
289 "*",
290 [
291 "public_defines",
292 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700293 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700294 ])
mtklein457b42a2016-08-23 13:56:37 -0700295 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700296 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700297 if (defined(invoker.configs_to_remove)) {
298 configs -= invoker.configs_to_remove
299 }
mtklein457b42a2016-08-23 13:56:37 -0700300 }
301 } else {
mtklein457b42a2016-08-23 13:56:37 -0700302 source_set(target_name) {
303 forward_variables_from(invoker,
304 "*",
305 [
306 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700307 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700308 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700309 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700310 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700311 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700312 ])
mtkleincd01b032016-08-31 04:58:19 -0700313 if (defined(invoker.sources_when_disabled)) {
314 sources = invoker.sources_when_disabled
315 }
316 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700317 }
mtkleineb3c4252016-08-23 07:38:09 -0700318 }
mtklein457b42a2016-08-23 13:56:37 -0700319}
mtklein457b42a2016-08-23 13:56:37 -0700320
mtkleina45be612016-08-29 15:22:10 -0700321optional("fontmgr_android") {
322 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700323
324 deps = [
325 "//third_party/expat",
326 "//third_party/freetype2",
327 ]
328 sources = [
329 "src/ports/SkFontMgr_android.cpp",
330 "src/ports/SkFontMgr_android_factory.cpp",
331 "src/ports/SkFontMgr_android_parser.cpp",
332 ]
333}
334
mtkleind2e39db2016-09-07 07:52:55 -0700335optional("fontmgr_custom") {
336 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
337
338 deps = [
339 "//third_party/freetype2",
340 ]
341 sources = [
342 "src/ports/SkFontMgr_custom.cpp",
343 "src/ports/SkFontMgr_custom_directory_factory.cpp",
344 ]
345}
346
mtklein3cc22182016-08-29 13:26:14 -0700347optional("fontmgr_fontconfig") {
348 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700349
350 deps = [
351 "//third_party:fontconfig",
352 "//third_party/freetype2",
353 ]
354 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700355 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700356 "src/ports/SkFontConfigInterface_direct.cpp",
357 "src/ports/SkFontConfigInterface_direct_factory.cpp",
358 "src/ports/SkFontMgr_FontConfigInterface.cpp",
359 "src/ports/SkFontMgr_fontconfig.cpp",
360 "src/ports/SkFontMgr_fontconfig_factory.cpp",
361 ]
362}
363
mtkleincdedd0e2016-09-12 15:15:44 -0700364optional("fontmgr_fuchsia") {
365 enabled = is_fuchsia && skia_use_freetype
366
367 deps = [
368 "//third_party/freetype2",
369 ]
370 sources = [
371 "src/ports/SkFontMgr_custom.cpp",
372 "src/ports/SkFontMgr_custom_empty_factory.cpp",
373 ]
374}
375
mtklein06c35c02016-09-20 12:28:12 -0700376optional("gpu") {
377 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700378 public_defines = []
379
mtklein06c35c02016-09-20 12:28:12 -0700380 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
381
382 # These paths need to be absolute to match the ones produced by shared_sources.gni.
383 sources -= get_path_info([
384 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
385 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
386 ],
387 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400388 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700389 if (is_android) {
390 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
391 } else if (is_linux) {
392 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
393 } else if (is_mac) {
394 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.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
mtklein63213812016-08-24 09:55:56 -0700504
mtklein63213812016-08-24 09:55:56 -0700505 deps = [
506 "//third_party/expat",
507 ]
508 sources = [
509 "src/xml/SkDOM.cpp",
510 "src/xml/SkXMLParser.cpp",
511 "src/xml/SkXMLWriter.cpp",
512 ]
513}
514
mtkleinc04ff472016-06-23 10:29:30 -0700515component("skia") {
516 public_configs = [ ":skia_public" ]
517 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700518
519 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700520 ":arm64",
521 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700522 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700523 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700524 ":dsp",
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
mtkleinc04ff472016-06-23 10:29:30 -0700545 sources = []
brettwb9447282016-09-01 14:24:39 -0700546 sources += skia_core_sources
547 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700548 sources += skia_sksl_sources
549 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700550 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700551 "src/android/SkBitmapRegionCodec.cpp",
552 "src/android/SkBitmapRegionDecoder.cpp",
553 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700554 "src/codec/SkBmpCodec.cpp",
555 "src/codec/SkBmpMaskCodec.cpp",
556 "src/codec/SkBmpRLECodec.cpp",
557 "src/codec/SkBmpStandardCodec.cpp",
558 "src/codec/SkCodec.cpp",
559 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700560 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700561 "src/codec/SkMaskSwizzler.cpp",
562 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700563 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700564 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700565 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700566 "src/codec/SkSwizzler.cpp",
567 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700568 "src/images/SkImageEncoder.cpp",
569 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700570 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700571 "src/ports/SkDiscardableMemory_none.cpp",
572 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700573 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700574 "src/ports/SkMemory_malloc.cpp",
575 "src/ports/SkOSFile_stdio.cpp",
576 "src/sfnt/SkOTTable_name.cpp",
577 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700578 "src/svg/SkSVGCanvas.cpp",
579 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700580 "src/utils/mac/SkStream_mac.cpp",
581 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700582 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700583 "third_party/ktx/ktx.cpp",
584 ]
brettwb9447282016-09-01 14:24:39 -0700585
mtklein7d6fb2c2016-08-25 14:50:44 -0700586 libs = []
587
mtkleinc04ff472016-06-23 10:29:30 -0700588 if (is_win) {
589 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400590 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700591 "src/ports/SkDebug_win.cpp",
592 "src/ports/SkFontHost_win.cpp",
593 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700594 "src/ports/SkImageEncoder_WIC.cpp",
595 "src/ports/SkImageGeneratorWIC.cpp",
596 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700597 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700598 "src/ports/SkScalerContext_win_dw.cpp",
599 "src/ports/SkTLS_win.cpp",
600 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700601 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400602 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700603 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400604 if (skia_use_gdi) {
605 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
606 libs += [
607 "Gdi32.lib",
608 "Usp10.lib",
609 ]
610 } else {
611 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
612 }
mtkleinb9be9792016-09-16 14:44:18 -0700613 sources -=
614 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400615 libs += [
616 "FontSub.lib",
617 "Ole32.lib",
618 "OleAut32.lib",
619 "User32.lib",
620 ]
mtkleinc04ff472016-06-23 10:29:30 -0700621 } else {
622 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700623 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700624 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700625 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700626 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700627 ]
628 }
629
mtklein7d6fb2c2016-08-25 14:50:44 -0700630 if (is_android) {
631 deps += [
632 "//third_party/cpu-features",
633 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700634 ]
mtklein06c35c02016-09-20 12:28:12 -0700635 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700636 libs += [
637 "EGL",
638 "GLESv2",
639 "log",
640 ]
641 }
642
mtkleinc04ff472016-06-23 10:29:30 -0700643 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700644 libs += [
645 "GL",
646 "GLU",
647 "X11",
648 ]
mtklein06c35c02016-09-20 12:28:12 -0700649 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700650 }
651
652 if (is_mac) {
653 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700654 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700655 "src/ports/SkFontHost_mac.cpp",
656 "src/ports/SkImageEncoder_CG.cpp",
657 "src/ports/SkImageGeneratorCG.cpp",
658 ]
mtklein09e61f72016-08-23 13:35:28 -0700659 libs += [
660 "ApplicationServices.framework",
661 "OpenGL.framework",
662 ]
mtkleinc04ff472016-06-23 10:29:30 -0700663 }
abarth6fc8ff02016-07-15 15:15:15 -0700664
665 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700666 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700667 }
mtkleinc04ff472016-06-23 10:29:30 -0700668}
669
mtkleinada5a442016-08-02 14:28:26 -0700670skia_h_headers = exec_script("gyp/find.py",
671 [ "*.h" ] + rebase_path(skia_public_includes),
672 "list lines",
673 []) -
674 [
675 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
676 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
677 rebase_path("include/gpu/vk/GrVkDefines.h"),
678 rebase_path("include/gpu/vk/GrVkInterface.h"),
679 rebase_path("include/gpu/vk/GrVkTypes.h"),
680 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
681 ]
682
mtklein1211e0c2016-07-26 13:55:45 -0700683action("skia.h") {
684 script = "gn/echo_headers.py"
685 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700686 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400687 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700688 outputs = [
689 "$target_gen_dir/skia.h",
690 ]
691}
692
mtklein06c35c02016-09-20 12:28:12 -0700693if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700694 # Our bots only have 64-bit libOSMesa installed.
695 # TODO: worth fixing?
696 executable("fiddle") {
697 include_dirs = [ "$target_gen_dir" ]
698 libs = []
699 if (is_linux) {
700 libs += [ "OSMesa" ]
701 }
mtklein56d56692016-09-15 11:18:55 -0700702
mtklein1fbdf982016-09-15 12:07:48 -0700703 sources = [
704 "src/images/SkForceLinking.cpp",
705 "tools/fiddle/draw.cpp",
706 "tools/fiddle/fiddle_main.cpp",
707 ]
708 deps = [
709 ":skia",
710 ":skia.h",
711 ]
712 }
mtkleinc04ff472016-06-23 10:29:30 -0700713}
mtklein25c81d42016-07-27 13:55:26 -0700714
mtkleinc095df52016-08-24 12:23:52 -0700715# Targets guarded by skia_enable_tools may use //third_party freely.
716if (skia_enable_tools) {
717 template("test_lib") {
718 config(target_name + "_config") {
719 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700720 if (defined(invoker.public_defines)) {
721 defines = invoker.public_defines
722 }
mtklein25c81d42016-07-27 13:55:26 -0700723 }
mtkleinc095df52016-08-24 12:23:52 -0700724 source_set(target_name) {
725 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
726 public_configs = [
727 ":" + target_name + "_config",
728 ":skia_private",
729 ]
730
731 if (!defined(deps)) {
732 deps = []
733 }
734 deps += [ ":skia" ]
735 testonly = true
736 }
mtklein25c81d42016-07-27 13:55:26 -0700737 }
mtklein25c81d42016-07-27 13:55:26 -0700738
mtkleinc095df52016-08-24 12:23:52 -0700739 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700740 public_include_dirs = []
741 if (skia_enable_gpu) {
742 public_defines = []
743 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700744
745 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700746 sources = [
747 "tools/gpu/GrContextFactory.cpp",
748 "tools/gpu/GrTest.cpp",
749 "tools/gpu/TestContext.cpp",
750 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700751 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700752 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
753 "tools/gpu/gl/debug/GrBufferObj.cpp",
754 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
755 "tools/gpu/gl/debug/GrProgramObj.cpp",
756 "tools/gpu/gl/debug/GrShaderObj.cpp",
757 "tools/gpu/gl/debug/GrTextureObj.cpp",
758 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
759 "tools/gpu/gl/null/NullGLTestContext.cpp",
760 ]
761 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700762
mtklein38925aa2016-09-21 10:11:25 -0700763 if (is_android) {
764 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
765 } else if (is_linux) {
766 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
767 } else if (is_mac) {
768 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400769 } else if (is_win) {
770 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
771 libs += [
772 "Gdi32.lib",
773 "OpenGL32.lib",
774 ]
mtklein38925aa2016-09-21 10:11:25 -0700775 }
mtklein6ef69992016-09-14 06:12:09 -0700776
mtkleind68f9b02016-09-23 13:18:41 -0700777 if (skia_use_angle) {
778 public_defines += [ "SK_ANGLE" ]
779 deps += [ "//third_party/angle2" ]
780 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700781 }
782 if (skia_use_mesa) {
783 public_defines += [ "SK_MESA" ]
784 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
785 libs += [ "OSMesa" ]
786 }
mtkleind68f9b02016-09-23 13:18:41 -0700787 if (skia_use_vulkan) {
788 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
789 }
mtkleina627b5c2016-09-20 13:36:47 -0700790 }
mtklein25c81d42016-07-27 13:55:26 -0700791 }
mtklein25c81d42016-07-27 13:55:26 -0700792
mtkleinc095df52016-08-24 12:23:52 -0700793 test_lib("flags") {
794 public_include_dirs = [ "tools/flags" ]
795 sources = [
796 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700797 ]
798 }
799 test_lib("common_flags") {
800 public_include_dirs = [ "tools/flags" ]
801 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700802 "tools/flags/SkCommonFlags.cpp",
803 "tools/flags/SkCommonFlagsConfig.cpp",
804 ]
805 deps = [
mtklein046cb562016-09-16 10:23:12 -0700806 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700807 ":gpu_tool_utils",
808 ]
809 }
mtklein25c81d42016-07-27 13:55:26 -0700810
mtkleinc095df52016-08-24 12:23:52 -0700811 test_lib("tool_utils") {
812 public_include_dirs = [
813 "tools",
814 "tools/debugger",
815 "tools/timer",
816 ]
817 sources = [
818 "src/images/SkForceLinking.cpp",
819 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700820 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700821 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700822 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700823 "tools/ProcStats.cpp",
824 "tools/Resources.cpp",
825 "tools/ThermalManager.cpp",
826 "tools/UrlDataManager.cpp",
827 "tools/debugger/SkDebugCanvas.cpp",
828 "tools/debugger/SkDrawCommand.cpp",
829 "tools/debugger/SkJsonWriteBuffer.cpp",
830 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700831 "tools/picture_utils.cpp",
832 "tools/random_parse_path.cpp",
833 "tools/sk_tool_utils.cpp",
834 "tools/sk_tool_utils_font.cpp",
835 "tools/timer/Timer.cpp",
836 ]
837 deps = [
mtklein046cb562016-09-16 10:23:12 -0700838 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700839 ":flags",
840 "//third_party/libpng",
841 ]
842 public_deps = [
843 "//third_party/jsoncpp",
844 ]
845 }
mtklein25c81d42016-07-27 13:55:26 -0700846
Mike Klein6e744122016-10-27 12:21:40 -0400847 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700848 test_lib("gm") {
849 public_include_dirs = [ "gm" ]
850 sources = gm_sources
851 deps = [
scroggo19b91532016-10-24 09:03:26 -0700852 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700853 ":gpu_tool_utils",
854 ":skia",
855 ":tool_utils",
856 ]
857 }
mtklein25c81d42016-07-27 13:55:26 -0700858
Mike Klein6e744122016-10-27 12:21:40 -0400859 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700860 test_lib("tests") {
861 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400862 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700863 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400864 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700865 }
mtkleinc095df52016-08-24 12:23:52 -0700866 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700867 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700868 ":flags",
869 ":gpu_tool_utils",
870 ":skia",
871 ":tool_utils",
872 "//third_party/libpng",
873 "//third_party/zlib",
874 ]
875 }
mtklein2f3416d2016-08-02 16:02:05 -0700876
Mike Klein6e744122016-10-27 12:21:40 -0400877 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700878 test_lib("bench") {
879 public_include_dirs = [ "bench" ]
880 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700881 deps = [
882 ":flags",
883 ":gm",
884 ":gpu_tool_utils",
885 ":skia",
886 ":tool_utils",
887 ]
888 }
mtklein2b6870c2016-07-28 14:17:33 -0700889
mtkleinc095df52016-08-24 12:23:52 -0700890 test_lib("experimental_svg_model") {
891 public_include_dirs = [ "experimental/svg/model" ]
892 sources = [
893 "experimental/svg/model/SkSVGAttribute.cpp",
894 "experimental/svg/model/SkSVGAttributeParser.cpp",
895 "experimental/svg/model/SkSVGCircle.cpp",
896 "experimental/svg/model/SkSVGContainer.cpp",
897 "experimental/svg/model/SkSVGDOM.cpp",
898 "experimental/svg/model/SkSVGEllipse.cpp",
899 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700900 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700901 "experimental/svg/model/SkSVGNode.cpp",
902 "experimental/svg/model/SkSVGPath.cpp",
903 "experimental/svg/model/SkSVGPoly.cpp",
904 "experimental/svg/model/SkSVGRect.cpp",
905 "experimental/svg/model/SkSVGRenderContext.cpp",
906 "experimental/svg/model/SkSVGSVG.cpp",
907 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700908 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700909 "experimental/svg/model/SkSVGTransformableNode.cpp",
910 "experimental/svg/model/SkSVGValue.cpp",
911 ]
912 deps = [
913 ":skia",
914 ]
915 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700916
Brian Osman16adfa32016-10-18 14:42:44 -0400917 test_lib("views") {
918 public_include_dirs = [ "include/views" ]
919 sources = [
920 "src/views/SkEvent.cpp",
921 "src/views/SkEventSink.cpp",
922 "src/views/SkOSMenu.cpp",
923 "src/views/SkTagList.cpp",
924 "src/views/SkTouchGesture.cpp",
925 "src/views/SkView.cpp",
926 "src/views/SkViewPriv.cpp",
927 ]
928 libs = []
929 if (!is_android) {
930 sources += [ "src/views/SkWindow.cpp" ]
931 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400932 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400933 public_include_dirs += [ "src/views/unix" ]
934 sources += [
935 "src/views/unix/SkOSWindow_Unix.cpp",
936 "src/views/unix/keysym2ucs.c",
937 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400938 } else if (is_mac) {
939 sources += [
940 "src/views/mac/SkEventNotifier.mm",
941 "src/views/mac/SkNSView.mm",
942 "src/views/mac/SkOSWindow_Mac.mm",
943 "src/views/mac/SkTextFieldCell.m",
944 ]
945 libs += [
946 "QuartzCore.framework",
947 "Cocoa.framework",
948 "Foundation.framework",
949 ]
950 } else if (is_win) {
951 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
952 }
953 }
954
Mike Klein6e744122016-10-27 12:21:40 -0400955 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -0400956 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -0400957 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -0400958 include_dirs = [ "experimental" ]
959 sources = samples_sources + [
960 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
961 "experimental/SkSetPoly3To3.cpp",
962 "experimental/SkSetPoly3To3_A.cpp",
963 "experimental/SkSetPoly3To3_D.cpp",
964 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400965 deps = [
966 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -0400967 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -0400968 ":tool_utils",
969 ":views",
970 ":xml",
971 ]
972 }
973
mtklein2b6870c2016-07-28 14:17:33 -0700974 executable("dm") {
975 sources = [
976 "dm/DM.cpp",
977 "dm/DMJsonWriter.cpp",
978 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700979 ]
980 include_dirs = [ "tests" ]
981 deps = [
mtklein046cb562016-09-16 10:23:12 -0700982 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700983 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700984 ":flags",
985 ":gm",
986 ":gpu_tool_utils",
987 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700988 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700989 ":tool_utils",
990 "//third_party/jsoncpp",
991 "//third_party/libpng",
992 ]
993 testonly = true
994 }
995
Mike Kleina3430172016-09-27 16:46:29 -0400996 if (!is_debug) { # I've benchmarked debug code once too many times...
997 executable("monobench") {
998 sources = [
999 "tools/monobench.cpp",
1000 ]
1001 deps = [
1002 ":bench",
1003 ":skia",
1004 ]
1005 testonly = true
1006 }
mtklein2b6870c2016-07-28 14:17:33 -07001007 }
1008
1009 executable("nanobench") {
1010 sources = [
1011 "bench/nanobench.cpp",
1012 ]
1013 deps = [
1014 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001015 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001016 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001017 ":flags",
1018 ":gm",
1019 ":gpu_tool_utils",
1020 ":skia",
1021 ":tool_utils",
1022 "//third_party/jsoncpp",
1023 ]
1024 testonly = true
1025 }
halcanary19a97202016-08-03 15:08:04 -07001026
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001027 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001028 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001029 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001030 "samplecode/SampleApp.cpp",
1031 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001032 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001033 if (is_mac) {
1034 sources += [ "src/views/mac/skia_mac.mm" ]
1035 } else if (is_win) {
1036 sources += [ "src/views/win/skia_win.cpp" ]
1037 } else if (is_linux) {
1038 sources += [ "src/views/unix/skia_unix.cpp" ]
1039 }
mtklein38925aa2016-09-21 10:11:25 -07001040 deps = [
1041 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001042 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001043 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001044 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001045 ":skia",
1046 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001047 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001048 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001049 if (skia_use_angle) {
1050 deps += [ "//third_party/angle2" ]
1051 }
mtklein38925aa2016-09-21 10:11:25 -07001052 testonly = true
1053 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001054 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001055
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001056 if (skia_enable_gpu) {
1057 executable("skpbench") {
1058 sources = [
1059 "tools/skpbench/skpbench.cpp",
1060 ]
1061 deps = [
1062 ":flags",
1063 ":gpu_tool_utils",
1064 ":skia",
1065 ":tool_utils",
1066 ]
1067 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001068 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001069 }
1070
Mike Klein4b167fc2016-10-11 18:13:53 -04001071 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001072 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001073 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001074 sources = [
1075 "tools/SkShaper_harfbuzz.cpp",
1076 "tools/using_skia_and_harfbuzz.cpp",
1077 ]
1078 deps = [
1079 ":skia",
1080 "//third_party/harfbuzz",
1081 ]
1082 testonly = true
1083 }
halcanary19a97202016-08-03 15:08:04 -07001084 }
halcanary3eee9d92016-09-10 07:01:53 -07001085 executable("sktexttopdf") {
1086 sources = [
1087 "tools/SkShaper_primitive.cpp",
1088 "tools/using_skia_and_harfbuzz.cpp",
1089 ]
1090 deps = [
1091 ":skia",
1092 ]
1093 testonly = true
1094 }
mtklein046cb562016-09-16 10:23:12 -07001095
1096 executable("get_images_from_skps") {
1097 sources = [
1098 "tools/get_images_from_skps.cpp",
1099 ]
1100 deps = [
1101 ":flags",
1102 ":skia",
1103 "//third_party/jsoncpp",
1104 ]
1105 testonly = true
1106 }
mtkleinecbc5262016-09-22 11:51:24 -07001107
1108 executable("skiaserve") {
1109 sources = [
1110 "tools/skiaserve/Request.cpp",
1111 "tools/skiaserve/Response.cpp",
1112 "tools/skiaserve/skiaserve.cpp",
1113 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1114 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1115 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1116 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1117 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1118 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1119 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1120 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1121 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1122 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1123 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001124 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001125 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1126 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1127 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1128 ]
1129 deps = [
1130 ":flags",
1131 ":gpu_tool_utils",
1132 ":skia",
1133 ":tool_utils",
1134 "//third_party/jsoncpp",
1135 "//third_party/libmicrohttpd",
1136 "//third_party/libpng",
1137 ]
1138 testonly = true
1139 }
kjlubick14f984b2016-10-03 11:49:45 -07001140
1141 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001142 if (is_skia_standalone) {
1143 configs -= [ "//gn:no_exceptions" ]
1144 }
kjlubick14f984b2016-10-03 11:49:45 -07001145 sources = [
1146 "fuzz/FilterFuzz.cpp",
1147 "fuzz/FuzzGradients.cpp",
1148 "fuzz/FuzzParsePath.cpp",
1149 "fuzz/FuzzPathop.cpp",
1150 "fuzz/FuzzScaleToSides.cpp",
1151 "fuzz/fuzz.cpp",
1152 ]
1153 deps = [
1154 ":flags",
1155 ":skia",
1156 ]
1157 testonly = true
1158 }
Mike Klein38312422016-10-05 15:41:01 -04001159
caryclark9feb6322016-10-25 08:58:26 -07001160 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001161 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001162 rebase_path("tests/skia_test.cpp"),
1163 rebase_path("tests/Test.cpp"),
1164 ]
caryclark9feb6322016-10-25 08:58:26 -07001165 deps = [
1166 ":flags",
1167 ":gpu_tool_utils",
1168 ":skia",
1169 ":tool_utils",
1170 ]
1171 testonly = true
1172 }
1173
Mike Klein38312422016-10-05 15:41:01 -04001174 executable("dump_record") {
1175 sources = [
1176 "tools/DumpRecord.cpp",
1177 "tools/dump_record.cpp",
1178 ]
1179 deps = [
1180 ":flags",
1181 ":skia",
1182 ]
1183 testonly = true
1184 }
bungemanfe917272016-10-13 17:36:40 -04001185
1186 executable("skdiff") {
1187 sources = [
1188 "tools/skdiff/skdiff.cpp",
1189 "tools/skdiff/skdiff_html.cpp",
1190 "tools/skdiff/skdiff_main.cpp",
1191 "tools/skdiff/skdiff_utils.cpp",
1192 ]
1193 deps = [
1194 ":skia",
1195 ":tool_utils",
1196 ]
1197 testonly = true
1198 }
halcanarya73d76a2016-10-17 13:19:02 -07001199
1200 executable("skp_parser") {
1201 sources = [
1202 "tools/skp_parser.cpp",
1203 ]
1204 deps = [
1205 ":skia",
1206 ":tool_utils",
1207 "//third_party/jsoncpp",
1208 ]
1209 testonly = true
1210 }
Brian Osman16adfa32016-10-18 14:42:44 -04001211
Mike Klein43c25262016-10-20 10:17:47 -04001212 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001213 executable("viewer") {
1214 sources = [
1215 "tools/viewer/GMSlide.cpp",
1216 "tools/viewer/ImageSlide.cpp",
1217 "tools/viewer/SKPSlide.cpp",
1218 "tools/viewer/SampleSlide.cpp",
1219 "tools/viewer/Viewer.cpp",
1220 "tools/viewer/sk_app/CommandSet.cpp",
1221 "tools/viewer/sk_app/GLWindowContext.cpp",
1222 "tools/viewer/sk_app/Window.cpp",
1223 "tools/viewer/sk_app/WindowContext.cpp",
1224 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001225 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001226
Jim Van Verth4e56a912016-10-21 10:58:52 -04001227 if (is_android) {
1228 sources += [
1229 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1230 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1231 "tools/viewer/sk_app/android/Window_android.cpp",
1232 "tools/viewer/sk_app/android/main_android.cpp",
1233 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1234 ]
1235 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001236 sources += [
1237 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1238 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1239 "tools/viewer/sk_app/unix/Window_unix.cpp",
1240 "tools/viewer/sk_app/unix/main_unix.cpp",
1241 ]
1242 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001243 sources += [
1244 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1245 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1246 "tools/viewer/sk_app/win/Window_win.cpp",
1247 "tools/viewer/sk_app/win/main_win.cpp",
1248 ]
Mike Klein43c25262016-10-20 10:17:47 -04001249 } else if (is_mac) {
1250 sources += [
1251 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1252 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1253 "tools/viewer/sk_app/mac/Window_mac.cpp",
1254 "tools/viewer/sk_app/mac/main_mac.cpp",
1255 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001256 }
1257
1258 if (skia_use_vulkan) {
1259 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001260 if (is_android) {
1261 sources +=
1262 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1263 libs += [ "android" ]
1264 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001265 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1266 libs += [ "X11-xcb" ]
1267 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001268 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1269 }
1270 }
1271
1272 include_dirs = []
1273 deps = [
1274 ":flags",
1275 ":gm",
1276 ":gpu_tool_utils",
1277 ":samples",
1278 ":skia",
1279 ":tool_utils",
1280 ":views",
1281 "//third_party/jsoncpp",
1282 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001283 if (is_android) {
1284 deps += [ "//third_party/native_app_glue" ]
1285 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001286 deps += [ "//third_party/libsdl" ]
1287 }
Brian Osman16adfa32016-10-18 14:42:44 -04001288 testonly = true
1289 }
1290 }
mtklein25c81d42016-07-27 13:55:26 -07001291}