1 # Copyright 2016 Google Inc.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 import("gn/android_framework_defines.gni")
7 import("gn/shared_sources.gni")
9 if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
14 skia_use_angle = false
16 skia_use_fontconfig = is_linux
17 skia_use_freetype = is_android || is_fuchsia || is_linux
19 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
20 skia_use_libjpeg_turbo = true
21 skia_use_libpng = true
22 skia_use_libwebp = !is_fuchsia
25 skia_use_piex = !is_win
28 skia_android_serial = ""
29 skia_enable_android_framework_defines = false
30 skia_enable_discrete_gpu = true
31 skia_enable_gpu = true
32 skia_enable_pdf = true
33 skia_enable_splicer = is_skia_standalone && sanitize != "MSAN" && !is_ios
34 skia_enable_tools = is_skia_standalone
35 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
36 skia_vulkan_sdk = getenv("VULKAN_SDK")
40 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
41 skia_use_sfntly = skia_use_icu
44 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
46 skia_use_vulkan = skia_vulkan_sdk != ""
50 # Our tools require static linking (they use non-exported symbols).
51 skia_enable_tools = skia_enable_tools && !is_component_build
53 fontmgr_android_enabled = skia_use_expat && skia_use_freetype
55 skia_public_includes = [
72 # Skia public API, generally provided by :skia.
73 config("skia_public") {
74 include_dirs = skia_public_includes
76 if (is_component_build) {
77 defines += [ "SKIA_DLL" ]
79 if (is_fuchsia || is_linux) {
80 defines += [ "SK_SAMPLES_FOR_X" ]
82 if (skia_enable_android_framework_defines) {
83 defines += android_framework_defines
85 if (!skia_enable_gpu) {
86 defines += [ "SK_SUPPORT_GPU=0" ]
90 # Skia internal APIs, used by Skia itself and a few test tools.
91 config("skia_private") {
100 "src/effects/gradients",
120 "SK_GAMMA_APPLY_TO_A8",
125 "SK_GAMMA_EXPONENT=1.4",
126 "SK_GAMMA_CONTRAST=0.0",
129 if (is_official_build || is_android) {
130 # TODO(bsalomon): it'd be nice to make Android normal.
131 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
135 if (skia_use_vulkan) {
136 if (skia_vulkan_sdk != "" && !is_android) {
138 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
139 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
141 include_dirs += [ "$skia_vulkan_sdk/include/" ]
142 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
146 libs += [ "vulkan-1.lib" ]
151 if (skia_use_angle) {
152 defines += [ "SK_ANGLE" ]
154 if (skia_enable_discrete_gpu) {
155 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
159 # Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
160 config("skia_library") {
161 visibility = [ ":*" ]
162 defines = [ "SKIA_IMPLEMENTATION=1" ]
165 skia_library_configs = [
171 # Use for CPU-specific Skia code that needs particular compiler flags.
173 if (invoker.enabled) {
174 source_set(target_name) {
175 forward_variables_from(invoker, "*")
176 configs += skia_library_configs
179 # If not enabled, a phony empty target that swallows all otherwise unused variables.
180 source_set(target_name) {
181 forward_variables_from(invoker,
191 is_x86 = current_cpu == "x64" || current_cpu == "x86"
194 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
195 sources = skia_opts.none_sources
200 enabled = current_cpu == "arm"
201 sources = skia_opts.armv7_sources
203 sources += skia_opts.neon_sources
209 enabled = current_cpu == "arm64"
210 sources = skia_opts.arm64_sources
215 enabled = current_cpu == "arm64"
216 sources = skia_opts.crc32_sources
217 cflags = [ "-march=armv8-a+crc" ]
222 sources = skia_opts.sse2_sources
224 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
226 cflags = [ "-msse2" ]
232 sources = skia_opts.ssse3_sources
234 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
236 cflags = [ "-mssse3" ]
242 sources = skia_opts.sse41_sources
244 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
246 cflags = [ "-msse4.1" ]
252 sources = skia_opts.sse42_sources
254 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
256 cflags = [ "-msse4.2" ]
262 sources = skia_opts.avx_sources
264 cflags = [ "/arch:AVX" ]
272 sources = skia_opts.hsw_sources
274 cflags = [ "/arch:AVX2" ]
286 # Any feature of Skia that requires third-party code should be optional and use this template.
287 template("optional") {
288 if (invoker.enabled) {
289 config(target_name + "_public") {
290 if (defined(invoker.public_defines)) {
291 defines = invoker.public_defines
294 source_set(target_name) {
295 forward_variables_from(invoker,
299 "sources_when_disabled",
302 all_dependent_configs = [ ":" + target_name + "_public" ]
303 configs += skia_library_configs
304 if (defined(invoker.configs_to_remove)) {
305 configs -= invoker.configs_to_remove
309 source_set(target_name) {
310 forward_variables_from(invoker,
317 "sources_when_disabled",
320 if (defined(invoker.sources_when_disabled)) {
321 sources = invoker.sources_when_disabled
323 configs += skia_library_configs
328 optional("fontmgr_android") {
329 enabled = fontmgr_android_enabled
332 "//third_party/expat",
333 "//third_party/freetype2",
336 "src/ports/SkFontMgr_android.cpp",
337 "src/ports/SkFontMgr_android_factory.cpp",
338 "src/ports/SkFontMgr_android_parser.cpp",
342 optional("fontmgr_custom") {
343 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
346 "//third_party/freetype2",
349 "src/ports/SkFontMgr_custom.cpp",
350 "src/ports/SkFontMgr_custom_directory_factory.cpp",
354 optional("fontmgr_fontconfig") {
355 enabled = skia_use_freetype && skia_use_fontconfig
358 "//third_party:fontconfig",
359 "//third_party/freetype2",
362 "src/ports/SkFontConfigInterface.cpp",
363 "src/ports/SkFontConfigInterface_direct.cpp",
364 "src/ports/SkFontConfigInterface_direct_factory.cpp",
365 "src/ports/SkFontMgr_FontConfigInterface.cpp",
366 "src/ports/SkFontMgr_fontconfig.cpp",
367 "src/ports/SkFontMgr_fontconfig_factory.cpp",
371 optional("fontmgr_fuchsia") {
372 enabled = is_fuchsia && skia_use_freetype
375 "//third_party/freetype2",
378 "src/ports/SkFontMgr_custom.cpp",
379 "src/ports/SkFontMgr_custom_empty_factory.cpp",
384 enabled = skia_enable_gpu
387 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
389 # These paths need to be absolute to match the ones produced by shared_sources.gni.
390 sources -= get_path_info([
391 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
392 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
397 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
398 } else if (is_linux) {
399 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
401 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
403 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
404 } else if (is_win && !is_winrt) {
405 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
406 libs += [ "OpenGL32.lib" ]
408 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
411 if (skia_use_vulkan) {
412 public_defines += [ "SK_VULKAN" ]
413 sources += skia_vk_sources
414 if (skia_enable_vulkan_debug_layers) {
415 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
421 enabled = skia_use_libjpeg_turbo
422 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
425 "//third_party/libjpeg-turbo:libjpeg",
428 "src/codec/SkJpegCodec.cpp",
429 "src/codec/SkJpegDecoderMgr.cpp",
430 "src/codec/SkJpegUtility.cpp",
431 "src/images/SkJPEGImageEncoder.cpp",
432 "src/images/SkJPEGWriteUtility.cpp",
437 enabled = skia_use_zlib && skia_enable_pdf
438 public_defines = [ "SK_SUPPORT_PDF" ]
441 "//third_party/zlib",
443 sources = skia_pdf_sources
444 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
446 if (skia_use_sfntly) {
447 deps += [ "//third_party/sfntly" ]
448 public_defines += [ "SK_PDF_USE_SFNTLY" ]
453 enabled = skia_use_libpng
454 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
457 "//third_party/libpng",
460 "src/codec/SkIcoCodec.cpp",
461 "src/codec/SkPngCodec.cpp",
462 "src/images/SkPNGImageEncoder.cpp",
467 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
468 public_defines = [ "SK_CODEC_DECODES_RAW" ]
471 "//third_party/dng_sdk",
472 "//third_party/libjpeg-turbo:libjpeg",
473 "//third_party/piex",
476 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
478 configs_to_remove = [ "//gn:no_exceptions" ]
481 "src/codec/SkRawAdapterCodec.cpp",
482 "src/codec/SkRawCodec.cpp",
486 optional("splicer") {
487 enabled = skia_enable_splicer
488 public_defines = [ "SK_RASTER_PIPELINE_HAS_JIT" ]
491 "src/splicer/SkSplicer.cpp",
495 optional("typeface_freetype") {
496 enabled = skia_use_freetype
499 "//third_party/freetype2",
502 "src/ports/SkFontHost_FreeType.cpp",
503 "src/ports/SkFontHost_FreeType_common.cpp",
508 enabled = skia_use_libwebp
509 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
512 "//third_party/libwebp",
515 "src/codec/SkWebpAdapterCodec.cpp",
516 "src/codec/SkWebpCodec.cpp",
517 "src/images/SkWEBPImageEncoder.cpp",
522 enabled = skia_use_expat
523 public_defines = [ "SK_XML" ]
526 "//third_party/expat",
530 "src/xml/SkXMLParser.cpp",
531 "src/xml/SkXMLWriter.cpp",
536 public_configs = [ ":skia_public" ]
537 configs += skia_library_configs
546 ":fontmgr_fontconfig",
560 ":typeface_freetype",
565 # This file (and all GN files in Skia) are designed to work with an
566 # empty sources assignment filter; we handle all that explicitly.
567 # We clear the filter here for clients who may have set up a global filter.
568 set_sources_assignment_filter([])
571 sources += skia_core_sources
572 sources += skia_effects_sources
573 sources += skia_sksl_sources
574 sources += skia_utils_sources
575 sources += skia_xps_sources
577 "src/android/SkBitmapRegionCodec.cpp",
578 "src/android/SkBitmapRegionDecoder.cpp",
579 "src/codec/SkAndroidCodec.cpp",
580 "src/codec/SkBmpCodec.cpp",
581 "src/codec/SkBmpMaskCodec.cpp",
582 "src/codec/SkBmpRLECodec.cpp",
583 "src/codec/SkBmpStandardCodec.cpp",
584 "src/codec/SkCodec.cpp",
585 "src/codec/SkCodecImageGenerator.cpp",
586 "src/codec/SkGifCodec.cpp",
587 "src/codec/SkMaskSwizzler.cpp",
588 "src/codec/SkMasks.cpp",
589 "src/codec/SkSampledCodec.cpp",
590 "src/codec/SkSampler.cpp",
591 "src/codec/SkStreamBuffer.cpp",
592 "src/codec/SkSwizzler.cpp",
593 "src/codec/SkWbmpCodec.cpp",
594 "src/images/SkImageEncoder.cpp",
595 "src/ports/SkDiscardableMemory_none.cpp",
596 "src/ports/SkGlobalInitialization_default.cpp",
597 "src/ports/SkImageGenerator_skia.cpp",
598 "src/ports/SkMemory_malloc.cpp",
599 "src/ports/SkOSFile_stdio.cpp",
600 "src/sfnt/SkOTTable_name.cpp",
601 "src/sfnt/SkOTUtils.cpp",
602 "src/svg/SkSVGCanvas.cpp",
603 "src/svg/SkSVGDevice.cpp",
604 "src/utils/mac/SkStream_mac.cpp",
605 "third_party/etc1/etc1.cpp",
606 "third_party/gif/SkGifImageReader.cpp",
607 "third_party/ktx/ktx.cpp",
614 "src/fonts/SkFontMgr_indirect.cpp",
615 "src/ports/SkDebug_win.cpp",
616 "src/ports/SkFontMgr_win_dw.cpp",
617 "src/ports/SkImageEncoder_WIC.cpp",
618 "src/ports/SkImageGeneratorWIC.cpp",
619 "src/ports/SkOSFile_win.cpp",
620 "src/ports/SkOSLibrary_win.cpp",
621 "src/ports/SkScalerContext_win_dw.cpp",
622 "src/ports/SkTLS_win.cpp",
623 "src/ports/SkTypeface_win_dw.cpp",
626 sources += [ "src/ports/SkFontHost_win.cpp" ]
629 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
635 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
638 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
647 "src/ports/SkOSFile_posix.cpp",
648 "src/ports/SkOSLibrary_posix.cpp",
649 "src/ports/SkTLS_pthread.cpp",
655 get_path_info("src/utils/win/SkWGL.h", "abspath"),
656 get_path_info("src/utils/win/SkWGL_win.cpp", "abspath"),
661 deps += [ "//third_party/expat" ]
662 if (is_skia_standalone && ndk != "") {
663 deps += [ "//third_party/cpu-features" ]
665 sources += [ "src/ports/SkDebug_android.cpp" ]
679 sources += [ "src/ports/SkDebug_stdio.cpp" ]
684 "src/ports/SkDebug_stdio.cpp",
685 "src/ports/SkFontHost_mac.cpp",
686 "src/ports/SkImageEncoder_CG.cpp",
687 "src/ports/SkImageGeneratorCG.cpp",
690 "ApplicationServices.framework",
697 "src/ports/SkDebug_stdio.cpp",
698 "src/ports/SkFontHost_mac.cpp",
699 "src/ports/SkImageEncoder_CG.cpp",
700 "src/ports/SkImageGeneratorCG.cpp",
703 "CoreFoundation.framework",
704 "CoreGraphics.framework",
705 "CoreText.framework",
707 "MobileCoreServices.framework",
712 sources += [ "src/ports/SkDebug_stdio.cpp" ]
716 # Targets guarded by skia_enable_tools may use //third_party freely.
717 if (skia_enable_tools) {
718 # Used by gn_to_bp.py to list our public include dirs.
719 source_set("public") {
720 configs += [ ":skia_public" ]
723 config("skia.h_config") {
724 include_dirs = [ "$target_gen_dir" ]
727 public_configs = [ ":skia.h_config" ]
728 skia_h = "$target_gen_dir/skia.h"
729 script = "gn/find_headers.py"
730 args = [ rebase_path(skia_h, root_build_dir) ] +
731 rebase_path(skia_public_includes)
732 depfile = "$skia_h.deps"
738 if (skia_enable_gpu && target_cpu == "x64") {
739 # Our bots only have 64-bit libOSMesa installed.
740 # TODO: worth fixing?
741 executable("fiddle") {
748 "tools/fiddle/draw.cpp",
749 "tools/fiddle/fiddle_main.cpp",
758 if (skia_enable_gpu) {
759 source_set("public_headers_warnings_check") {
761 "tools/public_headers_warnings_check.cpp",
763 configs -= [ "//gn:warnings_except_public_headers" ]
771 template("test_lib") {
772 config(target_name + "_config") {
773 include_dirs = invoker.public_include_dirs
774 if (defined(invoker.public_defines)) {
775 defines = invoker.public_defines
778 source_set(target_name) {
779 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
781 ":" + target_name + "_config",
785 if (!defined(deps)) {
793 template("test_app") {
794 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
795 shared_library("lib" + target_name) {
796 forward_variables_from(invoker, "*", [ "is_shared_library" ])
800 _executable = target_name
801 executable(_executable) {
802 forward_variables_from(invoker, "*", [ "is_shared_library" ])
806 if (is_android && skia_android_serial != "" && defined(_executable)) {
807 action("push_" + target_name) {
808 script = "gn/push_to_android.py"
812 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
817 rebase_path("$root_build_dir/$_executable"),
826 test_lib("gpu_tool_utils") {
827 public_include_dirs = []
828 if (skia_enable_gpu) {
830 public_include_dirs += [ "tools/gpu" ]
834 "tools/gpu/GrContextFactory.cpp",
835 "tools/gpu/GrTest.cpp",
836 "tools/gpu/TestContext.cpp",
837 "tools/gpu/gl/GLTestContext.cpp",
838 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
839 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
840 "tools/gpu/gl/debug/GrBufferObj.cpp",
841 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
842 "tools/gpu/gl/debug/GrProgramObj.cpp",
843 "tools/gpu/gl/debug/GrShaderObj.cpp",
844 "tools/gpu/gl/debug/GrTextureObj.cpp",
845 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
846 "tools/gpu/gl/null/NullGLTestContext.cpp",
851 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
853 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
854 libs += [ "OpenGLES.framework" ]
855 } else if (is_linux) {
856 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
858 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
860 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
867 if (skia_use_angle) {
868 deps += [ "//third_party/angle2" ]
869 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
872 public_defines += [ "SK_MESA" ]
873 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
876 if (skia_use_vulkan) {
877 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
883 public_include_dirs = [ "tools/flags" ]
885 "tools/flags/SkCommandLineFlags.cpp",
888 test_lib("common_flags") {
889 public_include_dirs = [ "tools/flags" ]
891 "tools/flags/SkCommonFlags.cpp",
892 "tools/flags/SkCommonFlagsConfig.cpp",
900 test_lib("tool_utils") {
901 public_include_dirs = [
907 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
908 "tools/AndroidSkDebugToStdOut.cpp",
909 "tools/CrashHandler.cpp",
910 "tools/LsanSuppressions.cpp",
911 "tools/ProcStats.cpp",
912 "tools/Resources.cpp",
913 "tools/ThermalManager.cpp",
914 "tools/UrlDataManager.cpp",
915 "tools/debugger/SkDebugCanvas.cpp",
916 "tools/debugger/SkDrawCommand.cpp",
917 "tools/debugger/SkJsonWriteBuffer.cpp",
918 "tools/debugger/SkObjectParser.cpp",
919 "tools/picture_utils.cpp",
920 "tools/random_parse_path.cpp",
921 "tools/sk_tool_utils.cpp",
922 "tools/sk_tool_utils_font.cpp",
923 "tools/timer/Timer.cpp",
928 "//third_party/libpng",
931 "//third_party/jsoncpp",
937 public_include_dirs = [ "gm" ]
947 import("gn/tests.gni")
949 public_include_dirs = [ "tests" ]
950 sources = tests_sources + pathops_tests_sources
951 if (!fontmgr_android_enabled) {
952 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
955 ":experimental_svg_model",
960 "//third_party/libpng",
961 "//third_party/zlib",
965 import("gn/bench.gni")
967 public_include_dirs = [ "bench" ]
968 sources = bench_sources
978 test_lib("experimental_svg_model") {
979 public_include_dirs = [ "experimental/svg/model" ]
981 "experimental/svg/model/SkSVGAttribute.cpp",
982 "experimental/svg/model/SkSVGAttributeParser.cpp",
983 "experimental/svg/model/SkSVGCircle.cpp",
984 "experimental/svg/model/SkSVGClipPath.cpp",
985 "experimental/svg/model/SkSVGContainer.cpp",
986 "experimental/svg/model/SkSVGDOM.cpp",
987 "experimental/svg/model/SkSVGEllipse.cpp",
988 "experimental/svg/model/SkSVGLine.cpp",
989 "experimental/svg/model/SkSVGLinearGradient.cpp",
990 "experimental/svg/model/SkSVGNode.cpp",
991 "experimental/svg/model/SkSVGPath.cpp",
992 "experimental/svg/model/SkSVGPoly.cpp",
993 "experimental/svg/model/SkSVGRect.cpp",
994 "experimental/svg/model/SkSVGRenderContext.cpp",
995 "experimental/svg/model/SkSVGSVG.cpp",
996 "experimental/svg/model/SkSVGShape.cpp",
997 "experimental/svg/model/SkSVGStop.cpp",
998 "experimental/svg/model/SkSVGTransformableNode.cpp",
999 "experimental/svg/model/SkSVGValue.cpp",
1007 public_include_dirs = [ "include/views" ]
1009 "src/views/SkEvent.cpp",
1010 "src/views/SkEventSink.cpp",
1011 "src/views/SkOSMenu.cpp",
1012 "src/views/SkTagList.cpp",
1013 "src/views/SkTouchGesture.cpp",
1014 "src/views/SkView.cpp",
1015 "src/views/SkViewPriv.cpp",
1020 sources += [ "src/views/SkWindow.cpp" ]
1023 public_include_dirs += [ "src/views/unix" ]
1025 "src/views/unix/SkOSWindow_Unix.cpp",
1026 "src/views/unix/keysym2ucs.c",
1028 } else if (is_mac) {
1030 "src/views/mac/SkEventNotifier.mm",
1031 "src/views/mac/SkNSView.mm",
1032 "src/views/mac/SkOSWindow_Mac.mm",
1033 "src/views/mac/SkTextFieldCell.m",
1036 "QuartzCore.framework",
1038 "Foundation.framework",
1040 } else if (is_win) {
1041 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1043 if (skia_use_angle) {
1044 deps += [ "//third_party/angle2" ]
1050 public_include_dirs = []
1052 "src/utils/SkLua.cpp",
1053 "src/utils/SkLuaCanvas.cpp",
1056 "//third_party/lua",
1060 test_app("lua_app") {
1062 "tools/lua/lua_app.cpp",
1067 "//third_party/lua",
1071 test_app("lua_pictures") {
1073 "tools/lua/lua_pictures.cpp",
1080 "//third_party/lua",
1085 import("gn/samples.gni")
1086 test_lib("samples") {
1087 public_include_dirs = [ "samplecode" ]
1088 include_dirs = [ "experimental" ]
1089 sources = samples_sources + [
1090 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1091 "experimental/SkSetPoly3To3.cpp",
1092 "experimental/SkSetPoly3To3_A.cpp",
1093 "experimental/SkSetPoly3To3_D.cpp",
1096 ":experimental_svg_model",
1104 sources += [ "samplecode/SampleLua.cpp" ]
1107 "//third_party/lua",
1115 "dm/DMJsonWriter.cpp",
1118 include_dirs = [ "tests" ]
1121 ":experimental_svg_model",
1128 "//third_party/jsoncpp",
1129 "//third_party/libpng",
1133 if (!is_debug) { # I've benchmarked debug code once too many times...
1134 test_app("monobench") {
1136 "tools/monobench.cpp",
1145 test_app("nanobench") {
1147 "bench/nanobench.cpp",
1152 ":experimental_svg_model",
1158 "//third_party/jsoncpp",
1162 if (is_linux || is_win || is_mac) {
1163 test_app("SampleApp") {
1165 "samplecode/SampleApp.cpp",
1166 "samplecode/SamplePictFile.cpp",
1169 sources += [ "src/views/mac/skia_mac.mm" ]
1170 } else if (is_win) {
1171 sources += [ "src/views/win/skia_win.cpp" ]
1172 } else if (is_linux) {
1173 sources += [ "src/views/unix/skia_unix.cpp" ]
1184 if (skia_use_angle) {
1185 deps += [ "//third_party/angle2" ]
1190 if (skia_enable_gpu) {
1191 test_app("skpbench") {
1193 "tools/skpbench/skpbench.cpp",
1204 # We can't yet build ICU on iOS or Windows.
1205 if (!is_ios && !is_win) {
1206 test_app("sktexttopdf-hb") {
1208 "tools/SkShaper_harfbuzz.cpp",
1209 "tools/using_skia_and_harfbuzz.cpp",
1213 "//third_party/harfbuzz",
1217 test_app("sktexttopdf") {
1219 "tools/SkShaper_primitive.cpp",
1220 "tools/using_skia_and_harfbuzz.cpp",
1227 test_app("get_images_from_skps") {
1229 "tools/get_images_from_skps.cpp",
1234 "//third_party/jsoncpp",
1238 test_app("colorspaceinfo") {
1240 "tools/colorspaceinfo.cpp",
1250 test_app("skiaserve") {
1252 "tools/skiaserve/Request.cpp",
1253 "tools/skiaserve/Response.cpp",
1254 "tools/skiaserve/skiaserve.cpp",
1255 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1256 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1257 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1258 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1259 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1260 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1261 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1262 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1263 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1264 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1265 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
1266 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1267 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1268 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1269 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1276 "//third_party/jsoncpp",
1277 "//third_party/libmicrohttpd",
1278 "//third_party/libpng",
1285 "fuzz/FilterFuzz.cpp",
1286 "fuzz/FuzzDrawFunctions.cpp",
1287 "fuzz/FuzzGradients.cpp",
1288 "fuzz/FuzzParsePath.cpp",
1289 "fuzz/FuzzPathop.cpp",
1290 "fuzz/FuzzScaleToSides.cpp",
1300 test_app("pathops_unittest") {
1301 sources = pathops_tests_sources + [
1302 rebase_path("tests/skia_test.cpp"),
1303 rebase_path("tests/Test.cpp"),
1313 test_app("dump_record") {
1315 "tools/DumpRecord.cpp",
1316 "tools/dump_record.cpp",
1324 test_app("skdiff") {
1326 "tools/skdiff/skdiff.cpp",
1327 "tools/skdiff/skdiff_html.cpp",
1328 "tools/skdiff/skdiff_main.cpp",
1329 "tools/skdiff/skdiff_utils.cpp",
1337 test_app("skp_parser") {
1339 "tools/skp_parser.cpp",
1344 "//third_party/jsoncpp",
1348 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
1349 test_app("viewer") {
1350 is_shared_library = is_android
1352 "tools/viewer/GMSlide.cpp",
1353 "tools/viewer/ImageSlide.cpp",
1354 "tools/viewer/SKPSlide.cpp",
1355 "tools/viewer/SampleSlide.cpp",
1356 "tools/viewer/Viewer.cpp",
1357 "tools/viewer/sk_app/CommandSet.cpp",
1358 "tools/viewer/sk_app/GLWindowContext.cpp",
1359 "tools/viewer/sk_app/Window.cpp",
1360 "tools/viewer/sk_app/WindowContext.cpp",
1366 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1367 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1368 "tools/viewer/sk_app/android/Window_android.cpp",
1369 "tools/viewer/sk_app/android/main_android.cpp",
1370 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1372 } else if (is_linux) {
1374 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1375 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1376 "tools/viewer/sk_app/unix/Window_unix.cpp",
1377 "tools/viewer/sk_app/unix/main_unix.cpp",
1379 } else if (is_win) {
1381 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1382 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1383 "tools/viewer/sk_app/win/Window_win.cpp",
1384 "tools/viewer/sk_app/win/main_win.cpp",
1386 } else if (is_mac) {
1388 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1389 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1390 "tools/viewer/sk_app/mac/Window_mac.cpp",
1391 "tools/viewer/sk_app/mac/main_mac.cpp",
1395 if (skia_use_vulkan) {
1396 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
1399 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1400 libs += [ "android" ]
1401 } else if (is_linux) {
1402 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1403 libs += [ "X11-xcb" ]
1404 } else if (is_win) {
1405 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1418 "//third_party/jsoncpp",
1421 deps += [ "//third_party/native_app_glue" ]
1422 } else if (is_mac) {
1423 deps += [ "//third_party/libsdl" ]
1428 if (is_android && is_skia_standalone && ndk != "") {
1431 "$ndk/$ndk_gdbserver",
1434 "$root_out_dir/gdbserver",
1437 if (ndk_simpleperf != "") {
1438 copy("simpleperf") {
1440 "$ndk/$ndk_simpleperf",
1441 "$ndk/simpleperf/simpleperf_report.py",
1444 "$root_out_dir/{{source_file_part}}",
1450 if (skia_enable_gpu) {
1453 "src/sksl/SkSLMain.cpp",