blob: f5ad42f865c0f7fb5fc893a20ee087f7617c9d33 [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
mtklein63213812016-08-24 09:55:56 -070019 skia_use_libjpeg_turbo = true
20 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070021 skia_use_libwebp = !is_fuchsia
mtkleina627b5c2016-09-20 13:36:47 -070022 skia_use_mesa = false
scroggof84ad642016-10-31 09:02:57 -070023 skia_use_raw = !is_win
Mike Kleinae7e6712016-10-11 17:49:33 -040024 skia_use_sfntly = !is_fuchsia && !is_win # TODO: icu on Windows, re-enable this.
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}
33
Brian Salomon23d73ea2016-10-27 13:31:37 -040034declare_args() {
Mike Klein4d598a32016-10-31 13:44:49 -040035 if (is_android) {
36 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
37 } else {
38 skia_use_vulkan = skia_vulkan_sdk != ""
39 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040040}
Brian Salomon789e25e2016-09-30 13:41:03 -040041
mtklein38925aa2016-09-21 10:11:25 -070042# Our tools require static linking (they use non-exported symbols).
43skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070044
mtkleina45be612016-08-29 15:22:10 -070045fontmgr_android_enabled = skia_use_expat && skia_use_freetype
46
mtklein1211e0c2016-07-26 13:55:45 -070047skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070048 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070049 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070050 "include/codec",
51 "include/config",
52 "include/core",
53 "include/effects",
54 "include/gpu",
55 "include/gpu/gl",
56 "include/images",
57 "include/pathops",
58 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070059 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070060 "include/utils",
61 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070062 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070063]
64
mtkleinc04ff472016-06-23 10:29:30 -070065# Skia public API, generally provided by :skia.
66config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070067 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040068 defines = []
69 if (is_component_build) {
70 defines += [ "SKIA_DLL" ]
71 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040072 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070073 defines += [ "SK_SAMPLES_FOR_X" ]
74 }
mtkleincae1be52016-09-20 08:24:34 -070075 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040076 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070077 }
mtklein06c35c02016-09-20 12:28:12 -070078 if (!skia_enable_gpu) {
79 defines += [ "SK_SUPPORT_GPU=0" ]
80 }
mtkleinc04ff472016-06-23 10:29:30 -070081}
82
83# Skia internal APIs, used by Skia itself and a few test tools.
84config("skia_private") {
85 visibility = [ ":*" ]
86
87 include_dirs = [
88 "include/private",
89 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070090 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070091 "src/config",
92 "src/core",
93 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070094 "src/effects/gradients",
95 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070096 "src/gpu",
97 "src/image",
98 "src/images",
99 "src/lazy",
100 "src/opts",
101 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700102 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700103 "src/ports",
104 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700105 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700106 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700107 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700108 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700109 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "third_party/ktx",
111 ]
mtklein150d1132016-08-01 06:56:40 -0700112
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400113 defines = [
114 "SK_GAMMA_APPLY_TO_A8",
115 "SK_INTERNAL",
116 ]
mtkleinb37c0342016-09-09 11:07:45 -0700117 if (is_android) {
118 defines += [
119 "SK_GAMMA_EXPONENT=1.4",
120 "SK_GAMMA_CONTRAST=0.0",
121 ]
122 }
mtklein88a7ac02016-09-14 11:16:49 -0700123 if (is_official_build || is_android) {
124 # TODO(bsalomon): it'd be nice to make Android normal.
125 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
126 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400127 libs = []
128 lib_dirs = []
129 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400130 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400131 if (is_win) {
132 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
133 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
134 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400135 include_dirs += [ "$skia_vulkan_sdk/include/" ]
136 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400137 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400138 }
Mike Klein487bfc22016-10-14 14:04:56 -0400139 if (is_win) {
140 libs += [ "vulkan-1.lib" ]
141 } else {
142 libs += [ "vulkan" ]
143 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400144 }
mtkleinc04ff472016-06-23 10:29:30 -0700145}
146
147# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
148config("skia_library") {
149 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700150 defines = [ "SKIA_IMPLEMENTATION=1" ]
151}
152
153skia_library_configs = [
154 ":skia_public",
155 ":skia_private",
156 ":skia_library",
157]
158
mtklein9b8583d2016-08-24 17:32:30 -0700159# Use for CPU-specific Skia code that needs particular compiler flags.
160template("opts") {
161 if (invoker.enabled) {
162 source_set(target_name) {
163 forward_variables_from(invoker, "*")
164 configs += skia_library_configs
165 }
166 } else {
167 # If not enabled, a phony empty target that swallows all otherwise unused variables.
168 source_set(target_name) {
169 forward_variables_from(invoker,
170 "*",
171 [
172 "sources",
173 "cflags",
174 ])
175 }
176 }
anmittala7eaf2e2016-08-17 13:57:26 -0700177}
178
mtklein422310d2016-08-16 18:28:43 -0700179is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700180
mtklein7d6fb2c2016-08-25 14:50:44 -0700181opts("none") {
182 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700183 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700184 cflags = []
185}
186
mtklein7d6fb2c2016-08-25 14:50:44 -0700187opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700188 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700189 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700190 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700191}
192
193opts("arm64") {
194 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700195 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700196 cflags = []
197}
198
199opts("crc32") {
200 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700201 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700202 cflags = [ "-march=armv8-a+crc" ]
203}
204
mtklein9b8583d2016-08-24 17:32:30 -0700205opts("sse2") {
206 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400208 if (is_win) {
209 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
210 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400211 cflags = [ "-msse2" ]
212 }
mtklein9b8583d2016-08-24 17:32:30 -0700213}
mtkleinc04ff472016-06-23 10:29:30 -0700214
mtklein9b8583d2016-08-24 17:32:30 -0700215opts("ssse3") {
216 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700217 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400218 if (is_win) {
219 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
220 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400221 cflags = [ "-mssse3" ]
222 }
mtklein9b8583d2016-08-24 17:32:30 -0700223}
mtkleinc04ff472016-06-23 10:29:30 -0700224
mtklein9b8583d2016-08-24 17:32:30 -0700225opts("sse41") {
226 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700227 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400228 if (is_win) {
229 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
230 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400231 cflags = [ "-msse4.1" ]
232 }
mtklein9b8583d2016-08-24 17:32:30 -0700233}
mtklein4e976072016-08-08 09:06:27 -0700234
mtklein9b8583d2016-08-24 17:32:30 -0700235opts("sse42") {
236 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700237 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400238 if (is_win) {
239 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
240 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400241 cflags = [ "-msse4.2" ]
242 }
mtklein9b8583d2016-08-24 17:32:30 -0700243}
244
245opts("avx") {
246 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400248 if (is_win) {
249 cflags = [ "/arch:AVX" ]
250 } else {
251 cflags = [ "-mavx" ]
252 }
mtkleinc04ff472016-06-23 10:29:30 -0700253}
254
Mike Klein78d5a3b2016-09-30 10:48:01 -0400255opts("hsw") {
256 enabled = is_x86
257 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400258 if (is_win) {
259 cflags = [ "/arch:AVX2" ]
260 } else {
261 cflags = [
262 "-mavx2",
263 "-mbmi",
264 "-mbmi2",
265 "-mf16c",
266 "-mfma",
267 ]
268 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400269}
270
mtklein349cece2016-08-26 08:13:04 -0700271opts("dsp") {
272 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700273 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700274 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700275}
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" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400393 } else if (is_win) {
394 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
395 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700396 } else {
397 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
398 }
mtkleine9fb3d52016-09-20 15:11:46 -0700399
400 if (skia_use_vulkan) {
401 public_defines += [ "SK_VULKAN" ]
402 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700403 if (skia_enable_vulkan_debug_layers) {
404 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
405 }
mtkleine9fb3d52016-09-20 15:11:46 -0700406 }
mtklein06c35c02016-09-20 12:28:12 -0700407}
408
mtklein63213812016-08-24 09:55:56 -0700409optional("jpeg") {
410 enabled = skia_use_libjpeg_turbo
411 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
412
mtklein63213812016-08-24 09:55:56 -0700413 deps = [
414 "//third_party/libjpeg-turbo:libjpeg",
415 ]
416 sources = [
417 "src/codec/SkJpegCodec.cpp",
418 "src/codec/SkJpegDecoderMgr.cpp",
419 "src/codec/SkJpegUtility.cpp",
420 "src/images/SkJPEGImageEncoder.cpp",
421 "src/images/SkJPEGWriteUtility.cpp",
422 ]
423}
424
425optional("pdf") {
426 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700427
mtklein63213812016-08-24 09:55:56 -0700428 deps = [
429 "//third_party/zlib",
430 ]
brettwb9447282016-09-01 14:24:39 -0700431 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700432 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700433
434 if (skia_use_sfntly) {
435 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700436 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700437 }
438}
439
440optional("png") {
441 enabled = skia_use_libpng
442 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
443
mtklein63213812016-08-24 09:55:56 -0700444 deps = [
445 "//third_party/libpng",
446 ]
447 sources = [
448 "src/codec/SkIcoCodec.cpp",
449 "src/codec/SkPngCodec.cpp",
450 "src/images/SkPNGImageEncoder.cpp",
451 ]
452}
453
scroggof84ad642016-10-31 09:02:57 -0700454optional("raw") {
455 enabled = skia_use_raw && skia_use_libjpeg_turbo && skia_use_zlib
456 public_defines = [ "SK_CODEC_DECODES_RAW" ]
457
458 deps = [
459 "//third_party/dng_sdk",
460 "//third_party/libjpeg-turbo:libjpeg",
461 "//third_party/piex",
462 ]
463
464 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
465 # Skia.
466 configs_to_remove = [ "//gn:no_exceptions" ]
467
468 sources = [
469 "src/codec/SkRawAdapterCodec.cpp",
470 "src/codec/SkRawCodec.cpp",
471 ]
472}
473
mtklein3cc22182016-08-29 13:26:14 -0700474optional("typeface_freetype") {
475 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700476
477 deps = [
478 "//third_party/freetype2",
479 ]
480 sources = [
481 "src/ports/SkFontHost_FreeType.cpp",
482 "src/ports/SkFontHost_FreeType_common.cpp",
483 ]
484}
485
mtklein457b42a2016-08-23 13:56:37 -0700486optional("webp") {
487 enabled = skia_use_libwebp
488 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
489
mtklein457b42a2016-08-23 13:56:37 -0700490 deps = [
491 "//third_party/libwebp",
492 ]
493 sources = [
494 "src/codec/SkWebpAdapterCodec.cpp",
495 "src/codec/SkWebpCodec.cpp",
496 "src/images/SkWEBPImageEncoder.cpp",
497 ]
mtkleineb3c4252016-08-23 07:38:09 -0700498}
499
mtklein63213812016-08-24 09:55:56 -0700500optional("xml") {
501 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700502
mtklein63213812016-08-24 09:55:56 -0700503 deps = [
504 "//third_party/expat",
505 ]
506 sources = [
507 "src/xml/SkDOM.cpp",
508 "src/xml/SkXMLParser.cpp",
509 "src/xml/SkXMLWriter.cpp",
510 ]
511}
512
mtkleinc04ff472016-06-23 10:29:30 -0700513component("skia") {
514 public_configs = [ ":skia_public" ]
515 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700516
517 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700518 ":arm64",
519 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700520 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700521 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700522 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700523 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700524 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700525 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700526 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700527 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400528 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700529 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700530 ":none",
mtklein63213812016-08-24 09:55:56 -0700531 ":pdf",
532 ":png",
scroggof84ad642016-10-31 09:02:57 -0700533 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700534 ":sse2",
535 ":sse41",
536 ":sse42",
537 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700538 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700539 ":webp",
mtklein63213812016-08-24 09:55:56 -0700540 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700541 ]
542
mtkleinc04ff472016-06-23 10:29:30 -0700543 sources = []
brettwb9447282016-09-01 14:24:39 -0700544 sources += skia_core_sources
545 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700546 sources += skia_sksl_sources
547 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700548 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700549 "src/android/SkBitmapRegionCodec.cpp",
550 "src/android/SkBitmapRegionDecoder.cpp",
551 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700552 "src/codec/SkBmpCodec.cpp",
553 "src/codec/SkBmpMaskCodec.cpp",
554 "src/codec/SkBmpRLECodec.cpp",
555 "src/codec/SkBmpStandardCodec.cpp",
556 "src/codec/SkCodec.cpp",
557 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700558 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700559 "src/codec/SkMaskSwizzler.cpp",
560 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700561 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700562 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700563 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700564 "src/codec/SkSwizzler.cpp",
565 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700566 "src/images/SkImageEncoder.cpp",
567 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700568 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700569 "src/ports/SkDiscardableMemory_none.cpp",
570 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700571 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700572 "src/ports/SkMemory_malloc.cpp",
573 "src/ports/SkOSFile_stdio.cpp",
574 "src/sfnt/SkOTTable_name.cpp",
575 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700576 "src/svg/SkSVGCanvas.cpp",
577 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700578 "src/utils/mac/SkStream_mac.cpp",
579 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700580 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700581 "third_party/ktx/ktx.cpp",
582 ]
brettwb9447282016-09-01 14:24:39 -0700583
mtklein7d6fb2c2016-08-25 14:50:44 -0700584 libs = []
585
mtkleinc04ff472016-06-23 10:29:30 -0700586 if (is_win) {
587 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400588 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700589 "src/ports/SkDebug_win.cpp",
590 "src/ports/SkFontHost_win.cpp",
591 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700592 "src/ports/SkImageEncoder_WIC.cpp",
593 "src/ports/SkImageGeneratorWIC.cpp",
594 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700595 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700596 "src/ports/SkScalerContext_win_dw.cpp",
597 "src/ports/SkTLS_win.cpp",
598 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700599 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400600 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700601 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400602 if (skia_use_gdi) {
603 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
604 libs += [
605 "Gdi32.lib",
606 "Usp10.lib",
607 ]
608 } else {
609 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
610 }
mtkleinb9be9792016-09-16 14:44:18 -0700611 sources -=
612 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400613 libs += [
614 "FontSub.lib",
615 "Ole32.lib",
616 "OleAut32.lib",
617 "User32.lib",
618 ]
mtkleinc04ff472016-06-23 10:29:30 -0700619 } else {
620 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700621 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700622 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700623 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700624 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700625 ]
626 }
627
mtklein7d6fb2c2016-08-25 14:50:44 -0700628 if (is_android) {
629 deps += [
630 "//third_party/cpu-features",
631 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700632 ]
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
663 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700664 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700665 }
mtkleinc04ff472016-06-23 10:29:30 -0700666}
667
mtkleinada5a442016-08-02 14:28:26 -0700668skia_h_headers = exec_script("gyp/find.py",
669 [ "*.h" ] + rebase_path(skia_public_includes),
670 "list lines",
671 []) -
672 [
673 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
674 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
675 rebase_path("include/gpu/vk/GrVkDefines.h"),
676 rebase_path("include/gpu/vk/GrVkInterface.h"),
677 rebase_path("include/gpu/vk/GrVkTypes.h"),
678 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
679 ]
680
mtklein1211e0c2016-07-26 13:55:45 -0700681action("skia.h") {
682 script = "gn/echo_headers.py"
683 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700684 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400685 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700686 outputs = [
687 "$target_gen_dir/skia.h",
688 ]
689}
690
mtklein06c35c02016-09-20 12:28:12 -0700691if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700692 # Our bots only have 64-bit libOSMesa installed.
693 # TODO: worth fixing?
694 executable("fiddle") {
695 include_dirs = [ "$target_gen_dir" ]
696 libs = []
697 if (is_linux) {
698 libs += [ "OSMesa" ]
699 }
mtklein56d56692016-09-15 11:18:55 -0700700
mtklein1fbdf982016-09-15 12:07:48 -0700701 sources = [
702 "src/images/SkForceLinking.cpp",
703 "tools/fiddle/draw.cpp",
704 "tools/fiddle/fiddle_main.cpp",
705 ]
706 deps = [
707 ":skia",
708 ":skia.h",
709 ]
710 }
mtkleinc04ff472016-06-23 10:29:30 -0700711}
mtklein25c81d42016-07-27 13:55:26 -0700712
mtkleinc095df52016-08-24 12:23:52 -0700713# Targets guarded by skia_enable_tools may use //third_party freely.
714if (skia_enable_tools) {
715 template("test_lib") {
716 config(target_name + "_config") {
717 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700718 if (defined(invoker.public_defines)) {
719 defines = invoker.public_defines
720 }
mtklein25c81d42016-07-27 13:55:26 -0700721 }
mtkleinc095df52016-08-24 12:23:52 -0700722 source_set(target_name) {
723 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
724 public_configs = [
725 ":" + target_name + "_config",
726 ":skia_private",
727 ]
728
729 if (!defined(deps)) {
730 deps = []
731 }
732 deps += [ ":skia" ]
733 testonly = true
734 }
mtklein25c81d42016-07-27 13:55:26 -0700735 }
mtklein25c81d42016-07-27 13:55:26 -0700736
mtkleinc095df52016-08-24 12:23:52 -0700737 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700738 public_include_dirs = []
739 if (skia_enable_gpu) {
740 public_defines = []
741 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700742
743 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700744 sources = [
745 "tools/gpu/GrContextFactory.cpp",
746 "tools/gpu/GrTest.cpp",
747 "tools/gpu/TestContext.cpp",
748 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700749 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700750 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
751 "tools/gpu/gl/debug/GrBufferObj.cpp",
752 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
753 "tools/gpu/gl/debug/GrProgramObj.cpp",
754 "tools/gpu/gl/debug/GrShaderObj.cpp",
755 "tools/gpu/gl/debug/GrTextureObj.cpp",
756 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
757 "tools/gpu/gl/null/NullGLTestContext.cpp",
758 ]
759 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700760
mtklein38925aa2016-09-21 10:11:25 -0700761 if (is_android) {
762 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
763 } else if (is_linux) {
764 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
765 } else if (is_mac) {
766 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400767 } else if (is_win) {
768 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
769 libs += [
770 "Gdi32.lib",
771 "OpenGL32.lib",
772 ]
mtklein38925aa2016-09-21 10:11:25 -0700773 }
mtklein6ef69992016-09-14 06:12:09 -0700774
mtkleind68f9b02016-09-23 13:18:41 -0700775 if (skia_use_angle) {
776 public_defines += [ "SK_ANGLE" ]
777 deps += [ "//third_party/angle2" ]
778 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700779 }
780 if (skia_use_mesa) {
781 public_defines += [ "SK_MESA" ]
782 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
783 libs += [ "OSMesa" ]
784 }
mtkleind68f9b02016-09-23 13:18:41 -0700785 if (skia_use_vulkan) {
786 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
787 }
mtkleina627b5c2016-09-20 13:36:47 -0700788 }
mtklein25c81d42016-07-27 13:55:26 -0700789 }
mtklein25c81d42016-07-27 13:55:26 -0700790
mtkleinc095df52016-08-24 12:23:52 -0700791 test_lib("flags") {
792 public_include_dirs = [ "tools/flags" ]
793 sources = [
794 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700795 ]
796 }
797 test_lib("common_flags") {
798 public_include_dirs = [ "tools/flags" ]
799 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700800 "tools/flags/SkCommonFlags.cpp",
801 "tools/flags/SkCommonFlagsConfig.cpp",
802 ]
803 deps = [
mtklein046cb562016-09-16 10:23:12 -0700804 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700805 ":gpu_tool_utils",
806 ]
807 }
mtklein25c81d42016-07-27 13:55:26 -0700808
mtkleinc095df52016-08-24 12:23:52 -0700809 test_lib("tool_utils") {
810 public_include_dirs = [
811 "tools",
812 "tools/debugger",
813 "tools/timer",
814 ]
815 sources = [
816 "src/images/SkForceLinking.cpp",
817 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700818 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700819 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700820 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700821 "tools/ProcStats.cpp",
822 "tools/Resources.cpp",
823 "tools/ThermalManager.cpp",
824 "tools/UrlDataManager.cpp",
825 "tools/debugger/SkDebugCanvas.cpp",
826 "tools/debugger/SkDrawCommand.cpp",
827 "tools/debugger/SkJsonWriteBuffer.cpp",
828 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700829 "tools/picture_utils.cpp",
830 "tools/random_parse_path.cpp",
831 "tools/sk_tool_utils.cpp",
832 "tools/sk_tool_utils_font.cpp",
833 "tools/timer/Timer.cpp",
834 ]
835 deps = [
mtklein046cb562016-09-16 10:23:12 -0700836 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700837 ":flags",
838 "//third_party/libpng",
839 ]
840 public_deps = [
841 "//third_party/jsoncpp",
842 ]
843 }
mtklein25c81d42016-07-27 13:55:26 -0700844
Mike Klein6e744122016-10-27 12:21:40 -0400845 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700846 test_lib("gm") {
847 public_include_dirs = [ "gm" ]
848 sources = gm_sources
849 deps = [
scroggo19b91532016-10-24 09:03:26 -0700850 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700851 ":gpu_tool_utils",
852 ":skia",
853 ":tool_utils",
854 ]
855 }
mtklein25c81d42016-07-27 13:55:26 -0700856
Mike Klein6e744122016-10-27 12:21:40 -0400857 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700858 test_lib("tests") {
859 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400860 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700861 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400862 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700863 }
mtkleinc095df52016-08-24 12:23:52 -0700864 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700865 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700866 ":flags",
867 ":gpu_tool_utils",
868 ":skia",
869 ":tool_utils",
870 "//third_party/libpng",
871 "//third_party/zlib",
872 ]
873 }
mtklein2f3416d2016-08-02 16:02:05 -0700874
Mike Klein6e744122016-10-27 12:21:40 -0400875 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700876 test_lib("bench") {
877 public_include_dirs = [ "bench" ]
878 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700879 deps = [
880 ":flags",
881 ":gm",
882 ":gpu_tool_utils",
883 ":skia",
884 ":tool_utils",
885 ]
886 }
mtklein2b6870c2016-07-28 14:17:33 -0700887
mtkleinc095df52016-08-24 12:23:52 -0700888 test_lib("experimental_svg_model") {
889 public_include_dirs = [ "experimental/svg/model" ]
890 sources = [
891 "experimental/svg/model/SkSVGAttribute.cpp",
892 "experimental/svg/model/SkSVGAttributeParser.cpp",
893 "experimental/svg/model/SkSVGCircle.cpp",
894 "experimental/svg/model/SkSVGContainer.cpp",
895 "experimental/svg/model/SkSVGDOM.cpp",
896 "experimental/svg/model/SkSVGEllipse.cpp",
897 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700898 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700899 "experimental/svg/model/SkSVGNode.cpp",
900 "experimental/svg/model/SkSVGPath.cpp",
901 "experimental/svg/model/SkSVGPoly.cpp",
902 "experimental/svg/model/SkSVGRect.cpp",
903 "experimental/svg/model/SkSVGRenderContext.cpp",
904 "experimental/svg/model/SkSVGSVG.cpp",
905 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700906 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700907 "experimental/svg/model/SkSVGTransformableNode.cpp",
908 "experimental/svg/model/SkSVGValue.cpp",
909 ]
910 deps = [
911 ":skia",
912 ]
913 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700914
Brian Osman16adfa32016-10-18 14:42:44 -0400915 test_lib("views") {
916 public_include_dirs = [ "include/views" ]
917 sources = [
918 "src/views/SkEvent.cpp",
919 "src/views/SkEventSink.cpp",
920 "src/views/SkOSMenu.cpp",
921 "src/views/SkTagList.cpp",
922 "src/views/SkTouchGesture.cpp",
923 "src/views/SkView.cpp",
924 "src/views/SkViewPriv.cpp",
925 ]
926 libs = []
927 if (!is_android) {
928 sources += [ "src/views/SkWindow.cpp" ]
929 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400930 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400931 public_include_dirs += [ "src/views/unix" ]
932 sources += [
933 "src/views/unix/SkOSWindow_Unix.cpp",
934 "src/views/unix/keysym2ucs.c",
935 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400936 } else if (is_mac) {
937 sources += [
938 "src/views/mac/SkEventNotifier.mm",
939 "src/views/mac/SkNSView.mm",
940 "src/views/mac/SkOSWindow_Mac.mm",
941 "src/views/mac/SkTextFieldCell.m",
942 ]
943 libs += [
944 "QuartzCore.framework",
945 "Cocoa.framework",
946 "Foundation.framework",
947 ]
948 } else if (is_win) {
949 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
950 }
951 }
952
Mike Klein6e744122016-10-27 12:21:40 -0400953 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -0400954 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -0400955 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -0400956 include_dirs = [ "experimental" ]
957 sources = samples_sources + [
958 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
959 "experimental/SkSetPoly3To3.cpp",
960 "experimental/SkSetPoly3To3_A.cpp",
961 "experimental/SkSetPoly3To3_D.cpp",
962 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400963 deps = [
964 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -0400965 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -0400966 ":tool_utils",
967 ":views",
968 ":xml",
969 ]
970 }
971
mtklein2b6870c2016-07-28 14:17:33 -0700972 executable("dm") {
973 sources = [
974 "dm/DM.cpp",
975 "dm/DMJsonWriter.cpp",
976 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700977 ]
978 include_dirs = [ "tests" ]
979 deps = [
mtklein046cb562016-09-16 10:23:12 -0700980 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700981 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700982 ":flags",
983 ":gm",
984 ":gpu_tool_utils",
985 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700986 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700987 ":tool_utils",
988 "//third_party/jsoncpp",
989 "//third_party/libpng",
990 ]
991 testonly = true
992 }
993
Mike Kleina3430172016-09-27 16:46:29 -0400994 if (!is_debug) { # I've benchmarked debug code once too many times...
995 executable("monobench") {
996 sources = [
997 "tools/monobench.cpp",
998 ]
999 deps = [
1000 ":bench",
1001 ":skia",
1002 ]
1003 testonly = true
1004 }
mtklein2b6870c2016-07-28 14:17:33 -07001005 }
1006
1007 executable("nanobench") {
1008 sources = [
1009 "bench/nanobench.cpp",
1010 ]
1011 deps = [
1012 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001013 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001014 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001015 ":flags",
1016 ":gm",
1017 ":gpu_tool_utils",
1018 ":skia",
1019 ":tool_utils",
1020 "//third_party/jsoncpp",
1021 ]
1022 testonly = true
1023 }
halcanary19a97202016-08-03 15:08:04 -07001024
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001025 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001026 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001027 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001028 "samplecode/SampleApp.cpp",
1029 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001030 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001031 if (is_mac) {
1032 sources += [ "src/views/mac/skia_mac.mm" ]
1033 } else if (is_win) {
1034 sources += [ "src/views/win/skia_win.cpp" ]
1035 } else if (is_linux) {
1036 sources += [ "src/views/unix/skia_unix.cpp" ]
1037 }
mtklein38925aa2016-09-21 10:11:25 -07001038 deps = [
1039 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001040 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001041 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001042 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001043 ":skia",
1044 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001045 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001046 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001047 if (skia_use_angle) {
1048 deps += [ "//third_party/angle2" ]
1049 }
mtklein38925aa2016-09-21 10:11:25 -07001050 testonly = true
1051 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001052 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001053
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001054 if (skia_enable_gpu) {
1055 executable("skpbench") {
1056 sources = [
1057 "tools/skpbench/skpbench.cpp",
1058 ]
1059 deps = [
1060 ":flags",
1061 ":gpu_tool_utils",
1062 ":skia",
1063 ":tool_utils",
1064 ]
1065 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001066 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001067 }
1068
Mike Klein4b167fc2016-10-11 18:13:53 -04001069 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001070 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001071 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001072 sources = [
1073 "tools/SkShaper_harfbuzz.cpp",
1074 "tools/using_skia_and_harfbuzz.cpp",
1075 ]
1076 deps = [
1077 ":skia",
1078 "//third_party/harfbuzz",
1079 ]
1080 testonly = true
1081 }
halcanary19a97202016-08-03 15:08:04 -07001082 }
halcanary3eee9d92016-09-10 07:01:53 -07001083 executable("sktexttopdf") {
1084 sources = [
1085 "tools/SkShaper_primitive.cpp",
1086 "tools/using_skia_and_harfbuzz.cpp",
1087 ]
1088 deps = [
1089 ":skia",
1090 ]
1091 testonly = true
1092 }
mtklein046cb562016-09-16 10:23:12 -07001093
1094 executable("get_images_from_skps") {
1095 sources = [
1096 "tools/get_images_from_skps.cpp",
1097 ]
1098 deps = [
1099 ":flags",
1100 ":skia",
1101 "//third_party/jsoncpp",
1102 ]
1103 testonly = true
1104 }
mtkleinecbc5262016-09-22 11:51:24 -07001105
1106 executable("skiaserve") {
1107 sources = [
1108 "tools/skiaserve/Request.cpp",
1109 "tools/skiaserve/Response.cpp",
1110 "tools/skiaserve/skiaserve.cpp",
1111 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1112 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1113 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1114 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1115 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1116 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1117 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1118 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1119 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1120 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1121 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001122 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001123 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1124 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1125 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1126 ]
1127 deps = [
1128 ":flags",
1129 ":gpu_tool_utils",
1130 ":skia",
1131 ":tool_utils",
1132 "//third_party/jsoncpp",
1133 "//third_party/libmicrohttpd",
1134 "//third_party/libpng",
1135 ]
1136 testonly = true
1137 }
kjlubick14f984b2016-10-03 11:49:45 -07001138
1139 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001140 if (is_skia_standalone) {
1141 configs -= [ "//gn:no_exceptions" ]
1142 }
kjlubick14f984b2016-10-03 11:49:45 -07001143 sources = [
1144 "fuzz/FilterFuzz.cpp",
1145 "fuzz/FuzzGradients.cpp",
1146 "fuzz/FuzzParsePath.cpp",
1147 "fuzz/FuzzPathop.cpp",
1148 "fuzz/FuzzScaleToSides.cpp",
1149 "fuzz/fuzz.cpp",
1150 ]
1151 deps = [
1152 ":flags",
1153 ":skia",
1154 ]
1155 testonly = true
1156 }
Mike Klein38312422016-10-05 15:41:01 -04001157
caryclark9feb6322016-10-25 08:58:26 -07001158 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001159 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001160 rebase_path("tests/skia_test.cpp"),
1161 rebase_path("tests/Test.cpp"),
1162 ]
caryclark9feb6322016-10-25 08:58:26 -07001163 deps = [
1164 ":flags",
1165 ":gpu_tool_utils",
1166 ":skia",
1167 ":tool_utils",
1168 ]
1169 testonly = true
1170 }
1171
Mike Klein38312422016-10-05 15:41:01 -04001172 executable("dump_record") {
1173 sources = [
1174 "tools/DumpRecord.cpp",
1175 "tools/dump_record.cpp",
1176 ]
1177 deps = [
1178 ":flags",
1179 ":skia",
1180 ]
1181 testonly = true
1182 }
bungemanfe917272016-10-13 17:36:40 -04001183
1184 executable("skdiff") {
1185 sources = [
1186 "tools/skdiff/skdiff.cpp",
1187 "tools/skdiff/skdiff_html.cpp",
1188 "tools/skdiff/skdiff_main.cpp",
1189 "tools/skdiff/skdiff_utils.cpp",
1190 ]
1191 deps = [
1192 ":skia",
1193 ":tool_utils",
1194 ]
1195 testonly = true
1196 }
halcanarya73d76a2016-10-17 13:19:02 -07001197
1198 executable("skp_parser") {
1199 sources = [
1200 "tools/skp_parser.cpp",
1201 ]
1202 deps = [
1203 ":skia",
1204 ":tool_utils",
1205 "//third_party/jsoncpp",
1206 ]
1207 testonly = true
1208 }
Brian Osman16adfa32016-10-18 14:42:44 -04001209
Mike Klein43c25262016-10-20 10:17:47 -04001210 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001211 executable("viewer") {
1212 sources = [
1213 "tools/viewer/GMSlide.cpp",
1214 "tools/viewer/ImageSlide.cpp",
1215 "tools/viewer/SKPSlide.cpp",
1216 "tools/viewer/SampleSlide.cpp",
1217 "tools/viewer/Viewer.cpp",
1218 "tools/viewer/sk_app/CommandSet.cpp",
1219 "tools/viewer/sk_app/GLWindowContext.cpp",
1220 "tools/viewer/sk_app/Window.cpp",
1221 "tools/viewer/sk_app/WindowContext.cpp",
1222 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001223 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001224
Jim Van Verth4e56a912016-10-21 10:58:52 -04001225 if (is_android) {
1226 sources += [
1227 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1228 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1229 "tools/viewer/sk_app/android/Window_android.cpp",
1230 "tools/viewer/sk_app/android/main_android.cpp",
1231 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1232 ]
1233 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001234 sources += [
1235 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1236 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1237 "tools/viewer/sk_app/unix/Window_unix.cpp",
1238 "tools/viewer/sk_app/unix/main_unix.cpp",
1239 ]
1240 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001241 sources += [
1242 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1243 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1244 "tools/viewer/sk_app/win/Window_win.cpp",
1245 "tools/viewer/sk_app/win/main_win.cpp",
1246 ]
Mike Klein43c25262016-10-20 10:17:47 -04001247 } else if (is_mac) {
1248 sources += [
1249 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1250 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1251 "tools/viewer/sk_app/mac/Window_mac.cpp",
1252 "tools/viewer/sk_app/mac/main_mac.cpp",
1253 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001254 }
1255
1256 if (skia_use_vulkan) {
1257 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001258 if (is_android) {
1259 sources +=
1260 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1261 libs += [ "android" ]
1262 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001263 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1264 libs += [ "X11-xcb" ]
1265 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001266 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1267 }
1268 }
1269
1270 include_dirs = []
1271 deps = [
1272 ":flags",
1273 ":gm",
1274 ":gpu_tool_utils",
1275 ":samples",
1276 ":skia",
1277 ":tool_utils",
1278 ":views",
1279 "//third_party/jsoncpp",
1280 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001281 if (is_android) {
1282 deps += [ "//third_party/native_app_glue" ]
1283 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001284 deps += [ "//third_party/libsdl" ]
1285 }
Brian Osman16adfa32016-10-18 14:42:44 -04001286 testonly = true
1287 }
1288 }
mtklein25c81d42016-07-27 13:55:26 -07001289}