Added bindings for SkPixelSerializer
[platform/upstream/libSkiaSharp.git] / BUILD.gn
1 # 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
6 import("gn/android_framework_defines.gni")
7 import("gn/shared_sources.gni")
8
9 if (is_fuchsia) {
10   import("//build/vulkan/config.gni")
11 }
12
13 if (!defined(is_skia_standalone)) {
14   is_skia_standalone = false
15 }
16 is_skia_dev_build = is_skia_standalone && !is_official_build
17
18 declare_args() {
19   skia_use_angle = false
20   skia_use_egl = false
21   skia_use_expat = true
22   skia_use_fontconfig = is_linux
23   skia_use_freetype = is_android || is_fuchsia || is_linux
24   skia_use_gdi = false
25   skia_use_icu = !is_fuchsia && !is_ios && !is_win  # TODO: Windows
26   skia_use_libjpeg_turbo = true
27   skia_use_libpng = true
28   skia_use_libwebp = !is_fuchsia
29   skia_use_lua = false
30   skia_use_mesa = false
31   skia_use_piex = !is_win
32   skia_use_zlib = true
33
34   skia_android_serial = ""
35   skia_enable_android_framework_defines = false
36   skia_enable_discrete_gpu = true
37   skia_enable_effects = true
38   skia_enable_gpu = true
39   skia_enable_pdf = true
40   skia_enable_spirv_validation = is_skia_dev_build && is_debug
41   skia_enable_tools = is_skia_dev_build
42   skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
43   skia_vulkan_sdk = getenv("VULKAN_SDK")
44 }
45 declare_args() {
46   skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
47   skia_use_sfntly = skia_use_icu
48
49   if (is_android) {
50     skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
51   } else if (is_fuchsia) {
52     skia_use_vulkan = fuchsia_use_vulkan
53   } else {
54     skia_use_vulkan = skia_vulkan_sdk != ""
55   }
56 }
57 declare_args() {
58   if (skia_use_vulkan) {
59     if (is_fuchsia) {
60       skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
61     } else if (is_linux || is_win) {
62       skia_vulkan_headers = "$skia_vulkan_sdk/include"
63     } else {
64       # When buliding on Android we get the header via the NDK
65       skia_vulkan_headers = ""
66     }
67   } else {
68     skia_vulkan_headers = "third_party/vulkan"
69   }
70 }
71
72 # Our tools require static linking (they use non-exported symbols).
73 skia_enable_tools = skia_enable_tools && !is_component_build
74
75 fontmgr_android_enabled = skia_use_expat && skia_use_freetype
76
77 skia_public_includes = [
78   "include/android",
79   "include/c",
80   "include/codec",
81   "include/config",
82   "include/core",
83   "include/effects",
84   "include/encode",
85   "include/gpu",
86   "include/gpu/gl",
87   "include/pathops",
88   "include/ports",
89   "include/svg",
90   "include/utils",
91   "include/utils/mac",
92 ]
93
94 # Skia public API, generally provided by :skia.
95 config("skia_public") {
96   include_dirs = skia_public_includes
97   if (skia_vulkan_headers != "") {
98     include_dirs += [ skia_vulkan_headers ]
99   }
100   defines = []
101   if (is_component_build) {
102     defines += [ "SKIA_DLL" ]
103   }
104   if (is_fuchsia || is_linux) {
105     defines += [ "SK_SAMPLES_FOR_X" ]
106   }
107   if (skia_enable_android_framework_defines) {
108     defines += android_framework_defines
109   }
110   if (!skia_enable_gpu) {
111     defines += [ "SK_SUPPORT_GPU=0" ]
112   }
113 }
114
115 # Skia internal APIs, used by Skia itself and a few test tools.
116 config("skia_private") {
117   visibility = [ ":*" ]
118
119   include_dirs = [
120     "include/private",
121     "src/c",
122     "src/codec",
123     "src/core",
124     "src/effects",
125     "src/effects/gradients",
126     "src/fonts",
127     "src/image",
128     "src/images",
129     "src/lazy",
130     "src/opts",
131     "src/pathops",
132     "src/pdf",
133     "src/ports",
134     "src/sfnt",
135     "src/sksl",
136     "src/utils",
137     "src/utils/win",
138     "src/xml",
139     "third_party/gif",
140   ]
141
142   defines = [ "SK_GAMMA_APPLY_TO_A8" ]
143   if (is_android) {
144     defines += [
145       "SK_GAMMA_EXPONENT=1.4",
146       "SK_GAMMA_CONTRAST=0.0",
147     ]
148   }
149   if (is_official_build || is_android) {
150     # TODO(bsalomon): it'd be nice to make Android normal.
151     defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
152   }
153   libs = []
154   lib_dirs = []
155   if (skia_use_vulkan) {
156     if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
157       if (is_win) {
158         lib_dirs += [
159           "$skia_vulkan_sdk/Bin",
160           "$skia_vulkan_sdk/Lib",
161         ]
162       } else {
163         lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
164       }
165     }
166   }
167   if (skia_enable_gpu) {
168     include_dirs += [ "src/gpu" ]
169   }
170   if (skia_use_angle) {
171     defines += [ "SK_ANGLE" ]
172   }
173   if (skia_enable_discrete_gpu) {
174     defines += [ "SK_ENABLE_DISCRETE_GPU" ]
175   }
176 }
177
178 # Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
179 config("skia_library") {
180   visibility = [ ":*" ]
181   defines = [ "SKIA_IMPLEMENTATION=1" ]
182 }
183
184 skia_library_configs = [
185   ":skia_public",
186   ":skia_private",
187   ":skia_library",
188 ]
189
190 # Use for CPU-specific Skia code that needs particular compiler flags.
191 template("opts") {
192   if (invoker.enabled) {
193     source_set(target_name) {
194       forward_variables_from(invoker, "*")
195       configs += skia_library_configs
196     }
197   } else {
198     # If not enabled, a phony empty target that swallows all otherwise unused variables.
199     source_set(target_name) {
200       forward_variables_from(invoker,
201                              "*",
202                              [
203                                "sources",
204                                "cflags",
205                              ])
206     }
207   }
208 }
209
210 is_x86 = current_cpu == "x64" || current_cpu == "x86"
211
212 opts("none") {
213   enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
214   sources = skia_opts.none_sources
215   cflags = []
216 }
217
218 opts("armv7") {
219   enabled = current_cpu == "arm"
220   sources = skia_opts.armv7_sources
221   if (!is_win) {
222     sources += skia_opts.neon_sources
223   }
224   cflags = []
225 }
226
227 opts("arm64") {
228   enabled = current_cpu == "arm64"
229   sources = skia_opts.arm64_sources
230   cflags = []
231 }
232
233 opts("crc32") {
234   enabled = current_cpu == "arm64"
235   sources = skia_opts.crc32_sources
236   cflags = [ "-march=armv8-a+crc" ]
237 }
238
239 opts("sse2") {
240   enabled = is_x86
241   sources = skia_opts.sse2_sources
242   if (is_win) {
243     defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
244   } else {
245     cflags = [ "-msse2" ]
246   }
247 }
248
249 opts("ssse3") {
250   enabled = is_x86
251   sources = skia_opts.ssse3_sources
252   if (is_win) {
253     defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
254   } else {
255     cflags = [ "-mssse3" ]
256   }
257 }
258
259 opts("sse41") {
260   enabled = is_x86
261   sources = skia_opts.sse41_sources
262   if (is_win) {
263     defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
264   } else {
265     cflags = [ "-msse4.1" ]
266   }
267 }
268
269 opts("sse42") {
270   enabled = is_x86
271   sources = skia_opts.sse42_sources
272   if (is_win) {
273     defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
274   } else {
275     cflags = [ "-msse4.2" ]
276   }
277 }
278
279 opts("avx") {
280   enabled = is_x86
281   sources = skia_opts.avx_sources
282   if (is_win) {
283     cflags = [ "/arch:AVX" ]
284   } else {
285     cflags = [ "-mavx" ]
286   }
287 }
288
289 opts("hsw") {
290   enabled = is_x86
291   sources = skia_opts.hsw_sources
292   if (is_win) {
293     cflags = [ "/arch:AVX2" ]
294   } else {
295     cflags = [
296       "-mavx2",
297       "-mbmi",
298       "-mbmi2",
299       "-mf16c",
300       "-mfma",
301     ]
302   }
303 }
304
305 # Any feature of Skia that requires third-party code should be optional and use this template.
306 template("optional") {
307   if (invoker.enabled) {
308     config(target_name + "_public") {
309       if (defined(invoker.public_defines)) {
310         defines = invoker.public_defines
311       }
312     }
313     source_set(target_name) {
314       forward_variables_from(invoker,
315                              "*",
316                              [
317                                "public_defines",
318                                "sources_when_disabled",
319                                "configs_to_remove",
320                              ])
321       all_dependent_configs = [ ":" + target_name + "_public" ]
322       configs += skia_library_configs
323       if (defined(invoker.configs_to_remove)) {
324         configs -= invoker.configs_to_remove
325       }
326     }
327   } else {
328     source_set(target_name) {
329       forward_variables_from(invoker,
330                              "*",
331                              [
332                                "public_defines",
333                                "deps",
334                                "libs",
335                                "sources",
336                                "sources_when_disabled",
337                                "configs_to_remove",
338                              ])
339       if (defined(invoker.sources_when_disabled)) {
340         sources = invoker.sources_when_disabled
341       }
342       configs += skia_library_configs
343     }
344   }
345 }
346
347 optional("effects") {
348   enabled = skia_enable_effects
349   sources =
350       skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
351   sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
352 }
353
354 optional("fontmgr_android") {
355   enabled = fontmgr_android_enabled
356
357   deps = [
358     ":typeface_freetype",
359     "//third_party/expat",
360   ]
361   sources = [
362     "src/ports/SkFontMgr_android.cpp",
363     "src/ports/SkFontMgr_android_factory.cpp",
364     "src/ports/SkFontMgr_android_parser.cpp",
365   ]
366 }
367
368 optional("fontmgr_custom") {
369   enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
370
371   deps = [
372     ":typeface_freetype",
373   ]
374   sources = [
375     "src/ports/SkFontMgr_custom.cpp",
376     "src/ports/SkFontMgr_custom.h",
377     "src/ports/SkFontMgr_custom_directory.cpp",
378     "src/ports/SkFontMgr_custom_directory_factory.cpp",
379     "src/ports/SkFontMgr_custom_embedded.cpp",
380     "src/ports/SkFontMgr_custom_empty.cpp",
381   ]
382 }
383
384 optional("fontmgr_fontconfig") {
385   enabled = skia_use_freetype && skia_use_fontconfig
386
387   deps = [
388     ":typeface_freetype",
389     "//third_party:fontconfig",
390   ]
391   sources = [
392     "src/ports/SkFontConfigInterface.cpp",
393     "src/ports/SkFontConfigInterface_direct.cpp",
394     "src/ports/SkFontConfigInterface_direct_factory.cpp",
395     "src/ports/SkFontMgr_FontConfigInterface.cpp",
396     "src/ports/SkFontMgr_fontconfig.cpp",
397     "src/ports/SkFontMgr_fontconfig_factory.cpp",
398   ]
399 }
400
401 optional("fontmgr_fuchsia") {
402   enabled = is_fuchsia && skia_use_freetype
403
404   deps = [
405     ":typeface_freetype",
406   ]
407   sources = [
408     "src/ports/SkFontMgr_custom.cpp",
409     "src/ports/SkFontMgr_custom_empty.cpp",
410     "src/ports/SkFontMgr_custom_empty_factory.cpp",
411   ]
412 }
413
414 optional("gpu") {
415   enabled = skia_enable_gpu
416   public_defines = []
417
418   sources = skia_gpu_sources + skia_sksl_sources +
419             [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
420
421   # These paths need to be absolute to match the ones produced by shared_sources.gni.
422   sources -= get_path_info([
423                              "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
424                              "src/gpu/gl/GrGLDefaultInterface_none.cpp",
425                            ],
426                            "abspath")
427   libs = []
428   if (is_android) {
429     sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
430   } else if (skia_use_egl) {
431     sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
432     libs += [ "EGL" ]
433   } else if (is_linux) {
434     sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
435     libs += [
436       "GL",
437       "GLU",
438     ]
439   } else if (is_mac) {
440     sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
441   } else if (is_ios) {
442     sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
443   } else if (is_win && !is_winrt) {
444     sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
445     libs += [ "OpenGL32.lib" ]
446   } else {
447     sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
448   }
449
450   if (skia_use_vulkan) {
451     public_defines += [ "SK_VULKAN" ]
452     sources += skia_vk_sources
453     if (skia_enable_vulkan_debug_layers) {
454       public_defines += [ "SK_ENABLE_VK_LAYERS" ]
455     }
456   }
457   if (skia_enable_spirv_validation) {
458     deps = [
459       "//third_party/spirv-tools",
460     ]
461     public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
462   }
463 }
464
465 optional("jpeg") {
466   enabled = skia_use_libjpeg_turbo
467   public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
468
469   deps = [
470     "//third_party/libjpeg-turbo:libjpeg",
471   ]
472   sources = [
473     "src/codec/SkJpegCodec.cpp",
474     "src/codec/SkJpegDecoderMgr.cpp",
475     "src/codec/SkJpegUtility.cpp",
476     "src/images/SkJPEGWriteUtility.cpp",
477     "src/images/SkJpegEncoder.cpp",
478   ]
479 }
480
481 optional("pdf") {
482   enabled = skia_use_zlib && skia_enable_pdf
483   public_defines = [ "SK_SUPPORT_PDF" ]
484
485   deps = [
486     "//third_party/zlib",
487   ]
488   sources = skia_pdf_sources
489   sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
490
491   if (skia_use_sfntly) {
492     deps += [ "//third_party/sfntly" ]
493     public_defines += [ "SK_PDF_USE_SFNTLY" ]
494   }
495 }
496
497 optional("png") {
498   enabled = skia_use_libpng
499   public_defines = [ "SK_HAS_PNG_LIBRARY" ]
500
501   deps = [
502     "//third_party/libpng",
503   ]
504   sources = [
505     "src/codec/SkIcoCodec.cpp",
506     "src/codec/SkPngCodec.cpp",
507     "src/images/SkPngEncoder.cpp",
508   ]
509 }
510
511 optional("raw") {
512   enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
513   public_defines = [ "SK_CODEC_DECODES_RAW" ]
514
515   deps = [
516     "//third_party/dng_sdk",
517     "//third_party/libjpeg-turbo:libjpeg",
518     "//third_party/piex",
519   ]
520
521   # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
522   # Skia.
523   configs_to_remove = [ "//gn:no_exceptions" ]
524
525   sources = [
526     "src/codec/SkRawAdapterCodec.cpp",
527     "src/codec/SkRawCodec.cpp",
528   ]
529 }
530
531 optional("typeface_freetype") {
532   enabled = skia_use_freetype
533
534   deps = [
535     "//third_party/freetype2",
536   ]
537   sources = [
538     "src/ports/SkFontHost_FreeType.cpp",
539     "src/ports/SkFontHost_FreeType_common.cpp",
540   ]
541 }
542
543 optional("webp") {
544   enabled = skia_use_libwebp
545   public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
546
547   deps = [
548     "//third_party/libwebp",
549   ]
550   sources = [
551     "src/codec/SkWebpAdapterCodec.cpp",
552     "src/codec/SkWebpCodec.cpp",
553     "src/images/SkWebpEncoder.cpp",
554   ]
555 }
556
557 optional("xml") {
558   enabled = skia_use_expat
559   public_defines = [ "SK_XML" ]
560
561   deps = [
562     "//third_party/expat",
563   ]
564   sources = [
565     "src/svg/SkSVGCanvas.cpp",
566     "src/svg/SkSVGDevice.cpp",
567     "src/xml/SkDOM.cpp",
568     "src/xml/SkXMLParser.cpp",
569     "src/xml/SkXMLWriter.cpp",
570   ]
571 }
572
573 component("skia") {
574   public_configs = [ ":skia_public" ]
575   configs += skia_library_configs
576
577   deps = [
578     ":arm64",
579     ":armv7",
580     ":avx",
581     ":crc32",
582     ":effects",
583     ":fontmgr_android",
584     ":fontmgr_custom",
585     ":fontmgr_fontconfig",
586     ":fontmgr_fuchsia",
587     ":gpu",
588     ":hsw",
589     ":jpeg",
590     ":none",
591     ":pdf",
592     ":png",
593     ":raw",
594     ":sse2",
595     ":sse41",
596     ":sse42",
597     ":ssse3",
598     ":webp",
599     ":xml",
600   ]
601
602   # This file (and all GN files in Skia) are designed to work with an
603   # empty sources assignment filter; we handle all that explicitly.
604   # We clear the filter here for clients who may have set up a global filter.
605   set_sources_assignment_filter([])
606
607   sources = []
608   sources += skia_core_sources
609   sources += skia_utils_sources
610   sources += skia_xps_sources
611   sources += [
612     "src/android/SkBitmapRegionCodec.cpp",
613     "src/android/SkBitmapRegionDecoder.cpp",
614     "src/codec/SkAndroidCodec.cpp",
615     "src/codec/SkBmpCodec.cpp",
616     "src/codec/SkBmpMaskCodec.cpp",
617     "src/codec/SkBmpRLECodec.cpp",
618     "src/codec/SkBmpStandardCodec.cpp",
619     "src/codec/SkCodec.cpp",
620     "src/codec/SkCodecImageGenerator.cpp",
621     "src/codec/SkGifCodec.cpp",
622     "src/codec/SkMaskSwizzler.cpp",
623     "src/codec/SkMasks.cpp",
624     "src/codec/SkSampledCodec.cpp",
625     "src/codec/SkSampler.cpp",
626     "src/codec/SkStreamBuffer.cpp",
627     "src/codec/SkSwizzler.cpp",
628     "src/codec/SkWbmpCodec.cpp",
629     "src/images/SkImageEncoder.cpp",
630     "src/ports/SkDiscardableMemory_none.cpp",
631     "src/ports/SkImageGenerator_skia.cpp",
632     "src/ports/SkMemory_malloc.cpp",
633     "src/ports/SkOSFile_stdio.cpp",
634     "src/sfnt/SkOTTable_name.cpp",
635     "src/sfnt/SkOTUtils.cpp",
636     "src/utils/mac/SkStream_mac.cpp",
637     "third_party/gif/SkGifImageReader.cpp",
638   ]
639
640   libs = []
641
642   if (is_win) {
643     sources += [
644       "src/fonts/SkFontMgr_indirect.cpp",
645       "src/ports/SkDebug_win.cpp",
646       "src/ports/SkFontMgr_win_dw.cpp",
647       "src/ports/SkImageEncoder_WIC.cpp",
648       "src/ports/SkImageGeneratorWIC.cpp",
649       "src/ports/SkOSFile_win.cpp",
650       "src/ports/SkOSLibrary_win.cpp",
651       "src/ports/SkScalerContext_win_dw.cpp",
652       "src/ports/SkTLS_win.cpp",
653       "src/ports/SkTypeface_win_dw.cpp",
654     ]
655     if (!is_winrt) {
656       sources += [ "src/ports/SkFontHost_win.cpp" ]
657     }
658     if (skia_use_gdi) {
659       sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
660       libs += [
661         "Gdi32.lib",
662         "Usp10.lib",
663       ]
664     } else {
665       sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
666     }
667     sources -=
668         [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
669     libs += [
670       "FontSub.lib",
671       "Ole32.lib",
672       "OleAut32.lib",
673       "User32.lib",
674     ]
675   } else {
676     sources += [
677       "src/ports/SkOSFile_posix.cpp",
678       "src/ports/SkOSLibrary_posix.cpp",
679       "src/ports/SkTLS_pthread.cpp",
680     ]
681   }
682
683   if (is_winrt) {
684     sources -= [
685       get_path_info("src/utils/win/SkWGL.h", "abspath"),
686       get_path_info("src/utils/win/SkWGL_win.cpp", "abspath"),
687     ]
688   }
689
690   if (is_android) {
691     deps += [ "//third_party/expat" ]
692     if (defined(ndk) && ndk != "") {
693       deps += [ "//third_party/cpu-features" ]
694     }
695     sources += [ "src/ports/SkDebug_android.cpp" ]
696     libs += [
697       "EGL",
698       "GLESv2",
699       "log",
700     ]
701   }
702
703   if (is_linux) {
704     sources += [ "src/ports/SkDebug_stdio.cpp" ]
705   }
706
707   if (is_mac) {
708     sources += [
709       "src/ports/SkDebug_stdio.cpp",
710       "src/ports/SkFontHost_mac.cpp",
711       "src/ports/SkImageEncoder_CG.cpp",
712       "src/ports/SkImageGeneratorCG.cpp",
713     ]
714     libs += [
715       # AppKit symbols NSFontWeightXXX may be dlsym'ed.
716       "AppKit.framework",
717       "ApplicationServices.framework",
718       "OpenGL.framework",
719     ]
720   }
721
722   if (is_ios) {
723     sources += [
724       "src/ports/SkDebug_stdio.cpp",
725       "src/ports/SkFontHost_mac.cpp",
726       "src/ports/SkImageEncoder_CG.cpp",
727       "src/ports/SkImageGeneratorCG.cpp",
728     ]
729     libs += [
730       "CoreFoundation.framework",
731       "CoreGraphics.framework",
732       "CoreText.framework",
733       "ImageIO.framework",
734       "MobileCoreServices.framework",
735
736       # UIKit symbols UIFontWeightXXX may be dlsym'ed.
737       "UIKit.framework",
738     ]
739   }
740
741   if (is_fuchsia) {
742     sources += [ "src/ports/SkDebug_stdio.cpp" ]
743   }
744 }
745
746 # Targets guarded by skia_enable_tools may use //third_party freely.
747 if (skia_enable_tools) {
748   # Used by gn_to_bp.py to list our public include dirs.
749   source_set("public") {
750     configs += [ ":skia_public" ]
751   }
752
753   config("skia.h_config") {
754     include_dirs = [ "$target_gen_dir" ]
755   }
756   action("skia.h") {
757     public_configs = [ ":skia.h_config" ]
758     skia_h = "$target_gen_dir/skia.h"
759     script = "gn/find_headers.py"
760     args = [ rebase_path(skia_h, root_build_dir) ] +
761            rebase_path(skia_public_includes) +
762            [ rebase_path("third_party/vulkan") ]
763     depfile = "$skia_h.deps"
764     outputs = [
765       skia_h,
766     ]
767   }
768
769   if (skia_enable_gpu && target_cpu == "x64") {
770     # Our bots only have 64-bit libOSMesa installed.
771     # TODO: worth fixing?
772     executable("fiddle") {
773       libs = []
774       if (is_linux) {
775         libs += [ "OSMesa" ]
776       }
777
778       sources = [
779         "tools/fiddle/draw.cpp",
780         "tools/fiddle/fiddle_main.cpp",
781       ]
782       testonly = true
783       deps = [
784         ":flags",
785         ":skia",
786         ":skia.h",
787       ]
788     }
789   }
790
791   if (skia_enable_gpu) {
792     source_set("public_headers_warnings_check") {
793       sources = [
794         "tools/public_headers_warnings_check.cpp",
795       ]
796       configs -= [ "//gn:warnings_except_public_headers" ]
797       deps = [
798         ":skia",
799         ":skia.h",
800       ]
801     }
802   }
803
804   template("test_lib") {
805     config(target_name + "_config") {
806       include_dirs = invoker.public_include_dirs
807       if (defined(invoker.public_defines)) {
808         defines = invoker.public_defines
809       }
810     }
811     source_set(target_name) {
812       forward_variables_from(invoker, "*", [ "public_include_dirs" ])
813       public_configs = [
814         ":" + target_name + "_config",
815         ":skia_private",
816       ]
817
818       if (!defined(deps)) {
819         deps = []
820       }
821       deps += [ ":skia" ]
822       testonly = true
823     }
824   }
825
826   template("test_app") {
827     if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
828       shared_library("lib" + target_name) {
829         forward_variables_from(invoker, "*", [ "is_shared_library" ])
830         testonly = true
831       }
832     } else {
833       _executable = target_name
834       executable(_executable) {
835         forward_variables_from(invoker, "*", [ "is_shared_library" ])
836         testonly = true
837       }
838     }
839     if (is_android && skia_android_serial != "" && defined(_executable)) {
840       action("push_" + target_name) {
841         script = "gn/push_to_android.py"
842         deps = [
843           ":" + _executable,
844         ]
845         _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
846         outputs = [
847           _stamp,
848         ]
849         args = [
850           rebase_path("$root_build_dir/$_executable"),
851           skia_android_serial,
852           rebase_path(_stamp),
853         ]
854         testonly = true
855       }
856     }
857   }
858
859   test_lib("gpu_tool_utils") {
860     public_include_dirs = []
861     if (skia_enable_gpu) {
862       public_defines = []
863       public_include_dirs += [ "tools/gpu" ]
864
865       deps = []
866       sources = [
867         "tools/gpu/GrContextFactory.cpp",
868         "tools/gpu/GrTest.cpp",
869         "tools/gpu/TestContext.cpp",
870         "tools/gpu/gl/GLTestContext.cpp",
871         "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
872         "tools/gpu/gl/debug/DebugGLTestContext.cpp",
873         "tools/gpu/gl/debug/GrBufferObj.cpp",
874         "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
875         "tools/gpu/gl/debug/GrProgramObj.cpp",
876         "tools/gpu/gl/debug/GrShaderObj.cpp",
877         "tools/gpu/gl/debug/GrTextureObj.cpp",
878         "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
879         "tools/gpu/gl/null/NullGLTestContext.cpp",
880       ]
881       libs = []
882
883       if (is_android || skia_use_egl) {
884         sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
885       } else if (is_ios) {
886         sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
887         libs += [ "OpenGLES.framework" ]
888       } else if (is_linux) {
889         sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
890         libs += [ "X11" ]
891       } else if (is_mac) {
892         sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
893       } else if (is_win) {
894         sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
895         libs += [
896           "Gdi32.lib",
897           "OpenGL32.lib",
898         ]
899       }
900
901       if (skia_use_angle) {
902         deps += [ "//third_party/angle2" ]
903         sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
904       }
905       if (skia_use_mesa) {
906         public_defines += [ "SK_MESA" ]
907         sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
908         libs += [ "OSMesa" ]
909       }
910       if (skia_use_vulkan) {
911         sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
912         if (is_win) {
913           libs += [ "vulkan-1.lib" ]
914         } else {
915           libs += [ "vulkan" ]
916         }
917       }
918     }
919   }
920
921   test_lib("flags") {
922     public_include_dirs = [ "tools/flags" ]
923     sources = [
924       "tools/flags/SkCommandLineFlags.cpp",
925     ]
926   }
927   test_lib("common_flags") {
928     public_include_dirs = [ "tools/flags" ]
929     sources = [
930       "tools/flags/SkCommonFlags.cpp",
931       "tools/flags/SkCommonFlagsConfig.cpp",
932     ]
933     deps = [
934       ":flags",
935       ":gpu_tool_utils",
936     ]
937   }
938
939   test_lib("tool_utils") {
940     public_include_dirs = [
941       "tools",
942       "tools/debugger",
943       "tools/timer",
944     ]
945     sources = [
946       "tools/AndroidSkDebugToStdOut.cpp",
947       "tools/CrashHandler.cpp",
948       "tools/LsanSuppressions.cpp",
949       "tools/ProcStats.cpp",
950       "tools/Resources.cpp",
951       "tools/ThermalManager.cpp",
952       "tools/UrlDataManager.cpp",
953       "tools/debugger/SkDebugCanvas.cpp",
954       "tools/debugger/SkDrawCommand.cpp",
955       "tools/debugger/SkJsonWriteBuffer.cpp",
956       "tools/debugger/SkObjectParser.cpp",
957       "tools/picture_utils.cpp",
958       "tools/random_parse_path.cpp",
959       "tools/sk_tool_utils.cpp",
960       "tools/sk_tool_utils_font.cpp",
961       "tools/timer/Timer.cpp",
962     ]
963     libs = []
964     if (is_ios) {
965       sources += [ "tools/ios_utils.m" ]
966       libs += [ "Foundation.framework" ]
967     }
968     deps = [
969       ":common_flags",
970       ":flags",
971       "//third_party/libpng",
972     ]
973     public_deps = [
974       "//third_party/jsoncpp",
975     ]
976   }
977
978   import("gn/gm.gni")
979   test_lib("gm") {
980     public_include_dirs = [ "gm" ]
981     sources = gm_sources
982     deps = [
983       ":flags",
984       ":gpu_tool_utils",
985       ":skia",
986       ":tool_utils",
987     ]
988   }
989
990   import("gn/tests.gni")
991   test_lib("tests") {
992     public_include_dirs = [ "tests" ]
993     sources = tests_sources + pathops_tests_sources
994     if (!fontmgr_android_enabled) {
995       sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
996     }
997     deps = [
998       ":experimental_svg_model",
999       ":flags",
1000       ":skia",
1001       ":tool_utils",
1002       "//third_party/libpng",
1003       "//third_party/zlib",
1004     ]
1005     public_deps = [
1006       ":gpu_tool_utils",  # Test.h #includes headers from this target.
1007     ]
1008   }
1009
1010   import("gn/bench.gni")
1011   test_lib("bench") {
1012     public_include_dirs = [ "bench" ]
1013     sources = bench_sources
1014     deps = [
1015       ":flags",
1016       ":gm",
1017       ":gpu_tool_utils",
1018       ":skia",
1019       ":tool_utils",
1020     ]
1021   }
1022
1023   test_lib("experimental_svg_model") {
1024     public_include_dirs = [ "experimental/svg/model" ]
1025     sources = [
1026       "experimental/svg/model/SkSVGAttribute.cpp",
1027       "experimental/svg/model/SkSVGAttributeParser.cpp",
1028       "experimental/svg/model/SkSVGCircle.cpp",
1029       "experimental/svg/model/SkSVGClipPath.cpp",
1030       "experimental/svg/model/SkSVGContainer.cpp",
1031       "experimental/svg/model/SkSVGDOM.cpp",
1032       "experimental/svg/model/SkSVGEllipse.cpp",
1033       "experimental/svg/model/SkSVGLine.cpp",
1034       "experimental/svg/model/SkSVGLinearGradient.cpp",
1035       "experimental/svg/model/SkSVGNode.cpp",
1036       "experimental/svg/model/SkSVGPath.cpp",
1037       "experimental/svg/model/SkSVGPoly.cpp",
1038       "experimental/svg/model/SkSVGRect.cpp",
1039       "experimental/svg/model/SkSVGRenderContext.cpp",
1040       "experimental/svg/model/SkSVGSVG.cpp",
1041       "experimental/svg/model/SkSVGShape.cpp",
1042       "experimental/svg/model/SkSVGStop.cpp",
1043       "experimental/svg/model/SkSVGTransformableNode.cpp",
1044       "experimental/svg/model/SkSVGValue.cpp",
1045     ]
1046     deps = [
1047       ":skia",
1048     ]
1049   }
1050
1051   test_lib("views") {
1052     public_include_dirs = [ "include/views" ]
1053     sources = [
1054       "src/views/SkEvent.cpp",
1055       "src/views/SkEventSink.cpp",
1056       "src/views/SkOSMenu.cpp",
1057       "src/views/SkTagList.cpp",
1058       "src/views/SkTouchGesture.cpp",
1059       "src/views/SkView.cpp",
1060       "src/views/SkViewPriv.cpp",
1061     ]
1062     libs = []
1063     deps = []
1064     if (!is_android) {
1065       sources += [ "src/views/SkWindow.cpp" ]
1066     }
1067     if (is_linux) {
1068       public_include_dirs += [ "src/views/unix" ]
1069       sources += [
1070         "src/views/unix/SkOSWindow_Unix.cpp",
1071         "src/views/unix/keysym2ucs.c",
1072       ]
1073       libs += [
1074         "GL",
1075         "X11",
1076       ]
1077     } else if (is_mac) {
1078       sources += [
1079         "src/views/mac/SkEventNotifier.mm",
1080         "src/views/mac/SkNSView.mm",
1081         "src/views/mac/SkOSWindow_Mac.mm",
1082         "src/views/mac/SkTextFieldCell.m",
1083       ]
1084       libs += [
1085         "QuartzCore.framework",
1086         "Cocoa.framework",
1087         "Foundation.framework",
1088       ]
1089     } else if (is_win) {
1090       sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1091     }
1092     if (skia_use_angle) {
1093       deps += [ "//third_party/angle2" ]
1094     }
1095   }
1096
1097   if (skia_use_lua) {
1098     test_lib("lua") {
1099       public_include_dirs = []
1100       sources = [
1101         "src/utils/SkLua.cpp",
1102         "src/utils/SkLuaCanvas.cpp",
1103       ]
1104       deps = [
1105         "//third_party/lua",
1106       ]
1107     }
1108
1109     test_app("lua_app") {
1110       sources = [
1111         "tools/lua/lua_app.cpp",
1112       ]
1113       deps = [
1114         ":lua",
1115         ":skia",
1116         "//third_party/lua",
1117       ]
1118     }
1119
1120     test_app("lua_pictures") {
1121       sources = [
1122         "tools/lua/lua_pictures.cpp",
1123       ]
1124       deps = [
1125         ":flags",
1126         ":lua",
1127         ":skia",
1128         ":tool_utils",
1129         "//third_party/lua",
1130       ]
1131     }
1132   }
1133
1134   import("gn/samples.gni")
1135   test_lib("samples") {
1136     public_include_dirs = [ "samplecode" ]
1137     include_dirs = [ "experimental" ]
1138     sources = samples_sources + [
1139                 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1140                 "experimental/SkSetPoly3To3.cpp",
1141                 "experimental/SkSetPoly3To3_A.cpp",
1142                 "experimental/SkSetPoly3To3_D.cpp",
1143               ]
1144     deps = [
1145       ":experimental_svg_model",
1146       ":flags",
1147       ":gm",
1148       ":tool_utils",
1149       ":views",
1150       ":xml",
1151     ]
1152
1153     if (skia_use_lua) {
1154       sources += [ "samplecode/SampleLua.cpp" ]
1155       deps += [
1156         ":lua",
1157         "//third_party/lua",
1158       ]
1159     }
1160   }
1161
1162   test_app("dm") {
1163     sources = [
1164       "dm/DM.cpp",
1165       "dm/DMJsonWriter.cpp",
1166       "dm/DMSrcSink.cpp",
1167     ]
1168     include_dirs = [ "tests" ]
1169     deps = [
1170       ":common_flags",
1171       ":experimental_svg_model",
1172       ":flags",
1173       ":gm",
1174       ":gpu_tool_utils",
1175       ":skia",
1176       ":tests",
1177       ":tool_utils",
1178       "//third_party/jsoncpp",
1179       "//third_party/libpng",
1180     ]
1181   }
1182
1183   test_app("ok") {
1184     sources = [
1185       "tools/ok.cpp",
1186       "tools/ok_dsts.cpp",
1187       "tools/ok_srcs.cpp",
1188       "tools/ok_test.cpp",
1189       "tools/ok_vias.cpp",
1190     ]
1191     deps = [
1192       ":gm",
1193       ":skia",
1194       ":tests",
1195       ":tool_utils",
1196     ]
1197   }
1198
1199   if (!is_debug) {  # I've benchmarked debug code once too many times...
1200     test_app("monobench") {
1201       sources = [
1202         "tools/monobench.cpp",
1203       ]
1204       deps = [
1205         ":bench",
1206         ":skia",
1207       ]
1208     }
1209   }
1210
1211   test_app("nanobench") {
1212     sources = [
1213       "bench/nanobench.cpp",
1214     ]
1215     deps = [
1216       ":bench",
1217       ":common_flags",
1218       ":experimental_svg_model",
1219       ":flags",
1220       ":gm",
1221       ":gpu_tool_utils",
1222       ":skia",
1223       ":tool_utils",
1224       "//third_party/jsoncpp",
1225     ]
1226   }
1227
1228   test_app("skpinfo") {
1229     sources = [
1230       "tools/skpinfo.cpp",
1231     ]
1232     deps = [
1233       ":flags",
1234       ":skia",
1235     ]
1236   }
1237
1238   if (is_linux || is_win || is_mac) {
1239     test_app("SampleApp") {
1240       sources = [
1241         "samplecode/SampleApp.cpp",
1242         "samplecode/SamplePictFile.cpp",
1243       ]
1244       if (is_mac) {
1245         sources += [ "src/views/mac/skia_mac.mm" ]
1246       } else if (is_win) {
1247         sources += [ "src/views/win/skia_win.cpp" ]
1248       } else if (is_linux) {
1249         sources += [ "src/views/unix/skia_unix.cpp" ]
1250       }
1251       deps = [
1252         ":flags",
1253         ":gm",
1254         ":gpu_tool_utils",
1255         ":samples",
1256         ":skia",
1257         ":tool_utils",
1258         ":views",
1259       ]
1260       if (skia_use_angle) {
1261         deps += [ "//third_party/angle2" ]
1262       }
1263     }
1264   }
1265
1266   if (skia_enable_gpu) {
1267     test_app("skpbench") {
1268       sources = [
1269         "tools/skpbench/skpbench.cpp",
1270       ]
1271       deps = [
1272         ":flags",
1273         ":gpu_tool_utils",
1274         ":skia",
1275         ":tool_utils",
1276       ]
1277     }
1278   }
1279
1280   # We can't yet build ICU on iOS or Windows.
1281   if (!is_ios && !is_win) {
1282     test_app("sktexttopdf-hb") {
1283       sources = [
1284         "tools/SkShaper_harfbuzz.cpp",
1285         "tools/using_skia_and_harfbuzz.cpp",
1286       ]
1287       deps = [
1288         ":skia",
1289         "//third_party/harfbuzz",
1290       ]
1291     }
1292   }
1293   test_app("sktexttopdf") {
1294     sources = [
1295       "tools/SkShaper_primitive.cpp",
1296       "tools/using_skia_and_harfbuzz.cpp",
1297     ]
1298     deps = [
1299       ":skia",
1300     ]
1301   }
1302
1303   test_app("create_flutter_test_images") {
1304     sources = [
1305       "tools/create_flutter_test_images.cpp",
1306     ]
1307     deps = [
1308       ":skia",
1309       ":tool_utils",
1310     ]
1311   }
1312
1313   test_app("get_images_from_skps") {
1314     sources = [
1315       "tools/get_images_from_skps.cpp",
1316     ]
1317     deps = [
1318       ":flags",
1319       ":skia",
1320       "//third_party/jsoncpp",
1321     ]
1322   }
1323
1324   test_app("colorspaceinfo") {
1325     sources = [
1326       "tools/colorspaceinfo.cpp",
1327     ]
1328     deps = [
1329       ":flags",
1330       ":skia",
1331       ":tool_utils",
1332     ]
1333   }
1334
1335   if (!is_ios) {
1336     test_app("skiaserve") {
1337       sources = [
1338         "tools/skiaserve/Request.cpp",
1339         "tools/skiaserve/Response.cpp",
1340         "tools/skiaserve/skiaserve.cpp",
1341         "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1342         "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1343         "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1344         "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1345         "tools/skiaserve/urlhandlers/DataHandler.cpp",
1346         "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1347         "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1348         "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1349         "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1350         "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1351         "tools/skiaserve/urlhandlers/OpsHandler.cpp",
1352         "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1353         "tools/skiaserve/urlhandlers/PostHandler.cpp",
1354         "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1355         "tools/skiaserve/urlhandlers/RootHandler.cpp",
1356       ]
1357       deps = [
1358         ":flags",
1359         ":gpu_tool_utils",
1360         ":skia",
1361         ":tool_utils",
1362         "//third_party/jsoncpp",
1363         "//third_party/libmicrohttpd",
1364         "//third_party/libpng",
1365       ]
1366     }
1367   }
1368
1369   test_app("fuzz") {
1370     sources = [
1371       "fuzz/FilterFuzz.cpp",
1372       "fuzz/FuzzCanvas.cpp",
1373       "fuzz/FuzzDrawFunctions.cpp",
1374       "fuzz/FuzzGradients.cpp",
1375       "fuzz/FuzzParsePath.cpp",
1376       "fuzz/FuzzPathop.cpp",
1377       "fuzz/FuzzScaleToSides.cpp",
1378       "fuzz/fuzz.cpp",
1379     ]
1380     deps = [
1381       ":flags",
1382       ":gpu_tool_utils",
1383       ":skia",
1384       ":tool_utils",
1385     ]
1386   }
1387
1388   test_app("pathops_unittest") {
1389     sources = pathops_tests_sources + [
1390                 rebase_path("tests/skia_test.cpp"),
1391                 rebase_path("tests/Test.cpp"),
1392               ]
1393     deps = [
1394       ":flags",
1395       ":gpu_tool_utils",
1396       ":skia",
1397       ":tool_utils",
1398     ]
1399   }
1400
1401   test_app("dump_record") {
1402     sources = [
1403       "tools/DumpRecord.cpp",
1404       "tools/dump_record.cpp",
1405     ]
1406     deps = [
1407       ":flags",
1408       ":skia",
1409     ]
1410   }
1411
1412   test_app("skdiff") {
1413     sources = [
1414       "tools/skdiff/skdiff.cpp",
1415       "tools/skdiff/skdiff_html.cpp",
1416       "tools/skdiff/skdiff_main.cpp",
1417       "tools/skdiff/skdiff_utils.cpp",
1418     ]
1419     deps = [
1420       ":skia",
1421       ":tool_utils",
1422     ]
1423   }
1424
1425   test_app("skp_parser") {
1426     sources = [
1427       "tools/skp_parser.cpp",
1428     ]
1429     deps = [
1430       ":skia",
1431       ":tool_utils",
1432       "//third_party/jsoncpp",
1433     ]
1434   }
1435
1436   if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
1437     test_app("viewer") {
1438       is_shared_library = is_android
1439       sources = [
1440         "tools/viewer/GMSlide.cpp",
1441         "tools/viewer/ImageSlide.cpp",
1442         "tools/viewer/SKPSlide.cpp",
1443         "tools/viewer/SampleSlide.cpp",
1444         "tools/viewer/Viewer.cpp",
1445         "tools/viewer/sk_app/CommandSet.cpp",
1446         "tools/viewer/sk_app/GLWindowContext.cpp",
1447         "tools/viewer/sk_app/Window.cpp",
1448       ]
1449       libs = []
1450
1451       if (is_android) {
1452         sources += [
1453           "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1454           "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1455           "tools/viewer/sk_app/android/Window_android.cpp",
1456           "tools/viewer/sk_app/android/main_android.cpp",
1457           "tools/viewer/sk_app/android/surface_glue_android.cpp",
1458         ]
1459         libs += [ "android" ]
1460       } else if (is_linux) {
1461         sources += [
1462           "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1463           "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1464           "tools/viewer/sk_app/unix/Window_unix.cpp",
1465           "tools/viewer/sk_app/unix/main_unix.cpp",
1466         ]
1467       } else if (is_win) {
1468         sources += [
1469           "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1470           "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1471           "tools/viewer/sk_app/win/Window_win.cpp",
1472           "tools/viewer/sk_app/win/main_win.cpp",
1473         ]
1474       } else if (is_mac) {
1475         sources += [
1476           "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1477           "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1478           "tools/viewer/sk_app/mac/Window_mac.cpp",
1479           "tools/viewer/sk_app/mac/main_mac.cpp",
1480         ]
1481       }
1482
1483       if (skia_use_vulkan) {
1484         sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
1485         if (is_android) {
1486           sources +=
1487               [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1488         } else if (is_linux) {
1489           sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1490           libs += [ "X11-xcb" ]
1491         } else if (is_win) {
1492           sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1493         }
1494       }
1495
1496       include_dirs = []
1497       deps = [
1498         ":flags",
1499         ":gm",
1500         ":gpu_tool_utils",
1501         ":samples",
1502         ":skia",
1503         ":tool_utils",
1504         ":views",
1505         "//third_party/imgui",
1506         "//third_party/jsoncpp",
1507       ]
1508       if (is_android) {
1509         deps += [ "//third_party/native_app_glue" ]
1510       } else if (is_mac) {
1511         deps += [ "//third_party/libsdl" ]
1512       }
1513     }
1514   }
1515
1516   if (is_android && defined(ndk) && ndk != "") {
1517     copy("gdbserver") {
1518       sources = [
1519         "$ndk/$ndk_gdbserver",
1520       ]
1521       outputs = [
1522         "$root_out_dir/gdbserver",
1523       ]
1524     }
1525   }
1526
1527   if (skia_enable_gpu) {
1528     test_app("skslc") {
1529       defines = [ "SKSL_STANDALONE" ]
1530       sources = [
1531         "src/sksl/SkSLMain.cpp",
1532       ]
1533       sources += skia_sksl_sources
1534       include_dirs = [ "src/sksl" ]
1535     }
1536   }
1537 }