blob: 5ea18dd3475b84889dd4e2528d230be5583d0611 [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
brettwb9447282016-09-01 14:24:39 -07006import("//gn/shared_sources.gni")
7
mtkleinc04ff472016-06-23 10:29:30 -07008declare_args() {
mtkleinc095df52016-08-24 12:23:52 -07009 skia_enable_tools = !is_fuchsia && !is_component_build
10
mtklein63213812016-08-24 09:55:56 -070011 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070012 skia_use_fontconfig = is_linux
13 skia_use_freetype = is_android || is_linux
mtklein457b42a2016-08-23 13:56:37 -070014 skia_use_giflib = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070015 skia_use_libjpeg_turbo = true
16 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070017 skia_use_libwebp = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070018 skia_use_sfntly = !is_fuchsia
19 skia_use_zlib = true
mtkleinc04ff472016-06-23 10:29:30 -070020}
21
mtkleina45be612016-08-29 15:22:10 -070022fontmgr_android_enabled = skia_use_expat && skia_use_freetype
23
mtklein1211e0c2016-07-26 13:55:45 -070024skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070025 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070026 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070027 "include/codec",
28 "include/config",
29 "include/core",
30 "include/effects",
31 "include/gpu",
32 "include/gpu/gl",
33 "include/images",
34 "include/pathops",
35 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070036 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070037 "include/utils",
38 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070039 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070040]
41
mtkleinc04ff472016-06-23 10:29:30 -070042# Skia public API, generally provided by :skia.
43config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070044 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070045 defines = [ "SKIA_DLL" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070046 if (is_linux) {
47 defines += [ "SK_SAMPLES_FOR_X" ]
48 }
mtkleinc04ff472016-06-23 10:29:30 -070049}
50
51# Skia internal APIs, used by Skia itself and a few test tools.
52config("skia_private") {
53 visibility = [ ":*" ]
54
55 include_dirs = [
56 "include/private",
57 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070058 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070059 "src/config",
60 "src/core",
61 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070062 "src/effects/gradients",
63 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070064 "src/gpu",
65 "src/image",
66 "src/images",
67 "src/lazy",
68 "src/opts",
69 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070070 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070071 "src/ports",
72 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -070073 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -070074 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070075 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070076 "third_party/etc1",
77 "third_party/ktx",
78 ]
mtklein150d1132016-08-01 06:56:40 -070079
mtklein63213812016-08-24 09:55:56 -070080 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinc04ff472016-06-23 10:29:30 -070081}
82
83# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
84config("skia_library") {
85 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070086 defines = [ "SKIA_IMPLEMENTATION=1" ]
87}
88
89skia_library_configs = [
90 ":skia_public",
91 ":skia_private",
92 ":skia_library",
93]
94
mtklein9b8583d2016-08-24 17:32:30 -070095# Use for CPU-specific Skia code that needs particular compiler flags.
96template("opts") {
97 if (invoker.enabled) {
98 source_set(target_name) {
99 forward_variables_from(invoker, "*")
100 configs += skia_library_configs
101 }
102 } else {
103 # If not enabled, a phony empty target that swallows all otherwise unused variables.
104 source_set(target_name) {
105 forward_variables_from(invoker,
106 "*",
107 [
108 "sources",
109 "cflags",
110 ])
111 }
112 }
anmittala7eaf2e2016-08-17 13:57:26 -0700113}
114
mtklein422310d2016-08-16 18:28:43 -0700115is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700116
mtklein7d6fb2c2016-08-25 14:50:44 -0700117opts("none") {
118 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700119 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700120 cflags = []
121}
122
mtklein7d6fb2c2016-08-25 14:50:44 -0700123opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700124 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700125 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700126 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700127}
128
129opts("arm64") {
130 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700131 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700132 cflags = []
133}
134
135opts("crc32") {
136 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700137 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700138 cflags = [ "-march=armv8-a+crc" ]
139}
140
mtklein9b8583d2016-08-24 17:32:30 -0700141opts("sse2") {
142 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700143 sources = skia_opts.sse2_sources
mtklein9b8583d2016-08-24 17:32:30 -0700144 cflags = [ "-msse2" ]
145}
mtkleinc04ff472016-06-23 10:29:30 -0700146
mtklein9b8583d2016-08-24 17:32:30 -0700147opts("ssse3") {
148 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700149 sources = skia_opts.ssse3_sources
mtklein9b8583d2016-08-24 17:32:30 -0700150 cflags = [ "-mssse3" ]
151}
mtkleinc04ff472016-06-23 10:29:30 -0700152
mtklein9b8583d2016-08-24 17:32:30 -0700153opts("sse41") {
154 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.sse41_sources
mtklein9b8583d2016-08-24 17:32:30 -0700156 cflags = [ "-msse4.1" ]
157}
mtklein4e976072016-08-08 09:06:27 -0700158
mtklein9b8583d2016-08-24 17:32:30 -0700159opts("sse42") {
160 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.sse42_sources
mtklein9b8583d2016-08-24 17:32:30 -0700162 cflags = [ "-msse4.2" ]
163}
164
165opts("avx") {
166 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.avx_sources
mtklein9b8583d2016-08-24 17:32:30 -0700168 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700169}
170
mtklein349cece2016-08-26 08:13:04 -0700171opts("dsp") {
172 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700174 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700175}
176
mtkleinc095df52016-08-24 12:23:52 -0700177# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700178template("optional") {
179 if (invoker.enabled) {
180 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700181 if (defined(invoker.public_defines)) {
182 defines = invoker.public_defines
183 }
mtklein457b42a2016-08-23 13:56:37 -0700184 }
185 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700186 forward_variables_from(invoker,
187 "*",
188 [
189 "public_defines",
190 "sources_when_disabled",
191 ])
mtklein457b42a2016-08-23 13:56:37 -0700192 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700193 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700194 }
195 } else {
mtklein457b42a2016-08-23 13:56:37 -0700196 source_set(target_name) {
197 forward_variables_from(invoker,
198 "*",
199 [
200 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700201 "deps",
202 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700203 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700204 ])
mtkleincd01b032016-08-31 04:58:19 -0700205 if (defined(invoker.sources_when_disabled)) {
206 sources = invoker.sources_when_disabled
207 }
208 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700209 }
mtkleineb3c4252016-08-23 07:38:09 -0700210 }
mtklein457b42a2016-08-23 13:56:37 -0700211}
mtklein457b42a2016-08-23 13:56:37 -0700212
mtkleina45be612016-08-29 15:22:10 -0700213optional("fontmgr_android") {
214 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700215
216 deps = [
217 "//third_party/expat",
218 "//third_party/freetype2",
219 ]
220 sources = [
221 "src/ports/SkFontMgr_android.cpp",
222 "src/ports/SkFontMgr_android_factory.cpp",
223 "src/ports/SkFontMgr_android_parser.cpp",
224 ]
225}
226
mtkleind2e39db2016-09-07 07:52:55 -0700227optional("fontmgr_custom") {
228 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
229
230 deps = [
231 "//third_party/freetype2",
232 ]
233 sources = [
234 "src/ports/SkFontMgr_custom.cpp",
235 "src/ports/SkFontMgr_custom_directory_factory.cpp",
236 ]
237}
238
mtklein3cc22182016-08-29 13:26:14 -0700239optional("fontmgr_fontconfig") {
240 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700241
242 deps = [
243 "//third_party:fontconfig",
244 "//third_party/freetype2",
245 ]
246 sources = [
247 "src/ports/SkFontConfigInterface_direct.cpp",
248 "src/ports/SkFontConfigInterface_direct_factory.cpp",
249 "src/ports/SkFontMgr_FontConfigInterface.cpp",
250 "src/ports/SkFontMgr_fontconfig.cpp",
251 "src/ports/SkFontMgr_fontconfig_factory.cpp",
252 ]
253}
254
mtklein457b42a2016-08-23 13:56:37 -0700255optional("gif") {
256 enabled = skia_use_giflib
257 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
258
mtklein457b42a2016-08-23 13:56:37 -0700259 deps = [
260 "//third_party/giflib",
261 ]
262 sources = [
263 "src/codec/SkGifCodec.cpp",
264 ]
265}
266
mtklein63213812016-08-24 09:55:56 -0700267optional("jpeg") {
268 enabled = skia_use_libjpeg_turbo
269 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
270
mtklein63213812016-08-24 09:55:56 -0700271 deps = [
272 "//third_party/libjpeg-turbo:libjpeg",
273 ]
274 sources = [
275 "src/codec/SkJpegCodec.cpp",
276 "src/codec/SkJpegDecoderMgr.cpp",
277 "src/codec/SkJpegUtility.cpp",
278 "src/images/SkJPEGImageEncoder.cpp",
279 "src/images/SkJPEGWriteUtility.cpp",
280 ]
281}
282
283optional("pdf") {
284 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700285
mtklein63213812016-08-24 09:55:56 -0700286 deps = [
287 "//third_party/zlib",
288 ]
brettwb9447282016-09-01 14:24:39 -0700289 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700290 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700291
292 if (skia_use_sfntly) {
293 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700294 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700295 }
296}
297
298optional("png") {
299 enabled = skia_use_libpng
300 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
301
mtklein63213812016-08-24 09:55:56 -0700302 deps = [
303 "//third_party/libpng",
304 ]
305 sources = [
306 "src/codec/SkIcoCodec.cpp",
307 "src/codec/SkPngCodec.cpp",
308 "src/images/SkPNGImageEncoder.cpp",
309 ]
310}
311
mtklein3cc22182016-08-29 13:26:14 -0700312optional("typeface_freetype") {
313 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700314
315 deps = [
316 "//third_party/freetype2",
317 ]
318 sources = [
319 "src/ports/SkFontHost_FreeType.cpp",
320 "src/ports/SkFontHost_FreeType_common.cpp",
321 ]
322}
323
mtklein457b42a2016-08-23 13:56:37 -0700324optional("webp") {
325 enabled = skia_use_libwebp
326 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
327
mtklein457b42a2016-08-23 13:56:37 -0700328 deps = [
329 "//third_party/libwebp",
330 ]
331 sources = [
332 "src/codec/SkWebpAdapterCodec.cpp",
333 "src/codec/SkWebpCodec.cpp",
334 "src/images/SkWEBPImageEncoder.cpp",
335 ]
mtkleineb3c4252016-08-23 07:38:09 -0700336}
337
mtklein63213812016-08-24 09:55:56 -0700338optional("xml") {
339 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700340
mtklein63213812016-08-24 09:55:56 -0700341 deps = [
342 "//third_party/expat",
343 ]
344 sources = [
345 "src/xml/SkDOM.cpp",
346 "src/xml/SkXMLParser.cpp",
347 "src/xml/SkXMLWriter.cpp",
348 ]
349}
350
mtkleinc04ff472016-06-23 10:29:30 -0700351component("skia") {
352 public_configs = [ ":skia_public" ]
353 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700354
355 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700356 ":arm64",
357 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700358 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700359 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700360 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700361 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700362 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700363 ":fontmgr_fontconfig",
mtklein457b42a2016-08-23 13:56:37 -0700364 ":gif",
mtklein63213812016-08-24 09:55:56 -0700365 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700366 ":none",
mtklein63213812016-08-24 09:55:56 -0700367 ":pdf",
368 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700369 ":sse2",
370 ":sse41",
371 ":sse42",
372 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700373 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700374 ":webp",
mtklein63213812016-08-24 09:55:56 -0700375 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700376 ]
377
mtkleinc04ff472016-06-23 10:29:30 -0700378 sources = []
brettwb9447282016-09-01 14:24:39 -0700379 sources += skia_core_sources
380 sources += skia_effects_sources
381 sources += skia_gpu_sources
382 sources += skia_sksl_sources
383 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700384 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700385 "src/android/SkBitmapRegionCodec.cpp",
386 "src/android/SkBitmapRegionDecoder.cpp",
387 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700388 "src/codec/SkBmpCodec.cpp",
389 "src/codec/SkBmpMaskCodec.cpp",
390 "src/codec/SkBmpRLECodec.cpp",
391 "src/codec/SkBmpStandardCodec.cpp",
392 "src/codec/SkCodec.cpp",
393 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700394 "src/codec/SkMaskSwizzler.cpp",
395 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700396 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700397 "src/codec/SkSampler.cpp",
398 "src/codec/SkSwizzler.cpp",
399 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700400 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700401 "src/images/SkImageEncoder.cpp",
402 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700403 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700404 "src/ports/SkDiscardableMemory_none.cpp",
405 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700406 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700407 "src/ports/SkMemory_malloc.cpp",
408 "src/ports/SkOSFile_stdio.cpp",
409 "src/sfnt/SkOTTable_name.cpp",
410 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700411 "src/svg/SkSVGCanvas.cpp",
412 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700413 "src/utils/mac/SkStream_mac.cpp",
414 "third_party/etc1/etc1.cpp",
415 "third_party/ktx/ktx.cpp",
416 ]
brettwb9447282016-09-01 14:24:39 -0700417
418 # These paths need to be absolute to match the ones produced by
419 # shared_sources.gni, but this file may be used from different directory
420 # locations.
421 sources -= get_path_info([
422 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
423 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
424 ],
425 "abspath")
mtkleinc04ff472016-06-23 10:29:30 -0700426
mtklein7d6fb2c2016-08-25 14:50:44 -0700427 libs = []
428
mtkleinc04ff472016-06-23 10:29:30 -0700429 if (is_win) {
430 sources += [
431 "src/ports/SkDebug_win.cpp",
432 "src/ports/SkFontHost_win.cpp",
433 "src/ports/SkFontMgr_win_dw.cpp",
434 "src/ports/SkFontMgr_win_dw_factory.cpp",
435 "src/ports/SkImageEncoder_WIC.cpp",
436 "src/ports/SkImageGeneratorWIC.cpp",
437 "src/ports/SkOSFile_win.cpp",
438 "src/ports/SkScalerContext_win_dw.cpp",
439 "src/ports/SkTLS_win.cpp",
440 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700441 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700442 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700443 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700444 } else {
445 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700446 "src/ports/SkOSFile_posix.cpp",
447 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700448 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700449 ]
450 }
451
mtklein7d6fb2c2016-08-25 14:50:44 -0700452 if (is_android) {
453 deps += [
454 "//third_party/cpu-features",
455 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700456 ]
457 sources += [
458 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
459 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700460 ]
461 libs += [
462 "EGL",
463 "GLESv2",
464 "log",
465 ]
466 }
467
mtkleinc04ff472016-06-23 10:29:30 -0700468 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700469 libs += [
470 "GL",
471 "GLU",
472 "X11",
473 ]
mtkleinc04ff472016-06-23 10:29:30 -0700474 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700475 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700476 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700477 ]
478 }
479
480 if (is_mac) {
481 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700482 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700483 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700484 "src/ports/SkFontHost_mac.cpp",
485 "src/ports/SkImageEncoder_CG.cpp",
486 "src/ports/SkImageGeneratorCG.cpp",
487 ]
mtklein09e61f72016-08-23 13:35:28 -0700488 libs += [
489 "ApplicationServices.framework",
490 "OpenGL.framework",
491 ]
mtkleinc04ff472016-06-23 10:29:30 -0700492 }
abarth6fc8ff02016-07-15 15:15:15 -0700493
494 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700495 sources += [
496 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700497 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700498 "src/ports/SkFontMgr_empty_factory.cpp",
499 ]
abarth6fc8ff02016-07-15 15:15:15 -0700500 }
mtkleinc04ff472016-06-23 10:29:30 -0700501}
502
mtkleinada5a442016-08-02 14:28:26 -0700503skia_h_headers = exec_script("gyp/find.py",
504 [ "*.h" ] + rebase_path(skia_public_includes),
505 "list lines",
506 []) -
507 [
508 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
509 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
510 rebase_path("include/gpu/vk/GrVkDefines.h"),
511 rebase_path("include/gpu/vk/GrVkInterface.h"),
512 rebase_path("include/gpu/vk/GrVkTypes.h"),
513 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
514 ]
515
mtklein1211e0c2016-07-26 13:55:45 -0700516action("skia.h") {
517 script = "gn/echo_headers.py"
518 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700519 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700520 outputs = [
521 "$target_gen_dir/skia.h",
522 ]
523}
524
525executable("fiddle") {
526 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700527 libs = []
528 if (is_linux) {
529 libs += [ "OSMesa" ]
530 }
mtklein1211e0c2016-07-26 13:55:45 -0700531
mtkleinc04ff472016-06-23 10:29:30 -0700532 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700533 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700534 "tools/fiddle/draw.cpp",
535 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700536 ]
537 deps = [
538 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700539 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700540 ]
mtkleinc04ff472016-06-23 10:29:30 -0700541}
mtklein25c81d42016-07-27 13:55:26 -0700542
mtkleinc095df52016-08-24 12:23:52 -0700543# Targets guarded by skia_enable_tools may use //third_party freely.
544if (skia_enable_tools) {
545 template("test_lib") {
546 config(target_name + "_config") {
547 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700548 }
mtkleinc095df52016-08-24 12:23:52 -0700549 source_set(target_name) {
550 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
551 public_configs = [
552 ":" + target_name + "_config",
553 ":skia_private",
554 ]
555
556 if (!defined(deps)) {
557 deps = []
558 }
559 deps += [ ":skia" ]
560 testonly = true
561 }
mtklein25c81d42016-07-27 13:55:26 -0700562 }
mtklein25c81d42016-07-27 13:55:26 -0700563
mtkleinc095df52016-08-24 12:23:52 -0700564 test_lib("gpu_tool_utils") {
565 public_include_dirs = [ "tools/gpu" ]
566 sources = [
567 "tools/gpu/GrContextFactory.cpp",
568 "tools/gpu/GrTest.cpp",
569 "tools/gpu/TestContext.cpp",
570 "tools/gpu/gl/GLTestContext.cpp",
571 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
572 "tools/gpu/gl/debug/GrBufferObj.cpp",
573 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
574 "tools/gpu/gl/debug/GrProgramObj.cpp",
575 "tools/gpu/gl/debug/GrShaderObj.cpp",
576 "tools/gpu/gl/debug/GrTextureObj.cpp",
577 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
578 "tools/gpu/gl/null/NullGLTestContext.cpp",
579 ]
580 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700581
mtklein7d6fb2c2016-08-25 14:50:44 -0700582 if (is_android) {
583 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
584 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700585 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
586 } else if (is_mac) {
587 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
588 }
mtklein25c81d42016-07-27 13:55:26 -0700589 }
mtklein25c81d42016-07-27 13:55:26 -0700590
mtkleinc095df52016-08-24 12:23:52 -0700591 test_lib("flags") {
592 public_include_dirs = [ "tools/flags" ]
593 sources = [
594 "tools/flags/SkCommandLineFlags.cpp",
595 "tools/flags/SkCommonFlags.cpp",
596 "tools/flags/SkCommonFlagsConfig.cpp",
597 ]
598 deps = [
599 ":gpu_tool_utils",
600 ]
601 }
mtklein25c81d42016-07-27 13:55:26 -0700602
mtkleinc095df52016-08-24 12:23:52 -0700603 test_lib("tool_utils") {
604 public_include_dirs = [
605 "tools",
606 "tools/debugger",
607 "tools/timer",
608 ]
609 sources = [
610 "src/images/SkForceLinking.cpp",
611 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
612 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700613 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700614 "tools/ProcStats.cpp",
615 "tools/Resources.cpp",
616 "tools/ThermalManager.cpp",
617 "tools/UrlDataManager.cpp",
618 "tools/debugger/SkDebugCanvas.cpp",
619 "tools/debugger/SkDrawCommand.cpp",
620 "tools/debugger/SkJsonWriteBuffer.cpp",
621 "tools/debugger/SkObjectParser.cpp",
622 "tools/debugger/SkOverdrawMode.cpp",
623 "tools/picture_utils.cpp",
624 "tools/random_parse_path.cpp",
625 "tools/sk_tool_utils.cpp",
626 "tools/sk_tool_utils_font.cpp",
627 "tools/timer/Timer.cpp",
628 ]
629 deps = [
630 ":flags",
631 "//third_party/libpng",
632 ]
633 public_deps = [
634 "//third_party/jsoncpp",
635 ]
636 }
mtklein25c81d42016-07-27 13:55:26 -0700637
mtkleinc095df52016-08-24 12:23:52 -0700638 gm_sources = exec_script("gyp/find.py",
639 [
640 "*.c*",
641 rebase_path("gm"),
642 ],
643 "list lines",
644 [])
645 test_lib("gm") {
646 public_include_dirs = [ "gm" ]
647 sources = gm_sources
648 deps = [
649 ":gpu_tool_utils",
650 ":skia",
651 ":tool_utils",
652 ]
653 }
mtklein25c81d42016-07-27 13:55:26 -0700654
mtkleinc095df52016-08-24 12:23:52 -0700655 tests_sources = exec_script("gyp/find.py",
656 [
657 "*.c*",
658 rebase_path("tests"),
659 ],
660 "list lines",
661 [])
mtklein2f3416d2016-08-02 16:02:05 -0700662
mtkleinc095df52016-08-24 12:23:52 -0700663 test_lib("tests") {
664 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700665 sources = tests_sources - [
666 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700667 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
668 rebase_path("tests/skia_test.cpp"), # alternate main
669 ]
670 if (!fontmgr_android_enabled) {
671 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
672 }
mtkleinc095df52016-08-24 12:23:52 -0700673 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700674 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700675 ":flags",
676 ":gpu_tool_utils",
677 ":skia",
678 ":tool_utils",
679 "//third_party/libpng",
680 "//third_party/zlib",
681 ]
682 }
mtklein2f3416d2016-08-02 16:02:05 -0700683
mtkleinc095df52016-08-24 12:23:52 -0700684 bench_sources = exec_script("gyp/find.py",
685 [
686 "*.c*",
687 rebase_path("bench"),
688 ],
689 "list lines",
690 [])
mtklein25c81d42016-07-27 13:55:26 -0700691
mtkleinc095df52016-08-24 12:23:52 -0700692 test_lib("bench") {
693 public_include_dirs = [ "bench" ]
694 sources = bench_sources
695 sources -= [
696 rebase_path("bench/nanobench.cpp"),
697 rebase_path("bench/nanobenchAndroid.cpp"),
698 ]
699 deps = [
700 ":flags",
701 ":gm",
702 ":gpu_tool_utils",
703 ":skia",
704 ":tool_utils",
705 ]
706 }
mtklein2b6870c2016-07-28 14:17:33 -0700707
mtkleinc095df52016-08-24 12:23:52 -0700708 test_lib("experimental_svg_model") {
709 public_include_dirs = [ "experimental/svg/model" ]
710 sources = [
711 "experimental/svg/model/SkSVGAttribute.cpp",
712 "experimental/svg/model/SkSVGAttributeParser.cpp",
713 "experimental/svg/model/SkSVGCircle.cpp",
714 "experimental/svg/model/SkSVGContainer.cpp",
715 "experimental/svg/model/SkSVGDOM.cpp",
716 "experimental/svg/model/SkSVGEllipse.cpp",
717 "experimental/svg/model/SkSVGLine.cpp",
718 "experimental/svg/model/SkSVGNode.cpp",
719 "experimental/svg/model/SkSVGPath.cpp",
720 "experimental/svg/model/SkSVGPoly.cpp",
721 "experimental/svg/model/SkSVGRect.cpp",
722 "experimental/svg/model/SkSVGRenderContext.cpp",
723 "experimental/svg/model/SkSVGSVG.cpp",
724 "experimental/svg/model/SkSVGShape.cpp",
725 "experimental/svg/model/SkSVGTransformableNode.cpp",
726 "experimental/svg/model/SkSVGValue.cpp",
727 ]
728 deps = [
729 ":skia",
730 ]
731 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700732
mtklein2b6870c2016-07-28 14:17:33 -0700733 executable("dm") {
734 sources = [
735 "dm/DM.cpp",
736 "dm/DMJsonWriter.cpp",
737 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700738 ]
739 include_dirs = [ "tests" ]
740 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700741 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700742 ":flags",
743 ":gm",
744 ":gpu_tool_utils",
745 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700746 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700747 ":tool_utils",
748 "//third_party/jsoncpp",
749 "//third_party/libpng",
750 ]
751 testonly = true
752 }
753
754 executable("monobench") {
755 sources = [
756 "tools/monobench.cpp",
757 ]
758 deps = [
759 ":bench",
760 ":skia",
761 ]
762 testonly = true
763 }
764
765 executable("nanobench") {
766 sources = [
767 "bench/nanobench.cpp",
768 ]
769 deps = [
770 ":bench",
771 ":flags",
772 ":gm",
773 ":gpu_tool_utils",
774 ":skia",
775 ":tool_utils",
776 "//third_party/jsoncpp",
777 ]
778 testonly = true
779 }
halcanary19a97202016-08-03 15:08:04 -0700780
mtklein6f5df6a2016-08-29 16:01:10 -0700781 if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel.
782 executable("sktexttopdf") {
783 sources = [
784 "tools/SkShaper_harfbuzz.cpp",
785 "tools/using_skia_and_harfbuzz.cpp",
786 ]
787 deps = [
788 ":skia",
789 "//third_party/harfbuzz",
790 ]
791 testonly = true
792 }
halcanary19a97202016-08-03 15:08:04 -0700793 }
mtklein25c81d42016-07-27 13:55:26 -0700794}