blob: f6e4f0c2f33b51eb4b5f53281c84b31c810313a0 [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
Mike Kleinae7e6712016-10-11 17:49:33 -040023 skia_use_sfntly = !is_fuchsia && !is_win # TODO: icu on Windows, re-enable this.
mtkleinf29180e2016-09-16 07:01:17 -070024 skia_use_vulkan = is_android && defined(ndk_api) && ndk_api >= 24
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 Salomon789e25e2016-09-30 13:41:03 -040034skia_use_vulkan = skia_use_vulkan || skia_vulkan_sdk != ""
35
mtklein38925aa2016-09-21 10:11:25 -070036# Our tools require static linking (they use non-exported symbols).
37skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070038
mtkleina45be612016-08-29 15:22:10 -070039fontmgr_android_enabled = skia_use_expat && skia_use_freetype
40
mtklein1211e0c2016-07-26 13:55:45 -070041skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070042 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070043 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070044 "include/codec",
45 "include/config",
46 "include/core",
47 "include/effects",
48 "include/gpu",
49 "include/gpu/gl",
50 "include/images",
51 "include/pathops",
52 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070053 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070054 "include/utils",
55 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070056 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070057]
58
mtkleinc04ff472016-06-23 10:29:30 -070059# Skia public API, generally provided by :skia.
60config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070061 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040062 defines = []
63 if (is_component_build) {
64 defines += [ "SKIA_DLL" ]
65 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040066 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070067 defines += [ "SK_SAMPLES_FOR_X" ]
68 }
mtkleincae1be52016-09-20 08:24:34 -070069 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040070 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070071 }
mtklein06c35c02016-09-20 12:28:12 -070072 if (!skia_enable_gpu) {
73 defines += [ "SK_SUPPORT_GPU=0" ]
74 }
mtkleinc04ff472016-06-23 10:29:30 -070075}
76
77# Skia internal APIs, used by Skia itself and a few test tools.
78config("skia_private") {
79 visibility = [ ":*" ]
80
81 include_dirs = [
82 "include/private",
83 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070084 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070085 "src/config",
86 "src/core",
87 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070088 "src/effects/gradients",
89 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070090 "src/gpu",
91 "src/image",
92 "src/images",
93 "src/lazy",
94 "src/opts",
95 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070096 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070097 "src/ports",
98 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -070099 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700100 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700101 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700102 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700103 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700104 "third_party/ktx",
105 ]
mtklein150d1132016-08-01 06:56:40 -0700106
mtklein63213812016-08-24 09:55:56 -0700107 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700108 if (is_android) {
109 defines += [
110 "SK_GAMMA_EXPONENT=1.4",
111 "SK_GAMMA_CONTRAST=0.0",
112 ]
113 }
mtklein88a7ac02016-09-14 11:16:49 -0700114 if (is_official_build || is_android) {
115 # TODO(bsalomon): it'd be nice to make Android normal.
116 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
117 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400118 libs = []
119 lib_dirs = []
120 if (skia_use_vulkan) {
121 if (skia_vulkan_sdk != "") {
Mike Klein487bfc22016-10-14 14:04:56 -0400122 if (is_win) {
123 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
124 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
125 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400126 include_dirs += [ "$skia_vulkan_sdk/include/" ]
127 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400128 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400129 }
Mike Klein487bfc22016-10-14 14:04:56 -0400130 if (is_win) {
131 libs += [ "vulkan-1.lib" ]
132 } else {
133 libs += [ "vulkan" ]
134 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400135 }
mtkleinc04ff472016-06-23 10:29:30 -0700136}
137
138# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
139config("skia_library") {
140 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700141 defines = [ "SKIA_IMPLEMENTATION=1" ]
142}
143
144skia_library_configs = [
145 ":skia_public",
146 ":skia_private",
147 ":skia_library",
148]
149
mtklein9b8583d2016-08-24 17:32:30 -0700150# Use for CPU-specific Skia code that needs particular compiler flags.
151template("opts") {
152 if (invoker.enabled) {
153 source_set(target_name) {
154 forward_variables_from(invoker, "*")
155 configs += skia_library_configs
156 }
157 } else {
158 # If not enabled, a phony empty target that swallows all otherwise unused variables.
159 source_set(target_name) {
160 forward_variables_from(invoker,
161 "*",
162 [
163 "sources",
164 "cflags",
165 ])
166 }
167 }
anmittala7eaf2e2016-08-17 13:57:26 -0700168}
169
mtklein422310d2016-08-16 18:28:43 -0700170is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700171
mtklein7d6fb2c2016-08-25 14:50:44 -0700172opts("none") {
173 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700174 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700175 cflags = []
176}
177
mtklein7d6fb2c2016-08-25 14:50:44 -0700178opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700179 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700180 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700181 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700182}
183
184opts("arm64") {
185 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700186 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700187 cflags = []
188}
189
190opts("crc32") {
191 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700192 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700193 cflags = [ "-march=armv8-a+crc" ]
194}
195
mtklein9b8583d2016-08-24 17:32:30 -0700196opts("sse2") {
197 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700198 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400199 if (is_win) {
200 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
201 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400202 cflags = [ "-msse2" ]
203 }
mtklein9b8583d2016-08-24 17:32:30 -0700204}
mtkleinc04ff472016-06-23 10:29:30 -0700205
mtklein9b8583d2016-08-24 17:32:30 -0700206opts("ssse3") {
207 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700208 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400209 if (is_win) {
210 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
211 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400212 cflags = [ "-mssse3" ]
213 }
mtklein9b8583d2016-08-24 17:32:30 -0700214}
mtkleinc04ff472016-06-23 10:29:30 -0700215
mtklein9b8583d2016-08-24 17:32:30 -0700216opts("sse41") {
217 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700218 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400219 if (is_win) {
220 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
221 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400222 cflags = [ "-msse4.1" ]
223 }
mtklein9b8583d2016-08-24 17:32:30 -0700224}
mtklein4e976072016-08-08 09:06:27 -0700225
mtklein9b8583d2016-08-24 17:32:30 -0700226opts("sse42") {
227 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700228 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400229 if (is_win) {
230 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
231 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400232 cflags = [ "-msse4.2" ]
233 }
mtklein9b8583d2016-08-24 17:32:30 -0700234}
235
236opts("avx") {
237 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400239 if (is_win) {
240 cflags = [ "/arch:AVX" ]
241 } else {
242 cflags = [ "-mavx" ]
243 }
mtkleinc04ff472016-06-23 10:29:30 -0700244}
245
Mike Klein78d5a3b2016-09-30 10:48:01 -0400246opts("hsw") {
247 enabled = is_x86
248 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400249 if (is_win) {
250 cflags = [ "/arch:AVX2" ]
251 } else {
252 cflags = [
253 "-mavx2",
254 "-mbmi",
255 "-mbmi2",
256 "-mf16c",
257 "-mfma",
258 ]
259 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400260}
261
mtklein349cece2016-08-26 08:13:04 -0700262opts("dsp") {
263 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700265 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700266}
267
mtkleinc095df52016-08-24 12:23:52 -0700268# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700269template("optional") {
270 if (invoker.enabled) {
271 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700272 if (defined(invoker.public_defines)) {
273 defines = invoker.public_defines
274 }
mtklein457b42a2016-08-23 13:56:37 -0700275 }
276 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700277 forward_variables_from(invoker,
278 "*",
279 [
280 "public_defines",
281 "sources_when_disabled",
282 ])
mtklein457b42a2016-08-23 13:56:37 -0700283 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700284 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700285 }
286 } else {
mtklein457b42a2016-08-23 13:56:37 -0700287 source_set(target_name) {
288 forward_variables_from(invoker,
289 "*",
290 [
291 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700292 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700293 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700294 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700295 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700296 ])
mtkleincd01b032016-08-31 04:58:19 -0700297 if (defined(invoker.sources_when_disabled)) {
298 sources = invoker.sources_when_disabled
299 }
300 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700301 }
mtkleineb3c4252016-08-23 07:38:09 -0700302 }
mtklein457b42a2016-08-23 13:56:37 -0700303}
mtklein457b42a2016-08-23 13:56:37 -0700304
mtkleina45be612016-08-29 15:22:10 -0700305optional("fontmgr_android") {
306 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700307
308 deps = [
309 "//third_party/expat",
310 "//third_party/freetype2",
311 ]
312 sources = [
313 "src/ports/SkFontMgr_android.cpp",
314 "src/ports/SkFontMgr_android_factory.cpp",
315 "src/ports/SkFontMgr_android_parser.cpp",
316 ]
317}
318
mtkleind2e39db2016-09-07 07:52:55 -0700319optional("fontmgr_custom") {
320 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
321
322 deps = [
323 "//third_party/freetype2",
324 ]
325 sources = [
326 "src/ports/SkFontMgr_custom.cpp",
327 "src/ports/SkFontMgr_custom_directory_factory.cpp",
328 ]
329}
330
mtklein3cc22182016-08-29 13:26:14 -0700331optional("fontmgr_fontconfig") {
332 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700333
334 deps = [
335 "//third_party:fontconfig",
336 "//third_party/freetype2",
337 ]
338 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700339 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700340 "src/ports/SkFontConfigInterface_direct.cpp",
341 "src/ports/SkFontConfigInterface_direct_factory.cpp",
342 "src/ports/SkFontMgr_FontConfigInterface.cpp",
343 "src/ports/SkFontMgr_fontconfig.cpp",
344 "src/ports/SkFontMgr_fontconfig_factory.cpp",
345 ]
346}
347
mtkleincdedd0e2016-09-12 15:15:44 -0700348optional("fontmgr_fuchsia") {
349 enabled = is_fuchsia && skia_use_freetype
350
351 deps = [
352 "//third_party/freetype2",
353 ]
354 sources = [
355 "src/ports/SkFontMgr_custom.cpp",
356 "src/ports/SkFontMgr_custom_empty_factory.cpp",
357 ]
358}
359
mtklein06c35c02016-09-20 12:28:12 -0700360optional("gpu") {
361 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700362 public_defines = []
363
mtklein06c35c02016-09-20 12:28:12 -0700364 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
365
366 # These paths need to be absolute to match the ones produced by shared_sources.gni.
367 sources -= get_path_info([
368 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
369 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
370 ],
371 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400372 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700373 if (is_android) {
374 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
375 } else if (is_linux) {
376 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
377 } else if (is_mac) {
378 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400379 } else if (is_win) {
380 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
381 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700382 } else {
383 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
384 }
mtkleine9fb3d52016-09-20 15:11:46 -0700385
386 if (skia_use_vulkan) {
387 public_defines += [ "SK_VULKAN" ]
388 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700389 if (skia_enable_vulkan_debug_layers) {
390 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
391 }
mtkleine9fb3d52016-09-20 15:11:46 -0700392 }
mtklein06c35c02016-09-20 12:28:12 -0700393}
394
mtklein63213812016-08-24 09:55:56 -0700395optional("jpeg") {
396 enabled = skia_use_libjpeg_turbo
397 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
398
mtklein63213812016-08-24 09:55:56 -0700399 deps = [
400 "//third_party/libjpeg-turbo:libjpeg",
401 ]
402 sources = [
403 "src/codec/SkJpegCodec.cpp",
404 "src/codec/SkJpegDecoderMgr.cpp",
405 "src/codec/SkJpegUtility.cpp",
406 "src/images/SkJPEGImageEncoder.cpp",
407 "src/images/SkJPEGWriteUtility.cpp",
408 ]
409}
410
411optional("pdf") {
412 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700413
mtklein63213812016-08-24 09:55:56 -0700414 deps = [
415 "//third_party/zlib",
416 ]
brettwb9447282016-09-01 14:24:39 -0700417 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700418 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700419
420 if (skia_use_sfntly) {
421 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700422 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700423 }
424}
425
426optional("png") {
427 enabled = skia_use_libpng
428 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
429
mtklein63213812016-08-24 09:55:56 -0700430 deps = [
431 "//third_party/libpng",
432 ]
433 sources = [
434 "src/codec/SkIcoCodec.cpp",
435 "src/codec/SkPngCodec.cpp",
436 "src/images/SkPNGImageEncoder.cpp",
437 ]
438}
439
mtklein3cc22182016-08-29 13:26:14 -0700440optional("typeface_freetype") {
441 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700442
443 deps = [
444 "//third_party/freetype2",
445 ]
446 sources = [
447 "src/ports/SkFontHost_FreeType.cpp",
448 "src/ports/SkFontHost_FreeType_common.cpp",
449 ]
450}
451
mtklein457b42a2016-08-23 13:56:37 -0700452optional("webp") {
453 enabled = skia_use_libwebp
454 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
455
mtklein457b42a2016-08-23 13:56:37 -0700456 deps = [
457 "//third_party/libwebp",
458 ]
459 sources = [
460 "src/codec/SkWebpAdapterCodec.cpp",
461 "src/codec/SkWebpCodec.cpp",
462 "src/images/SkWEBPImageEncoder.cpp",
463 ]
mtkleineb3c4252016-08-23 07:38:09 -0700464}
465
mtklein63213812016-08-24 09:55:56 -0700466optional("xml") {
467 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700468
mtklein63213812016-08-24 09:55:56 -0700469 deps = [
470 "//third_party/expat",
471 ]
472 sources = [
473 "src/xml/SkDOM.cpp",
474 "src/xml/SkXMLParser.cpp",
475 "src/xml/SkXMLWriter.cpp",
476 ]
477}
478
mtkleinc04ff472016-06-23 10:29:30 -0700479component("skia") {
480 public_configs = [ ":skia_public" ]
481 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700482
483 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700484 ":arm64",
485 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700486 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700487 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700488 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700489 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700490 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700491 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700492 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700493 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400494 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700495 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700496 ":none",
mtklein63213812016-08-24 09:55:56 -0700497 ":pdf",
498 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700499 ":sse2",
500 ":sse41",
501 ":sse42",
502 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700503 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700504 ":webp",
mtklein63213812016-08-24 09:55:56 -0700505 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700506 ]
507
mtkleinc04ff472016-06-23 10:29:30 -0700508 sources = []
brettwb9447282016-09-01 14:24:39 -0700509 sources += skia_core_sources
510 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700511 sources += skia_sksl_sources
512 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700513 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700514 "src/android/SkBitmapRegionCodec.cpp",
515 "src/android/SkBitmapRegionDecoder.cpp",
516 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700517 "src/codec/SkBmpCodec.cpp",
518 "src/codec/SkBmpMaskCodec.cpp",
519 "src/codec/SkBmpRLECodec.cpp",
520 "src/codec/SkBmpStandardCodec.cpp",
521 "src/codec/SkCodec.cpp",
522 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700523 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700524 "src/codec/SkMaskSwizzler.cpp",
525 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700526 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700527 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700528 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700529 "src/codec/SkSwizzler.cpp",
530 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700531 "src/images/SkImageEncoder.cpp",
532 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700533 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700534 "src/ports/SkDiscardableMemory_none.cpp",
535 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700536 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700537 "src/ports/SkMemory_malloc.cpp",
538 "src/ports/SkOSFile_stdio.cpp",
539 "src/sfnt/SkOTTable_name.cpp",
540 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700541 "src/svg/SkSVGCanvas.cpp",
542 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700543 "src/utils/mac/SkStream_mac.cpp",
544 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700545 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700546 "third_party/ktx/ktx.cpp",
547 ]
brettwb9447282016-09-01 14:24:39 -0700548
mtklein7d6fb2c2016-08-25 14:50:44 -0700549 libs = []
550
mtkleinc04ff472016-06-23 10:29:30 -0700551 if (is_win) {
552 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400553 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700554 "src/ports/SkDebug_win.cpp",
555 "src/ports/SkFontHost_win.cpp",
556 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700557 "src/ports/SkImageEncoder_WIC.cpp",
558 "src/ports/SkImageGeneratorWIC.cpp",
559 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700560 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700561 "src/ports/SkScalerContext_win_dw.cpp",
562 "src/ports/SkTLS_win.cpp",
563 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700564 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400565 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700566 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400567 if (skia_use_gdi) {
568 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
569 libs += [
570 "Gdi32.lib",
571 "Usp10.lib",
572 ]
573 } else {
574 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
575 }
mtkleinb9be9792016-09-16 14:44:18 -0700576 sources -=
577 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400578 libs += [
579 "FontSub.lib",
580 "Ole32.lib",
581 "OleAut32.lib",
582 "User32.lib",
583 ]
mtkleinc04ff472016-06-23 10:29:30 -0700584 } else {
585 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700586 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700587 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700588 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700589 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700590 ]
591 }
592
mtklein7d6fb2c2016-08-25 14:50:44 -0700593 if (is_android) {
594 deps += [
595 "//third_party/cpu-features",
596 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700597 ]
mtklein06c35c02016-09-20 12:28:12 -0700598 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700599 libs += [
600 "EGL",
601 "GLESv2",
602 "log",
603 ]
604 }
605
mtkleinc04ff472016-06-23 10:29:30 -0700606 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700607 libs += [
608 "GL",
609 "GLU",
610 "X11",
611 ]
mtklein06c35c02016-09-20 12:28:12 -0700612 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700613 }
614
615 if (is_mac) {
616 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700617 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700618 "src/ports/SkFontHost_mac.cpp",
619 "src/ports/SkImageEncoder_CG.cpp",
620 "src/ports/SkImageGeneratorCG.cpp",
621 ]
mtklein09e61f72016-08-23 13:35:28 -0700622 libs += [
623 "ApplicationServices.framework",
624 "OpenGL.framework",
625 ]
mtkleinc04ff472016-06-23 10:29:30 -0700626 }
abarth6fc8ff02016-07-15 15:15:15 -0700627
628 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700629 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700630 }
mtkleinc04ff472016-06-23 10:29:30 -0700631}
632
mtkleinada5a442016-08-02 14:28:26 -0700633skia_h_headers = exec_script("gyp/find.py",
634 [ "*.h" ] + rebase_path(skia_public_includes),
635 "list lines",
636 []) -
637 [
638 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
639 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
640 rebase_path("include/gpu/vk/GrVkDefines.h"),
641 rebase_path("include/gpu/vk/GrVkInterface.h"),
642 rebase_path("include/gpu/vk/GrVkTypes.h"),
643 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
644 ]
645
mtklein1211e0c2016-07-26 13:55:45 -0700646action("skia.h") {
647 script = "gn/echo_headers.py"
648 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700649 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400650 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700651 outputs = [
652 "$target_gen_dir/skia.h",
653 ]
654}
655
mtklein06c35c02016-09-20 12:28:12 -0700656if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700657 # Our bots only have 64-bit libOSMesa installed.
658 # TODO: worth fixing?
659 executable("fiddle") {
660 include_dirs = [ "$target_gen_dir" ]
661 libs = []
662 if (is_linux) {
663 libs += [ "OSMesa" ]
664 }
mtklein56d56692016-09-15 11:18:55 -0700665
mtklein1fbdf982016-09-15 12:07:48 -0700666 sources = [
667 "src/images/SkForceLinking.cpp",
668 "tools/fiddle/draw.cpp",
669 "tools/fiddle/fiddle_main.cpp",
670 ]
671 deps = [
672 ":skia",
673 ":skia.h",
674 ]
675 }
mtkleinc04ff472016-06-23 10:29:30 -0700676}
mtklein25c81d42016-07-27 13:55:26 -0700677
mtkleinc095df52016-08-24 12:23:52 -0700678# Targets guarded by skia_enable_tools may use //third_party freely.
679if (skia_enable_tools) {
680 template("test_lib") {
681 config(target_name + "_config") {
682 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700683 if (defined(invoker.public_defines)) {
684 defines = invoker.public_defines
685 }
mtklein25c81d42016-07-27 13:55:26 -0700686 }
mtkleinc095df52016-08-24 12:23:52 -0700687 source_set(target_name) {
688 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
689 public_configs = [
690 ":" + target_name + "_config",
691 ":skia_private",
692 ]
693
694 if (!defined(deps)) {
695 deps = []
696 }
697 deps += [ ":skia" ]
698 testonly = true
699 }
mtklein25c81d42016-07-27 13:55:26 -0700700 }
mtklein25c81d42016-07-27 13:55:26 -0700701
mtkleinc095df52016-08-24 12:23:52 -0700702 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700703 public_include_dirs = []
704 if (skia_enable_gpu) {
705 public_defines = []
706 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700707
708 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700709 sources = [
710 "tools/gpu/GrContextFactory.cpp",
711 "tools/gpu/GrTest.cpp",
712 "tools/gpu/TestContext.cpp",
713 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700714 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700715 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
716 "tools/gpu/gl/debug/GrBufferObj.cpp",
717 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
718 "tools/gpu/gl/debug/GrProgramObj.cpp",
719 "tools/gpu/gl/debug/GrShaderObj.cpp",
720 "tools/gpu/gl/debug/GrTextureObj.cpp",
721 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
722 "tools/gpu/gl/null/NullGLTestContext.cpp",
723 ]
724 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700725
mtklein38925aa2016-09-21 10:11:25 -0700726 if (is_android) {
727 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
728 } else if (is_linux) {
729 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
730 } else if (is_mac) {
731 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400732 } else if (is_win) {
733 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
734 libs += [
735 "Gdi32.lib",
736 "OpenGL32.lib",
737 ]
mtklein38925aa2016-09-21 10:11:25 -0700738 }
mtklein6ef69992016-09-14 06:12:09 -0700739
mtkleind68f9b02016-09-23 13:18:41 -0700740 if (skia_use_angle) {
741 public_defines += [ "SK_ANGLE" ]
742 deps += [ "//third_party/angle2" ]
743 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700744 }
745 if (skia_use_mesa) {
746 public_defines += [ "SK_MESA" ]
747 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
748 libs += [ "OSMesa" ]
749 }
mtkleind68f9b02016-09-23 13:18:41 -0700750 if (skia_use_vulkan) {
751 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
752 }
mtkleina627b5c2016-09-20 13:36:47 -0700753 }
mtklein25c81d42016-07-27 13:55:26 -0700754 }
mtklein25c81d42016-07-27 13:55:26 -0700755
mtkleinc095df52016-08-24 12:23:52 -0700756 test_lib("flags") {
757 public_include_dirs = [ "tools/flags" ]
758 sources = [
759 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700760 ]
761 }
762 test_lib("common_flags") {
763 public_include_dirs = [ "tools/flags" ]
764 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700765 "tools/flags/SkCommonFlags.cpp",
766 "tools/flags/SkCommonFlagsConfig.cpp",
767 ]
768 deps = [
mtklein046cb562016-09-16 10:23:12 -0700769 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700770 ":gpu_tool_utils",
771 ]
772 }
mtklein25c81d42016-07-27 13:55:26 -0700773
mtkleinc095df52016-08-24 12:23:52 -0700774 test_lib("tool_utils") {
775 public_include_dirs = [
776 "tools",
777 "tools/debugger",
778 "tools/timer",
779 ]
780 sources = [
781 "src/images/SkForceLinking.cpp",
782 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700783 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700784 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700785 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700786 "tools/ProcStats.cpp",
787 "tools/Resources.cpp",
788 "tools/ThermalManager.cpp",
789 "tools/UrlDataManager.cpp",
790 "tools/debugger/SkDebugCanvas.cpp",
791 "tools/debugger/SkDrawCommand.cpp",
792 "tools/debugger/SkJsonWriteBuffer.cpp",
793 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700794 "tools/picture_utils.cpp",
795 "tools/random_parse_path.cpp",
796 "tools/sk_tool_utils.cpp",
797 "tools/sk_tool_utils_font.cpp",
798 "tools/timer/Timer.cpp",
799 ]
800 deps = [
mtklein046cb562016-09-16 10:23:12 -0700801 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700802 ":flags",
803 "//third_party/libpng",
804 ]
805 public_deps = [
806 "//third_party/jsoncpp",
807 ]
808 }
mtklein25c81d42016-07-27 13:55:26 -0700809
mtkleinc095df52016-08-24 12:23:52 -0700810 gm_sources = exec_script("gyp/find.py",
811 [
812 "*.c*",
813 rebase_path("gm"),
814 ],
815 "list lines",
816 [])
817 test_lib("gm") {
818 public_include_dirs = [ "gm" ]
819 sources = gm_sources
820 deps = [
scroggo19b91532016-10-24 09:03:26 -0700821 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700822 ":gpu_tool_utils",
823 ":skia",
824 ":tool_utils",
825 ]
826 }
mtklein25c81d42016-07-27 13:55:26 -0700827
mtkleinc095df52016-08-24 12:23:52 -0700828 tests_sources = exec_script("gyp/find.py",
829 [
830 "*.c*",
831 rebase_path("tests"),
832 ],
833 "list lines",
834 [])
mtklein2f3416d2016-08-02 16:02:05 -0700835
mtkleinc095df52016-08-24 12:23:52 -0700836 test_lib("tests") {
837 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700838 sources = tests_sources - [
839 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700840 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
841 rebase_path("tests/skia_test.cpp"), # alternate main
842 ]
843 if (!fontmgr_android_enabled) {
844 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
845 }
mtkleinc095df52016-08-24 12:23:52 -0700846 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700847 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700848 ":flags",
849 ":gpu_tool_utils",
850 ":skia",
851 ":tool_utils",
852 "//third_party/libpng",
853 "//third_party/zlib",
854 ]
855 }
mtklein2f3416d2016-08-02 16:02:05 -0700856
mtkleinc095df52016-08-24 12:23:52 -0700857 bench_sources = exec_script("gyp/find.py",
858 [
859 "*.c*",
860 rebase_path("bench"),
861 ],
862 "list lines",
863 [])
mtklein25c81d42016-07-27 13:55:26 -0700864
mtkleinc095df52016-08-24 12:23:52 -0700865 test_lib("bench") {
866 public_include_dirs = [ "bench" ]
867 sources = bench_sources
868 sources -= [
869 rebase_path("bench/nanobench.cpp"),
870 rebase_path("bench/nanobenchAndroid.cpp"),
871 ]
872 deps = [
873 ":flags",
874 ":gm",
875 ":gpu_tool_utils",
876 ":skia",
877 ":tool_utils",
878 ]
879 }
mtklein2b6870c2016-07-28 14:17:33 -0700880
mtkleinc095df52016-08-24 12:23:52 -0700881 test_lib("experimental_svg_model") {
882 public_include_dirs = [ "experimental/svg/model" ]
883 sources = [
884 "experimental/svg/model/SkSVGAttribute.cpp",
885 "experimental/svg/model/SkSVGAttributeParser.cpp",
886 "experimental/svg/model/SkSVGCircle.cpp",
887 "experimental/svg/model/SkSVGContainer.cpp",
888 "experimental/svg/model/SkSVGDOM.cpp",
889 "experimental/svg/model/SkSVGEllipse.cpp",
890 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700891 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700892 "experimental/svg/model/SkSVGNode.cpp",
893 "experimental/svg/model/SkSVGPath.cpp",
894 "experimental/svg/model/SkSVGPoly.cpp",
895 "experimental/svg/model/SkSVGRect.cpp",
896 "experimental/svg/model/SkSVGRenderContext.cpp",
897 "experimental/svg/model/SkSVGSVG.cpp",
898 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700899 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700900 "experimental/svg/model/SkSVGTransformableNode.cpp",
901 "experimental/svg/model/SkSVGValue.cpp",
902 ]
903 deps = [
904 ":skia",
905 ]
906 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700907
Brian Osman16adfa32016-10-18 14:42:44 -0400908 test_lib("views") {
909 public_include_dirs = [ "include/views" ]
910 sources = [
911 "src/views/SkEvent.cpp",
912 "src/views/SkEventSink.cpp",
913 "src/views/SkOSMenu.cpp",
914 "src/views/SkTagList.cpp",
915 "src/views/SkTouchGesture.cpp",
916 "src/views/SkView.cpp",
917 "src/views/SkViewPriv.cpp",
918 ]
919 libs = []
920 if (!is_android) {
921 sources += [ "src/views/SkWindow.cpp" ]
922 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400923 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400924 public_include_dirs += [ "src/views/unix" ]
925 sources += [
926 "src/views/unix/SkOSWindow_Unix.cpp",
927 "src/views/unix/keysym2ucs.c",
928 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400929 } else if (is_mac) {
930 sources += [
931 "src/views/mac/SkEventNotifier.mm",
932 "src/views/mac/SkNSView.mm",
933 "src/views/mac/SkOSWindow_Mac.mm",
934 "src/views/mac/SkTextFieldCell.m",
935 ]
936 libs += [
937 "QuartzCore.framework",
938 "Cocoa.framework",
939 "Foundation.framework",
940 ]
941 } else if (is_win) {
942 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
943 }
944 }
945
946 sample_sources = exec_script("gyp/find.py",
947 [
948 "*.c*",
949 rebase_path("samplecode"),
950 ],
951 "list lines",
952 [])
953
954 test_lib("samples") {
955 include_dirs = [ "experimental" ]
956 public_include_dirs = [ "samplecode" ]
957 sources = sample_sources
958 sources -= [
959 rebase_path("samplecode/SampleAnimator.cpp"), # relies on animator
960 rebase_path("samplecode/SampleApp.cpp"), # part of SampleApp exe, not samples lib
961 rebase_path("samplecode/SampleClamp.cpp"),
962 rebase_path("samplecode/SampleDash.cpp"),
963 rebase_path("samplecode/SampleLua.cpp"), # no Lua yet in GN
964 rebase_path("samplecode/SamplePathFill.cpp"),
965 rebase_path("samplecode/SamplePictFile.cpp"), # relies on SK_SUPPORT_LEGACY_DRAWFILTER
966 rebase_path("samplecode/SampleSkLayer.cpp"), # relies on SkMatrix44 which doesn't compile?
967 rebase_path("samplecode/SampleFontCache.cpp"), # relies on pthread.h
968 ]
969 sources += [
970 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
971 "experimental/SkSetPoly3To3.cpp",
972 "experimental/SkSetPoly3To3_A.cpp",
973 "experimental/SkSetPoly3To3_D.cpp",
974 ]
975 deps = [
976 ":experimental_svg_model",
977 ":gm", # Why does SampleFilterQuality.cpp include gm.h ???
978 ":tool_utils",
979 ":views",
980 ":xml",
981 ]
982 }
983
mtklein2b6870c2016-07-28 14:17:33 -0700984 executable("dm") {
985 sources = [
986 "dm/DM.cpp",
987 "dm/DMJsonWriter.cpp",
988 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700989 ]
990 include_dirs = [ "tests" ]
991 deps = [
mtklein046cb562016-09-16 10:23:12 -0700992 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700993 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700994 ":flags",
995 ":gm",
996 ":gpu_tool_utils",
997 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700998 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700999 ":tool_utils",
1000 "//third_party/jsoncpp",
1001 "//third_party/libpng",
1002 ]
1003 testonly = true
1004 }
1005
Mike Kleina3430172016-09-27 16:46:29 -04001006 if (!is_debug) { # I've benchmarked debug code once too many times...
1007 executable("monobench") {
1008 sources = [
1009 "tools/monobench.cpp",
1010 ]
1011 deps = [
1012 ":bench",
1013 ":skia",
1014 ]
1015 testonly = true
1016 }
mtklein2b6870c2016-07-28 14:17:33 -07001017 }
1018
1019 executable("nanobench") {
1020 sources = [
1021 "bench/nanobench.cpp",
1022 ]
1023 deps = [
1024 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001025 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001026 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001027 ":flags",
1028 ":gm",
1029 ":gpu_tool_utils",
1030 ":skia",
1031 ":tool_utils",
1032 "//third_party/jsoncpp",
1033 ]
1034 testonly = true
1035 }
halcanary19a97202016-08-03 15:08:04 -07001036
mtklein38925aa2016-09-21 10:11:25 -07001037 if (skia_enable_gpu) {
1038 executable("skpbench") {
1039 sources = [
1040 "tools/skpbench/skpbench.cpp",
1041 ]
1042 deps = [
1043 ":flags",
1044 ":gpu_tool_utils",
1045 ":skia",
1046 ":tool_utils",
1047 ]
1048 testonly = true
1049 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001050 }
1051
Mike Klein4b167fc2016-10-11 18:13:53 -04001052 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001053 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001054 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001055 sources = [
1056 "tools/SkShaper_harfbuzz.cpp",
1057 "tools/using_skia_and_harfbuzz.cpp",
1058 ]
1059 deps = [
1060 ":skia",
1061 "//third_party/harfbuzz",
1062 ]
1063 testonly = true
1064 }
halcanary19a97202016-08-03 15:08:04 -07001065 }
halcanary3eee9d92016-09-10 07:01:53 -07001066 executable("sktexttopdf") {
1067 sources = [
1068 "tools/SkShaper_primitive.cpp",
1069 "tools/using_skia_and_harfbuzz.cpp",
1070 ]
1071 deps = [
1072 ":skia",
1073 ]
1074 testonly = true
1075 }
mtklein046cb562016-09-16 10:23:12 -07001076
1077 executable("get_images_from_skps") {
1078 sources = [
1079 "tools/get_images_from_skps.cpp",
1080 ]
1081 deps = [
1082 ":flags",
1083 ":skia",
1084 "//third_party/jsoncpp",
1085 ]
1086 testonly = true
1087 }
mtkleinecbc5262016-09-22 11:51:24 -07001088
1089 executable("skiaserve") {
1090 sources = [
1091 "tools/skiaserve/Request.cpp",
1092 "tools/skiaserve/Response.cpp",
1093 "tools/skiaserve/skiaserve.cpp",
1094 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1095 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1096 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1097 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1098 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1099 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1100 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1101 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1102 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1103 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1104 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001105 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001106 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1107 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1108 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1109 ]
1110 deps = [
1111 ":flags",
1112 ":gpu_tool_utils",
1113 ":skia",
1114 ":tool_utils",
1115 "//third_party/jsoncpp",
1116 "//third_party/libmicrohttpd",
1117 "//third_party/libpng",
1118 ]
1119 testonly = true
1120 }
kjlubick14f984b2016-10-03 11:49:45 -07001121
1122 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001123 if (is_skia_standalone) {
1124 configs -= [ "//gn:no_exceptions" ]
1125 }
kjlubick14f984b2016-10-03 11:49:45 -07001126 sources = [
1127 "fuzz/FilterFuzz.cpp",
1128 "fuzz/FuzzGradients.cpp",
1129 "fuzz/FuzzParsePath.cpp",
1130 "fuzz/FuzzPathop.cpp",
1131 "fuzz/FuzzScaleToSides.cpp",
1132 "fuzz/fuzz.cpp",
1133 ]
1134 deps = [
1135 ":flags",
1136 ":skia",
1137 ]
1138 testonly = true
1139 }
Mike Klein38312422016-10-05 15:41:01 -04001140
caryclark9feb6322016-10-25 08:58:26 -07001141 pathops_tests_sources = exec_script("gyp/find.py",
1142 [
1143 "PathOps*.cpp",
1144 rebase_path("tests"),
1145 ],
1146 "list lines",
1147 [])
1148
1149 executable("pathops_unittest") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001150 sources = pathops_tests_sources -
1151 [ rebase_path("tests/PathOpsSkpClipTest.cpp") ] +
1152 [
1153 rebase_path("tests/skia_test.cpp"),
1154 rebase_path("tests/Test.cpp"),
1155 ]
caryclark9feb6322016-10-25 08:58:26 -07001156 deps = [
1157 ":flags",
1158 ":gpu_tool_utils",
1159 ":skia",
1160 ":tool_utils",
1161 ]
1162 testonly = true
1163 }
1164
Mike Klein38312422016-10-05 15:41:01 -04001165 executable("dump_record") {
1166 sources = [
1167 "tools/DumpRecord.cpp",
1168 "tools/dump_record.cpp",
1169 ]
1170 deps = [
1171 ":flags",
1172 ":skia",
1173 ]
1174 testonly = true
1175 }
bungemanfe917272016-10-13 17:36:40 -04001176
1177 executable("skdiff") {
1178 sources = [
1179 "tools/skdiff/skdiff.cpp",
1180 "tools/skdiff/skdiff_html.cpp",
1181 "tools/skdiff/skdiff_main.cpp",
1182 "tools/skdiff/skdiff_utils.cpp",
1183 ]
1184 deps = [
1185 ":skia",
1186 ":tool_utils",
1187 ]
1188 testonly = true
1189 }
halcanarya73d76a2016-10-17 13:19:02 -07001190
1191 executable("skp_parser") {
1192 sources = [
1193 "tools/skp_parser.cpp",
1194 ]
1195 deps = [
1196 ":skia",
1197 ":tool_utils",
1198 "//third_party/jsoncpp",
1199 ]
1200 testonly = true
1201 }
Brian Osman16adfa32016-10-18 14:42:44 -04001202
Mike Klein43c25262016-10-20 10:17:47 -04001203 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001204 executable("viewer") {
1205 sources = [
1206 "tools/viewer/GMSlide.cpp",
1207 "tools/viewer/ImageSlide.cpp",
1208 "tools/viewer/SKPSlide.cpp",
1209 "tools/viewer/SampleSlide.cpp",
1210 "tools/viewer/Viewer.cpp",
1211 "tools/viewer/sk_app/CommandSet.cpp",
1212 "tools/viewer/sk_app/GLWindowContext.cpp",
1213 "tools/viewer/sk_app/Window.cpp",
1214 "tools/viewer/sk_app/WindowContext.cpp",
1215 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001216 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001217
Jim Van Verth4e56a912016-10-21 10:58:52 -04001218 if (is_android) {
1219 sources += [
1220 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1221 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1222 "tools/viewer/sk_app/android/Window_android.cpp",
1223 "tools/viewer/sk_app/android/main_android.cpp",
1224 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1225 ]
1226 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001227 sources += [
1228 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1229 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1230 "tools/viewer/sk_app/unix/Window_unix.cpp",
1231 "tools/viewer/sk_app/unix/main_unix.cpp",
1232 ]
1233 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001234 sources += [
1235 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1236 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1237 "tools/viewer/sk_app/win/Window_win.cpp",
1238 "tools/viewer/sk_app/win/main_win.cpp",
1239 ]
Mike Klein43c25262016-10-20 10:17:47 -04001240 } else if (is_mac) {
1241 sources += [
1242 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1243 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1244 "tools/viewer/sk_app/mac/Window_mac.cpp",
1245 "tools/viewer/sk_app/mac/main_mac.cpp",
1246 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001247 }
1248
1249 if (skia_use_vulkan) {
1250 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001251 if (is_android) {
1252 sources +=
1253 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1254 libs += [ "android" ]
1255 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001256 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1257 libs += [ "X11-xcb" ]
1258 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001259 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1260 }
1261 }
1262
1263 include_dirs = []
1264 deps = [
1265 ":flags",
1266 ":gm",
1267 ":gpu_tool_utils",
1268 ":samples",
1269 ":skia",
1270 ":tool_utils",
1271 ":views",
1272 "//third_party/jsoncpp",
1273 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001274 if (is_android) {
1275 deps += [ "//third_party/native_app_glue" ]
1276 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001277 deps += [ "//third_party/libsdl" ]
1278 }
Brian Osman16adfa32016-10-18 14:42:44 -04001279 testonly = true
1280 }
1281 }
mtklein25c81d42016-07-27 13:55:26 -07001282}