blob: 2ea5a075fdd0f0c1a38f97811ca6df3f50f95e8e [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" ]
40}
41
42# Skia internal APIs, used by Skia itself and a few test tools.
43config("skia_private") {
44 visibility = [ ":*" ]
45
46 include_dirs = [
47 "include/private",
48 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070049 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070050 "src/config",
51 "src/core",
52 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070053 "src/effects/gradients",
54 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070055 "src/gpu",
56 "src/image",
57 "src/images",
58 "src/lazy",
59 "src/opts",
60 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070061 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070062 "src/ports",
63 "src/sfnt",
64 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070065 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070066 "third_party/etc1",
67 "third_party/ktx",
68 ]
mtklein150d1132016-08-01 06:56:40 -070069
mtklein63213812016-08-24 09:55:56 -070070 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinee269f42016-08-04 09:52:11 -070071 if (is_linux) {
72 defines += [ "SK_SAMPLES_FOR_X" ]
73 }
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
anmittala7eaf2e2016-08-17 13:57:26 -0700142source_set("opts_none") {
143 configs += skia_library_configs
144 sources = opts_gypi.none_sources
145}
146
mtklein422310d2016-08-16 18:28:43 -0700147is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700148
mtklein422310d2016-08-16 18:28:43 -0700149if (is_x86) {
150 source_set("opts_sse2") {
151 configs += skia_library_configs
152 sources = opts_gypi.sse2_sources
153 cflags = [ "-msse2" ]
154 }
mtkleinc04ff472016-06-23 10:29:30 -0700155
mtklein422310d2016-08-16 18:28:43 -0700156 source_set("opts_ssse3") {
157 configs += skia_library_configs
158 sources = opts_gypi.ssse3_sources
159 cflags = [ "-mssse3" ]
160 }
mtkleinc04ff472016-06-23 10:29:30 -0700161
mtklein422310d2016-08-16 18:28:43 -0700162 source_set("opts_sse41") {
163 configs += skia_library_configs
164 sources = opts_gypi.sse41_sources
165 cflags = [ "-msse4.1" ]
166 }
mtkleinc04ff472016-06-23 10:29:30 -0700167
mtklein422310d2016-08-16 18:28:43 -0700168 source_set("opts_sse42") {
169 configs += skia_library_configs
170 sources = opts_gypi.sse42_sources
171 cflags = [ "-msse4.2" ]
172 }
mtklein4e976072016-08-08 09:06:27 -0700173
mtklein422310d2016-08-16 18:28:43 -0700174 source_set("opts_avx") {
175 configs += skia_library_configs
176 sources = opts_gypi.avx_sources
177 cflags = [ "-mavx" ]
178 }
mtkleinc04ff472016-06-23 10:29:30 -0700179}
180
mtkleinc095df52016-08-24 12:23:52 -0700181# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700182template("optional") {
183 if (invoker.enabled) {
184 config(target_name + "_public") {
185 defines = invoker.public_defines
186 }
187 source_set(target_name) {
188 forward_variables_from(invoker, "*", [ "public_defines" ])
189 all_dependent_configs = [ ":" + target_name + "_public" ]
190 }
191 } else {
192 # If not enabled, a phony empty target that swallows all otherwise unused variables.
193 source_set(target_name) {
194 forward_variables_from(invoker,
195 "*",
196 [
197 "public_defines",
198 "configs",
199 "deps",
200 "sources",
201 ])
202 }
mtkleineb3c4252016-08-23 07:38:09 -0700203 }
mtklein457b42a2016-08-23 13:56:37 -0700204}
205set_defaults("optional") {
206 configs = default_configs
207}
208
209optional("gif") {
210 enabled = skia_use_giflib
211 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
212
213 configs += skia_library_configs
214 deps = [
215 "//third_party/giflib",
216 ]
217 sources = [
218 "src/codec/SkGifCodec.cpp",
219 ]
220}
221
mtklein63213812016-08-24 09:55:56 -0700222optional("jpeg") {
223 enabled = skia_use_libjpeg_turbo
224 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
225
226 configs += skia_library_configs
227 deps = [
228 "//third_party/libjpeg-turbo:libjpeg",
229 ]
230 sources = [
231 "src/codec/SkJpegCodec.cpp",
232 "src/codec/SkJpegDecoderMgr.cpp",
233 "src/codec/SkJpegUtility.cpp",
234 "src/images/SkJPEGImageEncoder.cpp",
235 "src/images/SkJPEGWriteUtility.cpp",
236 ]
237}
238
239optional("pdf") {
240 enabled = skia_use_zlib
241 public_defines = []
242
243 configs += skia_library_configs
244 deps = [
245 "//third_party/zlib",
246 ]
247 sources = pdf_gypi.sources
248
249 if (skia_use_sfntly) {
250 deps += [ "//third_party/sfntly" ]
251 public_defines += [
252 # TODO(halcanary): make this the default; this is the value Android uses.
253 "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"",
254 ]
255 }
256}
257
258optional("png") {
259 enabled = skia_use_libpng
260 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
261
262 configs += skia_library_configs
263 deps = [
264 "//third_party/libpng",
265 ]
266 sources = [
267 "src/codec/SkIcoCodec.cpp",
268 "src/codec/SkPngCodec.cpp",
269 "src/images/SkPNGImageEncoder.cpp",
270 ]
271}
272
mtklein457b42a2016-08-23 13:56:37 -0700273optional("webp") {
274 enabled = skia_use_libwebp
275 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
276
277 configs += skia_library_configs
278 deps = [
279 "//third_party/libwebp",
280 ]
281 sources = [
282 "src/codec/SkWebpAdapterCodec.cpp",
283 "src/codec/SkWebpCodec.cpp",
284 "src/images/SkWEBPImageEncoder.cpp",
285 ]
mtkleineb3c4252016-08-23 07:38:09 -0700286}
287
mtklein63213812016-08-24 09:55:56 -0700288optional("xml") {
289 enabled = skia_use_expat
290 public_defines = []
291
292 configs += skia_library_configs
293 deps = [
294 "//third_party/expat",
295 ]
296 sources = [
297 "src/xml/SkDOM.cpp",
298 "src/xml/SkXMLParser.cpp",
299 "src/xml/SkXMLWriter.cpp",
300 ]
301}
302
mtkleinc04ff472016-06-23 10:29:30 -0700303component("skia") {
304 public_configs = [ ":skia_public" ]
305 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700306
307 deps = [
mtklein457b42a2016-08-23 13:56:37 -0700308 ":gif",
mtklein63213812016-08-24 09:55:56 -0700309 ":jpeg",
310 ":pdf",
311 ":png",
mtkleineb3c4252016-08-23 07:38:09 -0700312 ":webp",
mtklein63213812016-08-24 09:55:56 -0700313 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700314 ]
mtklein422310d2016-08-16 18:28:43 -0700315 if (is_x86) {
316 deps += [
317 ":opts_avx",
318 ":opts_sse2",
319 ":opts_sse41",
320 ":opts_sse42",
321 ":opts_ssse3",
322 ]
anmittala7eaf2e2016-08-17 13:57:26 -0700323 } else {
324 deps += [ ":opts_none" ]
mtklein422310d2016-08-16 18:28:43 -0700325 }
mtkleinc04ff472016-06-23 10:29:30 -0700326
mtklein7a1f45f2016-08-04 06:19:33 -0700327 if (!is_win) {
328 libs = [ "pthread" ]
329 }
mtkleinc04ff472016-06-23 10:29:30 -0700330
331 sources = []
332 sources += core_gypi.sources
333 sources += effects_gypi.sources
334 sources += gpu_gypi.skgpu_sources
mtkleinc04ff472016-06-23 10:29:30 -0700335 sources += utils_gypi.sources
336 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700337 "src/android/SkBitmapRegionCodec.cpp",
338 "src/android/SkBitmapRegionDecoder.cpp",
339 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700340 "src/codec/SkBmpCodec.cpp",
341 "src/codec/SkBmpMaskCodec.cpp",
342 "src/codec/SkBmpRLECodec.cpp",
343 "src/codec/SkBmpStandardCodec.cpp",
344 "src/codec/SkCodec.cpp",
345 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700346 "src/codec/SkMaskSwizzler.cpp",
347 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700348 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700349 "src/codec/SkSampler.cpp",
350 "src/codec/SkSwizzler.cpp",
351 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700352 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700353 "src/images/SkImageEncoder.cpp",
354 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700355 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700356 "src/ports/SkDiscardableMemory_none.cpp",
357 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700358 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700359 "src/ports/SkMemory_malloc.cpp",
360 "src/ports/SkOSFile_stdio.cpp",
361 "src/sfnt/SkOTTable_name.cpp",
362 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700363 "src/svg/SkSVGCanvas.cpp",
364 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700365 "src/utils/mac/SkStream_mac.cpp",
366 "third_party/etc1/etc1.cpp",
367 "third_party/ktx/ktx.cpp",
368 ]
mtklein09e61f72016-08-23 13:35:28 -0700369 sources -= [
370 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
371 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
372 ]
mtkleinc04ff472016-06-23 10:29:30 -0700373
374 if (is_win) {
375 sources += [
376 "src/ports/SkDebug_win.cpp",
377 "src/ports/SkFontHost_win.cpp",
378 "src/ports/SkFontMgr_win_dw.cpp",
379 "src/ports/SkFontMgr_win_dw_factory.cpp",
380 "src/ports/SkImageEncoder_WIC.cpp",
381 "src/ports/SkImageGeneratorWIC.cpp",
382 "src/ports/SkOSFile_win.cpp",
383 "src/ports/SkScalerContext_win_dw.cpp",
384 "src/ports/SkTLS_win.cpp",
385 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700386 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700387 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700388 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700389 } else {
390 sources += [
391 "src/ports/SkDebug_stdio.cpp",
392 "src/ports/SkOSFile_posix.cpp",
393 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700394 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700395 ]
396 }
397
398 if (is_linux) {
399 deps += [
400 "third_party:fontconfig",
401 "third_party:freetype2",
mtkleinc04ff472016-06-23 10:29:30 -0700402 ]
mtklein09e61f72016-08-23 13:35:28 -0700403 libs += [
404 "GL",
405 "GLU",
406 "X11",
407 ]
mtkleinc04ff472016-06-23 10:29:30 -0700408 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700409 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700410 "src/ports/SkFontConfigInterface_direct.cpp",
411 "src/ports/SkFontConfigInterface_direct_factory.cpp",
412 "src/ports/SkFontHost_FreeType.cpp",
413 "src/ports/SkFontHost_FreeType_common.cpp",
bungeman7d0e3bc2016-08-02 07:07:33 -0700414 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein7a34b1c2016-08-01 13:08:46 -0700415 "src/ports/SkFontMgr_fontconfig.cpp",
416 "src/ports/SkFontMgr_fontconfig_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700417 ]
418 }
419
420 if (is_mac) {
421 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700422 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700423 "src/ports/SkFontHost_mac.cpp",
424 "src/ports/SkImageEncoder_CG.cpp",
425 "src/ports/SkImageGeneratorCG.cpp",
426 ]
mtklein09e61f72016-08-23 13:35:28 -0700427 libs += [
428 "ApplicationServices.framework",
429 "OpenGL.framework",
430 ]
mtkleinc04ff472016-06-23 10:29:30 -0700431 }
abarth6fc8ff02016-07-15 15:15:15 -0700432
433 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700434 sources += [
435 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
436 "src/ports/SkFontMgr_empty_factory.cpp",
437 ]
abarth6fc8ff02016-07-15 15:15:15 -0700438 }
mtkleinc04ff472016-06-23 10:29:30 -0700439}
440
mtkleinada5a442016-08-02 14:28:26 -0700441skia_h_headers = exec_script("gyp/find.py",
442 [ "*.h" ] + rebase_path(skia_public_includes),
443 "list lines",
444 []) -
445 [
446 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
447 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
448 rebase_path("include/gpu/vk/GrVkDefines.h"),
449 rebase_path("include/gpu/vk/GrVkInterface.h"),
450 rebase_path("include/gpu/vk/GrVkTypes.h"),
451 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
452 ]
453
mtklein1211e0c2016-07-26 13:55:45 -0700454action("skia.h") {
455 script = "gn/echo_headers.py"
456 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700457 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700458 outputs = [
459 "$target_gen_dir/skia.h",
460 ]
461}
462
463executable("fiddle") {
464 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700465 libs = []
466 if (is_linux) {
467 libs += [ "OSMesa" ]
468 }
mtklein1211e0c2016-07-26 13:55:45 -0700469
mtkleinc04ff472016-06-23 10:29:30 -0700470 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700471 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700472 "tools/fiddle/draw.cpp",
473 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700474 ]
475 deps = [
476 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700477 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700478 ]
mtkleinc04ff472016-06-23 10:29:30 -0700479}
mtklein25c81d42016-07-27 13:55:26 -0700480
mtkleinc095df52016-08-24 12:23:52 -0700481# Targets guarded by skia_enable_tools may use //third_party freely.
482if (skia_enable_tools) {
483 template("test_lib") {
484 config(target_name + "_config") {
485 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700486 }
mtkleinc095df52016-08-24 12:23:52 -0700487 source_set(target_name) {
488 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
489 public_configs = [
490 ":" + target_name + "_config",
491 ":skia_private",
492 ]
493
494 if (!defined(deps)) {
495 deps = []
496 }
497 deps += [ ":skia" ]
498 testonly = true
499 }
mtklein25c81d42016-07-27 13:55:26 -0700500 }
mtklein25c81d42016-07-27 13:55:26 -0700501
mtkleinc095df52016-08-24 12:23:52 -0700502 test_lib("gpu_tool_utils") {
503 public_include_dirs = [ "tools/gpu" ]
504 sources = [
505 "tools/gpu/GrContextFactory.cpp",
506 "tools/gpu/GrTest.cpp",
507 "tools/gpu/TestContext.cpp",
508 "tools/gpu/gl/GLTestContext.cpp",
509 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
510 "tools/gpu/gl/debug/GrBufferObj.cpp",
511 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
512 "tools/gpu/gl/debug/GrProgramObj.cpp",
513 "tools/gpu/gl/debug/GrShaderObj.cpp",
514 "tools/gpu/gl/debug/GrTextureObj.cpp",
515 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
516 "tools/gpu/gl/null/NullGLTestContext.cpp",
517 ]
518 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700519
mtkleinc095df52016-08-24 12:23:52 -0700520 if (is_linux) {
521 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
522 } else if (is_mac) {
523 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
524 }
mtklein25c81d42016-07-27 13:55:26 -0700525 }
mtklein25c81d42016-07-27 13:55:26 -0700526
mtkleinc095df52016-08-24 12:23:52 -0700527 test_lib("flags") {
528 public_include_dirs = [ "tools/flags" ]
529 sources = [
530 "tools/flags/SkCommandLineFlags.cpp",
531 "tools/flags/SkCommonFlags.cpp",
532 "tools/flags/SkCommonFlagsConfig.cpp",
533 ]
534 deps = [
535 ":gpu_tool_utils",
536 ]
537 }
mtklein25c81d42016-07-27 13:55:26 -0700538
mtkleinc095df52016-08-24 12:23:52 -0700539 test_lib("tool_utils") {
540 public_include_dirs = [
541 "tools",
542 "tools/debugger",
543 "tools/timer",
544 ]
545 sources = [
546 "src/images/SkForceLinking.cpp",
547 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
548 "tools/CrashHandler.cpp",
549 "tools/ProcStats.cpp",
550 "tools/Resources.cpp",
551 "tools/ThermalManager.cpp",
552 "tools/UrlDataManager.cpp",
553 "tools/debugger/SkDebugCanvas.cpp",
554 "tools/debugger/SkDrawCommand.cpp",
555 "tools/debugger/SkJsonWriteBuffer.cpp",
556 "tools/debugger/SkObjectParser.cpp",
557 "tools/debugger/SkOverdrawMode.cpp",
558 "tools/picture_utils.cpp",
559 "tools/random_parse_path.cpp",
560 "tools/sk_tool_utils.cpp",
561 "tools/sk_tool_utils_font.cpp",
562 "tools/timer/Timer.cpp",
563 ]
564 deps = [
565 ":flags",
566 "//third_party/libpng",
567 ]
568 public_deps = [
569 "//third_party/jsoncpp",
570 ]
571 }
mtklein25c81d42016-07-27 13:55:26 -0700572
mtkleinc095df52016-08-24 12:23:52 -0700573 gm_sources = exec_script("gyp/find.py",
574 [
575 "*.c*",
576 rebase_path("gm"),
577 ],
578 "list lines",
579 [])
580 test_lib("gm") {
581 public_include_dirs = [ "gm" ]
582 sources = gm_sources
583 deps = [
584 ":gpu_tool_utils",
585 ":skia",
586 ":tool_utils",
587 ]
588 }
mtklein25c81d42016-07-27 13:55:26 -0700589
mtkleinc095df52016-08-24 12:23:52 -0700590 tests_sources = exec_script("gyp/find.py",
591 [
592 "*.c*",
593 rebase_path("tests"),
594 ],
595 "list lines",
596 [])
mtklein2f3416d2016-08-02 16:02:05 -0700597
mtkleinc095df52016-08-24 12:23:52 -0700598 test_lib("tests") {
599 public_include_dirs = [ "tests" ]
600 sources =
601 tests_sources - [
602 rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only
603 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
604 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
605 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
606 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
607 rebase_path("tests/skia_test.cpp"), # alternate main
608 ]
609 deps = [
610 ":flags",
611 ":gpu_tool_utils",
612 ":skia",
613 ":tool_utils",
614 "//third_party/libpng",
615 "//third_party/zlib",
616 ]
617 }
mtklein2f3416d2016-08-02 16:02:05 -0700618
mtkleinc095df52016-08-24 12:23:52 -0700619 bench_sources = exec_script("gyp/find.py",
620 [
621 "*.c*",
622 rebase_path("bench"),
623 ],
624 "list lines",
625 [])
mtklein25c81d42016-07-27 13:55:26 -0700626
mtkleinc095df52016-08-24 12:23:52 -0700627 test_lib("bench") {
628 public_include_dirs = [ "bench" ]
629 sources = bench_sources
630 sources -= [
631 rebase_path("bench/nanobench.cpp"),
632 rebase_path("bench/nanobenchAndroid.cpp"),
633 ]
634 deps = [
635 ":flags",
636 ":gm",
637 ":gpu_tool_utils",
638 ":skia",
639 ":tool_utils",
640 ]
641 }
mtklein2b6870c2016-07-28 14:17:33 -0700642
mtkleinc095df52016-08-24 12:23:52 -0700643 test_lib("experimental_svg_model") {
644 public_include_dirs = [ "experimental/svg/model" ]
645 sources = [
646 "experimental/svg/model/SkSVGAttribute.cpp",
647 "experimental/svg/model/SkSVGAttributeParser.cpp",
648 "experimental/svg/model/SkSVGCircle.cpp",
649 "experimental/svg/model/SkSVGContainer.cpp",
650 "experimental/svg/model/SkSVGDOM.cpp",
651 "experimental/svg/model/SkSVGEllipse.cpp",
652 "experimental/svg/model/SkSVGLine.cpp",
653 "experimental/svg/model/SkSVGNode.cpp",
654 "experimental/svg/model/SkSVGPath.cpp",
655 "experimental/svg/model/SkSVGPoly.cpp",
656 "experimental/svg/model/SkSVGRect.cpp",
657 "experimental/svg/model/SkSVGRenderContext.cpp",
658 "experimental/svg/model/SkSVGSVG.cpp",
659 "experimental/svg/model/SkSVGShape.cpp",
660 "experimental/svg/model/SkSVGTransformableNode.cpp",
661 "experimental/svg/model/SkSVGValue.cpp",
662 ]
663 deps = [
664 ":skia",
665 ]
666 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700667
mtklein2b6870c2016-07-28 14:17:33 -0700668 executable("dm") {
669 sources = [
670 "dm/DM.cpp",
671 "dm/DMJsonWriter.cpp",
672 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700673 ]
674 include_dirs = [ "tests" ]
675 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700676 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700677 ":flags",
678 ":gm",
679 ":gpu_tool_utils",
680 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700681 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700682 ":tool_utils",
683 "//third_party/jsoncpp",
684 "//third_party/libpng",
685 ]
686 testonly = true
687 }
688
689 executable("monobench") {
690 sources = [
691 "tools/monobench.cpp",
692 ]
693 deps = [
694 ":bench",
695 ":skia",
696 ]
697 testonly = true
698 }
699
700 executable("nanobench") {
701 sources = [
702 "bench/nanobench.cpp",
703 ]
704 deps = [
705 ":bench",
706 ":flags",
707 ":gm",
708 ":gpu_tool_utils",
709 ":skia",
710 ":tool_utils",
711 "//third_party/jsoncpp",
712 ]
713 testonly = true
714 }
halcanary19a97202016-08-03 15:08:04 -0700715
716 executable("sktexttopdf") {
717 sources = [
718 "tools/SkShaper_harfbuzz.cpp",
719 "tools/using_skia_and_harfbuzz.cpp",
720 ]
721 deps = [
722 ":skia",
723 "//third_party/harfbuzz",
724 ]
725 testonly = true
726 }
mtklein25c81d42016-07-27 13:55:26 -0700727}