blob: 67347ea251a47215d717fc3cf6c6b3f8d5214560 [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
mtkleina45be612016-08-29 15:22:10 -070020fontmgr_android_enabled = skia_use_expat && skia_use_freetype
21
mtklein1211e0c2016-07-26 13:55:45 -070022skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070023 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070024 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070025 "include/codec",
26 "include/config",
27 "include/core",
28 "include/effects",
29 "include/gpu",
30 "include/gpu/gl",
31 "include/images",
32 "include/pathops",
33 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070034 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070035 "include/utils",
36 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070037 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070038]
39
mtkleinc04ff472016-06-23 10:29:30 -070040# Skia public API, generally provided by :skia.
41config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070042 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070043 defines = [ "SKIA_DLL" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070044 if (is_linux) {
45 defines += [ "SK_SAMPLES_FOR_X" ]
46 }
mtkleinc04ff472016-06-23 10:29:30 -070047}
48
49# Skia internal APIs, used by Skia itself and a few test tools.
50config("skia_private") {
51 visibility = [ ":*" ]
52
53 include_dirs = [
54 "include/private",
55 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070056 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070057 "src/config",
58 "src/core",
59 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070060 "src/effects/gradients",
61 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070062 "src/gpu",
63 "src/image",
64 "src/images",
65 "src/lazy",
66 "src/opts",
67 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070068 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070069 "src/ports",
70 "src/sfnt",
71 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070072 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070073 "third_party/etc1",
74 "third_party/ktx",
75 ]
mtklein150d1132016-08-01 06:56:40 -070076
mtklein63213812016-08-24 09:55:56 -070077 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinc04ff472016-06-23 10:29:30 -070078}
79
80# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
81config("skia_library") {
82 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070083 defines = [ "SKIA_IMPLEMENTATION=1" ]
84}
85
86skia_library_configs = [
87 ":skia_public",
88 ":skia_private",
89 ":skia_library",
90]
91
mtklein7fbfbbe2016-07-21 12:25:45 -070092core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070093 [
94 rebase_path("gyp/core.gypi"),
95 "--replace=<(skia_include_path)=include",
96 "--replace=<(skia_src_path)=src",
97 ],
98 "scope",
99 [ "gyp/core.gypi" ])
100
mtklein7fbfbbe2016-07-21 12:25:45 -0700101effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700102 [
103 rebase_path("gyp/effects.gypi"),
104 "--replace=<(skia_include_path)=include",
105 "--replace=<(skia_src_path)=src",
106 ],
107 "scope",
108 [ "gyp/effects.gypi" ])
109
mtklein7fbfbbe2016-07-21 12:25:45 -0700110gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700111 [
112 rebase_path("gyp/gpu.gypi"),
113 "--replace=<(skia_include_path)=include",
114 "--replace=<(skia_src_path)=src",
115 ],
116 "scope",
117 [ "gyp/gpu.gypi" ])
118
mtklein7fbfbbe2016-07-21 12:25:45 -0700119opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700120 [
121 rebase_path("gyp/opts.gypi"),
122 "--replace=<(skia_include_path)=include",
123 "--replace=<(skia_src_path)=src",
124 ],
125 "scope",
126 [ "gyp/opts.gypi" ])
127
mtklein7fbfbbe2016-07-21 12:25:45 -0700128pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700129 [
130 rebase_path("gyp/pdf.gypi"),
131 "--replace=<(skia_include_path)=include",
132 "--replace=<(skia_src_path)=src",
133 ],
134 "scope",
135 [ "gyp/pdf.gypi" ])
136
mtklein7fbfbbe2016-07-21 12:25:45 -0700137utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700138 [
139 rebase_path("gyp/utils.gypi"),
140 "--replace=<(skia_include_path)=include",
141 "--replace=<(skia_src_path)=src",
142 ],
143 "scope",
144 [ "gyp/utils.gypi" ])
145
mtklein9b8583d2016-08-24 17:32:30 -0700146# Use for CPU-specific Skia code that needs particular compiler flags.
147template("opts") {
148 if (invoker.enabled) {
149 source_set(target_name) {
150 forward_variables_from(invoker, "*")
151 configs += skia_library_configs
152 }
153 } else {
154 # If not enabled, a phony empty target that swallows all otherwise unused variables.
155 source_set(target_name) {
156 forward_variables_from(invoker,
157 "*",
158 [
159 "sources",
160 "cflags",
161 ])
162 }
163 }
anmittala7eaf2e2016-08-17 13:57:26 -0700164}
165
mtklein422310d2016-08-16 18:28:43 -0700166is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700167
mtklein7d6fb2c2016-08-25 14:50:44 -0700168opts("none") {
169 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
170 sources = opts_gypi.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700171 cflags = []
172}
173
mtklein7d6fb2c2016-08-25 14:50:44 -0700174opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700175 enabled = current_cpu == "arm"
mtklein7d6fb2c2016-08-25 14:50:44 -0700176 sources = opts_gypi.armv7_sources + opts_gypi.neon_sources
177 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700178}
179
180opts("arm64") {
181 enabled = current_cpu == "arm64"
182 sources = opts_gypi.arm64_sources
183 cflags = []
184}
185
186opts("crc32") {
187 enabled = current_cpu == "arm64"
188 sources = opts_gypi.crc32_sources
189 cflags = [ "-march=armv8-a+crc" ]
190}
191
mtklein9b8583d2016-08-24 17:32:30 -0700192opts("sse2") {
193 enabled = is_x86
194 sources = opts_gypi.sse2_sources
195 cflags = [ "-msse2" ]
196}
mtkleinc04ff472016-06-23 10:29:30 -0700197
mtklein9b8583d2016-08-24 17:32:30 -0700198opts("ssse3") {
199 enabled = is_x86
200 sources = opts_gypi.ssse3_sources
201 cflags = [ "-mssse3" ]
202}
mtkleinc04ff472016-06-23 10:29:30 -0700203
mtklein9b8583d2016-08-24 17:32:30 -0700204opts("sse41") {
205 enabled = is_x86
206 sources = opts_gypi.sse41_sources
207 cflags = [ "-msse4.1" ]
208}
mtklein4e976072016-08-08 09:06:27 -0700209
mtklein9b8583d2016-08-24 17:32:30 -0700210opts("sse42") {
211 enabled = is_x86
212 sources = opts_gypi.sse42_sources
213 cflags = [ "-msse4.2" ]
214}
215
216opts("avx") {
217 enabled = is_x86
218 sources = opts_gypi.avx_sources
219 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700220}
221
mtklein349cece2016-08-26 08:13:04 -0700222opts("dsp") {
223 enabled = current_cpu == "mipsel"
224 sources = opts_gypi.mips_dsp_sources
225 cflags = [ "-Wno-deprecated-register" ] # FIXME
226}
227
mtkleinc095df52016-08-24 12:23:52 -0700228# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700229template("optional") {
230 if (invoker.enabled) {
231 config(target_name + "_public") {
232 defines = invoker.public_defines
233 }
234 source_set(target_name) {
235 forward_variables_from(invoker, "*", [ "public_defines" ])
236 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700237 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700238 }
239 } else {
240 # If not enabled, a phony empty target that swallows all otherwise unused variables.
241 source_set(target_name) {
242 forward_variables_from(invoker,
243 "*",
244 [
245 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700246 "deps",
247 "sources",
248 ])
249 }
mtkleineb3c4252016-08-23 07:38:09 -0700250 }
mtklein457b42a2016-08-23 13:56:37 -0700251}
mtklein457b42a2016-08-23 13:56:37 -0700252
mtkleina45be612016-08-29 15:22:10 -0700253optional("fontmgr_android") {
254 enabled = fontmgr_android_enabled
255 public_defines = []
256
257 deps = [
258 "//third_party/expat",
259 "//third_party/freetype2",
260 ]
261 sources = [
262 "src/ports/SkFontMgr_android.cpp",
263 "src/ports/SkFontMgr_android_factory.cpp",
264 "src/ports/SkFontMgr_android_parser.cpp",
265 ]
266}
267
mtklein3cc22182016-08-29 13:26:14 -0700268optional("fontmgr_fontconfig") {
269 enabled = skia_use_freetype && skia_use_fontconfig
270 public_defines = []
271
272 deps = [
273 "//third_party:fontconfig",
274 "//third_party/freetype2",
275 ]
276 sources = [
277 "src/ports/SkFontConfigInterface_direct.cpp",
278 "src/ports/SkFontConfigInterface_direct_factory.cpp",
279 "src/ports/SkFontMgr_FontConfigInterface.cpp",
280 "src/ports/SkFontMgr_fontconfig.cpp",
281 "src/ports/SkFontMgr_fontconfig_factory.cpp",
282 ]
283}
284
mtklein457b42a2016-08-23 13:56:37 -0700285optional("gif") {
286 enabled = skia_use_giflib
287 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
288
mtklein457b42a2016-08-23 13:56:37 -0700289 deps = [
290 "//third_party/giflib",
291 ]
292 sources = [
293 "src/codec/SkGifCodec.cpp",
294 ]
295}
296
mtklein63213812016-08-24 09:55:56 -0700297optional("jpeg") {
298 enabled = skia_use_libjpeg_turbo
299 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
300
mtklein63213812016-08-24 09:55:56 -0700301 deps = [
302 "//third_party/libjpeg-turbo:libjpeg",
303 ]
304 sources = [
305 "src/codec/SkJpegCodec.cpp",
306 "src/codec/SkJpegDecoderMgr.cpp",
307 "src/codec/SkJpegUtility.cpp",
308 "src/images/SkJPEGImageEncoder.cpp",
309 "src/images/SkJPEGWriteUtility.cpp",
310 ]
311}
312
313optional("pdf") {
314 enabled = skia_use_zlib
315 public_defines = []
316
mtklein63213812016-08-24 09:55:56 -0700317 deps = [
318 "//third_party/zlib",
319 ]
320 sources = pdf_gypi.sources
321
322 if (skia_use_sfntly) {
323 deps += [ "//third_party/sfntly" ]
halcanary650e20d2016-08-25 09:07:02 -0700324 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700325 }
326}
327
328optional("png") {
329 enabled = skia_use_libpng
330 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
331
mtklein63213812016-08-24 09:55:56 -0700332 deps = [
333 "//third_party/libpng",
334 ]
335 sources = [
336 "src/codec/SkIcoCodec.cpp",
337 "src/codec/SkPngCodec.cpp",
338 "src/images/SkPNGImageEncoder.cpp",
339 ]
340}
341
mtklein3cc22182016-08-29 13:26:14 -0700342optional("typeface_freetype") {
343 enabled = skia_use_freetype
344 public_defines = []
345
346 deps = [
347 "//third_party/freetype2",
348 ]
349 sources = [
350 "src/ports/SkFontHost_FreeType.cpp",
351 "src/ports/SkFontHost_FreeType_common.cpp",
352 ]
353}
354
mtklein457b42a2016-08-23 13:56:37 -0700355optional("webp") {
356 enabled = skia_use_libwebp
357 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
358
mtklein457b42a2016-08-23 13:56:37 -0700359 deps = [
360 "//third_party/libwebp",
361 ]
362 sources = [
363 "src/codec/SkWebpAdapterCodec.cpp",
364 "src/codec/SkWebpCodec.cpp",
365 "src/images/SkWEBPImageEncoder.cpp",
366 ]
mtkleineb3c4252016-08-23 07:38:09 -0700367}
368
mtklein63213812016-08-24 09:55:56 -0700369optional("xml") {
370 enabled = skia_use_expat
371 public_defines = []
372
mtklein63213812016-08-24 09:55:56 -0700373 deps = [
374 "//third_party/expat",
375 ]
376 sources = [
377 "src/xml/SkDOM.cpp",
378 "src/xml/SkXMLParser.cpp",
379 "src/xml/SkXMLWriter.cpp",
380 ]
381}
382
mtkleinc04ff472016-06-23 10:29:30 -0700383component("skia") {
384 public_configs = [ ":skia_public" ]
385 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700386
387 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700388 ":arm64",
389 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700390 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700391 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700392 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700393 ":fontmgr_android",
mtklein3cc22182016-08-29 13:26:14 -0700394 ":fontmgr_fontconfig",
mtklein457b42a2016-08-23 13:56:37 -0700395 ":gif",
mtklein63213812016-08-24 09:55:56 -0700396 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700397 ":none",
mtklein63213812016-08-24 09:55:56 -0700398 ":pdf",
399 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700400 ":sse2",
401 ":sse41",
402 ":sse42",
403 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700404 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700405 ":webp",
mtklein63213812016-08-24 09:55:56 -0700406 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700407 ]
408
mtkleinc04ff472016-06-23 10:29:30 -0700409 sources = []
410 sources += core_gypi.sources
411 sources += effects_gypi.sources
412 sources += gpu_gypi.skgpu_sources
mtkleinc04ff472016-06-23 10:29:30 -0700413 sources += utils_gypi.sources
414 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700415 "src/android/SkBitmapRegionCodec.cpp",
416 "src/android/SkBitmapRegionDecoder.cpp",
417 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700418 "src/codec/SkBmpCodec.cpp",
419 "src/codec/SkBmpMaskCodec.cpp",
420 "src/codec/SkBmpRLECodec.cpp",
421 "src/codec/SkBmpStandardCodec.cpp",
422 "src/codec/SkCodec.cpp",
423 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700424 "src/codec/SkMaskSwizzler.cpp",
425 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700426 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700427 "src/codec/SkSampler.cpp",
428 "src/codec/SkSwizzler.cpp",
429 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700430 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700431 "src/images/SkImageEncoder.cpp",
432 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700433 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700434 "src/ports/SkDiscardableMemory_none.cpp",
435 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700436 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700437 "src/ports/SkMemory_malloc.cpp",
438 "src/ports/SkOSFile_stdio.cpp",
439 "src/sfnt/SkOTTable_name.cpp",
440 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700441 "src/svg/SkSVGCanvas.cpp",
442 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700443 "src/utils/mac/SkStream_mac.cpp",
444 "third_party/etc1/etc1.cpp",
445 "third_party/ktx/ktx.cpp",
446 ]
mtklein09e61f72016-08-23 13:35:28 -0700447 sources -= [
448 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
449 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
450 ]
mtkleinc04ff472016-06-23 10:29:30 -0700451
mtklein7d6fb2c2016-08-25 14:50:44 -0700452 libs = []
453
mtkleinc04ff472016-06-23 10:29:30 -0700454 if (is_win) {
455 sources += [
456 "src/ports/SkDebug_win.cpp",
457 "src/ports/SkFontHost_win.cpp",
458 "src/ports/SkFontMgr_win_dw.cpp",
459 "src/ports/SkFontMgr_win_dw_factory.cpp",
460 "src/ports/SkImageEncoder_WIC.cpp",
461 "src/ports/SkImageGeneratorWIC.cpp",
462 "src/ports/SkOSFile_win.cpp",
463 "src/ports/SkScalerContext_win_dw.cpp",
464 "src/ports/SkTLS_win.cpp",
465 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700466 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700467 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700468 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700469 } else {
470 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700471 "src/ports/SkOSFile_posix.cpp",
472 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700473 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700474 ]
475 }
476
mtklein7d6fb2c2016-08-25 14:50:44 -0700477 if (is_android) {
478 deps += [
479 "//third_party/cpu-features",
480 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700481 ]
482 sources += [
483 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
484 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700485 ]
486 libs += [
487 "EGL",
488 "GLESv2",
489 "log",
490 ]
491 }
492
mtkleinc04ff472016-06-23 10:29:30 -0700493 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700494 libs += [
495 "GL",
496 "GLU",
497 "X11",
498 ]
mtkleinc04ff472016-06-23 10:29:30 -0700499 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700500 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700501 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700502 ]
503 }
504
505 if (is_mac) {
506 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700507 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700508 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700509 "src/ports/SkFontHost_mac.cpp",
510 "src/ports/SkImageEncoder_CG.cpp",
511 "src/ports/SkImageGeneratorCG.cpp",
512 ]
mtklein09e61f72016-08-23 13:35:28 -0700513 libs += [
514 "ApplicationServices.framework",
515 "OpenGL.framework",
516 ]
mtkleinc04ff472016-06-23 10:29:30 -0700517 }
abarth6fc8ff02016-07-15 15:15:15 -0700518
519 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700520 sources += [
521 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700522 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700523 "src/ports/SkFontMgr_empty_factory.cpp",
524 ]
abarth6fc8ff02016-07-15 15:15:15 -0700525 }
mtkleinc04ff472016-06-23 10:29:30 -0700526}
527
mtkleinada5a442016-08-02 14:28:26 -0700528skia_h_headers = exec_script("gyp/find.py",
529 [ "*.h" ] + rebase_path(skia_public_includes),
530 "list lines",
531 []) -
532 [
533 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
534 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
535 rebase_path("include/gpu/vk/GrVkDefines.h"),
536 rebase_path("include/gpu/vk/GrVkInterface.h"),
537 rebase_path("include/gpu/vk/GrVkTypes.h"),
538 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
539 ]
540
mtklein1211e0c2016-07-26 13:55:45 -0700541action("skia.h") {
542 script = "gn/echo_headers.py"
543 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700544 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700545 outputs = [
546 "$target_gen_dir/skia.h",
547 ]
548}
549
550executable("fiddle") {
551 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700552 libs = []
553 if (is_linux) {
554 libs += [ "OSMesa" ]
555 }
mtklein1211e0c2016-07-26 13:55:45 -0700556
mtkleinc04ff472016-06-23 10:29:30 -0700557 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700558 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700559 "tools/fiddle/draw.cpp",
560 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700561 ]
562 deps = [
563 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700564 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700565 ]
mtkleinc04ff472016-06-23 10:29:30 -0700566}
mtklein25c81d42016-07-27 13:55:26 -0700567
mtkleinc095df52016-08-24 12:23:52 -0700568# Targets guarded by skia_enable_tools may use //third_party freely.
569if (skia_enable_tools) {
570 template("test_lib") {
571 config(target_name + "_config") {
572 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700573 }
mtkleinc095df52016-08-24 12:23:52 -0700574 source_set(target_name) {
575 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
576 public_configs = [
577 ":" + target_name + "_config",
578 ":skia_private",
579 ]
580
581 if (!defined(deps)) {
582 deps = []
583 }
584 deps += [ ":skia" ]
585 testonly = true
586 }
mtklein25c81d42016-07-27 13:55:26 -0700587 }
mtklein25c81d42016-07-27 13:55:26 -0700588
mtkleinc095df52016-08-24 12:23:52 -0700589 test_lib("gpu_tool_utils") {
590 public_include_dirs = [ "tools/gpu" ]
591 sources = [
592 "tools/gpu/GrContextFactory.cpp",
593 "tools/gpu/GrTest.cpp",
594 "tools/gpu/TestContext.cpp",
595 "tools/gpu/gl/GLTestContext.cpp",
596 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
597 "tools/gpu/gl/debug/GrBufferObj.cpp",
598 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
599 "tools/gpu/gl/debug/GrProgramObj.cpp",
600 "tools/gpu/gl/debug/GrShaderObj.cpp",
601 "tools/gpu/gl/debug/GrTextureObj.cpp",
602 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
603 "tools/gpu/gl/null/NullGLTestContext.cpp",
604 ]
605 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700606
mtklein7d6fb2c2016-08-25 14:50:44 -0700607 if (is_android) {
608 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
609 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700610 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
611 } else if (is_mac) {
612 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
613 }
mtklein25c81d42016-07-27 13:55:26 -0700614 }
mtklein25c81d42016-07-27 13:55:26 -0700615
mtkleinc095df52016-08-24 12:23:52 -0700616 test_lib("flags") {
617 public_include_dirs = [ "tools/flags" ]
618 sources = [
619 "tools/flags/SkCommandLineFlags.cpp",
620 "tools/flags/SkCommonFlags.cpp",
621 "tools/flags/SkCommonFlagsConfig.cpp",
622 ]
623 deps = [
624 ":gpu_tool_utils",
625 ]
626 }
mtklein25c81d42016-07-27 13:55:26 -0700627
mtkleinc095df52016-08-24 12:23:52 -0700628 test_lib("tool_utils") {
629 public_include_dirs = [
630 "tools",
631 "tools/debugger",
632 "tools/timer",
633 ]
634 sources = [
635 "src/images/SkForceLinking.cpp",
636 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
637 "tools/CrashHandler.cpp",
638 "tools/ProcStats.cpp",
639 "tools/Resources.cpp",
640 "tools/ThermalManager.cpp",
641 "tools/UrlDataManager.cpp",
642 "tools/debugger/SkDebugCanvas.cpp",
643 "tools/debugger/SkDrawCommand.cpp",
644 "tools/debugger/SkJsonWriteBuffer.cpp",
645 "tools/debugger/SkObjectParser.cpp",
646 "tools/debugger/SkOverdrawMode.cpp",
647 "tools/picture_utils.cpp",
648 "tools/random_parse_path.cpp",
649 "tools/sk_tool_utils.cpp",
650 "tools/sk_tool_utils_font.cpp",
651 "tools/timer/Timer.cpp",
652 ]
653 deps = [
654 ":flags",
655 "//third_party/libpng",
656 ]
657 public_deps = [
658 "//third_party/jsoncpp",
659 ]
660 }
mtklein25c81d42016-07-27 13:55:26 -0700661
mtkleinc095df52016-08-24 12:23:52 -0700662 gm_sources = exec_script("gyp/find.py",
663 [
664 "*.c*",
665 rebase_path("gm"),
666 ],
667 "list lines",
668 [])
669 test_lib("gm") {
670 public_include_dirs = [ "gm" ]
671 sources = gm_sources
672 deps = [
673 ":gpu_tool_utils",
674 ":skia",
675 ":tool_utils",
676 ]
677 }
mtklein25c81d42016-07-27 13:55:26 -0700678
mtkleinc095df52016-08-24 12:23:52 -0700679 tests_sources = exec_script("gyp/find.py",
680 [
681 "*.c*",
682 rebase_path("tests"),
683 ],
684 "list lines",
685 [])
mtklein2f3416d2016-08-02 16:02:05 -0700686
mtkleinc095df52016-08-24 12:23:52 -0700687 test_lib("tests") {
688 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700689 sources = tests_sources - [
690 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
691 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
692 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
693 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
694 rebase_path("tests/skia_test.cpp"), # alternate main
695 ]
696 if (!fontmgr_android_enabled) {
697 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
698 }
mtkleinc095df52016-08-24 12:23:52 -0700699 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700700 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700701 ":flags",
702 ":gpu_tool_utils",
703 ":skia",
704 ":tool_utils",
705 "//third_party/libpng",
706 "//third_party/zlib",
707 ]
708 }
mtklein2f3416d2016-08-02 16:02:05 -0700709
mtkleinc095df52016-08-24 12:23:52 -0700710 bench_sources = exec_script("gyp/find.py",
711 [
712 "*.c*",
713 rebase_path("bench"),
714 ],
715 "list lines",
716 [])
mtklein25c81d42016-07-27 13:55:26 -0700717
mtkleinc095df52016-08-24 12:23:52 -0700718 test_lib("bench") {
719 public_include_dirs = [ "bench" ]
720 sources = bench_sources
721 sources -= [
722 rebase_path("bench/nanobench.cpp"),
723 rebase_path("bench/nanobenchAndroid.cpp"),
724 ]
725 deps = [
726 ":flags",
727 ":gm",
728 ":gpu_tool_utils",
729 ":skia",
730 ":tool_utils",
731 ]
732 }
mtklein2b6870c2016-07-28 14:17:33 -0700733
mtkleinc095df52016-08-24 12:23:52 -0700734 test_lib("experimental_svg_model") {
735 public_include_dirs = [ "experimental/svg/model" ]
736 sources = [
737 "experimental/svg/model/SkSVGAttribute.cpp",
738 "experimental/svg/model/SkSVGAttributeParser.cpp",
739 "experimental/svg/model/SkSVGCircle.cpp",
740 "experimental/svg/model/SkSVGContainer.cpp",
741 "experimental/svg/model/SkSVGDOM.cpp",
742 "experimental/svg/model/SkSVGEllipse.cpp",
743 "experimental/svg/model/SkSVGLine.cpp",
744 "experimental/svg/model/SkSVGNode.cpp",
745 "experimental/svg/model/SkSVGPath.cpp",
746 "experimental/svg/model/SkSVGPoly.cpp",
747 "experimental/svg/model/SkSVGRect.cpp",
748 "experimental/svg/model/SkSVGRenderContext.cpp",
749 "experimental/svg/model/SkSVGSVG.cpp",
750 "experimental/svg/model/SkSVGShape.cpp",
751 "experimental/svg/model/SkSVGTransformableNode.cpp",
752 "experimental/svg/model/SkSVGValue.cpp",
753 ]
754 deps = [
755 ":skia",
756 ]
757 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700758
mtklein2b6870c2016-07-28 14:17:33 -0700759 executable("dm") {
760 sources = [
761 "dm/DM.cpp",
762 "dm/DMJsonWriter.cpp",
763 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700764 ]
765 include_dirs = [ "tests" ]
766 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700767 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700768 ":flags",
769 ":gm",
770 ":gpu_tool_utils",
771 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700772 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700773 ":tool_utils",
774 "//third_party/jsoncpp",
775 "//third_party/libpng",
776 ]
777 testonly = true
778 }
779
780 executable("monobench") {
781 sources = [
782 "tools/monobench.cpp",
783 ]
784 deps = [
785 ":bench",
786 ":skia",
787 ]
788 testonly = true
789 }
790
791 executable("nanobench") {
792 sources = [
793 "bench/nanobench.cpp",
794 ]
795 deps = [
796 ":bench",
797 ":flags",
798 ":gm",
799 ":gpu_tool_utils",
800 ":skia",
801 ":tool_utils",
802 "//third_party/jsoncpp",
803 ]
804 testonly = true
805 }
halcanary19a97202016-08-03 15:08:04 -0700806
mtklein6f5df6a2016-08-29 16:01:10 -0700807 if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel.
808 executable("sktexttopdf") {
809 sources = [
810 "tools/SkShaper_harfbuzz.cpp",
811 "tools/using_skia_and_harfbuzz.cpp",
812 ]
813 deps = [
814 ":skia",
815 "//third_party/harfbuzz",
816 ]
817 testonly = true
818 }
halcanary19a97202016-08-03 15:08:04 -0700819 }
mtklein25c81d42016-07-27 13:55:26 -0700820}