blob: c1aed787a59a16627a28b346e6e566c5acad9f8a [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) {
mtklein2ff47c22016-08-24 10:27:13 -0700431 sources += [
432 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
433 "src/ports/SkFontMgr_empty_factory.cpp",
434 ]
abarth6fc8ff02016-07-15 15:15:15 -0700435 }
mtkleinc04ff472016-06-23 10:29:30 -0700436}
437
mtkleinada5a442016-08-02 14:28:26 -0700438skia_h_headers = exec_script("gyp/find.py",
439 [ "*.h" ] + rebase_path(skia_public_includes),
440 "list lines",
441 []) -
442 [
443 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
444 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
445 rebase_path("include/gpu/vk/GrVkDefines.h"),
446 rebase_path("include/gpu/vk/GrVkInterface.h"),
447 rebase_path("include/gpu/vk/GrVkTypes.h"),
448 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
449 ]
450
mtklein1211e0c2016-07-26 13:55:45 -0700451action("skia.h") {
452 script = "gn/echo_headers.py"
453 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinada5a442016-08-02 14:28:26 -0700454 rebase_path(skia_h_headers, root_build_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700455 outputs = [
456 "$target_gen_dir/skia.h",
457 ]
458}
459
460executable("fiddle") {
461 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700462 libs = []
463 if (is_linux) {
464 libs += [ "OSMesa" ]
465 }
mtklein1211e0c2016-07-26 13:55:45 -0700466
mtkleinc04ff472016-06-23 10:29:30 -0700467 sources = [
mtklein1211e0c2016-07-26 13:55:45 -0700468 "tools/fiddle/draw.cpp",
469 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700470 ]
471 deps = [
472 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700473 ":skia.h",
mtklein5dbd2742016-08-02 11:13:48 -0700474 ":tool_utils",
mtkleinc04ff472016-06-23 10:29:30 -0700475 ]
mtklein5dbd2742016-08-02 11:13:48 -0700476 testonly = true
mtkleinc04ff472016-06-23 10:29:30 -0700477}
mtklein25c81d42016-07-27 13:55:26 -0700478
479template("test_lib") {
480 config(target_name + "_config") {
481 include_dirs = invoker.public_include_dirs
482 }
483 source_set(target_name) {
484 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
485 public_configs = [
486 ":" + target_name + "_config",
487 ":skia_private",
488 ]
489
490 if (!defined(deps)) {
491 deps = []
492 }
493 deps += [ ":skia" ]
494 testonly = true
495 }
496}
497
498test_lib("gpu_tool_utils") {
499 public_include_dirs = [ "tools/gpu" ]
500 sources = [
501 "tools/gpu/GrContextFactory.cpp",
502 "tools/gpu/GrTest.cpp",
503 "tools/gpu/TestContext.cpp",
504 "tools/gpu/gl/GLTestContext.cpp",
505 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
506 "tools/gpu/gl/debug/GrBufferObj.cpp",
507 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
508 "tools/gpu/gl/debug/GrProgramObj.cpp",
509 "tools/gpu/gl/debug/GrShaderObj.cpp",
510 "tools/gpu/gl/debug/GrTextureObj.cpp",
511 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
512 "tools/gpu/gl/null/NullGLTestContext.cpp",
513 ]
514 libs = []
515
516 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700517 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
mtklein25c81d42016-07-27 13:55:26 -0700518 } else if (is_mac) {
mtklein09e61f72016-08-23 13:35:28 -0700519 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
mtklein25c81d42016-07-27 13:55:26 -0700520 }
521}
522
523test_lib("flags") {
524 public_include_dirs = [ "tools/flags" ]
525 sources = [
526 "tools/flags/SkCommandLineFlags.cpp",
527 "tools/flags/SkCommonFlags.cpp",
528 "tools/flags/SkCommonFlagsConfig.cpp",
529 ]
530 deps = [
531 ":gpu_tool_utils",
532 ]
533}
534
535test_lib("tool_utils") {
536 public_include_dirs = [
537 "tools",
mtklein2f3416d2016-08-02 16:02:05 -0700538 "tools/debugger",
mtklein25c81d42016-07-27 13:55:26 -0700539 "tools/timer",
540 ]
541 sources = [
mtklein2b6870c2016-07-28 14:17:33 -0700542 "src/images/SkForceLinking.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700543 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtklein2b6870c2016-07-28 14:17:33 -0700544 "tools/CrashHandler.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700545 "tools/ProcStats.cpp",
546 "tools/Resources.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700547 "tools/ThermalManager.cpp",
mtklein2f3416d2016-08-02 16:02:05 -0700548 "tools/UrlDataManager.cpp",
549 "tools/debugger/SkDebugCanvas.cpp",
550 "tools/debugger/SkDrawCommand.cpp",
551 "tools/debugger/SkJsonWriteBuffer.cpp",
552 "tools/debugger/SkObjectParser.cpp",
553 "tools/debugger/SkOverdrawMode.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700554 "tools/picture_utils.cpp",
555 "tools/random_parse_path.cpp",
556 "tools/sk_tool_utils.cpp",
557 "tools/sk_tool_utils_font.cpp",
558 "tools/timer/Timer.cpp",
559 ]
560 deps = [
561 ":flags",
mtklein2f3416d2016-08-02 16:02:05 -0700562 "//third_party/libpng",
563 ]
564 public_deps = [
565 "//third_party/jsoncpp",
mtklein25c81d42016-07-27 13:55:26 -0700566 ]
567}
568
569gm_sources = exec_script("gyp/find.py",
570 [
mtklein25c81d42016-07-27 13:55:26 -0700571 "*.c*",
mtkleinada5a442016-08-02 14:28:26 -0700572 rebase_path("gm"),
mtklein25c81d42016-07-27 13:55:26 -0700573 ],
574 "list lines",
575 [])
576test_lib("gm") {
577 public_include_dirs = [ "gm" ]
578 sources = gm_sources
579 deps = [
580 ":gpu_tool_utils",
581 ":skia",
582 ":tool_utils",
583 ]
584}
585
mtklein2f3416d2016-08-02 16:02:05 -0700586tests_sources = exec_script("gyp/find.py",
587 [
588 "*.c*",
589 rebase_path("tests"),
590 ],
591 "list lines",
592 [])
593
594test_lib("tests") {
595 public_include_dirs = [ "tests" ]
596 sources = tests_sources - [
597 rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only
598 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtklein4db3b792016-08-03 14:18:22 -0700599 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
600 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
mtklein2f3416d2016-08-02 16:02:05 -0700601 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
602 rebase_path("tests/skia_test.cpp"), # alternate main
603 ]
604 deps = [
605 ":flags",
606 ":gpu_tool_utils",
607 ":skia",
608 ":tool_utils",
609 "//third_party/libpng",
610 "//third_party/zlib",
611 ]
612}
613
mtklein2b6870c2016-07-28 14:17:33 -0700614bench_sources = exec_script("gyp/find.py",
615 [
mtklein2b6870c2016-07-28 14:17:33 -0700616 "*.c*",
mtkleinada5a442016-08-02 14:28:26 -0700617 rebase_path("bench"),
mtklein2b6870c2016-07-28 14:17:33 -0700618 ],
619 "list lines",
620 [])
mtklein25c81d42016-07-27 13:55:26 -0700621
mtklein2b6870c2016-07-28 14:17:33 -0700622test_lib("bench") {
623 public_include_dirs = [ "bench" ]
624 sources = bench_sources
625 sources -= [
626 rebase_path("bench/nanobench.cpp"),
627 rebase_path("bench/nanobenchAndroid.cpp"),
628 ]
629 deps = [
630 ":flags",
631 ":gm",
632 ":gpu_tool_utils",
633 ":skia",
634 ":tool_utils",
635 ]
636}
637
fmalitaa2b9fdf2016-08-03 19:53:36 -0700638test_lib("experimental_svg_model") {
639 public_include_dirs = [ "experimental/svg/model" ]
640 sources = [
641 "experimental/svg/model/SkSVGAttribute.cpp",
642 "experimental/svg/model/SkSVGAttributeParser.cpp",
fmalitadc4c2a92016-08-16 15:38:51 -0700643 "experimental/svg/model/SkSVGCircle.cpp",
anmittala7eaf2e2016-08-17 13:57:26 -0700644 "experimental/svg/model/SkSVGContainer.cpp",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700645 "experimental/svg/model/SkSVGDOM.cpp",
fmalitadc4c2a92016-08-16 15:38:51 -0700646 "experimental/svg/model/SkSVGEllipse.cpp",
fmalitad24ee142016-08-17 08:38:15 -0700647 "experimental/svg/model/SkSVGLine.cpp",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700648 "experimental/svg/model/SkSVGNode.cpp",
649 "experimental/svg/model/SkSVGPath.cpp",
fmalita5b31f322016-08-12 12:15:33 -0700650 "experimental/svg/model/SkSVGPoly.cpp",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700651 "experimental/svg/model/SkSVGRect.cpp",
652 "experimental/svg/model/SkSVGRenderContext.cpp",
653 "experimental/svg/model/SkSVGSVG.cpp",
654 "experimental/svg/model/SkSVGShape.cpp",
655 "experimental/svg/model/SkSVGTransformableNode.cpp",
656 "experimental/svg/model/SkSVGValue.cpp",
657 ]
658 deps = [
659 ":skia",
660 ]
661}
662
mtklein2b6870c2016-07-28 14:17:33 -0700663if (!is_component_build) { # Our test tools use many non-SK_API APIs...
664 executable("dm") {
665 sources = [
666 "dm/DM.cpp",
667 "dm/DMJsonWriter.cpp",
668 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700669 ]
670 include_dirs = [ "tests" ]
671 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700672 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700673 ":flags",
674 ":gm",
675 ":gpu_tool_utils",
676 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700677 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700678 ":tool_utils",
679 "//third_party/jsoncpp",
680 "//third_party/libpng",
681 ]
682 testonly = true
683 }
684
685 executable("monobench") {
686 sources = [
687 "tools/monobench.cpp",
688 ]
689 deps = [
690 ":bench",
691 ":skia",
692 ]
693 testonly = true
694 }
695
696 executable("nanobench") {
697 sources = [
698 "bench/nanobench.cpp",
699 ]
700 deps = [
701 ":bench",
702 ":flags",
703 ":gm",
704 ":gpu_tool_utils",
705 ":skia",
706 ":tool_utils",
707 "//third_party/jsoncpp",
708 ]
709 testonly = true
710 }
halcanary19a97202016-08-03 15:08:04 -0700711
712 executable("sktexttopdf") {
713 sources = [
714 "tools/SkShaper_harfbuzz.cpp",
715 "tools/using_skia_and_harfbuzz.cpp",
716 ]
717 deps = [
718 ":skia",
719 "//third_party/harfbuzz",
720 ]
721 testonly = true
722 }
mtklein25c81d42016-07-27 13:55:26 -0700723}