blob: 02cb350d57e14b4c6b174f82723dbb38e1beed3f [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
mtklein457b42a2016-08-23 13:56:37 -070010 skia_use_giflib = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070011 skia_use_libjpeg_turbo = true
12 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070013 skia_use_libwebp = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070014 skia_use_sfntly = !is_fuchsia
15 skia_use_zlib = true
mtkleinc04ff472016-06-23 10:29:30 -070016}
17
mtklein1211e0c2016-07-26 13:55:45 -070018skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070019 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070020 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070021 "include/codec",
22 "include/config",
23 "include/core",
24 "include/effects",
25 "include/gpu",
26 "include/gpu/gl",
27 "include/images",
28 "include/pathops",
29 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070030 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070031 "include/utils",
32 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070033 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070034]
35
mtkleinc04ff472016-06-23 10:29:30 -070036# Skia public API, generally provided by :skia.
37config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070038 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070039 defines = [ "SKIA_DLL" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070040 if (is_linux) {
41 defines += [ "SK_SAMPLES_FOR_X" ]
42 }
mtkleinc04ff472016-06-23 10:29:30 -070043}
44
45# Skia internal APIs, used by Skia itself and a few test tools.
46config("skia_private") {
47 visibility = [ ":*" ]
48
49 include_dirs = [
50 "include/private",
51 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070052 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070053 "src/config",
54 "src/core",
55 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070056 "src/effects/gradients",
57 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070058 "src/gpu",
59 "src/image",
60 "src/images",
61 "src/lazy",
62 "src/opts",
63 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070064 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070065 "src/ports",
66 "src/sfnt",
67 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070068 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070069 "third_party/etc1",
70 "third_party/ktx",
71 ]
mtklein150d1132016-08-01 06:56:40 -070072
mtklein63213812016-08-24 09:55:56 -070073 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinc04ff472016-06-23 10:29:30 -070074}
75
76# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
77config("skia_library") {
78 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070079 defines = [ "SKIA_IMPLEMENTATION=1" ]
80}
81
82skia_library_configs = [
83 ":skia_public",
84 ":skia_private",
85 ":skia_library",
86]
87
mtklein7fbfbbe2016-07-21 12:25:45 -070088core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070089 [
90 rebase_path("gyp/core.gypi"),
91 "--replace=<(skia_include_path)=include",
92 "--replace=<(skia_src_path)=src",
93 ],
94 "scope",
95 [ "gyp/core.gypi" ])
96
mtklein7fbfbbe2016-07-21 12:25:45 -070097effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070098 [
99 rebase_path("gyp/effects.gypi"),
100 "--replace=<(skia_include_path)=include",
101 "--replace=<(skia_src_path)=src",
102 ],
103 "scope",
104 [ "gyp/effects.gypi" ])
105
mtklein7fbfbbe2016-07-21 12:25:45 -0700106gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700107 [
108 rebase_path("gyp/gpu.gypi"),
109 "--replace=<(skia_include_path)=include",
110 "--replace=<(skia_src_path)=src",
111 ],
112 "scope",
113 [ "gyp/gpu.gypi" ])
114
mtklein7fbfbbe2016-07-21 12:25:45 -0700115opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700116 [
117 rebase_path("gyp/opts.gypi"),
118 "--replace=<(skia_include_path)=include",
119 "--replace=<(skia_src_path)=src",
120 ],
121 "scope",
122 [ "gyp/opts.gypi" ])
123
mtklein7fbfbbe2016-07-21 12:25:45 -0700124pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700125 [
126 rebase_path("gyp/pdf.gypi"),
127 "--replace=<(skia_include_path)=include",
128 "--replace=<(skia_src_path)=src",
129 ],
130 "scope",
131 [ "gyp/pdf.gypi" ])
132
mtklein7fbfbbe2016-07-21 12:25:45 -0700133utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700134 [
135 rebase_path("gyp/utils.gypi"),
136 "--replace=<(skia_include_path)=include",
137 "--replace=<(skia_src_path)=src",
138 ],
139 "scope",
140 [ "gyp/utils.gypi" ])
141
mtklein9b8583d2016-08-24 17:32:30 -0700142# Use for CPU-specific Skia code that needs particular compiler flags.
143template("opts") {
144 if (invoker.enabled) {
145 source_set(target_name) {
146 forward_variables_from(invoker, "*")
147 configs += skia_library_configs
148 }
149 } else {
150 # If not enabled, a phony empty target that swallows all otherwise unused variables.
151 source_set(target_name) {
152 forward_variables_from(invoker,
153 "*",
154 [
155 "sources",
156 "cflags",
157 ])
158 }
159 }
anmittala7eaf2e2016-08-17 13:57:26 -0700160}
161
mtklein422310d2016-08-16 18:28:43 -0700162is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700163
mtklein7d6fb2c2016-08-25 14:50:44 -0700164opts("none") {
165 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
166 sources = opts_gypi.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700167 cflags = []
168}
169
mtklein7d6fb2c2016-08-25 14:50:44 -0700170opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700171 enabled = current_cpu == "arm"
mtklein7d6fb2c2016-08-25 14:50:44 -0700172 sources = opts_gypi.armv7_sources + opts_gypi.neon_sources
173 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700174}
175
176opts("arm64") {
177 enabled = current_cpu == "arm64"
178 sources = opts_gypi.arm64_sources
179 cflags = []
180}
181
182opts("crc32") {
183 enabled = current_cpu == "arm64"
184 sources = opts_gypi.crc32_sources
185 cflags = [ "-march=armv8-a+crc" ]
186}
187
mtklein9b8583d2016-08-24 17:32:30 -0700188opts("sse2") {
189 enabled = is_x86
190 sources = opts_gypi.sse2_sources
191 cflags = [ "-msse2" ]
192}
mtkleinc04ff472016-06-23 10:29:30 -0700193
mtklein9b8583d2016-08-24 17:32:30 -0700194opts("ssse3") {
195 enabled = is_x86
196 sources = opts_gypi.ssse3_sources
197 cflags = [ "-mssse3" ]
198}
mtkleinc04ff472016-06-23 10:29:30 -0700199
mtklein9b8583d2016-08-24 17:32:30 -0700200opts("sse41") {
201 enabled = is_x86
202 sources = opts_gypi.sse41_sources
203 cflags = [ "-msse4.1" ]
204}
mtklein4e976072016-08-08 09:06:27 -0700205
mtklein9b8583d2016-08-24 17:32:30 -0700206opts("sse42") {
207 enabled = is_x86
208 sources = opts_gypi.sse42_sources
209 cflags = [ "-msse4.2" ]
210}
211
212opts("avx") {
213 enabled = is_x86
214 sources = opts_gypi.avx_sources
215 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700216}
217
mtklein349cece2016-08-26 08:13:04 -0700218opts("dsp") {
219 enabled = current_cpu == "mipsel"
220 sources = opts_gypi.mips_dsp_sources
221 cflags = [ "-Wno-deprecated-register" ] # FIXME
222}
223
mtkleinc095df52016-08-24 12:23:52 -0700224# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700225template("optional") {
226 if (invoker.enabled) {
227 config(target_name + "_public") {
228 defines = invoker.public_defines
229 }
230 source_set(target_name) {
231 forward_variables_from(invoker, "*", [ "public_defines" ])
232 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700233 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700234 }
235 } else {
236 # If not enabled, a phony empty target that swallows all otherwise unused variables.
237 source_set(target_name) {
238 forward_variables_from(invoker,
239 "*",
240 [
241 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700242 "deps",
243 "sources",
244 ])
245 }
mtkleineb3c4252016-08-23 07:38:09 -0700246 }
mtklein457b42a2016-08-23 13:56:37 -0700247}
mtklein457b42a2016-08-23 13:56:37 -0700248
249optional("gif") {
250 enabled = skia_use_giflib
251 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
252
mtklein457b42a2016-08-23 13:56:37 -0700253 deps = [
254 "//third_party/giflib",
255 ]
256 sources = [
257 "src/codec/SkGifCodec.cpp",
258 ]
259}
260
mtklein63213812016-08-24 09:55:56 -0700261optional("jpeg") {
262 enabled = skia_use_libjpeg_turbo
263 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
264
mtklein63213812016-08-24 09:55:56 -0700265 deps = [
266 "//third_party/libjpeg-turbo:libjpeg",
267 ]
268 sources = [
269 "src/codec/SkJpegCodec.cpp",
270 "src/codec/SkJpegDecoderMgr.cpp",
271 "src/codec/SkJpegUtility.cpp",
272 "src/images/SkJPEGImageEncoder.cpp",
273 "src/images/SkJPEGWriteUtility.cpp",
274 ]
275}
276
277optional("pdf") {
278 enabled = skia_use_zlib
279 public_defines = []
280
mtklein63213812016-08-24 09:55:56 -0700281 deps = [
282 "//third_party/zlib",
283 ]
284 sources = pdf_gypi.sources
285
286 if (skia_use_sfntly) {
287 deps += [ "//third_party/sfntly" ]
halcanary650e20d2016-08-25 09:07:02 -0700288 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700289 }
290}
291
292optional("png") {
293 enabled = skia_use_libpng
294 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
295
mtklein63213812016-08-24 09:55:56 -0700296 deps = [
297 "//third_party/libpng",
298 ]
299 sources = [
300 "src/codec/SkIcoCodec.cpp",
301 "src/codec/SkPngCodec.cpp",
302 "src/images/SkPNGImageEncoder.cpp",
303 ]
304}
305
mtklein457b42a2016-08-23 13:56:37 -0700306optional("webp") {
307 enabled = skia_use_libwebp
308 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
309
mtklein457b42a2016-08-23 13:56:37 -0700310 deps = [
311 "//third_party/libwebp",
312 ]
313 sources = [
314 "src/codec/SkWebpAdapterCodec.cpp",
315 "src/codec/SkWebpCodec.cpp",
316 "src/images/SkWEBPImageEncoder.cpp",
317 ]
mtkleineb3c4252016-08-23 07:38:09 -0700318}
319
mtklein63213812016-08-24 09:55:56 -0700320optional("xml") {
321 enabled = skia_use_expat
322 public_defines = []
323
mtklein63213812016-08-24 09:55:56 -0700324 deps = [
325 "//third_party/expat",
326 ]
327 sources = [
328 "src/xml/SkDOM.cpp",
329 "src/xml/SkXMLParser.cpp",
330 "src/xml/SkXMLWriter.cpp",
331 ]
332}
333
mtkleinc04ff472016-06-23 10:29:30 -0700334component("skia") {
335 public_configs = [ ":skia_public" ]
336 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700337
338 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700339 ":arm64",
340 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700341 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700342 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700343 ":dsp",
mtklein457b42a2016-08-23 13:56:37 -0700344 ":gif",
mtklein63213812016-08-24 09:55:56 -0700345 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700346 ":none",
mtklein63213812016-08-24 09:55:56 -0700347 ":pdf",
348 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700349 ":sse2",
350 ":sse41",
351 ":sse42",
352 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700353 ":webp",
mtklein63213812016-08-24 09:55:56 -0700354 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700355 ]
356
mtkleinc04ff472016-06-23 10:29:30 -0700357 sources = []
358 sources += core_gypi.sources
359 sources += effects_gypi.sources
360 sources += gpu_gypi.skgpu_sources
mtkleinc04ff472016-06-23 10:29:30 -0700361 sources += utils_gypi.sources
362 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700363 "src/android/SkBitmapRegionCodec.cpp",
364 "src/android/SkBitmapRegionDecoder.cpp",
365 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700366 "src/codec/SkBmpCodec.cpp",
367 "src/codec/SkBmpMaskCodec.cpp",
368 "src/codec/SkBmpRLECodec.cpp",
369 "src/codec/SkBmpStandardCodec.cpp",
370 "src/codec/SkCodec.cpp",
371 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700372 "src/codec/SkMaskSwizzler.cpp",
373 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700374 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700375 "src/codec/SkSampler.cpp",
376 "src/codec/SkSwizzler.cpp",
377 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700378 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700379 "src/images/SkImageEncoder.cpp",
380 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700381 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700382 "src/ports/SkDiscardableMemory_none.cpp",
383 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700384 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700385 "src/ports/SkMemory_malloc.cpp",
386 "src/ports/SkOSFile_stdio.cpp",
387 "src/sfnt/SkOTTable_name.cpp",
388 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700389 "src/svg/SkSVGCanvas.cpp",
390 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700391 "src/utils/mac/SkStream_mac.cpp",
392 "third_party/etc1/etc1.cpp",
393 "third_party/ktx/ktx.cpp",
394 ]
mtklein09e61f72016-08-23 13:35:28 -0700395 sources -= [
396 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
397 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
398 ]
mtkleinc04ff472016-06-23 10:29:30 -0700399
mtklein7d6fb2c2016-08-25 14:50:44 -0700400 libs = []
401
mtkleinc04ff472016-06-23 10:29:30 -0700402 if (is_win) {
403 sources += [
404 "src/ports/SkDebug_win.cpp",
405 "src/ports/SkFontHost_win.cpp",
406 "src/ports/SkFontMgr_win_dw.cpp",
407 "src/ports/SkFontMgr_win_dw_factory.cpp",
408 "src/ports/SkImageEncoder_WIC.cpp",
409 "src/ports/SkImageGeneratorWIC.cpp",
410 "src/ports/SkOSFile_win.cpp",
411 "src/ports/SkScalerContext_win_dw.cpp",
412 "src/ports/SkTLS_win.cpp",
413 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700414 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700415 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700416 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700417 } else {
418 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700419 "src/ports/SkOSFile_posix.cpp",
420 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700421 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700422 ]
423 }
424
mtklein7d6fb2c2016-08-25 14:50:44 -0700425 if (is_android) {
426 deps += [
427 "//third_party/cpu-features",
428 "//third_party/expat",
429 "//third_party/freetype2",
430 ]
431 sources += [
432 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
433 "src/ports/SkDebug_android.cpp",
434 "src/ports/SkFontHost_FreeType.cpp",
435 "src/ports/SkFontHost_FreeType_common.cpp",
436 "src/ports/SkFontMgr_android.cpp",
437 "src/ports/SkFontMgr_android_factory.cpp",
438 "src/ports/SkFontMgr_android_parser.cpp",
439 ]
440 libs += [
441 "EGL",
442 "GLESv2",
443 "log",
444 ]
445 }
446
mtkleinc04ff472016-06-23 10:29:30 -0700447 if (is_linux) {
448 deps += [
449 "third_party:fontconfig",
mtklein7d6fb2c2016-08-25 14:50:44 -0700450 "//third_party/freetype2",
mtkleinc04ff472016-06-23 10:29:30 -0700451 ]
mtklein09e61f72016-08-23 13:35:28 -0700452 libs += [
453 "GL",
454 "GLU",
455 "X11",
456 ]
mtkleinc04ff472016-06-23 10:29:30 -0700457 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700458 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700459 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700460 "src/ports/SkFontConfigInterface_direct.cpp",
461 "src/ports/SkFontConfigInterface_direct_factory.cpp",
462 "src/ports/SkFontHost_FreeType.cpp",
463 "src/ports/SkFontHost_FreeType_common.cpp",
bungeman7d0e3bc2016-08-02 07:07:33 -0700464 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein7a34b1c2016-08-01 13:08:46 -0700465 "src/ports/SkFontMgr_fontconfig.cpp",
466 "src/ports/SkFontMgr_fontconfig_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700467 ]
468 }
469
470 if (is_mac) {
471 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700472 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700473 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700474 "src/ports/SkFontHost_mac.cpp",
475 "src/ports/SkImageEncoder_CG.cpp",
476 "src/ports/SkImageGeneratorCG.cpp",
477 ]
mtklein09e61f72016-08-23 13:35:28 -0700478 libs += [
479 "ApplicationServices.framework",
480 "OpenGL.framework",
481 ]
mtkleinc04ff472016-06-23 10:29:30 -0700482 }
abarth6fc8ff02016-07-15 15:15:15 -0700483
484 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700485 sources += [
486 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700487 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700488 "src/ports/SkFontMgr_empty_factory.cpp",
489 ]
abarth6fc8ff02016-07-15 15:15:15 -0700490 }
mtkleinc04ff472016-06-23 10:29:30 -0700491}
492
mtkleinada5a442016-08-02 14:28:26 -0700493skia_h_headers = exec_script("gyp/find.py",
494 [ "*.h" ] + rebase_path(skia_public_includes),
495 "list lines",
496 []) -
497 [
498 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
499 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
500 rebase_path("include/gpu/vk/GrVkDefines.h"),
501 rebase_path("include/gpu/vk/GrVkInterface.h"),
502 rebase_path("include/gpu/vk/GrVkTypes.h"),
503 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
504 ]
505
mtklein1211e0c2016-07-26 13:55:45 -0700506action("skia.h") {
507 script = "gn/echo_headers.py"
508 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700509 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700510 outputs = [
511 "$target_gen_dir/skia.h",
512 ]
513}
514
515executable("fiddle") {
516 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700517 libs = []
518 if (is_linux) {
519 libs += [ "OSMesa" ]
520 }
mtklein1211e0c2016-07-26 13:55:45 -0700521
mtkleinc04ff472016-06-23 10:29:30 -0700522 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700523 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700524 "tools/fiddle/draw.cpp",
525 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700526 ]
527 deps = [
528 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700529 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700530 ]
mtkleinc04ff472016-06-23 10:29:30 -0700531}
mtklein25c81d42016-07-27 13:55:26 -0700532
mtkleinc095df52016-08-24 12:23:52 -0700533# Targets guarded by skia_enable_tools may use //third_party freely.
534if (skia_enable_tools) {
535 template("test_lib") {
536 config(target_name + "_config") {
537 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700538 }
mtkleinc095df52016-08-24 12:23:52 -0700539 source_set(target_name) {
540 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
541 public_configs = [
542 ":" + target_name + "_config",
543 ":skia_private",
544 ]
545
546 if (!defined(deps)) {
547 deps = []
548 }
549 deps += [ ":skia" ]
550 testonly = true
551 }
mtklein25c81d42016-07-27 13:55:26 -0700552 }
mtklein25c81d42016-07-27 13:55:26 -0700553
mtkleinc095df52016-08-24 12:23:52 -0700554 test_lib("gpu_tool_utils") {
555 public_include_dirs = [ "tools/gpu" ]
556 sources = [
557 "tools/gpu/GrContextFactory.cpp",
558 "tools/gpu/GrTest.cpp",
559 "tools/gpu/TestContext.cpp",
560 "tools/gpu/gl/GLTestContext.cpp",
561 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
562 "tools/gpu/gl/debug/GrBufferObj.cpp",
563 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
564 "tools/gpu/gl/debug/GrProgramObj.cpp",
565 "tools/gpu/gl/debug/GrShaderObj.cpp",
566 "tools/gpu/gl/debug/GrTextureObj.cpp",
567 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
568 "tools/gpu/gl/null/NullGLTestContext.cpp",
569 ]
570 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700571
mtklein7d6fb2c2016-08-25 14:50:44 -0700572 if (is_android) {
573 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
574 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700575 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
576 } else if (is_mac) {
577 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
578 }
mtklein25c81d42016-07-27 13:55:26 -0700579 }
mtklein25c81d42016-07-27 13:55:26 -0700580
mtkleinc095df52016-08-24 12:23:52 -0700581 test_lib("flags") {
582 public_include_dirs = [ "tools/flags" ]
583 sources = [
584 "tools/flags/SkCommandLineFlags.cpp",
585 "tools/flags/SkCommonFlags.cpp",
586 "tools/flags/SkCommonFlagsConfig.cpp",
587 ]
588 deps = [
589 ":gpu_tool_utils",
590 ]
591 }
mtklein25c81d42016-07-27 13:55:26 -0700592
mtkleinc095df52016-08-24 12:23:52 -0700593 test_lib("tool_utils") {
594 public_include_dirs = [
595 "tools",
596 "tools/debugger",
597 "tools/timer",
598 ]
599 sources = [
600 "src/images/SkForceLinking.cpp",
601 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
602 "tools/CrashHandler.cpp",
603 "tools/ProcStats.cpp",
604 "tools/Resources.cpp",
605 "tools/ThermalManager.cpp",
606 "tools/UrlDataManager.cpp",
607 "tools/debugger/SkDebugCanvas.cpp",
608 "tools/debugger/SkDrawCommand.cpp",
609 "tools/debugger/SkJsonWriteBuffer.cpp",
610 "tools/debugger/SkObjectParser.cpp",
611 "tools/debugger/SkOverdrawMode.cpp",
612 "tools/picture_utils.cpp",
613 "tools/random_parse_path.cpp",
614 "tools/sk_tool_utils.cpp",
615 "tools/sk_tool_utils_font.cpp",
616 "tools/timer/Timer.cpp",
617 ]
618 deps = [
619 ":flags",
620 "//third_party/libpng",
621 ]
622 public_deps = [
623 "//third_party/jsoncpp",
624 ]
625 }
mtklein25c81d42016-07-27 13:55:26 -0700626
mtkleinc095df52016-08-24 12:23:52 -0700627 gm_sources = exec_script("gyp/find.py",
628 [
629 "*.c*",
630 rebase_path("gm"),
631 ],
632 "list lines",
633 [])
634 test_lib("gm") {
635 public_include_dirs = [ "gm" ]
636 sources = gm_sources
637 deps = [
638 ":gpu_tool_utils",
639 ":skia",
640 ":tool_utils",
641 ]
642 }
mtklein25c81d42016-07-27 13:55:26 -0700643
mtkleinc095df52016-08-24 12:23:52 -0700644 tests_sources = exec_script("gyp/find.py",
645 [
646 "*.c*",
647 rebase_path("tests"),
648 ],
649 "list lines",
650 [])
mtklein2f3416d2016-08-02 16:02:05 -0700651
mtkleinc095df52016-08-24 12:23:52 -0700652 test_lib("tests") {
653 public_include_dirs = [ "tests" ]
654 sources =
655 tests_sources - [
656 rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only
657 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
658 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
659 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
660 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
661 rebase_path("tests/skia_test.cpp"), # alternate main
662 ]
663 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700664 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700665 ":flags",
666 ":gpu_tool_utils",
667 ":skia",
668 ":tool_utils",
669 "//third_party/libpng",
670 "//third_party/zlib",
671 ]
672 }
mtklein2f3416d2016-08-02 16:02:05 -0700673
mtkleinc095df52016-08-24 12:23:52 -0700674 bench_sources = exec_script("gyp/find.py",
675 [
676 "*.c*",
677 rebase_path("bench"),
678 ],
679 "list lines",
680 [])
mtklein25c81d42016-07-27 13:55:26 -0700681
mtkleinc095df52016-08-24 12:23:52 -0700682 test_lib("bench") {
683 public_include_dirs = [ "bench" ]
684 sources = bench_sources
685 sources -= [
686 rebase_path("bench/nanobench.cpp"),
687 rebase_path("bench/nanobenchAndroid.cpp"),
688 ]
689 deps = [
690 ":flags",
691 ":gm",
692 ":gpu_tool_utils",
693 ":skia",
694 ":tool_utils",
695 ]
696 }
mtklein2b6870c2016-07-28 14:17:33 -0700697
mtkleinc095df52016-08-24 12:23:52 -0700698 test_lib("experimental_svg_model") {
699 public_include_dirs = [ "experimental/svg/model" ]
700 sources = [
701 "experimental/svg/model/SkSVGAttribute.cpp",
702 "experimental/svg/model/SkSVGAttributeParser.cpp",
703 "experimental/svg/model/SkSVGCircle.cpp",
704 "experimental/svg/model/SkSVGContainer.cpp",
705 "experimental/svg/model/SkSVGDOM.cpp",
706 "experimental/svg/model/SkSVGEllipse.cpp",
707 "experimental/svg/model/SkSVGLine.cpp",
708 "experimental/svg/model/SkSVGNode.cpp",
709 "experimental/svg/model/SkSVGPath.cpp",
710 "experimental/svg/model/SkSVGPoly.cpp",
711 "experimental/svg/model/SkSVGRect.cpp",
712 "experimental/svg/model/SkSVGRenderContext.cpp",
713 "experimental/svg/model/SkSVGSVG.cpp",
714 "experimental/svg/model/SkSVGShape.cpp",
715 "experimental/svg/model/SkSVGTransformableNode.cpp",
716 "experimental/svg/model/SkSVGValue.cpp",
717 ]
718 deps = [
719 ":skia",
720 ]
721 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700722
mtklein2b6870c2016-07-28 14:17:33 -0700723 executable("dm") {
724 sources = [
725 "dm/DM.cpp",
726 "dm/DMJsonWriter.cpp",
727 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700728 ]
729 include_dirs = [ "tests" ]
730 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700731 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700732 ":flags",
733 ":gm",
734 ":gpu_tool_utils",
735 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700736 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700737 ":tool_utils",
738 "//third_party/jsoncpp",
739 "//third_party/libpng",
740 ]
741 testonly = true
742 }
743
744 executable("monobench") {
745 sources = [
746 "tools/monobench.cpp",
747 ]
748 deps = [
749 ":bench",
750 ":skia",
751 ]
752 testonly = true
753 }
754
755 executable("nanobench") {
756 sources = [
757 "bench/nanobench.cpp",
758 ]
759 deps = [
760 ":bench",
761 ":flags",
762 ":gm",
763 ":gpu_tool_utils",
764 ":skia",
765 ":tool_utils",
766 "//third_party/jsoncpp",
767 ]
768 testonly = true
769 }
halcanary19a97202016-08-03 15:08:04 -0700770
771 executable("sktexttopdf") {
772 sources = [
773 "tools/SkShaper_harfbuzz.cpp",
774 "tools/using_skia_and_harfbuzz.cpp",
775 ]
776 deps = [
777 ":skia",
778 "//third_party/harfbuzz",
779 ]
780 testonly = true
781 }
mtklein25c81d42016-07-27 13:55:26 -0700782}