blob: e0ed2a6f80d2d1d406f1f296c4bf79f6c2537b4d [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
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
mtklein9b8583d2016-08-24 17:32:30 -0700164opts("none") {
165 enabled = !is_x86
166 sources = opts_gypi.none_sources
167 cflags = []
168}
mtkleinc04ff472016-06-23 10:29:30 -0700169
mtklein9b8583d2016-08-24 17:32:30 -0700170opts("sse2") {
171 enabled = is_x86
172 sources = opts_gypi.sse2_sources
173 cflags = [ "-msse2" ]
174}
mtkleinc04ff472016-06-23 10:29:30 -0700175
mtklein9b8583d2016-08-24 17:32:30 -0700176opts("ssse3") {
177 enabled = is_x86
178 sources = opts_gypi.ssse3_sources
179 cflags = [ "-mssse3" ]
180}
mtkleinc04ff472016-06-23 10:29:30 -0700181
mtklein9b8583d2016-08-24 17:32:30 -0700182opts("sse41") {
183 enabled = is_x86
184 sources = opts_gypi.sse41_sources
185 cflags = [ "-msse4.1" ]
186}
mtklein4e976072016-08-08 09:06:27 -0700187
mtklein9b8583d2016-08-24 17:32:30 -0700188opts("sse42") {
189 enabled = is_x86
190 sources = opts_gypi.sse42_sources
191 cflags = [ "-msse4.2" ]
192}
193
194opts("avx") {
195 enabled = is_x86
196 sources = opts_gypi.avx_sources
197 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700198}
199
mtkleinc095df52016-08-24 12:23:52 -0700200# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700201template("optional") {
202 if (invoker.enabled) {
203 config(target_name + "_public") {
204 defines = invoker.public_defines
205 }
206 source_set(target_name) {
207 forward_variables_from(invoker, "*", [ "public_defines" ])
208 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700209 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700210 }
211 } else {
212 # If not enabled, a phony empty target that swallows all otherwise unused variables.
213 source_set(target_name) {
214 forward_variables_from(invoker,
215 "*",
216 [
217 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700218 "deps",
219 "sources",
220 ])
221 }
mtkleineb3c4252016-08-23 07:38:09 -0700222 }
mtklein457b42a2016-08-23 13:56:37 -0700223}
mtklein457b42a2016-08-23 13:56:37 -0700224
225optional("gif") {
226 enabled = skia_use_giflib
227 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
228
mtklein457b42a2016-08-23 13:56:37 -0700229 deps = [
230 "//third_party/giflib",
231 ]
232 sources = [
233 "src/codec/SkGifCodec.cpp",
234 ]
235}
236
mtklein63213812016-08-24 09:55:56 -0700237optional("jpeg") {
238 enabled = skia_use_libjpeg_turbo
239 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
240
mtklein63213812016-08-24 09:55:56 -0700241 deps = [
242 "//third_party/libjpeg-turbo:libjpeg",
243 ]
244 sources = [
245 "src/codec/SkJpegCodec.cpp",
246 "src/codec/SkJpegDecoderMgr.cpp",
247 "src/codec/SkJpegUtility.cpp",
248 "src/images/SkJPEGImageEncoder.cpp",
249 "src/images/SkJPEGWriteUtility.cpp",
250 ]
251}
252
253optional("pdf") {
254 enabled = skia_use_zlib
255 public_defines = []
256
mtklein63213812016-08-24 09:55:56 -0700257 deps = [
258 "//third_party/zlib",
259 ]
260 sources = pdf_gypi.sources
261
262 if (skia_use_sfntly) {
263 deps += [ "//third_party/sfntly" ]
264 public_defines += [
265 # TODO(halcanary): make this the default; this is the value Android uses.
266 "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"",
267 ]
268 }
269}
270
271optional("png") {
272 enabled = skia_use_libpng
273 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
274
mtklein63213812016-08-24 09:55:56 -0700275 deps = [
276 "//third_party/libpng",
277 ]
278 sources = [
279 "src/codec/SkIcoCodec.cpp",
280 "src/codec/SkPngCodec.cpp",
281 "src/images/SkPNGImageEncoder.cpp",
282 ]
283}
284
mtklein457b42a2016-08-23 13:56:37 -0700285optional("webp") {
286 enabled = skia_use_libwebp
287 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
288
mtklein457b42a2016-08-23 13:56:37 -0700289 deps = [
290 "//third_party/libwebp",
291 ]
292 sources = [
293 "src/codec/SkWebpAdapterCodec.cpp",
294 "src/codec/SkWebpCodec.cpp",
295 "src/images/SkWEBPImageEncoder.cpp",
296 ]
mtkleineb3c4252016-08-23 07:38:09 -0700297}
298
mtklein63213812016-08-24 09:55:56 -0700299optional("xml") {
300 enabled = skia_use_expat
301 public_defines = []
302
mtklein63213812016-08-24 09:55:56 -0700303 deps = [
304 "//third_party/expat",
305 ]
306 sources = [
307 "src/xml/SkDOM.cpp",
308 "src/xml/SkXMLParser.cpp",
309 "src/xml/SkXMLWriter.cpp",
310 ]
311}
312
mtkleinc04ff472016-06-23 10:29:30 -0700313component("skia") {
314 public_configs = [ ":skia_public" ]
315 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700316
317 deps = [
mtklein9b8583d2016-08-24 17:32:30 -0700318 ":avx",
mtklein457b42a2016-08-23 13:56:37 -0700319 ":gif",
mtklein63213812016-08-24 09:55:56 -0700320 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700321 ":none",
mtklein63213812016-08-24 09:55:56 -0700322 ":pdf",
323 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700324 ":sse2",
325 ":sse41",
326 ":sse42",
327 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700328 ":webp",
mtklein63213812016-08-24 09:55:56 -0700329 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700330 ]
331
mtklein7a1f45f2016-08-04 06:19:33 -0700332 if (!is_win) {
333 libs = [ "pthread" ]
334 }
mtkleinc04ff472016-06-23 10:29:30 -0700335
336 sources = []
337 sources += core_gypi.sources
338 sources += effects_gypi.sources
339 sources += gpu_gypi.skgpu_sources
mtkleinc04ff472016-06-23 10:29:30 -0700340 sources += utils_gypi.sources
341 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700342 "src/android/SkBitmapRegionCodec.cpp",
343 "src/android/SkBitmapRegionDecoder.cpp",
344 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700345 "src/codec/SkBmpCodec.cpp",
346 "src/codec/SkBmpMaskCodec.cpp",
347 "src/codec/SkBmpRLECodec.cpp",
348 "src/codec/SkBmpStandardCodec.cpp",
349 "src/codec/SkCodec.cpp",
350 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700351 "src/codec/SkMaskSwizzler.cpp",
352 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700353 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700354 "src/codec/SkSampler.cpp",
355 "src/codec/SkSwizzler.cpp",
356 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700357 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700358 "src/images/SkImageEncoder.cpp",
359 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700360 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700361 "src/ports/SkDiscardableMemory_none.cpp",
362 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700363 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700364 "src/ports/SkMemory_malloc.cpp",
365 "src/ports/SkOSFile_stdio.cpp",
366 "src/sfnt/SkOTTable_name.cpp",
367 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700368 "src/svg/SkSVGCanvas.cpp",
369 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700370 "src/utils/mac/SkStream_mac.cpp",
371 "third_party/etc1/etc1.cpp",
372 "third_party/ktx/ktx.cpp",
373 ]
mtklein09e61f72016-08-23 13:35:28 -0700374 sources -= [
375 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
376 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
377 ]
mtkleinc04ff472016-06-23 10:29:30 -0700378
379 if (is_win) {
380 sources += [
381 "src/ports/SkDebug_win.cpp",
382 "src/ports/SkFontHost_win.cpp",
383 "src/ports/SkFontMgr_win_dw.cpp",
384 "src/ports/SkFontMgr_win_dw_factory.cpp",
385 "src/ports/SkImageEncoder_WIC.cpp",
386 "src/ports/SkImageGeneratorWIC.cpp",
387 "src/ports/SkOSFile_win.cpp",
388 "src/ports/SkScalerContext_win_dw.cpp",
389 "src/ports/SkTLS_win.cpp",
390 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700391 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700392 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700393 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700394 } else {
395 sources += [
396 "src/ports/SkDebug_stdio.cpp",
397 "src/ports/SkOSFile_posix.cpp",
398 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700399 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700400 ]
401 }
402
403 if (is_linux) {
404 deps += [
405 "third_party:fontconfig",
406 "third_party:freetype2",
mtkleinc04ff472016-06-23 10:29:30 -0700407 ]
mtklein09e61f72016-08-23 13:35:28 -0700408 libs += [
409 "GL",
410 "GLU",
411 "X11",
412 ]
mtkleinc04ff472016-06-23 10:29:30 -0700413 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700414 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700415 "src/ports/SkFontConfigInterface_direct.cpp",
416 "src/ports/SkFontConfigInterface_direct_factory.cpp",
417 "src/ports/SkFontHost_FreeType.cpp",
418 "src/ports/SkFontHost_FreeType_common.cpp",
bungeman7d0e3bc2016-08-02 07:07:33 -0700419 "src/ports/SkFontMgr_FontConfigInterface.cpp",
mtklein7a34b1c2016-08-01 13:08:46 -0700420 "src/ports/SkFontMgr_fontconfig.cpp",
421 "src/ports/SkFontMgr_fontconfig_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700422 ]
423 }
424
425 if (is_mac) {
426 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700427 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700428 "src/ports/SkFontHost_mac.cpp",
429 "src/ports/SkImageEncoder_CG.cpp",
430 "src/ports/SkImageGeneratorCG.cpp",
431 ]
mtklein09e61f72016-08-23 13:35:28 -0700432 libs += [
433 "ApplicationServices.framework",
434 "OpenGL.framework",
435 ]
mtkleinc04ff472016-06-23 10:29:30 -0700436 }
abarth6fc8ff02016-07-15 15:15:15 -0700437
438 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700439 sources += [
440 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
441 "src/ports/SkFontMgr_empty_factory.cpp",
442 ]
abarth6fc8ff02016-07-15 15:15:15 -0700443 }
mtkleinc04ff472016-06-23 10:29:30 -0700444}
445
mtkleinada5a442016-08-02 14:28:26 -0700446skia_h_headers = exec_script("gyp/find.py",
447 [ "*.h" ] + rebase_path(skia_public_includes),
448 "list lines",
449 []) -
450 [
451 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
452 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
453 rebase_path("include/gpu/vk/GrVkDefines.h"),
454 rebase_path("include/gpu/vk/GrVkInterface.h"),
455 rebase_path("include/gpu/vk/GrVkTypes.h"),
456 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
457 ]
458
mtklein1211e0c2016-07-26 13:55:45 -0700459action("skia.h") {
460 script = "gn/echo_headers.py"
461 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700462 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700463 outputs = [
464 "$target_gen_dir/skia.h",
465 ]
466}
467
468executable("fiddle") {
469 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700470 libs = []
471 if (is_linux) {
472 libs += [ "OSMesa" ]
473 }
mtklein1211e0c2016-07-26 13:55:45 -0700474
mtkleinc04ff472016-06-23 10:29:30 -0700475 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700476 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700477 "tools/fiddle/draw.cpp",
478 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700479 ]
480 deps = [
481 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700482 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700483 ]
mtkleinc04ff472016-06-23 10:29:30 -0700484}
mtklein25c81d42016-07-27 13:55:26 -0700485
mtkleinc095df52016-08-24 12:23:52 -0700486# Targets guarded by skia_enable_tools may use //third_party freely.
487if (skia_enable_tools) {
488 template("test_lib") {
489 config(target_name + "_config") {
490 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700491 }
mtkleinc095df52016-08-24 12:23:52 -0700492 source_set(target_name) {
493 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
494 public_configs = [
495 ":" + target_name + "_config",
496 ":skia_private",
497 ]
498
499 if (!defined(deps)) {
500 deps = []
501 }
502 deps += [ ":skia" ]
503 testonly = true
504 }
mtklein25c81d42016-07-27 13:55:26 -0700505 }
mtklein25c81d42016-07-27 13:55:26 -0700506
mtkleinc095df52016-08-24 12:23:52 -0700507 test_lib("gpu_tool_utils") {
508 public_include_dirs = [ "tools/gpu" ]
509 sources = [
510 "tools/gpu/GrContextFactory.cpp",
511 "tools/gpu/GrTest.cpp",
512 "tools/gpu/TestContext.cpp",
513 "tools/gpu/gl/GLTestContext.cpp",
514 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
515 "tools/gpu/gl/debug/GrBufferObj.cpp",
516 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
517 "tools/gpu/gl/debug/GrProgramObj.cpp",
518 "tools/gpu/gl/debug/GrShaderObj.cpp",
519 "tools/gpu/gl/debug/GrTextureObj.cpp",
520 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
521 "tools/gpu/gl/null/NullGLTestContext.cpp",
522 ]
523 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700524
mtkleinc095df52016-08-24 12:23:52 -0700525 if (is_linux) {
526 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
527 } else if (is_mac) {
528 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
529 }
mtklein25c81d42016-07-27 13:55:26 -0700530 }
mtklein25c81d42016-07-27 13:55:26 -0700531
mtkleinc095df52016-08-24 12:23:52 -0700532 test_lib("flags") {
533 public_include_dirs = [ "tools/flags" ]
534 sources = [
535 "tools/flags/SkCommandLineFlags.cpp",
536 "tools/flags/SkCommonFlags.cpp",
537 "tools/flags/SkCommonFlagsConfig.cpp",
538 ]
539 deps = [
540 ":gpu_tool_utils",
541 ]
542 }
mtklein25c81d42016-07-27 13:55:26 -0700543
mtkleinc095df52016-08-24 12:23:52 -0700544 test_lib("tool_utils") {
545 public_include_dirs = [
546 "tools",
547 "tools/debugger",
548 "tools/timer",
549 ]
550 sources = [
551 "src/images/SkForceLinking.cpp",
552 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
553 "tools/CrashHandler.cpp",
554 "tools/ProcStats.cpp",
555 "tools/Resources.cpp",
556 "tools/ThermalManager.cpp",
557 "tools/UrlDataManager.cpp",
558 "tools/debugger/SkDebugCanvas.cpp",
559 "tools/debugger/SkDrawCommand.cpp",
560 "tools/debugger/SkJsonWriteBuffer.cpp",
561 "tools/debugger/SkObjectParser.cpp",
562 "tools/debugger/SkOverdrawMode.cpp",
563 "tools/picture_utils.cpp",
564 "tools/random_parse_path.cpp",
565 "tools/sk_tool_utils.cpp",
566 "tools/sk_tool_utils_font.cpp",
567 "tools/timer/Timer.cpp",
568 ]
569 deps = [
570 ":flags",
571 "//third_party/libpng",
572 ]
573 public_deps = [
574 "//third_party/jsoncpp",
575 ]
576 }
mtklein25c81d42016-07-27 13:55:26 -0700577
mtkleinc095df52016-08-24 12:23:52 -0700578 gm_sources = exec_script("gyp/find.py",
579 [
580 "*.c*",
581 rebase_path("gm"),
582 ],
583 "list lines",
584 [])
585 test_lib("gm") {
586 public_include_dirs = [ "gm" ]
587 sources = gm_sources
588 deps = [
589 ":gpu_tool_utils",
590 ":skia",
591 ":tool_utils",
592 ]
593 }
mtklein25c81d42016-07-27 13:55:26 -0700594
mtkleinc095df52016-08-24 12:23:52 -0700595 tests_sources = exec_script("gyp/find.py",
596 [
597 "*.c*",
598 rebase_path("tests"),
599 ],
600 "list lines",
601 [])
mtklein2f3416d2016-08-02 16:02:05 -0700602
mtkleinc095df52016-08-24 12:23:52 -0700603 test_lib("tests") {
604 public_include_dirs = [ "tests" ]
605 sources =
606 tests_sources - [
607 rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only
608 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
609 rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work
610 rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work
611 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
612 rebase_path("tests/skia_test.cpp"), # alternate main
613 ]
614 deps = [
615 ":flags",
616 ":gpu_tool_utils",
617 ":skia",
618 ":tool_utils",
619 "//third_party/libpng",
620 "//third_party/zlib",
621 ]
622 }
mtklein2f3416d2016-08-02 16:02:05 -0700623
mtkleinc095df52016-08-24 12:23:52 -0700624 bench_sources = exec_script("gyp/find.py",
625 [
626 "*.c*",
627 rebase_path("bench"),
628 ],
629 "list lines",
630 [])
mtklein25c81d42016-07-27 13:55:26 -0700631
mtkleinc095df52016-08-24 12:23:52 -0700632 test_lib("bench") {
633 public_include_dirs = [ "bench" ]
634 sources = bench_sources
635 sources -= [
636 rebase_path("bench/nanobench.cpp"),
637 rebase_path("bench/nanobenchAndroid.cpp"),
638 ]
639 deps = [
640 ":flags",
641 ":gm",
642 ":gpu_tool_utils",
643 ":skia",
644 ":tool_utils",
645 ]
646 }
mtklein2b6870c2016-07-28 14:17:33 -0700647
mtkleinc095df52016-08-24 12:23:52 -0700648 test_lib("experimental_svg_model") {
649 public_include_dirs = [ "experimental/svg/model" ]
650 sources = [
651 "experimental/svg/model/SkSVGAttribute.cpp",
652 "experimental/svg/model/SkSVGAttributeParser.cpp",
653 "experimental/svg/model/SkSVGCircle.cpp",
654 "experimental/svg/model/SkSVGContainer.cpp",
655 "experimental/svg/model/SkSVGDOM.cpp",
656 "experimental/svg/model/SkSVGEllipse.cpp",
657 "experimental/svg/model/SkSVGLine.cpp",
658 "experimental/svg/model/SkSVGNode.cpp",
659 "experimental/svg/model/SkSVGPath.cpp",
660 "experimental/svg/model/SkSVGPoly.cpp",
661 "experimental/svg/model/SkSVGRect.cpp",
662 "experimental/svg/model/SkSVGRenderContext.cpp",
663 "experimental/svg/model/SkSVGSVG.cpp",
664 "experimental/svg/model/SkSVGShape.cpp",
665 "experimental/svg/model/SkSVGTransformableNode.cpp",
666 "experimental/svg/model/SkSVGValue.cpp",
667 ]
668 deps = [
669 ":skia",
670 ]
671 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700672
mtklein2b6870c2016-07-28 14:17:33 -0700673 executable("dm") {
674 sources = [
675 "dm/DM.cpp",
676 "dm/DMJsonWriter.cpp",
677 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700678 ]
679 include_dirs = [ "tests" ]
680 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700681 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700682 ":flags",
683 ":gm",
684 ":gpu_tool_utils",
685 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700686 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700687 ":tool_utils",
688 "//third_party/jsoncpp",
689 "//third_party/libpng",
690 ]
691 testonly = true
692 }
693
694 executable("monobench") {
695 sources = [
696 "tools/monobench.cpp",
697 ]
698 deps = [
699 ":bench",
700 ":skia",
701 ]
702 testonly = true
703 }
704
705 executable("nanobench") {
706 sources = [
707 "bench/nanobench.cpp",
708 ]
709 deps = [
710 ":bench",
711 ":flags",
712 ":gm",
713 ":gpu_tool_utils",
714 ":skia",
715 ":tool_utils",
716 "//third_party/jsoncpp",
717 ]
718 testonly = true
719 }
halcanary19a97202016-08-03 15:08:04 -0700720
721 executable("sktexttopdf") {
722 sources = [
723 "tools/SkShaper_harfbuzz.cpp",
724 "tools/using_skia_and_harfbuzz.cpp",
725 ]
726 deps = [
727 ":skia",
728 "//third_party/harfbuzz",
729 ]
730 testonly = true
731 }
mtklein25c81d42016-07-27 13:55:26 -0700732}