blob: 49e3e50d28dad0b0c680679a1a76fee00484f99d [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() {
mtklein63213812016-08-24 09:55:56 -07007 skia_use_expat = true
mtklein457b42a2016-08-23 13:56:37 -07008 skia_use_giflib = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -07009 skia_use_libjpeg_turbo = true
10 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070011 skia_use_libwebp = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070012 skia_use_sfntly = !is_fuchsia
13 skia_use_zlib = true
mtkleinc04ff472016-06-23 10:29:30 -070014}
15
mtklein1211e0c2016-07-26 13:55:45 -070016skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070017 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070018 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070019 "include/codec",
20 "include/config",
21 "include/core",
22 "include/effects",
23 "include/gpu",
24 "include/gpu/gl",
25 "include/images",
26 "include/pathops",
27 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070028 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070029 "include/utils",
30 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070031 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070032]
33
mtkleinc04ff472016-06-23 10:29:30 -070034# Skia public API, generally provided by :skia.
35config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070036 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070037 defines = [ "SKIA_DLL" ]
38}
39
40# Skia internal APIs, used by Skia itself and a few test tools.
41config("skia_private") {
42 visibility = [ ":*" ]
43
44 include_dirs = [
45 "include/private",
46 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070047 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070048 "src/config",
49 "src/core",
50 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070051 "src/effects/gradients",
52 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070053 "src/gpu",
54 "src/image",
55 "src/images",
56 "src/lazy",
57 "src/opts",
58 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070059 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070060 "src/ports",
61 "src/sfnt",
62 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070063 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070064 "third_party/etc1",
65 "third_party/ktx",
66 ]
mtklein150d1132016-08-01 06:56:40 -070067
mtklein63213812016-08-24 09:55:56 -070068 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinee269f42016-08-04 09:52:11 -070069 if (is_linux) {
70 defines += [ "SK_SAMPLES_FOR_X" ]
71 }
mtkleinc04ff472016-06-23 10:29:30 -070072}
73
74# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
75config("skia_library") {
76 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070077 defines = [ "SKIA_IMPLEMENTATION=1" ]
78}
79
80skia_library_configs = [
81 ":skia_public",
82 ":skia_private",
83 ":skia_library",
84]
85
mtklein7fbfbbe2016-07-21 12:25:45 -070086core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070087 [
88 rebase_path("gyp/core.gypi"),
89 "--replace=<(skia_include_path)=include",
90 "--replace=<(skia_src_path)=src",
91 ],
92 "scope",
93 [ "gyp/core.gypi" ])
94
mtklein7fbfbbe2016-07-21 12:25:45 -070095effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070096 [
97 rebase_path("gyp/effects.gypi"),
98 "--replace=<(skia_include_path)=include",
99 "--replace=<(skia_src_path)=src",
100 ],
101 "scope",
102 [ "gyp/effects.gypi" ])
103
mtklein7fbfbbe2016-07-21 12:25:45 -0700104gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700105 [
106 rebase_path("gyp/gpu.gypi"),
107 "--replace=<(skia_include_path)=include",
108 "--replace=<(skia_src_path)=src",
109 ],
110 "scope",
111 [ "gyp/gpu.gypi" ])
112
mtklein7fbfbbe2016-07-21 12:25:45 -0700113opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700114 [
115 rebase_path("gyp/opts.gypi"),
116 "--replace=<(skia_include_path)=include",
117 "--replace=<(skia_src_path)=src",
118 ],
119 "scope",
120 [ "gyp/opts.gypi" ])
121
mtklein7fbfbbe2016-07-21 12:25:45 -0700122pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700123 [
124 rebase_path("gyp/pdf.gypi"),
125 "--replace=<(skia_include_path)=include",
126 "--replace=<(skia_src_path)=src",
127 ],
128 "scope",
129 [ "gyp/pdf.gypi" ])
130
mtklein7fbfbbe2016-07-21 12:25:45 -0700131utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700132 [
133 rebase_path("gyp/utils.gypi"),
134 "--replace=<(skia_include_path)=include",
135 "--replace=<(skia_src_path)=src",
136 ],
137 "scope",
138 [ "gyp/utils.gypi" ])
139
anmittala7eaf2e2016-08-17 13:57:26 -0700140source_set("opts_none") {
141 configs += skia_library_configs
142 sources = opts_gypi.none_sources
143}
144
mtklein422310d2016-08-16 18:28:43 -0700145is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700146
mtklein422310d2016-08-16 18:28:43 -0700147if (is_x86) {
148 source_set("opts_sse2") {
149 configs += skia_library_configs
150 sources = opts_gypi.sse2_sources
151 cflags = [ "-msse2" ]
152 }
mtkleinc04ff472016-06-23 10:29:30 -0700153
mtklein422310d2016-08-16 18:28:43 -0700154 source_set("opts_ssse3") {
155 configs += skia_library_configs
156 sources = opts_gypi.ssse3_sources
157 cflags = [ "-mssse3" ]
158 }
mtkleinc04ff472016-06-23 10:29:30 -0700159
mtklein422310d2016-08-16 18:28:43 -0700160 source_set("opts_sse41") {
161 configs += skia_library_configs
162 sources = opts_gypi.sse41_sources
163 cflags = [ "-msse4.1" ]
164 }
mtkleinc04ff472016-06-23 10:29:30 -0700165
mtklein422310d2016-08-16 18:28:43 -0700166 source_set("opts_sse42") {
167 configs += skia_library_configs
168 sources = opts_gypi.sse42_sources
169 cflags = [ "-msse4.2" ]
170 }
mtklein4e976072016-08-08 09:06:27 -0700171
mtklein422310d2016-08-16 18:28:43 -0700172 source_set("opts_avx") {
173 configs += skia_library_configs
174 sources = opts_gypi.avx_sources
175 cflags = [ "-mavx" ]
176 }
mtkleinc04ff472016-06-23 10:29:30 -0700177}
178
mtklein457b42a2016-08-23 13:56:37 -0700179template("optional") {
180 if (invoker.enabled) {
181 config(target_name + "_public") {
182 defines = invoker.public_defines
183 }
184 source_set(target_name) {
185 forward_variables_from(invoker, "*", [ "public_defines" ])
186 all_dependent_configs = [ ":" + target_name + "_public" ]
187 }
188 } else {
189 # If not enabled, a phony empty target that swallows all otherwise unused variables.
190 source_set(target_name) {
191 forward_variables_from(invoker,
192 "*",
193 [
194 "public_defines",
195 "configs",
196 "deps",
197 "sources",
198 ])
199 }
mtkleineb3c4252016-08-23 07:38:09 -0700200 }
mtklein457b42a2016-08-23 13:56:37 -0700201}
202set_defaults("optional") {
203 configs = default_configs
204}
205
206optional("gif") {
207 enabled = skia_use_giflib
208 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
209
210 configs += skia_library_configs
211 deps = [
212 "//third_party/giflib",
213 ]
214 sources = [
215 "src/codec/SkGifCodec.cpp",
216 ]
217}
218
mtklein63213812016-08-24 09:55:56 -0700219optional("jpeg") {
220 enabled = skia_use_libjpeg_turbo
221 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
222
223 configs += skia_library_configs
224 deps = [
225 "//third_party/libjpeg-turbo:libjpeg",
226 ]
227 sources = [
228 "src/codec/SkJpegCodec.cpp",
229 "src/codec/SkJpegDecoderMgr.cpp",
230 "src/codec/SkJpegUtility.cpp",
231 "src/images/SkJPEGImageEncoder.cpp",
232 "src/images/SkJPEGWriteUtility.cpp",
233 ]
234}
235
236optional("pdf") {
237 enabled = skia_use_zlib
238 public_defines = []
239
240 configs += skia_library_configs
241 deps = [
242 "//third_party/zlib",
243 ]
244 sources = pdf_gypi.sources
245
246 if (skia_use_sfntly) {
247 deps += [ "//third_party/sfntly" ]
248 public_defines += [
249 # TODO(halcanary): make this the default; this is the value Android uses.
250 "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"",
251 ]
252 }
253}
254
255optional("png") {
256 enabled = skia_use_libpng
257 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
258
259 configs += skia_library_configs
260 deps = [
261 "//third_party/libpng",
262 ]
263 sources = [
264 "src/codec/SkIcoCodec.cpp",
265 "src/codec/SkPngCodec.cpp",
266 "src/images/SkPNGImageEncoder.cpp",
267 ]
268}
269
mtklein457b42a2016-08-23 13:56:37 -0700270optional("webp") {
271 enabled = skia_use_libwebp
272 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
273
274 configs += skia_library_configs
275 deps = [
276 "//third_party/libwebp",
277 ]
278 sources = [
279 "src/codec/SkWebpAdapterCodec.cpp",
280 "src/codec/SkWebpCodec.cpp",
281 "src/images/SkWEBPImageEncoder.cpp",
282 ]
mtkleineb3c4252016-08-23 07:38:09 -0700283}
284
mtklein63213812016-08-24 09:55:56 -0700285optional("xml") {
286 enabled = skia_use_expat
287 public_defines = []
288
289 configs += skia_library_configs
290 deps = [
291 "//third_party/expat",
292 ]
293 sources = [
294 "src/xml/SkDOM.cpp",
295 "src/xml/SkXMLParser.cpp",
296 "src/xml/SkXMLWriter.cpp",
297 ]
298}
299
mtkleinc04ff472016-06-23 10:29:30 -0700300component("skia") {
301 public_configs = [ ":skia_public" ]
302 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700303
304 deps = [
mtklein457b42a2016-08-23 13:56:37 -0700305 ":gif",
mtklein63213812016-08-24 09:55:56 -0700306 ":jpeg",
307 ":pdf",
308 ":png",
mtkleineb3c4252016-08-23 07:38:09 -0700309 ":webp",
mtklein63213812016-08-24 09:55:56 -0700310 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700311 ]
mtklein422310d2016-08-16 18:28:43 -0700312 if (is_x86) {
313 deps += [
314 ":opts_avx",
315 ":opts_sse2",
316 ":opts_sse41",
317 ":opts_sse42",
318 ":opts_ssse3",
319 ]
anmittala7eaf2e2016-08-17 13:57:26 -0700320 } else {
321 deps += [ ":opts_none" ]
mtklein422310d2016-08-16 18:28:43 -0700322 }
mtkleinc04ff472016-06-23 10:29:30 -0700323
mtklein7a1f45f2016-08-04 06:19:33 -0700324 if (!is_win) {
325 libs = [ "pthread" ]
326 }
mtkleinc04ff472016-06-23 10:29:30 -0700327
328 sources = []
329 sources += core_gypi.sources
330 sources += effects_gypi.sources
331 sources += gpu_gypi.skgpu_sources
mtkleinc04ff472016-06-23 10:29:30 -0700332 sources += utils_gypi.sources
333 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700334 "src/android/SkBitmapRegionCodec.cpp",
335 "src/android/SkBitmapRegionDecoder.cpp",
336 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700337 "src/codec/SkBmpCodec.cpp",
338 "src/codec/SkBmpMaskCodec.cpp",
339 "src/codec/SkBmpRLECodec.cpp",
340 "src/codec/SkBmpStandardCodec.cpp",
341 "src/codec/SkCodec.cpp",
342 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700343 "src/codec/SkMaskSwizzler.cpp",
344 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700345 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700346 "src/codec/SkSampler.cpp",
347 "src/codec/SkSwizzler.cpp",
348 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700349 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700350 "src/images/SkImageEncoder.cpp",
351 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700352 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700353 "src/ports/SkDiscardableMemory_none.cpp",
354 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700355 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700356 "src/ports/SkMemory_malloc.cpp",
357 "src/ports/SkOSFile_stdio.cpp",
358 "src/sfnt/SkOTTable_name.cpp",
359 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700360 "src/svg/SkSVGCanvas.cpp",
361 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700362 "src/utils/mac/SkStream_mac.cpp",
363 "third_party/etc1/etc1.cpp",
364 "third_party/ktx/ktx.cpp",
365 ]
mtklein09e61f72016-08-23 13:35:28 -0700366 sources -= [
367 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
368 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
369 ]
mtkleinc04ff472016-06-23 10:29:30 -0700370
371 if (is_win) {
372 sources += [
373 "src/ports/SkDebug_win.cpp",
374 "src/ports/SkFontHost_win.cpp",
375 "src/ports/SkFontMgr_win_dw.cpp",
376 "src/ports/SkFontMgr_win_dw_factory.cpp",
377 "src/ports/SkImageEncoder_WIC.cpp",
378 "src/ports/SkImageGeneratorWIC.cpp",
379 "src/ports/SkOSFile_win.cpp",
380 "src/ports/SkScalerContext_win_dw.cpp",
381 "src/ports/SkTLS_win.cpp",
382 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700383 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700384 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700385 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700386 } else {
387 sources += [
388 "src/ports/SkDebug_stdio.cpp",
389 "src/ports/SkOSFile_posix.cpp",
390 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700391 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700392 ]
393 }
394
395 if (is_linux) {
396 deps += [
397 "third_party:fontconfig",
398 "third_party:freetype2",
mtkleinc04ff472016-06-23 10:29:30 -0700399 ]
mtklein09e61f72016-08-23 13:35:28 -0700400 libs += [
401 "GL",
402 "GLU",
403 "X11",
404 ]
mtkleinc04ff472016-06-23 10:29:30 -0700405 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700406 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700407 "src/ports/SkFontConfigInterface_direct.cpp",
408 "src/ports/SkFontConfigInterface_direct_factory.cpp",
409 "src/ports/SkFontHost_FreeType.cpp",
410 "src/ports/SkFontHost_FreeType_common.cpp",
bungeman7d0e3bc2016-08-02 07:07:33 -0700411 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein7a34b1c2016-08-01 13:08:46 -0700412 "src/ports/SkFontMgr_fontconfig.cpp",
413 "src/ports/SkFontMgr_fontconfig_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700414 ]
415 }
416
417 if (is_mac) {
418 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700419 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700420 "src/ports/SkFontHost_mac.cpp",
421 "src/ports/SkImageEncoder_CG.cpp",
422 "src/ports/SkImageGeneratorCG.cpp",
423 ]
mtklein09e61f72016-08-23 13:35:28 -0700424 libs += [
425 "ApplicationServices.framework",
426 "OpenGL.framework",
427 ]
mtkleinc04ff472016-06-23 10:29:30 -0700428 }
abarth6fc8ff02016-07-15 15:15:15 -0700429
430 if (is_fuchsia) {
mtkleine817ddf2016-07-19 06:03:22 -0700431 sources += [ "src/ports/SkFontMgr_empty_factory.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700432 }
mtkleinc04ff472016-06-23 10:29:30 -0700433}
434
mtkleinada5a442016-08-02 14:28:26 -0700435skia_h_headers = exec_script("gyp/find.py",
436 [ "*.h" ] + rebase_path(skia_public_includes),
437 "list lines",
438 []) -
439 [
440 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
441 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
442 rebase_path("include/gpu/vk/GrVkDefines.h"),
443 rebase_path("include/gpu/vk/GrVkInterface.h"),
444 rebase_path("include/gpu/vk/GrVkTypes.h"),
445 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
446 ]
447
mtklein1211e0c2016-07-26 13:55:45 -0700448action("skia.h") {
449 script = "gn/echo_headers.py"
450 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinada5a442016-08-02 14:28:26 -0700451 rebase_path(skia_h_headers, root_build_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700452 outputs = [
453 "$target_gen_dir/skia.h",
454 ]
455}
456
457executable("fiddle") {
458 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700459 libs = []
460 if (is_linux) {
461 libs += [ "OSMesa" ]
462 }
mtklein1211e0c2016-07-26 13:55:45 -0700463
mtkleinc04ff472016-06-23 10:29:30 -0700464 sources = [
mtklein1211e0c2016-07-26 13:55:45 -0700465 "tools/fiddle/draw.cpp",
466 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700467 ]
468 deps = [
469 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700470 ":skia.h",
mtklein5dbd2742016-08-02 11:13:48 -0700471 ":tool_utils",
mtkleinc04ff472016-06-23 10:29:30 -0700472 ]
mtklein5dbd2742016-08-02 11:13:48 -0700473 testonly = true
mtkleinc04ff472016-06-23 10:29:30 -0700474}
mtklein25c81d42016-07-27 13:55:26 -0700475
476template("test_lib") {
477 config(target_name + "_config") {
478 include_dirs = invoker.public_include_dirs
479 }
480 source_set(target_name) {
481 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
482 public_configs = [
483 ":" + target_name + "_config",
484 ":skia_private",
485 ]
486
487 if (!defined(deps)) {
488 deps = []
489 }
490 deps += [ ":skia" ]
491 testonly = true
492 }
493}
494
495test_lib("gpu_tool_utils") {
496 public_include_dirs = [ "tools/gpu" ]
497 sources = [
498 "tools/gpu/GrContextFactory.cpp",
499 "tools/gpu/GrTest.cpp",
500 "tools/gpu/TestContext.cpp",
501 "tools/gpu/gl/GLTestContext.cpp",
502 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
503 "tools/gpu/gl/debug/GrBufferObj.cpp",
504 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
505 "tools/gpu/gl/debug/GrProgramObj.cpp",
506 "tools/gpu/gl/debug/GrShaderObj.cpp",
507 "tools/gpu/gl/debug/GrTextureObj.cpp",
508 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
509 "tools/gpu/gl/null/NullGLTestContext.cpp",
510 ]
511 libs = []
512
513 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700514 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
mtklein25c81d42016-07-27 13:55:26 -0700515 } else if (is_mac) {
mtklein09e61f72016-08-23 13:35:28 -0700516 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
mtklein25c81d42016-07-27 13:55:26 -0700517 }
518}
519
520test_lib("flags") {
521 public_include_dirs = [ "tools/flags" ]
522 sources = [
523 "tools/flags/SkCommandLineFlags.cpp",
524 "tools/flags/SkCommonFlags.cpp",
525 "tools/flags/SkCommonFlagsConfig.cpp",
526 ]
527 deps = [
528 ":gpu_tool_utils",
529 ]
530}
531
532test_lib("tool_utils") {
533 public_include_dirs = [
534 "tools",
mtklein2f3416d2016-08-02 16:02:05 -0700535 "tools/debugger",
mtklein25c81d42016-07-27 13:55:26 -0700536 "tools/timer",
537 ]
538 sources = [
mtklein2b6870c2016-07-28 14:17:33 -0700539 "src/images/SkForceLinking.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700540 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtklein2b6870c2016-07-28 14:17:33 -0700541 "tools/CrashHandler.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700542 "tools/ProcStats.cpp",
543 "tools/Resources.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700544 "tools/ThermalManager.cpp",
mtklein2f3416d2016-08-02 16:02:05 -0700545 "tools/UrlDataManager.cpp",
546 "tools/debugger/SkDebugCanvas.cpp",
547 "tools/debugger/SkDrawCommand.cpp",
548 "tools/debugger/SkJsonWriteBuffer.cpp",
549 "tools/debugger/SkObjectParser.cpp",
550 "tools/debugger/SkOverdrawMode.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700551 "tools/picture_utils.cpp",
552 "tools/random_parse_path.cpp",
553 "tools/sk_tool_utils.cpp",
554 "tools/sk_tool_utils_font.cpp",
555 "tools/timer/Timer.cpp",
556 ]
557 deps = [
558 ":flags",
mtklein2f3416d2016-08-02 16:02:05 -0700559 "//third_party/libpng",
560 ]
561 public_deps = [
562 "//third_party/jsoncpp",
mtklein25c81d42016-07-27 13:55:26 -0700563 ]
564}
565
566gm_sources = exec_script("gyp/find.py",
567 [
mtklein25c81d42016-07-27 13:55:26 -0700568 "*.c*",
mtkleinada5a442016-08-02 14:28:26 -0700569 rebase_path("gm"),
mtklein25c81d42016-07-27 13:55:26 -0700570 ],
571 "list lines",
572 [])
573test_lib("gm") {
574 public_include_dirs = [ "gm" ]
575 sources = gm_sources
576 deps = [
577 ":gpu_tool_utils",
578 ":skia",
579 ":tool_utils",
580 ]
581}
582
mtklein2f3416d2016-08-02 16:02:05 -0700583tests_sources = exec_script("gyp/find.py",
584 [
585 "*.c*",
586 rebase_path("tests"),
587 ],
588 "list lines",
589 [])
590
591test_lib("tests") {
592 public_include_dirs = [ "tests" ]
593 sources = tests_sources - [
594 rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only
595 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtklein4db3b792016-08-03 14:18:22 -0700596 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
597 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
mtklein2f3416d2016-08-02 16:02:05 -0700598 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
599 rebase_path("tests/skia_test.cpp"), # alternate main
600 ]
601 deps = [
602 ":flags",
603 ":gpu_tool_utils",
604 ":skia",
605 ":tool_utils",
606 "//third_party/libpng",
607 "//third_party/zlib",
608 ]
609}
610
mtklein2b6870c2016-07-28 14:17:33 -0700611bench_sources = exec_script("gyp/find.py",
612 [
mtklein2b6870c2016-07-28 14:17:33 -0700613 "*.c*",
mtkleinada5a442016-08-02 14:28:26 -0700614 rebase_path("bench"),
mtklein2b6870c2016-07-28 14:17:33 -0700615 ],
616 "list lines",
617 [])
mtklein25c81d42016-07-27 13:55:26 -0700618
mtklein2b6870c2016-07-28 14:17:33 -0700619test_lib("bench") {
620 public_include_dirs = [ "bench" ]
621 sources = bench_sources
622 sources -= [
623 rebase_path("bench/nanobench.cpp"),
624 rebase_path("bench/nanobenchAndroid.cpp"),
625 ]
626 deps = [
627 ":flags",
628 ":gm",
629 ":gpu_tool_utils",
630 ":skia",
631 ":tool_utils",
632 ]
633}
634
fmalitaa2b9fdf2016-08-03 19:53:36 -0700635test_lib("experimental_svg_model") {
636 public_include_dirs = [ "experimental/svg/model" ]
637 sources = [
638 "experimental/svg/model/SkSVGAttribute.cpp",
639 "experimental/svg/model/SkSVGAttributeParser.cpp",
fmalitadc4c2a92016-08-16 15:38:51 -0700640 "experimental/svg/model/SkSVGCircle.cpp",
anmittala7eaf2e2016-08-17 13:57:26 -0700641 "experimental/svg/model/SkSVGContainer.cpp",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700642 "experimental/svg/model/SkSVGDOM.cpp",
fmalitadc4c2a92016-08-16 15:38:51 -0700643 "experimental/svg/model/SkSVGEllipse.cpp",
fmalitad24ee142016-08-17 08:38:15 -0700644 "experimental/svg/model/SkSVGLine.cpp",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700645 "experimental/svg/model/SkSVGNode.cpp",
646 "experimental/svg/model/SkSVGPath.cpp",
fmalita5b31f322016-08-12 12:15:33 -0700647 "experimental/svg/model/SkSVGPoly.cpp",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700648 "experimental/svg/model/SkSVGRect.cpp",
649 "experimental/svg/model/SkSVGRenderContext.cpp",
650 "experimental/svg/model/SkSVGSVG.cpp",
651 "experimental/svg/model/SkSVGShape.cpp",
652 "experimental/svg/model/SkSVGTransformableNode.cpp",
653 "experimental/svg/model/SkSVGValue.cpp",
654 ]
655 deps = [
656 ":skia",
657 ]
658}
659
mtklein2b6870c2016-07-28 14:17:33 -0700660if (!is_component_build) { # Our test tools use many non-SK_API APIs...
661 executable("dm") {
662 sources = [
663 "dm/DM.cpp",
664 "dm/DMJsonWriter.cpp",
665 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700666 ]
667 include_dirs = [ "tests" ]
668 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700669 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700670 ":flags",
671 ":gm",
672 ":gpu_tool_utils",
673 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700674 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700675 ":tool_utils",
676 "//third_party/jsoncpp",
677 "//third_party/libpng",
678 ]
679 testonly = true
680 }
681
682 executable("monobench") {
683 sources = [
684 "tools/monobench.cpp",
685 ]
686 deps = [
687 ":bench",
688 ":skia",
689 ]
690 testonly = true
691 }
692
693 executable("nanobench") {
694 sources = [
695 "bench/nanobench.cpp",
696 ]
697 deps = [
698 ":bench",
699 ":flags",
700 ":gm",
701 ":gpu_tool_utils",
702 ":skia",
703 ":tool_utils",
704 "//third_party/jsoncpp",
705 ]
706 testonly = true
707 }
halcanary19a97202016-08-03 15:08:04 -0700708
709 executable("sktexttopdf") {
710 sources = [
711 "tools/SkShaper_harfbuzz.cpp",
712 "tools/using_skia_and_harfbuzz.cpp",
713 ]
714 deps = [
715 ":skia",
716 "//third_party/harfbuzz",
717 ]
718 testonly = true
719 }
mtklein25c81d42016-07-27 13:55:26 -0700720}