load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") # This first example only needs the core Skia functionality and the pathops # module. Thus, the client defines a cc_library (skia_core_and_pathops) with # those components and then depending on that library. cc_binary( name = "path_combiner", srcs = ["src/path_main.cpp"], copts = ["-std=c++17"], linkopts = [ "-fuse-ld=lld", "-lpthread", ], deps = [":skia_core_and_pathops"], ) cc_library( name = "skia_core_and_pathops", deps = [ "@skia//:core", "@skia//:pathops", ], ) cc_binary( name = "png_decoder", srcs = ["src/decode_png_main.cpp"], copts = ["-std=c++17"], linkopts = [ "-fuse-ld=lld", "-lpthread", ], deps = [ "@skia//:core", "@skia//:png_decode_codec", ], ) cc_binary( name = "decode_everything", srcs = ["src/decode_everything.cpp"], copts = ["-std=c++17"], linkopts = select({ "@platforms//os:linux": [ "-fuse-ld=lld", "-lpthread", ], "//conditions:default": [], }), deps = [ "@skia//:bmp_decode_codec", "@skia//:core", "@skia//:gif_decode_codec", "@skia//:ico_decode_codec", "@skia//:jpeg_decode_codec", "@skia//:jpegxl_decode_codec", "@skia//:png_decode_codec", "@skia//:wbmp_decode_codec", "@skia//:webp_decode_codec", ], ) cc_binary( name = "write_text_to_png", srcs = ["src/write_text_to_png.cpp"], copts = ["-std=c++17"], linkopts = [ "-fuse-ld=lld", "-lpthread", ], deps = [ "@skia//:core", "@skia//:png_encode_codec", ] + select({ "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"], "@platforms//os:macos": ["@skia//:fontmgr_coretext"], }), ) cc_binary( name = "shape_text", srcs = ["src/shape_text.cpp"], copts = ["-std=c++17"], linkopts = [ "-fuse-ld=lld", "-lpthread", ], deps = [ "@skia//:core", "@skia//:fontmgr_empty_freetype", "@skia//:jpeg_encode_codec", "@skia//:skparagraph_harfbuzz_skunicode", "@skia//:skunicode_icu", ], ) cc_binary( name = "use_ganesh_gl", srcs = ["src/ganesh_gl.cpp"], copts = ["-std=c++17"], linkopts = [ "-lpthread", ] + select( { "@platforms//os:linux": [ "-lGL", "-lX11", ], "//conditions:default": [], }, ), deps = [ "@skia//:core", "@skia//:ganesh_gl", "@skia//:webp_encode_codec", ] + select({ "@platforms//os:linux": ["@skia//:ganesh_glx_factory"], "@platforms//os:macos": [ ":gl_context_helper", "@skia//:ganesh_gl_mac_factory", ], "//conditions:default": ["@platforms//:incompatible"], }), ) objc_library( name = "gl_context_helper", srcs = ["src/gl_context_helper.mm"], hdrs = ["src/gl_context_helper.h"], copts = ["-DGL_SILENCE_DEPRECATION"], includes = ["src"], sdk_frameworks = [ "OpenGL", ], ) cc_binary( name = "use_ganesh_vulkan", srcs = ["src/ganesh_vulkan.cpp"], copts = ["-std=c++17"], linkopts = [ "-lpthread", ], deps = [ "@skia//:core", "@skia//:ganesh_vulkan", ], ) cc_binary( name = "use_ganesh_metal", srcs = ["src/ganesh_metal.cpp"], copts = ["-std=c++17"], target_compatible_with = select({ "@platforms//os:macos": [], "@platforms//os:ios": [], "//conditions:default": ["@platforms//:incompatible"], }), deps = [ ":metal_context_helper", "@skia//:core", "@skia//:ganesh_metal", ], ) objc_library( name = "metal_context_helper", srcs = ["src/metal_context_helper.mm"], hdrs = ["src/metal_context_helper.h"], copts = ["-std=c++17"], includes = ["src"], sdk_frameworks = [ # Without MetalKit added as a dependency, `[*device newCommandQueue]` fails "MetalKit", "Metal", ], target_compatible_with = select({ "@platforms//os:macos": [], "@platforms//os:ios": [], "//conditions:default": ["@platforms//:incompatible"], }), deps = [ "@skia//:core", "@skia//:ganesh_metal", "@skia//:jpeg_encode_codec", ], ) cc_binary( name = "use_skresources", srcs = ["src/use_skresources.cpp"], copts = ["-std=c++17"], linkopts = [ "-lpthread", ], deps = [ "@skia//:core", "@skia//:jpeg_decode_codec", "@skia//:png_decode_codec", "@skia//:skresources", ], ) cc_binary( name = "svg_with_primitive", srcs = ["src/svg_renderer.cpp"], copts = ["-std=c++17"], linkopts = [ "-lpthread", ], deps = [ "@skia//:core", "@skia//:png_encode_codec", "@skia//:skshaper_core", "@skia//:svg_renderer", ] + select({ "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"], "@platforms//os:macos": ["@skia//:fontmgr_coretext"], "//conditions:default": [], }), ) cc_binary( name = "svg_with_harfbuzz", srcs = ["src/svg_renderer.cpp"], copts = ["-std=c++17"], linkopts = [ "-lpthread", ], deps = [ "@skia//:core", "@skia//:png_encode_codec", "@skia//:skshaper_harfbuzz", "@skia//:skshaper_unicode", "@skia//:skunicode_icu", "@skia//:svg_renderer", ] + select({ "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"], "@platforms//os:macos": ["@skia//:fontmgr_coretext"], "//conditions:default": [], }), ) cc_binary( name = "write_to_pdf", srcs = ["src/write_to_pdf.cpp"], copts = ["-std=c++17"], linkopts = [ "-lpthread", ], deps = [ "@skia//:core", "@skia//:pdf_writer", ] + select({ "@platforms//os:linux": ["@skia//:fontmgr_fontconfig_freetype"], "@platforms//os:macos": ["@skia//:fontmgr_coretext"], "//conditions:default": [], }), )