blob: 6b761f0cd42322b92deab5bf59843fe9e8678ab7 [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
6declare_args() {
mtkleinc095df52016-08-24 12:23:52 -07007 skia_enable_tools = !is_fuchsia && !is_component_build
8
mtklein63213812016-08-24 09:55:56 -07009 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070010 skia_use_fontconfig = is_linux
11 skia_use_freetype = is_android || is_linux
mtklein457b42a2016-08-23 13:56:37 -070012 skia_use_giflib = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070013 skia_use_libjpeg_turbo = true
14 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070015 skia_use_libwebp = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070016 skia_use_sfntly = !is_fuchsia
17 skia_use_zlib = true
mtkleinc04ff472016-06-23 10:29:30 -070018}
19
mtklein1211e0c2016-07-26 13:55:45 -070020skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070021 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070022 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070023 "include/codec",
24 "include/config",
25 "include/core",
26 "include/effects",
27 "include/gpu",
28 "include/gpu/gl",
29 "include/images",
30 "include/pathops",
31 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070032 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070033 "include/utils",
34 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070035 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070036]
37
mtkleinc04ff472016-06-23 10:29:30 -070038# Skia public API, generally provided by :skia.
39config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070040 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070041 defines = [ "SKIA_DLL" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070042 if (is_linux) {
43 defines += [ "SK_SAMPLES_FOR_X" ]
44 }
mtkleinc04ff472016-06-23 10:29:30 -070045}
46
47# Skia internal APIs, used by Skia itself and a few test tools.
48config("skia_private") {
49 visibility = [ ":*" ]
50
51 include_dirs = [
52 "include/private",
53 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070054 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070055 "src/config",
56 "src/core",
57 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070058 "src/effects/gradients",
59 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070060 "src/gpu",
61 "src/image",
62 "src/images",
63 "src/lazy",
64 "src/opts",
65 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070066 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070067 "src/ports",
68 "src/sfnt",
69 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070070 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070071 "third_party/etc1",
72 "third_party/ktx",
73 ]
mtklein150d1132016-08-01 06:56:40 -070074
mtklein63213812016-08-24 09:55:56 -070075 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinc04ff472016-06-23 10:29:30 -070076}
77
78# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
79config("skia_library") {
80 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070081 defines = [ "SKIA_IMPLEMENTATION=1" ]
82}
83
84skia_library_configs = [
85 ":skia_public",
86 ":skia_private",
87 ":skia_library",
88]
89
mtklein7fbfbbe2016-07-21 12:25:45 -070090core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070091 [
92 rebase_path("gyp/core.gypi"),
93 "--replace=<(skia_include_path)=include",
94 "--replace=<(skia_src_path)=src",
95 ],
96 "scope",
97 [ "gyp/core.gypi" ])
98
mtklein7fbfbbe2016-07-21 12:25:45 -070099effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700100 [
101 rebase_path("gyp/effects.gypi"),
102 "--replace=<(skia_include_path)=include",
103 "--replace=<(skia_src_path)=src",
104 ],
105 "scope",
106 [ "gyp/effects.gypi" ])
107
mtklein7fbfbbe2016-07-21 12:25:45 -0700108gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700109 [
110 rebase_path("gyp/gpu.gypi"),
111 "--replace=<(skia_include_path)=include",
112 "--replace=<(skia_src_path)=src",
113 ],
114 "scope",
115 [ "gyp/gpu.gypi" ])
116
mtklein7fbfbbe2016-07-21 12:25:45 -0700117opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700118 [
119 rebase_path("gyp/opts.gypi"),
120 "--replace=<(skia_include_path)=include",
121 "--replace=<(skia_src_path)=src",
122 ],
123 "scope",
124 [ "gyp/opts.gypi" ])
125
mtklein7fbfbbe2016-07-21 12:25:45 -0700126pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700127 [
128 rebase_path("gyp/pdf.gypi"),
129 "--replace=<(skia_include_path)=include",
130 "--replace=<(skia_src_path)=src",
131 ],
132 "scope",
133 [ "gyp/pdf.gypi" ])
134
mtklein7fbfbbe2016-07-21 12:25:45 -0700135utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700136 [
137 rebase_path("gyp/utils.gypi"),
138 "--replace=<(skia_include_path)=include",
139 "--replace=<(skia_src_path)=src",
140 ],
141 "scope",
142 [ "gyp/utils.gypi" ])
143
mtklein9b8583d2016-08-24 17:32:30 -0700144# Use for CPU-specific Skia code that needs particular compiler flags.
145template("opts") {
146 if (invoker.enabled) {
147 source_set(target_name) {
148 forward_variables_from(invoker, "*")
149 configs += skia_library_configs
150 }
151 } else {
152 # If not enabled, a phony empty target that swallows all otherwise unused variables.
153 source_set(target_name) {
154 forward_variables_from(invoker,
155 "*",
156 [
157 "sources",
158 "cflags",
159 ])
160 }
161 }
anmittala7eaf2e2016-08-17 13:57:26 -0700162}
163
mtklein422310d2016-08-16 18:28:43 -0700164is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700165
mtklein7d6fb2c2016-08-25 14:50:44 -0700166opts("none") {
167 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
168 sources = opts_gypi.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700169 cflags = []
170}
171
mtklein7d6fb2c2016-08-25 14:50:44 -0700172opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700173 enabled = current_cpu == "arm"
mtklein7d6fb2c2016-08-25 14:50:44 -0700174 sources = opts_gypi.armv7_sources + opts_gypi.neon_sources
175 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700176}
177
178opts("arm64") {
179 enabled = current_cpu == "arm64"
180 sources = opts_gypi.arm64_sources
181 cflags = []
182}
183
184opts("crc32") {
185 enabled = current_cpu == "arm64"
186 sources = opts_gypi.crc32_sources
187 cflags = [ "-march=armv8-a+crc" ]
188}
189
mtklein9b8583d2016-08-24 17:32:30 -0700190opts("sse2") {
191 enabled = is_x86
192 sources = opts_gypi.sse2_sources
193 cflags = [ "-msse2" ]
194}
mtkleinc04ff472016-06-23 10:29:30 -0700195
mtklein9b8583d2016-08-24 17:32:30 -0700196opts("ssse3") {
197 enabled = is_x86
198 sources = opts_gypi.ssse3_sources
199 cflags = [ "-mssse3" ]
200}
mtkleinc04ff472016-06-23 10:29:30 -0700201
mtklein9b8583d2016-08-24 17:32:30 -0700202opts("sse41") {
203 enabled = is_x86
204 sources = opts_gypi.sse41_sources
205 cflags = [ "-msse4.1" ]
206}
mtklein4e976072016-08-08 09:06:27 -0700207
mtklein9b8583d2016-08-24 17:32:30 -0700208opts("sse42") {
209 enabled = is_x86
210 sources = opts_gypi.sse42_sources
211 cflags = [ "-msse4.2" ]
212}
213
214opts("avx") {
215 enabled = is_x86
216 sources = opts_gypi.avx_sources
217 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700218}
219
mtklein349cece2016-08-26 08:13:04 -0700220opts("dsp") {
221 enabled = current_cpu == "mipsel"
222 sources = opts_gypi.mips_dsp_sources
223 cflags = [ "-Wno-deprecated-register" ] # FIXME
224}
225
mtkleinc095df52016-08-24 12:23:52 -0700226# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700227template("optional") {
228 if (invoker.enabled) {
229 config(target_name + "_public") {
230 defines = invoker.public_defines
231 }
232 source_set(target_name) {
233 forward_variables_from(invoker, "*", [ "public_defines" ])
234 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700235 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700236 }
237 } else {
238 # If not enabled, a phony empty target that swallows all otherwise unused variables.
239 source_set(target_name) {
240 forward_variables_from(invoker,
241 "*",
242 [
243 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700244 "deps",
245 "sources",
246 ])
247 }
mtkleineb3c4252016-08-23 07:38:09 -0700248 }
mtklein457b42a2016-08-23 13:56:37 -0700249}
mtklein457b42a2016-08-23 13:56:37 -0700250
mtklein3cc22182016-08-29 13:26:14 -0700251optional("fontmgr_fontconfig") {
252 enabled = skia_use_freetype && skia_use_fontconfig
253 public_defines = []
254
255 deps = [
256 "//third_party:fontconfig",
257 "//third_party/freetype2",
258 ]
259 sources = [
260 "src/ports/SkFontConfigInterface_direct.cpp",
261 "src/ports/SkFontConfigInterface_direct_factory.cpp",
262 "src/ports/SkFontMgr_FontConfigInterface.cpp",
263 "src/ports/SkFontMgr_fontconfig.cpp",
264 "src/ports/SkFontMgr_fontconfig_factory.cpp",
265 ]
266}
267
mtklein457b42a2016-08-23 13:56:37 -0700268optional("gif") {
269 enabled = skia_use_giflib
270 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
271
mtklein457b42a2016-08-23 13:56:37 -0700272 deps = [
273 "//third_party/giflib",
274 ]
275 sources = [
276 "src/codec/SkGifCodec.cpp",
277 ]
278}
279
mtklein63213812016-08-24 09:55:56 -0700280optional("jpeg") {
281 enabled = skia_use_libjpeg_turbo
282 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
283
mtklein63213812016-08-24 09:55:56 -0700284 deps = [
285 "//third_party/libjpeg-turbo:libjpeg",
286 ]
287 sources = [
288 "src/codec/SkJpegCodec.cpp",
289 "src/codec/SkJpegDecoderMgr.cpp",
290 "src/codec/SkJpegUtility.cpp",
291 "src/images/SkJPEGImageEncoder.cpp",
292 "src/images/SkJPEGWriteUtility.cpp",
293 ]
294}
295
296optional("pdf") {
297 enabled = skia_use_zlib
298 public_defines = []
299
mtklein63213812016-08-24 09:55:56 -0700300 deps = [
301 "//third_party/zlib",
302 ]
303 sources = pdf_gypi.sources
304
305 if (skia_use_sfntly) {
306 deps += [ "//third_party/sfntly" ]
halcanary650e20d2016-08-25 09:07:02 -0700307 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700308 }
309}
310
311optional("png") {
312 enabled = skia_use_libpng
313 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
314
mtklein63213812016-08-24 09:55:56 -0700315 deps = [
316 "//third_party/libpng",
317 ]
318 sources = [
319 "src/codec/SkIcoCodec.cpp",
320 "src/codec/SkPngCodec.cpp",
321 "src/images/SkPNGImageEncoder.cpp",
322 ]
323}
324
mtklein3cc22182016-08-29 13:26:14 -0700325optional("typeface_freetype") {
326 enabled = skia_use_freetype
327 public_defines = []
328
329 deps = [
330 "//third_party/freetype2",
331 ]
332 sources = [
333 "src/ports/SkFontHost_FreeType.cpp",
334 "src/ports/SkFontHost_FreeType_common.cpp",
335 ]
336}
337
mtklein457b42a2016-08-23 13:56:37 -0700338optional("webp") {
339 enabled = skia_use_libwebp
340 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
341
mtklein457b42a2016-08-23 13:56:37 -0700342 deps = [
343 "//third_party/libwebp",
344 ]
345 sources = [
346 "src/codec/SkWebpAdapterCodec.cpp",
347 "src/codec/SkWebpCodec.cpp",
348 "src/images/SkWEBPImageEncoder.cpp",
349 ]
mtkleineb3c4252016-08-23 07:38:09 -0700350}
351
mtklein63213812016-08-24 09:55:56 -0700352optional("xml") {
353 enabled = skia_use_expat
354 public_defines = []
355
mtklein63213812016-08-24 09:55:56 -0700356 deps = [
357 "//third_party/expat",
358 ]
359 sources = [
360 "src/xml/SkDOM.cpp",
361 "src/xml/SkXMLParser.cpp",
362 "src/xml/SkXMLWriter.cpp",
363 ]
364}
365
mtkleinc04ff472016-06-23 10:29:30 -0700366component("skia") {
367 public_configs = [ ":skia_public" ]
368 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700369
370 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700371 ":arm64",
372 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700373 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700374 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700375 ":dsp",
mtklein3cc22182016-08-29 13:26:14 -0700376 ":fontmgr_fontconfig",
mtklein457b42a2016-08-23 13:56:37 -0700377 ":gif",
mtklein63213812016-08-24 09:55:56 -0700378 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700379 ":none",
mtklein63213812016-08-24 09:55:56 -0700380 ":pdf",
381 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700382 ":sse2",
383 ":sse41",
384 ":sse42",
385 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700386 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700387 ":webp",
mtklein63213812016-08-24 09:55:56 -0700388 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700389 ]
390
mtkleinc04ff472016-06-23 10:29:30 -0700391 sources = []
392 sources += core_gypi.sources
393 sources += effects_gypi.sources
394 sources += gpu_gypi.skgpu_sources
mtkleinc04ff472016-06-23 10:29:30 -0700395 sources += utils_gypi.sources
396 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700397 "src/android/SkBitmapRegionCodec.cpp",
398 "src/android/SkBitmapRegionDecoder.cpp",
399 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700400 "src/codec/SkBmpCodec.cpp",
401 "src/codec/SkBmpMaskCodec.cpp",
402 "src/codec/SkBmpRLECodec.cpp",
403 "src/codec/SkBmpStandardCodec.cpp",
404 "src/codec/SkCodec.cpp",
405 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700406 "src/codec/SkMaskSwizzler.cpp",
407 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700408 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700409 "src/codec/SkSampler.cpp",
410 "src/codec/SkSwizzler.cpp",
411 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700412 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700413 "src/images/SkImageEncoder.cpp",
414 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700415 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700416 "src/ports/SkDiscardableMemory_none.cpp",
417 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700418 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700419 "src/ports/SkMemory_malloc.cpp",
420 "src/ports/SkOSFile_stdio.cpp",
421 "src/sfnt/SkOTTable_name.cpp",
422 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700423 "src/svg/SkSVGCanvas.cpp",
424 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700425 "src/utils/mac/SkStream_mac.cpp",
426 "third_party/etc1/etc1.cpp",
427 "third_party/ktx/ktx.cpp",
428 ]
mtklein09e61f72016-08-23 13:35:28 -0700429 sources -= [
430 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
431 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
432 ]
mtkleinc04ff472016-06-23 10:29:30 -0700433
mtklein7d6fb2c2016-08-25 14:50:44 -0700434 libs = []
435
mtkleinc04ff472016-06-23 10:29:30 -0700436 if (is_win) {
437 sources += [
438 "src/ports/SkDebug_win.cpp",
439 "src/ports/SkFontHost_win.cpp",
440 "src/ports/SkFontMgr_win_dw.cpp",
441 "src/ports/SkFontMgr_win_dw_factory.cpp",
442 "src/ports/SkImageEncoder_WIC.cpp",
443 "src/ports/SkImageGeneratorWIC.cpp",
444 "src/ports/SkOSFile_win.cpp",
445 "src/ports/SkScalerContext_win_dw.cpp",
446 "src/ports/SkTLS_win.cpp",
447 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700448 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700449 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700450 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700451 } else {
452 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700453 "src/ports/SkOSFile_posix.cpp",
454 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700455 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700456 ]
457 }
458
mtklein7d6fb2c2016-08-25 14:50:44 -0700459 if (is_android) {
460 deps += [
461 "//third_party/cpu-features",
462 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700463 ]
464 sources += [
465 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
466 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700467 "src/ports/SkFontMgr_android.cpp",
468 "src/ports/SkFontMgr_android_factory.cpp",
469 "src/ports/SkFontMgr_android_parser.cpp",
470 ]
471 libs += [
472 "EGL",
473 "GLESv2",
474 "log",
475 ]
476 }
477
mtkleinc04ff472016-06-23 10:29:30 -0700478 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700479 libs += [
480 "GL",
481 "GLU",
482 "X11",
483 ]
mtkleinc04ff472016-06-23 10:29:30 -0700484 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700485 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700486 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700487 ]
488 }
489
490 if (is_mac) {
491 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700492 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700493 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700494 "src/ports/SkFontHost_mac.cpp",
495 "src/ports/SkImageEncoder_CG.cpp",
496 "src/ports/SkImageGeneratorCG.cpp",
497 ]
mtklein09e61f72016-08-23 13:35:28 -0700498 libs += [
499 "ApplicationServices.framework",
500 "OpenGL.framework",
501 ]
mtkleinc04ff472016-06-23 10:29:30 -0700502 }
abarth6fc8ff02016-07-15 15:15:15 -0700503
504 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700505 sources += [
506 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700507 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700508 "src/ports/SkFontMgr_empty_factory.cpp",
509 ]
abarth6fc8ff02016-07-15 15:15:15 -0700510 }
mtkleinc04ff472016-06-23 10:29:30 -0700511}
512
mtkleinada5a442016-08-02 14:28:26 -0700513skia_h_headers = exec_script("gyp/find.py",
514 [ "*.h" ] + rebase_path(skia_public_includes),
515 "list lines",
516 []) -
517 [
518 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
519 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
520 rebase_path("include/gpu/vk/GrVkDefines.h"),
521 rebase_path("include/gpu/vk/GrVkInterface.h"),
522 rebase_path("include/gpu/vk/GrVkTypes.h"),
523 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
524 ]
525
mtklein1211e0c2016-07-26 13:55:45 -0700526action("skia.h") {
527 script = "gn/echo_headers.py"
528 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700529 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700530 outputs = [
531 "$target_gen_dir/skia.h",
532 ]
533}
534
535executable("fiddle") {
536 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700537 libs = []
538 if (is_linux) {
539 libs += [ "OSMesa" ]
540 }
mtklein1211e0c2016-07-26 13:55:45 -0700541
mtkleinc04ff472016-06-23 10:29:30 -0700542 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700543 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700544 "tools/fiddle/draw.cpp",
545 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700546 ]
547 deps = [
548 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700549 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700550 ]
mtkleinc04ff472016-06-23 10:29:30 -0700551}
mtklein25c81d42016-07-27 13:55:26 -0700552
mtkleinc095df52016-08-24 12:23:52 -0700553# Targets guarded by skia_enable_tools may use //third_party freely.
554if (skia_enable_tools) {
555 template("test_lib") {
556 config(target_name + "_config") {
557 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700558 }
mtkleinc095df52016-08-24 12:23:52 -0700559 source_set(target_name) {
560 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
561 public_configs = [
562 ":" + target_name + "_config",
563 ":skia_private",
564 ]
565
566 if (!defined(deps)) {
567 deps = []
568 }
569 deps += [ ":skia" ]
570 testonly = true
571 }
mtklein25c81d42016-07-27 13:55:26 -0700572 }
mtklein25c81d42016-07-27 13:55:26 -0700573
mtkleinc095df52016-08-24 12:23:52 -0700574 test_lib("gpu_tool_utils") {
575 public_include_dirs = [ "tools/gpu" ]
576 sources = [
577 "tools/gpu/GrContextFactory.cpp",
578 "tools/gpu/GrTest.cpp",
579 "tools/gpu/TestContext.cpp",
580 "tools/gpu/gl/GLTestContext.cpp",
581 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
582 "tools/gpu/gl/debug/GrBufferObj.cpp",
583 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
584 "tools/gpu/gl/debug/GrProgramObj.cpp",
585 "tools/gpu/gl/debug/GrShaderObj.cpp",
586 "tools/gpu/gl/debug/GrTextureObj.cpp",
587 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
588 "tools/gpu/gl/null/NullGLTestContext.cpp",
589 ]
590 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700591
mtklein7d6fb2c2016-08-25 14:50:44 -0700592 if (is_android) {
593 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
594 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700595 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
596 } else if (is_mac) {
597 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
598 }
mtklein25c81d42016-07-27 13:55:26 -0700599 }
mtklein25c81d42016-07-27 13:55:26 -0700600
mtkleinc095df52016-08-24 12:23:52 -0700601 test_lib("flags") {
602 public_include_dirs = [ "tools/flags" ]
603 sources = [
604 "tools/flags/SkCommandLineFlags.cpp",
605 "tools/flags/SkCommonFlags.cpp",
606 "tools/flags/SkCommonFlagsConfig.cpp",
607 ]
608 deps = [
609 ":gpu_tool_utils",
610 ]
611 }
mtklein25c81d42016-07-27 13:55:26 -0700612
mtkleinc095df52016-08-24 12:23:52 -0700613 test_lib("tool_utils") {
614 public_include_dirs = [
615 "tools",
616 "tools/debugger",
617 "tools/timer",
618 ]
619 sources = [
620 "src/images/SkForceLinking.cpp",
621 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
622 "tools/CrashHandler.cpp",
623 "tools/ProcStats.cpp",
624 "tools/Resources.cpp",
625 "tools/ThermalManager.cpp",
626 "tools/UrlDataManager.cpp",
627 "tools/debugger/SkDebugCanvas.cpp",
628 "tools/debugger/SkDrawCommand.cpp",
629 "tools/debugger/SkJsonWriteBuffer.cpp",
630 "tools/debugger/SkObjectParser.cpp",
631 "tools/debugger/SkOverdrawMode.cpp",
632 "tools/picture_utils.cpp",
633 "tools/random_parse_path.cpp",
634 "tools/sk_tool_utils.cpp",
635 "tools/sk_tool_utils_font.cpp",
636 "tools/timer/Timer.cpp",
637 ]
638 deps = [
639 ":flags",
640 "//third_party/libpng",
641 ]
642 public_deps = [
643 "//third_party/jsoncpp",
644 ]
645 }
mtklein25c81d42016-07-27 13:55:26 -0700646
mtkleinc095df52016-08-24 12:23:52 -0700647 gm_sources = exec_script("gyp/find.py",
648 [
649 "*.c*",
650 rebase_path("gm"),
651 ],
652 "list lines",
653 [])
654 test_lib("gm") {
655 public_include_dirs = [ "gm" ]
656 sources = gm_sources
657 deps = [
658 ":gpu_tool_utils",
659 ":skia",
660 ":tool_utils",
661 ]
662 }
mtklein25c81d42016-07-27 13:55:26 -0700663
mtkleinc095df52016-08-24 12:23:52 -0700664 tests_sources = exec_script("gyp/find.py",
665 [
666 "*.c*",
667 rebase_path("tests"),
668 ],
669 "list lines",
670 [])
mtklein2f3416d2016-08-02 16:02:05 -0700671
mtkleinc095df52016-08-24 12:23:52 -0700672 test_lib("tests") {
673 public_include_dirs = [ "tests" ]
674 sources =
675 tests_sources - [
676 rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only
677 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
678 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
679 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
680 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
681 rebase_path("tests/skia_test.cpp"), # alternate main
682 ]
683 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700684 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700685 ":flags",
686 ":gpu_tool_utils",
687 ":skia",
688 ":tool_utils",
689 "//third_party/libpng",
690 "//third_party/zlib",
691 ]
692 }
mtklein2f3416d2016-08-02 16:02:05 -0700693
mtkleinc095df52016-08-24 12:23:52 -0700694 bench_sources = exec_script("gyp/find.py",
695 [
696 "*.c*",
697 rebase_path("bench"),
698 ],
699 "list lines",
700 [])
mtklein25c81d42016-07-27 13:55:26 -0700701
mtkleinc095df52016-08-24 12:23:52 -0700702 test_lib("bench") {
703 public_include_dirs = [ "bench" ]
704 sources = bench_sources
705 sources -= [
706 rebase_path("bench/nanobench.cpp"),
707 rebase_path("bench/nanobenchAndroid.cpp"),
708 ]
709 deps = [
710 ":flags",
711 ":gm",
712 ":gpu_tool_utils",
713 ":skia",
714 ":tool_utils",
715 ]
716 }
mtklein2b6870c2016-07-28 14:17:33 -0700717
mtkleinc095df52016-08-24 12:23:52 -0700718 test_lib("experimental_svg_model") {
719 public_include_dirs = [ "experimental/svg/model" ]
720 sources = [
721 "experimental/svg/model/SkSVGAttribute.cpp",
722 "experimental/svg/model/SkSVGAttributeParser.cpp",
723 "experimental/svg/model/SkSVGCircle.cpp",
724 "experimental/svg/model/SkSVGContainer.cpp",
725 "experimental/svg/model/SkSVGDOM.cpp",
726 "experimental/svg/model/SkSVGEllipse.cpp",
727 "experimental/svg/model/SkSVGLine.cpp",
728 "experimental/svg/model/SkSVGNode.cpp",
729 "experimental/svg/model/SkSVGPath.cpp",
730 "experimental/svg/model/SkSVGPoly.cpp",
731 "experimental/svg/model/SkSVGRect.cpp",
732 "experimental/svg/model/SkSVGRenderContext.cpp",
733 "experimental/svg/model/SkSVGSVG.cpp",
734 "experimental/svg/model/SkSVGShape.cpp",
735 "experimental/svg/model/SkSVGTransformableNode.cpp",
736 "experimental/svg/model/SkSVGValue.cpp",
737 ]
738 deps = [
739 ":skia",
740 ]
741 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700742
mtklein2b6870c2016-07-28 14:17:33 -0700743 executable("dm") {
744 sources = [
745 "dm/DM.cpp",
746 "dm/DMJsonWriter.cpp",
747 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700748 ]
749 include_dirs = [ "tests" ]
750 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700751 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700752 ":flags",
753 ":gm",
754 ":gpu_tool_utils",
755 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700756 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700757 ":tool_utils",
758 "//third_party/jsoncpp",
759 "//third_party/libpng",
760 ]
761 testonly = true
762 }
763
764 executable("monobench") {
765 sources = [
766 "tools/monobench.cpp",
767 ]
768 deps = [
769 ":bench",
770 ":skia",
771 ]
772 testonly = true
773 }
774
775 executable("nanobench") {
776 sources = [
777 "bench/nanobench.cpp",
778 ]
779 deps = [
780 ":bench",
781 ":flags",
782 ":gm",
783 ":gpu_tool_utils",
784 ":skia",
785 ":tool_utils",
786 "//third_party/jsoncpp",
787 ]
788 testonly = true
789 }
halcanary19a97202016-08-03 15:08:04 -0700790
791 executable("sktexttopdf") {
792 sources = [
793 "tools/SkShaper_harfbuzz.cpp",
794 "tools/using_skia_and_harfbuzz.cpp",
795 ]
796 deps = [
797 ":skia",
798 "//third_party/harfbuzz",
799 ]
800 testonly = true
801 }
mtklein25c81d42016-07-27 13:55:26 -0700802}