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